Changeset 15377
- Timestamp:
- 07/01/13 15:34:52 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/ElementResults/TriaP1ElementResult.cpp
r15128 r15377 118 118 /*FUNCTION TriaP1ElementResult::GetElementVectorFromResults{{{*/ 119 119 void TriaP1ElementResult::GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof){ 120 _error_("Result " << EnumToStringx(enum_type) << " is a TriaP1ElementResult and should not write vector of size numberofelemen rs");120 _error_("Result " << EnumToStringx(enum_type) << " is a TriaP1ElementResult and should not write vector of size numberofelements"); 121 121 } /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15375 r15377 455 455 case MeltingAnalysisEnum: 456 456 Ke=CreateKMatrixMelting(); 457 break; 458 #endif 459 #ifdef _HAVE_HYDROLOGY_ 460 case HydrologyDCInefficientAnalysisEnum: 461 Ke=CreateKMatrixHydrologyDCInefficient(); 462 break; 463 case HydrologyDCEfficientAnalysisEnum: 464 Ke=CreateKMatrixHydrologyDCEfficient(); 457 465 break; 458 466 #endif … … 585 593 break; 586 594 #endif 595 #ifdef _HAVE_HYDROLOGY_ 596 case HydrologyDCInefficientAnalysisEnum: 597 pe=CreatePVectorHydrologyDCInefficient(); 598 break; 599 case HydrologyDCEfficientAnalysisEnum: 600 pe=CreatePVectorHydrologyDCEfficient(); 601 break; 602 #endif 587 603 default: 588 604 _error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); … … 1162 1178 break; 1163 1179 case DiagnosticVertAnalysisEnum: 1164 GetSolutionFromInputsDiagnosticVert(solution); 1180 //GetSolutionFromInputsDiagnosticVert(solution); 1181 GetSolutionFromInputsOneDof(solution, VzEnum); 1165 1182 break; 1166 1183 #endif 1167 1184 #ifdef _HAVE_THERMAL_ 1168 1185 case ThermalAnalysisEnum: 1169 GetSolutionFromInputsThermal(solution); 1186 //GetSolutionFromInputsThermal(solution); 1187 GetSolutionFromInputsOneDof(solution, TemperatureEnum); 1170 1188 break; 1171 1189 case EnthalpyAnalysisEnum: 1172 GetSolutionFromInputsEnthalpy(solution); 1190 //GetSolutionFromInputsEnthalpy(solution); 1191 GetSolutionFromInputsOneDof(solution, EnthalpyEnum); 1173 1192 break; 1174 1193 #endif 1194 #ifdef _HAVE_HYDROLOGY_ 1195 case HydrologyDCInefficientAnalysisEnum: 1196 GetSolutionFromInputsOneDof(solution, SedimentHeadEnum); 1197 break; 1198 case HydrologyDCEfficientAnalysisEnum: 1199 GetSolutionFromInputsOneDof(solution, EplHeadEnum); 1200 break; 1201 #endif 1175 1202 default: 1176 1203 _error_("analysis: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); … … 1880 1907 break; 1881 1908 #endif 1909 #ifdef _HAVE_HYDROLOGY_ 1910 case HydrologyDCInefficientAnalysisEnum: 1911 InputUpdateFromSolutionHydrologyDCInefficient(solution); 1912 break; 1913 case HydrologyDCEfficientAnalysisEnum: 1914 InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum); 1915 break; 1916 #endif 1882 1917 default: 1883 1918 _error_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); … … 2085 2120 return; 2086 2121 2087 default: 2122 case NodeSIdEnum: 2123 for(int i=0;i<NUMVERTICES;i++){ 2124 values[i]=vector[nodes[i]->Sid()]; 2125 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector"); 2126 } 2127 /*Add input to the element: */ 2128 this->inputs->AddInput(new PentaP1Input(name,values)); 2129 2130 /*Free ressources:*/ 2131 xDelete<int>(doflist); 2132 return; 2133 2134 default: 2088 2135 _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 2089 2136 } … … 2152 2199 name==QmuMeltingEnum || 2153 2200 name==GiaWEnum || 2154 name==GiadWdtEnum 2155 2201 name==GiadWdtEnum || 2202 name==SedimentHeadEnum || 2203 name==EplHeadEnum || 2204 name==SedimentHeadOldEnum || 2205 name==EplHeadOldEnum || 2206 name==HydrologydcMaskEplactiveEnum || 2207 name==WaterTransferEnum 2208 2156 2209 ) { 2157 2210 return true; … … 9267 9320 #endif 9268 9321 #ifdef _HAVE_HYDROLOGY_ 9322 9323 /*FUNCTION Penta::CreateKMatrixHydrologyDCInefficient {{{*/ 9324 ElementMatrix* Penta::CreateKMatrixHydrologyDCInefficient(void){ 9325 9326 if (!IsOnBed()) return NULL; 9327 9328 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9329 ElementMatrix* Ke=tria->CreateKMatrixHydrologyDCInefficient(); 9330 delete tria->material; delete tria; 9331 9332 /*clean up and return*/ 9333 return Ke; 9334 } 9335 /*}}}*/ 9336 /*FUNCTION Penta::CreateKMatrixHydrologyDCEfficient {{{*/ 9337 ElementMatrix* Penta::CreateKMatrixHydrologyDCEfficient(void){ 9338 9339 if (!IsOnBed()) return NULL; 9340 9341 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9342 ElementMatrix* Ke=tria->CreateKMatrixHydrologyDCEfficient(); 9343 delete tria->material; delete tria; 9344 9345 /*clean up and return*/ 9346 return Ke; 9347 } 9348 /*}}}*/ 9349 /*FUNCTION Penta::CreatePVectorHydrologyDCInefficient {{{*/ 9350 ElementVector* Penta::CreatePVectorHydrologyDCInefficient(void){ 9351 9352 if (!IsOnBed()) return NULL; 9353 9354 /*Call Tria function*/ 9355 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9356 ElementVector* pe=tria->CreatePVectorHydrologyDCInefficient(); 9357 delete tria->material; delete tria; 9358 9359 /*Clean up and return*/ 9360 return pe; 9361 } 9362 /*}}}*/ 9363 /*FUNCTION Penta::CreatePVectorHydrologyDCEfficient {{{*/ 9364 ElementVector* Penta::CreatePVectorHydrologyDCEfficient(void){ 9365 9366 if (!IsOnBed()) return NULL; 9367 9368 /*Call Tria function*/ 9369 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9370 ElementVector* pe=tria->CreatePVectorHydrologyDCEfficient(); 9371 delete tria->material; delete tria; 9372 9373 /*Clean up and return*/ 9374 return pe; 9375 } 9376 /*}}}*/ 9269 9377 /*FUNCTION Penta::GetHydrologyDCInefficientHmax{{{*/ 9270 9378 void Penta::GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){ 9271 _error_("Hydrological stuff not suported in Penta"); 9379 9380 if (!IsOnBed()) return; 9381 9382 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9383 tria->GetHydrologyDCInefficientHmax(ph_max,innode); 9384 delete tria->material; delete tria; 9272 9385 } 9273 9386 /*}}}*/ 9274 9387 /*FUNCTION Penta::GetHydrologyTransfer{{{*/ 9275 9388 void Penta::GetHydrologyTransfer(Vector<IssmDouble>* transfer){ 9276 _error_("Hydrological stuff not suported in Penta"); 9277 } 9278 /*}}}*/ 9279 9389 9390 if (!IsOnBed()) return; 9391 9392 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9393 tria->GetHydrologyTransfer(transfer); 9394 delete tria->material; delete tria; 9395 } 9396 /*}}}*/ 9397 /*FUNCTION Penta::GetSolutionFromInputsOneDof {{{*/ 9398 void Penta::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){ 9399 9400 const int numdof=NDOF1*NUMVERTICES; 9401 9402 int i; 9403 int* doflist=NULL; 9404 IssmDouble values[numdof]; 9405 IssmDouble enum_value; 9406 GaussPenta *gauss=NULL; 9407 9408 /*Get dof list: */ 9409 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 9410 Input* enum_input=inputs->GetInput(enum_type); _assert_(enum_input); 9411 9412 gauss=new GaussPenta(); 9413 for(i=0;i<NUMVERTICES;i++){ 9414 /*Recover temperature*/ 9415 gauss->GaussVertex(i); 9416 enum_input->GetInputValue(&enum_value,gauss); 9417 values[i]=enum_value; 9418 } 9419 9420 /*Add value to global vector*/ 9421 solution->SetValues(numdof,doflist,values,INS_VAL); 9422 9423 /*Free ressources:*/ 9424 delete gauss; 9425 xDelete<int>(doflist); 9426 } 9427 /*{{{*/ 9280 9428 /*FUNCTION Penta::HydrologyEPLGetActive {{{*/ 9281 9429 void Penta::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){ 9282 _error_("Hydrological stuff not suported in Penta"); 9430 9431 if (!IsOnBed())return; 9432 9433 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9434 tria->HydrologyEPLGetActive(active_vec); 9435 delete tria->material; delete tria; 9436 9283 9437 } 9284 9438 /*}}}*/ 9285 9439 /*FUNCTION Penta::HydrologyEPLGetMask{{{*/ 9286 9440 void Penta::HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){ 9287 _error_("Hydrological stuff not suported in Penta"); 9441 9442 if (!IsOnBed())return; 9443 9444 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9445 tria->HydrologyEPLGetMask(vec_mask); 9446 delete tria->material; delete tria; 9447 9448 } 9449 /*}}}*/ 9450 /*FUNCTION Penta::InputUpdateFromSolutionHydrologyDCInefficient{{{*/ 9451 void Penta::InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution){ 9452 9453 const int numdof = NDOF1*NUMVERTICES; 9454 const int numdof2d = NDOF1*NUMVERTICES2D; 9455 int* doflist = NULL; 9456 bool converged; 9457 IssmDouble values[numdof]; 9458 IssmDouble residual[numdof]; 9459 IssmDouble penalty_factor; 9460 IssmDouble kmax, kappa, h_max; 9461 Penta *penta = NULL; 9462 9463 /*If not on bed, return*/ 9464 if (!IsOnBed()) return; 9465 9466 /*Get dof list: */ 9467 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 9468 9469 /*Use the dof list to index into the solution vector and extrude it */ 9470 for(int i=0;i<numdof2d;i++){ 9471 values[i] =solution[doflist[i]]; 9472 values[i+numdof2d]=values[i]; 9473 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector"); 9474 } 9475 9476 /*If converged keep the residual in mind*/ 9477 this->inputs->GetInputValue(&converged,ConvergedEnum); 9478 9479 /*Get inputs*/ 9480 if(converged){ 9481 this->parameters->FindParam(&kmax,HydrologySedimentKmaxEnum); 9482 this->parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum); 9483 9484 kappa=kmax*pow(10.,penalty_factor); 9485 9486 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 9487 for(int i=0;i<NUMVERTICES2D;i++){ 9488 tria->GetHydrologyDCInefficientHmax(&h_max,nodes[i]); 9489 if(values[i]>h_max){ 9490 residual[i]=kappa*(values[i]-h_max); 9491 } 9492 else{ 9493 residual[i]=0.0; 9494 } 9495 } 9496 delete tria->material; delete tria; 9497 } 9498 9499 /*Start looping over all elements above current element and update all inputs*/ 9500 penta=this; 9501 for(;;){ 9502 /*Add input to the element: */ 9503 penta->inputs->AddInput(new PentaP1Input(SedimentHeadEnum,values)); 9504 penta->inputs->AddInput(new PentaP1Input(SedimentHeadResidualEnum,residual)); 9505 9506 /*Stop if we have reached the surface*/ 9507 if (penta->IsOnSurface()) break; 9508 9509 /* get upper Penta*/ 9510 penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id); 9511 } 9512 9513 /*Free ressources:*/ 9514 xDelete<int>(doflist); 9288 9515 } 9289 9516 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r15372 r15377 302 302 303 303 #ifdef _HAVE_HYDROLOGY_ 304 void UpdateConstraints(void); 304 305 ElementMatrix* CreateKMatrixHydrologyDCInefficient(void); 306 ElementMatrix* CreateKMatrixHydrologyDCEfficient(void); 307 ElementVector* CreatePVectorHydrologyDCInefficient(void); 308 ElementVector* CreatePVectorHydrologyDCEfficient(void); 309 305 310 void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode); 306 311 void GetHydrologyTransfer(Vector<IssmDouble>* transfer); 312 void GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type); 307 313 void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec); 308 314 void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask); 315 void InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution); 316 void UpdateConstraints(void); 309 317 #endif 310 318 #ifdef _HAVE_THERMAL_ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15372 r15377 6406 6406 int *doflist = NULL; 6407 6407 bool converged; 6408 bool isefficientlayer;6409 6408 IssmDouble values[numdof]; 6410 6409 IssmDouble residual[numdof]; … … 6415 6414 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 6416 6415 6417 /*Get the flag to know if the efficient layer is present*/6418 this->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);6419 6420 6416 /*Use the dof list to index into the solution vector: */ 6421 6417 for(int i=0;i<numdof;i++){ … … 6429 6425 /*Get inputs*/ 6430 6426 if(converged){ 6431 this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);6432 6427 this->parameters->FindParam(&kmax,HydrologySedimentKmaxEnum); 6433 6428 this->parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum); … … 6461 6456 IssmDouble rho_ice,rho_water; 6462 6457 IssmDouble thickness,bed; 6463 6464 6458 /*Get the flag to the limitation method*/ 6465 6459 this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum); -
issm/trunk-jpl/src/c/classes/Node.cpp
r15230 r15377 122 122 analysis_type==BedSlopeAnalysisEnum || 123 123 analysis_type==SurfaceSlopeAnalysisEnum || 124 analysis_type==BalancethicknessAnalysisEnum 124 analysis_type==BalancethicknessAnalysisEnum || 125 analysis_type==HydrologyDCInefficientAnalysisEnum || 126 analysis_type==HydrologyDCEfficientAnalysisEnum 125 127 ){ 126 128 if (dim==3){
Note:
See TracChangeset
for help on using the changeset viewer.