Changeset 24968
- Timestamp:
- 06/04/20 19:56:33 (5 years ago)
- 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 5751 5751 void Tria::SealevelriseEustatic(IssmDouble* Sgi, IssmDouble* peustatic, SealevelMasks* masks, IssmDouble oceanarea){ /*{{{*/ 5752 5752 5753 /*Computational flags:*/5754 5753 int bp_compute_fingerprints= 0; 5755 5756 /* some paramters first:*/5754 5755 /*Compute bottom pressure contribution from ocean if requested:*/ 5757 5756 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); 5768 5761 5769 5762 } … … 5777 5770 IssmDouble I; //change in ice thickness or water level(Farrel and Clarke, Equ. 4) 5778 5771 bool notfullygrounded=false; 5772 bool scaleoceanarea= false; 5779 5773 5780 5774 /*elastic green function:*/ … … 5782 5776 5783 5777 /*ice properties: */ 5784 IssmDouble rho_ice,rho_water ,rho_earth;5778 IssmDouble rho_ice,rho_water; 5785 5779 5786 5780 /*constants:*/ … … 5789 5783 /*Initialize eustatic component: do not skip this step :):*/ 5790 5784 IssmDouble eustatic = 0.; 5791 5792 /*Computational flags:*/5793 bool computerigid = true;5794 bool computeelastic= true;5795 bool scaleoceanarea= false;5796 5785 5797 5786 /*early return if we are not on an ice cap:*/ … … 5827 5816 rho_water=FindParam(MaterialsRhoSeawaterEnum); 5828 5817 5829 /*recover love numbers and computational flags: */5818 /*recover ocean area scaling: */ 5830 5819 this->parameters->FindParam(&scaleoceanarea,SealevelriseOceanAreaScalingEnum); 5831 5820 … … 5836 5825 this->GetInput2Value(&area,AreaEnum); 5837 5826 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){ 5840 5829 IssmDouble xyz_list[NUMVERTICES][3]; 5841 5830 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 5842 5831 5843 5832 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: */ 5848 5837 Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 5849 5838 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!"); 5850 5839 5851 /* If we are fully grounded, take the average over the element: {{{*/5840 /*/Average ice thickness over grounded area of the element only: {{{*/ 5852 5841 if(!notfullygrounded)deltathickness_input->GetInputAverage(&I); 5853 5842 else{ … … 5876 5865 /*}}}*/ 5877 5866 5878 /*Compute eustatic compo ent:*/5867 /*Compute eustatic component:*/ 5879 5868 _assert_(oceanarea>0.); 5880 5869 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 … … 5893 5882 } 5894 5883 /*}}}*/ 5895 void Tria::Sealevelrise EustaticBottomPressure(IssmDouble* Sgi,IssmDouble* peustatic, IssmDouble oceanarea){ /*{{{*/5884 void Tria::SealevelriseBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){ /*{{{*/ 5896 5885 5897 5886 /*diverse:*/ 5898 5887 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) 5906 5890 5907 5891 /*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; 5927 5899 5928 5900 /*Inform mask: */ 5901 #ifdef _ISSM_DEBUG_ 5929 5902 constant=1; this->AddInput2(SealevelEustaticMaskEnum,&constant,P0Enum); 5903 #endif 5930 5904 5931 5905 /*recover material parameters: */ 5932 5906 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); 5991 5910 5992 5911 /*Get area of element: precomputed in the sealevelrise_core_geometry:*/ 5993 5912 this->GetInput2Value(&area,AreaEnum); 5994 5913 5995 /* Compute bottom pressure change: */5914 /*Retrieve bottom pressure change and average over the element: */ 5996 5915 Input2* bottompressure_change_input=this->GetInput2(DslSeaWaterPressureChangeAtSeaFloor); 5997 5916 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 6043 5925 return; 6044 5926 } -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r24947 r24968 169 169 void SealevelriseEustatic(IssmDouble* Sgi, IssmDouble* peustatic,SealevelMasks* masks, IssmDouble oceanarea); 170 170 void SealevelriseEustaticIce(IssmDouble* Sgi, IssmDouble* peustatic,SealevelMasks* masks, IssmDouble oceanarea); 171 void Sealevelrise EustaticBottomPressure(IssmDouble* Sgi, IssmDouble* peustatic,IssmDouble oceanarea);171 void SealevelriseBottomPressure(IssmDouble* Sgi,SealevelMasks* masks); 172 172 void SealevelriseNonEustatic(IssmDouble* Sgo,IssmDouble* Sg_old,SealevelMasks* masks); 173 173 void SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg,SealevelMasks* masks);
Note:
See TracChangeset
for help on using the changeset viewer.