Changeset 16359
- Timestamp:
- 10/10/13 06:55:53 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/enthalpy_core.cpp
r16219 r16359 30 30 InputToResultx(femmodel,EnthalpyEnum); 31 31 InputToResultx(femmodel,WaterfractionEnum); 32 InputToResultx(femmodel,WatercolumnEnum); 33 InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 32 34 } 33 35 } -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16357 r16359 4526 4526 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 4527 4527 IssmDouble Jdet2d,dt; 4528 IssmDouble rho_ice,heatcapacity,geothermalflux_value; 4528 IssmDouble rho_ice,heatcapacity; 4529 IssmDouble geothermalflux_value, heatflux_value; 4529 4530 IssmDouble basalfriction,alpha2,vx,vy,vz; 4530 4531 IssmDouble scalar,enthalpy,enthalpyup; … … 4563 4564 gauss=new GaussPenta(0,1,2,2); 4564 4565 gaussup=new GaussPenta(3,4,5,2); 4566 4565 4567 for(int ig=gauss->begin();ig<gauss->end();ig++){ 4566 4568 … … 4575 4577 watercolumn_input->GetInputValue(&watercolumn,gauss); 4576 4578 4577 if((watercolumn ==0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){4579 if((watercolumn<=0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){ 4578 4580 /* the above check is equivalent to 4579 4581 NOT ((watercolumn>0.) AND (enthalpy<PIE)) AND (enthalpy<PIE)*/ … … 4586 4588 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0)); 4587 4589 4588 scalar=gauss->weight*Jdet2d*(basalfriction+geothermalflux_value)/(rho_ice); 4590 heatflux_value=(basalfriction+geothermalflux_value)/(rho_ice); 4591 scalar=gauss->weight*Jdet2d*heatflux_value; 4589 4592 if(reCast<bool,IssmDouble>(dt)) scalar=dt*scalar; 4590 4593 for(i=0;i<numdof;i++) pe->values[i]+=scalar*basis[i]; … … 5014 5017 bool isenthalpy,isdynamicbasalspc,setspc; 5015 5018 int numindices, numindicesup; 5016 IssmDouble h_pmp,pressure, pressureup; 5017 IssmDouble enthalpy, enthalpyup; 5019 IssmDouble pressure, pressureup; 5020 IssmDouble h_pmp, enthalpy, enthalpyup; 5021 IssmDouble watercolumn; 5018 5022 int *indices = NULL, *indicesup = NULL; 5019 5023 … … 5035 5039 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 5036 5040 Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); 5041 Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); //_assert_(watercolumn_input); 5037 5042 5038 5043 /*if there is a temperate layer of zero thickness, set spc enthalpy=h_pmp at that node*/ … … 5047 5052 enthalpy_input->GetInputValue(&enthalpy, gauss); 5048 5053 pressure_input->GetInputValue(&pressure, gauss); 5054 watercolumn_input->GetInputValue(&watercolumn,gauss); 5049 5055 setspc = false; 5050 5056 if (enthalpy>=matpar->PureIceEnthalpy(pressure)){ … … 5054 5060 enthalpy_input->GetInputValue(&enthalpyup, gaussup); 5055 5061 pressure_input->GetInputValue(&pressureup, gaussup); 5056 setspc=( enthalpyup<matpar->PureIceEnthalpy(pressureup))?true:false;5062 setspc=((enthalpyup<matpar->PureIceEnthalpy(pressureup)) && (watercolumn>=0.))?true:false; 5057 5063 } 5058 5064 … … 5096 5102 IssmDouble vx[NUMVERTICES],vy[NUMVERTICES],vz[NUMVERTICES]; 5097 5103 IssmDouble geothermalflux[NUMVERTICES]; 5098 IssmDouble dt,meltingrate_enthalpy; 5104 IssmDouble dt; 5105 IssmDouble meltingrate_enthalpy; 5099 5106 Friction *friction = NULL; 5100 5107 … … 5108 5115 /*Fetch parameters and inputs */ 5109 5116 latentheat=matpar->GetLatentHeat(); 5110 rho_ice= this->matpar->GetRhoIce();5117 rho_ice=matpar->GetRhoIce(); 5111 5118 GetInputListOnVertices(&vx[0],VxEnum); 5112 5119 GetInputListOnVertices(&vy[0],VyEnum); … … 5149 5156 istemperatelayer=false; 5150 5157 if(enthalpy[iv+3]>=matpar->PureIceEnthalpy(pressure[iv+3])) istemperatelayer=true; 5151 if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; 5158 if(istemperatelayer) for(i=0;i<3;i++) vec_heatflux[i]=0.; // TODO: add -k*nabla T_pmp 5152 5159 else{ 5153 5160 enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss); 5154 kappa=matpar->GetEnthalpyDiffusionParameter (enthalpy[iv],pressure[iv]); _assert_(kappa>0.);5161 kappa=matpar->GetEnthalpyDiffusionParameterVolume(enthalpy[iv],enthalpy[iv+NUMVERTICES2D], pressure[iv],pressure[iv+NUMVERTICES2D]); _assert_(kappa>0.); 5155 5162 for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i]; 5156 5163 } … … 5166 5173 5167 5174 matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure[iv]); 5168 meltingrate_enthalpy=(basalfriction-(heatflux-geothermalflux[iv]))/((1-waterfraction)*latentheat*rho_ice); // m/yr water equivalent5169 }5170 5175 // -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66 5176 meltingrate_enthalpy=(heatflux+basalfriction+geothermalflux[iv])/((1-waterfraction)*latentheat*rho_ice); // m/s water equivalent 5177 } 5171 5178 /*Update water column, basal meltingrate*/ 5172 basalmeltingrate[iv]+=meltingrate_enthalpy; 5179 //basalmeltingrate[iv]+=meltingrate_enthalpy; 5180 basalmeltingrate[iv]=meltingrate_enthalpy; 5173 5181 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5174 5182 if(reCast<bool,IssmDouble>(dt)) 5175 5183 watercolumn[iv]+=dt*meltingrate_enthalpy; 5176 5184 else 5177 5185 watercolumn[iv]+=meltingrate_enthalpy; 5178 5186 } 5179 5187 /*feed updated variables back into model*/ … … 5193 5201 bool isenthalpy; 5194 5202 IssmDouble waterfraction[NUMVERTICES], temperature[NUMVERTICES]; 5203 IssmDouble watercolumnbase[NUMVERTICES]; 5195 5204 IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES]; 5196 5205 IssmDouble latentheat, dt; 5206 IssmDouble dw, dwc; 5207 Penta *pentabase = NULL; 5197 5208 5198 5209 /*Check wether enthalpy is activated*/ 5199 5210 parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 5200 5211 if(!isenthalpy) return; 5201 5212 5213 /*get basal element, needed for basal watercolumn*/ 5214 pentabase=this->GetBasalElement(); 5215 5202 5216 GetInputListOnVertices(&enthalpy[0],EnthalpyEnum); 5203 5217 GetInputListOnVertices(&pressure[0],PressureEnum); 5218 pentabase->GetInputListOnVertices(&watercolumnbase[0], WatercolumnEnum); 5219 5204 5220 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5205 5221 latentheat=matpar->GetLatentHeat(); … … 5207 5223 for(int iv=0;iv<NUMVERTICES;iv++){ 5208 5224 matpar->EnthalpyToThermal(&temperature[iv],&waterfraction[iv], enthalpy[iv],pressure[iv]); 5209 5225 dw=DrainageFunctionWaterfraction(waterfraction[iv], dt); 5210 5226 /*drain water fraction & update enthalpy*/ 5211 waterfraction[iv]-= DrainageFunctionWaterfraction(waterfraction[iv], dt);5227 waterfraction[iv]-=dw; 5212 5228 matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]); 5229 /*add drained water to watercolumn at base*/ 5230 dwc=dw*this->IceVolume(); 5231 watercolumnbase[iv%NUMVERTICES2D]+=dwc; 5213 5232 } 5214 5233 /*feed updated results back into model*/ 5215 5234 this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum)); 5216 5235 this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum)); 5217 // this->inputs->AddInput(new PentaInput(TemperatureEnum,temperature,P1Enum)); // temperature should not change during drainage... 5236 pentabase->inputs->AddInput(new PentaInput(WatercolumnEnum, watercolumnbase,P1Enum)); 5237 5238 delete pentabase; 5218 5239 } 5219 5240 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp
r16322 r16359 385 385 } 386 386 /*}}}*/ 387 /*FUNCTION Matpar::GetEnthalpyDiffusionParameterVolume{{{*/ 388 IssmDouble Matpar::GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy0, IssmDouble enthalpy1, IssmDouble pressure0, IssmDouble pressure1){ 389 /*returns kappa depending on distribution of enthalpy over edge of element 390 lambda is the barycentric coordinate that solves H0+(H1-H0)*lambda=H_pureice. 391 it represents the fraction of the ice column which is temperate/cold like H0. 392 if lambda<0 or lambda>1, then the whole ice column is cold or temperate, respectively. 393 */ 394 IssmDouble kappa, kappa0, kappa1; 395 if (enthalpy0!=enthalpy1){ 396 IssmDouble lambda=(PureIceEnthalpy(pressure0)-enthalpy0)/(enthalpy1-enthalpy0); 397 if ((lambda>=0.) && (lambda<=1.)){ 398 kappa0=GetEnthalpyDiffusionParameter(enthalpy0,pressure0); 399 kappa1=GetEnthalpyDiffusionParameter(enthalpy1,pressure1); 400 kappa=lambda*kappa0+(1.-lambda)*kappa1; 401 } 402 } 403 else 404 kappa=GetEnthalpyDiffusionParameter(enthalpy0, pressure0); 405 return kappa; 406 } 407 /*}}}*/ 387 408 /*FUNCTION Matpar::EnthalpyToThermal {{{*/ 388 409 void Matpar::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){ -
issm/trunk-jpl/src/c/classes/Materials/Matpar.h
r16350 r16359 126 126 IssmDouble PureIceEnthalpy(IssmDouble pressure); 127 127 IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure); 128 IssmDouble GetEnthalpyDiffusionParameterVolume(IssmDouble enthalpy0, IssmDouble enthalpy1, IssmDouble pressure0, IssmDouble pressure1); 128 129 IssmDouble GetLithosphereShearModulus(); 129 130 IssmDouble GetLithosphereDensity(); -
issm/trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp
r16144 r16359 15 15 IssmDouble w0=0.01, w1=0.02, w2=0.03; 16 16 IssmDouble Dret, D0=0, D1=0.005, D2=0.05; 17 IssmDouble yts=365*24*60*60; 18 dt/=yts; 17 19 18 20 /*get drainage function value*/
Note:
See TracChangeset
for help on using the changeset viewer.