Changeset 23661


Ignore:
Timestamp:
01/25/19 03:22:12 (6 years ago)
Author:
bdef
Message:

BUG: bug in the treatment of initialization of inactive nodes

Location:
issm/trunk-jpl/src/c
Files:
4 edited

Legend:

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

    r23644 r23661  
    410410void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    411411        /*Intermediaries*/
    412         bool     active_element;
    413412        int      domaintype;
    414413        Element* basalelement=NULL;
     
    433432
    434433        /*Fetch dof list and allocate solution vector*/
    435         IssmDouble* eplHeads    = xNew<IssmDouble>(numnodes);
    436         IssmDouble* basevalue    = xNew<IssmDouble>(numnodes);
    437434        basalelement->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
    438 
    439         Input* 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);
    442439        /*Use the dof list to index into the solution vector: */
    443440        /*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()){
    447443                        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");
    460450        }
    461451        /*Add input to the element: */
     
    463453        /*Free ressources:*/
    464454        xDelete<IssmDouble>(eplHeads);
    465         xDelete<IssmDouble>(basevalue);
     455        xDelete<IssmDouble>(base);
    466456        xDelete<int>(doflist);
    467457        if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
  • issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp

    r23644 r23661  
    488488
    489489        /*Intermediaries*/
    490         bool     thawed_element;
    491490        int                      domaintype;
    492491        Element* basalelement=NULL;
    493492        bool             converged;
    494         int*             doflist        =       NULL;
    495493
    496494        /*Get basal element*/
     
    506504                default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
    507505        }
     506        /*Intermediary*/
     507        int* doflist = NULL;
    508508
    509509        /*Fetch number of nodes for this finite element*/
     
    515515        IssmDouble* pressure = xNew<IssmDouble>(numnodes);
    516516        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: */
    520521        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                }
    522528                if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
    523529                if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector");
     
    531537                IssmDouble  penalty_factor,kmax,kappa,h_max;
    532538                IssmDouble* thickness = xNew<IssmDouble>(numnodes);
    533                 IssmDouble* base      = xNew<IssmDouble>(numnodes);
    534539                IssmDouble* transmitivity = xNew<IssmDouble>(numnodes);
    535540
     
    540545                IssmDouble g              = basalelement->FindParam(ConstantsGEnum);
    541546
    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
    545550                kappa=kmax*pow(10.,penalty_factor);
    546551
    547 
    548                 Input* thawed_element_input = basalelement->GetInput(HydrologydcMaskThawedEltEnum); _assert_(thawed_element_input);
    549                 thawed_element_input->GetInputValue(&thawed_element);
    550 
    551552                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                         }
    556553                        GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i));
    557554                        if(values[i]>h_max) {
  • issm/trunk-jpl/src/c/cores/hydrology_core.cpp

    r23546 r23661  
    6464                femmodel->HydrologyIDSupdateDomainx(&ThawedNodes);
    6565                if(ThawedNodes>0){
    66                         init_time = time-dt; //getting the time back to the start of the timestep
     66                        init_time=time-dt; //getting the time back to the start of the timestep
    6767                        hydrotime=init_time;
    6868                        hydrodt=dt/hydroslices; //computing hydro dt from dt and a divider
     
    120120                }
    121121        }
    122         else if (hydrology_model==HydrologyshaktiEnum){
     122 else if (hydrology_model==HydrologyshaktiEnum){
    123123                femmodel->SetCurrentConfiguration(HydrologyShaktiAnalysisEnum);
    124124                InputDuplicatex(femmodel,HydrologyHeadEnum,HydrologyHeadOldEnum);
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp

    r23587 r23661  
    5757        if(!isefficientlayer) hydroconverged=true;
    5858
    59         /*Retrieve inputs as the initial state for the non linear iteration*/
     59        /*{{{*//*Retrieve inputs as the initial state for the non linear iteration*/
    6060        GetSolutionFromInputsx(&ug_sed,femmodel);
    6161        Reducevectorgtofx(&uf_sed, ug_sed, femmodel->nodes,femmodel->parameters);
     
    6565                femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
    6666                GetSolutionFromInputsx(&ug_epl,femmodel);
    67                 /*Initialize the element mask*/
     67                /*Initialize the EPL element mask*/
    6868                inefanalysis->ElementizeEplMask(femmodel);
    6969                effanalysis->InitZigZagCounter(femmodel);
     70                /*Initialize the IDS element mask*/
     71                femmodel->SetCurrentConfiguration(HydrologyDCInefficientAnalysisEnum);
     72                inefanalysis->ElementizeIdsMask(femmodel);
    7073        }
     74        /*}}}*/
    7175        /*The real computation starts here, outermost loop is on the two layer system*/
    7276        for(;;){
     
    98102                        /*{{{*//*Loop on the sediment layer to deal with the penalization*/
    99103                        for(;;){
    100                                 /*{{{*/ /*Core of the computation*/
     104                                /*{{{*//*Core of the computation*/
    101105                                if(VerboseSolution()) _printf0_("Building Sediment Matrix...\n");
    102106                                SystemMatricesx(&Kff,&Kfs,&pf,&df,&sediment_kmax,femmodel);
     
    130134                        sedconverged=false;
    131135
    132                         /*Checking convegence on the value of the sediment head*/
     136                        /*Checking convergence on the value of the sediment head*/
    133137                        duf=uf_sed_sub_iter->Duplicate();_assert_(duf);
    134138                        uf_sed_sub_iter->Copy(duf);
     
    160164                        if(VerboseSolution()) _printf0_("==updating mask...\n");
    161165                        femmodel->HydrologyEPLupdateDomainx(&ThickCount);
    162                         inefanalysis->ElementizeEplMask(femmodel);
    163166                        ResetZigzagCounterx(femmodel);
    164167                        InputUpdateFromConstantx(femmodel,false,ConvergedEnum);
     
    172175                                femmodel->SetCurrentConfiguration(L2ProjectionEPLAnalysisEnum);
    173176                                femmodel->UpdateConstraintsL2ProjectionEPLx(&L2Count);
    174                                 inefanalysis->ElementizeEplMask(femmodel);
    175177                                femmodel->parameters->SetParam(EplHeadSlopeXEnum,InputToL2ProjectEnum);
    176178                                solutionsequence_linear(femmodel);
     
    182184                                //updating mask after the computation of the epl thickness (Allow to close too thin EPL)
    183185                                femmodel->HydrologyEPLupdateDomainx(&ThickCount);
    184                                 inefanalysis->ElementizeEplMask(femmodel);
    185186                                /*}}}*/
    186187
     
    229230                        }
    230231                }
    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*/
    234234                if(!hydroconverged){
    235235                        //compute norm(du)/norm(u)
Note: See TracChangeset for help on using the changeset viewer.