Changeset 26650
- Timestamp:
- 11/19/21 12:21:28 (3 years ago)
- Location:
- issm/trunk-jpl/src/c/analyses
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyShaktiAnalysis.cpp
r26632 r26650 154 154 parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.relaxation",HydrologyRelaxationEnum)); 155 155 parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.storage",HydrologyStorageEnum)); 156 157 /*Deal with friction parameters*/ 158 int frictionlaw; 159 iomodel->FindConstant(&frictionlaw,"md.friction.law"); 160 if(frictionlaw==6){ 161 parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum)); 162 } 163 if(frictionlaw==4){ 164 parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum)); 165 parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum)); 166 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 167 } 168 if(frictionlaw==1 || frictionlaw==3 || frictionlaw==7){ 169 parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum)); 170 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 171 } 172 if(frictionlaw==9){ 173 parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum)); 174 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 175 parameters->AddObject(new IntParam(FrictionCouplingEnum,0)); 176 } 156 177 157 178 /*Requested outputs*/ … … 465 486 466 487 /*Get thickness and base on nodes to apply cap on water head*/ 467 IssmDouble* eff_pressure = xNew<IssmDouble>(numnodes);468 488 IssmDouble* thickness = xNew<IssmDouble>(numnodes); 469 489 IssmDouble* bed = xNew<IssmDouble>(numnodes); … … 496 516 values[i] = head_old[i] - relaxation*(head_old[i]-values[i]); 497 517 498 /*Calculate effective pressure*/499 eff_pressure[i] = rho_ice*g*thickness[i] - rho_water*g*(values[i]-bed[i]);500 501 518 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector"); 502 519 if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector"); … … 505 522 /*Add input to the element: */ 506 523 element->AddInput(HydrologyHeadEnum,values,element->GetElementType()); 507 element->AddInput(EffectivePressureEnum,eff_pressure,P1Enum);508 524 509 525 /*Update reynolds number according to new solution*/ … … 519 535 IssmDouble reynolds = conductivity*sqrt(dh[0]*dh[0]+dh[1]*dh[1])/NU; 520 536 element->AddInput(HydrologyReynoldsEnum,&reynolds,P0Enum); 537 538 /*Compute new effective pressure*/ 539 this->UpdateEffectivePressure(element); 521 540 522 541 /*Free resources:*/ … … 526 545 xDelete<IssmDouble>(xyz_list); 527 546 xDelete<int>(doflist); 528 xDelete<IssmDouble>(eff_pressure);529 547 xDelete<IssmDouble>(head_old); 530 548 }/*}}}*/ … … 724 742 delete gauss; 725 743 }/*}}}*/ 744 void HydrologyShaktiAnalysis::UpdateEffectivePressure(FemModel* femmodel){/*{{{*/ 745 746 for(Object* & object : femmodel->elements->objects){ 747 Element* element=xDynamicCast<Element*>(object); 748 UpdateEffectivePressure(element); 749 } 750 751 }/*}}}*/ 752 void HydrologyShaktiAnalysis::UpdateEffectivePressure(Element* element){/*{{{*/ 753 754 /*Skip if water or ice shelf element*/ 755 if(element->IsAllFloating()) return; 756 757 /*Intermediaries*/ 758 IssmDouble bed,thickness,head; 759 760 /* Fetch number of nodes and allocate output*/ 761 int numnodes = element->GetNumberOfNodes(); 762 IssmDouble* N = xNew<IssmDouble>(numnodes); 763 764 /*Retrieve all inputs and parameters*/ 765 IssmDouble g = element->FindParam(ConstantsGEnum); 766 IssmDouble rho_ice = element->FindParam(MaterialsRhoIceEnum); 767 IssmDouble rho_water = element->FindParam(MaterialsRhoFreshwaterEnum); 768 Input* head_input = element->GetInput(HydrologyHeadEnum); _assert_(head_input); 769 Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input); 770 Input* base_input = element->GetInput(BaseEnum); _assert_(base_input); 771 772 773 Gauss* gauss=element->NewGauss(); 774 for (int i=0;i<numnodes;i++){ 775 gauss->GaussNode(element->GetElementType(),i); 776 777 base_input->GetInputValue(&bed,gauss); 778 thickness_input->GetInputValue(&thickness,gauss); 779 head_input->GetInputValue(&head,gauss); 780 781 N[i] = rho_ice*g*thickness - rho_water*g*(head-bed); 782 } 783 784 /*Add new gap as an input*/ 785 element->AddInput(EffectivePressureEnum,N,element->GetElementType()); 786 787 /*Clean up and return*/ 788 xDelete<IssmDouble>(N); 789 delete gauss; 790 }/*}}}*/ -
issm/trunk-jpl/src/c/analyses/HydrologyShaktiAnalysis.h
r26047 r26650 36 36 void UpdateGapHeight(FemModel* femmodel); 37 37 void UpdateGapHeight(Element* element); 38 void UpdateEffectivePressure(FemModel* femmodel); 39 void UpdateEffectivePressure(Element* element); 38 40 }; 39 41 #endif
Note:
See TracChangeset
for help on using the changeset viewer.