Changeset 27489


Ignore:
Timestamp:
01/01/23 07:32:41 (2 years ago)
Author:
Mathieu Morlighem
Message:

CHG: fone with linearize=2 (elementwise friction)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Loads/Friction.cpp

    r27478 r27489  
    3434         * There are exceptions, e.g. HO, which needs the user to specify the dimension used in Friciton.*/
    3535
     36        /*Intermediaries*/
     37        int linearization_type;
     38
    3639        this->element=element_in;
    3740        this->linearize  = 0;
     
    6568
    6669        if(this->law==1){
    67                 element_in->FindParam(&this->linearize,FrictionLinearizeEnum);
    68                 if(this->linearize){
    69                         this->linearize = 0; /*Change to make sure we do the calculation once*/
     70                element_in->FindParam(&linearization_type,FrictionLinearizeEnum);
     71                if(linearization_type==0){
     72                        /*Don't do anything*/
     73                }
     74                else if(linearization_type==1){
    7075                        int numvertices = this->element->GetNumberOfVertices();
    7176                        this->alpha2_list            = xNew<IssmDouble>(numvertices);
     
    7580                                gauss->GaussVertex(iv);
    7681                                this->GetAlpha2(&this->alpha2_list[iv], gauss);
    77                                 IssmDouble temp = 0.;
    78                                 this->GetAlpha2(&temp, gauss);
    7982                                this->GetAlphaComplement(&this->alpha2_complement_list[iv], gauss);
    8083                        }
    81                         this->linearize = 1; /*Change back, we are now all set!*/
     84                        this->linearize = linearization_type; /*Change back, we are now all set!*/
     85                        delete gauss;
     86                }
     87                else if(linearization_type==2){
     88                        this->alpha2_list            = xNew<IssmDouble>(1);
     89                        this->alpha2_complement_list = xNew<IssmDouble>(1);
     90                        Gauss* gauss=element->NewGauss(1); gauss->GaussPoint(0);
     91                        this->GetAlpha2(&this->alpha2_list[0], gauss);
     92                        this->GetAlphaComplement(&this->alpha2_complement_list[0], gauss);
     93                        this->linearize = linearization_type; /*Change back, we are now all set!*/
     94                        delete gauss;
     95                }
     96                else{
     97                        _error_("not supported yet");
    8298                }
    8399        }
     
    94110Friction::~Friction(){/*{{{*/
    95111        if(this->linearize){
    96                 printf("linearize = %i\n",this->linearize);
    97112                xDelete<IssmDouble>(this->alpha2_list);
    98113                xDelete<IssmDouble>(this->alpha2_complement_list);
     
    111126        switch(this->law){
    112127                case 1:
    113                         GetAlphaViscousComplement(palpha_complement,gauss);
     128                        if(this->linearize==0){
     129                                GetAlphaViscousComplement(palpha_complement,gauss);
     130                        }
     131                        else if(this->linearize==1){
     132                                this->element->ValueP1OnGauss(palpha_complement, this->alpha2_complement_list, gauss);
     133                        }
     134                        else if(this->linearize==2){
     135                                *palpha_complement = this->alpha2_complement_list[0];
     136                        }
     137                        else{
     138                                _error_("not supported yet");
     139                        }
     140                        break;
    114141                        break;
    115142                case 2:
     
    333360        switch(this->law){
    334361                case 1:
    335                         if(this->linearize){
     362                        if(this->linearize==0){
     363                                GetAlpha2Viscous(palpha2,gauss);
     364                        }
     365                        else if(this->linearize==1){
    336366                                this->element->ValueP1OnGauss(palpha2, this->alpha2_list, gauss);
    337367                        }
     368                        else if(this->linearize==2){
     369                                *palpha2 = this->alpha2_list[0];
     370                        }
    338371                        else{
    339                                 GetAlpha2Viscous(palpha2,gauss);
     372                                _error_("not supported yet");
    340373                        }
    341374                        break;
     
    12881321        switch(frictionlaw){
    12891322                case 1:
    1290                         //parameters->AddObject(iomodel->CopyConstantObject("md.friction.linearize",FrictionLinearizeEnum));
     1323                        parameters->AddObject(iomodel->CopyConstantObject("md.friction.linearize",FrictionLinearizeEnum));
    12911324                        parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
    12921325                        parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
Note: See TracChangeset for help on using the changeset viewer.