00001 /************************************************************************ 00002 File pdh_heat_problem.h - problem module's types and functions 00003 00004 Contains problem module defines (see below) 00005 00006 Contains definition of types: 00007 pdt_heat_ctrls 00008 pdt_heat_times 00009 pdt_heat_nonls 00010 pdt_heat_linss 00011 pdt_heat_adpts 00012 pdt_heat_problem - aggregates above ones 00013 00014 Procedures: 00015 pdr_heat_problem_clear - clear problem data 00016 pdr_heat_problem_read - read problem data 00017 00018 00019 ------------------------------ 00020 History: 00021 initial version - Krzysztof Banas 00022 2011 - Przemyslaw Plaszewski (pplaszew@agh.edu.pl) 00023 2011 - Aleksander Siwek (Aleksander.Siwek@agh.edu.pl) 00024 2012 - Krzysztof Banas (pobanas@cyf-kr.edu.pl) 00025 *************************************************************************/ 00026 00027 #ifndef PDH_HEAT_PROBLEM 00028 #define PDH_HEAT_PROBLEM 00029 00030 #ifndef ANALYTIC_EXPRESSIONS 00031 #define ANALYTIC_EXPRESSIONS 00032 #endif 00033 00034 #include <stdio.h> 00035 00036 #ifdef __cplusplus 00037 extern "C"{ 00038 #endif 00039 00040 /* problem dependent interface with the PDEs */ 00041 #include "pdh_intf.h" 00042 00043 /* types and functions related to boundary conditions handling */ 00044 #include "pdh_heat_bc.h" 00045 00046 /* types and functions related to materials handling */ 00047 #include "pdh_heat_materials.h" 00048 00049 /**************************************/ 00050 /* DEFINES */ 00051 /**************************************/ 00052 /* Rules: 00053 /* - always uppercase */ 00054 /* - name starts with PDC_ */ 00055 00056 #define PDC_HEAT_MAXEQ 1 00057 #define PDC_HEAT_NREQ 1 00058 00059 #ifdef PHASE_TRANSFORMATION 00060 #define PDC_HEAT_PT_MAXEQ 7 // PDC_MAXEQ & APC_MAXEQ must be >= PDC_HEAT_PT_MAXEQ 00061 #define PDC_HEAT_P_MAXEQ 5 00062 #endif 00063 00064 // PDC_HEAT_SBC - Stefan-Boltzmann constant [W / m^2 K^4] 00065 #define PDC_HEAT_SBC 5.670373E-08 00066 00067 00068 /**************************************/ 00069 /* TYPES */ 00070 /**************************************/ 00071 /* Rules: 00072 /* - type name starts always witn pdt_ */ 00073 00074 /* structure with control parameters */ 00075 00076 #ifndef PHASE_TRANSFORMATION 00077 typedef struct { 00078 /*** GENERIC - DO NOT CHANGE !!! ***/ 00079 char name[300]; /* name (identifier for problem dependent routines) */ 00080 int mesh_id; /* ID of the associated mesh */ 00081 int field_id; /* ID of the associated approximation field */ 00082 int nr_sol; /* number of solution vectors stored by approximation */ 00083 /* module (for time dependent/nonlinear problems) */ 00084 int nreq; /* number of equations (solution components) */ 00085 int solver_id; /* ID of the associated solver */ 00086 // for continuous standard shape functions global base is not used 00087 // int base; /* parameter specifying the type of basis functions */ 00088 /* interpreted by particular approximation modules */ 00089 int pdeg; /* PDEG value for approximation field */ 00090 char mesh_type[2]; 00091 00092 char work_dir[300]; 00093 FILE* interactive_input; 00094 FILE* interactive_output; 00095 char mesh_filename[300]; 00096 char field_filename[300]; 00097 char material_filename[300]; 00098 char bc_filename[300]; 00099 char solver_filename[300]; 00100 char field_dmp_filepattern[50]; 00101 char mesh_dmp_filepattern[50]; 00102 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00103 double penalty; 00104 double ref_temperature; 00105 double ambient_temperature; 00106 double thermal_conductivity; 00107 double density; 00108 double specific_heat; 00109 } pdt_heat_ctrls; 00110 #else 00111 typedef struct { 00112 /*** GENERIC - DO NOT CHANGE !!! ***/ 00113 char name[300]; /* name (identifier for problem dependent routines) */ 00114 int mesh_id; /* ID of the associated mesh */ 00115 int field_id; /* ID of the associated approximation field */ 00116 int nr_sol; /* number of solution vectors stored by approximation */ 00117 /* module (for time dependent/nonlinear problems) */ 00118 int nreq; /* number of equations (solution components) */ 00119 int solver_id; /* ID of the associated solver */ 00120 // for continuous standard shape functions global base is not used 00121 // int base; /* parameter specifying the type of basis functions */ 00122 /* interpreted by particular approximation modules */ 00123 int pdeg[2]; /* PDEG value for approximation field */ 00124 char mesh_type[2]; 00125 00126 char work_dir[300]; 00127 FILE* interactive_input; 00128 FILE* interactive_output; 00129 char mesh_filename[300]; 00130 char field_filename[300]; 00131 char material_filename[300]; 00132 char bc_filename[300]; 00133 char solver_filename[300]; 00134 char field_dmp_filepattern[50]; 00135 char mesh_dmp_filepattern[50]; 00136 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00137 int phase_transformation_field_id; /* ID of the associated approximation field */ 00138 int phase_transformation_nr_sol; /* number of solution vectors stored by approximation */ 00139 /* module (for time dependent/nonlinear problems) */ 00140 int phase_transformation_nreq; /* number of equations (solution components) */ 00141 char phase_transformation_field_filename[300]; 00142 char phase_transformation_field_dmp_filepattern[50]; 00143 00144 int phases_field_id; /* ID of the associated approximation field */ 00145 int phases_nr_sol; /* number of solution vectors stored by approximation */ 00146 /* module (for time dependent/nonlinear problems) */ 00147 int phases_nreq; /* number of equations (solution components) */ 00148 char phases_field_filename[300]; 00149 char phases_field_dmp_filepattern[50]; 00150 00151 double penalty; 00152 double ref_temperature; 00153 double ambient_temperature; 00154 double austenitizing_temperature; 00155 double thermal_conductivity; 00156 double density; 00157 double specific_heat; 00158 int fields_nb; // fields number 00159 } pdt_heat_ctrls; 00160 00164 extern int pdr_phases_transformation(int Problem_id); 00165 00169 extern int pdr_phases_field_init(int Problem_id); 00170 00171 #endif 00172 00173 /* structure with time integration parameters */ 00174 typedef struct { 00175 /*** GENERIC - DO NOT CHANGE !!! ***/ 00176 int type; /* type of time integration scheme */ 00177 /* 0 - no time integration */ 00178 /* 1 - alpha scheme */ 00179 double alpha; /* implicitnes parameter alpha */ 00180 00181 int cur_step; /* current time-step number */ 00182 double cur_time; /* current time */ 00183 double cur_dtime; /* current time-step length */ 00184 double prev_dtime; /* previous time-step length */ 00185 00186 int final_step; /* time-step number to stop simulation */ 00187 double final_time; /* time to stop simulation */ 00188 00189 int conv_type; /* convergence criterion number */ 00190 double conv_meas; /* convergence measure */ 00191 int monitor; /* monitoring level: */ 00192 /* PDC_SILENT 0 */ 00193 /* PDC_ERRORS 1 */ 00194 /* PDC_INFO 2 */ 00195 /* PDC_ALLINFO 3 */ 00196 int intv_dumpout; /* interval (in time steps) for dumping out data */ 00197 int intv_graph; /* interval (in time steps) for graphics output */ 00198 int graph_accu; /* auto graphics dumpout accuracy */ 00199 00200 00201 int time_step_length_nonl_control; // indicator (0/1) of time step adaptivity 00202 // based on the convergence of non-linear solution 00203 int time_step_length_nonl_iter_max; 00204 // the number of non-linear iterations for which time step 00205 // length is decreased (0 for non-decreasing time-step) 00206 int time_step_length_nonl_iter_min; 00207 // the number of non-linear iterations for which time step 00208 // length is increased (0 for non-increasing time-step) 00209 double time_step_length_nonl_iter_increase_mult; // multiplier 00210 double time_step_length_nonl_iter_decrease_mult; // multiplier 00211 double time_step_length_min, 00212 time_step_length_max, 00213 time_step_length_min_norm, 00214 time_step_length_max_norm; 00215 00216 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00217 // CFL control - removed, see ns_supg for possible implementation 00218 } pdt_heat_times; 00219 00220 /* structure with nonlinear solver control parameters */ 00221 typedef struct { 00222 /*** GENERIC - DO NOT CHANGE !!! ***/ 00223 int type; /* method identifier */ 00224 /* 0 - problem is linear */ 00225 int max_iter; /* maximal iteration number */ 00226 int conv_type; /* convergence criterion number */ 00227 double conv_meas; /* convergence measure */ 00228 int monitor; /* monitoring level: */ 00229 /* PDC_SILENT 0 */ 00230 /* PDC_ERRORS 1 */ 00231 /* PDC_INFO 2 */ 00232 /* PDC_ALLINFO 3 */ 00233 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00234 } pdt_heat_nonls; 00235 00236 /* structure with linear solver control parameters */ 00237 typedef struct { 00238 /*** GENERIC - DO NOT CHANGE !!! ***/ 00239 int type; /* method identifier */ 00240 /* 0 - direct solver (?) */ 00241 /* 1 - precondittioned GMRES */ 00242 /* 2 - multigrid preconditioned GMRES */ 00243 /* 10 - standard iterations */ 00244 /* 20 - V-cycle multigrid */ 00245 int max_iter; /* maximal iteration number */ 00246 int conv_type; /* convergence criterion number */ 00247 /* 0 - relative to initial residual */ 00248 /* 1 - absolute residual */ 00249 /* 2 - relative to rhs */ 00250 double conv_meas; /* convergence measure */ 00251 int monitor; /* monitoring level: */ 00252 /* PDC_SILENT 0 */ 00253 /* PDC_ERRORS 1 */ 00254 /* PDC_INFO 2 */ 00255 /* PDC_ALLINFO 3 */ 00256 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00257 } pdt_heat_linss; 00258 00259 /* structure with adaptation parameters */ 00260 typedef struct { 00261 /*** GENERIC - DO NOT CHANGE !!! ***/ 00262 int type; /* strategy number for adaptation */ 00263 int interval; /* number of time steps between adaptations */ 00264 int maxgen; /* maximum generation level for elements */ 00265 double eps; /* coefficient for choosing elements to adapt */ 00266 double ratio; /* ratio of errors for derefinements */ 00267 int monitor; /* monitoring level: */ 00268 /* PDC_SILENT 0 */ 00269 /* PDC_ERRORS 1 */ 00270 /* PDC_INFO 2 */ 00271 /* PDC_ALLINFO 3 */ 00272 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00273 } pdt_heat_adpts; 00274 00275 00276 /* problem definition data structure */ 00277 typedef struct { 00278 pdt_heat_ctrls ctrl; /* structure with control parameters */ 00279 pdt_heat_times time; /* structure with time integration parameters */ 00280 pdt_heat_nonls nonl; /* structure with nonlinear solver parameters */ 00281 pdt_heat_linss lins; /* structure with linear solver parameters */ 00282 pdt_heat_adpts adpt; /* structure with adaptation parameters */ 00283 //pdt_heat_materials materials; /* main structure containing materials data */ 00284 pdt_heat_bc bc; /* main structure containing bc data */ 00285 } pdt_heat_problem; 00286 00287 00291 extern int pdr_heat_problem_clear(pdt_heat_problem *Problem); 00292 00293 00297 extern int pdr_heat_problem_read( 00298 char *Work_dir, 00299 char *Filename, 00300 FILE *Interactive_output, 00301 pdt_heat_problem *Problem, 00302 int Nr_sol // nr_sol is time integration dependent - specified by main 00303 ); 00304 00305 #ifdef __cplusplus 00306 } 00307 #endif 00308 00309 #endif