00001 /************************************************************************ 00002 File pdh_conv_diff_weakform.h - weakform functions for conv_diff 00003 00004 Contains declarations of routines: 00005 00006 MODULE PROVIDES IMPLEMENTATION (in pds_conv_diff_weakform.c) 00007 PROCEDURES CAN BE CALLED BY ALL OTHER PROBLEM MODULES 00008 pdr_conv_diff_select_el_coeff - to select coefficients returned to approximation 00009 routines for element integrals 00010 00011 pdr_conv_diff_el_coeff - to return coefficients for element integrals 00012 00013 pdr_conv_diff_comp_el_stiff_mat - to construct UNCONSTRAINED stiffness matrix and 00014 a load vector for an element 00015 00016 pdr_conv_diff_comp_fa_stiff_mat - to construct UNCONSTRAINED stiffness matrix and 00017 a load vector for a face 00018 pdr_conv_diff_compute_CFL - to compute global CFL numbers (for a subdomain) 00019 00020 MODULE ASKS FOR IMPLEMENTATION - it has to be provided by procedures defined 00021 in weakform directory of the problem module that uses conv_diff as submodule 00022 00023 00024 ------------------------------ 00025 History: 00026 2011 - Przemyslaw Plaszewski (pplaszew@agh.edu.pl) 00027 2012 - Krzysztof Banas (pobanas@cyf-kr.edu.pl) 00028 *************************************************************************/ 00029 00030 #ifndef PDH_CONV_DIFF_WEAKFORM 00031 #define PDH_CONV_DIFF_WEAKFORM 00032 00033 #include<stdio.h> 00034 00035 #ifdef __cplusplus 00036 extern "C" 00037 { 00038 #endif 00039 00040 /**************************************/ 00041 /* INTERNAL PROCEDURES */ 00042 /**************************************/ 00043 /* Rules: 00044 /* - name always begins with pdr_ */ 00045 /* - argument names start uppercase */ 00046 00051 extern double* pdr_conv_diff_select_el_coeff( 00052 /* returns: pointer !=NULL to indicate selection */ 00053 int Problem_id, 00054 double **Mval, /* out: mass matrix coefficient */ 00055 double **Axx,double **Axy,double **Axz, /* out:diffusion coefficients, e.g.*/ 00056 double **Ayx,double **Ayy,double **Ayz, /* Axy denotes scalar or matrix */ 00057 double **Azx,double **Azy,double **Azz, /* related to terms with dv/dx*du/dy */ 00058 /* second order derivatives in weak formulation (scalar for scalar problems */ 00059 /* matrix for vector problems) */ 00060 /* WARNING: if axy==NULL only diagonal (axx, ayy, azz) terms are considered */ 00061 /* in apr_num_int_el */ 00062 double **Bx,double **By,double **Bz, /* out: convection coefficients */ 00063 /* Bx denotes scalar or matrix related to terms with du/dx*v in weak form */ 00064 double **Tx,double **Ty,double **Tz, /* out: convection coefficients */ 00065 /* Tx denotes scalar or matrix related to terms with u*dv/dx in weak form */ 00066 double **Cval,/* out: reaction coefficients - for terms without derivatives */ 00067 /* in weak form (as usual: scalar for scalar problems, matrix for vectors) */ 00068 double **Lval,/* out: rhs coefficient for time term, Lval denotes scalar */ 00069 /* or matrix corresponding to time derivative - similar as mass matrix but */ 00070 /* with known solution at the previous time step (usually denoted by u_n) */ 00071 double **Qx,/* out: rhs coefficients for terms with derivatives */ 00072 double **Qy,/* Qy denotes scalar or matrix corresponding to terms with dv/dy */ 00073 double **Qz,/* derivatives in weak formulation */ 00074 double **Sval /* out: rhs coefficients without derivatives (source terms) */ 00075 ); 00076 00080 extern int pdr_conv_diff_el_coeff( 00081 /* GENERIC arguments as in pdr_el_coeff */ 00082 int Problem_id, 00083 int Elem, /* in: element number */ 00084 int Mat_num, /* in: material number */ 00085 double Hsize, /* in: size of an element */ 00086 int Pdeg, /* in: local degree of polynomial */ 00087 double *X_loc, /* in: local coordinates of point within element */ 00088 double *Base_phi, /* in: basis functions */ 00089 double *Base_dphix, /* in: x-derivatives of basis functions */ 00090 double *Base_dphiy, /* in: y-derivatives of basis functions */ 00091 double *Base_dphiz, /* in: z-derivatives of basis functions */ 00092 double *Xcoor, /* in: global coordinates of a point */ 00093 double *Uk_val, /* in: computed solution from previous iteration */ 00094 double *Uk_x, /* in: gradient of computed solution Uk_val */ 00095 double *Uk_y, /* in: gradient of computed solution Uk_val */ 00096 double *Uk_z, /* in: gradient of computed solution Uk_val */ 00097 double *Un_val, /* in: computed solution from previous time step */ 00098 double *Un_x, /* in: gradient of computed solution Un_val */ 00099 double *Un_y, /* in: gradient of computed solution Un_val */ 00100 double *Un_z, /* in: gradient of computed solution Un_val */ 00101 double *Mval, /* out: mass matrix coefficient */ 00102 double *Axx, double *Axy, double *Axz, /* out:diffusion coefficients */ 00103 double *Ayx, double *Ayy, double *Ayz, /* e.g. Axy denotes scalar or matrix */ 00104 double *Azx, double *Azy, double *Azz, /* related to terms with dv/dx*du/dy */ 00105 /* second order derivatives in weak formulation (scalar for scalar problems */ 00106 /* matrix for vector problems) */ 00107 /* WARNING: if axy==NULL only diagonal (axx, ayy, azz) terms are considered */ 00108 /* in apr_num_int_el */ 00109 double *Bx, double *By, double *Bz, /* out: convection coefficients */ 00110 /* Bx denotes scalar or matrix related to terms with du/dx*v in weak form */ 00111 double *Tx, double *Ty, double *Tz, /* out: convection coefficients */ 00112 /* Tx denotes scalar or matrix related to terms with u*dv/dx in weak form */ 00113 double *Cval, /* out: reaction coefficients - for terms without derivatives */ 00114 /* in weak form (as usual: scalar for scalar problems, matrix for vectors) */ 00115 double *Lval, /* out: rhs coefficient for time term, Lval denotes scalar */ 00116 /* or matrix corresponding to time derivative - similar as mass matrix but */ 00117 /* with known solution at the previous time step (usually denoted by u_n) */ 00118 double *Qx, /* out: rhs coefficients for terms with derivatives */ 00119 double *Qy, /* Qy denotes scalar or matrix corresponding to terms with dv/dy */ 00120 double *Qz, /* derivatives in weak formulation */ 00121 double *Sval /* out: rhs coefficients without derivatives (source terms) */ 00122 ); 00123 00128 int pdr_conv_diff_comp_el_stiff_mat(/*returns: >=0 -success code, <0 -error code */ 00129 int Problem_id, /* in: approximation field ID */ 00130 int El_id, /* in: unique identifier of the element */ 00131 int Comp_sm, /* in: indicator for the scope of computations: */ 00132 /* PDC_NO_COMP - do not compute anything */ 00133 /* PDC_COMP_SM - compute entries to stiff matrix only */ 00134 /* PDC_COMP_RHS - compute entries to rhs vector only */ 00135 /* PDC_COMP_BOTH - compute entries for sm and rhsv */ 00136 int Pdeg_in, /* in: enforced degree of polynomial (if > 0 ) */ 00137 int *Nr_dof_ent, /* in: size of arrays, */ 00138 /* out: no of filled entries, i.e. number of mesh entities */ 00139 /* with which dofs and stiffness matrix blocks are associated */ 00140 int *List_dof_ent_type, /* out: list of no of dofs for 'dof' entity */ 00141 int *List_dof_ent_id, /* out: list of no of dofs for 'dof' entity */ 00142 int *List_dof_ent_nrdofs, /* out: list of no of dofs for 'dof' entity */ 00143 int *Nrdofs_loc, /* in(optional): size of Stiff_mat and Rhs_vect */ 00144 /* out(optional): actual number of dofs per integration entity */ 00145 double *Stiff_mat, /* out(optional): stiffness matrix stored columnwise */ 00146 double *Rhs_vect, /* out(optional): rhs vector */ 00147 char *Rewr_dofs /* out(optional): flag to rewrite or sum up entries */ 00148 /* 'T' - true, rewrite entries when assembling */ 00149 /* 'F' - false, sum up entries when assembling */ 00150 ); 00151 00156 int pdr_conv_diff_comp_fa_stiff_mat(/*returns: >=0 -success code, <0 -error code */ 00157 int Problem_id, /* in: approximation field ID */ 00158 int Fa_id, /* in: unique identifier of the face */ 00159 int Comp_sm, /* in: indicator for the scope of computations: */ 00160 /* PDC_NO_COMP - do not compute anything */ 00161 /* PDC_COMP_SM - compute entries to stiff matrix only */ 00162 /* PDC_COMP_RHS - compute entries to rhs vector only */ 00163 /* PDC_COMP_BOTH - compute entries for sm and rhsv */ 00164 int Pdeg_in, /* in: enforced degree of polynomial (if > 0 ) */ 00165 int *Nr_dof_ent, /* in: size of arrays List_dof_ent_... */ 00166 /* out: number of mesh entities with which dofs and */ 00167 /* stiffness matrix blocks are associated */ 00168 int *List_dof_ent_type, /* out: list of no of dofs for 'dof' entity */ 00169 int *List_dof_ent_id, /* out: list of no of dofs for 'dof' entity */ 00170 int *List_dof_ent_nrdofs, /* out: list of no of dofs for 'dof' entity */ 00171 int *Nrdofs_loc, /* in(optional): size of Stiff_mat and Rhs_vect */ 00172 /* out(optional): actual number of dofs per integration entity */ 00173 double *Stiff_mat, /* out(optional): stiffness matrix stored columnwise */ 00174 double *Rhs_vect, /* out(optional): rhs vector */ 00175 char *Rewr_dofs /* out(optional): flag to rewrite or sum up entries */ 00176 /* 'T' - true, rewrite entries when assembling */ 00177 /* 'F' - false, sum up entries when assembling */ 00178 ); 00179 00183 int pdr_conv_diff_compute_CFL( 00184 int Problem_id, 00185 double *CFL_min_p, 00186 double *CFL_max_p, 00187 double *CFL_ave_p 00188 ); 00189 00190 00191 00192 #ifdef __cplusplus 00193 } 00194 #endif 00195 00196 #endif