Changeset 17030


Ignore:
Timestamp:
12/19/13 08:25:02 (11 years ago)
Author:
bdef
Message:

CHG: uniformisation of the mask gestion in Hydrology

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

Legend:

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

    r17024 r17030  
    5858        iomodel->FetchDataToInput(elements,EplHeadEnum);
    5959        iomodel->FetchDataToInput(elements,HydrologydcEplInitialThicknessEnum);
     60
     61        //      iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
    6062       
    6163        elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
     
    98100
    99101/*Finite Element Analysis*/
    100 void           HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
     102void HydrologyDCEfficientAnalysis::Core(FemModel* femmodel){/*{{{*/
    101103        _error_("not implemented");
    102104}/*}}}*/
     105
    103106ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
    104107        /*Default, return NULL*/
    105108        return NULL;
    106109}/*}}}*/
     110
    107111ElementMatrix* HydrologyDCEfficientAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
    108112_error_("Not implemented");
    109113}/*}}}*/
     114
    110115ElementMatrix* HydrologyDCEfficientAnalysis::CreateKMatrix(Element* element){/*{{{*/
    111116
    112117        /*Intermediaries*/
    113118        int      meshtype;
     119        bool     active_element;
    114120        Element* basalelement;
     121        Input*   active_element_input=NULL;
    115122
    116123        /*Get basal element*/
     
    127134        }
    128135
     136        /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
     137        /* active_element_input->GetInputValue(&active_element); */
     138
    129139        /*Check that all nodes are active, else return empty matrix*/
    130140        if(!basalelement->AllActive()) {
    131                 if(meshtype!=Mesh2DhorizontalEnum){
     141                //if(!active_element){
     142        if(meshtype!=Mesh2DhorizontalEnum){
    132143                        basalelement->DeleteMaterials();
    133144                        delete basalelement;
     
    199210        /*Intermediaries*/
    200211        int      meshtype;
     212        bool       active_element;
    201213        Element* basalelement;
     214        Input*   active_element_input=NULL;
     215
    202216
    203217        /*Get basal element*/
     
    213227                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
    214228        }
     229        /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
     230        /* active_element_input->GetInputValue(&active_element); */
    215231
    216232        /*Check that all nodes are active, else return empty matrix*/
    217         if(!basalelement->AllActive()){
    218                 if(meshtype!=Mesh2DhorizontalEnum){
     233        if(!basalelement->AllActive()) {
     234                //if(!active_element){
     235        if(meshtype!=Mesh2DhorizontalEnum){
    219236                        basalelement->DeleteMaterials();
    220237                        delete basalelement;
     
    289306        return pe;
    290307}/*}}}*/
     308
    291309void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    292310        element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
    293311}/*}}}*/
     312
    294313void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    295314        int meshtype;
     
    315334        return rho_freshwater*g*epl_porosity*(water_compressibility+(epl_compressibility/epl_porosity));                 
    316335}/*}}}*/
     336
    317337void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    318338        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
  • issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp

    r17021 r17030  
    296296        return pe;
    297297}/*}}}*/
     298
    298299void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    299300        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
     
    323324        xDelete<IssmDouble>(dbasis);
    324325}/*}}}*/
     326
    325327void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    326328        element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
    327329}/*}}}*/
     330
    328331void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    329332
     
    395398        return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));               
    396399}/*}}}*/
     400
    397401void HydrologyDCInefficientAnalysis::ElementizeEplMask(FemModel* femmodel){/*{{{*/
    398402
  • issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp

    r17005 r17030  
    7373        _error_("not implemented");
    7474}/*}}}*/
     75
    7576ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
    7677        /*Default, return NULL*/
    7778        return NULL;
    7879}/*}}}*/
     80
    7981ElementMatrix* L2ProjectionEPLAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
    8082_error_("Not implemented");
    8183}/*}}}*/
     84
    8285ElementMatrix* L2ProjectionEPLAnalysis::CreateKMatrix(Element* element){/*{{{*/
    8386
    8487        /*Intermediaries*/
    8588        int      meshtype;
     89        bool     active_element;
    8690        Element* basalelement;
     91        Input*   active_element_input=NULL;
    8792
    8893        /*Get basal element*/
     
    101106                        break;
    102107                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
     108        }
     109
     110        /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
     111        /* active_element_input->GetInputValue(&active_element); */
     112
     113        /* Check that all nodes are active, else return empty matrix */
     114        if(!basalelement->AllActive()) {
     115                //      if(!active_element){
     116        if(meshtype!=Mesh2DhorizontalEnum){
     117                        basalelement->DeleteMaterials();
     118                        delete basalelement;
     119                }
     120                return NULL;
    103121        }
    104122
     
    143161        /*Intermediaries*/
    144162        int      meshtype;
     163        bool     active_element;
    145164        Element* basalelement;
     165        Input*   active_element_input=NULL;
    146166
    147167        /*Get basal element*/
     
    158178        }
    159179
     180        /* active_element_input=basalelement->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input); */
     181        /* active_element_input->GetInputValue(&active_element); */
     182
     183        /*Check that all nodes are active, else return empty matrix*/
     184        if(!basalelement->AllActive()) {
     185                /* if(!active_element){ */
     186                if(meshtype!=Mesh2DhorizontalEnum){
     187                        basalelement->DeleteMaterials();
     188                        delete basalelement;
     189                }
     190                return NULL;
     191        }
     192       
    160193        /*Intermediaries */
    161194        int         input_enum,index;
     
    199232        return pe;
    200233}/*}}}*/
     234
    201235void L2ProjectionEPLAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    202236           _error_("not implemented yet");
    203237}/*}}}*/
     238
    204239void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    205240        int inputenum,meshtype;
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r17021 r17030  
    47294729
    47304730                                        /*Introduce relaxation*/
    4731                                         wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
     4731                                        //                                      wh_trans=old_transfer[i]+0.66*(wh_trans-old_transfer[i]);
     4732
     4733                                        if(this->Id()==27){
     4734                                                printf("old %e, transfer is %e ,eplhead %e, sedhead %e, factor %e \n",old_transfer[i],wh_trans,epl_head[i],sed_head[i],epl_specificstoring[i]*epl_thickness[i]*sed_trans[i]);
     4735                                        }
    47324736                               
    47334737                                        /*Assign output pointer*/
     
    47824786        IssmDouble  residual[numdof];
    47834787
     4788        bool       active_element;
     4789        Input* active_element_input=NULL;
     4790
     4791        active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
     4792        active_element_input->GetInputValue(&active_element);
     4793
    47844794        GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);       
    47854795        GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessEnum); 
     
    48084818                /*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
    48094819                this->GetHydrologyDCInefficientHmax(&h_max,i);
    4810                 if(eplhead[i]>=h_max && this->AnyActive()){
     4820                //if(eplhead[i]>=h_max && this->AnyActive()){
     4821                if(eplhead[i]>=h_max && active_element){
    48114822                        for(j=0;j<numdof;j++){
    48124823                                if(old_active[j]>0.){
     
    48384849        IssmDouble  ice_thickness[numdof],bed[numdof];
    48394850
     4851        bool       active_element;
     4852        Input* active_element_input=NULL;
    48404853
    48414854        /*Get the flag to know if the efficient layer is present*/
     
    48544867                A                = material->GetAbar();
    48554868               
    4856                 GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
     4869                //      GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveNodeEnum);
     4870
     4871                active_element_input=inputs->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
     4872                active_element_input->GetInputValue(&active_element);
     4873                       
    48574874                GetInputListOnVertices(&eplhead[0],EplHeadEnum);
    48584875                GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);
     
    48624879                GetInputListOnVertices(&bed[0],BedEnum);
    48634880               
    4864                 if(!this->AnyActive()){
     4881                //if(!this->AnyActive()){
     4882                if(!active_element){
    48654883                        /*Keeping thickness to initial value if EPL is not active*/
    48664884                        for(int i=0;i<numdof;i++){
     
    48784896                                        /*And proceed to the real thing*/
    48794897                                        thickness[i] = old_thickness[i]*(1+((rho_water*gravity*dt)/(rho_ice*latentheat))*epl_conductivity*EPLgrad2-2.0*(A*dt/(pow(n,n)))*(pow(EPL_N,n)));
     4898                                        //                                      thickness[i] = old_thickness[i]+0.66*(thickness[i]-old_thickness[i]);
     4899                                        if(this->Id()==27){
     4900                                                printf("old %e, thickness is %e ,eplhead %e, slopeX %e, slopeY %e\n",old_thickness[i],thickness[i],eplhead[i],epl_slopeX[i],epl_slopeY[i]);
     4901                                        }
    48804902                        }
    48814903                }
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp

    r17024 r17030  
    169169                        femmodel->parameters->SetParam(HydrologyEfficientEnum,HydrologyLayerEnum);
    170170               
    171                         eplconverged = false;
    172                        
     171                        eplconverged=false;
    173172                        for(;;){
    174173                                ug_epl_sub_iter=ug_epl->Duplicate();_assert_(ug_epl_sub_iter);
    175174                                ug_epl->Copy(ug_epl_sub_iter);
    176                                        
     175                               
     176                                /*Loop on the epl layer to deal with the penalization, have been removed TO CHECK*/
     177                                                                                               
     178                                SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
     179                                CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
     180                                Reduceloadx(pf,Kfs,ys); delete Kfs;
     181                                delete uf_epl;
     182                                Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
     183                                delete Kff; delete pf; delete df;
     184                                delete uf_epl_sub_iter;
     185                                uf_epl_sub_iter=uf_epl->Duplicate();
     186                                uf_epl->Copy(uf_epl_sub_iter);
     187                                delete ug_epl;
     188                                Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
     189                                InputUpdateFromSolutionx(femmodel,ug_epl);
     190                                ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
     191                               
    177192                                /* {{{ *//*Start by retrieving the EPL head slopes and compute EPL Thickness*/
    178193                                if(VerboseSolution()) _printf0_("computing EPL Head slope...\n");
     
    183198                                femmodel->parameters->SetParam(EplHeadSlopeYEnum,InputToL2ProjectEnum);
    184199                                solutionsequence_linear(femmodel);
     200                                femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
    185201                                femmodel->HydrologyEPLThicknessx();
     202                               
    186203                                //updating mask after the computation of the epl thickness (Allow to close too thin EPL)
    187204                                femmodel->HydrologyEPLupdateDomainx();
    188205                                /* }}} */
    189                                 femmodel->SetCurrentConfiguration(HydrologyDCEfficientAnalysisEnum);
    190                                
    191                                 /* {{{ *//*Loop on the epl layer to deal with the penalization*/
    192                                 for(;;){
    193                                         SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
    194                                         CreateNodalConstraintsx(&ys,femmodel->nodes,HydrologyDCEfficientAnalysisEnum);
    195                                         Reduceloadx(pf,Kfs,ys); delete Kfs;
    196                                         delete uf_epl;
    197                                         Solverx(&uf_epl,Kff,pf,uf_epl_sub_iter,df,femmodel->parameters);
    198                                         delete Kff; delete pf; delete df;
    199                                         delete uf_epl_sub_iter;
    200                                         uf_epl_sub_iter=uf_epl->Duplicate();
    201                                         uf_epl->Copy(uf_epl_sub_iter);
    202                                         delete ug_epl;
    203                                         Mergesolutionfromftogx(&ug_epl,uf_epl,ys,femmodel->nodes,femmodel->parameters); delete ys;
    204                                         InputUpdateFromSolutionx(femmodel,ug_epl);
    205                                         ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
    206                                
    207                                         if (!eplconverged){
    208                                                 if(VerboseConvergence()) _printf0_("   # EPL unstable constraints = " << num_unstable_constraints << "\n");
    209                                                 if(num_unstable_constraints==0) eplconverged = true;
    210                                                 if (eplcount>=hydro_maxiter){
    211                                                         _error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
    212                                                 }
    213                                         }
    214                                         /*Add an iteration and get out of the loop if the penalisation is converged*/
    215                                         eplcount++;
    216                                         if(eplconverged) break;
    217                                 }
    218                                 /* }}} */ /*End of the EPL penalization loop*/
    219 
    220                                 eplconverged=false;
     206                               
    221207                                /*Update Elemental Mask and compute transfer*/
    222208                                HydrologyDCInefficientAnalysis* analysis = new HydrologyDCInefficientAnalysis();
     
    224210                                delete analysis;
    225211                                femmodel->HydrologyTransferx();
    226 
     212                               
    227213                                dug=ug_epl_sub_iter->Duplicate();_assert_(dug);
    228214                                ug_epl_sub_iter->Copy(dug);
     
    235221                                if(VerboseConvergence()) _printf0_(setw(50) << left << "   Inner EPL Convergence criterion:" << ndu_epl/nu_epl*100 << " aiming lower than " << eps_hyd*100 << " %\n");
    236222                                if((ndu_epl/nu_epl)<eps_hyd) eplconverged=true;
    237                        
     223                                if (eplcount>=hydro_maxiter){
     224                                        _error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
     225                                }
     226                                eplcount++;
     227                               
    238228                                delete ug_epl_sub_iter;
    239229                                if(eplconverged){
Note: See TracChangeset for help on using the changeset viewer.