Changeset 21375


Ignore:
Timestamp:
11/14/16 13:12:25 (8 years ago)
Author:
Eric.Larour
Message:

CHG: better handling of fraction of grounded area that contributes SLR.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-larour-NatGeoScience2016/src/c/classes/Elements/Tria.cpp

    r21324 r21375  
    10661066
    10671067        }
    1068         else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum){
     1068        else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
    10691069                /*Check that not all nodes are grounded or floating*/
    10701070                if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
     
    36223622        IssmDouble late,longe,re;
    36233623        IssmDouble lati,longi,ri;
     3624        bool notfullygrounded=false;
    36243625
    36253626        /*elastic green function:*/
     
    36423643                *peustatic=0; //do not forget to assign this pointer, otherwise, global eustatic will be garbage!
    36433644                return;
     3645        }
     3646
     3647        /*early return if we are fully floating: */
     3648        if (this->inputs->Max(MaskGroundediceLevelsetEnum)<=0){
     3649                *peustatic=0; //do not forget to assign this pointer, otherwise, global eustatic will be garbage!
     3650                return;
     3651        }
     3652       
     3653        /*If we are here, we are on ice that is fully grounded or half-way to floating: */
     3654        if ((this->inputs->Min(MaskGroundediceLevelsetEnum))<0){
     3655                notfullygrounded=true; //used later on.
    36443656        }
    36453657
     
    37033715        /*}}}*/
    37043716
    3705         /*Compute area of element:*/
     3717        /*Compute area of element. Scale it by grounded fraction if not fully grounded: */
    37063718        area=GetAreaSpherical();
    3707 
     3719        if(notfullygrounded){
     3720                IssmDouble phi=0;
     3721                IssmDouble xyz_list[NUMVERTICES][3];
     3722                ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     3723
     3724                phi=this->GetGroundedPortion(&xyz_list[0][0]); //watch out, this only works because of the Thales theorem! We are in 3D, but this routine is inherently for 2D trias
     3725                area*=phi;
     3726        }
     3727       
    37083728        /*Compute ice thickness change: */
    37093729        Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum);
    37103730        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    3711         deltathickness_input->GetInputAverage(&I);
    3712 
    3713         /*Are we on an ice shelf? if so, does not contribute to sea level rise!: */
    3714         if (this->IsFloating()) I=0;
     3731
     3732        /*If we are fully grounded, take the average over the element: */
     3733        if(!notfullygrounded)deltathickness_input->GetInputAverage(&I);
     3734        else{
     3735                IssmDouble total_weight=0;
     3736                bool mainlyfloating = true;
     3737                int         point1;
     3738                IssmDouble  fraction1,fraction2;
     3739               
     3740                /*Recover portion of element that is grounded*/
     3741                this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
     3742                Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
     3743
     3744                /* Start  looping on the number of gaussian points and average over these gaussian points: */
     3745                total_weight=0;
     3746                I=0;
     3747                for(int ig=gauss->begin();ig<gauss->end();ig++){
     3748                        IssmDouble Ig=0;
     3749                        gauss->GaussPoint(ig);
     3750                        deltathickness_input->GetInputValue(&Ig);
     3751                        I+=Ig*gauss->weight;
     3752                        total_weight+=gauss->weight;
     3753                }
     3754                I=I/total_weight;
     3755                delete gauss;
     3756        }
    37153757
    37163758        /*Compute eustatic compoent:*/
Note: See TracChangeset for help on using the changeset viewer.