Changeset 15896
- Timestamp:
- 08/23/13 08:57:45 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15895 r15896 5236 5236 /* Intermediaries */ 5237 5237 bool isenthalpy; 5238 int i,j, ig,analysis_type,numindices,numindicesup;5238 int i,j,analysis_type; 5239 5239 IssmDouble xyz_list[NUMVERTICES][3]; 5240 5240 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; … … 5243 5243 IssmDouble normal_base[3], d1enthalpy[3]; 5244 5244 IssmDouble kappa; 5245 IssmDouble meltrate[3], watercolumn[3]; 5245 5246 IssmDouble enthalpy, enthalpyup; 5246 5247 IssmDouble pressure, pressureup; … … 5250 5251 IssmDouble vx,vy,vz; 5251 5252 IssmDouble dt; 5252 int *indices = NULL;5253 int *indicesup = NULL;5254 5253 Friction *friction = NULL; 5255 5254 … … 5277 5276 friction=new Friction("3d",inputs,matpar,analysis_type); 5278 5277 5279 /*Fetch indices of basal and surface nodes for this finite element*/5280 BasalNodeIndices(&numindices,&indices,this->element_type);5281 SurfaceNodeIndices(&numindicesup,&indicesup,this->element_type);5282 _assert_(numindices==numindicesup);5283 5284 IssmDouble meltrate[numindices], watercolumn[numindices];5285 5286 5278 /*Ok, get meltrates now from basal conditions*/ 5287 5279 GaussPenta* gauss=new GaussPenta(); 5288 5280 GaussPenta* gaussup=new GaussPenta(); 5289 for(i g=0;ig<numindices;ig++){5290 gauss->GaussVertex( this->element_type,indices[ig]);5291 gaussup->GaussNode( this->element_type,indicesup[ig]);5281 for(int iv=0;iv<3;iv++){ 5282 gauss->GaussVertex(iv); 5283 gaussup->GaussNode(iv+3); 5292 5284 5293 5285 // TODO: make sure that no node is computed twice (insert mask) 5294 5286 5295 watercolumn_input->GetInputValue(&watercolumn[i ndices[ig]], gauss);5287 watercolumn_input->GetInputValue(&watercolumn[iv], gauss); 5296 5288 enthalpy_input->GetInputValue(&enthalpy, gauss); 5297 5289 pressure_input->GetInputValue(&pressure, gauss); 5298 5290 5299 5291 /*Calculate basal meltrate*/ 5300 if((watercolumn[i ndices[ig]]>0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){5292 if((watercolumn[iv]>0.) && (enthalpy<matpar->PureIceEnthalpy(pressure))){ 5301 5293 enthalpy=matpar->PureIceEnthalpy(pressure); 5302 5294 } 5303 5295 else if(enthalpy<matpar->PureIceEnthalpy(pressure)){ 5304 meltrate[i ndices[ig]]=0.; //TODO: set zero meltrate and watercolumn in model5305 watercolumn[i ndices[ig]]=0.;5306 return;5296 meltrate[iv]=0.; 5297 watercolumn[iv]=0.; 5298 continue; 5307 5299 } 5308 5300 … … 5333 5325 vz_input->GetInputValue(&vz,gauss); 5334 5326 basalfriction=alpha2*(pow(vx,2.0)+pow(vy,2.0)+pow(vz,2.0)); 5335 meltrate[i ndices[ig]]=(basalfriction-(heatflux-geothermalflux_value))/(1-waterfraction)/latentheat;5327 meltrate[iv]=(basalfriction-(heatflux-geothermalflux_value))/(1-waterfraction)/latentheat; 5336 5328 5337 5329 /*Update water column*/ 5338 5330 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5339 5331 if(reCast<bool,IssmDouble>(dt)) 5340 watercolumn[i ndices[ig]]+=dt*meltrate[indices[ig]];5332 watercolumn[iv]+=dt*meltrate[iv]; 5341 5333 else 5342 watercolumn[i ndices[ig]]=meltrate[indices[ig]];5334 watercolumn[iv]=meltrate[iv]; 5343 5335 } 5344 5336 /*update meltrate and watercolumn*/ … … 5347 5339 5348 5340 /*Clean up and return*/ 5349 xDelete<int>(indices);5350 xDelete<int>(indicesup);5351 5341 delete gauss; 5352 5342 delete gaussup; … … 5359 5349 5360 5350 /*Intermediaries*/ 5361 int ig;5362 5351 bool isenthalpy; 5363 5352 IssmDouble waterfraction_array[NUMVERTICES], temperature[NUMVERTICES]; … … 5376 5365 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum); 5377 5366 latentheat=matpar->GetLatentHeat(); 5378 gauss=new GaussPenta( 2,3);5379 for(i g=0;ig<NUMVERTICES;ig++){5380 gauss->GaussVertex(i g);5367 gauss=new GaussPenta(); 5368 for(int iv=0;iv<NUMVERTICES;iv++){ 5369 gauss->GaussVertex(iv); 5381 5370 /*TODO: Check whether Vertex has been drained already*/ 5382 enthalpy_input->GetInputValue(&enthalpy[i g], gauss);5383 pressure_input->GetInputValue(&pressure[i g], gauss);5384 matpar->EnthalpyToThermal(&temperature[i g], &waterfraction[ig], enthalpy[ig],pressure[ig]);5371 enthalpy_input->GetInputValue(&enthalpy[iv], gauss); 5372 pressure_input->GetInputValue(&pressure[iv], gauss); 5373 matpar->EnthalpyToThermal(&temperature[iv], &waterfraction[iv], enthalpy[iv],pressure[iv]); 5385 5374 5386 5375 /*drain water fraction*/ 5387 waterfraction[i g]-=dt*DrainageFunctionWaterfraction(waterfraction[ig]);5388 if(waterfraction[i g]<0) waterfraction[ig]=0.;5376 waterfraction[iv]-=dt*DrainageFunctionWaterfraction(waterfraction[iv]); 5377 if(waterfraction[iv]<0.) waterfraction[iv]=0.; 5389 5378 /*update enthalpy*/ 5390 matpar->ThermalToEnthalpy(&enthalpy[i g], temperature[ig], waterfraction[ig], pressure[ig]);5379 matpar->ThermalToEnthalpy(&enthalpy[iv], temperature[iv], waterfraction[iv], pressure[iv]); 5391 5380 } 5392 5381 /*feed updated results back into model*/
Note:
See TracChangeset
for help on using the changeset viewer.