Changeset 26830 for issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
- Timestamp:
- 01/27/22 18:17:58 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r26694 r26830 271 271 272 272 if(!this->IsOnBase()) return; 273 274 IssmDouble xyz_list[NUMVERTICES][3]; 275 IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 273 this->ComputeSigmaVM(); 274 276 275 IssmDouble calvingratex[NUMVERTICES]; 277 276 IssmDouble calvingratey[NUMVERTICES]; 278 277 IssmDouble calvingrate[NUMVERTICES]; 279 IssmDouble lambda1,lambda2,ex,ey,vx,vy,vel; 280 IssmDouble B,sigma_max,sigma_max_floating,sigma_max_grounded,n; 281 IssmDouble epse_2,groundedice,bed,sealevel; 282 IssmDouble sigma_vm[NUMVERTICES]; 283 284 /* Get node coordinates and dof list: */ 285 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 278 IssmDouble vx,vy; 279 IssmDouble sigma_vm,sigma_max,sigma_max_floating,sigma_max_grounded; 280 IssmDouble groundedice,bed,sealevel; 286 281 287 282 /*Depth average B for stress calculation*/ 288 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);289 283 this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 290 284 this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); … … 295 289 Input* gr_input = this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input); 296 290 Input* bs_input = this->GetInput(BaseEnum); _assert_(bs_input); 297 Input* B_input = this->GetInput(MaterialsRheologyBbarEnum); _assert_(B_input);298 Input* n_input = this->GetInput(MaterialsRheologyNEnum); _assert_(n_input);299 291 Input* smax_fl_input = this->GetInput(CalvingStressThresholdFloatingiceEnum); _assert_(smax_fl_input); 300 292 Input* smax_gr_input = this->GetInput(CalvingStressThresholdGroundediceEnum); _assert_(smax_gr_input); 301 293 Input* sl_input = this->GetInput(SealevelEnum); _assert_(sl_input); 294 Input* sigma_vm_input = this->GetInput(SigmaVMEnum); _assert_(sigma_vm_input); 302 295 303 296 /* Start looping on the number of vertices: */ … … 307 300 308 301 /*Get velocity components and thickness*/ 309 B_input->GetInputValue(&B,&gauss);310 n_input->GetInputValue(&n,&gauss);311 302 vx_input->GetInputValue(&vx,&gauss); 312 303 vy_input->GetInputValue(&vy,&gauss); 304 sigma_vm_input->GetInputValue(&sigma_vm,&gauss); 313 305 gr_input->GetInputValue(&groundedice,&gauss); 314 306 bs_input->GetInputValue(&bed,&gauss); 315 307 smax_fl_input->GetInputValue(&sigma_max_floating,&gauss); 316 308 smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss); 317 vel=sqrt(vx*vx+vy*vy)+1.e-14;318 309 sl_input->GetInputValue(&sealevel,&gauss); 319 320 /*Compute strain rate and viscosity: */321 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);322 323 /*Get Eigen values*/324 Matrix2x2Eigen(&lambda1,&lambda2,&ex,&ey,epsilon[0],epsilon[2],epsilon[1]);325 _assert_(!xIsNan<IssmDouble>(lambda1));326 _assert_(!xIsNan<IssmDouble>(lambda2));327 328 /*Process Eigen values (only account for extension)*/329 lambda1 = max(lambda1,0.);330 lambda2 = max(lambda2,0.);331 332 /*Calculate sigma_vm*/333 epse_2 = 1./2. *(lambda1*lambda1 + lambda2*lambda2);334 sigma_vm[iv] = sqrt(3.) * B * pow(epse_2,1./(2.*n));335 310 336 311 /*Tensile stress threshold*/ … … 346 321 } 347 322 else{ 348 calvingratex[iv]=vx*sigma_vm [iv]/sigma_max;349 calvingratey[iv]=vy*sigma_vm [iv]/sigma_max;323 calvingratex[iv]=vx*sigma_vm/sigma_max; 324 calvingratey[iv]=vy*sigma_vm/sigma_max; 350 325 } 351 326 calvingrate[iv] =sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]); … … 356 331 this->AddBasalInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum); 357 332 this->AddBasalInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum); 358 this->AddBasalInput(SigmaVMEnum,&sigma_vm[0],P1DGEnum);359 333 360 334 this->InputExtrude(CalvingratexEnum,-1); 361 335 this->InputExtrude(CalvingrateyEnum,-1); 362 336 this->InputExtrude(CalvingCalvingrateEnum,-1); 363 this->InputExtrude(SigmaVMEnum,-1);364 337 } 365 338 /*}}}*/ … … 847 820 this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum); 848 821 this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum); 822 } 823 /*}}}*/ 824 void Penta::ComputeSigmaVM(){/*{{{*/ 825 826 if(!this->IsOnBase()) return; 827 828 IssmDouble xyz_list[NUMVERTICES][3]; 829 IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 830 IssmDouble lambda1,lambda2,ex,ey,vx,vy,vel; 831 IssmDouble B,n; 832 IssmDouble sigma_vm[NUMVERTICES]; 833 834 /* Get node coordinates and dof list: */ 835 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 836 837 /*Depth average B for stress calculation*/ 838 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 839 this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 840 this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 841 842 /*Retrieve all inputs and parameters we will need*/ 843 Input* vx_input = this->GetInput(VxAverageEnum); _assert_(vx_input); 844 Input* vy_input = this->GetInput(VyAverageEnum); _assert_(vy_input); 845 Input* B_input = this->GetInput(MaterialsRheologyBbarEnum); _assert_(B_input); 846 Input* n_input = this->GetInput(MaterialsRheologyNEnum); _assert_(n_input); 847 848 /* Start looping on the number of vertices: */ 849 GaussPenta gauss; 850 for(int iv=0;iv<3;iv++){ 851 gauss.GaussVertex(iv); 852 853 /*Get velocity components and thickness*/ 854 B_input->GetInputValue(&B,&gauss); 855 n_input->GetInputValue(&n,&gauss); 856 vx_input->GetInputValue(&vx,&gauss); 857 vy_input->GetInputValue(&vy,&gauss); 858 vel=sqrt(vx*vx+vy*vy)+1.e-14; 859 860 /*Compute strain rate and viscosity: */ 861 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input); 862 863 /*Get Eigen values*/ 864 Matrix2x2Eigen(&lambda1,&lambda2,&ex,&ey,epsilon[0],epsilon[2],epsilon[1]); 865 _assert_(!xIsNan<IssmDouble>(lambda1)); 866 _assert_(!xIsNan<IssmDouble>(lambda2)); 867 868 /*Process Eigen values (only account for extension)*/ 869 lambda1 = max(lambda1,0.); 870 lambda2 = max(lambda2,0.); 871 872 /*Calculate sigma_vm*/ 873 IssmDouble epse_2 = 1./2. *(lambda1*lambda1 + lambda2*lambda2); 874 sigma_vm[iv] = sqrt(3.) * B * pow(epse_2,1./(2.*n)); 875 } 876 877 /*Add input*/ 878 this->AddBasalInput(SigmaVMEnum,&sigma_vm[0],P1DGEnum); 879 this->InputExtrude(SigmaVMEnum,-1); 849 880 } 850 881 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.