Ignore:
Timestamp:
11/22/19 02:51:08 (5 years ago)
Author:
bdef
Message:

BUG: fix in smb GradComp, and some shuffling in Hydro

File:
1 edited

Legend:

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

    r24344 r24385  
    383383        return pe;
    384384}/*}}}*/
     385void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
     386        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
     387         * For node i, Bi can be expressed in the actual coordinate system
     388         * by:
     389         *       Bi=[ dN/dx ]
     390         *          [ dN/dy ]
     391         * where N is the finiteelement function for node i.
     392         *
     393         * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
     394         */
     395
     396        /*Fetch number of nodes for this finite element*/
     397        int numnodes = element->GetNumberOfNodes();
     398
     399        /*Get nodal functions derivatives*/
     400        IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
     401        element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
     402
     403        /*Build B: */
     404        for(int i=0;i<numnodes;i++){
     405                B[numnodes*0+i] = dbasis[0*numnodes+i];
     406                B[numnodes*1+i] = dbasis[1*numnodes+i];
     407        }
     408
     409        /*Clean-up*/
     410        xDelete<IssmDouble>(dbasis);
     411}/*}}}*/
    385412void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    386413        element->GetSolutionFromInputsOneDof(solution,EplHeadSubstepEnum);
     
    437464
    438465/*Intermediaries*/
     466IssmDouble HydrologyDCEfficientAnalysis::EplStoring(Element* element,Gauss* gauss, Input2* epl_thick_input, Input2* epl_head_input, Input2* base_input){/*{{{*/
     467        IssmDouble epl_storing;
     468        IssmDouble water_sheet,storing;
     469        IssmDouble epl_thickness,prestep_head,base_elev;
     470        IssmDouble rho_freshwater        = element->FindParam(MaterialsRhoFreshwaterEnum);
     471        IssmDouble g                     = element->FindParam(ConstantsGEnum);
     472        IssmDouble epl_porosity                                  = element->FindParam(HydrologydcEplPorosityEnum);
     473        IssmDouble epl_compressibility   = element->FindParam(HydrologydcEplCompressibilityEnum);
     474        IssmDouble water_compressibility = element->FindParam(HydrologydcWaterCompressibilityEnum);
     475
     476        epl_thick_input->GetInputValue(&epl_thickness,gauss);
     477        epl_head_input->GetInputValue(&prestep_head,gauss);
     478        base_input->GetInputValue(&base_elev,gauss);
     479        water_sheet=max(0.0,(prestep_head-base_elev));
     480        storing=rho_freshwater*g*epl_porosity*epl_thickness*(water_compressibility+(epl_compressibility/epl_porosity));
     481
     482        /* //porosity for unconfined region */
     483        /* if (water_sheet<=0.9*epl_thickness){ */
     484        /*      epl_storing=epl_porosity; */
     485        /* } */
     486        /* //continuity ramp */
     487        /* else if((water_sheet<epl_thickness) && (water_sheet>0.9*epl_thickness)){ */
     488        /*      epl_storing=(epl_thickness-water_sheet)*(epl_porosity-storing)/(0.1*epl_thickness)+storing; */
     489        /* } */
     490        /* //storing coefficient for confined */
     491        /* else{ */
     492        /*      epl_storing=storing; */
     493        /* } */
     494        /* return epl_storing; */
     495        return storing;
     496}/*}}}*/
     497IssmDouble HydrologyDCEfficientAnalysis::EplTransmitivity(Element* element,Gauss* gauss, Input2* epl_thick_input, Input2* epl_head_input, Input2* base_input){/*{{{*/
     498        IssmDouble epl_transmitivity;
     499        IssmDouble water_sheet;
     500        IssmDouble epl_thickness,base_elev,prestep_head;
     501        IssmDouble epl_conductivity      = element->FindParam(HydrologydcEplConductivityEnum);
     502        epl_thick_input->GetInputValue(&epl_thickness,gauss);
     503        epl_head_input->GetInputValue(&prestep_head,gauss);
     504        base_input->GetInputValue(&base_elev,gauss);
     505
     506        water_sheet=max(0.0,(prestep_head-base_elev));
     507        epl_transmitivity=epl_conductivity*epl_thickness;
     508        //epl_transmitivity=max(1.0e-6,(epl_conductivity*min(water_sheet,epl_thickness)));
     509        return epl_transmitivity;
     510}/*}}}*/
     511void HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
     512
     513        int        hmax_flag;
     514        IssmDouble h_max;
     515        IssmDouble rho_ice,rho_water;
     516        IssmDouble thickness,bed;
     517        /*Get the flag to the limitation method*/
     518        element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
     519
     520        /*Switch between the different cases*/
     521        switch(hmax_flag){
     522        case 0:
     523                h_max=1.0e+10;
     524                break;
     525        case 1:
     526                element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
     527                break;
     528        case 2:
     529                /*Compute max*/
     530                rho_water = element->FindParam(MaterialsRhoFreshwaterEnum);
     531                rho_ice   = element->FindParam(MaterialsRhoIceEnum);
     532                element-> GetInputValue(&thickness,innode,ThicknessEnum);
     533                element-> GetInputValue(&bed,innode,BaseEnum);
     534                h_max=((rho_ice*thickness)/rho_water)+bed;
     535                break;
     536        case 3:
     537                _error_("Using normal stress  not supported yet");
     538                break;
     539        default:
     540                _error_("no case higher than 3 for SedimentlimitFlag");
     541        }
     542        /*Assign output pointer*/
     543        *ph_max=h_max;
     544}
     545/*}}}*/
    439546IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element){/*{{{*/
    440547
     
    582689        }
    583690}/*}}}*/
    584 void HydrologyDCEfficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    585         /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    586          * For node i, Bi can be expressed in the actual coordinate system
    587          * by:
    588          *       Bi=[ dN/dx ]
    589          *          [ dN/dy ]
    590          * where N is the finiteelement function for node i.
    591          *
    592          * We assume B has been allocated already, of size: 3x(NDOF2*numnodes)
    593          */
    594 
    595         /*Fetch number of nodes for this finite element*/
    596         int numnodes = element->GetNumberOfNodes();
    597 
    598         /*Get nodal functions derivatives*/
    599         IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
    600         element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
    601 
    602         /*Build B: */
    603         for(int i=0;i<numnodes;i++){
    604                 B[numnodes*0+i] = dbasis[0*numnodes+i];
    605                 B[numnodes*1+i] = dbasis[1*numnodes+i];
    606         }
    607 
    608         /*Clean-up*/
    609         xDelete<IssmDouble>(dbasis);
    610 }/*}}}*/
    611691void  HydrologyDCEfficientAnalysis::HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask, Vector<IssmDouble>* recurence, Element* element){/*{{{*/
    612692
     
    703783}
    704784/*}}}*/
    705 IssmDouble HydrologyDCEfficientAnalysis::EplStoring(Element* element,Gauss* gauss, Input2* epl_thick_input, Input2* epl_head_input, Input2* base_input){/*{{{*/
    706         IssmDouble epl_storing;
    707         IssmDouble water_sheet,storing;
    708         IssmDouble epl_thickness,prestep_head,base_elev;
    709         IssmDouble rho_freshwater        = element->FindParam(MaterialsRhoFreshwaterEnum);
    710         IssmDouble g                     = element->FindParam(ConstantsGEnum);
    711         IssmDouble epl_porosity                                  = element->FindParam(HydrologydcEplPorosityEnum);
    712         IssmDouble epl_compressibility   = element->FindParam(HydrologydcEplCompressibilityEnum);
    713         IssmDouble water_compressibility = element->FindParam(HydrologydcWaterCompressibilityEnum);
    714 
    715         epl_thick_input->GetInputValue(&epl_thickness,gauss);
    716         epl_head_input->GetInputValue(&prestep_head,gauss);
    717         base_input->GetInputValue(&base_elev,gauss);
    718         water_sheet=max(0.0,(prestep_head-base_elev));
    719         storing=rho_freshwater*g*epl_porosity*epl_thickness*(water_compressibility+(epl_compressibility/epl_porosity));
    720 
    721         /* //porosity for unconfined region */
    722         /* if (water_sheet<=0.9*epl_thickness){ */
    723         /*      epl_storing=epl_porosity; */
    724         /* } */
    725         /* //continuity ramp */
    726         /* else if((water_sheet<epl_thickness) && (water_sheet>0.9*epl_thickness)){ */
    727         /*      epl_storing=(epl_thickness-water_sheet)*(epl_porosity-storing)/(0.1*epl_thickness)+storing; */
    728         /* } */
    729         /* //storing coefficient for confined */
    730         /* else{ */
    731         /*      epl_storing=storing; */
    732         /* } */
    733         /* return epl_storing; */
    734         return storing;
    735 }/*}}}*/
    736 IssmDouble HydrologyDCEfficientAnalysis::EplTransmitivity(Element* element,Gauss* gauss, Input2* epl_thick_input, Input2* epl_head_input, Input2* base_input){/*{{{*/
    737         IssmDouble epl_transmitivity;
    738         IssmDouble water_sheet;
    739         IssmDouble epl_thickness,base_elev,prestep_head;
    740         IssmDouble epl_conductivity      = element->FindParam(HydrologydcEplConductivityEnum);
    741         epl_thick_input->GetInputValue(&epl_thickness,gauss);
    742         epl_head_input->GetInputValue(&prestep_head,gauss);
    743         base_input->GetInputValue(&base_elev,gauss);
    744 
    745         water_sheet=max(0.0,(prestep_head-base_elev));
    746         epl_transmitivity=epl_conductivity*epl_thickness;
    747         //epl_transmitivity=max(1.0e-6,(epl_conductivity*min(water_sheet,epl_thickness)));
    748         return epl_transmitivity;
    749 }/*}}}*/
    750785void HydrologyDCEfficientAnalysis::HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element){/*{{{*/
    751786        /*Constants*/
     
    796831}
    797832/*}}}*/
    798 void HydrologyDCEfficientAnalysis::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode){/*{{{*/
    799 
    800         int        hmax_flag;
    801         IssmDouble h_max;
    802         IssmDouble rho_ice,rho_water;
    803         IssmDouble thickness,bed;
    804         /*Get the flag to the limitation method*/
    805         element->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
    806 
    807         /*Switch between the different cases*/
    808         switch(hmax_flag){
    809         case 0:
    810                 h_max=1.0e+10;
    811                 break;
    812         case 1:
    813                 element->FindParam(&h_max,HydrologydcSedimentlimitEnum);
    814                 break;
    815         case 2:
    816                 /*Compute max*/
    817                 rho_water = element->FindParam(MaterialsRhoFreshwaterEnum);
    818                 rho_ice   = element->FindParam(MaterialsRhoIceEnum);
    819                 element-> GetInputValue(&thickness,innode,ThicknessEnum);
    820                 element-> GetInputValue(&bed,innode,BaseEnum);
    821                 h_max=((rho_ice*thickness)/rho_water)+bed;
    822                 break;
    823         case 3:
    824                 _error_("Using normal stress  not supported yet");
    825                 break;
    826         default:
    827                 _error_("no case higher than 3 for SedimentlimitFlag");
    828         }
    829         /*Assign output pointer*/
    830         *ph_max=h_max;
    831 }
    832 /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.