Changeset 18136


Ignore:
Timestamp:
06/10/14 16:29:46 (11 years ago)
Author:
cborstad
Message:

CHG: working on a new damage evolution source term

Location:
issm/trunk-jpl/src/c/analyses
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp

    r18057 r18136  
    266266
    267267        /*Intermediaries*/
    268         int      domaintype;
     268        int      domaintype,damagelaw;
    269269        Element* basalelement;
    270270        IssmDouble  Jdet,dt;
     
    285285        }
    286286
     287
    287288        /*Fetch number of nodes and dof for this finite element*/
    288289        int numnodes = basalelement->GetNumberOfNodes();
     
    295296        basalelement->GetVerticesCoordinates(&xyz_list);
    296297        basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    297         this->CreateDamageFInput(basalelement);
     298        basalelement->FindParam(&damagelaw,DamageLawEnum);
     299        if(damagelaw==1 | damagelaw==2){
     300                this->CreateDamageFInputPralong(basalelement);
     301        }
     302        else if(damagelaw==3){
     303                this->CreateDamageFInputExp(basalelement);
     304        }
    298305        Input* damaged_input = basalelement->GetInput(DamageDEnum); _assert_(damaged_input);
    299306        Input* damagef_input = basalelement->GetInput(DamageFEnum); _assert_(damagef_input);
     
    440447
    441448/*Intermediaries*/
    442 void DamageEvolutionAnalysis::CreateDamageFInput(Element* element){/*{{{*/
     449void DamageEvolutionAnalysis::CreateDamageFInputPralong(Element* element){/*{{{*/
    443450
    444451        /*Intermediaries */
     
    527534        delete gauss;
    528535}/*}}}*/
     536void DamageEvolutionAnalysis::CreateDamageFInputExp(Element* element){/*{{{*/
     537
     538        /*Intermediaries */
     539        IssmDouble epsf,stress_threshold,eps0;
     540        IssmDouble damage,B,n,epseff;
     541        IssmDouble eps_xx,eps_yy,eps_xy,eps1,eps2,epstmp;
     542        int domaintype,damagelaw;
     543
     544        /*Fetch number of vertices and allocate output*/
     545        int numnodes = element->GetNumberOfNodes();
     546        IssmDouble* f   = xNew<IssmDouble>(numnodes);
     547
     548        /*retrieve parameters:*/
     549        element->FindParam(&epsf,DamageC1Enum);
     550        element->FindParam(&stress_threshold,DamageStressThresholdEnum);
     551        element->FindParam(&domaintype,DomainTypeEnum);
     552        element->FindParam(&damagelaw,DamageLawEnum);
     553
     554        /*Compute stress tensor: */
     555        element->ComputeDeviatoricStressTensor();
     556
     557        /*retrieve what we need: */
     558        Input* eps_xx_input  = element->GetInput(StrainRatexxEnum);     _assert_(eps_xx_input);
     559        Input* eps_xy_input  = element->GetInput(StrainRatexyEnum);     _assert_(eps_xy_input);
     560        Input* eps_yy_input  = element->GetInput(StrainRateyyEnum);     _assert_(eps_yy_input);
     561        Input*  n_input=element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
     562        Input* damage_input = NULL;
     563        Input* B_input = NULL;
     564        if(domaintype==Domain2DhorizontalEnum){
     565                damage_input = element->GetInput(DamageDbarEnum);       _assert_(damage_input);
     566                B_input=element->GetInput(MaterialsRheologyBbarEnum); _assert_(B_input);
     567        }
     568        else{
     569                damage_input = element->GetInput(DamageDEnum);   _assert_(damage_input);
     570                B_input=element->GetInput(MaterialsRheologyBEnum); _assert_(B_input);
     571        }
     572
     573        /*Calculate damage evolution source term: */
     574        Gauss* gauss=element->NewGauss();
     575        for (int i=0;i<numnodes;i++){
     576                gauss->GaussNode(element->GetElementType(),i);
     577               
     578                eps_xx_input->GetInputValue(&eps_xx,gauss);
     579                eps_xy_input->GetInputValue(&eps_xy,gauss);
     580                eps_yy_input->GetInputValue(&eps_yy,gauss);
     581                B_input->GetInputValue(&B,gauss);
     582                n_input->GetInputValue(&n,gauss);
     583                damage_input->GetInputValue(&damage,gauss);
     584       
     585                /*Calculate principal effective strain rates*/
     586                eps1=(eps_xx+eps_yy)/2.+sqrt(pow((eps_xx-eps_yy)/2.,2)+pow(eps_xy,2));
     587                eps2=(eps_xx+eps_yy)/2.-sqrt(pow((eps_xx-eps_yy)/2.,2)+pow(eps_xy,2));
     588                if(fabs(eps2)>fabs(eps1)){epstmp=eps2; eps2=eps1; eps1=epstmp;}
     589
     590                /*Calculate effective strain rate and threshold strain rate*/
     591                epseff=1./sqrt(2.)*sqrt(eps1*eps1-eps1*eps2+eps2*eps2);
     592                eps0=pow(stress_threshold/B,n);
     593
     594                if(epseff>eps0){
     595                        f[i]=1.-pow(eps0/epseff,1./n)*exp(-(epseff-eps0)/(epsf-eps0))-damage;
     596                }
     597                else f[i]=0;
     598        }
     599
     600        /*Add input*/
     601        element->AddInput(DamageFEnum,f,element->GetElementType());
     602       
     603        /*Clean up and return*/
     604        xDelete<IssmDouble>(f);
     605        delete gauss;
     606}/*}}}*/
  • issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.h

    r18057 r18136  
    3434
    3535                /*Intermediaries*/
    36                 void CreateDamageFInput(Element* element);
     36                void CreateDamageFInputPralong(Element* element);
     37                void CreateDamageFInputExp(Element* element);
    3738};
    3839#endif
Note: See TracChangeset for help on using the changeset viewer.