Changeset 25958 for issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
- Timestamp:
- 01/27/21 17:49:18 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r25956 r25958 5523 5523 /*}}}*/ 5524 5524 void Tria::SealevelchangeMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks){/*{{{*/ 5525 5526 5525 5527 /*early return if we are not on an ice cap OR ocean:*/ 5526 5528 if(!masks->isiceonly[this->lid] && !masks->isoceanin[this->lid]){ … … 5599 5601 } 5600 5602 else if(masks->isiceonly[this->lid]){ 5601 IssmDouble rho_ice, I; 5602 5603 /*recover material parameters: */ 5603 IssmDouble rho_ice, dIdt, dt; 5604 5605 5606 /*recover parameters: */ 5604 5607 rho_ice=FindParam(MaterialsRhoIceEnum); 5608 dt=FindParam(TimesteppingTimeStepEnum); 5605 5609 5606 5610 /*Compute ice thickness change: */ 5607 Input* deltathickness_input=this->GetInput(SurfaceloadIceThickness ChangeEnum);5611 Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessRateEnum); 5608 5612 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level change!"); 5609 deltathickness_input->GetInputAverage(&I); 5610 5611 dI_list[0] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea; 5612 dI_list[1] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea; 5613 dI_list[2] = +4*PI*(rho_ice*I*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea; 5613 deltathickness_input->GetInputAverage(&dIdt); 5614 5615 5616 dI_list[0] = -4*PI*(rho_ice*dIdt*dt*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea; 5617 dI_list[1] = -4*PI*(rho_ice*dIdt*dt*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea; 5618 dI_list[2] = +4*PI*(rho_ice*dIdt*dt*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea; 5614 5619 } 5615 5620 … … 5819 5824 IssmDouble area; 5820 5825 IssmDouble phi=1.0; //WARNING: do not touch this, default is entire elemnt contributes barystatic 5821 IssmDouble I ; //change in ice thickness or water level(Farrel and Clarke, Equ. 4)5826 IssmDouble Idot; //ice thickness rate (Farrel and Clarke, Equ. 4) 5822 5827 bool notfullygrounded=false; 5823 5828 bool scaleoceanarea= false; 5824 5829 bool computerigid= false; 5825 5830 int glfraction=1; 5831 IssmDouble dt=0; 5826 5832 5827 5833 /*output: */ … … 5868 5874 rho_ice=FindParam(MaterialsRhoIceEnum); 5869 5875 rho_water=FindParam(MaterialsRhoSeawaterEnum); 5876 dt=FindParam(TimesteppingTimeStepEnum); 5870 5877 this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum); 5871 5878 this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum); … … 5892 5899 5893 5900 /*Retrieve ice thickness at vertices: */ 5894 Input* deltathickness_input=this->GetInput(SurfaceloadIceThickness ChangeEnum);5901 Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessRateEnum); 5895 5902 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level change!"); 5896 5903 5897 5904 /*/Average ice thickness over grounded area of the element only: {{{*/ 5898 if(!notfullygrounded)deltathickness_input->GetInputAverage(&I );5905 if(!notfullygrounded)deltathickness_input->GetInputAverage(&Idot); 5899 5906 else{ 5900 5907 IssmDouble total_weight=0; … … 5909 5916 /* Start looping on the number of gaussian points and average over these gaussian points: */ 5910 5917 total_weight=0; 5911 I =0;5918 Idot=0; 5912 5919 while(gauss->next()){ 5913 IssmDouble I g=0;5914 deltathickness_input->GetInputValue(&I g,gauss);5915 I +=Ig*gauss->weight;5920 IssmDouble Idotg=0; 5921 deltathickness_input->GetInputValue(&Idotg,gauss); 5922 Idot+=Idotg*gauss->weight; 5916 5923 total_weight+=gauss->weight; 5917 5924 } 5918 I =I/total_weight;5925 Idot=Idot/total_weight; 5919 5926 delete gauss; 5920 5927 } … … 5924 5931 _assert_(oceanarea>0.); 5925 5932 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 5926 bslcice = rho_ice*area*phi*I /(oceanarea*rho_water);5933 bslcice = rho_ice*area*phi*Idot*dt/(oceanarea*rho_water); 5927 5934 _assert_(!xIsNan<IssmDouble>(bslcice)); 5928 5935 5929 5936 if(computerigid){ 5930 5937 /*convert from m to kg/m^2:*/ 5931 I =I*rho_ice*phi;5938 Idot=Idot*rho_ice*phi; 5932 5939 5933 5940 /*convolve:*/ 5934 for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*I ;5941 for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*Idot*dt; 5935 5942 } 5936 5943 … … 5950 5957 IssmDouble area; 5951 5958 IssmDouble phi=1.0; //WARNING: do not touch this, default is entire elemnt contributes barystatic 5952 IssmDouble W; //change in water height thickness (Farrel and Clarke, Equ. 4) 5959 IssmDouble Wdot; //change in water height thickness (Farrel and Clarke, Equ. 4) 5960 IssmDouble dt=0; 5953 5961 bool notfullygrounded=false; 5954 5962 bool scaleoceanarea= false; … … 5983 5991 rho_water=FindParam(MaterialsRhoSeawaterEnum); 5984 5992 rho_freshwater=FindParam(MaterialsRhoFreshwaterEnum); 5993 dt=FindParam(TimesteppingTimeStepEnum); 5985 5994 this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum); 5986 5995 this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum); … … 5993 6002 5994 6003 /*Retrieve water height at vertices: */ 5995 Input* deltathickness_input=this->GetInput(SurfaceloadWaterHeight ChangeEnum);5996 if (!deltathickness_input)_error_("SurfaceloadWaterHeight ChangeEnum input needed to compute sea level change!");5997 deltathickness_input->GetInputAverage(&W );6004 Input* deltathickness_input=this->GetInput(SurfaceloadWaterHeightRateEnum); 6005 if (!deltathickness_input)_error_("SurfaceloadWaterHeightRateEnum input needed to compute sea level change!"); 6006 deltathickness_input->GetInputAverage(&Wdot); 5998 6007 5999 6008 /*Compute barystatic component:*/ 6000 6009 _assert_(oceanarea>0.); 6001 6010 if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 6002 bslchydro = rho_freshwater*area*phi*W /(oceanarea*rho_water);6011 bslchydro = rho_freshwater*area*phi*Wdot*dt/(oceanarea*rho_water); 6003 6012 _assert_(!xIsNan<IssmDouble>(bslchydro)); 6004 6013 6005 6014 if(computeelastic){ 6006 6015 /*convert from m to kg/m^2:*/ 6007 W =W*rho_freshwater*phi;6016 Wdot=Wdot*rho_freshwater*phi; 6008 6017 6009 6018 /*convolve:*/ 6010 for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*W ;6019 for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*Wdot*dt; 6011 6020 } 6012 6021 … … 6118 6127 /*diverse:*/ 6119 6128 int gsize; 6120 IssmDouble I , S, BP; //change in relative ice thickness and sea level6129 IssmDouble Idot, S, BP; //change in relative ice thickness and sea level 6121 6130 IssmDouble rho_ice,rho_water; 6122 6131 int horiz; … … 6182 6191 } 6183 6192 else if (masks->isiceonly[this->lid]){ 6193 IssmDouble dt=0; 6194 dt=FindParam(TimesteppingTimeStepEnum); 6184 6195 6185 6196 /*Compute ice thickness change: */ 6186 Input* deltathickness_input=this->GetInput(SurfaceloadIceThickness ChangeEnum);6197 Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessRateEnum); 6187 6198 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level change!"); 6188 deltathickness_input->GetInputAverage(&I );6199 deltathickness_input->GetInputAverage(&Idot); 6189 6200 6190 6201 /*convert to kg/m^2*/ 6191 I =I*rho_ice;6202 Idot=Idot*rho_ice; 6192 6203 6193 6204 for(int i=0;i<gsize;i++){ 6194 Up[i]+=I *GU[i];6205 Up[i]+=Idot*dt*GU[i]; 6195 6206 if(horiz){ 6196 North[i]+=I *GN[i];6197 East[i]+=I *GE[i];6207 North[i]+=Idot*dt*GN[i]; 6208 East[i]+=Idot*dt*GE[i]; 6198 6209 } 6199 6210 }
Note:
See TracChangeset
for help on using the changeset viewer.