Ignore:
Timestamp:
12/07/16 02:45:35 (8 years ago)
Author:
bdef
Message:

BUG. Fixing the Epl initialisation which was erased for non active nodes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp

    r21433 r21434  
    151151
    152152        int*     eplzigzag_counter=NULL;
    153         Element* element=NULL;
    154153        femmodel->parameters->FindParam(&eplzigzag_counter,NULL,EplZigZagCounterEnum);
    155154        for(int i=0;i<femmodel->nodes->Size();i++){
     
    381380                pe->values[iv]+=residual/connectivity;
    382381        }
    383 
    384382        /*Clean up and return*/
    385383        xDelete<IssmDouble>(xyz_list);
     
    399397
    400398void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    401 
    402399        /*Intermediaries*/
    403400        bool     active_element;
     
    417414                default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
    418415        }
    419 
    420416        /*Intermediary*/
    421417        int* doflist = NULL;
     
    425421
    426422        /*Fetch dof list and allocate solution vector*/
    427         IssmDouble* sedhead     = xNew<IssmDouble>(numnodes);
    428423        IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
    429 
    430424        basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    431         basalelement->GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
    432425
    433426        Input* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
     
    435428
    436429        /*Use the dof list to index into the solution vector: */
    437         for(int i=0;i<numnodes;i++){
    438                 eplHeads[i]=solution[doflist[i]];
    439                 if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
    440                 if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector");
     430        /*If the EPL is not active we revert to the initialisation vallue*/
     431        /*       For now we keep OldValue but it is probably not the best*/
     432        if(active_element){
     433                for(int i=0;i<numnodes;i++){
     434                        eplHeads[i]=solution[doflist[i]];
     435                        if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
     436                        if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector");
     437                }
     438        }
     439        else{
     440                basalelement->GetInputListOnVertices(&eplHeads[0],EplHeadOldEnum);
     441                for(int i=0;i<numnodes;i++){
     442                        if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
     443                        if(xIsInf<IssmDouble>(eplHeads[i])) _error_("Inf found in solution vector");
     444                }
    441445        }
    442446        /*Add input to the element: */
    443447        element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
    444 
    445448        /*Free ressources:*/
    446449        xDelete<IssmDouble>(eplHeads);
    447         xDelete<IssmDouble>(sedhead);
    448450        xDelete<int>(doflist);
    449451        if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
Note: See TracChangeset for help on using the changeset viewer.