00001 /************************************************************************ 00002 File pdh_conv_diff_problem.h - problem module's type 00003 00004 Contains problem module defines (see below) 00005 00006 Contains definition of types: 00007 pdt_conv_diff_ctrls 00008 pdt_conv_diff_times 00009 pdt_conv_diff_nonls 00010 pdt_conv_diff_linss 00011 pdt_conv_diff_adpts 00012 pdt_conv_diff_problem - aggregates above ones 00013 00014 ------------------------------ 00015 History: 00016 initial version - Krzysztof Banas 00017 2011 - Przemyslaw Plaszewski (pplaszew@agh.edu.pl) 00018 2011 - Aleksander Siwek (Aleksander.Siwek@agh.edu.pl) 00019 2012 - Krzysztof Banas (pobanas@cyf-kr.edu.pl) 00020 *************************************************************************/ 00021 00022 #ifndef PDH_CONV_DIFF_PROBLEM 00023 #define PDH_CONV_DIFF_PROBLEM 00024 00025 #include <stdio.h> 00026 00027 #ifdef __cplusplus 00028 extern "C" 00029 { 00030 #endif 00031 00032 /* USED AND IMPLEMENTED PROBLEM DEPENDENT DATA STRUCTURES AND INTERFACES */ 00033 00034 /* problem dependent interface with the PDEs */ 00035 #include "pdh_intf.h" 00036 00037 /* types and functions related to boundary conditions handling */ 00038 //#include "pdh_conv_diff_bc.h" 00039 00040 /* types and functions related to materials handling */ 00041 //#include "pdh_conv_diff_materials.h" 00042 00043 00044 /**************************************/ 00045 /* DEFINES */ 00046 /**************************************/ 00047 /* Rules: 00048 /* - always uppercase */ 00049 /* - name starts with PDC_ */ 00050 00051 // maximal number of equations (solution components) in component modules 00052 #define PDC_CONV_DIFF_MAXEQ 1 00053 #define PDC_CONV_DIFF_NREQ 1 00054 00055 #define PDC_CONV_DIFF_NR_SOL 2 00056 00057 #define PDC_CONV_DIFF_MAX_NUM_PROB 10 00058 #define PDC_CONV_DIFF_MAX_NUM_MAT 10 00059 #define PDC_CONV_DIFF_MAX_BC_VAL 10 00060 00061 00062 /**************************************/ 00063 /* TYPES */ 00064 /**************************************/ 00065 /* Rules: 00066 /* - type name starts always witn pdt_ */ 00067 00068 /* structure with control parameters */ 00069 typedef struct { 00070 /*** GENERIC - DO NOT CHANGE !!! ***/ 00071 char name[300]; /* name (identifier of the problem solved) */ 00072 int mesh_id; /* ID of the associated mesh */ 00073 int field_id; /* ID of the associated approximation field */ 00074 int nr_sol; /* number of solution vectors stored by approximation */ 00075 /* module (for time dependent/nonlinear problems) */ 00076 int nreq; /* number of equations (solution components) */ 00077 int solver_id; /* ID of the associated solver */ 00078 // for continuous basis functions problem->ctrl.base is not used 00079 int base; /* parameter specifying the type of basis functions */ 00080 /* interpreted by particular approximation modules */ 00081 char mesh_type[2]; 00082 00083 char work_dir[300]; 00084 FILE* interactive_input; 00085 FILE* interactive_output; 00086 char mesh_filename[300]; 00087 char field_filename[300]; 00088 char material_filename[300]; 00089 char bc_filename[300]; 00090 char solver_filename[300]; 00091 char field_dmp_filepattern[50]; 00092 char mesh_dmp_filepattern[50]; 00093 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00094 int slope; /* slope limiter: */ 00095 /* 1 - active */ 00096 /* 0 - not active */ 00097 double penalty; // for boundary conditions 00098 // IN THE CURRENT VERSION - SHOULD BE MODIFIED FOR MORE GENERAL SETTING 00099 double **bc_val; /* array of pointers to values of boundary conditions */ 00100 double **ic_val; /* array of pointers to values of initial conditions */ 00101 } pdt_conv_diff_ctrls; 00102 00103 /* structure with time integration parameters */ 00104 typedef struct { 00105 /*** GENERIC - DO NOT CHANGE !!! ***/ 00106 int type; /* type of time integration scheme */ 00107 /* 0 - no time integration */ 00108 /* 1 - alpha (a.k.a. theta) scheme */ 00109 double alpha; /* implicitnes parameter alpha (a.k.a. theta)*/ 00110 00111 int cur_step; /* current time-step number */ 00112 double cur_time; /* current time */ 00113 double cur_dtime; /* current time-step length */ 00114 double prev_dtime; /* previous time-step length */ 00115 00116 int final_step; /* time-step number to stop simulation */ 00117 double final_time; /* time to stop simulation */ 00118 00119 int conv_type; /* convergence criterion number */ 00120 double conv_meas; /* convergence measure */ 00121 int monitor; /* monitoring level: */ 00122 /* PDC_SILENT 0 */ 00123 /* PDC_ERRORS 1 */ 00124 /* PDC_INFO 2 */ 00125 /* PDC_ALLINFO 3 */ 00126 int intv_dumpout; /* interval (in time steps) for dumping out data */ 00127 int intv_graph; /* interval (in time steps) for graphics output */ 00128 int graph_accu; /* auto graphics dumpout accuracy */ 00129 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00130 int CFL_control; 00131 double CFL_limit; 00132 double time_step_length_mult; 00133 double reference_time_step_length; 00134 } pdt_conv_diff_times; 00135 00136 /* structure with nonlinear solver control parameters */ 00137 typedef struct { 00138 /*** GENERIC - DO NOT CHANGE !!! ***/ 00139 int type; /* method identifier */ 00140 /* 0 - problem is linear */ 00141 int max_iter; /* maximal iteration number */ 00142 int conv_type; /* convergence criterion number */ 00143 double conv_meas; /* convergence measure */ 00144 int monitor; /* monitoring level: */ 00145 /* PDC_SILENT 0 */ 00146 /* PDC_ERRORS 1 */ 00147 /* PDC_INFO 2 */ 00148 /* PDC_ALLINFO 3 */ 00149 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00150 } pdt_conv_diff_nonls; 00151 00152 /* structure with linear solver control parameters */ 00153 typedef struct { 00154 /*** GENERIC - DO NOT CHANGE !!! ***/ 00155 int type; /* method identifier */ 00156 /* 0 - direct solver (?) */ 00157 /* 1 - precondittioned GMRES */ 00158 /* 2 - multigrid preconditioned GMRES */ 00159 /* 10 - standard iterations */ 00160 /* 20 - V-cycle multigrid */ 00161 int max_iter; /* maximal iteration number */ 00162 int conv_type; /* convergence criterion number */ 00163 /* 0 - relative to initial residual */ 00164 /* 1 - absolute residual */ 00165 /* 2 - relative to rhs */ 00166 double conv_meas; /* convergence measure */ 00167 int monitor; /* monitoring level: */ 00168 /* PDC_SILENT 0 */ 00169 /* PDC_ERRORS 1 */ 00170 /* PDC_INFO 2 */ 00171 /* PDC_ALLINFO 3 */ 00172 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00173 } pdt_conv_diff_linss; 00174 00175 /* structure with adaptation parameters */ 00176 typedef struct { 00177 /*** GENERIC - DO NOT CHANGE !!! ***/ 00178 int type; /* strategy number for adaptation */ 00179 int interval; /* number of time steps between adaptations */ 00180 int maxgen; /* maximum generation level for elements */ 00181 double eps; /* coefficient for choosing elements to adapt */ 00182 double ratio; /* ratio of errors for derefinements */ 00183 int monitor; /* monitoring level: */ 00184 /* PDC_SILENT 0 */ 00185 /* PDC_ERRORS 1 */ 00186 /* PDC_INFO 2 */ 00187 /* PDC_ALLINFO 3 */ 00188 /*** PROBLEM SPECIFIC - CAN BE MODIFIED ***/ 00189 int maxgendiff; /* maximum difference of generation levels */ 00190 /* for neighboring elements - can be used for DG*/ 00191 } pdt_conv_diff_adpts; 00192 00193 /* problem definition data structure */ 00194 typedef struct { 00195 pdt_conv_diff_ctrls ctrl; /* structure with control parameters */ 00196 pdt_conv_diff_times time; /* structure with time integration parameters */ 00197 pdt_conv_diff_nonls nonl; /* structure with nonlinear solver parameters */ 00198 pdt_conv_diff_linss lins; /* structure with linear solver parameters */ 00199 pdt_conv_diff_adpts adpt; /* structure with adaptation parameters */ 00200 // MUST BE INCLUDED IN FUTURE RELEASES 00201 // pdt_conv_diff_materials materials; /* structure containing materials data */ 00202 // pdt_conv_diff_bc bc; /* structure containing bc data */ 00203 } pdt_conv_diff_problem; 00204 00205 00209 extern int pdr_conv_diff_problem_clear(pdt_conv_diff_problem *Problem); 00210 00214 extern int pdr_conv_diff_problem_read( 00215 char *Work_dir, 00216 char *Filename, 00217 FILE *Interactive_output, 00218 pdt_conv_diff_problem *Problem, 00219 int Nr_sol // nr_sol is time integration dependent - specified by main 00220 ); 00221 00225 int pdr_conv_diff_problem_write( 00226 char *Work_dir, 00227 char *Filename, 00228 FILE *Interactive_output, 00229 pdt_conv_diff_problem *Problem, 00230 int Nr_sol // nr_sol is time integration dependent - specified by main 00231 ); 00232 00233 #ifdef __cplusplus 00234 } 00235 #endif 00236 00237 #endif