Changeset 24968


Ignore:
Timestamp:
06/04/20 19:56:33 (5 years ago)
Author:
Eric.Larour
Message:

CHG: bottom pressure fingerprints computations.

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r24964 r24968  
    57515751void    Tria::SealevelriseEustatic(IssmDouble* Sgi, IssmDouble* peustatic, SealevelMasks* masks, IssmDouble oceanarea){ /*{{{*/
    57525752
    5753         /*Computational flags:*/
    57545753        int bp_compute_fingerprints= 0;
    5755 
    5756         /*some paramters first: */
     5754               
     5755        /*Compute bottom pressure contribution from ocean if requested:*/
    57575756        this->parameters->FindParam(&bp_compute_fingerprints,DslComputeFingerprintsEnum);
    5758 
    5759         if(!masks->isoceanin[this->lid]){
    5760                 /*ok, there is ocean in this element, we should compute eustatic loads for the ocean if we have requested
    5761                  *bottom pressure fingerprints:*/
    5762                 if(bp_compute_fingerprints)this->SealevelriseEustaticBottomPressure(Sgi,peustatic,oceanarea);
    5763         }
    5764         //if(!IsIceInElement()){
    5765                 /*there is ice in this eleemnt, let's compute the eustatic response for ice changes:*/
    5766                 this->SealevelriseEustaticIce(Sgi,peustatic,masks, oceanarea);
    5767         //}
     5757        if(bp_compute_fingerprints)this->SealevelriseBottomPressure(Sgi,masks);
     5758
     5759        /*Compute eustatic ice contribution to sea level rise: */
     5760        this->SealevelriseEustaticIce(Sgi,peustatic,masks, oceanarea);
    57685761
    57695762}
     
    57775770        IssmDouble I;  //change in ice thickness or water level(Farrel and Clarke, Equ. 4)
    57785771        bool notfullygrounded=false;
     5772        bool scaleoceanarea= false;
    57795773
    57805774        /*elastic green function:*/
     
    57825776
    57835777        /*ice properties: */
    5784         IssmDouble rho_ice,rho_water,rho_earth;
     5778        IssmDouble rho_ice,rho_water;
    57855779
    57865780        /*constants:*/
     
    57895783        /*Initialize eustatic component: do not skip this step :):*/
    57905784        IssmDouble eustatic = 0.;
    5791 
    5792         /*Computational flags:*/
    5793         bool computerigid = true;
    5794         bool computeelastic= true;
    5795         bool scaleoceanarea= false;
    57965785
    57975786        /*early return if we are not on an ice cap:*/
     
    58275816        rho_water=FindParam(MaterialsRhoSeawaterEnum);
    58285817
    5829         /*recover love numbers and computational flags: */
     5818        /*recover ocean area scaling: */
    58305819        this->parameters->FindParam(&scaleoceanarea,SealevelriseOceanAreaScalingEnum);
    58315820
     
    58365825        this->GetInput2Value(&area,AreaEnum);
    58375826
    5838         /*factor to reduce area if we are not fully grounded:*/
    5839         if(notfullygrounded){ /*{{{*/
     5827        /*Compute fraction of the element that is grounded: */
     5828        if(notfullygrounded){
    58405829                IssmDouble xyz_list[NUMVERTICES][3];
    58415830                ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
    58425831
    58435832                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
    5844         }
    5845         /*}}}*/
    5846 
    5847         /*Compute ice thickness: */
     5833        } 
     5834        else phi=1.0;
     5835
     5836        /*Retrieve ice thickness at vertices: */
    58485837        Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
    58495838        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    58505839
    5851         /*If we are fully grounded, take the average over the element: {{{*/
     5840        /*/Average ice thickness over grounded area of the element only: {{{*/
    58525841        if(!notfullygrounded)deltathickness_input->GetInputAverage(&I);
    58535842        else{
     
    58765865        /*}}}*/
    58775866
    5878         /*Compute eustatic compoent:*/
     5867        /*Compute eustatic component:*/
    58795868        _assert_(oceanarea>0.);
    58805869        if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2
     
    58935882}
    58945883/*}}}*/
    5895 void    Tria::SealevelriseEustaticBottomPressure(IssmDouble* Sgi,IssmDouble* peustatic, IssmDouble oceanarea){ /*{{{*/
     5884void    Tria::SealevelriseBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){ /*{{{*/
    58965885
    58975886        /*diverse:*/
    58985887        int gsize;
    5899         bool spherical=true;
    5900         IssmDouble llr_list[NUMVERTICES][3];
    5901         IssmDouble area,planetarea;
    5902         IssmDouble I;  //change in ice thickness or water level(Farrel and Clarke, Equ. 4)
    5903         IssmDouble rho;
    5904         IssmDouble late,longe,re;
    5905         IssmDouble lati,longi,ri;
     5888        IssmDouble area;
     5889        IssmDouble BP;  //change in bottom pressure (Farrel and Clarke, Equ. 4)
    59065890
    59075891        /*elastic green function:*/
    5908         IssmDouble* G_elastic_precomputed=NULL;
    5909         int         M;
    5910 
    5911         /*ice properties: */
    5912         IssmDouble rho_water,rho_earth;
    5913 
    5914         /*constants:*/
    5915         IssmDouble constant=0;
    5916 
    5917         /*Initialize eustatic component: do not skip this step :):*/
    5918         IssmDouble eustatic = 0.;
    5919 
    5920         /*Computational flags:*/
    5921         bool computerigid = true;
    5922         bool computeelastic= true;
    5923         bool scaleoceanarea= false;
    5924         bool bp_compute_fingerprints= false;
    5925 
    5926         /*we are here to compute fingerprints originating fromn bottom pressure loads:*/
     5892        IssmDouble* G=NULL;
     5893       
     5894        /*water properties: */
     5895        IssmDouble rho_water;
     5896
     5897        /*we are here to compute fingerprints originating fromn bottom pressure changes:*/
     5898        if(!masks->isoceanin[this->lid])return;
    59275899
    59285900        /*Inform mask: */
     5901        #ifdef _ISSM_DEBUG_
    59295902        constant=1; this->AddInput2(SealevelEustaticMaskEnum,&constant,P0Enum);
     5903        #endif
    59305904
    59315905        /*recover material parameters: */
    59325906        rho_water=FindParam(MaterialsRhoSeawaterEnum);
    5933         rho_earth=FindParam(MaterialsEarthDensityEnum);
    5934 
    5935         /*recover earth area: */
    5936         this->parameters->FindParam(&planetarea,SealevelPlanetAreaEnum);
    5937 
    5938         /*recover love numbers and computational flags: */
    5939         this->parameters->FindParam(&computerigid,SealevelriseRigidEnum);
    5940         this->parameters->FindParam(&computeelastic,SealevelriseElasticEnum);
    5941         this->parameters->FindParam(&scaleoceanarea,SealevelriseOceanAreaScalingEnum);
    5942 
    5943         /*recover elastic green function:*/
    5944         if(computeelastic){
    5945                 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum));
    5946                 _assert_(parameter);
    5947                 parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M);
    5948         }
    5949 
    5950         /*how many dofs are we working with here? */
    5951         this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
    5952 
    5953         /* Where is the centroid of this element?:{{{*/
    5954 
    5955         /*retrieve coordinates: */
    5956         ::GetVerticesCoordinates(&llr_list[0][0],this->vertices,NUMVERTICES,spherical);
    5957 
    5958         IssmDouble minlong=400;
    5959         IssmDouble maxlong=-20;
    5960         for (int i=0;i<NUMVERTICES;i++){
    5961                 llr_list[i][0]=(90-llr_list[i][0]);
    5962                 if(llr_list[i][1]<0)llr_list[i][1]=180+(180+llr_list[i][1]);
    5963                 if(llr_list[i][1]>maxlong)maxlong=llr_list[i][1];
    5964                 if(llr_list[i][1]<minlong)minlong=llr_list[i][1];
    5965         }
    5966         if(minlong==0 && maxlong>180){
    5967                 if (llr_list[0][1]==0)llr_list[0][1]=360;
    5968                 if (llr_list[1][1]==0)llr_list[1][1]=360;
    5969                 if (llr_list[2][1]==0)llr_list[2][1]=360;
    5970         }
    5971 
    5972         // correction at the north pole
    5973         if(llr_list[0][0]==0)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
    5974         if(llr_list[1][0]==0)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
    5975         if(llr_list[2][0]==0)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
    5976 
    5977         //correction at the south pole
    5978         if(llr_list[0][0]==180)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
    5979         if(llr_list[1][0]==180)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
    5980         if(llr_list[2][0]==180)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
    5981 
    5982         late=(llr_list[0][0]+llr_list[1][0]+llr_list[2][0])/3.0;
    5983         longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    5984 
    5985         late=90-late;
    5986         if(longe>180)longe=(longe-180)-180;
    5987 
    5988         late=late/180*PI;
    5989         longe=longe/180*PI;
    5990         /*}}}*/
     5907
     5908        /*retrieve precomputed G:*/
     5909        this->inputs2->GetArrayPtr(SealevelriseGEnum,this->lid,&G,&gsize);
    59915910
    59925911        /*Get area of element: precomputed in the sealevelrise_core_geometry:*/
    59935912        this->GetInput2Value(&area,AreaEnum);
    59945913
    5995         /*Compute bottom pressure change: */
     5914        /*Retrieve bottom pressure change and average over the element: */
    59965915        Input2* bottompressure_change_input=this->GetInput2(DslSeaWaterPressureChangeAtSeaFloor);
    59975916        if (!bottompressure_change_input)_error_("bottom pressure input needed to compute sea level rise fingerprint!");
    5998 
    5999         /*If we are fully grounded, take the average over the element: */
    6000         bottompressure_change_input->GetInputAverage(&I);
    6001 
    6002         /*Compute eustatic compoent:*/
    6003         _assert_(oceanarea>0.);
    6004         if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2
    6005 
    6006         /*We do not need to add the bottom pressure component to the eustatic value: */
    6007         eustatic += 0;
    6008         IssmDouble* latitude=NULL; //NOT GOING TO WORK!
    6009         IssmDouble* longitude=NULL; //NOT GOING TO WORK!
    6010 
    6011         if(computeelastic | computerigid){
    6012                 IssmDouble alpha;
    6013                 IssmDouble delPhi,delLambda;
    6014                 for(int i=0;i<gsize;i++){
    6015 
    6016                         IssmDouble G_rigid=0;  //do not remove =0!
    6017                         IssmDouble G_elastic=0;  //do not remove =0!
    6018 
    6019                         /*Compute alpha angle between centroid and current vertex : */
    6020                         lati=latitude[i]/180*PI; longi=longitude[i]/180*PI;
    6021 
    6022                    delPhi=fabs(lati-late); delLambda=fabs(longi-longe);
    6023                         alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
    6024 
    6025                         //Rigid earth gravitational perturbation:
    6026                         if(computerigid)G_rigid=1.0/2.0/sin(alpha/2.0);
    6027 
    6028                         //Elastic component  (from Eq 17 in Adhikari et al, GMD 2015)
    6029                         if(computeelastic){
    6030                                 int index=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1));
    6031                                 G_elastic += G_elastic_precomputed[index];
    6032                         }
    6033 
    6034                         /*Add all components to the pSgi or pSgo solution vectors:*/
    6035                         Sgi[i]+=3*rho_water/rho_earth*area/planetarea*I*(G_rigid+G_elastic);
    6036                 }
    6037         }
    6038 
    6039         /*Assign output pointer:*/
    6040         _assert_(!xIsNan<IssmDouble>(eustatic));
    6041         _assert_(!xIsInf<IssmDouble>(eustatic));
    6042         *peustatic=eustatic;
     5917        bottompressure_change_input->GetInputAverage(&BP);
     5918
     5919        /*convert from m to kg/m^2:*/
     5920        BP=BP*rho_water;
     5921
     5922        /*convolve:*/
     5923        for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*BP;
     5924
    60435925        return;
    60445926}
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r24947 r24968  
    169169                void    SealevelriseEustatic(IssmDouble* Sgi, IssmDouble* peustatic,SealevelMasks* masks, IssmDouble oceanarea);
    170170                void    SealevelriseEustaticIce(IssmDouble* Sgi, IssmDouble* peustatic,SealevelMasks* masks, IssmDouble oceanarea);
    171                 void    SealevelriseEustaticBottomPressure(IssmDouble* Sgi, IssmDouble* peustatic,IssmDouble oceanarea);
     171                void    SealevelriseBottomPressure(IssmDouble* Sgi,SealevelMasks* masks);
    172172                void    SealevelriseNonEustatic(IssmDouble* Sgo,IssmDouble* Sg_old,SealevelMasks* masks);
    173173                void    SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg,SealevelMasks* masks);
Note: See TracChangeset for help on using the changeset viewer.