Changeset 26158
- Timestamp:
- 03/29/21 09:14:55 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp ¶
r26152 r26158 5534 5534 dI_list[2] = +4*M_PI*(rho_water*S*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea; 5535 5535 } 5536 else if(masks->isiceonly[this->lid]){ 5537 IssmDouble rho_ice, I; 5538 5539 /*recover material parameters: */ 5536 if(masks->isiceonly[this->lid]){ 5537 5538 IssmDouble rho_ice,I; 5539 bool computerigid= false; 5540 5541 bool notfullygrounded=false; 5542 5543 bool scaleoceanarea= false; 5544 int glfraction=1; 5545 IssmDouble phi=1.0; 5546 /*{{{*/ 5547 5548 5549 5550 if (masks->isfullyfloating[this->lid]){ 5551 I=0; 5552 this->AddInput(EffectivePressureEnum,&I,P0Enum); 5553 return; 5554 } 5555 5556 5557 5558 if (masks->notfullygrounded[this->lid]) notfullygrounded=true; //used later on. 5559 5560 /*recover some parameters:*/ 5540 5561 rho_ice=FindParam(MaterialsRhoIceEnum); 5541 5542 /*Compute ice thickness change: */ 5562 this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum); 5563 this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum); 5564 this->parameters->FindParam(&glfraction,SolidearthSettingsGlfractionEnum); 5565 5566 /*Get area of element: precomputed in the sealevelchange_geometry:*/ 5567 this->Element::GetInputValue(&area,AreaEnum); 5568 5569 /*Compute fraction of the element that is grounded: */ 5570 if(notfullygrounded){ 5571 IssmDouble xyz_list[NUMVERTICES][3]; 5572 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 5573 5574 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 5575 if(glfraction==0)phi=1; 5576 #ifdef _ISSM_DEBUG_ 5577 this->AddInput(SealevelBarystaticMaskEnum,&phi,P0Enum); 5578 #endif 5579 } 5580 else phi=1.0; 5581 5582 /*Retrieve surface load for ice: */ 5543 5583 Input* deltathickness_input=this->GetInput(DeltaIceThicknessEnum); 5544 if (!deltathickness_input)_error_("DeltaIceThicknessEnum delta ice thickness input needed to compute sea level change!"); 5545 deltathickness_input->GetInputAverage(&I); 5584 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level change!"); 5585 5586 /*/Average ice thickness over grounded area of the element only: {{{*/ 5587 if(!notfullygrounded)deltathickness_input->GetInputAverage(&I); 5588 else{ 5589 IssmDouble total_weight=0; 5590 bool mainlyfloating = true; 5591 int point1; 5592 IssmDouble fraction1,fraction2; 5593 5594 /*Recover portion of element that is grounded*/ 5595 this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating); 5596 Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2); 5597 5598 /* Start looping on the number of gaussian points and average over these gaussian points: */ 5599 total_weight=0; 5600 I=0; 5601 while(gauss->next()){ 5602 IssmDouble Ig=0; 5603 deltathickness_input->GetInputValue(&Ig,gauss); 5604 I+=Ig*gauss->weight; 5605 total_weight+=gauss->weight; 5606 } 5607 I=I/total_weight; 5608 delete gauss; 5609 } 5610 /*}}}*/ 5611 5612 /*}}}*/ 5613 /*convert to kg/m^2*/ 5614 I=I*phi; 5546 5615 5547 5616 dI_list[0] = -4*M_PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea; … … 6053 6122 /*diverse:*/ 6054 6123 int gsize; 6055 IssmDouble I, S, BP; //change in relative ice thickness and sea level 6124 IssmDouble I=0; 6125 IssmDouble S=0; 6126 IssmDouble BP=0; 6056 6127 IssmDouble rho_ice,rho_water; 6057 6128 int horiz; … … 6065 6136 /*computational flags:*/ 6066 6137 bool computeelastic= false; 6138 bool computerigid= false; 6139 bool notfullygrounded=false; 6140 bool scaleoceanarea= false; 6141 int glfraction=1; 6142 IssmDouble area; 6143 IssmDouble phi=1.0; 6067 6144 6068 6145 /*early return if we are not on the ocean or on an ice cap:*/ … … 6116 6193 } 6117 6194 } 6118 else if (masks->isiceonly[this->lid]){ 6119 6120 /*Compute ice thickness change: */ 6195 if (masks->isiceonly[this->lid]){ 6196 6197 if (masks->isfullyfloating[this->lid]) return; 6198 6199 6200 if (masks->notfullygrounded[this->lid]) notfullygrounded=true; //used later on. 6201 6202 /*recover some parameters:*/ 6203 rho_ice=FindParam(MaterialsRhoIceEnum); 6204 rho_water=FindParam(MaterialsRhoSeawaterEnum); 6205 this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum); 6206 this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum); 6207 this->parameters->FindParam(&glfraction,SolidearthSettingsGlfractionEnum); 6208 6209 /*Get area of element: precomputed in the sealevelchange_geometry:*/ 6210 this->Element::GetInputValue(&area,AreaEnum); 6211 6212 /*Compute fraction of the element that is grounded: */ 6213 if(notfullygrounded){ 6214 IssmDouble xyz_list[NUMVERTICES][3]; 6215 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 6216 6217 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 6218 if(glfraction==0)phi=1; 6219 #ifdef _ISSM_DEBUG_ 6220 this->AddInput(SealevelBarystaticMaskEnum,&phi,P0Enum); 6221 #endif 6222 } 6223 else phi=1.0; 6224 6225 /*Retrieve surface load for ice: */ 6121 6226 Input* deltathickness_input=this->GetInput(DeltaIceThicknessEnum); 6122 if (!deltathickness_input)_error_("DeltaIceThicknessEnum delta thickness input needed to compute sea level change!"); 6123 deltathickness_input->GetInputAverage(&I); 6227 if (!deltathickness_input)_error_("delta thickness input needed to compute sea level change!"); 6228 6229 /*/Average ice thickness over grounded area of the element only: {{{*/ 6230 if(!notfullygrounded)deltathickness_input->GetInputAverage(&I); 6231 else{ 6232 IssmDouble total_weight=0; 6233 bool mainlyfloating = true; 6234 int point1; 6235 IssmDouble fraction1,fraction2; 6236 6237 /*Recover portion of element that is grounded*/ 6238 this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating); 6239 Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2); 6240 6241 /* Start looping on the number of gaussian points and average over these gaussian points: */ 6242 total_weight=0; 6243 I=0; 6244 while(gauss->next()){ 6245 IssmDouble Ig=0; 6246 deltathickness_input->GetInputValue(&Ig,gauss); 6247 I+=Ig*gauss->weight; 6248 total_weight+=gauss->weight; 6249 } 6250 I=I/total_weight; 6251 delete gauss; 6252 } 6253 /*}}}*/ 6124 6254 6125 6255 /*convert to kg/m^2*/ 6126 I=I*rho_ice ;6127 6256 I=I*rho_ice*phi; 6257 6128 6258 for(int i=0;i<gsize;i++){ 6129 6259 Up[i]+=I*GU[i];
Note:
See TracChangeset
for help on using the changeset viewer.