Changeset 23661
- Timestamp:
- 01/25/19 03:22:12 (6 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
r23644 r23661 410 410 void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 411 411 /*Intermediaries*/ 412 bool active_element;413 412 int domaintype; 414 413 Element* basalelement=NULL; … … 433 432 434 433 /*Fetch dof list and allocate solution vector*/ 435 IssmDouble* eplHeads = xNew<IssmDouble>(numnodes);436 IssmDouble* basevalue = xNew<IssmDouble>(numnodes);437 434 basalelement->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum); 438 439 I nput* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);440 active_element_input->GetInputValue(&active_element); 441 435 IssmDouble* eplHeads = xNew<IssmDouble>(numnodes); 436 IssmDouble* base = xNew<IssmDouble>(numnodes); 437 438 basalelement->GetInputListOnVertices(&base[0],BaseEnum); 442 439 /*Use the dof list to index into the solution vector: */ 443 440 /*If the EPL is not active we revert to the bedrock elevation*/ 444 445 if(active_element){ 446 for(int i=0;i<numnodes;i++){ 441 for(int i=0;i<numnodes;i++){ 442 if(basalelement->nodes[i]->IsActive()){ 447 443 eplHeads[i]=solution[doflist[i]]; 448 if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector"); 449 if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector"); 450 } 451 } 452 else{ 453 //Fixing epl head at bedrock elevation when deactivating 454 basalelement->GetInputListOnVertices(&basevalue[0],BaseEnum); 455 for(int i=0;i<numnodes;i++){ 456 eplHeads[i]=basevalue[i]; 457 if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector"); 458 if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector"); 459 } 444 } 445 else{ 446 eplHeads[i]=base[i]; 447 } 448 if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector"); 449 if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector"); 460 450 } 461 451 /*Add input to the element: */ … … 463 453 /*Free ressources:*/ 464 454 xDelete<IssmDouble>(eplHeads); 465 xDelete<IssmDouble>(base value);455 xDelete<IssmDouble>(base); 466 456 xDelete<int>(doflist); 467 457 if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;}; -
issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
r23644 r23661 488 488 489 489 /*Intermediaries*/ 490 bool thawed_element;491 490 int domaintype; 492 491 Element* basalelement=NULL; 493 492 bool converged; 494 int* doflist = NULL;495 493 496 494 /*Get basal element*/ … … 506 504 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 507 505 } 506 /*Intermediary*/ 507 int* doflist = NULL; 508 508 509 509 /*Fetch number of nodes for this finite element*/ … … 515 515 IssmDouble* pressure = xNew<IssmDouble>(numnodes); 516 516 IssmDouble* residual = xNew<IssmDouble>(numnodes); 517 518 /*Use the dof list to index into the solution vector: */ 519 517 IssmDouble* base = xNew<IssmDouble>(numnodes); 518 519 basalelement->GetInputListOnVertices(&base[0],BaseEnum); 520 /*Use the dof list to index into the solution vector, frozen nodes are set to initial value: */ 520 521 for(int i=0;i<numnodes;i++){ 521 values[i] =solution[doflist[i]]; 522 if(basalelement->nodes[i]->IsActive()){ 523 values[i] =solution[doflist[i]]; 524 } 525 else{ 526 values[i] = base[i]; 527 } 522 528 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector"); 523 529 if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector"); … … 531 537 IssmDouble penalty_factor,kmax,kappa,h_max; 532 538 IssmDouble* thickness = xNew<IssmDouble>(numnodes); 533 IssmDouble* base = xNew<IssmDouble>(numnodes);534 539 IssmDouble* transmitivity = xNew<IssmDouble>(numnodes); 535 540 … … 540 545 IssmDouble g = basalelement->FindParam(ConstantsGEnum); 541 546 542 basalelement->GetInputListOnVertices( thickness,ThicknessEnum);543 basalelement->GetInputListOnVertices( base,BaseEnum);544 basalelement->GetInputListOnVertices(transmitivity,HydrologydcSedimentTransmitivityEnum); 547 basalelement->GetInputListOnVertices(&thickness[0],ThicknessEnum); 548 basalelement->GetInputListOnVertices(&transmitivity[0],HydrologydcSedimentTransmitivityEnum); 549 545 550 kappa=kmax*pow(10.,penalty_factor); 546 551 547 548 Input* thawed_element_input = basalelement->GetInput(HydrologydcMaskThawedEltEnum); _assert_(thawed_element_input);549 thawed_element_input->GetInputValue(&thawed_element);550 551 552 for(int i=0;i<numnodes;i++){ 552 /*frozen elements heads are set to base elevation*/553 if(!thawed_element){554 values[i]=base[i];555 }556 553 GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i)); 557 554 if(values[i]>h_max) { -
issm/trunk-jpl/src/c/cores/hydrology_core.cpp
r23546 r23661 64 64 femmodel->HydrologyIDSupdateDomainx(&ThawedNodes); 65 65 if(ThawedNodes>0){ 66 init_time =time-dt; //getting the time back to the start of the timestep66 init_time=time-dt; //getting the time back to the start of the timestep 67 67 hydrotime=init_time; 68 68 hydrodt=dt/hydroslices; //computing hydro dt from dt and a divider … … 120 120 } 121 121 } 122 122 else if (hydrology_model==HydrologyshaktiEnum){ 123 123 femmodel->SetCurrentConfiguration(HydrologyShaktiAnalysisEnum); 124 124 InputDuplicatex(femmodel,HydrologyHeadEnum,HydrologyHeadOldEnum); -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
r23587 r23661 57 57 if(!isefficientlayer) hydroconverged=true; 58 58 59 /* Retrieve inputs as the initial state for the non linear iteration*/59 /*{{{*//*Retrieve inputs as the initial state for the non linear iteration*/ 60 60 GetSolutionFromInputsx(&ug_sed,femmodel); 61 61 Reducevectorgtofx(&uf_sed, ug_sed, femmodel->nodes,femmodel->parameters); … … 65 65 femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum); 66 66 GetSolutionFromInputsx(&ug_epl,femmodel); 67 /*Initialize the element mask*/67 /*Initialize the EPL element mask*/ 68 68 inefanalysis->ElementizeEplMask(femmodel); 69 69 effanalysis->InitZigZagCounter(femmodel); 70 /*Initialize the IDS element mask*/ 71 femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum); 72 inefanalysis->ElementizeIdsMask(femmodel); 70 73 } 74 /*}}}*/ 71 75 /*The real computation starts here, outermost loop is on the two layer system*/ 72 76 for(;;){ … … 98 102 /*{{{*//*Loop on the sediment layer to deal with the penalization*/ 99 103 for(;;){ 100 /*{{{*/ 104 /*{{{*//*Core of the computation*/ 101 105 if(VerboseSolution()) _printf0_("Building Sediment Matrix...\n"); 102 106 SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel); … … 130 134 sedconverged=false; 131 135 132 /*Checking conve gence on the value of the sediment head*/136 /*Checking convergence on the value of the sediment head*/ 133 137 duf=uf_sed_sub_iter->Duplicate();_assert_(duf); 134 138 uf_sed_sub_iter->Copy(duf); … … 160 164 if(VerboseSolution()) _printf0_("==updating mask...\n"); 161 165 femmodel->HydrologyEPLupdateDomainx(&ThickCount); 162 inefanalysis->ElementizeEplMask(femmodel);163 166 ResetZigzagCounterx(femmodel); 164 167 InputUpdateFromConstantx(femmodel,false,ConvergedEnum); … … 172 175 femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum); 173 176 femmodel->UpdateConstraintsL2ProjectionEPLx(&L2Count); 174 inefanalysis->ElementizeEplMask(femmodel);175 177 femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum); 176 178 solutionsequence_linear(femmodel); … … 182 184 //updating mask after the computation of the epl thickness (Allow to close too thin EPL) 183 185 femmodel->HydrologyEPLupdateDomainx(&ThickCount); 184 inefanalysis->ElementizeEplMask(femmodel);185 186 /*}}}*/ 186 187 … … 229 230 } 230 231 } 231 /*}}}*/ /*End of the global EPL loop*/ 232 233 /*{{{*/ /*Now dealing with the convergence of the whole system*/ 232 /*}}}*//*End of the global EPL loop*/ 233 /*{{{*//*Now dealing with the convergence of the whole system*/ 234 234 if(!hydroconverged){ 235 235 //compute norm(du)/norm(u)
Note:
See TracChangeset
for help on using the changeset viewer.