00001 /************************************************************************ 00002 File pdh_conv_diff.h - internal information for problem dependent module 00003 for solving convection-diffusion equations 00004 00005 Contains declarations of constants and interface routines: 00006 00007 pdr_time_integration - time integration driver (in time integration) 00008 pdr_adapt - to enforce adaptation strategy for a given problem (in adapt) 00009 00010 in pds_conv_diff_util.c : 00011 pdr_select_problem - to select the proper problem 00012 pdr_bc_val - to get the boundary condition values 00013 pdr_ic_val - to get the initial condition values 00014 pdr_time_i_params - to return parameters of time discretization 00015 pdr_time_d_params - to return parameters of time discretization 00016 pdr_set_time_i_params - to change parameters of time discretization 00017 pdr_set_time_d_params - to change parameters of time discretization 00018 pdr_lins_i_params - to return parameters of linear equations solver 00019 pdr_lins_d_params - to return parameters of linear equations solver 00020 pdr_conv_diff_error_test - to compute error norm for test examples 00021 pdr_conv_diff_post_process - to privide simple interactive post-processing 00022 pdr_conv_diff_average_sol - to compute the average of solution over element 00023 00024 pdr_get_mat_data - to get material data from material structures 00025 00026 pdr_exact_sol - to return values and derivatives at a point 00027 for functions used as exact solutions for test problems 00028 00029 pdr_slope_limit - to limit the slope of linear solution 00030 00031 pdr_zzhu_error - to get Zienkiewicz-Zhu error estimator 00032 pdr_zzhu_error_small - to get Zienkiewicz-Zhu error estimator based on small patches 00033 00034 // SHOULD BE CHANGED ? 00035 pdr_fa_coeff - to return coefficients for face integrals 00036 pdr_get_bc_type - to get BC type given BC flag from mesh data structure 00037 !!! according to some adopted convention !!! 00038 pdr_pde_coeff - to return coefficients of the original pdes 00039 pdr_bc_diri_coeff - to return DIRICHLET boundary coeficients 00040 (routine substitutes only non-zero values) 00041 pdr_bc_neum_coeff - to return NEUMANN boundary coeficients 00042 (routine substitutes only non-zero values) 00043 pdr_bc_mixed_coeff - to return ROBIN (mixed) boundary coeficients 00044 00045 ------------------------------ 00046 History: 00047 02.2002 - Krzysztof Banas, initial version 00048 *************************************************************************/ 00049 00050 #ifndef _pdh_conv_diff_ 00051 #define _pdh_conv_diff_ 00052 00053 #include <stdio.h> 00054 00055 #ifdef __cplusplus 00056 extern "C" 00057 { 00058 #endif 00059 00060 /* USED AND IMPLEMENTED PROBLEM DEPENDENT DATA STRUCTURES AND INTERFACES */ 00061 00062 #include "../include/pdh_conv_diff_problem.h" 00063 /* types and functions related to boundary conditions handling */ 00064 //#include "../include/pdh_conv_diff_bc.h" 00065 /* types and functions related to materials handling */ 00066 //#include "../include/pdh_conv_diff_materials.h" 00067 //#include "../include/pdh_conv_diff_weakform.h" 00068 00069 /*** CONSTANTS ***/ 00070 00071 00072 /* GLOBAL VARIABLES */ 00073 extern int pdv_conv_diff_nr_problems; /* the number of problems */ 00074 extern int pdv_conv_diff_current_problem_id; /* ID of the current problem */ 00075 extern pdt_conv_diff_problem pdv_conv_diff_problems[PDC_CONV_DIFF_MAX_NUM_PROB]; 00076 /* array of problems */ 00077 /* pdv_conv_diff_current_problem_id < pdv_conv_diff_nr_problems */ 00078 /* pdv_conv_diff_nr_problems <= PDC_CONV_DIFF_MAX_NUM_PROB */ 00079 00080 #ifdef PARALLEL 00081 extern int pdv_exchange_table_index; 00082 #endif 00083 00084 00085 /*** INTERNAL PROCEDURES ***/ 00086 00090 extern void pdr_time_integration( 00091 int Problem_id, /* in: problem data structure to be used */ 00092 char* Work_dir, 00093 FILE *interactive_input, 00094 FILE *interactive_output 00095 ); 00096 00097 00101 extern int pdr_adapt( /* returns: >0 - success, <=0 - failure */ 00102 int Problem_id, /* in: problem data structure to be used */ 00103 char* Work_dir, 00104 FILE *Interactive_input, 00105 FILE *Interactive_output 00106 ); 00107 00111 double pdr_zzhu_error( 00112 /* returns - Zienkiewicz-Zhu error for the whole mesh */ 00113 int Field_id, /* in: approximation field ID */ 00114 FILE *interactive_output 00115 ); 00116 00120 double pdr_zzhu_error_small( 00121 /* returns - Zienkiewicz-Zhu error for the whole mesh */ 00122 int Field_id, /* in: approximation field ID */ 00123 FILE *interactive_output 00124 ); 00125 00129 extern pdt_conv_diff_problem* pdr_select_problem( 00130 /* returns pointer to the chosen problem */ 00131 /* (if input is not valid it returns */ 00132 /* the pointer to the current problem) */ 00133 int Problem_id /* in: problem ID or 00134 0 (PDC_CURRENT_PROBLEM_ID) for the current problem */ 00135 ); 00136 00137 00141 extern int pdr_bc_val( /* returns: 1 - success, <=0 - failure */ 00142 int Problem_id, /* in: data structure to be used */ 00143 int Num, /* in: index in the array of boundary values */ 00144 double *Val /* out: vector of boundary values */ 00145 ); 00146 00150 extern int pdr_ic_val( /* returns: 1 - success, <=0 - failure */ 00151 int Problem_id, /* in: data structure to be used */ 00152 int Num, /* in: index in the array of initial values */ 00153 double *Val /* out: vector of initial values */ 00154 ); 00155 00159 extern int pdr_time_i_params( /* returns: integer time integration parameter */ 00160 int Problem_id, /* in: data structure to be used */ 00161 int Num /* in: parameter number in control structure */ 00162 ); 00163 00167 extern double pdr_time_d_params( /* returns: real time integration parameter */ 00168 int Problem_id, /* in: data structure to be used */ 00169 int Num /* in: parameter number in control structure */ 00170 ); 00171 00175 extern void pdr_set_time_i_params( 00176 int Problem_id, /* in: data structure to be used */ 00177 int Num, /* in: parameter number in control structure */ 00178 int Value /* in: parameter value */ 00179 ); 00180 00184 extern void pdr_set_time_d_params( 00185 int Problem_id, /* in: data structure to be used */ 00186 int Num, /* in: parameter number in control structure */ 00187 double Value /* in: parameter value */ 00188 ); 00189 00193 extern int pdr_lins_i_params( /* returns: integer linear solver parameter */ 00194 int Problem_id, /* in: data structure to be used */ 00195 int Num /* in: parameter number in control structure */ 00196 ); 00197 00201 extern double pdr_lins_d_params( /* returns: real linear solver parameter */ 00202 int Problem_id, /* in: data structure to be used */ 00203 int Num /* in: parameter number in control structure */ 00204 ); 00205 00206 00210 double pdr_conv_diff_error_test( /* returns H1 norm of error for */ 00211 /* for several known exact solutions */ 00212 int Field_id, /* in: approximation field ID */ 00213 FILE *Interactive_output 00214 ); 00215 00219 double pdr_conv_diff_post_process( 00220 int Field_id, /* in: approximation field ID */ 00221 FILE *Interactive_input, 00222 FILE *Interactive_output 00223 ); 00224 00228 double pdr_average_sol_el( /* returns: the average of solution over element */ 00229 int Problem_id, /* in: data structure to be used */ 00230 int El /* in: element number */ 00231 ); 00232 00233 00238 extern int pdr_conv_diff_exact_sol( /* returns: 1-found exact solution, 0-not found */ 00239 int Flag, /* in: flag, e.g. material number */ 00240 double X, /* in: coordinates of a point */ 00241 double Y, 00242 double Z, 00243 double Time, /* in: time instant */ 00244 double *Exact, /* out: values of solution and derivatives */ 00245 double *Exact_x, 00246 double *Exact_y, 00247 double *Exact_z, 00248 double *Lapl /* out: Laplacian of function */ 00249 ); 00250 00254 int pdr_slope_limit( /* returns: >0 - success, <=0 - failure */ 00255 int Problem_id /* in: data structure to be used */ 00256 ); 00257 00261 void pdr_fa_coeff( 00262 int Face, /* in: face number */ 00263 int BC_flag, /* in: boundary condition flag */ 00264 int Elem, /* in: element number */ 00265 int Mat_num, /* in: material number */ 00266 double Hsize, /* in: size of an element */ 00267 double Time, /* in: time instant */ 00268 int Pdeg, /* in: local degree of polynomial */ 00269 double* Xcoor, /* in: global coordinates of a point */ 00270 double* Vec_norm, /* in: unit normal to the boundary */ 00271 double* U_val, /* in: computed solution */ 00272 double* U_x, /* in: gradient of computed solution */ 00273 double* U_y, /* in: gradient of computed solution */ 00274 double* U_z, /* in: gradient of computed solution */ 00275 double* Anx, /* out: diffusion coefficients */ 00276 double* Any, 00277 double* Anz, 00278 double* Bn, /* out: convection coefficients */ 00279 double* Fval, /* out: rhs Dirichlet data f */ 00280 double* Gval, /* out: rhs Neumann data g */ 00281 double* Qn, /* out: rhs normal fluxes */ 00282 double* Vel_norm /* out: velocity normal to the boundary */ 00283 ); 00284 00289 int pdr_get_bc_type( /* returns: bc type for a face: */ 00290 /* 1 (PDC_INTERIOR) - interior face */ 00291 /* 2 (PDC_BC_DIRI) - Dirichlet boundary face */ 00292 /* 3 (PDC_BC_NEUM) - Neumann boundary face */ 00293 /* 4 (PDC_BC_MIXED) - Robin boundary face */ 00294 int Fa_bc /* in: BC flag (returned by mesh data structure) */ 00295 ); 00296 00300 void pdr_pde_coeff( 00301 int Mat_num, /* in: material number */ 00302 double* Xcoor, /* in: global coordinates of a point */ 00303 double Time, /* in: time instant */ 00304 double* U_val, /* in: computed solution */ 00305 double* U_x, /* in: gradient of computed solution */ 00306 double* U_y, /* in: gradient of computed solution */ 00307 double* U_z, /* in: gradient of computed solution */ 00308 double* Axx, /* out: diffusion coefficients */ 00309 double* Axy, 00310 double* Axz, 00311 double* Ayx, 00312 double* Ayy, 00313 double* Ayz, 00314 double* Azx, 00315 double* Azy, 00316 double* Azz, 00317 double* Bx, /* out: convection coefficients */ 00318 double* By, 00319 double* Bz, 00320 double* Tx, /* out: convection coefficients */ 00321 double* Ty, 00322 double* Tz, 00323 double* Cval, /* out: reaction coefficients */ 00324 double* Mval, /* out: mass matrix coefficients */ 00325 double* Lval, /* out: rhs time coefficients */ 00326 double* Sval, /* out: rhs coefficients without derivatives */ 00327 double* Qx, /* out: rhs coefficients with derivatives */ 00328 double* Qy, /* out: rhs coefficients with derivatives */ 00329 double* Qz /* out: rhs coefficients with derivatives */ 00330 ); 00331 00336 void pdr_bc_diri_coeff( 00337 int Face, /* in: index in an array of BC coefficients */ 00338 int Mat_num, /* in: material number */ 00339 double* Xcoor, /* in: global coordinates of a point */ 00340 double* Vec_norm,/* in: unit normal to the boundary */ 00341 double Time, /* in: time instant */ 00342 double* U_val, /* in: computed solution */ 00343 double* U_x, /* in: gradient of computed solution */ 00344 double* U_y, /* in: gradient of computed solution */ 00345 double* U_z, /* in: gradient of computed solution */ 00346 double* Fval /* out: BC DIRICHLET coefficients */ 00347 ); 00348 00353 void pdr_bc_neum_coeff( 00354 int Face, /* in: face number */ 00355 int Mat_num, /* in: material number */ 00356 double* Xcoor, /* in: global coordinates of a point */ 00357 double* Vec_norm,/* in: unit normal to the boundary */ 00358 double Time, /* in: time instant */ 00359 double* U_val, /* in: computed solution */ 00360 double* U_x, /* in: gradient of computed solution */ 00361 double* U_y, /* in: gradient of computed solution */ 00362 double* U_z, /* in: gradient of computed solution */ 00363 double* Gval /* out: BC NEUMANN coefficients */ 00364 ); 00365 00369 void pdr_bc_mixed_coeff( 00370 int Face, /* in: face number */ 00371 int Mat_num, /* in: material number */ 00372 double* Xcoor, /* in: global coordinates of a point */ 00373 double* Vec_norm,/* in: unit normal to the boundary */ 00374 double Time, /* in: time instant */ 00375 double* U_val, /* in: computed solution */ 00376 double* U_x, /* in: gradient of computed solution */ 00377 double* U_y, /* in: gradient of computed solution */ 00378 double* U_z, /* in: gradient of computed solution */ 00379 double* Fval, /* out: BC mixed coefficients */ 00380 double* Kr /* out: proportionality coefficient */ 00381 ); 00382 00383 #ifdef __cplusplus 00384 } 00385 #endif 00386 00387 #endif