Changeset 8496
- Timestamp:
- 06/03/11 10:27:30 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r8487 r8496 451 451 EnthalpyAnalysisEnum, 452 452 EnthalpyEnum, 453 EnthalpyPicardEnum, 453 454 WaterFractionEnum, 454 455 ReferenceTemperatureEnum -
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r8487 r8496 394 394 case EnthalpyAnalysisEnum : return "EnthalpyAnalysis"; 395 395 case EnthalpyEnum : return "Enthalpy"; 396 case EnthalpyPicardEnum : return "EnthalpyPicard"; 396 397 case WaterFractionEnum : return "WaterFraction"; 397 398 case ReferenceTemperatureEnum : return "ReferenceTemperature"; -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r8487 r8496 392 392 else if (strcmp(name,"EnthalpyAnalysis")==0) return EnthalpyAnalysisEnum; 393 393 else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum; 394 else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum; 394 395 else if (strcmp(name,"WaterFraction")==0) return WaterFractionEnum; 395 396 else if (strcmp(name,"ReferenceTemperature")==0) return ReferenceTemperatureEnum; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r8490 r8496 612 612 Ke=CreateKMatrixThermal(); 613 613 break; 614 case EnthalpyAnalysisEnum: 615 Ke=CreateKMatrixEnthalpy(); 616 break; 614 617 case MeltingAnalysisEnum: 615 618 Ke=CreateKMatrixMelting(); … … 1834 1837 double gravity,rho_ice,rho_water; 1835 1838 double heatcapacity,thermalconductivity,dt; 1836 double latentheat,kappa=1; 1839 double pressure,enthalpy; 1840 double latentheat,kappa; 1837 1841 double tau_parameter,diameter; 1838 1842 double xyz_list[NUMVERTICES][3]; … … 1870 1874 this->parameters->FindParam(&artdiff,ArtDiffEnum); 1871 1875 this->parameters->FindParam(&epsvel,EpsVelEnum); 1872 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 1873 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); 1874 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input); 1875 Input* vxm_input=inputs->GetInput(VxMeshEnum); _assert_(vxm_input); 1876 Input* vym_input=inputs->GetInput(VyMeshEnum); _assert_(vym_input); 1877 Input* vzm_input=inputs->GetInput(VzMeshEnum); _assert_(vzm_input); 1876 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); 1877 Input* enthalpy_input=inputs->GetInput(EnthalpyEnum); _assert_(enthalpy_input); 1878 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 1879 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); 1880 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input); 1881 Input* vxm_input=inputs->GetInput(VxMeshEnum); _assert_(vxm_input); 1882 Input* vym_input=inputs->GetInput(VyMeshEnum); _assert_(vym_input); 1883 Input* vzm_input=inputs->GetInput(VzMeshEnum); _assert_(vzm_input); 1878 1884 if (artdiff==2) diameter=MinEdgeLength(xyz_list); 1879 1885 … … 1891 1897 GetBConduct(&B_conduct[0][0],&xyz_list[0][0],gauss); 1892 1898 1893 //kappa=GetEnthalpyDiffusivityParameter(rho_ice,heatcapacity,thermalconductivity,latentheat,enthalpy); 1899 enthalpy_input->GetParameterValue(&enthalpy, gauss); 1900 pressure_input->GetParameterValue(&pressure, gauss); 1901 kappa=matpar->GetEnthalpyDiffusionParameter(enthalpy,pressure); 1894 1902 D_scalar_conduct=gauss->weight*Jdet*kappa; 1895 1903 if(dt) D_scalar_conduct=D_scalar_conduct*dt; … … 2377 2385 pe=CreatePVectorThermal(); 2378 2386 break; 2387 case EnthalpyAnalysisEnum: 2388 pe=CreatePVectorEnthalpy(); 2389 break; 2379 2390 case MeltingAnalysisEnum: 2380 2391 pe=CreatePVectorMelting(); … … 3412 3423 int i,j,ig; 3413 3424 double Jdet2d; 3425 double heatcapacity,h_pmp; 3414 3426 double mixed_layer_capacity,thermal_exchange_velocity; 3415 3427 double rho_ice,rho_water,pressure,dt,scalar_ocean; 3416 double meltingpoint,beta,heatcapacity,h_pmp;3417 3428 double xyz_list[NUMVERTICES][3]; 3418 3429 double xyz_list_tria[NUMVERTICES2D][3]; … … 3434 3445 rho_ice=matpar->GetRhoIce(); 3435 3446 heatcapacity=matpar->GetHeatCapacity(); 3436 beta=matpar->GetBeta();3437 meltingpoint=matpar->GetMeltingPoint();3438 3447 this->parameters->FindParam(&dt,DtEnum); 3439 3448 Input* pressure_input=inputs->GetInput(PressureEnum); _assert_(pressure_input); … … 3449 3458 3450 3459 pressure_input->GetParameterValue(&pressure,gauss); 3451 h_pmp=m eltingpoint-beta*pressure;3460 h_pmp=matpar->PureIceEnthalpy(pressure); 3452 3461 3453 3462 scalar_ocean=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity*(h_pmp)/(rho_ice*heatcapacity); … … 4177 4186 GetSolutionFromInputsThermal(solution); 4178 4187 } 4188 else if(analysis_type==EnthalpyAnalysisEnum){ 4189 GetSolutionFromInputsEnthalpy(solution); 4190 } 4179 4191 else{ 4180 4192 _error_("analysis: %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type)); … … 4359 4371 t_input->GetParameterValue(&temp,gauss); 4360 4372 values[i]=temp; 4373 } 4374 4375 /*Add value to global vector*/ 4376 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4377 4378 /*Free ressources:*/ 4379 delete gauss; 4380 xfree((void**)&doflist); 4381 } 4382 /*}}}*/ 4383 /*FUNCTION Penta::GetSolutionFromInputsEnthalpy{{{1*/ 4384 void Penta::GetSolutionFromInputsEnthalpy(Vec solution){ 4385 4386 const int numdof=NDOF1*NUMVERTICES; 4387 4388 int i; 4389 int* doflist=NULL; 4390 double values[numdof]; 4391 double enthalpy; 4392 GaussPenta *gauss=NULL; 4393 4394 /*Get dof list: */ 4395 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 4396 Input* h_input=inputs->GetInput(EnthalpyEnum); _assert_(h_input); 4397 4398 gauss=new GaussPenta(); 4399 for(i=0;i<NUMVERTICES;i++){ 4400 /*Recover temperature*/ 4401 gauss->GaussVertex(i); 4402 h_input->GetParameterValue(&enthalpy,gauss); 4403 values[i]=enthalpy; 4361 4404 } 4362 4405 … … 5042 5085 InputUpdateFromSolutionThermal( solution); 5043 5086 } 5087 else if (analysis_type==EnthalpyAnalysisEnum){ 5088 InputUpdateFromSolutionEnthalpy( solution); 5089 } 5044 5090 else if (analysis_type==MeltingAnalysisEnum){ 5045 5091 InputUpdateFromSolutionOneDof(solution,BasalMeltingRateEnum); … … 6026 6072 double xyz_list[NUMVERTICES][3]; 6027 6073 double values[numdof]; 6074 double pressure[NUMVERTICES]; 6028 6075 double temperatures[numdof]; 6029 6076 double waterfraction[numdof]; … … 6045 6092 /*Get all inputs and parameters*/ 6046 6093 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 6094 GetParameterListOnVertices(&pressure[0],PressureEnum); 6047 6095 Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input); 6096 6048 6097 6049 6098 this->inputs->GetParameterValue(&converged,ConvergedEnum); 6050 6099 if(converged){ 6051 6100 /*Convert enthalpy into temperature and water fraction*/ 6052 // for(i=0;i<numdof;i++){ 6053 // if values[i]<GetPureIceEnthalpy(){ 6054 // temperatures[i]=values[i]; 6055 // waterfraction[i]=0; 6056 // } 6057 // else{ 6058 // temperatures[i]=values[i]; 6059 // waterfraction[i]=values[i]; 6060 // } 6061 // } 6062 6101 for(i=0;i<numdof;i++) matpar->EnthalpyToThermal(&temperatures[i],&waterfraction[i],values[i],pressure[i]); 6102 6063 6103 this->inputs->AddInput(new PentaVertexInput(EnthalpyEnum,values)); 6064 6104 this->inputs->AddInput(new PentaVertexInput(WaterFractionEnum,waterfraction)); … … 6073 6113 break; 6074 6114 case PatersonEnum: 6075 B_average=Paterson(( values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0);6115 B_average=Paterson((temperatures[0]+temperatures[1]+temperatures[2]+temperatures[3]+temperatures[4]+temperatures[5])/6.0); 6076 6116 for(i=0;i<numdof;i++) B[i]=B_average; 6077 6117 this->matice->inputs->AddInput(new PentaVertexInput(RheologyBEnum,B)); … … 6079 6119 case ArrheniusEnum: 6080 6120 surface_input->GetParameterAverage(&s_average); 6081 B_average=Arrhenius(( values[0]+values[1]+values[2]+values[3]+values[4]+values[5])/6.0,6121 B_average=Arrhenius((temperatures[0]+temperatures[1]+temperatures[2]+temperatures[3]+temperatures[4]+temperatures[5])/6.0, 6082 6122 s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0), 6083 6123 matice->GetN()); … … 6090 6130 } 6091 6131 } 6092 //else{6093 //this->inputs->AddInput(new PentaVertexInput(EnthalpyPicardEnum,values));6094 //}6132 else{ 6133 this->inputs->AddInput(new PentaVertexInput(EnthalpyPicardEnum,values)); 6134 } 6095 6135 6096 6136 /*Free ressources:*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r8487 r8496 225 225 void GetSolutionFromInputsDiagnosticVert(Vec solutiong); 226 226 void GetSolutionFromInputsThermal(Vec solutiong); 227 void GetSolutionFromInputsEnthalpy(Vec solutiong); 227 228 double GetStabilizationParameter(double u, double v, double w, double diameter, double rho_ice, double heatcapacity, double thermalconductivity); 228 229 void GetStrainRate3dPattyn(double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input); -
issm/trunk/src/c/objects/Materials/Matpar.cpp
r8490 r8496 32 32 double matpar_beta; 33 33 double matpar_meltingpoint; 34 double matpar_referencetemperature; 34 35 double matpar_mixed_layer_capacity; 35 36 double matpar_thermal_exchange_velocity; … … 46 47 matpar_beta=iomodel->beta; 47 48 matpar_meltingpoint=iomodel->meltingpoint; 49 matpar_referencetemperature=iomodel->referencetemperature; 48 50 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 49 51 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; … … 59 61 this->beta=matpar_beta; 60 62 this->meltingpoint=matpar_meltingpoint; 63 this->referencetemperature=matpar_referencetemperature; 61 64 this->mixed_layer_capacity=matpar_mixed_layer_capacity; 62 65 this->thermal_exchange_velocity=matpar_thermal_exchange_velocity; … … 86 89 printf(" beta: %g\n",beta); 87 90 printf(" meltingpoint: %g\n",meltingpoint); 91 printf(" referencetemperature: %g\n",referencetemperature); 88 92 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 89 93 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); … … 106 110 printf(" beta: %g\n",beta); 107 111 printf(" meltingpoint: %g\n",meltingpoint); 112 printf(" referencetemperature: %g\n",referencetemperature); 108 113 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity); 109 114 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity); … … 147 152 memcpy(marshalled_dataset,&beta,sizeof(beta));marshalled_dataset+=sizeof(beta); 148 153 memcpy(marshalled_dataset,&meltingpoint,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint); 154 memcpy(marshalled_dataset,&referencetemperature,sizeof(referencetemperature));marshalled_dataset+=sizeof(referencetemperature); 149 155 memcpy(marshalled_dataset,&mixed_layer_capacity,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity); 150 156 memcpy(marshalled_dataset,&thermal_exchange_velocity,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity); … … 168 174 sizeof(beta)+ 169 175 sizeof(meltingpoint)+ 176 sizeof(referencetemperature)+ 170 177 sizeof(mixed_layer_capacity)+ 171 178 sizeof(thermal_exchange_velocity)+ … … 195 202 memcpy(&beta,marshalled_dataset,sizeof(beta));marshalled_dataset+=sizeof(beta); 196 203 memcpy(&meltingpoint,marshalled_dataset,sizeof(meltingpoint));marshalled_dataset+=sizeof(meltingpoint); 204 memcpy(&referencetemperature,marshalled_dataset,sizeof(referencetemperature));marshalled_dataset+=sizeof(referencetemperature); 197 205 memcpy(&mixed_layer_capacity,marshalled_dataset,sizeof(mixed_layer_capacity));marshalled_dataset+=sizeof(mixed_layer_capacity); 198 206 memcpy(&thermal_exchange_velocity,marshalled_dataset,sizeof(thermal_exchange_velocity));marshalled_dataset+=sizeof(thermal_exchange_velocity); … … 282 290 break; 283 291 292 case ReferenceTemperatureEnum: 293 this->referencetemperature=constant; 294 break; 295 284 296 case MixedLayerCapacityEnum: 285 297 this->mixed_layer_capacity=constant; … … 347 359 double Matpar::GetMeltingPoint(){ 348 360 return meltingpoint; 361 } 362 /*}}}1*/ 363 /*FUNCTION Matpar::GetReferenceTemperature {{{1*/ 364 double Matpar::GetReferenceTemperature(){ 365 return referencetemperature; 349 366 } 350 367 /*}}}1*/ … … 390 407 } 391 408 /*}}}1*/ 409 /*FUNCTION Matpar::PureIceEnthalpy{{{1*/ 410 double Matpar::PureIceEnthalpy(double pressure){ 411 return heatcapacity*(TMeltingPoint(pressure)-referencetemperature); 412 } 413 /*}}}1*/ 414 /*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{1*/ 415 double Matpar::GetEnthalpyDiffusionParameter(double enthalpy,double pressure){ 416 return thermalconductivity/(rho_ice*heatcapacity); 417 } 418 /*}}}1*/ 419 /*FUNCTION Matpar::EnthalpyToThermal {{{1*/ 420 void Matpar::EnthalpyToThermal(double* ptemperature,double* pwaterfraction,double enthalpy,double pressure){ 421 422 /*Ouput*/ 423 double temperature,waterfraction; 424 425 if(enthalpy<PureIceEnthalpy(pressure)){ 426 temperature=referencetemperature+enthalpy/heatcapacity; 427 waterfraction=0; 428 } 429 else{ 430 temperature=TMeltingPoint(pressure); 431 waterfraction=(enthalpy-PureIceEnthalpy(pressure))/latentheat; 432 } 433 434 /*Assign output pointers:*/ 435 *pwaterfraction=waterfraction; 436 *ptemperature=temperature; 437 } 438 /*}}}1*/ 439 /*FUNCTION Matpar::ThermalToEnthalpy {{{1*/ 440 void Matpar::ThermalToEnthalpy(double * penthalpy,double temperature,double waterfraction,double pressure){ 441 442 /*Ouput*/ 443 double enthalpy; 444 445 if(temperature<TMeltingPoint(pressure)){ 446 enthalpy=heatcapacity*(temperature-referencetemperature); 447 } 448 else{ 449 enthalpy=PureIceEnthalpy(pressure)+latentheat*waterfraction; 450 } 451 452 /*Assign output pointers:*/ 453 *penthalpy=enthalpy; 454 } 455 /*}}}1*/ -
issm/trunk/src/c/objects/Materials/Matpar.h
r8490 r8496 23 23 double beta; 24 24 double meltingpoint; 25 double referencetemperature; 25 26 double mixed_layer_capacity; 26 27 double thermal_exchange_velocity; … … 77 78 double GetBeta(); 78 79 double GetMeltingPoint(); 80 double GetReferenceTemperature(); 79 81 double GetGamma(); 80 82 double GetKn(); 81 83 double TMeltingPoint(double pressure); 84 double PureIceEnthalpy(double pressure); 85 double GetEnthalpyDiffusionParameter(double enthalpy,double pressure); 86 void EnthalpyToThermal(double* ptemperature,double* pwaterfraction,double enthalpy,double pressure); 87 void ThermalToEnthalpy(double* penthalpy,double temperature,double waterfraction,double pressure); 82 88 /*}}}*/ 83 89
Note:
See TracChangeset
for help on using the changeset viewer.