00001 /************************************************************************ 00002 File pdh_plast_flow_weakform.h - weakform functions for plast_flow 00003 00004 Contains declarations of routines: 00005 00006 MODULE PROVIDES IMPLEMENTATION (in pds_plast_flow_weakform.c) 00007 PROCEDURES CAN BE CALLED BY ALL OTHER PROBLEM MODULES 00008 00009 pdr_plast_flow_select_el_coeff - to select coefficients returned to approximation 00010 routines for element integrals 00011 00012 pdr_plast_flow_el_coeff - to return coefficients for element integrals 00013 00014 pdr_plast_flow_comp_el_stiff_mat - to construct UNCONSTRAINED stiffness matrix and 00015 a load vector for an element 00016 00017 pdr_plast_flow_comp_fa_stiff_mat - to construct UNCONSTRAINED stiffness matrix and 00018 a load vector for a face 00019 00020 pdr_plast_flow_compute_CFL - to compute and print local CFL numbers for element 00021 00022 pdr_plast_flow_get_velocity_at_point - to provide the velocity and its 00023 gradient at a particular point given its local coordinates within an element 00024 00025 00026 MODULE ASKS FOR IMPLEMENTATION - it has to be provided by procedures defined 00027 in weakform directory of the problem module that uses plast_flow as submodule 00028 00029 pdr_plast_flow_give_me_temperature_at_point - to provide the temperature and its 00030 gradient at a particular point given its local coordinates within an element 00031 00032 ------------------------------ 00033 History: 00034 2011 - Przemyslaw Plaszewski (pplaszew@agh.edu.pl) 00035 2012 - Krzysztof Banas (pobanas@cyf-kr.edu.pl) 00036 2018 - Jan Bielanski (jbielan@agh.edu.pl) (mixed formulation) 00037 *************************************************************************/ 00038 00039 #ifndef PDH_PLAST_FLOW_WEAKFORM 00040 #define PDH_PLAST_FLOW_WEAKFORM 00041 00042 #include<stdio.h> 00043 00044 #ifdef __cplusplus 00045 extern "C" 00046 { 00047 #endif 00048 00049 /**************************************/ 00050 /* INTERNAL PROCEDURES */ 00051 /**************************************/ 00052 /* Rules: 00053 /* - name always begins with pdr_ */ 00054 /* - argument names start uppercase */ 00055 00060 int pdr_plast_flow_select_el_coeff_vect( // returns success indicator 00061 int Problem_id, 00062 int *Coeff_vect_ind /* out: coefficient indicator */ 00063 ); 00064 00070 extern double* pdr_plast_flow_select_el_coeff( 00071 /* returns: pointer !=NULL to indicate selection */ 00072 int Problem_id, 00073 double **Mval, /* out: mass matrix coefficient */ 00074 double **Axx,double **Axy,double **Axz, /* out:diffusion coefficients, e.g.*/ 00075 double **Ayx,double **Ayy,double **Ayz, /* Axy denotes scalar or matrix */ 00076 double **Azx,double **Azy,double **Azz, /* related to terms with dv/dx*du/dy */ 00077 /* second order derivatives in weak formulation (scalar for scalar problems */ 00078 /* matrix for vector problems) */ 00079 /* WARNING: if axy==NULL only diagonal (axx, ayy, azz) terms are considered */ 00080 /* in apr_num_int_el */ 00081 double **Bx,double **By,double **Bz, /* out: convection coefficients */ 00082 /* Bx denotes scalar or matrix related to terms with du/dx*v in weak form */ 00083 double **Tx,double **Ty,double **Tz, /* out: convection coefficients */ 00084 /* Tx denotes scalar or matrix related to terms with u*dv/dx in weak form */ 00085 double **Cval,/* out: reaction coefficients - for terms without derivatives */ 00086 /* in weak form (as usual: scalar for scalar problems, matrix for vectors) */ 00087 double **Lval,/* out: rhs coefficient for time term, Lval denotes scalar */ 00088 /* or matrix corresponding to time derivative - similar as mass matrix but */ 00089 /* with known solution at the previous time step (usually denoted by u_n) */ 00090 double **Qx,/* out: rhs coefficients for terms with derivatives */ 00091 double **Qy,/* Qy denotes scalar or matrix corresponding to terms with dv/dy */ 00092 double **Qz,/* derivatives in weak formulation */ 00093 double **Sval /* out: rhs coefficients without derivatives (source terms) */ 00094 ); 00095 00099 extern int pdr_plast_flow_el_coeff( 00100 /* GENERIC arguments as in pdr_el_coeff */ 00101 int Problem_id, 00102 int Elem, /* in: element number */ 00103 int Mat_num, /* in: material number */ 00104 double Hsize, /* in: size of an element */ 00105 int Pdeg, /* in: local degree of polynomial */ 00106 double *X_loc, /* in: local coordinates of point within element */ 00107 double *Base_phi, /* in: basis functions */ 00108 double *Base_dphix, /* in: x-derivatives of basis functions */ 00109 double *Base_dphiy, /* in: y-derivatives of basis functions */ 00110 double *Base_dphiz, /* in: z-derivatives of basis functions */ 00111 double *Xcoor, /* in: global coordinates of a point */ 00112 double *Uk_val, /* in: computed solution from previous iteration */ 00113 double *Uk_x, /* in: gradient of computed solution Uk_val */ 00114 double *Uk_y, /* in: gradient of computed solution Uk_val */ 00115 double *Uk_z, /* in: gradient of computed solution Uk_val */ 00116 double *Un_val, /* in: computed solution from previous time step */ 00117 double *Un_x, /* in: gradient of computed solution Un_val */ 00118 double *Un_y, /* in: gradient of computed solution Un_val */ 00119 double *Un_z, /* in: gradient of computed solution Un_val */ 00120 double *Mval, /* out: mass matrix coefficient */ 00121 double *Axx, double *Axy, double *Axz, /* out:diffusion coefficients */ 00122 double *Ayx, double *Ayy, double *Ayz, /* e.g. Axy denotes scalar or matrix */ 00123 double *Azx, double *Azy, double *Azz, /* related to terms with dv/dx*du/dy */ 00124 /* second order derivatives in weak formulation (scalar for scalar problems */ 00125 /* matrix for vector problems) */ 00126 /* WARNING: if axy==NULL only diagonal (axx, ayy, azz) terms are considered */ 00127 /* in apr_num_int_el */ 00128 double *Bx, double *By, double *Bz, /* out: convection coefficients */ 00129 /* Bx denotes scalar or matrix related to terms with du/dx*v in weak form */ 00130 double *Tx, double *Ty, double *Tz, /* out: convection coefficients */ 00131 /* Tx denotes scalar or matrix related to terms with u*dv/dx in weak form */ 00132 double *Cval, /* out: reaction coefficients - for terms without derivatives */ 00133 /* in weak form (as usual: scalar for scalar problems, matrix for vectors) */ 00134 double *Lval, /* out: rhs coefficient for time term, Lval denotes scalar */ 00135 /* or matrix corresponding to time derivative - similar as mass matrix but */ 00136 /* with known solution at the previous time step (usually denoted by u_n) */ 00137 double *Qx, /* out: rhs coefficients for terms with derivatives */ 00138 double *Qy, /* Qy denotes scalar or matrix corresponding to terms with dv/dy */ 00139 double *Qz, /* derivatives in weak formulation */ 00140 double *Sval, /* out: rhs coefficients without derivatives (source terms) */ 00141 /* arguments SPECIFIC to plast_flow */ 00142 double Tk, // temperature at the current point */ 00143 double *Dynamic_viscosity, 00144 double Density, 00145 double Reference_density, 00146 double Reference_velocity, 00147 double Delta_t, 00148 double Implicitness_coeff, 00149 double Body_force_x, 00150 double Body_force_y, 00151 double Body_force_z 00152 ); 00153 00158 extern int pdr_plast_flow_comp_el_stiff_mat( 00159 /*returns: >=0 -success code, <0 -error code */ 00160 int Problem_id, /* in: approximation field ID */ 00161 int El_id, /* in: unique identifier of the element */ 00162 int Comp_sm, /* in: indicator for the scope of computations: */ 00163 /* PDC_NO_COMP - do not compute anything */ 00164 /* PDC_COMP_SM - compute entries to stiff matrix only */ 00165 /* PDC_COMP_RHS - compute entries to rhs vector only */ 00166 /* PDC_COMP_BOTH - compute entries for sm and rhsv */ 00167 int Pdeg_in, /* in: enforced degree of polynomial (if > 0 ) */ 00168 int *Nrdofs_loc, /* in(optional): size of Stiff_mat and Rhs_vect */ 00169 /* out(optional): actual number of dofs per integration entity */ 00170 double *Stiff_mat, /* out(optional): stiffness matrix stored columnwise */ 00171 double *Rhs_vect, /* out(optional): rhs vector */ 00172 char *Rewr_dofs /* out(optional): flag to rewrite or sum up entries */ 00173 /* 'T' - true, rewrite entries when assembling */ 00174 /* 'F' - false, sum up entries when assembling */ 00175 ); 00176 00181 extern int pdr_plast_flow_comp_fa_stiff_mat( 00182 /*returns: >=0 -success code, <0 -error code */ 00183 int Problem_id, /* in: approximation field ID */ 00184 int Fa_id, /* in: unique identifier of the face */ 00185 int Comp_sm, /* in: indicator for the scope of computations: */ 00186 /* PDC_NO_COMP - do not compute anything */ 00187 /* PDC_COMP_SM - compute entries to stiff matrix only */ 00188 /* PDC_COMP_RHS - compute entries to rhs vector only */ 00189 /* PDC_COMP_BOTH - compute entries for sm and rhsv */ 00190 int Pdeg_in, /* in: enforced degree of polynomial (if > 0 ) */ 00191 int *Nrdofs_loc, /* in(optional): size of Stiff_mat and Rhs_vect */ 00192 /* out(optional): actual number of dofs per integration entity */ 00193 double *Stiff_mat, /* out(optional): stiffness matrix stored columnwise */ 00194 double *Rhs_vect, /* out(optional): rhs vector */ 00195 char *Rewr_dofs /* out(optional): flag to rewrite or sum up entries */ 00196 /* 'T' - true, rewrite entries when assembling */ 00197 /* 'F' - false, sum up entries when assembling */ 00198 ); 00199 00203 extern int pdr_plast_flow_compute_CFL( 00204 int Problem_id, 00205 double *CFL_min_p, 00206 double *CFL_max_p, 00207 double *CFL_ave_p 00208 ); 00209 00215 extern int pdr_plast_flow_get_velocity_at_point( 00216 int Problem_id, 00217 int El_id, // element 00218 double *X_loc, // local coordinates of point 00219 double *Base_phi, // shape functions at point (if available - to speed up) 00220 double *Base_dphix, // derivatives of shape functions at point 00221 double *Base_dphiy, // derivatives of shape functions at point 00222 double *Base_dphiz, // derivatives of shape functions at point 00223 double *Velocity, // velocity vector 00224 double *DVel_dx, // x-derivative of velocity vector 00225 double *DVel_dy, // y-derivative of velocity vector 00226 double *DVel_dz // z-derivative of velocity vector 00227 ); 00228 00234 extern int pdr_plast_flow_get_stress_at_point( 00235 int Problem_id, 00236 int El_id, // element 00237 double *X_loc, // local coordinates of point 00238 double *Base_phi, // shape functions at point (if available - to speed up) 00239 double *Base_dphix, // derivatives of shape functions at point 00240 double *Base_dphiy, // derivatives of shape functions at point 00241 double *Base_dphiz, // derivatives of shape functions at point 00242 double *Stress, // stress vector (tensor) 00243 double *DStress_dx, // x-derivative of stress vector 00244 double *DStress_dy, // y-derivative of stress vector 00245 double *DStress_dz // z-derivative of stress vector 00246 ); 00247 00253 extern int pdr_plast_flow_get_strain_rate_at_point( 00254 int Problem_id, 00255 int El_id, // element 00256 double *X_loc, // local coordinates of point 00257 double *Base_phi, // shape functions at point (if available - to speed up) 00258 double *Base_dphix, // derivatives of shape functions at point 00259 double *Base_dphiy, // derivatives of shape functions at point 00260 double *Base_dphiz, // derivatives of shape functions at point 00261 double *StrainR, // strain rate vector (tensor) 00262 double *DStrainR_dx, // x-derivative of strain rate vector 00263 double *DStrainR_dy, // y-derivative of strain rate vector 00264 double *DStrainR_dz // z-derivative of strain rate vector 00265 ); 00266 00274 extern int pdr_plast_flow_give_me_temperature_at_point( 00275 int Problem_id, 00276 int El_id, // element 00277 double *X_loc, // local coordinates of point 00278 double *Base_phi, // shape functions at point (if available - to speed up) 00279 double *Base_dphix, // derivatives of shape functions at point 00280 double *Base_dphiy, // derivatives of shape functions at point 00281 double *Base_dphiz, // derivatives of shape functions at point 00282 double *Temp, // temperature 00283 double *DTemp_dx, // x-derivative of temperature 00284 double *DTemp_dy, // y-derivative of temperature 00285 double *DTemp_dz // z-derivative of temperature 00286 ); 00287 00288 00289 #ifdef __cplusplus 00290 } 00291 #endif 00292 00293 #endif