Changeset 21797


Ignore:
Timestamp:
07/14/17 10:41:25 (8 years ago)
Author:
seroussi
Message:

BUG: confusion between CG and DG

File:
1 edited

Legend:

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

    r21794 r21797  
    469469
    470470        /*Intermediaries */
     471        int         migration_style,point1;
     472        bool        mainlyfloating;
     473        IssmDouble  fraction1,fraction2;
    471474        IssmDouble  Jdet,dt;
    472475        IssmDouble  ms,mb,gmb,fmb,thickness;
    473476        IssmDouble  gllevelset,phi=1.;
    474477        IssmDouble* xyz_list = NULL;
     478        Gauss*      gauss     = NULL;
    475479
    476480        /*Fetch number of nodes and dof for this finite element*/
     
    490494        Input* thickness_input     = element->GetInput(ThicknessEnum);                            _assert_(thickness_input);
    491495
     496        /*Recover portion of element that is grounded*/
     497        phi=element->GetGroundedPortion(xyz_list);
     498        if(migration_style==SubelementMigration2Enum){
     499                gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
     500                element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
     501           gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,3);
     502        }
     503        else{
     504                gauss = element->NewGauss(3);
     505        }
     506
    492507        /* Start  looping on the number of gaussian points: */
    493         Gauss* gauss=element->NewGauss(2);
    494508        for(int ig=gauss->begin();ig<gauss->end();ig++){
    495509                gauss->GaussPoint(ig);
     
    501515                gmb_input->GetInputValue(&gmb,gauss);
    502516                fmb_input->GetInputValue(&fmb,gauss);
    503                 gllevelset_input->GetInputValue(&phi,gauss);
     517                gllevelset_input->GetInputValue(&gllevelset,gauss);
    504518                thickness_input->GetInputValue(&thickness,gauss);
    505                 if(phi>0.) mb=gmb;
    506                 else mb=fmb;
     519
     520                if(migration_style==SubelementMigrationEnum){
     521                        if (phi<0.00000001) mb=gmb;
     522                        else mb=(1-phi)*fmb+phi*gmb; // phi is the fraction of grounded ice so (1-phi) is floating
     523                }
     524                else if(migration_style==SubelementMigration2Enum){
     525                        if(gllevelset>0.) mb=gmb;
     526                        else mb=fmb;
     527                }
     528                else if(migration_style==SubelementMigration3Enum){
     529                        if (phi<0.00000001) mb=gmb;
     530                        else mb=gmb;
     531                }
     532                else{
     533                        if(gllevelset>0) mb=gmb;
     534                        else mb=fmb;
     535                }
    507536
    508537                for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb))*basis[i];
     
    521550
    522551        /*Intermediaries */
    523         int         migration_style,point1;
    524         bool        mainlyfloating;
    525         IssmDouble  Jdet,fraction1,fraction2;
    526         IssmDouble  dt,gllevelset;
     552        IssmDouble  Jdet,dt;
    527553        IssmDouble  ms,mb,gmb,fmb,thickness,phi=1.;
    528554        IssmDouble* xyz_list = NULL;
    529         Gauss*      gauss     = NULL;
    530555
    531556        /*Fetch number of nodes and dof for this finite element*/
     
    545570        Input* thickness_input     = element->GetInput(ThicknessEnum);                           _assert_(thickness_input);
    546571
    547         /*Recover portion of element that is grounded*/
    548         phi=element->GetGroundedPortion(xyz_list);
    549         if(migration_style==SubelementMigration2Enum){
    550                 gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    551                 element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
    552            gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,3);
    553         }
    554         else{
    555                 gauss = element->NewGauss(3);
    556         }
    557 
    558572        /* Start  looping on the number of gaussian points: */
     573        Gauss* gauss=element->NewGauss(2);
    559574        for(int ig=gauss->begin();ig<gauss->end();ig++){
    560575                gauss->GaussPoint(ig);
     
    566581                gmb_input->GetInputValue(&gmb,gauss);
    567582                fmb_input->GetInputValue(&fmb,gauss);
    568                 gllevelset_input->GetInputValue(&gllevelset,gauss);
     583                gllevelset_input->GetInputValue(&phi,gauss);
    569584                thickness_input->GetInputValue(&thickness,gauss);
    570                 if(migration_style==SubelementMigrationEnum){
    571                         if (phi<0.00000001) mb=gmb;
    572                         else mb=(1-phi)*fmb+phi*gmb; // phi is the fraction of grounded ice so (1-phi) is floating
    573                 }
    574                 else if(migration_style==SubelementMigration2Enum){
    575                         if(gllevelset>0.) mb=gmb;
    576                         else mb=fmb;
    577                 }
    578                 else if(migration_style==SubelementMigration3Enum){
    579                         if (phi<0.00000001) mb=gmb;
    580                         else mb=gmb;
    581                 }
    582                 else{
    583                         if(gllevelset>0) mb=gmb;
    584                         else mb=fmb;
    585                 }
     585
     586                if(phi>0.) mb=gmb;
     587                else mb=fmb;
    586588
    587589                for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(thickness+dt*(ms-mb))*basis[i];
Note: See TracChangeset for help on using the changeset viewer.