Changeset 11373


Ignore:
Timestamp:
02/08/12 16:49:03 (13 years ago)
Author:
cborstad
Message:

matice changes for new damage variable

Location:
issm/trunk-jpl-damage/src/c/objects/Materials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl-damage/src/c/objects/Materials/Matice.cpp

    r11291 r11373  
    218218}
    219219/*}}}*/
     220/*FUNCTION Matice::GetZ {{{1*/
     221double Matice::GetZ(){
     222
     223        /*Output*/
     224        double Z;
     225
     226        inputs->GetInputAverage(&Z,MaterialsRheologyZEnum);
     227        return Z;
     228}
     229/*}}}*/
     230/*FUNCTION Matice::GetZbar {{{1*/
     231double Matice::GetZbar(){
     232
     233        /*Output*/
     234        double Zbar;
     235
     236        inputs->GetInputAverage(&Zbar,MaterialsRheologyZbarEnum);
     237        return Zbar;
     238}
     239/*}}}*/
    220240/*FUNCTION Matice::GetN {{{1*/
    221241double Matice::GetN(){
     
    263283void  Matice::GetViscosity2d(double* pviscosity, double* epsilon){
    264284        /*From a string tensor and a material object, return viscosity, using Glen's flow law.
    265                                                                                                     B
     285                                                                                                  Z * B
    266286          viscosity= -------------------------------------------------------------------
    267287                                                  2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
    268288
    269           where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity
    270           vector, and n the flow law exponent.
     289          where viscosity is the viscosity, Z the damage effect variable (1-D),
     290          B the flow law parameter, (u,v) the velocity vector, and n the flow law exponent.
    271291
    272292          If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we
     
    282302        /*Intermediary: */
    283303        double A,e;
    284         double B,n;
    285 
    286         /*Get B and n*/
    287         B=GetBbar();
     304        double Btmp,B,n,Z;
     305
     306        /*Get B, Z and n*/
     307        Btmp=GetBbar();
     308        Z=GetZbar();
    288309        n=GetN();
     310        B=Z*Btmp;
    289311
    290312        if (n==1){
     
    318340        if(viscosity<=0) _error_("Negative viscosity");
    319341        _assert_(B>0);
     342        _assert_(Z>0);
    320343        _assert_(n>0);
    321344
     
    329352        /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]:
    330353         *
    331          *                                               B
     354         *                                             Z * B
    332355         * viscosity3d= -------------------------------------------------------------------
    333356         *                      2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
     
    348371        /*Intermediaries: */
    349372        double A,e;
    350         double B,n;
     373        double Btmp,B,n,Z;
    351374
    352375        /*Get B and n*/
    353         B=GetB();
     376        Btmp=GetB();
     377        Z=GetZ();
    354378        n=GetN();
     379        B=Z*Btmp;
    355380
    356381        if (n==1){
     
    389414        if(viscosity3d<=0) _error_("Negative viscosity");
    390415        _assert_(B>0);
     416        _assert_(Z>0);
    391417        _assert_(n>0);
    392418
     
    399425        /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]:
    400426         *
    401          *                                          B
     427         *                                        Z * B
    402428         * viscosity3d= -------------------------------------------------------------------
    403429         *                   2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
     
    418444        /*Intermediaries: */
    419445        double A,e;
    420         double B,n;
     446        double Btmp,B,Z,n;
    421447        double eps0;
    422448
    423449        /*Get B and n*/
    424450        eps0=pow((double)10,(double)-27);
    425         B=GetB();
    426         n=GetN();
     451        Btmp=GetB();
     452        Z=GetZ();
     453        n=GetB();
     454        B=Z*Btmp;
    427455       
    428456        if (n==1){
     
    461489        if(viscosity3d<=0) _error_("Negative viscosity");
    462490        _assert_(B>0);
     491        _assert_(Z>0);
    463492        _assert_(n>0);
    464493
     
    490519
    491520        /*Get B and n*/
    492         B=GetBbar();
     521        B=GetBbar(); /* why is this needed in this function? */
    493522        n=GetN();
    494523
     
    508537               
    509538                        viscosity_complement=1/(2*pow(A,e));
     539                }
     540        }
     541        else{
     542                viscosity_complement=4.5*pow((double)10,(double)17);
     543        }
     544
     545        /*Checks in debugging mode*/
     546        _assert_(B>0); /* shouldn't be necessary as B is never used! */
     547        _assert_(n>0);
     548        _assert_(viscosity_complement>0);
     549               
     550        /*Return: */
     551        *pviscosity_complement=viscosity_complement;
     552}
     553/*}}}*/
     554/*FUNCTION Matice::GetViscosityZComplement {{{1*/
     555void  Matice::GetViscosityZComplement(double* pviscosity_complement, double* epsilon){
     556        /*Return viscosity derivative for control method d(mu)/dZ:
     557         *
     558         *                                                                                             B
     559         * dviscosity= -------------------------------------------------------------------
     560         *                                2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n]
     561         *
     562         * If epsilon is NULL, it means this is the first time Gradjb is being run, and we
     563         * return mu20, initial viscosity.
     564         */
     565       
     566        /*output: */
     567        double viscosity_complement;
     568
     569        /*input strain rate: */
     570        double exx,eyy,exy;
     571
     572        /*Intermediary value A and exponent e: */
     573        double A,e;
     574        double B,n;
     575
     576        /*Get B and n*/
     577        B=GetBbar();
     578        n=GetN();
     579
     580        if(epsilon){
     581                exx=*(epsilon+0);
     582                eyy=*(epsilon+1);
     583                exy=*(epsilon+2);
     584
     585                /*Build viscosity: mu2=B/(2*A^e) */
     586                A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy;
     587                if(A==0){
     588                        /*Maximum viscosity_complement for 0 shear areas: */
     589                        viscosity_complement=2.25*pow((double)10,(double)17);
     590                }
     591                else{
     592                        e=(n-1)/(2*n);
     593               
     594                        viscosity_complement=B/(2*pow(A,e));
    510595                }
    511596        }
     
    685770                        this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,nodeinputs));
    686771                }
     772               
     773                /*Get Z*/
     774                if (iomodel->Data(MaterialsRheologyZEnum)) {
     775                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)];
     776                        this->inputs->AddInput(new TriaP1Input(MaterialsRheologyZbarEnum,nodeinputs));
     777                }
    687778
    688779                /*Get n*/
     
    706797                                                }
    707798                                                break;
     799                                        case MaterialsRheologyZbarEnum:
     800                                                if (iomodel->Data(MaterialsRheologyZEnum)){
     801                                                        _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));
     802                                                        for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)];
     803                                                        for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     804                                                        for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     805                                                        this->inputs->AddInput(new ControlInput(MaterialsRheologyZbarEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     806                                                }
     807                                                break;
    708808                                }
    709809                        }
     
    726826                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)];
    727827                        this->inputs->AddInput(new PentaP1Input(MaterialsRheologyBEnum,nodeinputs));
     828                }
     829               
     830                /*Get Z*/
     831                if (iomodel->Data(MaterialsRheologyZEnum)) {
     832                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)];
     833                        this->inputs->AddInput(new PentaP1Input(MaterialsRheologyZEnum,nodeinputs));
    728834                }
    729835
     
    748854                                                }
    749855                                                break;
     856                                        case MaterialsRheologyZbarEnum:
     857                                                if (iomodel->Data(MaterialsRheologyZEnum)){
     858                                                        _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));
     859                                                        for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)];
     860                                                        for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     861                                                        for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i];
     862                                                        this->inputs->AddInput(new ControlInput(MaterialsRheologyZbarEnum,PentaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
     863                                                }
     864                                                break;
     865
    750866                                }
    751867                        }
     
    766882                                name==MaterialsRheologyBEnum ||
    767883                                name==MaterialsRheologyBbarEnum ||
     884                                name==MaterialsRheologyZEnum ||
     885                                name==MaterialsRheologyZbarEnum ||
    768886                                name==MaterialsRheologyNEnum
    769887                ){
  • issm/trunk-jpl-damage/src/c/objects/Materials/Matice.h

    r10576 r11373  
    6868                void   GetViscosity3dStokes(double* pviscosity3d, double* epsilon);
    6969                void   GetViscosityComplement(double* pviscosity_complement, double* pepsilon);
     70                void   GetViscosityZComplement(double* pviscosity_complement, double* pepsilon);
    7071                double GetB();
    7172                double GetBbar();
     73                double GetZ();
     74                double GetZbar();
    7275                double GetN();
    7376                bool   IsInput(int name);
Note: See TracChangeset for help on using the changeset viewer.