Ignore:
Timestamp:
01/27/22 18:17:58 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added sigmavm for Julia

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r26694 r26830  
    271271
    272272        if(!this->IsOnBase()) return;
    273 
    274         IssmDouble  xyz_list[NUMVERTICES][3];
    275         IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
     273        this->ComputeSigmaVM();
     274
    276275        IssmDouble  calvingratex[NUMVERTICES];
    277276        IssmDouble  calvingratey[NUMVERTICES];
    278277        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;
    286281
    287282        /*Depth average B for stress calculation*/
    288         this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
    289283        this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
    290284        this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
     
    295289        Input* gr_input = this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
    296290        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);
    299291        Input* smax_fl_input = this->GetInput(CalvingStressThresholdFloatingiceEnum); _assert_(smax_fl_input);
    300292        Input* smax_gr_input = this->GetInput(CalvingStressThresholdGroundediceEnum); _assert_(smax_gr_input);
    301293        Input* sl_input  = this->GetInput(SealevelEnum); _assert_(sl_input);
     294        Input* sigma_vm_input = this->GetInput(SigmaVMEnum); _assert_(sigma_vm_input);
    302295
    303296        /* Start looping on the number of vertices: */
     
    307300
    308301                /*Get velocity components and thickness*/
    309                 B_input->GetInputValue(&B,&gauss);
    310                 n_input->GetInputValue(&n,&gauss);
    311302                vx_input->GetInputValue(&vx,&gauss);
    312303                vy_input->GetInputValue(&vy,&gauss);
     304                sigma_vm_input->GetInputValue(&sigma_vm,&gauss);
    313305                gr_input->GetInputValue(&groundedice,&gauss);
    314306                bs_input->GetInputValue(&bed,&gauss);
    315307                smax_fl_input->GetInputValue(&sigma_max_floating,&gauss);
    316308                smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss);
    317                 vel=sqrt(vx*vx+vy*vy)+1.e-14;
    318309                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));
    335310
    336311                /*Tensile stress threshold*/
     
    346321                }
    347322                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;
    350325                }
    351326                calvingrate[iv] =sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]);
     
    356331        this->AddBasalInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
    357332        this->AddBasalInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
    358         this->AddBasalInput(SigmaVMEnum,&sigma_vm[0],P1DGEnum);
    359333
    360334        this->InputExtrude(CalvingratexEnum,-1);
    361335        this->InputExtrude(CalvingrateyEnum,-1);
    362336        this->InputExtrude(CalvingCalvingrateEnum,-1);
    363         this->InputExtrude(SigmaVMEnum,-1);
    364337}
    365338/*}}}*/
     
    847820        this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
    848821        this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
     822}
     823/*}}}*/
     824void       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);
    849880}
    850881/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.