Changeset 15869
- Timestamp:
- 08/22/13 07:52:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15868 r15869 5059 5059 void Penta::ComputeBasalMeltrate(void){ 5060 5060 /*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/ 5061 // Do nothing for now. 5061 5062 /*Parameters*/ 5063 int dim; 5064 parameters->FindParam(&dim, MeshDimensionEnum); 5065 5066 /* Intermediaries */ 5067 bool isenthalpy; 5068 int i, analysis_type; 5069 IssmDouble xyz_list[NUMVERTICES][3]; 5070 IssmDouble heatflux, geothermalflux_value; 5071 IssmDouble vec_heatflux[dim]; 5072 IssmDouble normal_base[dim], d1enthalpy[dim]; 5073 IssmDouble kappa; 5074 IssmDouble enthalpy, enthalpyup; 5075 IssmDouble pressure, pressureup; 5076 IssmDouble meltrate, watercolumn; 5077 IssmDouble temperature, waterfraction; 5078 IssmDouble latentheat; 5079 IssmDouble basalfriction, alpha2; 5080 IssmDouble vx,vy,vz; 5081 IssmDouble dt; 5082 Friction* friction=NULL; 5083 GaussPenta* gauss=NULL; 5084 GaussPenta* gaussup=NULL; 5085 5086 /*check that dimension is 3*/ 5087 if(dim!=3) return; 5088 /* Only compute melt rates at the base of grounded ice*/ 5089 if(!IsOnBed() || IsFloating()) return; 5090 /*Check wether enthalpy is activated*/ 5091 parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 5092 if(!isenthalpy) return; 5093 5094 /*Fetch parameters: */ 5095 latentheat=matpar->GetLatentHeat(); 5096 5097 Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input); 5098 Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); 5099 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 5100 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 5101 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); 5102 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input); 5103 Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input); 5104 5105 /*Build friction element, needed later: */ 5106 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 5107 friction=new Friction("3d",inputs,matpar,analysis_type); 5108 5109 /* Start looping on the number of gaussian points: */ 5110 gauss=new GaussPenta(0,1,2,2); 5111 gaussup=new GaussPenta(3,4,5,2); 5112 for(int ig=gauss->begin();ig<gauss->end();ig++){ 5113 gauss->GaussPoint(ig); 5114 gaussup->GaussPoint(ig); 5115 5116 watercolumn_input->GetInputValue(&watercolumn, gauss); 5117 enthalpy_input->GetInputValue(&enthalpy, gauss); 5118 pressure_input->GetInputValue(&pressure, gauss); 5119 5120 /*Calculate basal meltrate*/ 5121 if((watercolumn>0) && (enthalpy<matpar->PureIceEnthalpy(pressure))) 5122 enthalpy=matpar->PureIceEnthalpy(pressure); 5123 else if(enthalpy<matpar->PureIceEnthalpy(pressure)){ 5124 meltrate=0.; //TODO: set zero meltrate and watercolumn in model 5125 watercolumn=0.; 5126 return; 5127 } 5128 5129 /*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice) */ 5130 enthalpy_input->GetInputValue(&enthalpyup, gaussup); 5131 pressure_input->GetInputValue(&pressureup, gaussup); 5132 if(enthalpyup>=matpar->PureIceEnthalpy(pressureup)) 5133 for(i=0;i<dim;i++) 5134 vec_heatflux[i]=0.; 5135 else{ 5136 enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss); 5137 kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure); 5138 for(i=0;i<dim;i++) 5139 vec_heatflux[i]=-1.*kappa*d1enthalpy[i]; 5140 } 5141 /*Get normal at base*/ 5142 normal_base[0]=0.; normal_base[1]=0.; normal_base[2]=1.; // TODO: get normal from model geometry 5143 5144 heatflux=0.; 5145 for(i=0;i<dim;i++) 5146 heatflux+=(vec_heatflux[i])*normal_base[i]; 5147 geothermalflux_input->GetInputValue(&geothermalflux_value,gauss); 5148 5149 matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy,pressure); 5150 5151 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 5152 vx_input->GetInputValue(&vx,gauss); 5153 vy_input->GetInputValue(&vy,gauss); 5154 vz_input->GetInputValue(&vz,gauss); 5155 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0)); 5156 meltrate=(basalfriction-(heatflux-geothermalflux_value))/(1-waterfraction)/latentheat; 5157 5158 /*Update water column*/ 5159 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5160 if(reCast<bool,IssmDouble>(dt)) 5161 watercolumn+=dt*meltrate; 5162 else 5163 watercolumn=meltrate; 5164 // TODO: feed meltrate & watercolumn back to model 5165 } 5062 5166 } 5063 5167 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.