Changeset 5878
- Timestamp:
- 09/17/10 17:29:07 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r5877 r5878 3098 3098 ElementMatrix* Tria::CreateKMatrixMelting(void){ 3099 3099 3100 /*Constants*/ 3100 3101 const int numdof=NUMVERTICES*NDOF1; 3101 int i,j,ig; 3102 3103 /*Intermediaries */ 3104 int i,j,ig; 3105 double heatcapacity,latentheat; 3106 double Jdet,D_scalar; 3102 3107 double xyz_list[NUMVERTICES][3]; 3103 double heatcapacity,latentheat;3104 GaussTria *gauss=NULL;3105 double Jdet;3106 double D_scalar;3107 double K_terms[numdof][numdof]={0.0};3108 3108 double L[3]; 3109 3109 double tLD[3]; 3110 3110 double Ke_gaussian[numdof][numdof]={0.0}; 3111 GaussTria *gauss=NULL; 3111 3112 3112 3113 /*Initialize Element matrix and return if necessary*/ … … 3127 3128 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3128 3129 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0], gauss); 3130 3129 3131 D_scalar=latentheat/heatcapacity*gauss->weight*Jdet; 3130 3132 … … 3157 3159 ElementMatrix* Tria::CreateKMatrixPrognostic_CG(void){ 3158 3160 3159 /* local declarations*/3161 /*Constants*/ 3160 3162 const int numdof=NDOF1*NUMVERTICES; 3161 int i,j; 3162 int ig; 3163 double xyz_list[NUMVERTICES][3]; 3164 int numberofdofspernode=1; 3163 3164 /*Intermediaries */ 3165 bool artdiff; 3166 int i,j,ig,dim; 3167 double Jdettria,DL_scalar,dt; 3168 double vx,vy,dvxdx,dvydy; 3169 double dvx[2],dvy[2]; 3170 double v_gauss[2]={0.0}; 3171 double xyz_list[NUMVERTICES][3]; 3172 double L[NUMVERTICES]; 3173 double B[2][NUMVERTICES]; 3174 double Bprime[2][NUMVERTICES]; 3175 double K[2][2] ={0.0}; 3176 double KDL[2][2] ={0.0}; 3177 double DL[2][2] ={0.0}; 3178 double DLprime[2][2] ={0.0}; 3179 double Ke_gg_gaussian[numdof][numdof] ={0.0}; 3180 double Ke_gg_thickness1[numdof][numdof]={0.0}; 3181 double Ke_gg_thickness2[numdof][numdof]={0.0}; 3165 3182 GaussTria *gauss=NULL; 3166 double L[NUMVERTICES];3167 double B[2][NUMVERTICES];3168 double Bprime[2][NUMVERTICES];3169 double DL[2][2]={0.0};3170 double DLprime[2][2]={0.0};3171 double DL_scalar;3172 double Ke_gg[numdof][numdof]={0.0};3173 double Ke_gg_gaussian[numdof][numdof]={0.0};3174 double Ke_gg_thickness1[numdof][numdof]={0.0};3175 double Ke_gg_thickness2[numdof][numdof]={0.0};3176 double Jdettria;3177 double dvx[2];3178 double dvy[2];3179 double vx,vy;3180 double dvxdx,dvydy;3181 double v_gauss[2]={0.0};3182 double K[2][2]={0.0};3183 double KDL[2][2]={0.0};3184 int dim;3185 double dt;3186 bool artdiff;3187 3183 3188 3184 /*Initialize Element matrix and return if necessary*/ … … 3208 3204 //Create Artificial diffusivity once for all if requested 3209 3205 if(artdiff){ 3210 //Get the Jacobian determinant3211 3206 gauss=new GaussTria(); 3212 3207 gauss->GaussCenter(); … … 3214 3209 delete gauss; 3215 3210 3216 //Build K matrix (artificial diffusivity matrix)3217 3211 vxaverage_input->GetParameterAverage(&v_gauss[0]); 3218 3212 vyaverage_input->GetParameterAverage(&v_gauss[1]); … … 3228 3222 gauss->GaussPoint(ig); 3229 3223 3230 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode);3231 3224 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3225 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3226 3227 vxaverage_input->GetParameterValue(&vx,gauss); 3228 vyaverage_input->GetParameterValue(&vy,gauss); 3229 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 3230 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 3232 3231 3233 3232 DL_scalar=gauss->weight*Jdettria; … … 3241 3240 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 3242 3241 3243 vxaverage_input->GetParameterValue(&vx,gauss);3244 vyaverage_input->GetParameterValue(&vy,gauss);3245 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);3246 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);3247 3242 dvxdx=dvx[0]; 3248 3243 dvydy=dvy[1]; … … 3289 3284 ElementMatrix* Tria::CreateKMatrixPrognostic_DG(void){ 3290 3285 3291 /* local declarations */ 3292 int i,j; 3286 /*Constants*/ 3293 3287 const int numdof=NDOF1*NUMVERTICES; 3294 double xyz_list[NUMVERTICES][3]; 3295 int* doflist=NULL; 3296 int numberofdofspernode=1; 3297 int ig; 3298 GaussTria *gauss=NULL; 3299 double L[NUMVERTICES]; 3300 double B[2][NUMVERTICES]; 3301 double Bprime[2][NUMVERTICES]; 3302 double DL[2][2]={0.0}; 3303 double DLprime[2][2]={0.0}; 3304 double DL_scalar; 3305 double Ke_gg[numdof][numdof]={0.0}; 3306 double Ke_gg1[numdof][numdof]={0.0}; 3307 double Ke_gg2[numdof][numdof]={0.0}; 3308 double Jdettria; 3309 double vx,vy; 3310 int dim; 3311 double dt; 3288 3289 /*Intermediaries */ 3290 int i,j,ig,dim; 3291 int* doflist=NULL; 3292 double xyz_list[NUMVERTICES][3]; 3293 double Jdettria,dt,vx,vy; 3294 double L[NUMVERTICES]; 3295 double B[2][NUMVERTICES]; 3296 double Bprime[2][NUMVERTICES]; 3297 double DL[2][2]={0.0}; 3298 double DLprime[2][2]={0.0}; 3299 double DL_scalar; 3300 double Ke_gg1[numdof][numdof]={0.0}; 3301 double Ke_gg2[numdof][numdof]={0.0}; 3302 GaussTria *gauss=NULL; 3312 3303 3313 3304 /*Initialize Element matrix and return if necessary*/ … … 3336 3327 gauss->GaussPoint(ig); 3337 3328 3338 3339 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode); 3329 vxaverage_input->GetParameterValue(&vx,gauss); 3330 vyaverage_input->GetParameterValue(&vy,gauss); 3331 3340 3332 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3333 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3341 3334 3342 3335 DL_scalar=gauss->weight*Jdettria; … … 3347 3340 &Ke_gg1[0][0],0); 3348 3341 3349 /*Get B and B prime matrix: */3350 3342 /*WARNING: B and Bprime are inverted compared to usual prognostic!!!!*/ 3351 3343 GetBPrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 3352 3344 GetBprimePrognostic(&B[0][0], &xyz_list[0][0], gauss); 3353 3345 3354 vxaverage_input->GetParameterValue(&vx,gauss);3355 vyaverage_input->GetParameterValue(&vy,gauss);3356 3346 DL_scalar=-dt*gauss->weight*Jdettria; 3357 3347 … … 3632 3622 void Tria::CreatePVectorBalancedvelocities(Vec pg){ 3633 3623 3634 /* local declarations */ 3635 int i,j; 3636 3637 /* node data: */ 3624 /*Constants*/ 3638 3625 const int numdof=NDOF1*NUMVERTICES; 3639 double xyz_list[NUMVERTICES][3]; 3640 int* doflist=NULL; 3641 int numberofdofspernode=1; 3642 3643 /* gaussian points: */ 3644 int ig; 3626 3627 /*Intermediaries */ 3628 int i,j,ig; 3629 int* doflist=NULL; 3630 double xyz_list[NUMVERTICES][3]; 3631 double Jdettria,accumulation_g,melting_g; 3632 double L[NUMVERTICES]; 3633 double pe_g[NUMVERTICES]={0.0}; 3645 3634 GaussTria* gauss=NULL; 3646 3635 3647 /* matrix */3648 double pe_g[NUMVERTICES]={0.0};3649 double L[NUMVERTICES];3650 double Jdettria;3651 3652 /*input parameters for structural analysis (diagnostic): */3653 double accumulation_g;3654 double melting_g;3655 3656 /* Get node coordinates and dof list: */3657 3636 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3658 3637 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); … … 3668 3647 gauss->GaussPoint(ig); 3669 3648 3670 /* Get Jacobian determinant: */3671 3649 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 3672 3673 /*Get L matrix: */ 3674 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode); 3675 3676 /* Get accumulation, melting at gauss point */ 3650 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3651 3677 3652 accumulation_input->GetParameterValue(&accumulation_g,gauss); 3678 3653 melting_input->GetParameterValue(&melting_g,gauss); 3679 3654 3680 /* Add value into pe_g: */3681 3655 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g)*L[i]; 3682 3656 3683 3657 } 3684 3658 3685 /*Add pe_g to global matrix Kgg: */3686 3659 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 3687 3660
Note:
See TracChangeset
for help on using the changeset viewer.