00001 /************************************************************************ 00002 File pdh_ns_mixed_problem.h - problem module's type 00003 00004 Contains problem module defines (see below) 00005 00006 Contains definition of types: 00007 pdt_ns_mixed_ctrls 00008 pdt_ns_mixed_times 00009 pdt_ns_mixed_nonls 00010 pdt_ns_mixed_linss 00011 pdt_ns_mixed_adpts 00012 pdt_ns_mixed_problem - aggregates above ones 00013 00014 Procedures: 00015 pdr_ns_mixed_problem_clear - clear problem data 00016 pdr_ns_mixed_problem_read - read problem data 00017 00018 ------------------------------ 00019 History: 00020 initial version - Krzysztof Banas 00021 2011 - Przemyslaw Plaszewski (pplaszew@agh.edu.pl) 00022 2011 - Aleksander Siwek (Aleksander.Siwek@agh.edu.pl) 00023 2012 - Krzysztof Banas (pobanas@cyf-kr.edu.pl) 00024 *************************************************************************/ 00025 00026 #ifndef PDH_NS_MIXED_PROBLEM 00027 #define PDH_NS_MIXED_PROBLEM 00028 00029 #include <stdio.h> 00030 00031 /* problem dependent interface with the PDEs */ 00032 #include "pdh_intf.h" 00033 00034 /* types and functions related to boundary conditions handling */ 00035 #include "pdh_ns_mixed_bc.h" 00036 00037 /* types and functions related to materials handling */ 00038 #include "pdh_ns_mixed_materials.h" 00039 00040 #include "uth_err.h" 00041 00042 #ifdef __cplusplus 00043 extern "C" 00044 { 00045 #endif 00046 00047 /**************************************/ 00048 /* DEFINES */ 00049 /**************************************/ 00050 /* Rules: 00051 /* - always uppercase */ 00052 /* - name starts with PDC_ */ 00053 00054 // maximal number of equations (solution components) in component modules 00055 #define PDC_NS_MIXED_MAXEQ 4 00056 #define PDC_NS_MIXED_NREQ 4 00057 #define PDC_NS_MIXED_PRIMARY_FIELD_NREQ 3 00058 #define PDC_NS_MIXED_SECONDARY_FIELD_NREQ 1 00059 00060 /**************************************/ 00061 /* TYPES */ 00062 /**************************************/ 00063 /* Rules: 00064 /* - type name starts always witn pdt_ */ 00065 00066 /* structure with control parameters */ 00067 typedef struct { 00068 /*** GENERIC - DO NOT CHANGE !!! ***/ 00069 char name[300]; /* name */ 00070 int mesh_id; /* ID of the associated mesh */ 00071 int primary_field_id; /* ID of the associated PRIMARY approximation field */ 00072 int secondary_field_id; /* ID of the associated SECONDARY approximation field */ 00073 int nr_sol; /* number of solution vectors stored by approximation */ 00074 /* module (for time dependent/nonlinear problems) */ 00075 int nreq[3]; /* number of equations (solution components) 00076 nreq[0] - total number of equations 00077 nreq[1] - number of equations for PRIMARY field 00078 nreq[2] - number of equations for SECONDARY field */ 00079 int solver_id; /* ID of the associated solver */ 00080 // for continuous basis functions problem->ctrl.base is not used 00081 //int base; /* parameter specifying the type of basis functions */ 00082 /* interpreted by particular approximation modules */ 00083 int pdeg[3]; /* PDEG value for approximation field 00084 pdeg[0] - PDEG value 00085 pdeg[1] - PDEG value of PRIMARY field 00086 pdeg[2] - PDEG value of SECONDARY field */ 00087 char mesh_type[2]; 00088 00089 char work_dir[300]; 00090 FILE* interactive_input; 00091 FILE* interactive_output; 00092 char mesh_filename[300]; 00093 char field_filename[300]; 00094 char material_filename[300]; 00095 char bc_filename[300]; 00096 char solver_filename[300]; 00097 char field_dmp_filepattern[50]; 00098 char mesh_dmp_filepattern[50]; 00099 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00100 double penalty; // for boundary conditions 00101 double gravity_field[3]; 00102 double ref_temperature; // if <=0 - constant density and viscosity are used 00103 double density; //material property (this value used only for ref_temperature <=0 ) 00104 double dynamic_viscosity; //material property (this value used only for ref_temperature <=0 ) 00105 double ref_length; // should match problem definition 00106 double ref_velocity; // should match problem definition 00107 //double reynolds_number; // never specified, always computed 00108 utt_err_code error_indicator; // for e.g. backwater 00109 double final_velocity_mag; 00110 } pdt_ns_mixed_ctrls; 00111 00112 /* structure with time integration parameters */ 00113 typedef struct { 00114 /*** GENERIC - DO NOT CHANGE !!! ***/ 00115 int type; /* type of time integration scheme */ 00116 /* 0 - no time integration */ 00117 /* 1 - alpha (a.k.a. theta) scheme */ 00118 double alpha; /* implicitnes parameter alpha (a.k.a. theta)*/ 00119 00120 int cur_step; /* current time-step number */ 00121 double cur_time; /* current time */ 00122 double cur_dtime; /* current time-step length */ 00123 double prev_dtime; /* previous time-step length */ 00124 00125 int final_step; /* time-step number to stop simulation */ 00126 double final_time; /* time to stop simulation */ 00127 00128 int conv_type; /* convergence criterion number */ 00129 double conv_meas; /* convergence measure */ 00130 int monitor; /* monitoring level: */ 00131 /* PDC_SILENT 0 */ 00132 /* PDC_ERRORS 1 */ 00133 /* PDC_INFO 2 */ 00134 /* PDC_ALLINFO 3 */ 00135 int intv_dumpout; /* interval (in time steps) for dumping out data */ 00136 int intv_graph; /* interval (in time steps) for graphics output */ 00137 int graph_accu; /* auto graphics dumpout accuracy */ 00138 00139 int time_step_length_nonl_control; // indicator (0/1) of time step adaptivity 00140 // based on the convergence of non-linear solution 00141 int time_step_length_nonl_iter_max; // the number of non-linear iterations above which 00142 // time step length is decreased (0 for non-decreasing time-step) 00143 int time_step_length_nonl_iter_min; // the number of non-linear iterations below which 00144 // time step length is increased (0 for non-increasing time-step) 00145 double time_step_length_nonl_iter_increase_mult; 00146 double time_step_length_nonl_iter_decrease_mult; 00147 double time_step_length_min, 00148 time_step_length_max, 00149 time_step_length_min_norm, 00150 time_step_length_max_norm; 00151 00152 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00153 int CFL_control; 00154 double CFL_limit_max; 00155 double CFL_limit_min; 00156 double CFL_time_step_length_increase_mult; 00157 double CFL_time_step_length_decrease_mult; 00158 00159 } pdt_ns_mixed_times; 00160 00161 /* structure with nonlinear solver control parameters */ 00162 typedef struct { 00163 /*** GENERIC - DO NOT CHANGE !!! ***/ 00164 int type; /* method identifier */ 00165 /* 0 - problem is linear */ 00166 int max_iter; /* maximal iteration number */ 00167 int conv_type; /* convergence criterion number */ 00168 double conv_meas; /* convergence measure */ 00169 int monitor; /* monitoring level: */ 00170 /* PDC_SILENT 0 */ 00171 /* PDC_ERRORS 1 */ 00172 /* PDC_INFO 2 */ 00173 /* PDC_ALLINFO 3 */ 00174 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00175 } pdt_ns_mixed_nonls; 00176 00177 /* structure with linear solver control parameters */ 00178 typedef struct { 00179 /*** GENERIC - DO NOT CHANGE !!! ***/ 00180 int type; /* method identifier */ 00181 /* 0 - direct solver (?) */ 00182 /* 1 - precondittioned GMRES */ 00183 /* 2 - multigrid preconditioned GMRES */ 00184 /* 10 - standard iterations */ 00185 /* 20 - V-cycle multigrid */ 00186 int max_iter; /* maximal iteration number */ 00187 int conv_type; /* convergence criterion number */ 00188 /* 0 - relative to initial residual */ 00189 /* 1 - absolute residual */ 00190 /* 2 - relative to rhs */ 00191 double conv_meas; /* convergence measure */ 00192 int monitor; /* monitoring level: */ 00193 /* PDC_SILENT 0 */ 00194 /* PDC_ERRORS 1 */ 00195 /* PDC_INFO 2 */ 00196 /* PDC_ALLINFO 3 */ 00197 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00198 } pdt_ns_mixed_linss; 00199 00200 /* structure with adaptation parameters */ 00201 typedef struct { 00202 /*** GENERIC - DO NOT CHANGE !!! ***/ 00203 int type; /* strategy number for adaptation */ 00204 int interval; /* number of time steps between adaptations */ 00205 int maxgen; /* maximum generation level for elements */ 00206 double eps; /* coefficient for choosing elements to adapt */ 00207 double ratio; /* ratio of errors for derefinements */ 00208 int monitor; /* monitoring level: */ 00209 /* PDC_SILENT 0 */ 00210 /* PDC_ERRORS 1 */ 00211 /* PDC_INFO 2 */ 00212 /* PDC_ALLINFO 3 */ 00213 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00214 } pdt_ns_mixed_adpts; 00215 00216 /* problem definition data structure */ 00217 typedef struct { 00218 pdt_ns_mixed_ctrls ctrl; /* structure with control parameters */ 00219 pdt_ns_mixed_times time; /* structure with time integration parameters */ 00220 pdt_ns_mixed_nonls nonl; /* structure with nonlinear solver parameters */ 00221 pdt_ns_mixed_linss lins; /* structure with linear solver parameters */ 00222 pdt_ns_mixed_adpts adpt; /* structure with adaptation parameters */ 00223 //pdt_ns_mixed_materials materials; /* structure containing materials data */ 00224 pdt_ns_mixed_bc bc; /* structure containing bc data */ 00225 } pdt_ns_mixed_problem; 00226 00227 00231 extern int pdr_ns_mixed_problem_clear(pdt_ns_mixed_problem *Problem); 00232 00236 extern int pdr_ns_mixed_problem_read( 00237 char *Work_dir, 00238 char *Filename, 00239 FILE *Interactive_output, 00240 pdt_ns_mixed_problem *Problem, 00241 int Nr_sol // nr_sol is time integration dependent - specified by main 00242 ); 00243 00244 #ifdef __cplusplus 00245 } 00246 #endif 00247 00248 #endif