Changeset 16026
- Timestamp:
- 08/30/13 06:48:44 (12 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r16007 r16026 306 306 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\ 307 307 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\ 308 ./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.h\ 309 ./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.cpp\ 308 310 ./modules/Delta18oParameterizationx/Delta18oParameterizationx.h\ 309 311 ./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp\ -
issm/trunk-jpl/src/c/analyses/steadystate_core.cpp
r15849 r16026 92 92 if(isenthalpy) InputToResultx(femmodel,WaterfractionEnum); 93 93 if(isenthalpy) InputToResultx(femmodel,EnthalpyEnum); 94 if(!isenthalpy) InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 94 if(isenthalpy) InputToResultx(femmodel,WatercolumnEnum); 95 //if(!isenthalpy) InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 96 InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 95 97 femmodel->RequestedOutputsx(requested_outputs,numoutputs); 96 98 } -
issm/trunk-jpl/src/c/analyses/transient_core.cpp
r15983 r16026 111 111 else{ 112 112 enthalpy_core(femmodel); 113 PostprocessingEnthalpyx(femmodel); 113 114 } 114 115 #else -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16014 r16026 127 127 #ifdef _HAVE_THERMAL_ 128 128 virtual void UpdateThermalBasalConstraints(void)=0; 129 //virtual void ComputeBasalMeltingrate(void)=0;130 //virtual void DrainWaterfraction(void)=0;129 virtual void ComputeBasalMeltingrate(void)=0; 130 virtual void DrainWaterfraction(void)=0; 131 131 #endif 132 132 -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16023 r16026 4700 4700 IssmDouble scalar,enthalpy,enthalpyup; 4701 4701 IssmDouble pressure,pressureup; 4702 IssmDouble watercolumn; 4702 4703 IssmDouble basis[NUMVERTICES]; 4703 4704 Friction* friction=NULL; … … 4724 4725 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 4725 4726 Input* geothermalflux_input=inputs->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input); 4726 4727 /*Build frictoin element, needed later: */ 4727 Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input); 4728 4729 /*Build friction element, needed later: */ 4728 4730 friction=new Friction("3d",inputs,matpar,analysis_type); 4729 4731 … … 4741 4743 enthalpy_input->GetInputValue(&enthalpy,gauss); 4742 4744 pressure_input->GetInputValue(&pressure,gauss); 4743 // if(enthalpy>matpar->PureIceEnthalpy(pressure)){ 4744 // enthalpy_input->GetInputValue(&enthalpyup,gaussup); 4745 // pressure_input->GetInputValue(&pressureup,gaussup); 4746 // if(enthalpyup>matpar->PureIceEnthalpy(pressureup)){ 4747 // //do nothing, don't add heatflux 4748 // } 4749 // else{ 4750 // //need to change spcenthalpy according to Aschwanden 4751 // //NEED TO UPDATE 4752 // } 4753 // } 4754 // else{ 4755 geothermalflux_input->GetInputValue(&geothermalflux_value,gauss); 4756 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 4757 vx_input->GetInputValue(&vx,gauss); 4758 vy_input->GetInputValue(&vy,gauss); 4759 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)); 4760 4761 scalar=gauss->weight*Jdet2d*(basalfriction+geothermalflux_value)/(rho_ice); 4762 if(reCast<bool,IssmDouble>(dt)) scalar=dt*scalar; 4763 4764 for(i=0;i<numdof;i++) pe->values[i]+=scalar*basis[i]; 4765 // } 4745 if(enthalpy>=matpar->PureIceEnthalpy(pressure)){ 4746 enthalpy_input->GetInputValue(&enthalpyup,gaussup); 4747 pressure_input->GetInputValue(&pressureup,gaussup); 4748 if(enthalpyup>=matpar->PureIceEnthalpy(pressureup)){ 4749 // temperate ice has positive thickness: grad enthalpy*n=0. 4750 } 4751 else{ 4752 // only base temperate, set Dirichlet BCs in Penta::UpdateThermalBasalConstraints() 4753 } 4754 } 4755 else{ 4756 watercolumn_input->GetInputValue(&watercolumn,gauss); 4757 if(watercolumn==0.){ 4758 /*add geothermal heat flux and basal friction*/ 4759 geothermalflux_input->GetInputValue(&geothermalflux_value,gauss); 4760 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 4761 vx_input->GetInputValue(&vx,gauss); 4762 vy_input->GetInputValue(&vy,gauss); 4763 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)); 4764 4765 scalar=gauss->weight*Jdet2d*(basalfriction+geothermalflux_value)/(rho_ice); 4766 if(reCast<bool,IssmDouble>(dt)) scalar=dt*scalar; 4767 4768 for(i=0;i<numdof;i++) pe->values[i]+=scalar*basis[i]; 4769 } 4770 else { /*do nothing (water layer acts as insulation)*/ } 4771 } 4766 4772 } 4767 4773 … … 5202 5208 this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum)); 5203 5209 break; 5210 case LliboutryDuvalEnum: 5211 B_average=LliboutryDuval((values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0, (pressure[0]+pressure[1]+pressure[2]+pressure[3]+pressure[4]+pressure[5])/6.0, material->GetN()); 5212 for(i=0;i<numdof;i++) B[i]=B_average; 5213 this->material->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,B,P1Enum)); 5214 break; 5204 5215 default: 5205 5216 _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet"); … … 5220 5231 /*Intermediary*/ 5221 5232 bool isenthalpy,isdynamicbasalspc,istemperatelayer; 5222 int numindices; 5223 IssmDouble h_pmp,pressure; 5224 int *indices = NULL; 5233 int numindices, numindicesup; 5234 IssmDouble h_pmp,pressure, pressureup; 5235 IssmDouble enthalpy, enthalpyup; 5236 int *indices = NULL, *indicesup = NULL; 5225 5237 5226 5238 /* Only update Constraints at the base of grounded ice*/ 5227 if(!IsOnBed() || !IsFloating()) return;5228 5229 /*Check wether dynamic basal bou dary conditions are activated -> TODO: Johannes :)*/5239 if(!IsOnBed() || IsFloating()) return; 5240 5241 /*Check wether dynamic basal boundary conditions are activated */ 5230 5242 parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 5231 5243 if(!isenthalpy) return; … … 5234 5246 if(!isdynamicbasalspc) return; 5235 5247 5236 5237 /*Fetch indices of basal nodes for this finite element*/ 5248 /*Fetch indices of basal & surface nodes for this finite element*/ 5238 5249 BasalNodeIndices(&numindices,&indices,this->element_type); 5250 SurfaceNodeIndices(&numindicesup,&indicesup,this->element_type); 5251 _assert_(numindices==numindicesup); 5239 5252 5240 5253 /*Get parameters and inputs: */ 5241 5254 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 5242 5243 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5255 Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); 5256 5257 /*if there is a temperate layer of positive thickness, set enthalpy=h_pmp at that node*/ 5244 5258 GaussPenta* gauss=new GaussPenta(); 5259 GaussPenta* gaussup=new GaussPenta(); 5245 5260 for(int i=0;i<numindices;i++){ 5246 5261 gauss->GaussNode(this->element_type,indices[i]); 5262 gaussup->GaussNode(this->element_type,indicesup[i]); // TODO: check: are the nodes corresponding? 5247 5263 5248 5264 /*Check wether there is a temperate layer at the base or not -> TODO: Johannes:) */ 5249 istemperatelayer = false; 5250 5251 /*Add Dirichlet constraint to this node if there is a positive thickness of temperate ice*/ 5252 if(istemperatelayer){ 5253 5265 /*check if node is temperate, if not, return*/ 5266 enthalpy_input->GetInputValue(&enthalpy, gauss); 5267 pressure_input->GetInputValue(&pressure, gauss); 5268 if (enthalpy<matpar->PureIceEnthalpy(pressure)){ 5269 // TODO: reset, if necessary, all spcs to non-valid 5270 continue; 5271 } 5272 /*check if upper node is temperate. if yes, then we have a temperate layer of positive thickness. if not, continue.*/ 5273 enthalpy_input->GetInputValue(&enthalpyup, gaussup); 5274 pressure_input->GetInputValue(&pressureup, gaussup); 5275 istemperatelayer = false; 5276 if (enthalpyup>=matpar->PureIceEnthalpy(pressureup)) 5277 istemperatelayer=true; 5278 5279 /*Add Dirichlet constraint to this node if there is no layer of temperate ice with positive thickness*/ 5280 if(!istemperatelayer){ 5254 5281 /*Calculate enthalpy at pressure melting point */ 5255 pressure_input->GetInputValue(&pressure,gauss);5256 5282 h_pmp=matpar->PureIceEnthalpy(pressure); 5257 5283 5258 5259 5284 /*Apply Dirichlet condition (dof = 0 here, since there is only one degree of freedom per node)*/ 5260 nodes[indices[i]]->ApplyConstraint(0,h_pmp); 5261 } 5285 nodes[indices[i]]->ApplyConstraint(1,h_pmp); 5286 } 5287 else { 5288 /*remove spc*/ 5289 nodes[indices[i]]->DofInFSet(0); 5290 } 5262 5291 } 5263 5292 5264 5293 /*Free ressources:*/ 5265 5294 xDelete<int>(indices); 5266 } 5267 /*}}}*/ 5268 /*FUNCTION Penta::ComputeBasalMeltrate{{{*/ 5269 void Penta::ComputeBasalMeltrate(void){ 5295 xDelete<int>(indicesup); 5296 } 5297 /*}}}*/ 5298 /*FUNCTION Penta::ComputeBasalMeltingrate{{{*/ 5299 void Penta::ComputeBasalMeltingrate(void){ 5270 5300 /*Calculate the basal melt rates of the enthalpy model after Aschwanden 2012*/ 5271 5301 5272 5302 /* Intermediaries */ 5273 bool isenthalpy ;5303 bool isenthalpy, checkpositivethickness, istemperatelayer; 5274 5304 int i,j,analysis_type; 5275 5305 IssmDouble xyz_list[NUMVERTICES][3]; … … 5279 5309 IssmDouble normal_base[3], d1enthalpy[3]; 5280 5310 IssmDouble kappa; 5281 IssmDouble meltrate[3], watercolumn[3];5282 IssmDouble enthalpy , enthalpyup;5311 IssmDouble basalmeltingrate[NUMVERTICES], watercolumn[NUMVERTICES], meltingrate_enthalpy; 5312 IssmDouble enthalpy[NUMVERTICES], enthalpyup; 5283 5313 IssmDouble pressure, pressureup; 5284 5314 IssmDouble temperature, waterfraction; 5285 IssmDouble latentheat ;5315 IssmDouble latentheat, rho_ice; 5286 5316 IssmDouble basalfriction, alpha2; 5287 5317 IssmDouble vx,vy,vz; 5318 IssmDouble connectivity; 5288 5319 IssmDouble dt; 5289 5320 Friction *friction = NULL; … … 5298 5329 /*Fetch parameters and inputs */ 5299 5330 latentheat=matpar->GetLatentHeat(); 5331 rho_ice=this->matpar->GetRhoIce(); 5300 5332 Input* watercolumn_input=inputs->GetInput(WatercolumnEnum); _assert_(watercolumn_input); 5333 Input* basalmeltingrate_input=inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basalmeltingrate_input); 5301 5334 Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); 5302 5335 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); … … 5312 5345 friction=new Friction("3d",inputs,matpar,analysis_type); 5313 5346 5314 /*Ok, get melt rates now from basal conditions*/5347 /*Ok, get meltingrates now from basal conditions*/ 5315 5348 GaussPenta* gauss=new GaussPenta(); 5316 5349 GaussPenta* gaussup=new GaussPenta(); … … 5318 5351 gauss->GaussVertex(iv); 5319 5352 gaussup->GaussVertex(iv+3); 5320 5321 // TODO: make sure that no node is computed twice (insert mask) 5322 5353 5354 checkpositivethickness=true; 5323 5355 watercolumn_input->GetInputValue(&watercolumn[iv], gauss); 5324 enthalpy_input->GetInputValue(&enthalpy, gauss); 5356 basalmeltingrate_input->GetInputValue(&basalmeltingrate[iv],gauss); 5357 enthalpy_input->GetInputValue(&enthalpy[iv], gauss); 5325 5358 pressure_input->GetInputValue(&pressure, gauss); 5326 5359 5327 /*Calculate basal meltrate*/ 5328 if((watercolumn[iv]>0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){ 5329 enthalpy=matpar->PureIceEnthalpy(pressure); 5330 } 5331 else if(enthalpy<matpar->PureIceEnthalpy(pressure)){ 5332 meltrate[iv]=0.; 5333 watercolumn[iv]=0.; 5334 continue; 5335 } 5336 5337 /*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice) */ 5338 enthalpy_input->GetInputValue(&enthalpyup, gaussup); 5339 pressure_input->GetInputValue(&pressureup, gaussup); 5340 if(enthalpyup>=matpar->PureIceEnthalpy(pressureup)){ 5341 for(i=0;i<3;i++) vec_heatflux[i]=0.; 5342 } 5343 else{ 5344 enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss); 5345 kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure); 5346 for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i]; 5347 } 5348 5349 /*Get normal vector to the bed */ 5350 BedNormal(&normal_base[0],xyz_list_tria); 5351 5352 heatflux=0.; 5353 for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i]; 5354 geothermalflux_input->GetInputValue(&geothermalflux_value,gauss); 5355 5356 matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy,pressure); 5357 5358 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 5359 vx_input->GetInputValue(&vx,gauss); 5360 vy_input->GetInputValue(&vy,gauss); 5361 vz_input->GetInputValue(&vz,gauss); 5362 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0)); 5363 meltrate[iv]=(basalfriction-(heatflux-geothermalflux_value))/(1-waterfraction)/latentheat; 5364 5365 /*Update water column*/ 5360 /*Calculate basal meltingrate after Fig.5 of A.Aschwanden 2012*/ 5361 meltingrate_enthalpy=0.; 5362 if((watercolumn[iv]>0.) && (enthalpy[iv]<matpar->PureIceEnthalpy(pressure))){ 5363 /*ensure that no ice is at T<Tm(p), if water layer present*/ 5364 enthalpy[iv]=matpar->PureIceEnthalpy(pressure); 5365 //meltingrate_enthalpy=0.; 5366 } 5367 else if(enthalpy[iv]<matpar->PureIceEnthalpy(pressure)){ 5368 /*cold base: set q*n=q_geo*n+frictionheating as Neumann BC in Penta::CreatePVectorEnthalpySheet*/ 5369 meltingrate_enthalpy=0.; 5370 checkpositivethickness=false; 5371 } 5372 else {/*do nothing, go to next check*/} 5373 5374 if(checkpositivethickness){ 5375 /*ok, from here on all basal ice is temperate. Check for positive thickness of layer of temperate ice. */ 5376 istemperatelayer=false; 5377 enthalpy_input->GetInputValue(&enthalpyup, gaussup); 5378 pressure_input->GetInputValue(&pressureup, gaussup); 5379 if(enthalpyup>=matpar->PureIceEnthalpy(pressureup)) 5380 istemperatelayer=true; 5381 if(istemperatelayer) 5382 for(i=0;i<3;i++) vec_heatflux[i]=0.; 5383 else{ 5384 enthalpy_input->GetInputDerivativeValue(&d1enthalpy[0],&xyz_list[0][0],gauss); 5385 kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy[iv],pressure); 5386 for(i=0;i<3;i++) vec_heatflux[i]=-kappa*d1enthalpy[i]; 5387 } 5388 5389 /*geothermal heatflux*/ 5390 BedNormal(&normal_base[0],xyz_list_tria); 5391 heatflux=0.; 5392 for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i]; 5393 geothermalflux_input->GetInputValue(&geothermalflux_value,gauss); 5394 5395 /*basal friction*/ 5396 friction->GetAlpha2(&alpha2,gauss,VxEnum,VyEnum,VzEnum); 5397 vx_input->GetInputValue(&vx,gauss); 5398 vy_input->GetInputValue(&vy,gauss); 5399 vz_input->GetInputValue(&vz,gauss); 5400 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0)); 5401 5402 matpar->EnthalpyToThermal(&temperature, &waterfraction, enthalpy[iv],pressure); 5403 meltingrate_enthalpy=(basalfriction-(heatflux-geothermalflux_value))/((1-waterfraction)*latentheat*rho_ice); // m/yr water equivalent 5404 } 5405 5406 /*Update water column, basal meltingrate*/ 5407 connectivity=IssmDouble(vertices[iv]->Connectivity()); 5408 meltingrate_enthalpy/=connectivity; // divide meltingrate_enthalpy by connectivity to address multiple iterations over vertex 5409 basalmeltingrate[iv]+=meltingrate_enthalpy; 5366 5410 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5367 5411 if(reCast<bool,IssmDouble>(dt)) 5368 watercolumn[iv]+=dt*melt rate[iv];5412 watercolumn[iv]+=dt*meltingrate_enthalpy; 5369 5413 else 5370 watercolumn[iv] =meltrate[iv];5414 watercolumn[iv]+=meltingrate_enthalpy; 5371 5415 } 5372 /*update meltrate and watercolumn*/ 5416 /*feed updated variables back into model*/ 5417 this->inputs->AddInput(new PentaInput(EnthalpyEnum, enthalpy, P1Enum)); 5373 5418 this->inputs->AddInput(new PentaInput(WatercolumnEnum, watercolumn, P1Enum)); 5374 this->inputs->AddInput(new PentaInput(BasalforcingsMeltingRateEnum, meltrate, P1Enum));5419 this->inputs->AddInput(new PentaInput(BasalforcingsMeltingRateEnum, basalmeltingrate, P1Enum)); 5375 5420 5376 5421 /*Clean up and return*/ 5377 5422 delete gauss; 5378 5423 delete gaussup; 5424 delete friction; 5379 5425 } 5380 5426 /*}}}*/ … … 5382 5428 void Penta::DrainWaterfraction(void){ 5383 5429 5384 // TODO: create vector to mark whether node has been drained already i.o. to not drain nodes multiple times5385 5386 5430 /*Intermediaries*/ 5387 5431 bool isenthalpy; … … 5389 5433 IssmDouble enthalpy[NUMVERTICES], pressure[NUMVERTICES]; 5390 5434 IssmDouble latentheat, dt; 5435 IssmDouble connectivity; 5391 5436 GaussPenta* gauss; 5392 5437 … … 5401 5446 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5402 5447 latentheat=matpar->GetLatentHeat(); 5448 5403 5449 gauss=new GaussPenta(); 5404 5450 for(int iv=0;iv<NUMVERTICES;iv++){ 5405 5451 gauss->GaussVertex(iv); 5406 /*TODO: Check whether Vertex has been drained already*/5407 5452 enthalpy_input->GetInputValue(&enthalpy[iv], gauss); 5408 5453 pressure_input->GetInputValue(&pressure[iv], gauss); 5409 5454 matpar->EnthalpyToThermal(&temperature[iv],&waterfraction[iv], enthalpy[iv],pressure[iv]); 5410 5455 5411 /*drain water fraction */5412 waterfraction[iv]-=dt*DrainageFunctionWaterfraction(waterfraction[iv]);5413 if(waterfraction[iv]<0.) waterfraction[iv]=0.;5414 /*update enthalpy*/5456 /*drain water fraction & update enthalpy*/ 5457 // TODO: replace connectivity-wise draining by draining once per node per timestep 5458 connectivity=IssmDouble(vertices[iv]->Connectivity()); 5459 waterfraction[iv]-=DrainageFunctionWaterfraction(waterfraction[iv], dt)/connectivity; 5415 5460 matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]); 5416 5461 } … … 5418 5463 this->inputs->AddInput(new PentaInput(EnthalpyEnum,enthalpy,P1Enum)); 5419 5464 this->inputs->AddInput(new PentaInput(WaterfractionEnum,waterfraction,P1Enum)); 5420 this->inputs->AddInput(new PentaInput(TemperatureEnum,temperature,P1Enum));5465 // this->inputs->AddInput(new PentaInput(TemperatureEnum,temperature,P1Enum)); // temperature should not change during drainage... 5421 5466 } 5422 5467 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16023 r16026 357 357 void InputUpdateFromSolutionEnthalpy(IssmDouble* solutiong); 358 358 void UpdateThermalBasalConstraints(void); 359 void ComputeBasalMelt rate(void);359 void ComputeBasalMeltingrate(void); 360 360 void DrainWaterfraction(void); 361 361 #endif -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16023 r16026 255 255 #ifdef _HAVE_THERMAL_ 256 256 void UpdateThermalBasalConstraints(void){_error_("not implemented yet");}; 257 void ComputeBasalMeltrate(void){_error_("not implemented yet");}; 257 void ComputeBasalMeltingrate(void){_error_("not implemented yet");}; 258 void DrainWaterfraction(void){_error_("not implemented yet");}; 258 259 #endif 259 260 -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
r15986 r16026 44 44 iomodel->FetchDataToInput(elements,WaterfractionEnum); 45 45 iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum); 46 iomodel->FetchDataToInput(elements,WatercolumnEnum); 47 iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum); 46 48 iomodel->FetchDataToInput(elements,VxEnum); 47 49 iomodel->FetchDataToInput(elements,VyEnum); -
issm/trunk-jpl/src/c/modules/modules.h
r15082 r16026 75 75 #include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h" 76 76 #include "./PositiveDegreeDayx/PositiveDegreeDayx.h" 77 #include "./PostprocessingEnthalpyx/PostprocessingEnthalpyx.h" 77 78 #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h" 78 79 #include "./Reduceloadx/Reduceloadx.h" -
issm/trunk-jpl/src/c/shared/Elements/DrainageFunctionWaterfraction.cpp
r15891 r16026 8 8 9 9 /*FUNCTION IssmDouble DrainageFunctionWaterfraction()*/ 10 IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction ){10 IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction, IssmDouble dt=0.){ 11 11 /* DrainageFunctionWaterfraction returns how much of the waterfraction is drained per year */ 12 _assert_(waterfraction>0); 12 _assert_(waterfraction>=0.); 13 _assert_(dt>=0.); 13 14 14 15 IssmDouble w0=0.01, w1=0.02, w2=0.03; 15 IssmDouble D 0=0, D1=0.005, D2=0.05;16 IssmDouble Dret, D0=0, D1=0.005, D2=0.05; 16 17 18 /*get drainage function value*/ 17 19 if((w0==w1)||(w1==w2)||(w0==w2)) 18 perror ("error in DrainageFunctionWaterfraction. Abort");20 _error_("Error: equal ordinates in DrainageFunctionWaterfraction -> division by zero. Abort"); 19 21 if(waterfraction<=w0) 20 returnD0;22 Dret=D0; 21 23 if((waterfraction>w0) && (waterfraction<=w1)) 22 return(D1-D0)/(w1-w0)*(waterfraction-w0)+D0;24 Dret=(D1-D0)/(w1-w0)*(waterfraction-w0)+D0; 23 25 if((waterfraction>w1) && (waterfraction<=w2)) 24 return(D2-D1)/(w2-w1)*(waterfraction-w1)+D1;26 Dret=(D2-D1)/(w2-w1)*(waterfraction-w1)+D1; 25 27 else 26 return D2; 28 Dret=D2; 29 30 /*check if dt*Dret>waterfraction. If so, drain whole waterfraction*/ 31 if(dt==0.){ 32 if(Dret>waterfraction) 33 return waterfraction; 34 else 35 return Dret; 36 } 37 else{ 38 if(dt*Dret>waterfraction) 39 return waterfraction; 40 else 41 return dt*Dret; 42 } 27 43 } -
issm/trunk-jpl/src/c/shared/Elements/elements.h
r15897 r16026 20 20 IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday, 21 21 IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout); 22 IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction );22 IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction, IssmDouble dt=0.); 23 23 24 24 /*Print arrays*/ -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r16010 r16026 236 236 SurfaceforcingsBPosEnum, 237 237 SurfaceforcingsBNegEnum, 238 ThermalIsenthalpyEnum, 239 ThermalIsdynamicbasalspcEnum, 238 240 ThermalMaxiterEnum, 239 241 ThermalPenaltyFactorEnum, … … 242 244 ThermalSpctemperatureEnum, 243 245 ThermalStabilizationEnum, 244 ThermalIsenthalpyEnum,245 246 GiaMantleViscosityEnum, 246 247 GiaLithosphereThicknessEnum, -
issm/trunk-jpl/src/m/classes/model/model.m
r15987 r16026 671 671 if ~isnan(md.initialization.temperature),md.initialization.temperature=project3d(md,'vector',md.initialization.temperature,'type','node');end; 672 672 if ~isnan(md.initialization.waterfraction),md.initialization.waterfraction=project3d(md,'vector',md.initialization.waterfraction,'type','node');end; 673 if ~isnan(md.initialization.watercolumn),md.initialization.watercolumn=project3d(md,'vector',md.initialization.watercolumn,'type','node','layer',1);end; 673 674 674 675 %bedinfo and surface info -
issm/trunk-jpl/src/m/classes/thermal.m
r15133 r16026 13 13 penalty_factor = 0; 14 14 isenthalpy = 0; 15 isdynamicbasalspc = 0; 15 16 end 16 17 methods … … 39 40 %Should we use cold ice (default) or enthalpy formulation 40 41 obj.isenthalpy=0; 42 43 %will basal boundary conditions be set dynamically 44 obj.isdynamicbasalspc=0; 41 45 end % }}} 42 46 function md = checkconsistency(obj,md,solution,analyses) % {{{ … … 52 56 md = checkfield(md,'thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos),'message','spctemperature should be below the adjusted melting point'); 53 57 md = checkfield(md,'thermal.isenthalpy','numel',[1],'values',[0 1]); 58 md = checkfield(md,'thermal.isdynamicbasalspc','numel',[1],'values',[0 1]); 54 59 end 55 60 end % }}} … … 63 68 fielddisplay(obj,'penalty_threshold','threshold to declare convergence of thermal solution (default is 0)'); 64 69 fielddisplay(obj,'isenthalpy','use an enthalpy formulation to include temperate ice (default is 0)'); 65 70 fielddisplay(obj,'isdynamicbasalspc',['enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)']); 71 66 72 end % }}} 67 73 function marshall(obj,md,fid) % {{{ … … 73 79 WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double'); 74 80 WriteData(fid,'object',obj,'fieldname','isenthalpy','format','Boolean'); 75 end % }}} 81 WriteData(fid,'object',obj,'fieldname','isdynamicbasalspc','format','Boolean'); 82 end % }}} 76 83 end 77 84 end
Note:
See TracChangeset
for help on using the changeset viewer.