00001 /************************************************************************ 00002 File pdh_ns_supg_problem.h - problem module's type 00003 00004 Contains problem module defines (see below) 00005 00006 Contains definition of types: 00007 pdt_ns_supg_ctrls 00008 pdt_ns_supg_times 00009 pdt_ns_supg_nonls 00010 pdt_ns_supg_linss 00011 pdt_ns_supg_adpts 00012 pdt_ns_supg_problem - aggregates above ones 00013 00014 Procedures: 00015 pdr_ns_supg_problem_clear - clear problem data 00016 pdr_ns_supg_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_SUPG_PROBLEM 00027 #define PDH_NS_SUPG_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_supg_bc.h" 00036 00037 /* types and functions related to materials handling */ 00038 #include "pdh_ns_supg_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_SUPG_MAXEQ 4 00056 #define PDC_NS_SUPG_NREQ 4 00057 00058 00059 /**************************************/ 00060 /* TYPES */ 00061 /**************************************/ 00062 /* Rules: 00063 /* - type name starts always witn pdt_ */ 00064 00065 /* structure with control parameters */ 00066 typedef struct { 00067 /*** GENERIC - DO NOT CHANGE !!! ***/ 00068 char name[300]; /* name */ 00069 int mesh_id; /* ID of the associated mesh */ 00070 int field_id; /* ID of the associated approximation field */ 00071 int nr_sol; /* number of solution vectors stored by approximation */ 00072 /* module (for time dependent/nonlinear problems) */ 00073 int nreq; /* number of equations (solution components) */ 00074 int solver_id; /* ID of the associated solver */ 00075 // for continuous basis functions problem->ctrl.base is not used 00076 //int base; /* parameter specifying the type of basis functions */ 00077 /* interpreted by particular approximation modules */ 00078 int pdeg; /* PDEG value for approximation field */ 00079 char mesh_type[2]; 00080 00081 char work_dir[300]; 00082 FILE* interactive_input; 00083 FILE* interactive_output; 00084 char mesh_filename[300]; 00085 char field_filename[300]; 00086 char material_filename[300]; 00087 char bc_filename[300]; 00088 char solver_filename[300]; 00089 char field_dmp_filepattern[50]; 00090 char mesh_dmp_filepattern[50]; 00091 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00092 double penalty; // for boundary conditions 00093 double gravity_field[3]; 00094 double ref_temperature; // if <=0 - constant density and viscosity are used 00095 double density; //material property (this value used only for ref_temperature <=0 ) 00096 double dynamic_viscosity; //material property (this value used only for ref_temperature <=0 ) 00097 double ref_length; // should match problem definition 00098 double ref_velocity; // should match problem definition 00099 //double reynolds_number; // never specified, always computed 00100 utt_err_code error_indicator; // for e.g. backwater 00101 double final_velocity_mag; 00102 } pdt_ns_supg_ctrls; 00103 00104 /* structure with time integration parameters */ 00105 typedef struct { 00106 /*** GENERIC - DO NOT CHANGE !!! ***/ 00107 int type; /* type of time integration scheme */ 00108 /* 0 - no time integration */ 00109 /* 1 - alpha (a.k.a. theta) scheme */ 00110 double alpha; /* implicitnes parameter alpha (a.k.a. theta)*/ 00111 00112 int cur_step; /* current time-step number */ 00113 double cur_time; /* current time */ 00114 double cur_dtime; /* current time-step length */ 00115 double prev_dtime; /* previous time-step length */ 00116 00117 int final_step; /* time-step number to stop simulation */ 00118 double final_time; /* time to stop simulation */ 00119 00120 int conv_type; /* convergence criterion number */ 00121 double conv_meas; /* convergence measure */ 00122 int monitor; /* monitoring level: */ 00123 /* PDC_SILENT 0 */ 00124 /* PDC_ERRORS 1 */ 00125 /* PDC_INFO 2 */ 00126 /* PDC_ALLINFO 3 */ 00127 int intv_dumpout; /* interval (in time steps) for dumping out data */ 00128 int intv_graph; /* interval (in time steps) for graphics output */ 00129 int graph_accu; /* auto graphics dumpout accuracy */ 00130 00131 int time_step_length_nonl_control; // indicator (0/1) of time step adaptivity 00132 // based on the convergence of non-linear solution 00133 int time_step_length_nonl_iter_max; // the number of non-linear iterations above which 00134 // time step length is decreased (0 for non-decreasing time-step) 00135 int time_step_length_nonl_iter_min; // the number of non-linear iterations below which 00136 // time step length is increased (0 for non-increasing time-step) 00137 double time_step_length_nonl_iter_increase_mult; 00138 double time_step_length_nonl_iter_decrease_mult; 00139 double time_step_length_min, 00140 time_step_length_max, 00141 time_step_length_min_norm, 00142 time_step_length_max_norm; 00143 00144 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00145 int CFL_control; 00146 double CFL_limit_max; 00147 double CFL_limit_min; 00148 double CFL_time_step_length_increase_mult; 00149 double CFL_time_step_length_decrease_mult; 00150 00151 } pdt_ns_supg_times; 00152 00153 /* structure with nonlinear solver control parameters */ 00154 typedef struct { 00155 /*** GENERIC - DO NOT CHANGE !!! ***/ 00156 int type; /* method identifier */ 00157 /* 0 - problem is linear */ 00158 int max_iter; /* maximal iteration number */ 00159 int conv_type; /* convergence criterion number */ 00160 double conv_meas; /* convergence measure */ 00161 int monitor; /* monitoring level: */ 00162 /* PDC_SILENT 0 */ 00163 /* PDC_ERRORS 1 */ 00164 /* PDC_INFO 2 */ 00165 /* PDC_ALLINFO 3 */ 00166 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00167 } pdt_ns_supg_nonls; 00168 00169 /* structure with linear solver control parameters */ 00170 typedef struct { 00171 /*** GENERIC - DO NOT CHANGE !!! ***/ 00172 int type; /* method identifier */ 00173 /* 0 - direct solver (?) */ 00174 /* 1 - precondittioned GMRES */ 00175 /* 2 - multigrid preconditioned GMRES */ 00176 /* 10 - standard iterations */ 00177 /* 20 - V-cycle multigrid */ 00178 int max_iter; /* maximal iteration number */ 00179 int conv_type; /* convergence criterion number */ 00180 /* 0 - relative to initial residual */ 00181 /* 1 - absolute residual */ 00182 /* 2 - relative to rhs */ 00183 double conv_meas; /* convergence measure */ 00184 int monitor; /* monitoring level: */ 00185 /* PDC_SILENT 0 */ 00186 /* PDC_ERRORS 1 */ 00187 /* PDC_INFO 2 */ 00188 /* PDC_ALLINFO 3 */ 00189 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00190 } pdt_ns_supg_linss; 00191 00192 /* structure with adaptation parameters */ 00193 typedef struct { 00194 /*** GENERIC - DO NOT CHANGE !!! ***/ 00195 int type; /* strategy number for adaptation */ 00196 int interval; /* number of time steps between adaptations */ 00197 int maxgen; /* maximum generation level for elements */ 00198 double eps; /* coefficient for choosing elements to adapt */ 00199 double ratio; /* ratio of errors for derefinements */ 00200 int monitor; /* monitoring level: */ 00201 /* PDC_SILENT 0 */ 00202 /* PDC_ERRORS 1 */ 00203 /* PDC_INFO 2 */ 00204 /* PDC_ALLINFO 3 */ 00205 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00206 } pdt_ns_supg_adpts; 00207 00208 /* problem definition data structure */ 00209 typedef struct { 00210 pdt_ns_supg_ctrls ctrl; /* structure with control parameters */ 00211 pdt_ns_supg_times time; /* structure with time integration parameters */ 00212 pdt_ns_supg_nonls nonl; /* structure with nonlinear solver parameters */ 00213 pdt_ns_supg_linss lins; /* structure with linear solver parameters */ 00214 pdt_ns_supg_adpts adpt; /* structure with adaptation parameters */ 00215 //pdt_ns_supg_materials materials; /* structure containing materials data */ 00216 pdt_ns_supg_bc bc; /* structure containing bc data */ 00217 } pdt_ns_supg_problem; 00218 00219 00223 extern int pdr_ns_supg_problem_clear(pdt_ns_supg_problem *Problem); 00224 00228 extern int pdr_ns_supg_problem_read( 00229 char *Work_dir, 00230 char *Filename, 00231 FILE *Interactive_output, 00232 pdt_ns_supg_problem *Problem, 00233 int Nr_sol // nr_sol is time integration dependent - specified by main 00234 ); 00235 00236 #ifdef __cplusplus 00237 } 00238 #endif 00239 00240 #endif