Changeset 24240


Ignore:
Timestamp:
10/17/19 06:03:43 (5 years ago)
Author:
bdef
Message:

Adding a substeping framework in hydro and part of smb

Location:
issm/trunk-jpl
Files:
96 edited

Legend:

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

    r24146 r24240  
    549549                                D[1*dim+1]=h/2.0*fabs(vy);
    550550                        }
    551                         else if(dim==3){ 
     551                        else if(dim==3){
    552552                                element->ElementSizes(&hx,&hy,&hz);
    553553                                vel=sqrt(vx*vx + vy*vy + vz*vz)+1.e-14;
     
    665665}/*}}}*/
    666666void           DamageEvolutionAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    667         /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
     667        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    668668         * For node i, Bi can be expressed in the actual coordinate system
    669          * by: 
     669         * by:
    670670         *       Bi=[ N ]
    671671         *          [ N ]
     
    693693}/*}}}*/
    694694void           DamageEvolutionAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    695         /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
     695        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    696696         * For node i, Bi' can be expressed in the actual coordinate system
    697          * by: 
     697         * by:
    698698         *       Bi_prime=[ dN/dx ]
    699699         *                [ dN/dy ]
  • issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp

    r24140 r24240  
    414414        element->VerticalSegmentIndicesBase(&pairindices,&numsegments);
    415415        IssmDouble* meltingrate_enthalpy = xNew<IssmDouble>(numsegments);
    416         IssmDouble* heating = xNew<IssmDouble>(numsegments);   
     416        IssmDouble* heating = xNew<IssmDouble>(numsegments);
    417417
    418418        numnodes=element->GetNumberOfNodes();
     
    440440                                for(i=0;i<3;i++) vec_heatflux[i]=0.;
    441441                                break;
    442                         case 1: case 2: case 3: 
    443                                 // case 1 : cold, wet base: keep at pressure melting point 
     442                        case 1: case 2: case 3:
     443                                // case 1 : cold, wet base: keep at pressure melting point
    444444                                // case 2: temperate, thin refreezing base: release spc
    445445                                // case 3: temperate, thin melting base: set spc
     
    478478                nodeup   = pairindices[is*2+1];
    479479                if(dt!=0.){
    480                         if(watercolumns[nodedown]+meltingrate_enthalpy[is]*dt<0.){      // prevent too much freeze on                   
     480                        if(watercolumns[nodedown]+meltingrate_enthalpy[is]*dt<0.){      // prevent too much freeze on
    481481                                lambda = -watercolumns[nodedown]/(dt*meltingrate_enthalpy[is]); _assert_(lambda>=0.); _assert_(lambda<1.);
    482482                                watercolumns[nodedown]=0.;
     
    486486                        else{
    487487                                basalmeltingrates[nodedown]=meltingrate_enthalpy[is];
    488                                 watercolumns[nodedown]+=dt*meltingrate_enthalpy[is]; 
     488                                watercolumns[nodedown]+=dt*meltingrate_enthalpy[is];
    489489                        }
    490490                        if(watercolumns[nodedown]>watercolumnupperlimit) watercolumns[nodedown]=watercolumnupperlimit;
     
    496496                        else
    497497                                watercolumns[nodedown]+=meltingrate_enthalpy[is];
    498                 }       
     498                }
    499499                basalmeltingrates[nodedown]*=rho_water/rho_ice; // convert meltingrate from water to ice equivalent
    500500                _assert_(watercolumns[nodedown]>=0.);
     
    503503        /*feed updated variables back into model*/
    504504        if(dt!=0.){
    505                 element->AddInput(enthalpy_enum,enthalpies,element->GetElementType()); 
     505                element->AddInput(enthalpy_enum,enthalpies,element->GetElementType());
    506506                element->AddInput(WatercolumnEnum,watercolumns,element->GetElementType());
    507507        }
     
    659659                        for(int i=0;i<3;i++) for(int j=0;j<3;j++) K[i][j] = D_scalar*K[i][j];
    660660
    661                         GetBAdvecprime(Bprime,element,xyz_list,gauss); 
     661                        GetBAdvecprime(Bprime,element,xyz_list,gauss);
    662662                        TripleMultiply(Bprime,3,numnodes,1,
    663663                                                &K[0][0],3,3,0,
     
    860860                        if(dt!=0.) scalar_sens=scalar_sens*dt;
    861861                        for(i=0;i<numnodes;i++) pe->values[i]+=scalar_sens*basis[i];
    862                 }               
     862                }
    863863
    864864                /* Build transient now */
     
    977977                switch (state) {
    978978                        case 0: case 1: case 2: case 3:
    979                                 // cold, dry base; cold, wet base; refreezing temperate base; thin temperate base: 
     979                                // cold, dry base; cold, wet base; refreezing temperate base; thin temperate base:
    980980                                // Apply basal surface forcing.
    981                                 // Interpolated values of enthalpy on gauss nodes may indicate cold base, 
     981                                // Interpolated values of enthalpy on gauss nodes may indicate cold base,
    982982                                // although one node might have become temperate. So keep heat flux switched on.
    983983                                geothermalflux_input->GetInputValue(&geothermalflux,gauss);
     
    990990                                scalar=gauss->weight*Jdet*heatflux;
    991991                                if(dt!=0.) scalar=dt*scalar;
    992                                 for(i=0;i<numnodes;i++) 
     992                                for(i=0;i<numnodes;i++)
    993993                                        pe->values[i]+=scalar*basis[i];
    994994                                break;
    995995                        case 4:
    996996                                // temperate, thick melting base: set grad H*n=0
    997                                 for(i=0;i<numnodes;i++) 
     997                                for(i=0;i<numnodes;i++)
    998998                                        pe->values[i]+=0.;
    999999                                break;
     
    11321132                /* Check if ice in element */
    11331133                if(!element->IsIceInElement()) continue;
    1134                 if(!element->IsOnBase()) continue; 
     1134                if(!element->IsOnBase()) continue;
    11351135
    11361136                numnodes=element->GetNumberOfNodes();
     
    12571257                else if(effectiveconductivity_averaging==1){
    12581258                        /* return harmonic mean (reciprocal avarage) of thermal conductivities, weighted by fraction of cold/temperate ice, cf Patankar 1980, pp44 */
    1259                         kappa=kappa_c*kappa_t/(lambda*kappa_t+(1.-lambda)*kappa_c); 
     1259                        kappa=kappa_c*kappa_t/(lambda*kappa_t+(1.-lambda)*kappa_c);
    12601260                }
    12611261                else if(effectiveconductivity_averaging==2){
    12621262                        /* return geometric mean (power law) of thermal conductivities, weighted by fraction of cold/temperate ice */
    1263                         kappa=pow(kappa_c,lambda)*pow(kappa_t,1.-lambda); 
     1263                        kappa=pow(kappa_c,lambda)*pow(kappa_t,1.-lambda);
    12641264                }
    12651265                else{
    12661266                        _error_("effectiveconductivity_averaging not supported yet");
    12671267                }
    1268         }       
     1268        }
    12691269
    12701270        /*Clean up and return*/
     
    12761276}/*}}}*/
    12771277void           EnthalpyAnalysis::GetBAdvec(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    1278         /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
     1278        /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
    12791279         * For node i, Bi' can be expressed in the actual coordinate system
    1280          * by: 
     1280         * by:
    12811281         *       Bi_advec =[ h ]
    12821282         *                 [ h ]
     
    13051305}/*}}}*/
    13061306void           EnthalpyAnalysis::GetBAdvecprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    1307         /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
     1307        /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
    13081308         * For node i, Bi' can be expressed in the actual coordinate system
    1309          * by: 
     1309         * by:
    13101310         *       Biprime_advec=[ dh/dx ]
    13111311         *                     [ dh/dy ]
     
    13561356        if(!element->IsIceInElement()) return;
    13571357
    1358         /* Only update constraints at the base. 
     1358        /* Only update constraints at the base.
    13591359         * Floating ice is not affected by basal BC decision chart. */
    13601360        if(!(element->IsOnBase()) || element->IsFloating()) return;
     
    13961396                                break;
    13971397                        case 1:
    1398                                 // cold, wet base: keep at pressure melting point 
     1398                                // cold, wet base: keep at pressure melting point
    13991399                                vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
    14001400                                break;
    14011401                        case 2:
    1402                                 // temperate, thin refreezing base: 
     1402                                // temperate, thin refreezing base:
    14031403                                vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
    14041404                                break;
     
    14271427        if(!element->IsIceInElement()) return;
    14281428
    1429         /* Only update constraints at the base. 
     1429        /* Only update constraints at the base.
    14301430         * Floating ice is not affected by basal BC decision chart.*/
    14311431        if(!(element->IsOnBase()) || element->IsFloating()) return;
     
    14691469                                break;
    14701470                        case 1:
    1471                                 // cold, wet base: keep at pressure melting point 
     1471                                // cold, wet base: keep at pressure melting point
    14721472                                vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
    14731473                                break;
     
    14971497}/*}}}*/
    14981498void           EnthalpyAnalysis::GetBConduct(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    1499         /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 
     1499        /*Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1.
    15001500         * For node i, Bi' can be expressed in the actual coordinate system
    1501          * by: 
     1501         * by:
    15021502         *       Bi_conduct=[ dh/dx ]
    15031503         *                  [ dh/dy ]
     
    16591659                                }
    16601660                        case LliboutryDuvalEnum:{
    1661                                 for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],n[i],element->FindParam(MaterialsBetaEnum),element->FindParam(ConstantsReferencetemperatureEnum),element->FindParam(MaterialsHeatcapacityEnum),element->FindParam(MaterialsLatentheatEnum)); 
    1662                                 element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType()); 
    1663                                 break; 
     1661                                for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],n[i],element->FindParam(MaterialsBetaEnum),element->FindParam(ConstantsReferencetemperatureEnum),element->FindParam(MaterialsHeatcapacityEnum),element->FindParam(MaterialsLatentheatEnum));
     1662                                element->AddInput(MaterialsRheologyBEnum,&B[0],element->GetElementType());
     1663                                break;
    16641664                                }
    16651665                        default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet");
  • issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp

    r24030 r24240  
    6161        iomodel->FetchDataToInput(elements,"md.geometry.base",BaseEnum);
    6262        iomodel->FetchDataToInput(elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
    63         iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadHydrostepEnum);
    64         iomodel->FetchDataToInput(elements,"md.initialization.sediment_head",SedimentHeadHydrostepEnum);
    65         iomodel->FetchDataToInput(elements,"md.initialization.epl_thickness",HydrologydcEplThicknessHydrostepEnum);
     63        iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadSubstepEnum);
     64        iomodel->FetchDataToInput(elements,"md.initialization.sediment_head",SedimentHeadSubstepEnum);
     65        iomodel->FetchDataToInput(elements,"md.initialization.epl_thickness",HydrologydcEplThicknessSubstepEnum);
    6666        iomodel->FetchDataToInput(elements,"md.hydrology.basal_moulin_input",HydrologydcBasalMoulinInputEnum);
    6767        if(iomodel->domaintype!=Domain2DhorizontalEnum){
     
    223223        /*Retrieve all inputs and parameters*/
    224224        basalelement->GetVerticesCoordinates(&xyz_list);
    225         //basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    226         basalelement ->FindParam(&dt,HydrologydtEnum);
    227 
    228         Input* epl_thick_input = basalelement->GetInput(HydrologydcEplThicknessHydrostepEnum); _assert_(epl_thick_input);
    229         Input* epl_head_input   = basalelement->GetInput(EplHeadHydrostepEnum);  _assert_(epl_head_input);
     225        basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
     226
     227        Input* epl_thick_input = basalelement->GetInput(HydrologydcEplThicknessSubstepEnum); _assert_(epl_thick_input);
     228        Input* epl_head_input   = basalelement->GetInput(EplHeadSubstepEnum);  _assert_(epl_head_input);
    230229        Input* base_input                       = basalelement->GetInput(BaseEnum); _assert_(base_input);
    231230
    232231        /* Start  looping on the number of gaussian points: */
    233         Gauss* gauss                                    = basalelement->NewGauss(2);
     232        Gauss* gauss = basalelement->NewGauss(2);
    234233        for(int ig=gauss->begin();ig<gauss->end();ig++){
    235234                gauss           ->GaussPoint(ig);
     
    320319        IssmDouble residual,connectivity;
    321320
    322         IssmDouble              *xyz_list                                                       = NULL;
    323         Input*                           old_wh_input                                   = NULL;
    324         Input*                          surface_runoff_input = NULL;
     321        IssmDouble              *xyz_list                                = NULL;
     322        Input*                   old_wh_input                    = NULL;
     323        Input*                  surface_runoff_input = NULL;
    325324
    326325        /*Fetch number of nodes and dof for this finite element*/
     
    334333        /*Retrieve all inputs and parameters*/
    335334        basalelement->GetVerticesCoordinates(&xyz_list);
    336         //basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    337         basalelement ->FindParam(&dt,HydrologydtEnum);
     335        basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    338336        basalelement ->FindParam(&smb_model,SmbEnum);
    339337
    340         Input*  epl_thick_input                  = basalelement->GetInput(HydrologydcEplThicknessHydrostepEnum); _assert_(epl_thick_input);
    341         Input*  sed_head_input                   = basalelement->GetInput(SedimentHeadHydrostepEnum); _assert_(sed_head_input);
    342         Input*  epl_head_input                   = basalelement->GetInput(EplHeadHydrostepEnum); _assert_(epl_head_input);
     338        Input*  epl_thick_input                  = basalelement->GetInput(HydrologydcEplThicknessSubstepEnum); _assert_(epl_thick_input);
     339        Input*  sed_head_input                   = basalelement->GetInput(SedimentHeadSubstepEnum); _assert_(sed_head_input);
     340        Input*  epl_head_input                   = basalelement->GetInput(EplHeadSubstepEnum); _assert_(epl_head_input);
    343341        Input*  basal_melt_input                 = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(basal_melt_input);
    344342        Input*  residual_input                   = basalelement->GetInput(SedimentHeadResidualEnum); _assert_(residual_input);
     
    353351
    354352        /* Start  looping on the number of gaussian points: */
    355         Gauss* gauss           = basalelement->NewGauss(2);
     353        Gauss* gauss = basalelement->NewGauss(2);
    356354        for(int ig=gauss->begin();ig<gauss->end();ig++){
    357355                gauss->GaussPoint(ig);
     
    383381
    384382        /*      Add residual if necessary*/
    385         gauss=basalelement->NewGauss();
     383        gauss = basalelement->NewGauss();
    386384        for(int iv=0;iv<numvertices;iv++){
    387385                gauss->GaussVertex(iv);
     
    401399
    402400void HydrologyDCEfficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    403         element->GetSolutionFromInputsOneDof(solution,EplHeadHydrostepEnum);
     401        element->GetSolutionFromInputsOneDof(solution,EplHeadSubstepEnum);
    404402}/*}}}*/
    405403
     
    443441        }
    444442        /*Add input to the element: */
    445         element->AddBasalInput(EplHeadHydrostepEnum,eplHeads,P1Enum);
     443        element->AddBasalInput(EplHeadSubstepEnum,eplHeads,P1Enum);
    446444        /*Free ressources:*/
    447445        xDelete<IssmDouble>(eplHeads);
     
    538536                Input*  active_element_input=element->GetInput(HydrologydcMaskEplactiveEltEnum); _assert_(active_element_input);
    539537                active_element_input->GetInputValue(&active_element);
    540                 //element->FindParam(&dt,TimesteppingTimeStepEnum);
    541                 element ->FindParam(&dt,HydrologydtEnum);
     538                element->FindParam(&dt,TimesteppingTimeStepEnum);
    542539
    543540                /*For now, assuming just one way to compute EPL thickness*/
     
    556553                }
    557554
    558                 element->GetInputListOnVertices(&eplhead[0],EplHeadHydrostepEnum);
     555                element->GetInputListOnVertices(&eplhead[0],EplHeadSubstepEnum);
    559556                element->GetInputListOnVertices(&epl_slopeX[0],EplHeadSlopeXEnum);
    560557                element->GetInputListOnVertices(&epl_slopeY[0],EplHeadSlopeYEnum);
     
    593590                        }
    594591                }
    595                 element->AddInput(HydrologydcEplThicknessHydrostepEnum,thickness,element->GetElementType());
     592                element->AddInput(HydrologydcEplThicknessSubstepEnum,thickness,element->GetElementType());
    596593                xDelete<IssmDouble>(thickness);
    597594                xDelete<IssmDouble>(eplhead);
     
    670667
    671668        basalelement-> GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveNodeEnum);
    672         basalelement-> GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessHydrostepEnum);
    673         basalelement-> GetInputListOnVertices(&sedhead[0],SedimentHeadHydrostepEnum);
    674         basalelement-> GetInputListOnVertices(&eplhead[0],EplHeadHydrostepEnum);
     669        basalelement-> GetInputListOnVertices(&epl_thickness[0],HydrologydcEplThicknessSubstepEnum);
     670        basalelement-> GetInputListOnVertices(&sedhead[0],SedimentHeadSubstepEnum);
     671        basalelement-> GetInputListOnVertices(&eplhead[0],EplHeadSubstepEnum);
    675672        basalelement-> GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
    676673        basalelement-> GetInputListOnVertices(&base[0],BaseEnum);
     
    715712                }
    716713        }
    717         basalelement->AddInput(HydrologydcEplThicknessHydrostepEnum,epl_thickness,basalelement->GetElementType());
     714        basalelement->AddInput(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType());
    718715
    719716        if(domaintype!=Domain2DhorizontalEnum){
  • issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp

    r24030 r24240  
    102102        iomodel->FetchDataToInput(elements,"md.basalforcings.groundedice_melting_rate",BasalforcingsGroundediceMeltingRateEnum);
    103103        iomodel->FetchDataToInput(elements,"md.hydrology.basal_moulin_input",HydrologydcBasalMoulinInputEnum);
    104         iomodel->FetchDataToInput(elements,"md.initialization.sediment_head",SedimentHeadHydrostepEnum);
     104        iomodel->FetchDataToInput(elements,"md.initialization.sediment_head",SedimentHeadSubstepEnum);
    105105        iomodel->FetchDataToInput(elements,"md.hydrology.sediment_transmitivity",HydrologydcSedimentTransmitivityEnum);
    106106        iomodel->FetchDataToInput(elements,"md.hydrology.mask_thawed_node",HydrologydcMaskThawedNodeEnum);
     
    111111        if(isefficientlayer){
    112112                iomodel->FetchDataToInput(elements,"md.hydrology.mask_eplactive_node",HydrologydcMaskEplactiveNodeEnum);
    113                 iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadHydrostepEnum);
     113                iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadSubstepEnum);
    114114        }
    115115
     
    233233        /*Retrieve all inputs and parameters*/
    234234        basalelement ->GetVerticesCoordinates(&xyz_list);
    235         //basalelement ->FindParam(&dt,TimesteppingTimeStepEnum);
    236         basalelement ->FindParam(&dt,HydrologydtEnum);
     235        basalelement ->FindParam(&dt,TimesteppingTimeStepEnum);
    237236        basalelement ->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
    238237        Input* SedTrans_input = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
    239         Input* sed_head_input = basalelement->GetInput(SedimentHeadHydrostepEnum);
     238        Input* sed_head_input = basalelement->GetInput(SedimentHeadSubstepEnum);
    240239        Input* base_input     = basalelement->GetInput(BaseEnum);
    241240        Input* old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);                  _assert_(old_wh_input);
     
    340339        bool       active_element,isefficientlayer;
    341340        int        smb_model;
     341        int        smbsubstepping;
    342342        IssmDouble dt,scalar,sediment_storing;
    343343        IssmDouble water_head,sediment_transmitivity;
     
    348348        Input*      active_element_input = NULL;
    349349        Input*      old_wh_input         = NULL;
    350         Input*      surface_runoff_input = NULL;
     350        Input*      dummy_input          = NULL;
     351        TransientInput*  surface_runoff_input          = NULL;
    351352
    352353        /*Fetch number of nodes and dof for this finite element*/
     
    359360        /*Retrieve all inputs and parameters*/
    360361        basalelement->GetVerticesCoordinates(&xyz_list);
    361         //basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    362         basalelement->FindParam(&dt,HydrologydtEnum);
     362        basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
    363363        basalelement->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
    364364        basalelement->FindParam(&smb_model,SmbEnum);
    365365
    366         Input* sed_head_input   = basalelement->GetInput(SedimentHeadHydrostepEnum);
    367         Input* epl_head_input   = basalelement->GetInput(EplHeadHydrostepEnum);
    368         Input* base_input                       = basalelement->GetInput(BaseEnum);
    369         Input* basal_melt_input = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(basal_melt_input);
    370         Input* SedTrans_input   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
     366        Input*  sed_head_input                   = basalelement->GetInput(SedimentHeadSubstepEnum);
     367        Input*  epl_head_input                   = basalelement->GetInput(EplHeadSubstepEnum);
     368        Input*  base_input                               = basalelement->GetInput(BaseEnum);
     369        Input*  basal_melt_input                 = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(basal_melt_input);
     370        Input*  SedTrans_input                   = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
     371
     372        IssmDouble time;
     373        basalelement->FindParam(&time,TimeEnum);
     374
    371375
    372376        if(dt!= 0.){
     
    374378        }
    375379        if(smb_model==SMBgradientscomponentsEnum){
    376                 surface_runoff_input = basalelement->GetInput(SmbRunoffEnum); _assert_(surface_runoff_input);
     380                basalelement->FindParam(&smbsubstepping,SmbStepsPerStepEnum);
     381                if(smbsubstepping>1) {
     382                        dummy_input = basalelement->GetInput(SmbRunoffTransientEnum); _assert_(dummy_input);
     383                }
     384                else {
     385                        dummy_input = basalelement->GetInput(SmbRunoffEnum); _assert_(dummy_input);
     386                }
     387                surface_runoff_input=xDynamicCast<TransientInput*>(dummy_input); _assert_(surface_runoff_input);
    377388        }
    378389
     
    384395        /* Start  looping on the number of gaussian points: */
    385396        Gauss* gauss=basalelement->NewGauss(2);
     397
     398        IssmDouble yts;
     399        basalelement->FindParam(&yts,ConstantsYtsEnum);
     400
    386401        for(int ig=gauss->begin();ig<gauss->end();ig++){
    387402                gauss->GaussPoint(ig);
     
    407422                        if(!active_element){
    408423                                basal_melt_input->GetInputValue(&water_load,gauss);
    409                                 if(surface_runoff_input) surface_runoff_input->GetInputValue(&runoff_value,gauss);
    410                                 else                     runoff_value = 0.;
     424                                if(surface_runoff_input)surface_runoff_input->GetInputValue(&runoff_value,gauss);
     425                                else runoff_value = 0.;
    411426                                scalar = Jdet*gauss->weight*(water_load+runoff_value);
    412427                                //scalar = Jdet*gauss->weight*(water_load)/sediment_transmitivity;
     
    480495}/*}}}*/
    481496void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    482         element->GetSolutionFromInputsOneDof(solution,SedimentHeadHydrostepEnum);
     497        element->GetSolutionFromInputsOneDof(solution,SedimentHeadSubstepEnum);
    483498}/*}}}*/
    484499void HydrologyDCInefficientAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
     
    514529        IssmDouble* residual = xNew<IssmDouble>(numnodes);
    515530
    516         /*Use the dof list to index into the solution vector reseting to base is done at the deactivate stage: */
    517531        for(int i=0;i<numnodes;i++){
    518532                values[i] =solution[doflist[i]];
    519533                if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
    520534                if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector");
     535
    521536        }
    522537
     
    553568                        }
    554569                        pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(values[i]-base[i]));
    555 
    556570                }
    557571                xDelete<IssmDouble>(thickness);
     
    561575
    562576        /*Add input to the element: */
    563         element->AddBasalInput(SedimentHeadHydrostepEnum,values,P1Enum);
    564         element->AddBasalInput(EffectivePressureHydrostepEnum,pressure,P1Enum);
     577        element->AddBasalInput(SedimentHeadSubstepEnum,values,P1Enum);
     578        element->AddBasalInput(EffectivePressureSubstepEnum,pressure,P1Enum);
    565579        element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
    566580
  • issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp

    r23585 r24240  
    6060        }
    6161
    62         iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadHydrostepEnum);
     62        iomodel->FetchDataToInput(elements,"md.initialization.epl_head",EplHeadSubstepEnum);
    6363        iomodel->FetchDataToInput(elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
    6464        if(iomodel->domaintype!=Domain2DhorizontalEnum){
     
    202202        basalelement->FindParam(&input_enum,InputToL2ProjectEnum);
    203203        switch(input_enum){
    204                 case EplHeadSlopeXEnum: input = basalelement->GetInput(EplHeadHydrostepEnum); index = 0; _assert_(input); break;
    205                 case EplHeadSlopeYEnum: input = basalelement->GetInput(EplHeadHydrostepEnum); index = 1; _assert_(input); break;
     204                case EplHeadSlopeXEnum: input = basalelement->GetInput(EplHeadSubstepEnum); index = 0; _assert_(input); break;
     205                case EplHeadSlopeYEnum: input = basalelement->GetInput(EplHeadSubstepEnum); index = 1; _assert_(input); break;
    206206                default: _error_("not implemented");
    207207        }
  • issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp

    r24040 r24240  
    107107        parameters->AddObject(iomodel->CopyConstantObject("md.levelset.kill_icebergs",LevelsetKillIcebergsEnum));
    108108        parameters->AddObject(iomodel->CopyConstantObject("md.levelset.calving_max",CalvingMaxEnum));
    109        
     109
    110110        int  calvinglaw;
    111111        iomodel->FindConstant(&calvinglaw,"md.calving.law");
     
    168168
    169169        if(save_results){
    170                 if(VerboseSolution()) _printf0_("   saving results\n");
     170                if(VerboseSolution()) _printf0_("   saving levelset results\n");
    171171                int outputs[1] = {MaskIceLevelsetEnum};
    172172                femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
     
    328328                /* Advection */
    329329                vx_input->GetInputValue(&v[0],gauss);
    330                 vy_input->GetInputValue(&v[1],gauss); 
     330                vy_input->GetInputValue(&v[1],gauss);
    331331                gr_input->GetInputValue(&groundedice,gauss);
    332332
     
    350350
    351351                                if(norm_dlsf>1.e-10)
    352                                  for(i=0;i<dim;i++){ 
     352                                 for(i=0;i<dim;i++){
    353353                                         c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
    354354                                 }
     
    379379
    380380                                if(norm_dlsf>1.e-10)
    381                                  for(i=0;i<dim;i++){ 
     381                                 for(i=0;i<dim;i++){
    382382                                         c[i]=0.;
    383383                                         m[i]=meltingrate*dlsf[i]/norm_dlsf;
     
    400400
    401401                                if(norm_dlsf>1.e-10)
    402                                  for(i=0;i<dim;i++){ 
     402                                 for(i=0;i<dim;i++){
    403403                                         c[i]=0.;
    404404                                         m[i]=meltingrate*dlsf[i]/norm_dlsf;
     
    423423
    424424                                if(norm_dlsf>1.e-10)
    425                                  for(i=0;i<dim;i++){ 
     425                                 for(i=0;i<dim;i++){
    426426                                         c[i]=0.;
    427427                                         m[i]=meltingrate*dlsf[i]/norm_dlsf;
     
    450450                                        meltingrate=0.;
    451451                                }
    452                                 else if(groundedice-calvinghaf>=haf_eps){ 
     452                                else if(groundedice-calvinghaf>=haf_eps){
    453453                                        // ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
    454454                                        calvingrate=min(calvingrate,vel);
     
    457457                                else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
    458458                                        //heaviside: 0 for floating, 1 for grounded
    459                                         heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI); 
     459                                        heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI);
    460460                                        calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
    461461                                        meltingrate=heaviside*meltingrate+0.;
     
    467467
    468468                                if(norm_dlsf>1.e-10)
    469                                  for(i=0;i<dim;i++){ 
    470                                          c[i]=calvingrate*dlsf[i]/norm_dlsf; 
     469                                 for(i=0;i<dim;i++){
     470                                         c[i]=calvingrate*dlsf[i]/norm_dlsf;
    471471                                         m[i]=meltingrate*dlsf[i]/norm_dlsf;
    472472                                 }
    473473                                else
    474474                                 for(i=0;i<dim;i++){
    475                                          c[i]=0.; 
     475                                         c[i]=0.;
    476476                                         m[i]=0.;
    477477                                 }
     
    506506                                /* Artificial Diffusion */
    507507                                basalelement->ElementSizes(&hx,&hy,&hz);
    508                                 h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) ); 
     508                                h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) );
    509509                                kappa=h*vel/2.;
    510510                                for(i=0;i<numnodes;i++){
     
    515515                                        }
    516516                                }
    517                                 break; 
     517                                break;
    518518                        case 2:
    519519                                  {
     
    522522                                h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) );
    523523                                IssmDouble D[9];
    524                                 for(row=0;row<dim;row++) 
    525                                         for(col=0;col<dim;col++) 
     524                                for(row=0;row<dim;row++)
     525                                        for(col=0;col<dim;col++)
    526526                                                D[row*dim+col] = D_scalar*h/(2.*vel)*w[row]*w[col];
    527527                                GetBprime(Bprime,basalelement,xyz_list,gauss);
     
    597597}/*}}}*/
    598598void           LevelsetAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    599         /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
     599        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    600600         * For node i, Bi can be expressed in the actual coordinate system
    601          * by: 
     601         * by:
    602602         *       Bi=[ N ]
    603603         *          [ N ]
     
    624624}/*}}}*/
    625625void           LevelsetAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    626         /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
     626        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    627627         * For node i, Bi' can be expressed in the actual coordinate system
    628          * by: 
     628         * by:
    629629         *       Bi_prime=[ dN/dx ]
    630630         *                [ dN/dy ]
     
    716716                        Element* element  = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
    717717
    718                         int      numnodes = element->GetNumberOfNodes();       
     718                        int      numnodes = element->GetNumberOfNodes();
    719719                        Gauss*   gauss    = element->NewGauss();
    720720                        Input*   H_input  = element->GetInput(ThicknessEnum); _assert_(H_input);
     
    736736                                else {
    737737                                        /* no ice, set no spc */
    738                                         node->DofInFSet(0); 
     738                                        node->DofInFSet(0);
    739739                                }
    740740                        }
     
    779779                                else {
    780780                                        /* no ice, set no spc */
    781                                         node->DofInFSet(0); 
     781                                        node->DofInFSet(0);
    782782                                }
    783783                        }
     
    795795                femmodel->elements->InputDuplicate(MaskIceLevelsetEnum,DistanceToCalvingfrontEnum);
    796796                femmodel->DistanceToFieldValue(MaskIceLevelsetEnum,0,DistanceToCalvingfrontEnum);
    797                
     797
    798798                /*Vector of size number of nodes*/
    799799                vec_constraint_nodes=new Vector<IssmDouble>(femmodel->nodes->NumberOfNodes());
     
    821821                                        thickness_input->GetInputValue(&thickness,gauss);
    822822                                        surface_input->GetInputValue(&surface,gauss);
    823                                        
     823
    824824                                        if((surface_crevasse-surface>0. || crevassedepth-thickness>0.) && bed<0.){
    825825                                                vec_constraint_nodes->SetValue(node->Sid(),1.0,INS_VAL);
  • issm/trunk-jpl/src/c/analyses/SmbAnalysis.cpp

    r23814 r24240  
    178178void SmbAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    179179
     180        printf("start param update\n");
    180181        int     numoutputs;
    181182        char**  requestedoutputs = NULL;
    182183        bool    isdelta18o,ismungsm,isd18opd,issetpddfac,interp,isfirnwarming;
    183         int     smb_model;
     184        int     smb_model, smbslices;
    184185        IssmDouble *temp = NULL;
    185186        int         N,M;
     
    189190        iomodel->FindConstant(&smb_model,"md.smb.model");
    190191        iomodel->FindConstant(&interp,"md.timestepping.interp_forcings");
     192
     193        iomodel->FetchData(&smbslices,"md.smb.steps_per_step");
     194        parameters->AddObject(new IntParam(SmbStepsPerStepEnum,smbslices));
    191195
    192196        switch(smb_model){
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r24189 r24240  
    512512                case PentaEnum:
    513513                case TetraEnum:
    514                                                         this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
    515                                                         this->InputExtrude(SmbPrecipitationEnum,-1);
    516                                                         break;
     514         this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
     515         this->InputExtrude(SmbPrecipitationEnum,-1);
     516         break;
    517517                default: _error_("Not implemented yet");
    518518        }
     
    644644                case PentaEnum:
    645645                case TetraEnum:
    646                                                         this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
    647                                                         this->InputExtrude(SmbPrecipitationEnum,-1);
    648                                                         break;
     646         this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
     647         this->InputExtrude(SmbPrecipitationEnum,-1);
     648         break;
    649649                default: _error_("Not implemented yet");
    650650        }
     
    673673        IssmDouble accugrad, runoffgrad; //gradients from reference altitude
    674674        IssmDouble rho_water, rho_ice;
    675         IssmDouble time;
     675        IssmDouble time,yts;
    676676
    677677        IssmDouble*             smb             = xNew<IssmDouble>(NUM_VERTICES);
     
    686686        /*Recover parameters*/
    687687        parameters->FindParam(&time,TimeEnum);
     688        parameters->FindParam(&yts,ConstantsYtsEnum);
    688689        parameters->FindParam(&accualti,SmbAccualtiEnum);
    689690        parameters->FindParam(&accugrad,SmbAccugradEnum);
     
    704705                smb[iv]=(accu[iv]-runoff[iv])*rho_ice/rho_water;
    705706        }
     707
    706708        switch(this->ObjectEnum()){
    707                 case TriaEnum:
    708                         this->inputs->AddInput(new TriaInput(SmbMassBalanceEnum,&smb[0],P1Enum));
    709                         this->inputs->AddInput(new TriaInput(SmbRunoffEnum,&runoff[0],P1Enum));
    710                         break;
    711                 case PentaEnum:
    712                         this->inputs->AddInput(new PentaInput(SmbMassBalanceEnum,&smb[0],P1Enum));
    713                         this->inputs->AddInput(new PentaInput(SmbRunoffEnum,&runoff[0],P1Enum));
    714                         this->InputExtrude(SmbMassBalanceEnum,-1);
    715                         this->InputExtrude(SmbRunoffEnum,-1);
    716                         break;
    717                 case TetraEnum:
    718                         this->inputs->AddInput(new TetraInput(SmbMassBalanceEnum,&smb[0],P1Enum));
    719                         this->inputs->AddInput(new TetraInput(SmbRunoffEnum,&runoff[0],P1Enum));
    720                         this->InputExtrude(SmbMassBalanceEnum,-1);
    721                         this->InputExtrude(SmbRunoffEnum,-1);
    722                         break;
    723                 default: _error_("Not implemented yet");
    724         }
    725         /* this->AddInput(SmbMassBalanceEnum,smb,P1Enum); */
    726         /* this->AddInput(SmbRunoffEnum,runoff,P1Enum); */
     709        case TriaEnum:
     710                this->inputs->AddInput(new TriaInput(SmbMassBalanceSubstepEnum,&smb[0],P1Enum));
     711                this->inputs->AddInput(new TriaInput(SmbRunoffSubstepEnum,&runoff[0],P1Enum));
     712                break;
     713        case PentaEnum:
     714                this->inputs->AddInput(new PentaInput(SmbMassBalanceSubstepEnum,&smb[0],P1Enum));
     715                this->inputs->AddInput(new PentaInput(SmbRunoffSubstepEnum,&runoff[0],P1Enum));
     716                this->InputExtrude(SmbMassBalanceSubstepEnum,-1);
     717                this->InputExtrude(SmbRunoffSubstepEnum,-1);
     718                break;
     719        case TetraEnum:
     720                this->inputs->AddInput(new TetraInput(SmbMassBalanceSubstepEnum,&smb[0],P1Enum));
     721                this->inputs->AddInput(new TetraInput(SmbRunoffSubstepEnum,&runoff[0],P1Enum));
     722                this->InputExtrude(SmbMassBalanceSubstepEnum,-1);
     723                this->InputExtrude(SmbRunoffSubstepEnum,-1);
     724                break;
     725        default: _error_("Not implemented yet");
     726        }
    727727        /*clean-up*/
    728728        xDelete<IssmDouble>(surf);
     
    11751175        Input* input=this->GetInput(enumtype);
    11761176        if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
    1177 
    11781177        /*Fetch number vertices for this element*/
    11791178        const int NUM_VERTICES = this->GetNumberOfVertices();
     
    25122511        IssmDouble rho_water    = this->FindParam(MaterialsRhoSeawaterEnum);
    25132512        IssmDouble rho_ice      = this->FindParam(MaterialsRhoIceEnum);
    2514         IssmDouble latentheat   = this->FindParam(MaterialsLatentheatEnum); 
     2513        IssmDouble latentheat   = this->FindParam(MaterialsLatentheatEnum);
    25152514        IssmDouble mixed_layer_capacity = this->FindParam(MaterialsMixedLayerCapacityEnum);
    25162515        IssmDouble thermal_exchange_vel = this->FindParam(MaterialsThermalExchangeVelocityEnum);
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r24208 r24240  
    313313
    314314                /*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
    315                 calvingrate[iv]=propcoeff*strainparallel*strainperpendicular;   
     315                calvingrate[iv]=propcoeff*strainparallel*strainperpendicular;
    316316                if(calvingrate[iv]<0){
    317317                        calvingrate[iv]=0;
     
    410410
    411411                /*Some checks in debugging mode*/
    412                 _assert_(s1>=0 && s1<=1.); 
    413                 _assert_(s2>=0 && s2<=1.); 
     412                _assert_(s1>=0 && s1<=1.);
     413                _assert_(s2>=0 && s2<=1.);
    414414
    415415                /*Get normal vector*/
     
    441441
    442442                        flux += rho_ice*Jdet*gauss->weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
    443                         area += Jdet*gauss->weight*thickness; 
     443                        area += Jdet*gauss->weight*thickness;
    444444
    445445                        flux_per_area=flux/area;
     
    447447
    448448                this->inputs->AddInput(new PentaInput(CalvingFluxLevelsetEnum,&flux_per_area,P0Enum));
    449                
     449
    450450                /*Clean up and return*/
    451451                delete gauss;
     
    532532
    533533                /*Some checks in debugging mode*/
    534                 _assert_(s1>=0 && s1<=1.); 
    535                 _assert_(s2>=0 && s2<=1.); 
     534                _assert_(s1>=0 && s1<=1.);
     535                _assert_(s2>=0 && s2<=1.);
    536536
    537537                /*Get normal vector*/
     
    569569                        vy_input->GetInputValue(&vy,gauss);
    570570                        vel=vx*vx+vy*vy;
    571                         meltingrate_input->GetInputValue(&meltingrate,gauss);   
     571                        meltingrate_input->GetInputValue(&meltingrate,gauss);
    572572                        meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
    573573                        meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
     
    575575
    576576                        flux += rho_ice*Jdet*gauss->weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
    577                         area += Jdet*gauss->weight*thickness; 
     577                        area += Jdet*gauss->weight*thickness;
    578578
    579579                        flux_per_area=flux/area;
     
    581581
    582582                this->inputs->AddInput(new PentaInput(CalvingMeltingFluxLevelsetEnum,&flux_per_area,P0Enum));
    583                
     583
    584584                /*Clean up and return*/
    585585                delete gauss;
     
    707707
    708708                /*Compute Stress*/
    709                 tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps 
     709                tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps
    710710                tau_yy[iv]=2*viscosity*epsilon[1];
    711711                tau_zz[iv]=2*viscosity*epsilon[2];
     
    796796        this->element_type=this->element_type_list[analysis_counter];
    797797
    798         /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
     798        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    799799         * datasets, using internal ids and offsets hidden in hooks: */
    800800        if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
     
    887887        int         connectivity[NUMVERTICES];
    888888        IssmPDouble values[NUMVERTICES];
    889         IssmPDouble gradients[NUMVERTICES]; 
     889        IssmPDouble gradients[NUMVERTICES];
    890890        IssmDouble  value,gradient;
    891891
     
    958958                        }
    959959                        break;
    960                 default: 
     960                default:
    961961                        _error_("Response type " << EnumToStringx(response_enum) << " not supported yet!");
    962962        }
     
    11061106/*}}}*/
    11071107void       Penta::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){/*{{{*/
    1108         /*Computeportion of the element that is grounded*/ 
     1108        /*Computeportion of the element that is grounded*/
    11091109
    11101110        int         i,j,k;
     
    11151115
    11161116        /*Initialize xyz_list with original xyz_list of triangle coordinates*/
    1117         for(j=0;j<3;j++){ 
     1117        for(j=0;j<3;j++){
    11181118                for(k=0;k<3;k++){
    11191119                        xyz_bis[j][k]=xyz_list[j*3+k];
     
    11211121        }
    11221122        for(i=0;i<numpoints;i++){
    1123                 for(j=0;j<3;j++){ 
     1123                for(j=0;j<3;j++){
    11241124                        for(k=0;k<3;k++){
    11251125                                /*Change appropriate line*/
     
    11741174/*}}}*/
    11751175void       Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
    1176         /*Computeportion of the element that is grounded*/ 
     1176        /*Computeportion of the element that is grounded*/
    11771177
    11781178        bool               floating=true;
     
    12281228/*}}}*/
    12291229IssmDouble Penta::GetGroundedPortion(IssmDouble* xyz_list){/*{{{*/
    1230         /*Computeportion of the element that is grounded*/ 
     1230        /*Computeportion of the element that is grounded*/
    12311231
    12321232        bool               mainlyfloating = true;
     
    13301330/*}}}*/
    13311331IssmDouble Penta::GetIcefrontArea(){/*{{{*/
    1332        
     1332
    13331333        IssmDouble  bed[NUMVERTICES]; //basinId[NUMVERTICES];
    13341334        IssmDouble      Haverage,frontarea;
     
    13591359                IssmDouble  s[2],x[2],y[2];
    13601360                this->GetLevelsetIntersectionBase(&indices, &numiceverts,&s[0],MaskIceLevelsetEnum,0.);
    1361                 _assert_(numiceverts); 
     1361                _assert_(numiceverts);
    13621362
    13631363                /*3 Write coordinates*/
     
    13961396                x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1];
    13971397                distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
    1398                
     1398
    13991399                int numthk=numiceverts+2;
    14001400                H=xNew<IssmDouble>(numthk);
     
    14211421                frontarea=distance*Haverage;
    14221422        }
    1423         else return 0; 
    1424        
     1423        else return 0;
     1424
    14251425        xDelete<int>(indices);
    14261426        xDelete<IssmDouble>(H);
    1427        
     1427
    14281428        _assert_(frontarea>0);
    14291429        return frontarea;
     
    14561456                indicesfront[0]=indicesfront[1];
    14571457                indicesfront[1]=index;
    1458         }       
     1458        }
    14591459
    14601460        IssmDouble* xyz_front = xNew<IssmDouble>(2*dim*nrfrontnodes);
     
    15111511void       Penta::GetLevelsetIntersectionBase(int** pindices, int* pnumiceverts, IssmDouble* fraction, int levelset_enum, IssmDouble level){/*{{{*/
    15121512
    1513         /* GetLevelsetIntersection computes: 
     1513        /* GetLevelsetIntersection computes:
    15141514         * 1. indices of element, sorted in [iceverts, noiceverts] in counterclockwise fashion,
    15151515         * 2. fraction of intersected triangle edges intersected by levelset, lying below level*/
     
    15531553                }
    15541554        }
    1555         //merge indices 
     1555        //merge indices
    15561556        for(i=0;i<numiceverts;i++){indices[i]=indices_ice[i];}
    15571557        for(i=0;i<numnoiceverts;i++){indices[numiceverts+i]=indices_noice[i];}
     
    15861586/*}}}*/
    15871587int        Penta::GetVertexIndex(Vertex* vertex){/*{{{*/
    1588 
    15891588        _assert_(vertices);
    15901589        for(int i=0;i<NUMVERTICES;i++){
     
    16041603/*}}}*/
    16051604int        Penta::GetNumberOfVertices(void){/*{{{*/
    1606         return NUMVERTICES; 
     1605        return NUMVERTICES;
    16071606}
    16081607/*}}}*/
     
    17681767
    17691768        /*Scaled not implemented yet...*/
    1770         _assert_(!scaled); 
     1769        _assert_(!scaled);
    17711770
    17721771        int               domaintype,index1,index2;
     
    18421841
    18431842        /*Some checks in debugging mode*/
    1844         _assert_(s1>=0 && s1<=1.); 
    1845         _assert_(s2>=0 && s2<=1.); 
     1843        _assert_(s1>=0 && s1<=1.);
     1844        _assert_(s2>=0 && s2<=1.);
    18461845
    18471846        /*Get normal vector*/
     
    18501849        normal[0] = -normal[0];
    18511850        normal[1] = -normal[1];
    1852        
     1851
    18531852        this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
    18541853        this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
     
    20022001                case PentaInputEnum:
    20032002                case ControlInputEnum:
    2004                         depth_averaged_input=new PentaInput(average_enum,&total[0],P1Enum); 
     2003                        depth_averaged_input=new PentaInput(average_enum,&total[0],P1Enum);
    20052004                        break;
    20062005                default:
     
    20692068        /*Recover vertices ids needed to initialize inputs*/
    20702069        _assert_(iomodel->elements);
    2071         for(i=0;i<NUMVERTICES;i++){ 
     2070        for(i=0;i<NUMVERTICES;i++){
    20722071                penta_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
    20732072        }
     
    22492248
    22502249        switch(type){
    2251                 case VertexLIdEnum: 
     2250                case VertexLIdEnum:
    22522251                        for (int i=0;i<NUMVERTICES;i++){
    22532252                                values[i]=vector[this->vertices[i]->Lid()];
     
    22572256                        return;
    22582257
    2259                 case VertexPIdEnum: 
     2258                case VertexPIdEnum:
    22602259                        for (int i=0;i<NUMVERTICES;i++){
    22612260                                values[i]=vector[this->vertices[i]->Pid()];
     
    22652264                        return;
    22662265
    2267                 case VertexSIdEnum: 
     2266                case VertexSIdEnum:
    22682267                        for (int i=0;i<NUMVERTICES;i++){
    22692268                                values[i]=vector[this->vertices[i]->Sid()];
     
    23202319        isicefront=false;
    23212320        if(IsIceInElement()){
    2322                 nrice=0;       
     2321                nrice=0;
    23232322                for(i=0;i<NUMVERTICES2D;i++)
    23242323                        if(ls[i]<0.) nrice++;
     
    26182617
    26192618        /*First, serarch the input: */
    2620         data=inputs->GetInput(natureofdataenum); 
     2619        data=inputs->GetInput(natureofdataenum);
    26212620
    26222621        /*figure out if we have the vertex id: */
     
    28512850
    28522851                /*New X axis          New Z axis*/
    2853                 xz_plane[0]=1.;       xz_plane[3]=-slopex; 
    2854                 xz_plane[1]=0.;       xz_plane[4]=-slopey; 
    2855                 xz_plane[2]=slopex;   xz_plane[5]=1.;         
     2852                xz_plane[0]=1.;       xz_plane[3]=-slopex;
     2853                xz_plane[1]=0.;       xz_plane[4]=-slopey;
     2854                xz_plane[2]=slopex;   xz_plane[5]=1.;
    28562855
    28572856                if(groundedice>=0){
    28582857                        if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
    2859                                 this->nodes[indices[i]]->DofInSSet(2); //vz 
     2858                                this->nodes[indices[i]]->DofInSSet(2); //vz
    28602859                        }
    28612860                        else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
    2862                                 this->nodes[indices[i]]->DofInSSet(4); //vz 
     2861                                this->nodes[indices[i]]->DofInSSet(4); //vz
    28632862                        }
    28642863                        else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
     
    28692868                        }
    28702869                        else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
    2871                                 this->nodes[indices[i]]->DofInFSet(4); //vz 
     2870                                this->nodes[indices[i]]->DofInFSet(4); //vz
    28722871                        }
    28732872                        else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
     
    29022901
    29032902        if(!this->IsOnBase()) return;
    2904    
     2903
    29052904        IssmDouble A, B, alpha, beta;
    29062905        IssmDouble bed,qsg,qsg_basin,TF,yts;
     
    29102909
    29112910        /* Coefficients */
    2912         A    = 3e-4;       
    2913         B    = 0.15;       
     2911        A    = 3e-4;
     2912        B    = 0.15;
    29142913        alpha = 0.39;
    29152914        beta = 1.18;
    2916        
     2915
    29172916        /*Get inputs*/
    29182917        Input* bed_input = this->GetInput(BedEnum);                     _assert_(bed_input);
    29192918        Input* qsg_input = this->GetInput(FrontalForcingsSubglacialDischargeEnum);               _assert_(qsg_input);
    29202919        Input* TF_input  = this->GetInput(FrontalForcingsThermalForcingEnum);          _assert_(TF_input);
    2921         GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum); 
    2922        
     2920        GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum);
     2921
    29232922        this->FindParam(&yts, ConstantsYtsEnum);
    29242923        this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
     
    29262925
    29272926        IssmDouble meltrates[NUMVERTICES2D];  //frontal melt-rate
    2928        
     2927
    29292928        /* Start looping on the number of vertices: */
    29302929        GaussPenta* gauss=new GaussPenta();
     
    29442943                        /* calculate melt rates */
    29452944                        meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
    2946                 }       
     2945                }
    29472946
    29482947                if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
     
    29522951        /*Add input*/
    29532952        this->inputs->AddInput(new PentaInput(CalvingMeltingrateEnum,&meltrates[0],P1Enum));
    2954        
     2953
    29552954        this->InputExtrude(CalvingMeltingrateEnum,-1);
    2956    
     2955
    29572956        /*Cleanup and return*/
    29582957        xDelete<IssmDouble>(basin_icefront_area);
     
    30853084        if(this->inputs->GetInput(CalvingratexEnum)) this->InputDepthAverageAtBase(CalvingratexEnum,CalvingratexAverageEnum);
    30863085        if(this->inputs->GetInput(CalvingrateyEnum)) this->InputDepthAverageAtBase(CalvingrateyEnum,CalvingrateyAverageEnum);
    3087        
     3086
    30883087        Tria* tria=(Tria*)SpawnTria(0,1,2);
    30893088        switch(this->material->ObjectEnum()){
     
    31493148
    31503149        normu=pow(pow(u,2)+pow(v,2)+pow(w,2),0.5);
    3151         if(normu*diameter/(3*2*kappa)<1){ 
     3150        if(normu*diameter/(3*2*kappa)<1){
    31523151                tau_parameter=pow(diameter,2)/(3*2*2*kappa);
    31533152        }
     
    31683167        hk=sqrt(pow(hx,2)+pow(hy,2));
    31693168
    3170         if(normu*hk/(C*2*kappa)<1){ 
     3169        if(normu*hk/(C*2*kappa)<1){
    31713170                tau_parameter_anisotropic[0]=pow(hk,2)/(C*2*2*kappa);
    31723171        }
     
    31753174        /* compute tau for the vertical direction */
    31763175        hk=hz;
    3177         if(normu*hk/(C*2*kappa)<1){ 
     3176        if(normu*hk/(C*2*kappa)<1){
    31783177                tau_parameter_anisotropic[1]=pow(hk,2)/(C*2*2*kappa);
    31793178        }
     
    33343333
    33353334                                if(prof<water_depth&prof<thickness){
    3336                                         /* Compute the local stress intensity factor*/ 
     3335                                        /* Compute the local stress intensity factor*/
    33373336                                        ki[ig]+=Jdet[ig]*gauss->weight*stress_xx*StressIntensityIntegralWeight(prof,min(water_depth,thickness),thickness);
    33383337                                }
     
    33743373        else if (approximation==SSAApproximationEnum){
    33753374
    3376                 /*This element should be collapsed into a tria element at its base. Create this tria element, 
     3375                /*This element should be collapsed into a tria element at its base. Create this tria element,
    33773376                 * and compute SurfaceArea*/
    33783377                tria=(Tria*)SpawnTria(0,1,2);
     
    34393438
    34403439        /*Scaled not implemented yet...*/
    3441         _assert_(!scaled); 
     3440        _assert_(!scaled);
    34423441
    34433442        int               domaintype,index1,index2;
     
    35133512
    35143513        /*Some checks in debugging mode*/
    3515         _assert_(s1>=0 && s1<=1.); 
    3516         _assert_(s2>=0 && s2<=1.); 
     3514        _assert_(s1>=0 && s1<=1.);
     3515        _assert_(s2>=0 && s2<=1.);
    35173516
    35183517        /*Get normal vector*/
     
    35463545
    35473546        return flux;
    3548                
     3547
    35493548        /*Clean up and return*/
    35503549        delete gauss;
     
    35573556
    35583557        /*Scaled not implemented yet...*/
    3559         _assert_(!scaled); 
     3558        _assert_(!scaled);
    35603559
    35613560        int               domaintype,index1,index2;
     
    36313630
    36323631        /*Some checks in debugging mode*/
    3633         _assert_(s1>=0 && s1<=1.); 
    3634         _assert_(s2>=0 && s2<=1.); 
     3632        _assert_(s1>=0 && s1<=1.);
     3633        _assert_(s2>=0 && s2<=1.);
    36353634
    36363635        /*Get normal vector*/
     
    36393638        normal[0] = -normal[0];
    36403639        normal[1] = -normal[1];
    3641        
     3640
    36423641        this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
    36433642        this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
     
    36703669                vy_input->GetInputValue(&vy,gauss);
    36713670                vel=vx*vx+vy*vy;
    3672                 meltingrate_input->GetInputValue(&meltingrate,gauss);   
     3671                meltingrate_input->GetInputValue(&meltingrate,gauss);
    36733672                meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
    36743673                meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
     
    36793678
    36803679        return flux;
    3681        
     3680
    36823681        /*Clean up and return*/
    36833682        delete gauss;
     
    36993698        /*Get material parameters :*/
    37003699        rho_ice=FindParam(MaterialsRhoIceEnum);
    3701         Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
     3700        Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input);
    37023701        Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    37033702        Input* scalefactor_input = NULL;
    37043703        if(scaled==true){
    3705                 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     3704                scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    37063705        }
    37073706        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    37443743        /*Get material parameters :*/
    37453744        rho_ice=FindParam(MaterialsRhoIceEnum);
    3746         Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
     3745        Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input);
    37473746        Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    37483747        Input* scalefactor_input = NULL;
    37493748        if(scaled==true){
    3750                 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     3749                scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    37513750        }
    37523751        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    37993798        if(scaled==true){
    38003799                Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    3801                 scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element 
     3800                scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
    38023801        }
    38033802        else{
     
    38273826        /*Checks if debuging*/
    38283827        _assert_(iomodel->elements);
    3829         _assert_(index==this->sid); 
     3828        _assert_(index==this->sid);
    38303829
    38313830        /*Recover element type*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r24186 r24240  
    245245        IssmDouble  B,sigma_max,sigma_max_floating,sigma_max_grounded,n;
    246246        IssmDouble  epse_2,groundedice,bed,sealevel;            // added sealevel
    247        
     247
    248248
    249249        /* Get node coordinates and dof list: */
     
    260260        Input* n_input  = inputs->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
    261261        Input* sl_input  = inputs->GetInput(SealevelEnum); _assert_(sl_input);
    262        
     262
    263263
    264264
     
    274274                vy_input->GetInputValue(&vy,gauss);
    275275                gr_input->GetInputValue(&groundedice,gauss);
    276                 bs_input->GetInputValue(&bed,gauss);   
     276                bs_input->GetInputValue(&bed,gauss);
    277277                smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
    278278                smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
     
    316316                }
    317317                calvingrate[iv] =sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]);
    318        
     318
    319319        }
    320320
     
    339339        IssmDouble  s_xx,s_xy,s_yy,s1,s2,stmp;
    340340        int crevasse_opening_stress;
    341        
     341
    342342        /* Get node coordinates and dof list: */
    343343        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    397397                        basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice)) * (B * strainparallel * pow(straineffective,((1/n)-1)) / (rho_ice*constant_g) - Ho);
    398398                }
    399                 else if(crevasse_opening_stress==1){     /*Benn2017,Todd2018: maximum principal stress */       
     399                else if(crevasse_opening_stress==1){     /*Benn2017,Todd2018: maximum principal stress */
    400400                        surface_crevasse[iv] = s1 / (rho_ice*constant_g);
    401401                        basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice))* (s1/ (rho_ice*constant_g)-Ho);
    402                 }       
    403        
     402                }
     403
    404404                /* some constraints */
    405405                if (surface_crevasse[iv]<0.) {
     
    408408                }
    409409                if (basal_crevasse[iv]<0.) basal_crevasse[iv]=0.;
    410                 if (bed>0.) basal_crevasse[iv] = 0.; 
    411                
     410                if (bed>0.) basal_crevasse[iv] = 0.;
     411
    412412                //if (surface_crevasse[iv]<water_height){
    413413                //      water_height = surface_crevasse[iv];
    414414                //}
    415                
     415
    416416                /* add water in surface crevasse */
    417417                surface_crevasse[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height; /* surface crevasse + water */
    418418                crevasse_depth[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height + basal_crevasse[iv]; /* surface crevasse + basal crevasse + water */
    419        
     419
    420420        }
    421421
     
    571571
    572572                /*Some checks in debugging mode*/
    573                 _assert_(s1>=0 && s1<=1.); 
    574                 _assert_(s2>=0 && s2<=1.); 
     573                _assert_(s1>=0 && s1<=1.);
     574                _assert_(s2>=0 && s2<=1.);
    575575
    576576                /*Get normal vector*/
     
    608608
    609609                        flux += rho_ice*Jdet*gauss->weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
    610                         area += Jdet*gauss->weight*thickness; 
     610                        area += Jdet*gauss->weight*thickness;
    611611
    612612                        flux_per_area=flux/area;
     
    614614
    615615                this->inputs->AddInput(new TriaInput(CalvingFluxLevelsetEnum,&flux_per_area,P0Enum));
    616                
     616
    617617                /*Clean up and return*/
    618618                delete gauss;
     
    708708
    709709                /*Some checks in debugging mode*/
    710                 _assert_(s1>=0 && s1<=1.); 
    711                 _assert_(s2>=0 && s2<=1.); 
     710                _assert_(s1>=0 && s1<=1.);
     711                _assert_(s2>=0 && s2<=1.);
    712712
    713713                /*Get normal vector*/
     
    751751                        vy_input->GetInputValue(&vy,gauss);
    752752                        vel=vx*vx+vy*vy;
    753                         meltingrate_input->GetInputValue(&meltingrate,gauss);   
     753                        meltingrate_input->GetInputValue(&meltingrate,gauss);
    754754                        meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
    755755                        meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
     
    757757
    758758                        flux += rho_ice*Jdet*gauss->weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
    759                         area += Jdet*gauss->weight*thickness; 
     759                        area += Jdet*gauss->weight*thickness;
    760760
    761761                        flux_per_area=flux/area;
     
    763763
    764764                this->inputs->AddInput(new TriaInput(CalvingMeltingFluxLevelsetEnum,&flux_per_area,P0Enum));
    765                
     765
    766766                /*Clean up and return*/
    767767                delete gauss;
     
    882882                strain_yy[iv]=epsilon[1];
    883883                strain_xy[iv]=epsilon[2];
    884                 vorticity_xy[iv]=epsilon[3]; 
     884                vorticity_xy[iv]=epsilon[3];
    885885        }
    886886
     
    909909                IssmDouble  sigma_xx,sigma_xy,sigma_yy;
    910910                IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
    911                 IssmDouble  base_normal[2]; 
     911                IssmDouble  base_normal[2];
    912912                int domaintype,dim=2;
    913913
     
    10161016        if (this->element_type_list) this->element_type=this->element_type_list[analysis_counter];
    10171017
    1018         /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
     1018        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    10191019         * datasets, using internal ids and offsets hidden in hooks: */
    10201020        if(this->hnodes){
     
    10221022                else this->hnodes[analysis_counter] = NULL;
    10231023        }
    1024         else this->hnodes = NULL; 
     1024        else this->hnodes = NULL;
    10251025        this->hvertices->configure(verticesin);
    10261026        this->hmaterial->configure(materialsin);
     
    10981098        int         connectivity[NUMVERTICES];
    10991099        IssmPDouble values[NUMVERTICES];
    1100         IssmPDouble gradients[NUMVERTICES]; 
     1100        IssmPDouble gradients[NUMVERTICES];
    11011101        IssmDouble  value,gradient;
    11021102
     
    12411241                        *presponse=vel;}
    12421242                        break;
    1243                 default: 
     1243                default:
    12441244                        _error_("Response type " << EnumToStringx(response_enum) << " not supported yet!");
    12451245        }
     
    13611361                }
    13621362                /*If was floating*/
    1363                 else{   
     1363                else{
    13641364                        /*Tricky part:
    13651365                         * 1. if base is now touching, we put 1 for sigma_nn and leave water pressure at 0 so that the rest of the module will reground this vertex
     
    14521452        IssmDouble llr_list[NUMVERTICES][3];
    14531453        IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
    1454         IssmDouble arc12,arc23,arc31,semi_peri,excess; 
     1454        IssmDouble arc12,arc23,arc31,semi_peri,excess;
    14551455
    14561456        /*retrieve coordinates: lat,long,radius */
     
    14651465        arc31=2.*asin(sqrt(pow(sin((x1-x3)/2),2.0)+cos(x3)*cos(x1)*pow(sin((y1-y3)/2),2)));
    14661466
    1467         /*semi parameter */ 
    1468         semi_peri=(arc12+arc23+arc31)/2; 
     1467        /*semi parameter */
     1468        semi_peri=(arc12+arc23+arc31)/2;
    14691469
    14701470        /*spherical excess */
    1471         excess=4.*atan(sqrt(tan(semi_peri/2)*tan((semi_peri-arc12)/2)*tan((semi_peri-arc23)/2)*tan((semi_peri-arc31)/2))); 
     1471        excess=4.*atan(sqrt(tan(semi_peri/2)*tan((semi_peri-arc12)/2)*tan((semi_peri-arc23)/2)*tan((semi_peri-arc31)/2)));
    14721472
    14731473        /*area = excess*radius^2 */
    1474         return excess*pow((z1+z2+z3)/3,2); 
     1474        return excess*pow((z1+z2+z3)/3,2);
    14751475}
    14761476/*}}}*/
    14771477void       Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){/*{{{*/
    1478         /*Computeportion of the element that is grounded*/ 
     1478        /*Computeportion of the element that is grounded*/
    14791479
    14801480        int         i,j,k;
     
    14851485
    14861486        /*Initialize xyz_list with original xyz_list of triangle coordinates*/
    1487         for(j=0;j<3;j++){ 
     1487        for(j=0;j<3;j++){
    14881488                for(k=0;k<3;k++){
    14891489                        xyz_bis[j][k]=xyz_list[j*3+k];
     
    14911491        }
    14921492        for(i=0;i<numpoints;i++){
    1493                 for(j=0;j<3;j++){ 
     1493                for(j=0;j<3;j++){
    14941494                        for(k=0;k<3;k++){
    14951495                                /*Change appropriate line*/
     
    15181518/*}}}*/
    15191519void       Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
    1520         /*Computeportion of the element that is grounded*/ 
     1520        /*Computeportion of the element that is grounded*/
    15211521
    15221522        bool               floating=true;
     
    15721572/*}}}*/
    15731573IssmDouble Tria::GetGroundedPortion(IssmDouble* xyz_list){/*{{{*/
    1574         /*Computeportion of the element that is grounded*/ 
     1574        /*Computeportion of the element that is grounded*/
    15751575
    15761576        bool              mainlyfloating = true;
     
    16971697/*}}}*/
    16981698IssmDouble Tria::GetIcefrontArea(){/*{{{*/
    1699        
     1699
    17001700        IssmDouble  bed[NUMVERTICES]; //basinId[NUMVERTICES];
    17011701        IssmDouble      Haverage,frontarea;
     
    17251725                IssmDouble  s[2],x[2],y[2];
    17261726                this->GetLevelsetIntersection(&indices, &numiceverts,&s[0],MaskIceLevelsetEnum,0.);
    1727                 _assert_(numiceverts); 
     1727                _assert_(numiceverts);
    17281728
    17291729                /*3 Write coordinates*/
     
    17621762                x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1];
    17631763                distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
    1764                
     1764
    17651765                int numthk=numiceverts+2;
    17661766                H=xNew<IssmDouble>(numthk);
     
    17871787                frontarea=distance*Haverage;
    17881788        }
    1789         else return 0; 
    1790        
     1789        else return 0;
     1790
    17911791        xDelete<int>(indices);
    17921792        xDelete<IssmDouble>(H);
    1793        
     1793
    17941794        _assert_(frontarea>0);
    17951795        return frontarea;
     
    18201820                indicesfront[0]=indicesfront[1];
    18211821                indicesfront[1]=index;
    1822         }       
     1822        }
    18231823
    18241824        IssmDouble* xyz_front = xNew<IssmDouble>(3*2);
     
    18861886                indicesfront[0]=indicesfront[1];
    18871887                indicesfront[1]=index;
    1888         }       
     1888        }
    18891889
    18901890        IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
     
    19011901void       Tria::GetLevelsetIntersection(int** pindices, int* pnumiceverts, IssmDouble* fraction, int levelset_enum, IssmDouble level){/*{{{*/
    19021902
    1903         /* GetLevelsetIntersection computes: 
     1903        /* GetLevelsetIntersection computes:
    19041904         * 1. indices of element, sorted in [iceverts, noiceverts] in counterclockwise fashion,
    19051905         * 2. fraction of intersected triangle edges intersected by levelset, lying below level*/
     
    19431943                }
    19441944        }
    1945         //merge indices 
     1945        //merge indices
    19461946        for(i=0;i<numiceverts;i++){indices[i]=indices_ice[i];}
    19471947        for(i=0;i<numnoiceverts;i++){indices[numiceverts+i]=indices_noice[i];}
     
    19771977void       Tria::GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* gl){/*{{{*/
    19781978
    1979         /*Computeportion of the element that has a positive levelset*/ 
     1979        /*Computeportion of the element that has a positive levelset*/
    19801980
    19811981        bool               negative=true;
     
    20292029/*}}}*/
    20302030int        Tria::GetVertexIndex(Vertex* vertex){/*{{{*/
    2031 
    20322031        _assert_(vertices);
    20332032        for(int i=0;i<NUMVERTICES;i++){
     
    22582257
    22592258        /*Scaled not implemented yet...*/
    2260         _assert_(!scaled); 
     2259        _assert_(!scaled);
    22612260
    22622261        /*Get domain type*/
     
    23142313
    23152314        /*Scaled not implemented yet...*/
    2316         _assert_(!scaled); 
     2315        _assert_(!scaled);
    23172316
    23182317        int               domaintype,index1,index2;
     
    23962395
    23972396        /*Some checks in debugging mode*/
    2398         _assert_(s1>=0 && s1<=1.); 
    2399         _assert_(s2>=0 && s2<=1.); 
     2397        _assert_(s1>=0 && s1<=1.);
     2398        _assert_(s2>=0 && s2<=1.);
    24002399
    24012400        /*Get normal vector*/
     
    24442443
    24452444        /*Scaled not implemented yet...*/
    2446         _assert_(!scaled); 
     2445        _assert_(!scaled);
    24472446
    24482447        int               domaintype,index1,index2;
     
    25252524
    25262525        /*Some checks in debugging mode*/
    2527         _assert_(s1>=0 && s1<=1.); 
    2528         _assert_(s2>=0 && s2<=1.); 
     2526        _assert_(s1>=0 && s1<=1.);
     2527        _assert_(s2>=0 && s2<=1.);
    25292528
    25302529        /*Get normal vector*/
     
    25852584
    25862585        if(false && IsIcefront()){
    2587                 //Assumption: linear ice thickness profile on element. 
     2586                //Assumption: linear ice thickness profile on element.
    25882587                //Hence ice thickness at intersection of levelset function with triangle edge is linear interpolation of ice thickness at vertices.
    25892588                this->GetLevelsetIntersection(&indices, &numiceverts, s, MaskIceLevelsetEnum, 0.);
     
    25962595                        for(i=0;i<NUMVERTICES;i++) SFaux[i]= scalefactors[indices[i]]; //sort thicknesses in ice/noice
    25972596                        switch(numiceverts){
    2598                                 case 1: // average over triangle 
     2597                                case 1: // average over triangle
    25992598                                        SF[0]=SFaux[0];
    26002599                                        SF[1]=SFaux[0]+s[0]*(SFaux[1]-SFaux[0]);
     
    26202619                for(i=0;i<NUMVERTICES;i++) Haux[i]= surfaces[indices[i]]-bases[indices[i]]; //sort thicknesses in ice/noice
    26212620                switch(numiceverts){
    2622                         case 1: // average over triangle 
     2621                        case 1: // average over triangle
    26232622                                H[0]=Haux[0];
    26242623                                H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]);
     
    29132912
    29142913        switch(type){
    2915                 case VertexLIdEnum: 
     2914                case VertexLIdEnum:
    29162915                        values = xNew<IssmDouble>(NUMVERTICES);
    29172916                        for(int i=0;i<NUMVERTICES;i++){
     
    29242923                        break;
    29252924
    2926                 case VertexPIdEnum: 
     2925                case VertexPIdEnum:
    29272926                        values = xNew<IssmDouble>(NUMVERTICES);
    29282927                        for(int i=0;i<NUMVERTICES;i++){
     
    29352934                        break;
    29362935
    2937                 case VertexSIdEnum: 
     2936                case VertexSIdEnum:
    29382937                        values = xNew<IssmDouble>(NUMVERTICES);
    29392938                        for(int i=0;i<NUMVERTICES;i++){
     
    29732972                        break;
    29742973
    2975                 case ElementEnum: 
     2974                case ElementEnum:
    29762975                        value=vector[this->Sid()];
    29772976                        if(xIsNan<IssmDouble>(value)) _error_("NaN found in vector");
     
    30233022        isicefront=false;
    30243023        if(IsIceInElement()){
    3025                 nrice=0;       
     3024                nrice=0;
    30263025                for(i=0;i<NUMVERTICES;i++)
    30273026                        if(ls[i]<0.) nrice++;
     
    32203219        vy_input->GetInputValue(&vy2,gauss_2);
    32213220
    3222         mass_flux= rho_ice*length*( 
     3221        mass_flux= rho_ice*length*(
    32233222                                (1./3.*(h1-h2)*(vx1-vx2)+0.5*h2*(vx1-vx2)+0.5*(h1-h2)*vx2+h2*vx2)*nx+
    32243223                                (1./3.*(h1-h2)*(vy1-vy2)+0.5*h2*(vy1-vy2)+0.5*(h1-h2)*vy2+h2*vy2)*ny
     
    34303429
    34313430        /*First, serarch the input: */
    3432         data=inputs->GetInput(natureofdataenum); 
     3431        data=inputs->GetInput(natureofdataenum);
    34333432
    34343433        /*figure out if we have the vertex id: */
     
    34673466        bed_normal[0]= + vector[1]/norm;
    34683467        bed_normal[1]= - vector[0]/norm;
    3469         _assert_(bed_normal[1]<0); 
     3468        _assert_(bed_normal[1]<0);
    34703469}
    34713470/*}}}*/
     
    35003499        top_normal[0]= + vector[1]/norm;
    35013500        top_normal[1]= - vector[0]/norm;
    3502         _assert_(top_normal[1]>0); 
     3501        _assert_(top_normal[1]>0);
    35033502}
    35043503/*}}}*/
     
    36153614
    36163615                        /*New X axis                  New Z axis*/
    3617                         xz_plane[0]=cos(theta);       xz_plane[3]=0.; 
    3618                         xz_plane[1]=sin(theta);       xz_plane[4]=0.; 
    3619                         xz_plane[2]=0.;               xz_plane[5]=1.;         
     3616                        xz_plane[0]=cos(theta);       xz_plane[3]=0.;
     3617                        xz_plane[1]=sin(theta);       xz_plane[4]=0.;
     3618                        xz_plane[2]=0.;               xz_plane[5]=1.;
    36203619
    36213620                        if(groundedice>=0){
     
    36603659
    36613660        /* Coefficients */
    3662         A    = 3e-4;       
    3663         B    = 0.15;     
     3661        A    = 3e-4;
     3662        B    = 0.15;
    36643663        alpha = 0.39;
    36653664        beta = 1.18;
    3666        
     3665
    36673666        /*Get inputs*/
    36683667        Input* bed_input = this->GetInput(BedEnum);                     _assert_(bed_input);
    36693668        Input* qsg_input = this->GetInput(FrontalForcingsSubglacialDischargeEnum);               _assert_(qsg_input);
    36703669        Input* TF_input  = this->GetInput(FrontalForcingsThermalForcingEnum);          _assert_(TF_input);
    3671         GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum); 
    3672        
     3670        GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum);
     3671
    36733672        this->FindParam(&yts, ConstantsYtsEnum);
    36743673        this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
     
    36763675
    36773676        IssmDouble meltrates[NUMVERTICES];  //frontal melt-rate
    3678        
     3677
    36793678        /* Start looping on the number of vertices: */
    36803679        GaussTria* gauss=new GaussTria();
     
    36943693                        /* calculate melt rates */
    36953694                        meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
    3696                 }       
     3695                }
    36973696
    36983697                if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
     
    37023701        /*Add input*/
    37033702        this->inputs->AddInput(new TriaInput(CalvingMeltingrateEnum,&meltrates[0],P1Enum));
    3704    
     3703
    37053704        /*Cleanup and return*/
    37063705        xDelete<IssmDouble>(basin_icefront_area);
     
    40494048
    40504049        /*Scaled not implemented yet...*/
    4051         _assert_(!scaled); 
     4050        _assert_(!scaled);
    40524051
    40534052        int               domaintype,index1,index2;
     
    41314130
    41324131        /*Some checks in debugging mode*/
    4133         _assert_(s1>=0 && s1<=1.); 
    4134         _assert_(s2>=0 && s2<=1.); 
     4132        _assert_(s1>=0 && s1<=1.);
     4133        _assert_(s2>=0 && s2<=1.);
    41354134
    41364135        /*Get normal vector*/
     
    41784177
    41794178        /*Scaled not implemented yet...*/
    4180         _assert_(!scaled); 
     4179        _assert_(!scaled);
    41814180
    41824181        int               domaintype,index1,index2;
     
    42604259
    42614260        /*Some checks in debugging mode*/
    4262         _assert_(s1>=0 && s1<=1.); 
    4263         _assert_(s2>=0 && s2<=1.); 
     4261        _assert_(s1>=0 && s1<=1.);
     4262        _assert_(s2>=0 && s2<=1.);
    42644263
    42654264        /*Get normal vector*/
     
    43024301                vy_input->GetInputValue(&vy,gauss);
    43034302                vel=vx*vx+vy*vy;
    4304                 meltingrate_input->GetInputValue(&meltingrate,gauss);   
     4303                meltingrate_input->GetInputValue(&meltingrate,gauss);
    43054304                meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
    43064305                meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
     
    43284327        /*Get material parameters :*/
    43294328        rho_ice=FindParam(MaterialsRhoIceEnum);
    4330         Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
     4329        Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input);
    43314330        Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    43324331        Input* scalefactor_input = NULL;
    43334332        if(scaled==true){
    4334                 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     4333                scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    43354334        }
    43364335        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    43734372        /*Get material parameters :*/
    43744373        rho_ice=FindParam(MaterialsRhoIceEnum);
    4375         Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
     4374        Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input);
    43764375        Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    43774376        Input* scalefactor_input = NULL;
    43784377        if(scaled==true){
    4379                 scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     4378                scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    43804379        }
    43814380        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    44274426        if(scaled==true){
    44284427                Input* scalefactor_input = inputs->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
    4429                 scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element 
     4428                scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
    44304429        }
    44314430        else{
     
    44464445        /*Checks if debuging*/
    44474446        _assert_(iomodel->elements);
    4448         _assert_(index==this->sid); 
     4447        _assert_(index==this->sid);
    44494448
    44504449        /*Recover element type*/
     
    46934692        int        *indices = NULL;
    46944693        this->GetLevelsetIntersection(&indices, &numiceverts,&s[0],fieldenum,fieldvalue);
    4695         _assert_(numiceverts); 
     4694        _assert_(numiceverts);
    46964695
    46974696        /*3 Write coordinates*/
     
    47984797
    47994798        /*pull thickness averages: */
    4800         thickness_input=inputs->GetInput(ThicknessEnum); 
     4799        thickness_input=inputs->GetInput(ThicknessEnum);
    48014800        if (!thickness_input)_error_("thickness input needed to compute gia deflection!");
    4802         thickness_input->GetInputUpToCurrentTimeAverages(&hes,&times,&numtimes,currenttime);
     4801        thickness_input->GetInputAveragesUpToCurrentTime(&hes,&times,&numtimes,currenttime);
    48034802
    48044803        /*recover mantle viscosity: */
     
    48734872        IssmDouble area;
    48744873        IssmDouble earth_radius = 6371012.0;    // Earth's radius [m]
    4875         IssmDouble I;           //ice/water loading 
     4874        IssmDouble I;           //ice/water loading
    48764875        IssmDouble rho_ice, rho_earth;
    48774876
     
    48794878        IssmDouble* U_elastic_precomputed = NULL;
    48804879        IssmDouble* H_elastic_precomputed = NULL;
    4881         int         M, hemi; 
     4880        int         M, hemi;
    48824881
    48834882        /*computation of Green functions:*/
     
    48924891
    48934892        /*Compute ice thickness change: */
    4894         Input*  deltathickness_input=inputs->GetInput(EsaDeltathicknessEnum); 
     4893        Input*  deltathickness_input=inputs->GetInput(EsaDeltathicknessEnum);
    48954894        if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
    48964895        deltathickness_input->GetInputAverage(&I);
    48974896
    4898         /*early return if we are not on the (ice) loading point: */ 
    4899         if(I==0) return; 
     4897        /*early return if we are not on the (ice) loading point: */
     4898        if(I==0) return;
    49004899
    49014900        /*recover material parameters: */
     
    49074906
    49084907        /*which hemisphere? for north-south, east-west components*/
    4909         this->parameters->FindParam(&hemi,EsaHemisphereEnum); 
     4908        this->parameters->FindParam(&hemi,EsaHemisphereEnum);
    49104909
    49114910        /*compute area of element:*/
     
    49134912
    49144913        /*figure out gravity center of our element (Cartesian): */
    4915         IssmDouble x_element, y_element; 
     4914        IssmDouble x_element, y_element;
    49164915        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
    49174916        x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
     
    49384937        IssmDouble* Y_values=xNewZeroInit<IssmDouble>(gsize);
    49394938        IssmDouble dx, dy, dist, alpha, ang, ang2;
    4940         IssmDouble N_azim, E_azim, X_azim, Y_azim; 
     4939        IssmDouble N_azim, E_azim, X_azim, Y_azim;
    49414940
    49424941        for(int i=0;i<gsize;i++){
    49434942
    4944                 indices[i]=i; 
    4945 
    4946                 IssmDouble N_azim=0; 
     4943                indices[i]=i;
     4944
     4945                IssmDouble N_azim=0;
    49474946                IssmDouble E_azim=0;
    49484947
    49494948                /*Compute alpha angle between centroid and current vertex: */
    4950                 dx = x_element - xx[i];         dy = y_element - yy[i]; 
    4951                 dist = sqrt(pow(dx,2)+pow(dy,2));                                               // distance between vertex and elemental centroid [m] 
    4952                 alpha = dist*360.0/(2*PI*earth_radius) * PI/180.0;      // [in radians] 360 degree = 2*pi*earth_radius 
     4949                dx = x_element - xx[i];         dy = y_element - yy[i];
     4950                dist = sqrt(pow(dx,2)+pow(dy,2));                                               // distance between vertex and elemental centroid [m]
     4951                alpha = dist*360.0/(2*PI*earth_radius) * PI/180.0;      // [in radians] 360 degree = 2*pi*earth_radius
    49534952
    49544953                /*Compute azimuths, both north and east components: */
    4955                 ang = PI/2 - atan2(dy,dx);              // this is bearing angle! 
    4956                 Y_azim = cos(ang); 
    4957                 X_azim = sin(ang); 
     4954                ang = PI/2 - atan2(dy,dx);              // this is bearing angle!
     4955                Y_azim = cos(ang);
     4956                X_azim = sin(ang);
    49584957
    49594958                /*Elastic component  (from Eq 17 in Adhikari et al, GMD 2015): */
     
    49684967                X_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*X_elastic[i];
    49694968
    4970                 /*North-south, East-west components */ 
     4969                /*North-south, East-west components */
    49714970                if (hemi == -1) {
    4972                         ang2 = PI/2 - atan2(yy[i],xx[i]); 
    4973                 } 
     4971                        ang2 = PI/2 - atan2(yy[i],xx[i]);
     4972                }
    49744973                else if (hemi == 1) {
    4975                         ang2 = PI/2 - atan2(-yy[i],-xx[i]); 
     4974                        ang2 = PI/2 - atan2(-yy[i],-xx[i]);
    49764975                }
    49774976                if (hemi != 0){
     
    49924991
    49934992        /*free ressources:*/
    4994         xDelete<int>(indices); 
     4993        xDelete<int>(indices);
    49954994        xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
    49964995        xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
     
    50095008        IssmDouble xyz_list[NUMVERTICES][3];
    50105009        IssmDouble area;
    5011         IssmDouble I;           //ice/water loading 
     5010        IssmDouble I;           //ice/water loading
    50125011        IssmDouble late,longe,re;
    50135012        IssmDouble lati,longi,ri;
     
    50305029
    50315030        /*Compute ice thickness change: */
    5032         Input*  deltathickness_input=inputs->GetInput(EsaDeltathicknessEnum); 
     5031        Input*  deltathickness_input=inputs->GetInput(EsaDeltathicknessEnum);
    50335032        if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
    50345033        deltathickness_input->GetInputAverage(&I);
    50355034
    5036         /*early return if we are not on the (ice) loading point: */ 
    5037         if(I==0) return; 
     5035        /*early return if we are not on the (ice) loading point: */
     5036        if(I==0) return;
    50385037
    50395038        /*recover material parameters: */
     
    50775076        longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    50785077
    5079         late=90-late; 
     5078        late=90-late;
    50805079        if(longe>180)longe=(longe-180)-180;
    50815080
     
    50855084
    50865085        /*figure out gravity center of our element (Cartesian): */
    5087         IssmDouble x_element, y_element, z_element; 
     5086        IssmDouble x_element, y_element, z_element;
    50885087        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
    50895088        x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
     
    51085107        IssmDouble alpha;
    51095108        IssmDouble delPhi,delLambda;
    5110         IssmDouble dx, dy, dz, x, y, z; 
     5109        IssmDouble dx, dy, dz, x, y, z;
    51115110        IssmDouble N_azim, E_azim;
    51125111
    51135112        for(int i=0;i<gsize;i++){
    51145113
    5115                 indices[i]=i; 
     5114                indices[i]=i;
    51165115
    51175116                /*Compute alpha angle between centroid and current vertex: */
     
    51225121
    51235122                /*Compute azimuths, both north and east components: */
    5124                 x = xx[i]; y = yy[i]; z = zz[i]; 
     5123                x = xx[i]; y = yy[i]; z = zz[i];
    51255124                if(latitude[i]==90){
    5126                         x=1e-12; y=1e-12; 
     5125                        x=1e-12; y=1e-12;
    51275126                }
    51285127                if(latitude[i]==-90){
    5129                         x=1e-12; y=1e-12; 
    5130                 }
    5131                 dx = x_element-x; dy = y_element-y; dz = z_element-z; 
     5128                        x=1e-12; y=1e-12;
     5129                }
     5130                dx = x_element-x; dy = y_element-y; dz = z_element-z;
    51325131                N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
    51335132                E_azim = (-y*dx+x*dy) /pow((pow(x,2)+pow(y,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
     
    51495148
    51505149        /*free ressources:*/
    5151         xDelete<int>(indices); 
     5150        xDelete<int>(indices);
    51525151        xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
    51535152        xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
     
    51875186        /*early return if we are not on an ice cap OR ocean:*/
    51885187        if(!(this->inputs->Max(MaskIceLevelsetEnum)<0) && !IsWaterInElement()){
    5189                 dI_list[0] = 0.0; // this is important!!! 
    5190                 dI_list[1] = 0.0; // this is important!!! 
    5191                 dI_list[2] = 0.0; // this is important!!! 
    5192                 return; 
     5188                dI_list[0] = 0.0; // this is important!!!
     5189                dI_list[1] = 0.0; // this is important!!!
     5190                dI_list[2] = 0.0; // this is important!!!
     5191                return;
    51935192        }
    51945193
    51955194        /*Compute area of element:*/
    5196         IssmDouble area; 
     5195        IssmDouble area;
    51975196        area=GetAreaSpherical();
    51985197
     
    52315230        longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    52325231
    5233         late=90-late; 
     5232        late=90-late;
    52345233        if(longe>180)longe=(longe-180)-180;
    52355234
     
    52405239
    52415240        if(IsWaterInElement()){
    5242                 IssmDouble rho_water, S; 
     5241                IssmDouble rho_water, S;
    52435242
    52445243                /*recover material parameters: */
     
    52485247                S=0; for(int i=0;i<NUMVERTICES;i++) S+=Sg_old[this->vertices[i]->Sid()]/NUMVERTICES;
    52495248
    5250                 /* Perturbation terms for moment of inertia (moi_list): 
    5251                  * computed analytically (see Wu & Peltier, eqs 10 & 32) 
     5249                /* Perturbation terms for moment of inertia (moi_list):
     5250                 * computed analytically (see Wu & Peltier, eqs 10 & 32)
    52525251                 * also consistent with my GMD formulation!
    5253                  * ALL in geographic coordinates 
     5252                 * ALL in geographic coordinates
    52545253                 * */
    5255                 dI_list[0] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/eartharea; 
    5256                 dI_list[1] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/eartharea; 
    5257                 dI_list[2] = +4*PI*(rho_water*S*area)*pow(re,4)*(1-pow(sin(late),2))/eartharea; 
     5254                dI_list[0] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/eartharea;
     5255                dI_list[1] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/eartharea;
     5256                dI_list[2] = +4*PI*(rho_water*S*area)*pow(re,4)*(1-pow(sin(late),2))/eartharea;
    52585257        }
    52595258        else if(this->inputs->Max(MaskIceLevelsetEnum)<0){
    5260                 IssmDouble rho_ice, I; 
     5259                IssmDouble rho_ice, I;
    52615260
    52625261                /*recover material parameters: */
     
    52645263
    52655264                /*Compute ice thickness change: */
    5266                 Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum); 
     5265                Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum);
    52675266                if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    52685267                deltathickness_input->GetInputAverage(&I);
    52695268
    5270                 dI_list[0] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/eartharea; 
    5271                 dI_list[1] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/eartharea; 
    5272                 dI_list[2] = +4*PI*(rho_ice*I*area)*pow(re,4)*(1-pow(sin(late),2))/eartharea; 
    5273         }
    5274 
    5275         return; 
     5269                dI_list[0] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/eartharea;
     5270                dI_list[1] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/eartharea;
     5271                dI_list[2] = +4*PI*(rho_ice*I*area)*pow(re,4)*(1-pow(sin(late),2))/eartharea;
     5272        }
     5273
     5274        return;
    52765275}/*}}}*/
    52775276void    Tria::SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/
     
    53405339        /*recover elastic green function:*/
    53415340        if(computeelastic){
    5342                 DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); 
     5341                DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum));
    53435342                _assert_(parameter);
    53445343                parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M);
     
    53805379        longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    53815380
    5382         late=90-late; 
     5381        late=90-late;
    53835382        if(longe>180)longe=(longe-180)-180;
    53845383
     
    53995398
    54005399        /*Compute ice thickness change: */
    5401         Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum); 
     5400        Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum);
    54025401        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    54035402
    54045403        /*If we are fully grounded, take the average over the element: */
    54055404        if(!notfullygrounded)deltathickness_input->GetInputAverage(&I);
    5406         else{ 
     5405        else{
    54075406                IssmDouble total_weight=0;
    54085407                bool mainlyfloating = true;
     
    54305429        /*Compute eustatic compoent:*/
    54315430        _assert_(oceanarea>0.);
    5432         if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2 
    5433         eustatic += rho_ice*area*I/(oceanarea*rho_water); 
     5431        if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2
     5432        eustatic += rho_ice*area*I/(oceanarea*rho_water);
    54345433
    54355434        if(computeelastic | computerigid){
     
    55645563        longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    55655564
    5566         late=90-late; 
     5565        late=90-late;
    55675566        if(longe>180)longe=(longe-180)-180;
    55685567
     
    55895588        for(int i=0;i<gsize;i++){
    55905589
    5591                 indices[i]=i; 
     5590                indices[i]=i;
    55925591
    55935592                /*Compute alpha angle between centroid and current vertex : */
     
    55985597
    55995598                /*Rigid earth gravitational perturbation: */
    5600                 if(computerigid){ 
    5601                         G_rigid[i]=1.0/2.0/sin(alpha/2.0); 
     5599                if(computerigid){
     5600                        G_rigid[i]=1.0/2.0/sin(alpha/2.0);
    56025601                        values[i]+=3*rho_water/rho_earth*area/eartharea*S*G_rigid[i];
    56035602                }
     
    56625661
    56635662        /*early return if we are not on the ocean or on an ice cap:*/
    5664         if(!(this->inputs->Max(MaskIceLevelsetEnum)<0) && !IsWaterInElement()) return; 
     5663        if(!(this->inputs->Max(MaskIceLevelsetEnum)<0) && !IsWaterInElement()) return;
    56655664
    56665665        /*early return if we are fully floating: */
     
    57155714        longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
    57165715
    5717         late=90-late; 
     5716        late=90-late;
    57185717        if(longe>180)longe=(longe-180)-180;
    57195718
     
    57235722
    57245723        /*figure out gravity center of our element (Cartesian): */
    5725         IssmDouble x_element, y_element, z_element; 
     5724        IssmDouble x_element, y_element, z_element;
    57265725        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
    57275726        x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
     
    57415740
    57425741        /*Compute ice thickness change: */
    5743         Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum); 
     5742        Input*  deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum);
    57445743        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    57455744        deltathickness_input->GetInputAverage(&I);
     
    57555754        U_values=xNewZeroInit<IssmDouble>(gsize);
    57565755        if(horiz){
    5757                 N_values=xNewZeroInit<IssmDouble>(gsize); 
     5756                N_values=xNewZeroInit<IssmDouble>(gsize);
    57585757                E_values=xNewZeroInit<IssmDouble>(gsize);
    57595758        }
    57605759        IssmDouble alpha;
    57615760        IssmDouble delPhi,delLambda;
    5762         IssmDouble dx, dy, dz, x, y, z; 
     5761        IssmDouble dx, dy, dz, x, y, z;
    57635762        IssmDouble N_azim, E_azim;
    57645763
    57655764        for(int i=0;i<gsize;i++){
    57665765
    5767                 indices[i]=i; 
     5766                indices[i]=i;
    57685767
    57695768                /*Compute alpha angle between centroid and current vertex: */
     
    57745773
    57755774                /*Compute azimuths, both north and east components: */
    5776                 x = xx[i]; y = yy[i]; z = zz[i]; 
     5775                x = xx[i]; y = yy[i]; z = zz[i];
    57775776                if(latitude[i]==90){
    5778                         x=1e-12; y=1e-12; 
     5777                        x=1e-12; y=1e-12;
    57795778                }
    57805779                if(latitude[i]==-90){
    5781                         x=1e-12; y=1e-12; 
    5782                 }
    5783                 dx = x_element-x; dy = y_element-y; dz = z_element-z; 
     5780                        x=1e-12; y=1e-12;
     5781                }
     5782                dx = x_element-x; dy = y_element-y; dz = z_element-z;
    57845783                if(horiz){
    57855784                        N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
     
    58185817
    58195818        /*free ressources:*/
    5820         xDelete<int>(indices); 
    5821         xDelete<IssmDouble>(U_values); 
    5822         xDelete<IssmDouble>(U_elastic); 
     5819        xDelete<int>(indices);
     5820        xDelete<IssmDouble>(U_values);
     5821        xDelete<IssmDouble>(U_elastic);
    58235822        if(horiz){
    58245823                xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
  • issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp

    r24131 r24240  
    3333/*Reference Element numerics*/
    3434void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/
    35         /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 
     35        /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian
    3636         * point specified by gauss_basis:
    3737         *   dp/dx=plist[0]*dh1/dx+plist[1]*dh2/dx+plist[2]*dh3/dx
     
    8989/*}}}*/
    9090void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    91         /*The Jacobian is constant over the element, discard the gaussian points. 
     91        /*The Jacobian is constant over the element, discard the gaussian points.
    9292         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
    9393
     
    106106/*}}}*/
    107107void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    108         /*The Jacobian determinant is constant over the element, discard the gaussian points. 
     108        /*The Jacobian determinant is constant over the element, discard the gaussian points.
    109109         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
    110110        IssmDouble J[2][2];
     
    120120/*}}}*/
    121121void TriaRef::GetJacobianDeterminant3D(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    122         /*The Jacobian determinant is constant over the element, discard the gaussian points. 
     122        /*The Jacobian determinant is constant over the element, discard the gaussian points.
    123123         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
    124124        IssmDouble J[2][2];
     
    202202void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/
    203203
    204         /*This routine returns the values of the nodal functions derivatives  (with respect to the 
     204        /*This routine returns the values of the nodal functions derivatives  (with respect to the
    205205         * actual coordinate system): */
    206206        IssmDouble    Jinv[2][2];
     
    211211        /*Get nodal functions derivatives in reference triangle*/
    212212        IssmDouble dbasis_ref[2*NUMNODESMAX];
    213         GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement); 
     213        GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement);
    214214
    215215        /*Get Jacobian invert: */
    216216        GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);
    217217
    218         /*Build dbasis: 
     218        /*Build dbasis:
    219219         * [dhi/dx]= Jinv*[dhi/dr]
    220220         * [dhi/dy]       [dhi/ds]
     
    228228/*}}}*/
    229229void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
    230         /*The Jacobian determinant is constant over the element, discard the gaussian points. 
     230        /*The Jacobian determinant is constant over the element, discard the gaussian points.
    231231         * J is assumed to have been allocated*/
    232232
     
    313313/*}}}*/
    314314void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){/*{{{*/
    315         /*This routine returns the values of the nodal functions derivatives  (with respect to the 
     315        /*This routine returns the values of the nodal functions derivatives  (with respect to the
    316316         * natural coordinate system) at the gaussian point. */
    317317
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r24205 r24240  
    15341534void FemModel::IcefrontAreax(){/*{{{*/
    15351535
     1536        int numvertices      = this->GetElementsWidth();
    15361537        int numbasins;
     1538        IssmDouble* BasinId   = xNew<IssmDouble>(numvertices);
    15371539        this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
    15381540        IssmDouble* basin_icefront_area           = xNewZeroInit<IssmDouble>(numbasins);
     
    15441546                for(int i=0;i<this->elements->Size();i++){
    15451547                        Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
    1546                         if(!element->IsOnBase()) continue;
    1547                         int  numvertices = element->GetNumberOfVertices();
    1548                         IssmDouble* BasinId   = xNew<IssmDouble>(numvertices);
    15491548                        element->GetInputListOnVertices(BasinId,FrontalForcingsBasinIdEnum);
    1550                         for(int j=0;j<3;j++){
     1549                        for(int j=0;j<numvertices;j++){
    15511550                                if(BasinId[j]==basin){
    15521551                                        local_icefront_area+=element->GetIcefrontArea();
     
    15541553                                }
    15551554                        }
    1556                         xDelete<IssmDouble>(BasinId);
    15571555                }
    15581556                ISSM_MPI_Reduce(&local_icefront_area,&total_icefront_area,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
     
    15631561
    15641562        this->parameters->AddObject(new DoubleVecParam(FrontalForcingsBasinIcefrontAreaEnum,basin_icefront_area,numbasins));
     1563
    15651564        xDelete<IssmDouble>(basin_icefront_area);
    1566 
     1565        xDelete<IssmDouble>(BasinId);
    15671566}/*}}}*/
    15681567void FemModel::IcefrontMassFluxx(IssmDouble* pM, bool scaled){/*{{{*/
     
    22162215/*}}}*/
    22172216void FemModel::RequestedOutputsx(Results **presults,char** requested_outputs, int numoutputs, bool save_results){/*{{{*/
    2218        
     2217
    22192218        /*Intermediaries*/
    22202219        bool        isvec,results_on_nodes;
     
    22352234        if(numonnodes) parameters->FindParam(&resultsonnodes,&numonnodes,SettingsResultsOnNodesEnum);
    22362235
     2236
    22372237        /*Go through all requested output*/
    22382238        for(int i=0;i<numoutputs;i++){
    2239 
    22402239                output_string = requested_outputs[i];
    22412240                output_enum   = StringToEnumx(output_string,false);
    22422241                isvec         = false;
     2242
    22432243
    22442244                /*If string is not an enum, it is defined in output definitions*/
     
    50865086}
    50875087/*}}}*/
    5088 void FemModel::InitMeanOutputx(int* stackedinput_enum,int numoutputs){ /*{{{*/
    5089 
    5090   for(int i=0;i<numoutputs;i++){
    5091                 if(stackedinput_enum[i]<0){
     5088void FemModel::InitTransientOutputx(int* transientinput_enum,int numoutputs){ /*{{{*/
     5089
     5090        for(int i=0;i<numoutputs;i++){
     5091                if(transientinput_enum[i]<0){
    50925092                        _error_("Can't deal with non enum fields for result Stack");
    50935093                }
    50945094                else{
    50955095                        for(int j=0;j<elements->Size();j++){
     5096                                TransientInput* transient_input = new TransientInput(transientinput_enum[i]);
    50965097                                /*Intermediaries*/
    5097                                 Element*    element     = xDynamicCast<Element*>(elements->GetObjectByOffset(j));
    5098                                 int         numvertices = element->GetNumberOfVertices();
    5099                                 IssmDouble* zeros       = xNewZeroInit<IssmDouble>(numvertices);
    5100                                 switch(element->ObjectEnum()){
    5101                                         case TriaEnum:
    5102                                                 element->inputs->AddInput(new TriaInput(stackedinput_enum[i],&zeros[0],P1Enum));
    5103                                                 break;
    5104                                         case PentaEnum:
    5105                                                 element->inputs->AddInput(new PentaInput(stackedinput_enum[i],&zeros[0],P1Enum));
    5106                                                 break;
    5107                                         case TetraEnum:
    5108                                                 element->inputs->AddInput(new TetraInput(stackedinput_enum[i],&zeros[0],P1Enum));
    5109                                                 break;
    5110                                         default: _error_("Not implemented yet");
    5111                                 }
    5112                                 xDelete<IssmDouble>(zeros);
    5113                         }
    5114                 }
    5115         }
    5116 }
    5117 /*}}}*/
    5118 void FemModel::SumOutputx(int* input_enum,int* stackedinput_enum,int numoutputs){ /*{{{*/
    5119 
    5120         //First get sub-timestep
    5121         IssmDouble hydrodt;
    5122         this->parameters->FindParam(&hydrodt,HydrologydtEnum);
     5098                                Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j));
     5099                                element->inputs->AddInput(transient_input);
     5100                        }
     5101                }
     5102        }
     5103}
     5104/*}}}*/
     5105void FemModel::StackTransientOutputx(int* input_enum,int* transientinput_enum,IssmDouble subtime,int numoutputs){ /*{{{*/
    51235106
    51245107  for(int i=0;i<numoutputs;i++){
     
    51305113                                /*Intermediaries*/
    51315114                                Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j));
     5115                                Input* input=element->inputs->GetInput(transientinput_enum[i]); _assert_(input); //this is the enum stack
     5116                                TransientInput* stacking_input=xDynamicCast<TransientInput*>(input);
     5117
    51325118                                int  numvertices = element->GetNumberOfVertices();
    5133                                 IssmDouble* values_to_add=xNew<IssmDouble>(numvertices);
    5134                                 IssmDouble* existing_values=xNew<IssmDouble>(numvertices);
    5135                                 element->GetInputListOnVertices(&values_to_add[0],input_enum[i]); //those are the values to add
    5136                                 element->GetInputListOnVertices(&existing_values[0],stackedinput_enum[i]); //those are the values to add
    5137                                 for(int k=0;k<numvertices;k++){
    5138                                         existing_values[k]+=values_to_add[k]*hydrodt;
     5119                                IssmDouble* N=xNew<IssmDouble>(numvertices);
     5120                                element->GetInputListOnVertices(&N[0],input_enum[i]);   //this is the enum to stack
     5121                                switch(element->ObjectEnum()){
     5122                                case TriaEnum:
     5123                                        stacking_input->AddTimeInput(new TriaInput(transientinput_enum[i],&N[0],P1Enum),subtime);
     5124                                        break;
     5125                                case PentaEnum:
     5126                                        stacking_input->AddTimeInput(new PentaInput(transientinput_enum[i],&N[0],P1Enum),subtime);
     5127                                        break;
     5128                                case TetraEnum:
     5129                                        stacking_input->AddTimeInput(new TetraInput(transientinput_enum[i],&N[0],P1Enum),subtime);
     5130                                        break;
     5131                                default: _error_("Not implemented yet");
    51395132                                }
    5140                                 element->AddInput(stackedinput_enum[i],&existing_values[0],P1Enum);
    5141                                 xDelete<IssmDouble>(existing_values);
    5142                                 xDelete<IssmDouble>(values_to_add);
    5143                         }
    5144                 }
    5145         }
    5146 }
    5147 /*}}}*/
    5148 void FemModel::AverageSumOutputx(int* stackedinput_enum,int* averagedinput_enum,int numoutputs){ /*{{{*/
    5149 
    5150         //First get timestep
    5151         IssmDouble maindt;
    5152         this->parameters->FindParam(&maindt,TimesteppingTimeStepEnum);
    5153   for(int i=0;i<numoutputs;i++){
    5154                 if(stackedinput_enum[i]<0){
     5133                                stacking_input->Configure(parameters);
     5134                                xDelete<IssmDouble>(N);
     5135                        }
     5136                }
     5137        }
     5138}
     5139/*}}}*/
     5140void FemModel::AverageTransientOutputx(int* transientinput_enum,int* averagedinput_enum,IssmDouble init_time,IssmDouble end_time,int numoutputs){ /*{{{*/
     5141
     5142
     5143        IssmDouble yts;
     5144        this->parameters->FindParam(&yts,ConstantsYtsEnum);
     5145        for(int i=0;i<numoutputs;i++){
     5146                if(transientinput_enum[i]<0){
    51555147                        _error_("Can't deal with non enum fields for result Stack");
    51565148                }
    51575149                else{
    51585150                        for(int j=0;j<elements->Size();j++){
    5159                                 /*Intermediaries*/
    5160                                 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(j));
    5161                                 int  numvertices = element->GetNumberOfVertices();
    5162                                 IssmDouble* time_averaged=xNew<IssmDouble>(numvertices);
    5163                                 IssmDouble* existing_values=xNew<IssmDouble>(numvertices);
    5164                                 element->GetInputListOnVertices(&existing_values[0],stackedinput_enum[i]); //those are the values to add
    5165 
    5166                                 for(int k=0;k<numvertices;k++){
    5167                                         time_averaged[k]=existing_values[k]/maindt;
     5151                                Element*    element       = xDynamicCast<Element*>(elements->GetObjectByOffset(j));
     5152                                int         numnodes      = element->GetNumberOfNodes();
     5153                                IssmDouble* time_averaged = xNew<IssmDouble>(numnodes);
     5154                                Gauss*      gauss         = element->NewGauss();
     5155
     5156                                Input*      input         = element->GetInput(transientinput_enum[i]); _assert_(input);
     5157                                TransientInput* transient_input=xDynamicCast<TransientInput*>(input);
     5158
     5159                                for(int iv=0;iv<numnodes;iv++){
     5160                                        gauss->GaussNode(element->FiniteElement(),iv);
     5161                                        transient_input->GetInputAverageOverTimeSlice(&time_averaged[iv],gauss,init_time,end_time);
    51685162                                }
    5169 
    5170                                 element->AddInput(averagedinput_enum[i],&time_averaged[0],P1Enum);
    5171                                 xDelete<IssmDouble>(time_averaged);
    5172                                 xDelete<IssmDouble>(existing_values);
     5163                                element->AddInput(averagedinput_enum[i],&time_averaged[0],element->GetElementType());
     5164                                delete gauss;
    51735165                        }
    51745166                }
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r24153 r24240  
    170170                void UpdateConstraintsExtrudeFromTopx();
    171171                void UpdateConstraintsL2ProjectionEPLx(IssmDouble* pL2count);
    172                 void InitMeanOutputx(int* stackedinput_enum,int numoutputs);
    173                 void SumOutputx(int* input_enum,int* stackedinput_enum,int numoutputs);
    174                 void AverageSumOutputx(int* stackedinput_enum,int* averagedinput_enum,int numoutputs);
     172                void InitTransientOutputx(int* transientinput_enum,int numoutputs);
     173                void StackTransientOutputx(int* input_enum,int* transientinput_enum,IssmDouble hydrotime,int numoutputs);
     174                void AverageTransientOutputx(int* transientinput_enum,int* averagedinput_enum,IssmDouble init_time,IssmDouble end_time,int numoutputs);
    175175                void UpdateConstraintsx(void);
    176176                int  UpdateVertexPositionsx(void);
  • issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp

    r21872 r24240  
    153153}
    154154/*}}}*/
     155void BoolInput::PointwiseMult(Input* xinput){/*{{{*/
     156        /*That would compare to a AND operation*/
     157        BoolInput* xboolinput=NULL;
     158
     159        /*xinput is of the same type, so cast it: */
     160        xboolinput=(BoolInput*)xinput;
     161
     162        /*Carry out the PointwiseMult operation depending on type:*/
     163        switch(xinput->ObjectEnum()){
     164
     165                case BoolInputEnum:
     166                        this->value=reCast<bool,IssmDouble>(this->value=this->value*xboolinput->value);
     167                        return;
     168
     169                default:
     170                        _error_("not implemented yet");
     171        }
     172}
     173/*}}}*/
     174void BoolInput::Pow(IssmDouble exponent){/*{{{*/
     175        /* no power for Bools*/
     176}
     177/*}}}*/
    155178void BoolInput::Scale(IssmDouble scale_factor){/*{{{*/
    156179        /*a bool cannot be scaled: */
  • issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h

    r23998 r24240  
    1 /*! \file BoolInput.h 
     1/*! \file BoolInput.h
    22 *  \brief: header file for triavertexinput object
    33 */
     
    4444                void ChangeEnum(int newenumtype);
    4545                void Extrude(int start);
    46                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    4746                void GetInputAverage(IssmDouble* pvalue);
     47                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    4848                void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
    4949                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
    50                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     50                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    5151                void GetInputValue(bool* pvalue);
    5252                void GetInputValue(int* pvalue);
     
    6161                IssmDouble Min(void){_error_("Min not implemented for booleans");};
    6262                IssmDouble MinAbs(void){_error_("Min not implemented for booleans");};
     63                void PointwiseMult(Input* xinput);
     64                void Pow(IssmDouble exponent);
    6365                void Scale(IssmDouble scale_factor);
    6466                /*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp

    r22794 r24240  
    253253}
    254254/*}}}*/
     255void ControlInput::PointwiseMult(Input* xinput){/*{{{*/
     256        values->PointwiseMult(xinput);
     257}/*}}}*/
    255258void ControlInput::SaveValue(void){/*{{{*/
    256259        if(!values) _error_("Values of " << EnumToStringx(this->enum_type) << " not found");
  • issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h

    r23998 r24240  
    1 /*! \file ControlInput.h 
     1/*! \file ControlInput.h
    22 *  \brief: header file for triavertexinput object
    33 */
     
    3535                void  DeepEcho();
    3636                void  Echo();
    37                 int   Id(); 
     37                int   Id();
    3838                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3939                int   ObjectEnum();
     
    5252                void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist);
    5353                void GetGradientValue(IssmDouble* pvalue,Gauss* gauss);
    54                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     54                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    5555                void GetInputAverage(IssmDouble* pvalue);
    5656                void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
    5757                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
    58                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     58                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    5959                void GetInputValue(bool* pvalue);
    6060                void GetInputValue(int* pvalue);
     
    7575                void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
    7676                void SaveValue(void);
     77                void PointwiseMult(Input* xinput);
     78                void Pow(IssmDouble exponent){_error_("not implemented yet");};
    7779                void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
    7880                void SetGradient(Input* gradient_in,int timestep);
  • issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h

    r23998 r24240  
    1 /*! \file DatasetInput.h 
     1/*! \file DatasetInput.h
    22 *  \brief: header file for datasetinput object
    33 */
     
    4747                void Extrude(int start){_error_("not implemented yet");};
    4848                void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");};
    49                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     49                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    5050                void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
    5151                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5757                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    5858                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index);
    59                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     59                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    6060                int  GetInputInterpolationType(){_error_("not implemented yet!");};
    6161                int GetResultArraySize(void){_error_("not implemented yet");};
     
    6969                void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
    7070                void SaveValue(void){_error_("not implemented yet");};
     71                void PointwiseMult(Input* xinput){_error_("not implemented yet");};
     72                void Pow(IssmDouble exponent){_error_("not implemented yet");};
    7173                void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
    7274                void SetGradient(Input* gradient_in){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/Inputs/DoubleArrayInput.h

    r23998 r24240  
    1 /*! \file DoubleArrayInput.h 
     1/*! \file DoubleArrayInput.h
    22 *  \brief: header file for vector type input object
    33 */
     
    2727                void  DeepEcho();
    2828                void  Echo();
    29                 int   Id(); 
     29                int   Id();
    3030                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3131                int   ObjectEnum();
     
    4646                void ChangeEnum(int newenumtype);
    4747                void Extrude(int start){_error_("not supported yet");};
    48                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     48                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    4949                void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
    5050                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5656                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    5757                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    58                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     58                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    5959                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
    6060                int  GetInputInterpolationType(){_error_("not implemented yet!");};
     
    6363                IssmDouble Min(void){_error_("not implemented yet");};
    6464                IssmDouble MinAbs(void){_error_("not implemented yet");};
     65                void PointwiseMult(Input* xinput){_error_("not implemented yet");};
     66                void Pow(IssmDouble exponent){_error_("not implemented yet");};
    6567                void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
    6668                /*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp

    r21974 r24240  
    171171}
    172172/*}}}*/
     173void DoubleInput::PointwiseMult(Input* xinput){/*{{{*/
     174
     175        DoubleInput* xIssmDoubleinput=NULL;
     176
     177
     178        /*xinput is of the same type, so cast it: */
     179        xIssmDoubleinput=(DoubleInput*)xinput;
     180
     181        switch(xinput->ObjectEnum()){
     182
     183                case DoubleInputEnum:
     184                        this->value=this->value*xIssmDoubleinput->value;
     185                        return;
     186
     187                default:
     188                        _error_("not implemented yet");
     189        }
     190}
     191/*}}}*/
     192void DoubleInput::Pow(IssmDouble exponent){/*{{{*/
     193
     194        if(exponent==0.0){
     195                /*  Not-a-number left alone Infinity set to one  */
     196                if (value==value)value=1.0;
     197        }
     198        else if(exponent==0.5){
     199                if(value>=0){
     200                        value=sqrt(value);
     201                }
     202                else{
     203                        value=INFINITY;
     204                }
     205        }
     206        else if(exponent==1.0){
     207                /* do nothing */
     208        }
     209        else if(exponent==-0.5){
     210                if(value>=0){
     211                        value=1.0/sqrt(value);
     212                }
     213                else{
     214                        value=INFINITY;
     215                }
     216        }
     217        else if(exponent==-1.0){
     218                if(value!=0.){
     219                        value=1.0/value;
     220                }
     221                else{
     222                        value=INFINITY;
     223                }
     224        }
     225        else {
     226                value=pow(value,exponent);
     227        }
     228}
     229/*}}}*/
    173230void DoubleInput::Scale(IssmDouble scale_factor){/*{{{*/
    174231        value=value*scale_factor;
  • issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h

    r23998 r24240  
    1 /*! \file DoubleInput.h 
     1/*! \file DoubleInput.h
    22 *  \brief: header file for triavertexinput object
    33 */
     
    2828                void  DeepEcho();
    2929                void  Echo();
    30                 int   Id(); 
     30                int   Id();
    3131                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3232                int   ObjectEnum();
     
    4747                void ChangeEnum(int newenumtype);
    4848                void Extrude(int start){_error_("not supported yet");};
    49                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     49                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    5050                void GetInputAverage(IssmDouble* pvalue);
    5151                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5757                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    5858                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    59                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     59                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    6060                int  GetInputInterpolationType(){return P0Enum; };
    6161                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
     
    6464                IssmDouble Min(void);
    6565                IssmDouble MinAbs(void);
     66                void PointwiseMult(Input* xinput);
     67                void Pow(IssmDouble exponent);
    6668                void Scale(IssmDouble scale_factor);
    6769                /*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/Input.h

    r23998 r24240  
    11/*!\file:  Input.h
    22 * \brief abstract class for Input object
    3  */ 
     3 */
    44
    55#ifndef _INPUT_H_
     
    2121class Input: public Object{
    2222
    23         public: 
     23        public:
    2424
    2525                virtual        ~Input(){};
     
    2727                virtual void ChangeEnum(int newenumtype)=0;
    2828                virtual void Configure(Parameters* parameters)=0;
    29                 virtual void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
     29                virtual void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
    3030                virtual void GetInputAverage(IssmDouble* pvalue)=0;
    3131                virtual void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list)=0;
     
    3838                virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index)=0;
    3939                virtual int  GetInputInterpolationType()=0;
    40                 virtual void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
    41                 virtual int  InstanceEnum()=0; 
     40                virtual void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
     41                virtual int  InstanceEnum()=0;
    4242
    4343                virtual void   AXPY(Input* xinput,IssmDouble scalar)=0;
     
    4848                virtual IssmDouble Min(void)=0;
    4949                virtual IssmDouble MinAbs(void)=0;
     50                virtual void   PointwiseMult(Input* xinput)=0;
     51                virtual void   Pow(IssmDouble exponent)=0;
    5052                virtual void   Scale(IssmDouble scale_factor)=0;
    5153
     
    5658                virtual Input* SpawnTriaInput(int index1,int index2,int index3)=0;
    5759                virtual void ResultToMatrix(IssmDouble* values,int ncols,int sid){_error_("not supported yet");};
    58                 virtual void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 
     60                virtual void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
    5961};
    6062#endif
  • issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp

    r21974 r24240  
    149149}
    150150/*}}}*/
     151void IntInput::PointwiseMult(Input* xinput){/*{{{*/
     152
     153        IssmDouble dvalue;
     154        IntInput* xintinput=NULL;
     155
     156        /*xinput is of the same type, so cast it: */
     157        xintinput=(IntInput*)xinput;
     158
     159        /*Carry out the PointwiseMult operation depending on type:*/
     160        switch(xinput->ObjectEnum()){
     161
     162                case IntInputEnum:
     163                        dvalue=(IssmDouble)this->value*(IssmDouble)xintinput->value;
     164                        this->value=reCast<int>(dvalue);
     165                        return;
     166
     167                default:
     168                        _error_("not implemented yet");
     169        }
     170}
     171/*}}}*/
     172void IntInput::Pow(IssmDouble exponent){/*{{{*/
     173
     174        IssmDouble dvalue;
     175
     176        if(exponent==0.0){
     177                /*  Not-a-number left alone Infinity set to one  */
     178                if (dvalue==dvalue)dvalue=1.0;
     179        }
     180        else if(exponent==0.5){
     181                if(dvalue>=0){
     182                        dvalue=sqrt(dvalue);
     183                }
     184                else{
     185                        dvalue=INFINITY;
     186                }
     187        }
     188        else if(exponent==1.0){
     189                /* do nothing */
     190        }
     191        else if(exponent==-0.5){
     192                if(dvalue>=0){
     193                        dvalue=1.0/sqrt(dvalue);
     194                }
     195                else{
     196                        dvalue=INFINITY;
     197                }
     198        }
     199        else if(exponent==-1.0){
     200                if(dvalue!=0.){
     201                        dvalue=1.0/dvalue;
     202                }
     203                else{
     204                        dvalue=INFINITY;
     205                }
     206        }
     207        else {
     208                dvalue=pow(dvalue,exponent);
     209        }
     210        value=reCast<int>(dvalue);
     211}
     212/*}}}*/
    151213void IntInput::Scale(IssmDouble scale_factor){/*{{{*/
    152214        IssmDouble dvalue=(IssmDouble)value*scale_factor;
  • issm/trunk-jpl/src/c/classes/Inputs/IntInput.h

    r23998 r24240  
    1 /*! \file IntInput.h 
     1/*! \file IntInput.h
    22 *  \brief: header file for triavertexinput object
    33 */
     
    2929                void  DeepEcho();
    3030                void  Echo();
    31                 int   Id(); 
     31                int   Id();
    3232                void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
    3333                int   ObjectEnum();
     
    4848                void ChangeEnum(int newenumtype);
    4949                void Extrude(int start){_error_("not supported yet");};
    50                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     50                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    5151                void GetInputAverage(IssmDouble* pvalue);
    5252                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5858                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    5959                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    60                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     60                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    6161                int  GetInputInterpolationType(){_error_("not implemented yet!");};
    6262                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
     
    6565                IssmDouble Min(void){_error_("Min not implemented for integers");};
    6666                IssmDouble MinAbs(void){_error_("Min not implemented for integers");};
     67                void PointwiseMult(Input* xinput);
     68                void Pow(IssmDouble exponent);
    6769                void Scale(IssmDouble scale_factor);
    6870                /*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp

    r22519 r24240  
    126126        TriaInput* outinput=NULL;
    127127
    128         if(this->interpolation_type==P0Enum){ 
     128        if(this->interpolation_type==P0Enum){
    129129                outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
    130130        }
    131131        else{
    132132                /*Assume P1 interpolation only for now*/
    133                 IssmDouble newvalues[3]; 
     133                IssmDouble newvalues[3];
    134134
    135135                /*Create array of indices depending on location (0=base 1=surface)*/
     
    319319}
    320320/*}}}*/
     321void PentaInput::PointwiseMult(Input* xinput){/*{{{*/
     322
     323        const int numnodes=this->NumberofNodes(this->interpolation_type);
     324        PentaInput* xpentainput=NULL;
     325
     326        /*If xinput is a ControlInput, take its values directly*/
     327        if(xinput->ObjectEnum()==ControlInputEnum){
     328                xinput=((ControlInput*)xinput)->values;
     329        }
     330
     331        /*xinput is of the same type, so cast it: */
     332        if(xinput->ObjectEnum()!=PentaInputEnum)
     333          _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));
     334        xpentainput=(PentaInput*)xinput;
     335        if(xpentainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xpentainput->interpolation_type));
     336
     337        /*Carry out the PointwiseMult operation depending on type:*/
     338        for(int i=0;i<numnodes;i++)this->values[i]=this->values[i]*xpentainput->values[i];
     339
     340}
     341/*}}}*/
     342void PentaInput::Pow(IssmDouble exponent){/*{{{*/
     343
     344        const int numnodes=this->NumberofNodes(this->interpolation_type);
     345        if(exponent==0.0){
     346                /*  Not-a-number left alone Infinity set to one  */
     347                for(int i=0;i<numnodes;i++){
     348                        if (this->values[i]==this->values[i])this->values[i]=1.0;
     349                }
     350        }
     351        else if(exponent==0.5){
     352                for(int i=0;i<numnodes;i++){
     353                        if(this->values[i]>=0){
     354                                this->values[i]=sqrt(this->values[i]);
     355                        }
     356                        else{
     357                                this->values[i]=INFINITY;
     358                        }
     359                }
     360        }
     361        else if(exponent==1.0){
     362                /* do nothing */
     363        }
     364        else if(exponent==-0.5){
     365                for(int i=0;i<numnodes;i++){
     366                        if(this->values[i]>=0){
     367                                this->values[i]=1.0/sqrt(this->values[i]);
     368                        }
     369                        else{
     370                                this->values[i]=INFINITY;
     371                        }
     372                }
     373        }
     374        else if(exponent==-1.0){
     375                for(int i=0;i<numnodes;i++){
     376                        if(this->values[i]!=0.){
     377                                this->values[i]=1.0/this->values[i];
     378                        }
     379                        else{
     380                                this->values[i]=INFINITY;
     381                        }
     382                }
     383        }
     384        else {
     385                for(int i=0;i<numnodes;i++)this->values[i]=pow(this->values[i],exponent);
     386        }
     387}
     388/*}}}*/
    321389void PentaInput::Scale(IssmDouble scale_factor){/*{{{*/
    322390
  • issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h

    r23998 r24240  
    1 /*! \file PentaInput.h 
     1/*! \file PentaInput.h
    22 *  \brief: header file for PentaInput object
    33 */
     
    4646                void ChangeEnum(int newenumtype);
    4747                void Extrude(int start);
    48                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     48                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    4949                void GetInputAverage(IssmDouble* pvalue);
    5050                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5656                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    5757                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    58                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     58                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    5959                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    6060                int  GetInputInterpolationType(){_error_("not implemented yet!");};
     
    6363                IssmDouble Min(void);
    6464                IssmDouble MinAbs(void);
     65                void PointwiseMult(Input* xinput);
     66                void Pow(IssmDouble exponent);
    6567                void Scale(IssmDouble scale_factor);
    6668                Input* SpawnTriaInput(int index1,int index2,int index3);
  • issm/trunk-jpl/src/c/classes/Inputs/SegInput.h

    r23998 r24240  
    1 /*! \file SegInput.h 
     1/*! \file SegInput.h
    22 *  \brief: header file for SegInput object
    33 */
     
    4949                void ChangeEnum(int newenumtype){_error_("not implemented yet");};
    5050                void Extrude(int start){_error_("not supported yet");};
    51                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
     51                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
    5252                void GetInputAverage(IssmDouble* pvalue);
    5353                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5959                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    6060                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    61                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
     61                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
    6262                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
    6363                int  GetInputInterpolationType(){_error_("not implemented yet!");};
     
    6666                IssmDouble Min(void);
    6767                IssmDouble MinAbs(void){_error_("not implemented yet");};
     68                void PointwiseMult(Input* xinput){_error_("not implemented yet");};
     69                void Pow(IssmDouble exponent){_error_("not implemented yet");};
    6870                void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
    6971
  • issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp

    r23998 r24240  
    122122}
    123123/*}}}*/
    124 void TetraInput::GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
     124void TetraInput::GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
    125125
    126126        IssmDouble* outvalues=NULL;
     
    160160}
    161161/*}}}*/
    162 void TetraInput::GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
     162void TetraInput::GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
    163163
    164164        IssmDouble* outvalues=NULL;
     
    192192        TriaInput* outinput=NULL;
    193193
    194         if(this->interpolation_type==P0Enum){ 
     194        if(this->interpolation_type==P0Enum){
    195195                outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
    196196        }
    197197        else{
    198198                /*Assume P1 interpolation only for now*/
    199                 IssmDouble newvalues[3]; 
     199                IssmDouble newvalues[3];
    200200
    201201                /*Create array of indices depending on location (0=base 1=surface)*/
     
    286286}
    287287/*}}}*/
     288void TetraInput::PointwiseMult(Input* xinput){/*{{{*/
     289
     290        const int numnodes=this->NumberofNodes(this->interpolation_type);
     291        TetraInput* xtetrainput=NULL;
     292
     293        /*xinput is of the same type, so cast it: */
     294        if(xinput->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));
     295        xtetrainput=(TetraInput*)xinput;
     296        if(xtetrainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xtetrainput->interpolation_type));
     297
     298        /*Carry out the PointwiseMult operation depending on type:*/
     299        for(int i=0;i<numnodes;i++)this->values[i]=this->values[i]*xtetrainput->values[i];
     300
     301}
     302/*}}}*/
     303void TetraInput::Pow(IssmDouble exponent){/*{{{*/
     304
     305        const int numnodes=this->NumberofNodes(this->interpolation_type);
     306        if(exponent==0.0){
     307                /*  Not-a-number left alone Infinity set to one  */
     308                for(int i=0;i<numnodes;i++){
     309                        if (this->values[i]==this->values[i])this->values[i]=1.0;
     310                }
     311        }
     312        else if(exponent==0.5){
     313                for(int i=0;i<numnodes;i++){
     314                        if(this->values[i]>=0){
     315                                this->values[i]=sqrt(this->values[i]);
     316                        }
     317                        else{
     318                                this->values[i]=INFINITY;
     319                        }
     320                }
     321        }
     322        else if(exponent==1.0){
     323                /* do nothing */
     324        }
     325        else if(exponent==-0.5){
     326                for(int i=0;i<numnodes;i++){
     327                        if(this->values[i]>=0){
     328                                this->values[i]=1.0/sqrt(this->values[i]);
     329                        }
     330                        else{
     331                                this->values[i]=INFINITY;
     332                        }
     333                }
     334        }
     335        else if(exponent==-1.0){
     336                for(int i=0;i<numnodes;i++){
     337                        if(this->values[i]!=0.){
     338                                this->values[i]=1.0/this->values[i];
     339                        }
     340                        else{
     341                                this->values[i]=INFINITY;
     342                        }
     343                }
     344        }
     345        else {
     346                for(int i=0;i<numnodes;i++)this->values[i]=pow(this->values[i],exponent);
     347        }
     348}
     349/*}}}*/
    288350void TetraInput::Scale(IssmDouble scale_factor){/*{{{*/
    289351
  • issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h

    r23998 r24240  
    1 /*! \file TetraInput.h 
     1/*! \file TetraInput.h
    22 *  \brief: header file for TetraInput object
    33 */
     
    4949                void ChangeEnum(int newenumtype);
    5050                void Extrude(int start){_error_("not supported yet");};
    51                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
     51                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
    5252                void GetInputAverage(IssmDouble* pvalue);
    5353                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
     
    5959                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    6060                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
    61                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
     61                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
    6262                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    6363                int  GetInputInterpolationType(){_error_("not implemented yet!");};
     
    6666                IssmDouble Min(void);
    6767                IssmDouble MinAbs(void);
     68                void PointwiseMult(Input* xinput);
     69                void Pow(IssmDouble exponent);
    6870                void Scale(IssmDouble scale_factor);
    6971
  • issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp

    r23797 r24240  
    6060}
    6161/*}}}*/
     62void TransientInput::AddTimeInput(Input* input,IssmDouble time){/*{{{*/
     63
     64        /*insert values at time step: */
     65        if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _error_("timestep values must increase sequentially");
     66
     67        //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input);
     68        IssmDouble* old_timesteps=NULL;
     69
     70        if (this->numtimesteps > 0){
     71                old_timesteps=xNew<IssmDouble>(this->numtimesteps);
     72                xMemCpy(old_timesteps,this->timesteps,this->numtimesteps);
     73                xDelete(this->timesteps);
     74        }
     75
     76        this->numtimesteps=this->numtimesteps+1;
     77        this->timesteps=xNew<IssmDouble>(this->numtimesteps);
     78
     79        if (this->numtimesteps > 1){
     80                xMemCpy(this->timesteps,old_timesteps,this->numtimesteps-1);
     81                xDelete(old_timesteps);
     82        }
     83
     84        /*go ahead and plug: */
     85        this->timesteps[this->numtimesteps-1]=time;
     86        inputs->AddObject(input);
     87
     88}
     89/*}}}*/
     90void TransientInput::AddTimeInput(Input* input){/*{{{*/
     91
     92        _assert_(this->inputs->Size()<this->numtimesteps);
     93        inputs->AddObject(input);
     94
     95}
     96/*}}}*/
    6297
    6398/*Object virtual functions definitions:*/
     
    120155
    121156/*TransientInput management*/
     157void TransientInput::Configure(Parameters* parameters){/*{{{*/
     158        this->parameters=parameters;
     159}
     160/*}}}*/
     161int  TransientInput::GetResultArraySize(void){/*{{{*/
     162
     163        return 1;
     164}
     165/*}}}*/
     166int  TransientInput::GetResultInterpolation(void){/*{{{*/
     167
     168        IssmDouble time;
     169        int        output;
     170
     171        parameters->FindParam(&time,TimeEnum);
     172        Input* input=GetTimeInput(time);
     173        output = input->GetResultInterpolation();
     174
     175        /*Clean up and return*/
     176        delete input;
     177        return output;
     178
     179}
     180/*}}}*/
     181int  TransientInput::GetResultNumberOfNodes(void){/*{{{*/
     182
     183        IssmDouble time;
     184        int        output;
     185
     186        parameters->FindParam(&time,TimeEnum);
     187        Input* input=GetTimeInput(time);
     188        output = input->GetResultNumberOfNodes();
     189
     190        /*Clean up and return*/
     191        delete input;
     192        return output;
     193
     194}
     195/*}}}*/
    122196int TransientInput::InstanceEnum(void){/*{{{*/
    123197
     
    174248}
    175249/*}}}*/
    176 void TransientInput::GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
     250void TransientInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/
     251
     252        IssmDouble time;
     253
     254        /*First, recover current time from parameters: */
     255        parameters->FindParam(&time,TimeEnum);
     256
     257        /*Retrieve interpolated values for this time step: */
     258        Input* input=GetTimeInput(time);
     259
     260        /*Call input function*/
     261        input->GetInputAverage(pvalue);
     262
     263        delete input;
     264
     265}
     266/*}}}*/
     267void TransientInput::GetInputAverageOverTimeSlice(IssmDouble* pvalue, Gauss* gauss, IssmDouble start_time,IssmDouble end_time){/*{{{*/
     268
     269        int averaging = 0;
     270
     271        Input* input=GetInputAverageOverTime(start_time,end_time,averaging);
     272
     273        /*Call input function*/
     274        input->GetInputValue(pvalue, gauss);
     275
     276        //*pvalues=values;
     277        delete input;
     278}
     279/*}}}*/
     280Input* TransientInput::GetInputAverageOverTime(IssmDouble start_time,IssmDouble end_time,int averaging){/*{{{*/
     281
     282        int found;
     283        int offset,start_offset,end_offset;
     284        IssmDouble subdt,yts;
     285        IssmDouble slice_duration;
     286
     287        IssmDouble time;
     288
     289        this->parameters->FindParam(&time,TimeEnum);
     290        this->parameters->FindParam(&yts,ConstantsYtsEnum);
     291        this->parameters->FindParam(&subdt,TimesteppingTimeStepEnum); //duration of each substeps
     292
     293        Input *averageinput  = NULL;
     294        Input *currentinput  = NULL;
     295
     296        slice_duration=end_time-start_time;
     297        start_time+=subdt; //because time is actually considered at the end of the timestep
     298
     299        /*go through the timesteps, and grab offset for the start of the slice*/
     300        found=binary_search(&offset,start_time,this->timesteps,this->numtimesteps);
     301        if(!found) _error_("Input not found (is TransientInput sorted ?)");
     302        /*go through the timesteps, and grab offset for the end of the slice*/
     303        found=binary_search(&end_offset,end_time,this->timesteps,this->numtimesteps);
     304        if(!found) _error_("Input not found (is TransientInput sorted ?)");
     305
     306        start_offset = offset;
     307        //stack the input for each timestep in the slice
     308        while(offset <= end_offset ){
     309                if (offset==-1){
     310                        /*get values for the first time: */
     311                        _assert_(start_time<this->timesteps[0]);
     312                        currentinput=(Input*)((Input*)this->inputs->GetObjectByOffset(0))->copy();
     313                }
     314                else if(offset==(this->numtimesteps-1)){
     315                        /*get values for the last time: */
     316                        _assert_(end_time>=this->timesteps[offset]);
     317                        currentinput=(Input*)((Input*)this->inputs->GetObjectByOffset(offset))->copy();
     318                }
     319                else{
     320                        currentinput=(Input*)((Input*)this->inputs->GetObjectByOffset(offset))->copy();
     321                }
     322                switch(averaging){
     323                        case 0: //Arithmetic mean
     324                                if (offset==start_offset){
     325                                        averageinput=(Input*)currentinput->copy();
     326                                        averageinput->Scale(subdt);
     327                                }
     328                                else{
     329                                        averageinput->AXPY(currentinput,subdt);
     330                                }
     331                                break;
     332                        case 1: //Geometric mean
     333                                if (offset==start_offset){
     334                                        averageinput=(Input*)currentinput->copy();
     335                                        averageinput->Scale(subdt);
     336                                }
     337                                else{
     338                                        currentinput->Scale(subdt);
     339                                        averageinput->PointwiseMult(currentinput);
     340                                }
     341                                break;
     342                        case 2: //Harmonic mean
     343                                if (offset==start_offset){
     344                                        averageinput=(Input*)currentinput->copy();
     345                                        averageinput->Pow(-1);
     346                                        averageinput->Scale(subdt);
     347                                }
     348                                else{
     349                                        currentinput->Pow(-1);
     350                                        averageinput->AXPY(currentinput,subdt);
     351                                }
     352                                break;
     353                        default:
     354                                _error_("averaging method is not recognised");
     355                }
     356                offset+=1;
     357        }
     358
     359        //summation is done, now we normalise
     360        switch(averaging){
     361                case 0: //Arithmetic mean
     362                        averageinput->Scale(1.0/slice_duration);
     363                        break;
     364                case 1: //Geometric mean
     365                        averageinput->Pow(1.0/slice_duration);
     366                        break;
     367                case 2: //Harmonic mean
     368                        averageinput->Scale(1.0/slice_duration);
     369                        averageinput->Pow(-1.0);
     370                        break;
     371                default:
     372                        _error_("averaging method is not recognised");
     373        }
     374        return averageinput;
     375}
     376/*}}}*/
     377void TransientInput::GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
    177378
    178379        int i;
     
    195396}
    196397/*}}}*/
    197 void TransientInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/
    198 
    199         IssmDouble time;
    200 
    201         /*First, recover current time from parameters: */
    202         parameters->FindParam(&time,TimeEnum);
    203 
    204         /*Retrieve interpolated values for this time step: */
    205         Input* input=GetTimeInput(time);
    206 
    207         /*Call input function*/
    208         input->GetInputAverage(pvalue);
    209 
    210         delete input;
    211 
    212 }
    213 /*}}}*/
    214 void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
    215 
    216         IssmDouble time;
    217 
    218         /*First, recover current time from parameters: */
    219         parameters->FindParam(&time,TimeEnum);
    220 
    221         /*Retrieve interpolated values for this time step: */
    222         Input* input=GetTimeInput(time);
    223 
    224         /*Call input function*/
    225         input->GetInputDerivativeValue(p,xyz_list,gauss);
    226 
    227         delete input;
    228 }
    229 /*}}}*/
    230 void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){/*{{{*/
    231         IssmDouble time;
    232 
    233         /*First, recover current time from parameters: */
    234         parameters->FindParam(&time,TimeEnum);
    235 
    236         /*Retrieve interpolated values for this time step: */
    237         Input* input=GetTimeInput(time);
    238 
    239         /*Call input function*/
    240         input->GetInputValue(pvalue,gauss);
    241 
    242         delete input;
    243 }
    244 /*}}}*/
    245 void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){/*{{{*/
    246 
    247         /*Retrieve interpolated values for this time step: */
    248         Input* input=GetTimeInput(time);
    249 
    250         /*Call input function*/
    251         input->GetInputValue(pvalue,gauss);
    252 
    253         delete input;
    254 }
    255 /*}}}*/
    256 int  TransientInput::GetTimeInputOffset(IssmDouble time){/*{{{*/
    257 
    258         int offset;
    259 
    260         /*go through the timesteps, and figure out which interval we
    261          *     *fall within. Then interpolate the values on this interval: */
    262         int found=binary_search(&offset,time,this->timesteps,this->numtimesteps);
    263         if(!found) _error_("Input not found (is TransientInput sorted ?)");
    264 
    265         return offset;
    266 }
    267 /*}}}*/
    268 IssmDouble  TransientInput::GetTimeByOffset(int offset){/*{{{*/
    269         if (offset < 0) offset=0;
    270         _assert_(offset<(this->numtimesteps));
    271         return this->timesteps[offset];
    272 }
    273 /*}}}*/
    274 void TransientInput::GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
     398void TransientInput::GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
    275399
    276400        int         i;
     
    312436}
    313437/*}}}*/
    314 
     438void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
     439
     440        IssmDouble time;
     441
     442        /*First, recover current time from parameters: */
     443        parameters->FindParam(&time,TimeEnum);
     444
     445        /*Retrieve interpolated values for this time step: */
     446        Input* input=GetTimeInput(time);
     447
     448        /*Call input function*/
     449        input->GetInputDerivativeValue(p,xyz_list,gauss);
     450
     451        delete input;
     452}
     453/*}}}*/
     454void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss){/*{{{*/
     455        IssmDouble time;
     456
     457        /*First, recover current time from parameters: */
     458        parameters->FindParam(&time,TimeEnum);
     459
     460        /*Retrieve interpolated values for this time step: */
     461        Input* input=GetTimeInput(time);
     462
     463        /*Call input function*/
     464        input->GetInputValue(pvalue,gauss);
     465
     466        delete input;
     467}
     468/*}}}*/
     469void TransientInput::GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){/*{{{*/
     470
     471        /*Retrieve interpolated values for this time step: */
     472        Input* input=GetTimeInput(time);
     473
     474        /*Call input function*/
     475        input->GetInputValue(pvalue,gauss);
     476
     477        delete input;
     478}
     479/*}}}*/
     480IssmDouble  TransientInput::GetTimeByOffset(int offset){/*{{{*/
     481        if (offset < 0) offset=0;
     482        _assert_(offset<(this->numtimesteps));
     483        return this->timesteps[offset];
     484}
     485/*}}}*/
     486int  TransientInput::GetTimeInputOffset(IssmDouble time){/*{{{*/
     487
     488        int offset;
     489
     490        /*go through the timesteps, and figure out which interval we
     491         *     *fall within. Then interpolate the values on this interval: */
     492        int found=binary_search(&offset,time,this->timesteps,this->numtimesteps);
     493        if(!found) _error_("Input not found (is TransientInput sorted ?)");
     494
     495        return offset;
     496}
     497/*}}}*/
    315498/*Intermediary*/
    316 void TransientInput::AddTimeInput(Input* input,IssmDouble time){/*{{{*/
    317 
    318         /*insert values at time step: */
    319         if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _error_("timestep values must increase sequentially");
    320 
    321         //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input);
    322         IssmDouble* old_timesteps=NULL;
    323 
    324         if (this->numtimesteps > 0){
    325                 old_timesteps=xNew<IssmDouble>(this->numtimesteps);
    326                 xMemCpy(old_timesteps,this->timesteps,this->numtimesteps);
    327                 xDelete(this->timesteps);
    328         }
    329 
    330         this->numtimesteps=this->numtimesteps+1;
    331         this->timesteps=xNew<IssmDouble>(this->numtimesteps);
    332 
    333         if (this->numtimesteps > 1){
    334                 xMemCpy(this->timesteps,old_timesteps,this->numtimesteps-1);
    335                 xDelete(old_timesteps);
    336         }
    337 
    338         /*go ahead and plug: */
    339         this->timesteps[this->numtimesteps-1]=time;
    340         inputs->AddObject(input);
    341 
    342 }
    343 /*}}}*/
    344 void TransientInput::AddTimeInput(Input* input){/*{{{*/
    345 
    346         _assert_(this->inputs->Size()<this->numtimesteps);
    347         inputs->AddObject(input);
    348 
    349 }
    350 /*}}}*/
    351 void TransientInput::Configure(Parameters* parameters){/*{{{*/
    352         this->parameters=parameters;
    353 }
    354 /*}}}*/
    355499void TransientInput::Extrude(int start){/*{{{*/
    356500
     
    358502                ((Input*)this->inputs->GetObjectByOffset(i))->Extrude(start);
    359503        }
    360 }
    361 /*}}}*/
    362 int  TransientInput::GetResultArraySize(void){/*{{{*/
    363 
    364         return 1;
    365 }
    366 /*}}}*/
    367 int  TransientInput::GetResultInterpolation(void){/*{{{*/
    368 
    369         IssmDouble time;
    370         int        output;
    371 
    372         parameters->FindParam(&time,TimeEnum);
    373         Input* input=GetTimeInput(time);
    374         output = input->GetResultInterpolation();
    375 
    376         /*Clean up and return*/
    377         delete input;
    378         return output;
    379 
    380 }
    381 /*}}}*/
    382 int  TransientInput::GetResultNumberOfNodes(void){/*{{{*/
    383 
    384         IssmDouble time;
    385         int        output;
    386 
    387         parameters->FindParam(&time,TimeEnum);
    388         Input* input=GetTimeInput(time);
    389         output = input->GetResultNumberOfNodes();
    390 
    391         /*Clean up and return*/
    392         delete input;
    393         return output;
    394 
    395504}
    396505/*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h

    r23998 r24240  
    4444                int  GetResultInterpolation(void);
    4545                int  GetResultNumberOfNodes(void);
    46                 int    InstanceEnum();
     46                int  InstanceEnum();
    4747                void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
    4848                Input* SpawnSegInput(int index1,int index2);
    4949                Input* SpawnTriaInput(int index1,int index2,int index3);
    5050                /*}}}*/
    51                 /*numerics: {{{*/
     51                /*Object Functions: {{{*/
    5252                void AXPY(Input* xforcing,IssmDouble scalar){_error_("not implemented yet");};
    5353                void ChangeEnum(int newenumtype);
    54                 void Extrude(int start);
    55                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
    5654                void GetInputAverage(IssmDouble* pvalue);
     55                void GetInputAverageOverTimeSlice(IssmDouble* pvalue, Gauss* gauss, IssmDouble init_time, IssmDouble end_time);
     56                Input* GetInputAverageOverTime(IssmDouble start_time,IssmDouble end_time,int averaging);
     57                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
     58                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
    5759                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
    5860                void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
     61                int  GetInputInterpolationType(){_error_("not implemented yet!");};
     62                void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");};
    5963                void GetInputValue(bool* pvalue){_error_("not implemented yet");};
    6064                void GetInputValue(int* pvalue){_error_("not implemented yet");};
     
    6367                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time);
    6468                void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
    65                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
    66                 int  GetInputInterpolationType(){_error_("not implemented yet!");};
    6769                IssmDouble  GetTimeByOffset(int offset);
     70                int  GetTimeInputOffset(IssmDouble time);
     71                void PointwiseMult(Input* xforcing){_error_("not implemented yet");};
     72                void Pow(IssmDouble exponent){_error_("not implemented yet");};
     73                void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
     74                /*}}}*/
     75                /*Intermiadaries: {{{*/
     76                void Extrude(int start);
    6877                Input* GetTimeInput(IssmDouble time);
    69                 int  GetTimeInputOffset(IssmDouble time);
    70                 void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");};
    7178                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    7279                IssmDouble Max(void);
     
    7481                IssmDouble Min(void);
    7582                IssmDouble MinAbs(void);
    76                 void Scale(IssmDouble scale_factor){_error_("not implemented yet");};
    7783                /*}}}*/
    7884
  • issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp

    r24091 r24240  
    126126        SegInput* outinput=NULL;
    127127
    128         if(this->interpolation_type==P0Enum){ 
     128        if(this->interpolation_type==P0Enum){
    129129                outinput=new SegInput(this->enum_type,&this->values[0],P0Enum);
    130130        }
     
    165165}
    166166/*}}}*/
    167 void TriaInput::GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
     167void TriaInput::GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
    168168
    169169        IssmDouble* outvalues=NULL;
     
    224224/*}}}*/
    225225
    226 void TriaInput::GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
     226void TriaInput::GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/
    227227
    228228        IssmDouble* outvalues=NULL;
     
    320320}
    321321/*}}}*/
     322void TriaInput::PointwiseMult(Input* xinput){/*{{{*/
     323
     324        const int numnodes=this->NumberofNodes(this->interpolation_type);
     325        TriaInput* xtriainput=NULL;
     326
     327
     328        /*xinput is of the same type, so cast it: */
     329        if(xinput->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum()));
     330        xtriainput=(TriaInput*)xinput;
     331        if(xtriainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xtriainput->interpolation_type));
     332
     333        /*Carry out the PointwiseMult operation depending on type:*/
     334        for(int i=0;i<numnodes;i++)this->values[i]=this->values[i]*xtriainput->values[i];
     335
     336}
     337/*}}}*/
     338void TriaInput::Pow(IssmDouble exponent){/*{{{*/
     339
     340        const int numnodes=this->NumberofNodes(this->interpolation_type);
     341        if(exponent==0.0){
     342                /*  Not-a-number left alone Infinity set to one  */
     343                for(int i=0;i<numnodes;i++){
     344                        if (this->values[i]==this->values[i])this->values[i]=1.0;
     345                }
     346        }
     347        else if(exponent==0.5){
     348                for(int i=0;i<numnodes;i++){
     349                        if(this->values[i]>=0){
     350                                this->values[i]=sqrt(this->values[i]);
     351                        }
     352                        else{
     353                                this->values[i]=INFINITY;
     354                        }
     355                }
     356        }
     357        else if(exponent==1.0){
     358                /* do nothing */
     359        }
     360        else if(exponent==-0.5){
     361                for(int i=0;i<numnodes;i++){
     362                        if(this->values[i]>=0){
     363                                this->values[i]=1.0/sqrt(this->values[i]);
     364                        }
     365                        else{
     366                                this->values[i]=INFINITY;
     367                        }
     368                }
     369        }
     370        else if(exponent==-1.0){
     371                for(int i=0;i<numnodes;i++){
     372                        if(this->values[i]!=0.){
     373                                this->values[i]=1.0/this->values[i];
     374                        }
     375                        else{
     376                                this->values[i]=INFINITY;
     377                        }
     378                }
     379        }
     380        else {
     381                for(int i=0;i<numnodes;i++)this->values[i]=pow(this->values[i],exponent);
     382        }
     383}
     384/*}}}*/
    322385void TriaInput::Scale(IssmDouble scale_factor){/*{{{*/
    323386
  • issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h

    r23998 r24240  
    1 /*! \file TriaInput.h 
     1/*! \file TriaInput.h
    22 *  \brief: header file for TriaInput object
    33 */
     
    4949                void ChangeEnum(int newenumtype);
    5050                void Extrude(int start){_error_("not supported yet");};
    51                 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
     51                void GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
    5252                void GetInputAverage(IssmDouble* pvalue);
    5353                void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list);
     
    5959                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,IssmDouble time){_error_("not implemented yet");};
    6060                void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
    61                 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
     61                void GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
    6262                int  GetInputInterpolationType(){return interpolation_type;};
    6363                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
     
    6666                IssmDouble Min(void);
    6767                IssmDouble MinAbs(void);
     68                void PointwiseMult(Input* xinput);
     69                void Pow(IssmDouble exponent);
    6870                void Scale(IssmDouble scale_factor);
    6971
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r24066 r24240  
    953953        /*recover my_rank:*/
    954954        int my_rank=IssmComm::GetRank();
    955 
    956955        /*Set file pointer to beginning of the data: */
    957956        fid=this->SetFilePointerToData(&code,NULL,data_name);
  • issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp

    r23959 r24240  
    381381        /*Get sediment water head h*/
    382382        inefanalysis = new HydrologyDCInefficientAnalysis();
    383         element->GetInputValue(&h,node,SedimentHeadHydrostepEnum);
     383        element->GetInputValue(&h,node,SedimentHeadSubstepEnum);
    384384        inefanalysis->GetHydrologyDCInefficientHmax(&h_max,element,node);
    385385        parameters->FindParam(&penalty_lock,HydrologydcPenaltyLockEnum);
  • issm/trunk-jpl/src/c/classes/Params/Parameters.cpp

    r24152 r24240  
    467467        /*first, figure out if the param has already been created: */
    468468        param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
    469 
    470469        if(param) param->SetValue(scalar); //already exists, just set it.
    471470        else this->AddObject(new DoubleParam(enum_type,scalar)); //just add the new parameter.
  • issm/trunk-jpl/src/c/cores/bedslope_core.cpp

    r17700 r24240  
    11/*!\file: bedslope_core.cpp
    2  * \brief: core of the slope solution 
    3  */ 
     2 * \brief: core of the slope solution
     3 */
    44
    55#include "./cores.h"
     
    3434
    3535        if(save_results){
    36                 if(VerboseSolution()) _printf0_("   saving results\n");
     36                if(VerboseSolution()) _printf0_("   saving bedslopes results\n");
    3737                if(domaintype!=Domain2DverticalEnum){
    3838                        int outputs[2] = {BedSlopeXEnum,BedSlopeYEnum};
  • issm/trunk-jpl/src/c/cores/damage_core.cpp

    r23232 r24240  
    1 /* 
     1/*
    22 * \brief: damage_core.cpp: core for the damage solution
    3  */ 
     3 */
    44
    55#include "./cores.h"
     
    1111
    1212void damage_core(FemModel* femmodel){
    13        
     13
    1414        /*Start profiler*/
    1515        femmodel->profiler->Start(DAMAGECORE);
    16        
     16
    1717        /*intermediary*/
    1818        bool   save_results;
    1919        bool   dakota_analysis     = false;
    2020        int    solution_type,stabilization;
    21         int    numoutputs          = 0; 
     21        int    numoutputs          = 0;
    2222        char   **requested_outputs = NULL;
    2323
     
    4040
    4141        if(save_results){
    42                 if(VerboseSolution()) _printf0_("   saving results\n");
     42                if(VerboseSolution()) _printf0_("   saving damage results\n");
    4343                femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
    4444        }
    4545
    46         /*Free resources:*/     
     46        /*Free resources:*/
    4747        if(numoutputs){
    4848                for(int i=0;i<numoutputs;i++){
    4949                        xDelete<char>(requested_outputs[i]);
    50                 } 
     50                }
    5151                xDelete<char*>(requested_outputs);
    5252        }
    53        
     53
    5454        /*End profiler*/
    5555        femmodel->profiler->Stop(DAMAGECORE);
  • issm/trunk-jpl/src/c/cores/hydrology_core.cpp

    r24080 r24240  
    1919        int          solution_type;
    2020        int          numoutputs        = 0;
    21         int          smboutputs;
    2221        bool         save_results;
    2322        bool         modify_loads      = true;
    24         bool         issmb;
    2523        char       **requested_outputs = NULL;
    26         char       **requested_smb_outputs = NULL;
    2724        IssmDouble   ThawedNodes;
    2825
     
    3330        femmodel->parameters->FindParam(&numoutputs,HydrologyNumRequestedOutputsEnum);
    3431        if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,HydrologyRequestedOutputsEnum);
    35         femmodel->parameters->FindParam(&issmb,TransientIssmbEnum);
    3632
    3733        /*Using the Shreve based Model*/
     
    5450                /*intermediary: */
    5551                bool       isefficientlayer;
    56                 int        hydrostep,hydroslices,numaveragedinput;
    57                 IssmDouble time,hydrotime,yts;
    58                 IssmDouble dt,hydrodt;
    59                 /*SMB related */
    60                 int    smb_model;
    61 
    6252                /*recover parameters: */
    6353                femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
    64                 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
    65                 femmodel->parameters->FindParam(&time,TimeEnum);
    66                 femmodel->parameters->FindParam(&hydroslices,HydrologyStepsPerStepEnum);
    67                 femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
    68 
    69                 /*recover SMB related parameters: */
    70                 if(issmb){
    71                         femmodel->parameters->FindParam(&smb_model,SmbEnum);
    72                         femmodel->parameters->FindParam(&smboutputs,SmbNumRequestedOutputsEnum);
    73                         if(smboutputs) femmodel->parameters->FindParam(&requested_smb_outputs,&smboutputs,SmbRequestedOutputsEnum);
    74                 }
    7554
    7655                /*first we exclude frozen nodes of the solved nodes*/
     
    7958
    8059                if(ThawedNodes>0){
    81                         hydrotime=time-dt; //getting the time back to the start of the timestep
    82                         hydrodt=dt/hydroslices; //computing hydro dt from dt and a divider
    83                         hydrostep=0;
    84                         femmodel->parameters->AddObject(new DoubleParam(HydrologydtEnum,hydrodt));
    85 
    86                         if(hydroslices>1){
     60                        /*check if we need sub steps*/
     61                        int        dtslices;
     62                        femmodel->parameters->FindParam(&dtslices,HydrologyStepsPerStepEnum);
     63
     64                        if(dtslices>1){
     65                                int        substep, numaveragedinput;
     66                                IssmDouble global_time, subtime, yts;
     67                                IssmDouble dt, subdt;
     68
     69            femmodel->parameters->FindParam(&global_time,TimeEnum);
     70            femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
     71            femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
     72
     73                                subtime=global_time-dt; //getting the time back to the start of the timestep
     74                                subdt=dt/dtslices; //computing hydro dt from dt and a divider
     75                                substep=0;
     76                                femmodel->parameters->SetParam(subdt,TimesteppingTimeStepEnum);
     77
     78                                /*intermiedaries to deal with averaging*/
     79                                static const int substeplist[4] = {EffectivePressureSubstepEnum,SedimentHeadSubstepEnum,EplHeadSubstepEnum,HydrologydcEplThicknessSubstepEnum};
     80                                static const int transientlist[4] = {EffectivePressureTransientEnum,SedimentHeadTransientEnum,EplHeadTransientEnum,HydrologydcEplThicknessTransientEnum};
     81                                static const int averagelist[4] = {EffectivePressureEnum,SedimentHeadEnum,EplHeadEnum,HydrologydcEplThicknessEnum};
     82                                std::vector<int> substepinput;
     83                                std::vector<int> transientinput;
     84                                std::vector<int> averagedinput;
     85
    8786                                if (isefficientlayer){
    8887                                        /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/
    8988                                        numaveragedinput = 4;
    90                                         int inputtostack[4]     =       {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum,EplHeadHydrostepEnum,HydrologydcEplThicknessHydrostepEnum};
    91                                         int stackedinput[4]     =       {EffectivePressureStackedEnum,SedimentHeadStackedEnum,EplHeadStackedEnum,HydrologydcEplThicknessStackedEnum};
    92                                         int averagedinput[4]    =       {EffectivePressureEnum,SedimentHeadEnum,EplHeadEnum,HydrologydcEplThicknessEnum};
    93                                         femmodel->InitMeanOutputx(&stackedinput[0],numaveragedinput);
    94 
    95                                         //while(hydrotime<time-(yts*DBL_EPSILON)){ //loop on hydro dts
    96                                         while(hydrostep<hydroslices){ //loop on hydro dts
    97                                                 hydrostep+=1;
    98                                                 hydrotime+=hydrodt;
    99                                                 /*Setting substep time as global time*/
    100                                                 femmodel->parameters->SetParam(hydrotime,TimeEnum);
    101                                                 if(VerboseSolution()) _printf0_("sub iteration " << hydrostep << "/" << hydroslices << "  time [yr]: " << setprecision(4) << hydrotime/yts << " (time step: " << hydrodt/yts << ")\n");
    102                                                 if(issmb){
    103                                                         if(VerboseSolution()) _printf0_("   computing mass balance\n");
    104                                                         SmbAnalysis* analysis = new SmbAnalysis();
    105                                                         analysis->Core(femmodel);
    106                                                         delete analysis;
    107                                                 }
    108                                                 if(VerboseSolution()) _printf0_("   computing water heads\n");
    109                                                 /*save preceding timestep*/
    110                                                 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum);
    111                                                 InputDuplicatex(femmodel,EplHeadHydrostepEnum,EplHeadOldEnum);
    112                                                 InputDuplicatex(femmodel,HydrologydcEplThicknessHydrostepEnum,HydrologydcEplThicknessOldEnum);
    113                                                 /*Proceed now to heads computations*/
    114                                                 solutionsequence_hydro_nonlinear(femmodel);
    115                                                 /*If we have a sub-timestep we stack the variables here*/
    116                                                 femmodel->SumOutputx(&inputtostack[0],&stackedinput[0],numaveragedinput);
     89                                        substepinput.assign(substeplist,substeplist+4);
     90                                        transientinput.assign(transientlist,transientlist+4);
     91                                        averagedinput.assign(averagelist,averagelist+4);
     92                                }
     93                                else{
     94                                        numaveragedinput = 2;
     95                                        substepinput.assign(substeplist,substeplist+2);
     96                                        transientinput.assign(transientlist,transientlist+2);
     97                                        averagedinput.assign(averagelist,averagelist+2);
     98                                }
     99                                femmodel->InitTransientOutputx(&transientinput[0],numaveragedinput);
     100                                while(substep<dtslices){ //loop on hydro dts
     101                                        substep+=1;
     102                                        subtime+=subdt;
     103                                        /*Setting substep time as global time*/
     104                                        femmodel->parameters->SetParam(subtime,TimeEnum);
     105                                        if(VerboseSolution()) _printf0_("sub iteration " << substep << "/" << dtslices << "  time [yr]: " << setprecision(4) << subtime/yts << " (time step: " << subdt/yts << ")\n");
     106                                        if(VerboseSolution()) _printf0_("   computing water heads\n");
     107                                        /*save preceding timestep*/
     108                                        InputDuplicatex(femmodel,SedimentHeadSubstepEnum,SedimentHeadOldEnum);
     109                                        if (isefficientlayer){
     110                                                InputDuplicatex(femmodel,EplHeadSubstepEnum,EplHeadOldEnum);
     111                                                InputDuplicatex(femmodel,HydrologydcEplThicknessSubstepEnum,HydrologydcEplThicknessOldEnum);
    117112                                        }
    118                                         /*Reseting to global time*/
    119                                         femmodel->parameters->SetParam(time,TimeEnum);
    120                                         femmodel->AverageSumOutputx(&stackedinput[0],&averagedinput[0],numaveragedinput);
    121                                 }
    122                                 else{
    123                                         /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/
    124                                         numaveragedinput = 2;
    125                                         int inputtostack[2]     =       {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum};
    126                                         int stackedinput[2]     =       {EffectivePressureStackedEnum,SedimentHeadStackedEnum};
    127                                         int averagedinput[2]    =       {EffectivePressureEnum,SedimentHeadEnum};
    128                                         femmodel->InitMeanOutputx(&stackedinput[0],numaveragedinput);
    129                                         while(hydrotime<time-(yts*DBL_EPSILON)){ //loop on hydro dts
    130                                                 hydrostep+=1;
    131                                                 hydrotime+=hydrodt;
    132                                                 /*Setting substep time as global time*/
    133                                                 femmodel->parameters->SetParam(hydrotime,TimeEnum);
    134                                                 if(VerboseSolution()) _printf0_("sub iteration " << hydrostep << "/" << hydroslices << "  time [yr]: " << setprecision(4) << hydrotime/yts << " (time step: " << hydrodt/yts << ")\n");
    135                                                 if(issmb){
    136                                                         if(VerboseSolution()) _printf0_("   computing mass balance\n");
    137                                                         SmbAnalysis* analysis = new SmbAnalysis();
    138                                                         analysis->Core(femmodel);
    139                                                         delete analysis;
    140                                                 }
    141                                                 if(VerboseSolution()) _printf0_("   computing water heads\n");
    142                                                 /*save preceding timestep*/
    143                                                 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum);
    144                                                 /*Proceed now to heads computations*/
    145                                                 solutionsequence_hydro_nonlinear(femmodel);
    146                                                 /*If we have a sub-timestep we stack the variables here*/
    147                                                 femmodel->SumOutputx(&inputtostack[0],&stackedinput[0],numaveragedinput);
    148                                         }
    149                                         /*Reseting to global time*/
    150                                         femmodel->parameters->SetParam(time,TimeEnum);
    151                                         femmodel->AverageSumOutputx(&stackedinput[0],&averagedinput[0],numaveragedinput);
    152                                 }
     113                                        /*Proceed now to heads computations*/
     114                                        solutionsequence_hydro_nonlinear(femmodel);
     115               /*If we have a sub-timestep we store the substep inputs in a transient input here*/
     116                                        femmodel->StackTransientOutputx(&substepinput[0],&transientinput[0],subtime,numaveragedinput);
     117                                }
     118                                /*averaging the stack*/
     119                                femmodel->AverageTransientOutputx(&transientinput[0],&averagedinput[0],global_time-dt,subtime,numaveragedinput);
     120
     121                                /*And reseting to global time*/
     122                                femmodel->parameters->SetParam(dt,TimesteppingTimeStepEnum);
     123                                femmodel->parameters->SetParam(global_time,TimeEnum);
    153124                        }
    154125                        else{
    155                                 if(issmb){
    156                                         if(VerboseSolution()) _printf0_("   computing mass balance\n");
    157                                         SmbAnalysis* analysis = new SmbAnalysis();
    158                                         analysis->Core(femmodel);
    159                                         delete analysis;
    160                                 }
    161                                 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum);
     126                                InputDuplicatex(femmodel,SedimentHeadSubstepEnum,SedimentHeadOldEnum);
    162127                                if (isefficientlayer){
    163                                         InputDuplicatex(femmodel,EplHeadHydrostepEnum,EplHeadOldEnum);
    164                                         InputDuplicatex(femmodel,HydrologydcEplThicknessHydrostepEnum,HydrologydcEplThicknessOldEnum);
     128                                        InputDuplicatex(femmodel,EplHeadSubstepEnum,EplHeadOldEnum);
     129                                        InputDuplicatex(femmodel,HydrologydcEplThicknessSubstepEnum,HydrologydcEplThicknessOldEnum);
    165130                                }
    166131                                /*Proceed now to heads computations*/
    167132                                if(VerboseSolution()) _printf0_("   computing water heads\n");
    168133                                solutionsequence_hydro_nonlinear(femmodel);
     134                                /*If no substeps are present we want to duplicate the results for coupling purposes*/
     135                                InputDuplicatex(femmodel,SedimentHeadSubstepEnum,SedimentHeadEnum);
     136                                InputDuplicatex(femmodel,EffectivePressureSubstepEnum,EffectivePressureEnum);
     137                                if (isefficientlayer){
     138                                        InputDuplicatex(femmodel,EplHeadSubstepEnum,EplHeadEnum);
     139                                        InputDuplicatex(femmodel,HydrologydcEplThicknessSubstepEnum,HydrologydcEplThicknessEnum);
     140                                }
    169141                        }
    170142                }
    171                 else{
    172                         /* If everything is frozen we still need smb */
    173                         if(issmb){
    174                                 if(VerboseSolution()) _printf0_("   computing mass balance\n");
    175                                 SmbAnalysis* analysis = new SmbAnalysis();
    176                                 analysis->Core(femmodel);
    177                                 delete analysis;
    178                         }
    179                 }
     143                if(VerboseSolution()) printf("   hydroDC done\n");
    180144        }
    181145
     
    221185        }
    222186        if(save_results){
    223                 if(VerboseSolution()) _printf0_("   saving results \n");
     187                if(VerboseSolution()) _printf0_("   saving hydrology results \n");
    224188                if(hydrology_model==HydrologydcEnum && ThawedNodes==0){
    225189                        if(VerboseSolution()) _printf0_("   No thawed node hydro is skiped \n");}
    226                 else if (hydrology_model==HydrologydcEnum && issmb){
    227                         femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
    228                         femmodel->RequestedOutputsx(&femmodel->results,requested_smb_outputs,smboutputs);
    229                 }
    230190                else{
    231191                        femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
     
    239199                xDelete<char*>(requested_outputs);
    240200        }
    241         if(issmb){
    242                 if(smboutputs){
    243                         for(int i=0;i<smboutputs;i++){
    244                                 xDelete<char>(requested_smb_outputs[i]);
    245                         }
    246                         xDelete<char*>(requested_smb_outputs);
    247                 }
    248         }
    249201        /*End profiler*/
    250202        femmodel->profiler->Stop(HYDROLOGYCORE);
  • issm/trunk-jpl/src/c/cores/smb_core.cpp

    r23232 r24240  
    11/*!\file: smb_core.cpp
    2  * \brief: core of the smb solution 
    3  */ 
     2 * \brief: core of the smb solution
     3 */
    44
    55#include "./cores.h"
     
    1111
    1212void smb_core(FemModel* femmodel){
    13        
     13
    1414        /*Start profiler*/
    1515        femmodel->profiler->Start(SMBCORE);
    16        
     16
    1717        /*parameters: */
    1818        Analysis* analysis=NULL;
     
    3333        if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SmbRequestedOutputsEnum);
    3434
    35         if(VerboseSolution()) _printf0_("   computing smb \n");
     35        /*sub steping specifics*/
     36        int dtslices;
     37        int numaveragedinput;
     38        femmodel->parameters->FindParam(&dtslices,SmbStepsPerStepEnum);
     39        /*intermiedaries to deal with averaging*/
     40        static const int substeplist[2] = {SmbMassBalanceSubstepEnum,SmbRunoffSubstepEnum};
     41        static const int transientlist[2] = {SmbMassBalanceTransientEnum,SmbRunoffTransientEnum};
     42        static const int averagelist[2] = {SmbMassBalanceEnum,SmbRunoffEnum};
     43        std::vector<int> substepinput;
     44        std::vector<int> transientinput;
     45        std::vector<int> averagedinput;
    3646
    37         analysis = new SmbAnalysis();
    38         analysis->Core(femmodel);
    39         delete analysis;
     47        /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/
     48        if(smb_model==SMBgradientscomponentsEnum){
     49                numaveragedinput = 2;
     50                substepinput.assign(substeplist,substeplist+2);
     51                transientinput.assign(transientlist,transientlist+2);
     52                averagedinput.assign(averagelist,averagelist+2);
     53        }
     54
     55        /*if yes compute necessary intermiedaries and start looping*/
     56        if (dtslices>1){
     57                int        substep;
     58                IssmDouble global_time,subtime,yts;
     59                IssmDouble dt,subdt;
     60
     61                femmodel->parameters->FindParam(&global_time,TimeEnum);
     62                femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
     63                femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
     64
     65                subtime=global_time-dt; //getting the time back to the start of the timestep
     66                subdt=dt/dtslices; //computing substep from dt and a divider
     67                substep=0;
     68                femmodel->parameters->SetParam(subdt,TimesteppingTimeStepEnum);
     69
     70                femmodel->InitTransientOutputx(&transientinput[0],numaveragedinput);
     71                while(substep<dtslices){ //loop on sub dts
     72                        substep+=1;
     73                        subtime+=subdt;
     74                        femmodel->parameters->SetParam(subtime,TimeEnum);
     75         if(VerboseSolution()) _printf0_("sub iteration " << substep << "/" << dtslices << "  time [yr]: " << setprecision(4) << subtime/yts << " (time step: " << subdt/yts << ")\n");
     76         if(VerboseSolution()) _printf0_("   computing smb\n");
     77         analysis = new SmbAnalysis();
     78                        if(VerboseSolution()) _printf0_("   Calling core\n");
     79                        analysis->Core(femmodel);
     80         /*If we have a sub-timestep we store the substep inputs in a transient input here*/
     81         femmodel->StackTransientOutputx(&substepinput[0],&transientinput[0],subtime,numaveragedinput);
     82                        delete analysis;
     83                }
     84      /*averaging the transient input*/
     85                femmodel->AverageTransientOutputx(&transientinput[0],&averagedinput[0],global_time-dt,subtime,numaveragedinput);
     86                /*and reset timesteping variables to original*/
     87                femmodel->parameters->SetParam(global_time,TimeEnum);
     88                femmodel->parameters->SetParam(dt,TimesteppingTimeStepEnum);
     89        }
     90        else{
     91      if(VerboseSolution()) _printf0_("   computing smb \n");
     92      analysis = new SmbAnalysis();
     93                analysis->Core(femmodel);
     94                /*If no substeps are present we want to duplicate the computed substep enum for coupling purposes*/
     95                if(smb_model==SMBgradientscomponentsEnum){
     96                        for(int i=0;i<numaveragedinput;i++){
     97                                InputDuplicatex(femmodel,substepinput[i],averagedinput[i]);
     98                        }
     99                }
     100                delete analysis;
     101        }
    40102
    41103        if(save_results){
    42                 if(VerboseSolution()) _printf0_("   saving results\n");
     104                if(VerboseSolution()) _printf0_("   saving smb results\n");
    43105                femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
    44106        }
  • issm/trunk-jpl/src/c/cores/stressbalance_core.cpp

    r23484 r24240  
    11/*!\file: stressbalance_core.cpp
    2  * \brief: core of the stressbalance solution 
    3  */ 
     2 * \brief: core of the stressbalance solution
     3 */
    44
    55#include "./cores.h"
     
    9191
    9292        if(save_results){
    93                 if(VerboseSolution()) _printf0_("   saving results\n");
     93                if(VerboseSolution()) _printf0_("   saving stressbalance results\n");
    9494                femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
     95                if(VerboseSolution()) _printf0_("   results saved\n");
    9596        }
    9697
    9798        if(solution_type==StressbalanceSolutionEnum && !control_analysis)femmodel->RequestedDependentsx();
    9899
    99         /*Free ressources:*/   
     100        /*Free ressources:*/
    100101        if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
    101102
  • issm/trunk-jpl/src/c/cores/surfaceslope_core.cpp

    r17700 r24240  
    11/*!\file: surfaceslope_core.cpp
    2  * \brief: core of the slope solution 
    3  */ 
     2 * \brief: core of the slope solution
     3 */
    44
    55#include "./cores.h"
     
    3838
    3939        if(save_results){
    40                 if(VerboseSolution()) _printf0_("saving results:\n");
     40                if(VerboseSolution()) _printf0_("saving surface slopes results:\n");
    4141                if(domaintype!=Domain2DverticalEnum){
    4242                        int outputs[2] = {SurfaceSlopeXEnum,SurfaceSlopeYEnum};
  • issm/trunk-jpl/src/c/cores/thermal_core.cpp

    r23228 r24240  
    11/*!\file: thermal_core.cpp
    2  * \brief: core of the thermal solution 
    3  */ 
     2 * \brief: core of the thermal solution
     3 */
    44
    55#include "./cores.h"
     
    1212
    1313void thermal_core(FemModel* femmodel){
    14        
     14
    1515        /*Start profiler*/
    1616        femmodel->profiler->Start(THERMALCORE);
    17        
     17
    1818        /*intermediary*/
    1919        bool   save_results,isenthalpy;
     
    4949
    5050        if(save_results){
    51                 if(VerboseSolution()) _printf0_("   saving results\n");
     51                if(VerboseSolution()) _printf0_("   saving thermal results\n");
    5252                femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
    5353        }
    5454
    55         /*Free ressources:*/   
     55        /*Free ressources:*/
    5656        if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
    57        
     57
    5858        /*End profiler*/
    5959        femmodel->profiler->Stop(THERMALCORE);
  • issm/trunk-jpl/src/c/cores/transient_core.cpp

    r23717 r24240  
    151151                }
    152152                /* Using Hydrology dc  coupled we need to compute smb in the hydrology inner time loop*/
     153                if(issmb) {
     154                        if(VerboseSolution()) _printf0_("   computing smb\n");
     155                        smb_core(femmodel);
     156                }
     157
    153158                if(ishydrology){
     159                        if(VerboseSolution()) _printf0_("   computing hydrology\n");
    154160                        int hydrology_model;
    155161                        hydrology_core(femmodel);
     
    157163                        if(hydrology_model!=HydrologydcEnum && issmb)smb_core(femmodel);
    158164                }
    159                 else{
    160                         if(issmb) smb_core(femmodel);
    161                 }
    162 
    163                 if(isstressbalance && (step%sb_coupling_frequency==0 || step==1) ) stressbalance_core(femmodel);
    164 
    165                 if(isdamageevolution) damage_core(femmodel);
    166 
    167                 if(ismovingfront)       movingfront_core(femmodel);
     165
     166                if(isstressbalance && (step%sb_coupling_frequency==0 || step==1) ) {
     167                        if(VerboseSolution()) _printf0_("   computing stress balance\n");
     168                        stressbalance_core(femmodel);
     169                }
     170
     171                if(isdamageevolution) {
     172                        if(VerboseSolution()) _printf0_("   computing damage\n");
     173                        damage_core(femmodel);
     174                }
     175
     176                if(ismovingfront)       {
     177                        if(VerboseSolution()) _printf0_("   computing moving front\n");
     178                        movingfront_core(femmodel);
     179                }
    168180
    169181                /* from here on, prepare geometry for next time step*/
     
    171183
    172184                if(ismasstransport){
     185                        if(VerboseSolution()) _printf0_("   computing mass transport\n");
    173186                        bmb_core(femmodel);
    174187                        masstransport_core(femmodel);
  • issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

    r24205 r24240  
    182182        HydrologydcRelTolEnum,
    183183        HydrologydcSedimentCompressibilityEnum,
     184        HydrologydcSedimentlimitEnum,
     185        HydrologydcSedimentlimitFlagEnum,
    184186        HydrologydcSedimentPorosityEnum,
    185187        HydrologydcSedimentThicknessEnum,
    186         HydrologydcSedimentlimitEnum,
    187         HydrologydcSedimentlimitFlagEnum,
    188188        HydrologydcTransferFlagEnum,
    189189        HydrologydcUnconfinedFlagEnum,
    190190        HydrologydcWaterCompressibilityEnum,
    191         HydrologydtEnum,
    192191        HydrologyshreveStabilizationEnum,
    193192        IcecapToEarthCommEnum,
     
    331330        SmbAccurefEnum,
    332331        SmbAdThreshEnum,
     332        SmbDesfacEnum,
     333        SmbDpermilEnum,
     334        SmbDsnowIdxEnum,
    333335        SmbCldFracEnum,
    334336        SmbDelta18oEnum,
    335337        SmbDelta18oSurfaceEnum,
    336338        SmbDenIdxEnum,
    337         SmbDesfacEnum,
    338         SmbDpermilEnum,
    339         SmbDsnowIdxEnum,
    340339        SmbDtEnum,
    341340        SmbEnum,
     
    369368        SmbRunoffrefEnum,
    370369        SmbSealevEnum,
     370        SmbStepsPerStepEnum,
    371371        SmbSwIdxEnum,
    372372        SmbT0dryEnum,
     
    494494        DamageFEnum,
    495495        DegreeOfChannelizationEnum,
    496         DepthBelowSurfaceEnum, 
     496        DepthBelowSurfaceEnum,
    497497        DeviatoricStresseffectiveEnum,
    498498        DeviatoricStressxxEnum,
     
    512512        DrivingStressXEnum,
    513513        DrivingStressYEnum,
    514         EffectivePressureEnum,
    515         EffectivePressureHydrostepEnum,
    516         EffectivePressureStackedEnum,
     514   EffectivePressureEnum,
     515        EffectivePressureSubstepEnum,
     516        EffectivePressureTransientEnum,
    517517        EnthalpyEnum,
    518518        EnthalpyPicardEnum,
    519519        EplHeadEnum,
    520         EplHeadHydrostepEnum,
    521         EplHeadOldEnum,
     520   EplHeadOldEnum,
    522521        EplHeadSlopeXEnum,
    523522        EplHeadSlopeYEnum,
    524         EplHeadStackedEnum,
     523        EplHeadSubstepEnum,
     524   EplHeadTransientEnum,
    525525        EsaDeltathicknessEnum,
    526526        EsaEmotionEnum,
     
    564564        HydrologyBumpHeightEnum,
    565565        HydrologyBumpSpacingEnum,
    566         HydrologyDrainageRateEnum,
    567         HydrologyEnglacialInputEnum,
     566        HydrologydcBasalMoulinInputEnum,
     567        HydrologydcEplThicknessEnum,
     568        HydrologydcEplThicknessOldEnum,
     569        HydrologydcEplThicknessSubstepEnum,
     570        HydrologydcEplThicknessTransientEnum,
     571        HydrologydcMaskEplactiveEltEnum,
     572        HydrologydcMaskEplactiveNodeEnum,
     573        HydrologydcMaskThawedEltEnum,
     574        HydrologydcMaskThawedNodeEnum,
     575        HydrologydcSedimentTransmitivityEnum,
     576   HydrologyDrainageRateEnum,
     577   HydrologyEnglacialInputEnum,
    568578        HydrologyGapHeightEnum,
    569579        HydrologyHeadEnum,
     
    575585        HydrologySheetThicknessEnum,
    576586        HydrologySheetThicknessOldEnum,
     587        HydrologyWatercolumnMaxEnum,
    577588        HydrologyWaterVxEnum,
    578589        HydrologyWaterVyEnum,
    579         HydrologyWatercolumnMaxEnum,
    580         HydrologydcBasalMoulinInputEnum,
    581         HydrologydcEplThicknessEnum,
    582         HydrologydcEplThicknessHydrostepEnum,
    583         HydrologydcEplThicknessOldEnum,
    584         HydrologydcEplThicknessStackedEnum,
    585         HydrologydcMaskEplactiveEltEnum,
    586         HydrologydcMaskEplactiveNodeEnum,
    587         HydrologydcMaskThawedEltEnum,
    588         HydrologydcMaskThawedNodeEnum,
    589         HydrologydcSedimentTransmitivityEnum,
    590590        IceEnum,
    591591        IceMaskNodeActivationEnum,
     
    628628        P1Enum,
    629629        PressureEnum,
    630         RadarEnum, 
    631         RadarAttenuationMacGregorEnum, 
     630        RadarEnum,
     631        RadarAttenuationMacGregorEnum,
    632632        RadarAttenuationWolffEnum,
    633         RadarIcePeriodEnum, 
     633        RadarIcePeriodEnum,
    634634        RadarPowerMacGregorEnum,
    635         RadarPowerWolffEnum, 
     635        RadarPowerWolffEnum,
    636636        RheologyBAbsGradientEnum,
    637637        RheologyBInitialguessEnum,
     
    659659        SealevelriseSpcthicknessEnum,
    660660        SealevelriseStericRateEnum,
    661         SedimentHeadEnum,
    662         SedimentHeadHydrostepEnum,
    663         SedimentHeadOldEnum,
     661   SedimentHeadEnum,
     662   SedimentHeadOldEnum,
     663        SedimentHeadSubstepEnum,
     664        SedimentHeadTransientEnum,
    664665        SedimentHeadResidualEnum,
    665666        SedimentHeadStackedEnum,
     
    708709        SmbMassBalanceClimateEnum,
    709710        SmbMassBalanceEnum,
     711   SmbMassBalanceSubstepEnum,
     712   SmbMassBalanceTransientEnum,
    710713        SmbMeanLHFEnum,
    711714        SmbMeanSHFEnum,
     
    728731        SmbReiniEnum,
    729732        SmbRunoffEnum,
     733   SmbRunoffSubstepEnum,
     734   SmbRunoffTransientEnum,
    730735        SmbS0gcmEnum,
    731736        SmbS0pEnum,
     
    941946        BasalforcingsIsmip6Enum,
    942947        BasalforcingsPicoEnum,
    943         BeckmannGoosseFloatingMeltRateEnum,     
     948        BeckmannGoosseFloatingMeltRateEnum,
    944949        BedSlopeSolutionEnum,
    945950        BoolExternalResultEnum,
  • issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

    r24205 r24240  
    190190                case HydrologydcRelTolEnum : return "HydrologydcRelTol";
    191191                case HydrologydcSedimentCompressibilityEnum : return "HydrologydcSedimentCompressibility";
     192                case HydrologydcSedimentlimitEnum : return "HydrologydcSedimentlimit";
     193                case HydrologydcSedimentlimitFlagEnum : return "HydrologydcSedimentlimitFlag";
    192194                case HydrologydcSedimentPorosityEnum : return "HydrologydcSedimentPorosity";
    193195                case HydrologydcSedimentThicknessEnum : return "HydrologydcSedimentThickness";
    194                 case HydrologydcSedimentlimitEnum : return "HydrologydcSedimentlimit";
    195                 case HydrologydcSedimentlimitFlagEnum : return "HydrologydcSedimentlimitFlag";
    196196                case HydrologydcTransferFlagEnum : return "HydrologydcTransferFlag";
    197197                case HydrologydcUnconfinedFlagEnum : return "HydrologydcUnconfinedFlag";
    198198                case HydrologydcWaterCompressibilityEnum : return "HydrologydcWaterCompressibility";
    199                 case HydrologydtEnum : return "Hydrologydt";
    200199                case HydrologyshreveStabilizationEnum : return "HydrologyshreveStabilization";
    201200                case IcecapToEarthCommEnum : return "IcecapToEarthComm";
     
    339338                case SmbAccurefEnum : return "SmbAccuref";
    340339                case SmbAdThreshEnum : return "SmbAdThresh";
     340                case SmbDesfacEnum : return "SmbDesfac";
     341                case SmbDpermilEnum : return "SmbDpermil";
     342                case SmbDsnowIdxEnum : return "SmbDsnowIdx";
    341343                case SmbCldFracEnum : return "SmbCldFrac";
    342344                case SmbDelta18oEnum : return "SmbDelta18o";
    343345                case SmbDelta18oSurfaceEnum : return "SmbDelta18oSurface";
    344346                case SmbDenIdxEnum : return "SmbDenIdx";
    345                 case SmbDesfacEnum : return "SmbDesfac";
    346                 case SmbDpermilEnum : return "SmbDpermil";
    347                 case SmbDsnowIdxEnum : return "SmbDsnowIdx";
    348347                case SmbDtEnum : return "SmbDt";
    349348                case SmbEnum : return "Smb";
     
    377376                case SmbRunoffrefEnum : return "SmbRunoffref";
    378377                case SmbSealevEnum : return "SmbSealev";
     378                case SmbStepsPerStepEnum : return "SmbStepsPerStep";
    379379                case SmbSwIdxEnum : return "SmbSwIdx";
    380380                case SmbT0dryEnum : return "SmbT0dry";
     
    519519                case DrivingStressYEnum : return "DrivingStressY";
    520520                case EffectivePressureEnum : return "EffectivePressure";
    521                 case EffectivePressureHydrostepEnum : return "EffectivePressureHydrostep";
    522                 case EffectivePressureStackedEnum : return "EffectivePressureStacked";
     521                case EffectivePressureSubstepEnum : return "EffectivePressureSubstep";
     522                case EffectivePressureTransientEnum : return "EffectivePressureTransient";
    523523                case EnthalpyEnum : return "Enthalpy";
    524524                case EnthalpyPicardEnum : return "EnthalpyPicard";
    525525                case EplHeadEnum : return "EplHead";
    526                 case EplHeadHydrostepEnum : return "EplHeadHydrostep";
    527526                case EplHeadOldEnum : return "EplHeadOld";
    528527                case EplHeadSlopeXEnum : return "EplHeadSlopeX";
    529528                case EplHeadSlopeYEnum : return "EplHeadSlopeY";
    530                 case EplHeadStackedEnum : return "EplHeadStacked";
     529                case EplHeadSubstepEnum : return "EplHeadSubstep";
     530                case EplHeadTransientEnum : return "EplHeadTransient";
    531531                case EsaDeltathicknessEnum : return "EsaDeltathickness";
    532532                case EsaEmotionEnum : return "EsaEmotion";
     
    570570                case HydrologyBumpHeightEnum : return "HydrologyBumpHeight";
    571571                case HydrologyBumpSpacingEnum : return "HydrologyBumpSpacing";
     572                case HydrologydcBasalMoulinInputEnum : return "HydrologydcBasalMoulinInput";
     573                case HydrologydcEplThicknessEnum : return "HydrologydcEplThickness";
     574                case HydrologydcEplThicknessOldEnum : return "HydrologydcEplThicknessOld";
     575                case HydrologydcEplThicknessSubstepEnum : return "HydrologydcEplThicknessSubstep";
     576                case HydrologydcEplThicknessTransientEnum : return "HydrologydcEplThicknessTransient";
     577                case HydrologydcMaskEplactiveEltEnum : return "HydrologydcMaskEplactiveElt";
     578                case HydrologydcMaskEplactiveNodeEnum : return "HydrologydcMaskEplactiveNode";
     579                case HydrologydcMaskThawedEltEnum : return "HydrologydcMaskThawedElt";
     580                case HydrologydcMaskThawedNodeEnum : return "HydrologydcMaskThawedNode";
     581                case HydrologydcSedimentTransmitivityEnum : return "HydrologydcSedimentTransmitivity";
    572582                case HydrologyDrainageRateEnum : return "HydrologyDrainageRate";
    573583                case HydrologyEnglacialInputEnum : return "HydrologyEnglacialInput";
     
    581591                case HydrologySheetThicknessEnum : return "HydrologySheetThickness";
    582592                case HydrologySheetThicknessOldEnum : return "HydrologySheetThicknessOld";
     593                case HydrologyWatercolumnMaxEnum : return "HydrologyWatercolumnMax";
    583594                case HydrologyWaterVxEnum : return "HydrologyWaterVx";
    584595                case HydrologyWaterVyEnum : return "HydrologyWaterVy";
    585                 case HydrologyWatercolumnMaxEnum : return "HydrologyWatercolumnMax";
    586                 case HydrologydcBasalMoulinInputEnum : return "HydrologydcBasalMoulinInput";
    587                 case HydrologydcEplThicknessEnum : return "HydrologydcEplThickness";
    588                 case HydrologydcEplThicknessHydrostepEnum : return "HydrologydcEplThicknessHydrostep";
    589                 case HydrologydcEplThicknessOldEnum : return "HydrologydcEplThicknessOld";
    590                 case HydrologydcEplThicknessStackedEnum : return "HydrologydcEplThicknessStacked";
    591                 case HydrologydcMaskEplactiveEltEnum : return "HydrologydcMaskEplactiveElt";
    592                 case HydrologydcMaskEplactiveNodeEnum : return "HydrologydcMaskEplactiveNode";
    593                 case HydrologydcMaskThawedEltEnum : return "HydrologydcMaskThawedElt";
    594                 case HydrologydcMaskThawedNodeEnum : return "HydrologydcMaskThawedNode";
    595                 case HydrologydcSedimentTransmitivityEnum : return "HydrologydcSedimentTransmitivity";
    596596                case IceEnum : return "Ice";
    597597                case IceMaskNodeActivationEnum : return "IceMaskNodeActivation";
     
    666666                case SealevelriseStericRateEnum : return "SealevelriseStericRate";
    667667                case SedimentHeadEnum : return "SedimentHead";
    668                 case SedimentHeadHydrostepEnum : return "SedimentHeadHydrostep";
    669668                case SedimentHeadOldEnum : return "SedimentHeadOld";
     669                case SedimentHeadSubstepEnum : return "SedimentHeadSubstep";
     670                case SedimentHeadTransientEnum : return "SedimentHeadTransient";
    670671                case SedimentHeadResidualEnum : return "SedimentHeadResidual";
    671672                case SedimentHeadStackedEnum : return "SedimentHeadStacked";
     
    714715                case SmbMassBalanceClimateEnum : return "SmbMassBalanceClimate";
    715716                case SmbMassBalanceEnum : return "SmbMassBalance";
     717                case SmbMassBalanceSubstepEnum : return "SmbMassBalanceSubstep";
     718                case SmbMassBalanceTransientEnum : return "SmbMassBalanceTransient";
    716719                case SmbMeanLHFEnum : return "SmbMeanLHF";
    717720                case SmbMeanSHFEnum : return "SmbMeanSHF";
     
    734737                case SmbReiniEnum : return "SmbReini";
    735738                case SmbRunoffEnum : return "SmbRunoff";
     739                case SmbRunoffSubstepEnum : return "SmbRunoffSubstep";
     740                case SmbRunoffTransientEnum : return "SmbRunoffTransient";
    736741                case SmbS0gcmEnum : return "SmbS0gcm";
    737742                case SmbS0pEnum : return "SmbS0p";
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r24205 r24240  
    193193              else if (strcmp(name,"HydrologydcRelTol")==0) return HydrologydcRelTolEnum;
    194194              else if (strcmp(name,"HydrologydcSedimentCompressibility")==0) return HydrologydcSedimentCompressibilityEnum;
     195              else if (strcmp(name,"HydrologydcSedimentlimit")==0) return HydrologydcSedimentlimitEnum;
     196              else if (strcmp(name,"HydrologydcSedimentlimitFlag")==0) return HydrologydcSedimentlimitFlagEnum;
    195197              else if (strcmp(name,"HydrologydcSedimentPorosity")==0) return HydrologydcSedimentPorosityEnum;
    196198              else if (strcmp(name,"HydrologydcSedimentThickness")==0) return HydrologydcSedimentThicknessEnum;
    197               else if (strcmp(name,"HydrologydcSedimentlimit")==0) return HydrologydcSedimentlimitEnum;
    198               else if (strcmp(name,"HydrologydcSedimentlimitFlag")==0) return HydrologydcSedimentlimitFlagEnum;
    199199              else if (strcmp(name,"HydrologydcTransferFlag")==0) return HydrologydcTransferFlagEnum;
    200200              else if (strcmp(name,"HydrologydcUnconfinedFlag")==0) return HydrologydcUnconfinedFlagEnum;
    201201              else if (strcmp(name,"HydrologydcWaterCompressibility")==0) return HydrologydcWaterCompressibilityEnum;
    202               else if (strcmp(name,"Hydrologydt")==0) return HydrologydtEnum;
    203202              else if (strcmp(name,"HydrologyshreveStabilization")==0) return HydrologyshreveStabilizationEnum;
    204203              else if (strcmp(name,"IcecapToEarthComm")==0) return IcecapToEarthCommEnum;
     
    260259              else if (strcmp(name,"MaterialsLithosphereShearModulus")==0) return MaterialsLithosphereShearModulusEnum;
    261260              else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;
     261              else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
    262262         else stage=3;
    263263   }
    264264   if(stage==3){
    265               if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
    266               else if (strcmp(name,"MaterialsMeltingpoint")==0) return MaterialsMeltingpointEnum;
     265              if (strcmp(name,"MaterialsMeltingpoint")==0) return MaterialsMeltingpointEnum;
    267266              else if (strcmp(name,"MaterialsMixedLayerCapacity")==0) return MaterialsMixedLayerCapacityEnum;
    268267              else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum;
     
    345344              else if (strcmp(name,"SmbAccuref")==0) return SmbAccurefEnum;
    346345              else if (strcmp(name,"SmbAdThresh")==0) return SmbAdThreshEnum;
     346              else if (strcmp(name,"SmbDesfac")==0) return SmbDesfacEnum;
     347              else if (strcmp(name,"SmbDpermil")==0) return SmbDpermilEnum;
     348              else if (strcmp(name,"SmbDsnowIdx")==0) return SmbDsnowIdxEnum;
    347349              else if (strcmp(name,"SmbCldFrac")==0) return SmbCldFracEnum;
    348350              else if (strcmp(name,"SmbDelta18o")==0) return SmbDelta18oEnum;
    349351              else if (strcmp(name,"SmbDelta18oSurface")==0) return SmbDelta18oSurfaceEnum;
    350352              else if (strcmp(name,"SmbDenIdx")==0) return SmbDenIdxEnum;
    351               else if (strcmp(name,"SmbDesfac")==0) return SmbDesfacEnum;
    352               else if (strcmp(name,"SmbDpermil")==0) return SmbDpermilEnum;
    353               else if (strcmp(name,"SmbDsnowIdx")==0) return SmbDsnowIdxEnum;
    354353              else if (strcmp(name,"SmbDt")==0) return SmbDtEnum;
    355354              else if (strcmp(name,"Smb")==0) return SmbEnum;
     
    383382              else if (strcmp(name,"SmbRunoffref")==0) return SmbRunoffrefEnum;
    384383              else if (strcmp(name,"SmbSealev")==0) return SmbSealevEnum;
     384              else if (strcmp(name,"SmbStepsPerStep")==0) return SmbStepsPerStepEnum;
    385385         else stage=4;
    386386   }
     
    531531              else if (strcmp(name,"DrivingStressY")==0) return DrivingStressYEnum;
    532532              else if (strcmp(name,"EffectivePressure")==0) return EffectivePressureEnum;
    533               else if (strcmp(name,"EffectivePressureHydrostep")==0) return EffectivePressureHydrostepEnum;
    534               else if (strcmp(name,"EffectivePressureStacked")==0) return EffectivePressureStackedEnum;
     533              else if (strcmp(name,"EffectivePressureSubstep")==0) return EffectivePressureSubstepEnum;
     534              else if (strcmp(name,"EffectivePressureTransient")==0) return EffectivePressureTransientEnum;
    535535              else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
    536536              else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
    537537              else if (strcmp(name,"EplHead")==0) return EplHeadEnum;
    538               else if (strcmp(name,"EplHeadHydrostep")==0) return EplHeadHydrostepEnum;
    539538              else if (strcmp(name,"EplHeadOld")==0) return EplHeadOldEnum;
    540539              else if (strcmp(name,"EplHeadSlopeX")==0) return EplHeadSlopeXEnum;
    541540              else if (strcmp(name,"EplHeadSlopeY")==0) return EplHeadSlopeYEnum;
    542               else if (strcmp(name,"EplHeadStacked")==0) return EplHeadStackedEnum;
     541              else if (strcmp(name,"EplHeadSubstep")==0) return EplHeadSubstepEnum;
     542              else if (strcmp(name,"EplHeadTransient")==0) return EplHeadTransientEnum;
    543543              else if (strcmp(name,"EsaDeltathickness")==0) return EsaDeltathicknessEnum;
    544544              else if (strcmp(name,"EsaEmotion")==0) return EsaEmotionEnum;
     
    582582              else if (strcmp(name,"HydrologyBumpHeight")==0) return HydrologyBumpHeightEnum;
    583583              else if (strcmp(name,"HydrologyBumpSpacing")==0) return HydrologyBumpSpacingEnum;
     584              else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
     585              else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
     586              else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
     587              else if (strcmp(name,"HydrologydcEplThicknessSubstep")==0) return HydrologydcEplThicknessSubstepEnum;
     588              else if (strcmp(name,"HydrologydcEplThicknessTransient")==0) return HydrologydcEplThicknessTransientEnum;
     589              else if (strcmp(name,"HydrologydcMaskEplactiveElt")==0) return HydrologydcMaskEplactiveEltEnum;
     590              else if (strcmp(name,"HydrologydcMaskEplactiveNode")==0) return HydrologydcMaskEplactiveNodeEnum;
     591              else if (strcmp(name,"HydrologydcMaskThawedElt")==0) return HydrologydcMaskThawedEltEnum;
     592              else if (strcmp(name,"HydrologydcMaskThawedNode")==0) return HydrologydcMaskThawedNodeEnum;
     593              else if (strcmp(name,"HydrologydcSedimentTransmitivity")==0) return HydrologydcSedimentTransmitivityEnum;
    584594              else if (strcmp(name,"HydrologyDrainageRate")==0) return HydrologyDrainageRateEnum;
    585595              else if (strcmp(name,"HydrologyEnglacialInput")==0) return HydrologyEnglacialInputEnum;
     
    593603              else if (strcmp(name,"HydrologySheetThickness")==0) return HydrologySheetThicknessEnum;
    594604              else if (strcmp(name,"HydrologySheetThicknessOld")==0) return HydrologySheetThicknessOldEnum;
     605              else if (strcmp(name,"HydrologyWatercolumnMax")==0) return HydrologyWatercolumnMaxEnum;
    595606              else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
    596607              else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
    597               else if (strcmp(name,"HydrologyWatercolumnMax")==0) return HydrologyWatercolumnMaxEnum;
    598               else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
    599               else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
    600               else if (strcmp(name,"HydrologydcEplThicknessHydrostep")==0) return HydrologydcEplThicknessHydrostepEnum;
    601               else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
    602               else if (strcmp(name,"HydrologydcEplThicknessStacked")==0) return HydrologydcEplThicknessStackedEnum;
    603               else if (strcmp(name,"HydrologydcMaskEplactiveElt")==0) return HydrologydcMaskEplactiveEltEnum;
    604               else if (strcmp(name,"HydrologydcMaskEplactiveNode")==0) return HydrologydcMaskEplactiveNodeEnum;
    605               else if (strcmp(name,"HydrologydcMaskThawedElt")==0) return HydrologydcMaskThawedEltEnum;
    606               else if (strcmp(name,"HydrologydcMaskThawedNode")==0) return HydrologydcMaskThawedNodeEnum;
    607               else if (strcmp(name,"HydrologydcSedimentTransmitivity")==0) return HydrologydcSedimentTransmitivityEnum;
    608608              else if (strcmp(name,"Ice")==0) return IceEnum;
    609609              else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
     
    681681              else if (strcmp(name,"SealevelriseStericRate")==0) return SealevelriseStericRateEnum;
    682682              else if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
    683               else if (strcmp(name,"SedimentHeadHydrostep")==0) return SedimentHeadHydrostepEnum;
    684683              else if (strcmp(name,"SedimentHeadOld")==0) return SedimentHeadOldEnum;
     684              else if (strcmp(name,"SedimentHeadSubstep")==0) return SedimentHeadSubstepEnum;
     685              else if (strcmp(name,"SedimentHeadTransient")==0) return SedimentHeadTransientEnum;
    685686              else if (strcmp(name,"SedimentHeadResidual")==0) return SedimentHeadResidualEnum;
    686687              else if (strcmp(name,"SedimentHeadStacked")==0) return SedimentHeadStackedEnum;
     
    729730              else if (strcmp(name,"SmbMassBalanceClimate")==0) return SmbMassBalanceClimateEnum;
    730731              else if (strcmp(name,"SmbMassBalance")==0) return SmbMassBalanceEnum;
     732              else if (strcmp(name,"SmbMassBalanceSubstep")==0) return SmbMassBalanceSubstepEnum;
     733              else if (strcmp(name,"SmbMassBalanceTransient")==0) return SmbMassBalanceTransientEnum;
    731734              else if (strcmp(name,"SmbMeanLHF")==0) return SmbMeanLHFEnum;
    732735              else if (strcmp(name,"SmbMeanSHF")==0) return SmbMeanSHFEnum;
     
    749752              else if (strcmp(name,"SmbReini")==0) return SmbReiniEnum;
    750753              else if (strcmp(name,"SmbRunoff")==0) return SmbRunoffEnum;
     754         else stage=7;
     755   }
     756   if(stage==7){
     757              if (strcmp(name,"SmbRunoffSubstep")==0) return SmbRunoffSubstepEnum;
     758              else if (strcmp(name,"SmbRunoffTransient")==0) return SmbRunoffTransientEnum;
    751759              else if (strcmp(name,"SmbS0gcm")==0) return SmbS0gcmEnum;
    752760              else if (strcmp(name,"SmbS0p")==0) return SmbS0pEnum;
    753761              else if (strcmp(name,"SmbS0t")==0) return SmbS0tEnum;
    754          else stage=7;
    755    }
    756    if(stage==7){
    757               if (strcmp(name,"SmbSizeini")==0) return SmbSizeiniEnum;
     762              else if (strcmp(name,"SmbSizeini")==0) return SmbSizeiniEnum;
    758763              else if (strcmp(name,"SmbSmbCorr")==0) return SmbSmbCorrEnum;
    759764              else if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum;
     
    870875              else if (strcmp(name,"Outputdefinition37")==0) return Outputdefinition37Enum;
    871876              else if (strcmp(name,"Outputdefinition38")==0) return Outputdefinition38Enum;
    872               else if (strcmp(name,"Outputdefinition39")==0) return Outputdefinition39Enum;
     877         else stage=8;
     878   }
     879   if(stage==8){
     880              if (strcmp(name,"Outputdefinition39")==0) return Outputdefinition39Enum;
    873881              else if (strcmp(name,"Outputdefinition3")==0) return Outputdefinition3Enum;
    874882              else if (strcmp(name,"Outputdefinition40")==0) return Outputdefinition40Enum;
    875883              else if (strcmp(name,"Outputdefinition41")==0) return Outputdefinition41Enum;
    876884              else if (strcmp(name,"Outputdefinition42")==0) return Outputdefinition42Enum;
    877          else stage=8;
    878    }
    879    if(stage==8){
    880               if (strcmp(name,"Outputdefinition43")==0) return Outputdefinition43Enum;
     885              else if (strcmp(name,"Outputdefinition43")==0) return Outputdefinition43Enum;
    881886              else if (strcmp(name,"Outputdefinition44")==0) return Outputdefinition44Enum;
    882887              else if (strcmp(name,"Outputdefinition45")==0) return Outputdefinition45Enum;
     
    993998              else if (strcmp(name,"ControlInputMaxs")==0) return ControlInputMaxsEnum;
    994999              else if (strcmp(name,"ControlInputMins")==0) return ControlInputMinsEnum;
    995               else if (strcmp(name,"ControlInputValues")==0) return ControlInputValuesEnum;
     1000         else stage=9;
     1001   }
     1002   if(stage==9){
     1003              if (strcmp(name,"ControlInputValues")==0) return ControlInputValuesEnum;
    9961004              else if (strcmp(name,"CrouzeixRaviart")==0) return CrouzeixRaviartEnum;
    9971005              else if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
    9981006              else if (strcmp(name,"CuffeyTemperate")==0) return CuffeyTemperateEnum;
    9991007              else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum;
    1000          else stage=9;
    1001    }
    1002    if(stage==9){
    1003               if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
     1008              else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum;
    10041009              else if (strcmp(name,"DataSet")==0) return DataSetEnum;
    10051010              else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
     
    11161121              else if (strcmp(name,"LoveHi")==0) return LoveHiEnum;
    11171122              else if (strcmp(name,"LoveHr")==0) return LoveHrEnum;
    1118               else if (strcmp(name,"LoveKernelsImag")==0) return LoveKernelsImagEnum;
     1123         else stage=10;
     1124   }
     1125   if(stage==10){
     1126              if (strcmp(name,"LoveKernelsImag")==0) return LoveKernelsImagEnum;
    11191127              else if (strcmp(name,"LoveKernelsReal")==0) return LoveKernelsRealEnum;
    11201128              else if (strcmp(name,"LoveKi")==0) return LoveKiEnum;
    11211129              else if (strcmp(name,"LoveKr")==0) return LoveKrEnum;
    11221130              else if (strcmp(name,"LoveLi")==0) return LoveLiEnum;
    1123          else stage=10;
    1124    }
    1125    if(stage==10){
    1126               if (strcmp(name,"LoveLr")==0) return LoveLrEnum;
     1131              else if (strcmp(name,"LoveLr")==0) return LoveLrEnum;
    11271132              else if (strcmp(name,"LoveSolution")==0) return LoveSolutionEnum;
    11281133              else if (strcmp(name,"MINI")==0) return MINIEnum;
     
    12391244              else if (strcmp(name,"Segment")==0) return SegmentEnum;
    12401245              else if (strcmp(name,"SegmentRiftfront")==0) return SegmentRiftfrontEnum;
    1241               else if (strcmp(name,"Separate")==0) return SeparateEnum;
     1246         else stage=11;
     1247   }
     1248   if(stage==11){
     1249              if (strcmp(name,"Separate")==0) return SeparateEnum;
    12421250              else if (strcmp(name,"Seq")==0) return SeqEnum;
    12431251              else if (strcmp(name,"SmbAnalysis")==0) return SmbAnalysisEnum;
    12441252              else if (strcmp(name,"SmbSolution")==0) return SmbSolutionEnum;
    12451253              else if (strcmp(name,"SmoothAnalysis")==0) return SmoothAnalysisEnum;
    1246          else stage=11;
    1247    }
    1248    if(stage==11){
    1249               if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
     1254              else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
    12501255              else if (strcmp(name,"SpatialLinearFloatingMeltRate")==0) return SpatialLinearFloatingMeltRateEnum;
    12511256              else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum;
  • issm/trunk-jpl/src/c/shared/Enum/Synchronize.sh

    r24017 r24240  
    66
    77#Removed existing files
    8 rm $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
    9 rm $ISSM_DIR/src/c/shared/Enum/StringToEnumx.cpp
     8rm $ISSM_DEV_DIR/src/c/shared/Enum/EnumToStringx.cpp
     9rm $ISSM_DEV_DIR/src/c/shared/Enum/StringToEnumx.cpp
    1010
    1111#Get number of enums
     
    1616#Build EnumToAnalysis.cpp {{{
    1717#Header
    18 cat <<END > $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
     18cat <<END > $ISSM_DEV_DIR/src/c/analyses/EnumToAnalysis.cpp
    1919/*
    2020* \file EnumToAnalysis.cpp
     
    3737        grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
    3838        awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
    39                 >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
     39                >> $ISSM_DEV_DIR/src/c/analyses/EnumToAnalysis.cpp
    4040
    4141#Footer
    42 cat <<END >> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
     42cat <<END >> $ISSM_DEV_DIR/src/c/analyses/EnumToAnalysis.cpp
    4343                default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
    4444        }
     
    4848#Build analyses.m4{{{
    4949#Header
    50 cat <<END > $ISSM_DIR/m4/analyses.m4
     50cat <<END > $ISSM_DEV_DIR/m4/analyses.m4
    5151
    5252dnl   WARNING: DO NOT MODIFY THIS FILE
     
    7878AC_MSG_RESULT($HAVE_" toupper($1)")\n\
    7979dnl }}}"}' \
    80         >> $ISSM_DIR/m4/analyses.m4
     80        >> $ISSM_DEV_DIR/m4/analyses.m4
    8181
    8282#Footer
    83 cat <<END >> $ISSM_DIR/m4/analyses.m4
     83cat <<END >> $ISSM_DEV_DIR/m4/analyses.m4
    8484
    8585])
     
    9191#Build EnumToStringx.cpp {{{
    9292#Header
    93 cat <<END >  $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
     93cat <<END >  $ISSM_DEV_DIR/src/c/shared/Enum/EnumToStringx.cpp
    9494/*
    9595* \file EnumToStringx.cpp:
     
    112112END
    113113#core
    114 cat temp |  awk '{print "\t\t" "case " $1" : return \"" substr($1,1,length($1)-4) "\";"}' >> $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
     114cat temp |  awk '{print "\t\t" "case " $1" : return \"" substr($1,1,length($1)-4) "\";"}' >> $ISSM_DEV_DIR/src/c/shared/Enum/EnumToStringx.cpp
    115115#Footer
    116 cat <<END >> $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
     116cat <<END >> $ISSM_DEV_DIR/src/c/shared/Enum/EnumToStringx.cpp
    117117                default : return "unknown";
    118118
     
    144144#Build StringToEnumx.cpp {{{
    145145#Header
    146 cat <<END > $ISSM_DIR/src/c/shared/Enum/StringToEnumx.cpp
     146cat <<END > $ISSM_DEV_DIR/src/c/shared/Enum/StringToEnumx.cpp
    147147/*
    148148* \file StringToEnumx.cpp:
     
    168168i2=120;
    169169for (( i=1 ; i<=100 ; i++ )); do
    170         echo "   if(stage==$i){" >> $ISSM_DIR//src/c/shared/Enum/StringToEnumx.cpp
     170        echo "   if(stage==$i){" >> $ISSM_DEV_DIR//src/c/shared/Enum/StringToEnumx.cpp
    171171        awk -v i1=$i1 -v i2=$i2 '{if(NR>=i1 && NR<=i2) print $0 }' temp |
    172         awk '{print "\t" ((NR==1)?"      if":"      else if") " (strcmp(name,\"" substr($1,1,length($1)-4) "\")==0) return " $1 ";"}' >> $ISSM_DIR//src/c/shared/Enum/StringToEnumx.cpp
    173         echo "         else stage=$(($i+1));" >> $ISSM_DIR//src/c/shared/Enum/StringToEnumx.cpp
    174         echo "   }" >> $ISSM_DIR//src/c/shared/Enum/StringToEnumx.cpp
    175        
     172        awk '{print "\t" ((NR==1)?"      if":"      else if") " (strcmp(name,\"" substr($1,1,length($1)-4) "\")==0) return " $1 ";"}' >> $ISSM_DEV_DIR//src/c/shared/Enum/StringToEnumx.cpp
     173        echo "         else stage=$(($i+1));" >> $ISSM_DEV_DIR//src/c/shared/Enum/StringToEnumx.cpp
     174        echo "   }" >> $ISSM_DEV_DIR//src/c/shared/Enum/StringToEnumx.cpp
     175
    176176        if [ $i2 -ge $NUMENUMS ]; then break; fi
    177177        let i1=$i1+120
     
    180180
    181181#footer
    182 cat <<END >> $ISSM_DIR/src/c/shared/Enum/StringToEnumx.cpp
     182cat <<END >> $ISSM_DEV_DIR/src/c/shared/Enum/StringToEnumx.cpp
    183183        /*If we reach this point, the string provided has not been found*/
    184184        if(notfounderror)
  • issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp

    r23643 r24240  
    8383
    8484        _assert_(this->vector);
    85         VecAssemblyBegin(this->vector); 
     85        VecAssemblyBegin(this->vector);
    8686        VecAssemblyEnd(this->vector);
    8787
     
    135135
    136136        /*Get Ownership range*/
    137         PetscInt lower_row,upper_row; 
     137        PetscInt lower_row,upper_row;
    138138        VecGetOwnershipRange(this->vector,&lower_row,&upper_row);
    139         int range=upper_row-lower_row;   
     139        int range=upper_row-lower_row;
    140140
    141141        /*return NULL if no range*/
     
    147147
    148148        /*Build indices*/
    149         int* indices=xNew<int>(range); 
     149        int* indices=xNew<int>(range);
    150150        for(int i=0;i<range;i++) indices[i]=lower_row+i;
    151151        /*Get vector*/
    152152        IssmDouble* values =xNew<IssmDouble>(range);
    153         VecGetValues(this->vector,range,indices,values); 
     153        VecGetValues(this->vector,range,indices,values);
    154154
    155155        *pvector  = values;
     
    238238
    239239        _assert_(this->vector);
    240         VecScale(this->vector,scale_factor);
     240        VecScale(this->vector,scale_factor);
     241
     242}
     243/*}}}*/
     244void PetscVec::Pow(IssmDouble scale_factor){/*{{{*/
     245
     246        _assert_(this->vector);
     247        VecPow(this->vector,scale_factor);
    241248
    242249}
     
    258265}
    259266/*}}}*/
     267void PetscVec::PointwiseMult(PetscVec* x,PetscVec* y){/*{{{*/
     268
     269        _assert_(this->vector);
     270        VecPointwiseMult(this->vector,x->vector,y->vector);
     271
     272}
     273/*}}}*/
  • issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h

    r23643 r24240  
    11/*!\file:  PetscVec.h
    2  * \brief wrapper to our own PetscVec object, which is needed to add AD capabilities (using ADOLC) 
    3  * to a C-coded Petsc API. We are just wrapping the Petsc objects into C++ equivalent, so that 
     2 * \brief wrapper to our own PetscVec object, which is needed to add AD capabilities (using ADOLC)
     3 * to a C-coded Petsc API. We are just wrapping the Petsc objects into C++ equivalent, so that
    44 * later, we can map all of the Petsc routines into Adolc equivalents.
    5  */ 
     5 */
    66
    77#ifndef _PETSCVEC_H_
     
    5757                IssmDouble  Max(void);
    5858                void        Scale(IssmDouble scale_factor);
     59                void        Pow(IssmDouble scale_factor);
    5960                void        PointwiseDivide(PetscVec* x,PetscVec* y);
     61                void        PointwiseMult(PetscVec* x,PetscVec* y);
    6062                IssmDouble  Dot(PetscVec* vector);
    6163};
  • issm/trunk-jpl/src/m/archive/arch.py

    r24213 r24240  
    88    """
    99    ARCHWRITE - Write data to a field, given the file name, field name, and data.
    10 
    1110        Usage:
    1211            archwrite('archive101.arch', 'variable_name', data)
    1312    """
     13
    1414    nargs = len(args)
    1515    if nargs % 2 != 0:
     
    2323    except IOError as e:
    2424        raise IOError("archwrite error: could not open '{}' to write to due to:".format(filename), e)
    25 
    2625    nfields = len(args) / 2
    2726    # generate data to write
    28     for i in range(nfields):
     27    for i in range(int(nfields)):
    2928        # write field name
    3029        name = args[2 * i]
    3130        write_field_name(fid, name)
    32 
    3331        # write data associated with field name
    3432        data = args[2 * i + 1]
     
    4240        else:
    4341            raise ValueError("archwrite : error writing data, invalid code entered '{}'".format(code))
    44 
    4542    fid.close()
    46 
    4743    # }}}
    4844
     
    6460
    6561    archive_results = []
    66 
    6762    # read first result
    6863    result = read_field(fid)
    69 
    7064    while result:
    7165        if fieldname == result['field_name']:
     
    7367            archive_results = result['data']  # we only want the data
    7468            break
    75 
    7669    # read next result
    7770        result = read_field(fid)
    78 
    7971    # close file
    8072    fid.close()
    81 
    8273    return archive_results
    8374    # }}}
     
    9889    except IOError as e:
    9990        raise IOError("archread error : could not open file '{}' to read from due to ".format(filename), e)
    100 
    10191    print('Source file: ')
    10292    print(('\t{0}'.format(filename)))
    10393    print('Variables: ')
    104 
    10594    result = read_field(fid)
    10695    while result:
     
    11099    # go to next result
    111100        result = read_field(fid)
    112 
    113101    # close file
    114102    fid.close()
    115 
    116     # }}}
    117 
    118     # Helper functions
    119 
    120 
     103    # }}}
     104
     105
     106# Helper functions
    121107def write_field_name(fid, data):  # {{{
    122108    """
     
    127113    reclen = len(data) + 4 + 4
    128114    fid.write(struct.pack('>i', reclen))
    129 
    130115    # write format code
    131116    code = format_archive_code(data)
     
    133118        raise TypeError("archwrite : error writing field name, expected string, but got %s" % type(data))
    134119    fid.write(struct.pack('>i', 1))
    135 
    136120    # write string length, and then the string
    137121    fid.write(struct.pack('>i', len(data)))
     
    151135    # write the format code (2 for scalar)
    152136    fid.write(struct.pack('>i', 2))
    153 
    154137    # write the double
    155138    fid.write(struct.pack('>d', data))
    156 
    157139    # }}}
    158140
     
    168150    elif isinstance(data, (list, tuple)):
    169151        data = np.array(data).reshape(- 1, )
    170 
    171152    if np.ndim(data) == 1:
    172153        if np.size(data):
     
    174155        else:
    175156            data = data.reshape(0, 0)
    176 
    177157    # get size of data
    178158    sz = data.shape
    179 
    180159    # write length of record
    181160    # format code + row size + col size + (double size * row amt * col amt)
     
    185164        raise ValueError("archwrite error : can not write vector to binary file because it is too large")
    186165    fid.write(struct.pack('>i', reclen))
    187 
    188166    # write format code
    189167    fid.write(struct.pack('>i', 3))
    190 
    191168    # write vector
    192169    fid.write(struct.pack('>i', sz[0]))
     
    195172        for j in range(sz[1]):
    196173            fid.write(struct.pack('>d', float(data[i][j])))
    197 
    198174    # }}}
    199175
  • issm/trunk-jpl/src/m/classes/SMBcomponents.m

    r23814 r24240  
    55
    66classdef SMBcomponents
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                isclimatology = 0;
    99                accumulation = NaN;
    1010                runoff = NaN;
    1111                evaporation = NaN;
    12                 requested_outputs      = {};
     12                steps_per_step = 1;
     13                requested_outputs     = {};
    1314        end
    1415        methods
     
    3637                        if isnan(self.accumulation)
    3738                                self.accumulation=zeros(md.mesh.numberofvertices,1);
    38                                 disp('      no smb.accumulation specified: values set as zero');
     39                                disp('  no smb.accumulation specified: values set as zero');
    3940                        end
    4041                        if isnan(self.evaporation)
    4142                                self.evaporation=zeros(md.mesh.numberofvertices,1);
    42                                 disp('      no smb.evaporation specified: values set as zero');
     43                                disp('  no smb.evaporation specified: values set as zero');
    4344                        end
    4445                        if isnan(self.runoff)
    4546                                self.runoff=zeros(md.mesh.numberofvertices,1);
    46                                 disp('      no smb.runoff specified: values set as zero');
     47                                disp('  no smb.runoff specified: values set as zero');
    4748                        end
    4849
     
    5253                        if ismember('MasstransportAnalysis',analyses),
    5354                                md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1);
     55                                md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1);
     56                                md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
    5457                        end
    5558                        if ismember('BalancethicknessAnalysis',analyses),
    5659                                md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    57                         end
    58                         if ismember('MasstransportAnalysis',analyses),
    59                                 md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1);
    60                         end
    61                         if ismember('BalancethicknessAnalysis',analyses),
    6260                                md = checkfield(md,'fieldname','smb.runoff','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    63                         end
    64                         if ismember('MasstransportAnalysis',analyses),
    65                                 md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
    66                         end
    67                         if ismember('BalancethicknessAnalysis',analyses),
    6861                                md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    6962                        end
     63                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    7064                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    7165                        md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
    7266                        if (self.isclimatology)
    7367                                md = checkfield(md,'fieldname', 'smb.accumulation', 'size',[md.mesh.numberofvertices+1],...
    74                                         'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     68                                                'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    7569                                md = checkfield(md,'fieldname', 'smb.runoff', 'size',[md.mesh.numberofvertices+1],...
    76                                         'message',['runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     70                                                'message',['runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    7771                                md = checkfield(md,'fieldname', 'smb.evaporation', 'size',[md.mesh.numberofvertices+1],...
    78                                         'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     72                                                'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    7973                        end
    8074                end % }}}
    8175                function disp(self) % {{{
    82                         disp(sprintf('   surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
     76                        disp(sprintf('    surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
    8377                        fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
    8478                        fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]');
    8579                        fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
    8680                        fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
     81                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    8782                        fielddisplay(self,'requested_outputs','additional outputs requested');
    8883                end % }}}
     
    9590                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    9691                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    97                        
     92                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
    9893                        %process requested outputs
    9994                        outputs = self.requested_outputs;
    10095                        pos  = find(ismember(outputs,'default'));
    10196                        if ~isempty(pos),
    102                                 outputs(pos) = [];                         %remove 'default' from outputs
    103                                 outputs      = [outputs defaultoutputs(self,md)]; %add defaults
     97                                outputs(pos) = [];                             %remove 'default' from outputs
     98                                outputs  = [outputs defaultoutputs(self,md)]; %add defaults
    10499                        end
    105100                        WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
  • issm/trunk-jpl/src/m/classes/SMBcomponents.py

    r24213 r24240  
    1818        self.evaporation = float('NaN')
    1919        self.isclimatology = 0
     20        self.steps_per_step = 1
    2021        self.requested_outputs = []
    21     #}}}
     22        #}}}
    2223
    2324    def __repr__(self):  # {{{
    24         string = "   surface forcings parameters (SMB = accumulation - runoff - evaporation) :"
    25         string = "%s\n%s" % (string, fielddisplay(self, 'accumulation', 'accumulated snow [m / yr ice eq]'))
    26         string = "%s\n%s" % (string, fielddisplay(self, 'runoff', 'amount of ice melt lost from the ice column [m / yr ice eq]'))
    27         string = "%s\n%s" % (string, fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m / yr ice eq]'))
     25        string = "   surface forcings parameters (SMB = accumulation-runoff-evaporation) :"
     26        string = "%s\n%s" % (string, fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))
     27        string = "%s\n%s" % (string, fielddisplay(self, 'runoff', 'amount of ice melt lost from the ice column [m/yr ice eq]'))
     28        string = "%s\n%s" % (string, fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))
    2829        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
     30        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    2931        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    3032        return string
    31     #}}}
     33        #}}}
    3234
    3335    def extrude(self, md):  # {{{
     
    6163        if 'MasstransportAnalysis' in analyses:
    6264            md = checkfield(md, 'fieldname', 'smb.accumulation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    63 
     65            md = checkfield(md, 'fieldname', 'smb.runoff', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     66            md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    6467        if 'BalancethicknessAnalysis' in analyses:
    6568            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    66 
    67         if 'MasstransportAnalysis' in analyses:
    68             md = checkfield(md, 'fieldname', 'smb.runoff', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    69 
    70         if 'BalancethicknessAnalysis' in analyses:
    7169            md = checkfield(md, 'fieldname', 'smb.runoff', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    72 
    73         if 'MasstransportAnalysis' in analyses:
    74             md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    75 
    76         if 'BalancethicknessAnalysis' in analyses:
    7770            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    7871
     72        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    7973        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    8074        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
     
    9084        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoff', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    9185        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    92 
     86        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    9387    #process requested outputs
    9488        outputs = self.requested_outputs
  • issm/trunk-jpl/src/m/classes/SMBd18opdd.m

    r22854 r24240  
    55
    66classdef SMBd18opdd
    7         properties (SetAccess=public)
     7        properties (SetAccess=public)
     8
    89                desfac                    = 0;
    910                s0p                       = NaN;
    1011                s0t                       = NaN;
    1112                rlaps                     = 0;
    12                 rlapslgm                  = 0; 
    13                 dpermil                   = 0; 
     13                rlapslgm                  = 0;
     14                dpermil                   = 0;
    1415                f                         = 0;
    1516                Tdiff                     = NaN;
     
    2829                pddfac_snow               = NaN;
    2930                pddfac_ice                = NaN;
    30                 requested_outputs      = {};
     31                steps_per_step            = 1;
     32                requested_outputs         = {};
    3133        end
    3234        methods
     
    5052
    5153                end % }}}
    52          function list = defaultoutputs(self,md) % {{{
     54                function list = defaultoutputs(self,md) % {{{
    5355
    5456                        list = {''};
     
    5658                end % }}}
    5759                function self = initialize(self,md) % {{{
    58                    
     60
    5961                        if isnan(self.s0p),
    60                                 self.s0p=zeros(md.mesh.numberofvertices,1);
    61                                 disp('      no SMBd18opdd.s0p specified: values set as zero');
     62                                self.s0p=zeros(md.mesh.numberofvertices,1);
     63                                disp('      no SMBd18opdd.s0p specified: values set as zero');
    6264                        end
    6365                        if isnan(self.s0t),
     
    6971                function self = setdefaultparameters(self) % {{{
    7072
    71                   self.ismungsm   = 0;
    72                   self.isd18opd   = 1;
    73                   self.istemperaturescaled = 1;
    74                   self.isprecipscaled = 1;
    75                   self.desfac     = 0.5;
    76                   self.rlaps      = 6.5;
    77                   self.rlapslgm   = 6.5;
    78                   self.dpermil    = 2.4;
    79                   self.f          = 0.169;
    80                   self.issetpddfac = 0;
    81                  
     73                        self.ismungsm   = 0;
     74                        self.isd18opd   = 1;
     75                        self.istemperaturescaled = 1;
     76                        self.isprecipscaled = 1;
     77                        self.desfac     = 0.5;
     78                        self.rlaps      = 6.5;
     79                        self.rlapslgm   = 6.5;
     80                        self.dpermil    = 2.4;
     81                        self.f          = 0.169;
     82                        self.issetpddfac = 0;
     83
    8284                end % }}}
    8385                function md = checkconsistency(self,md,solution,analyses) % {{{
     
    8991                                md = checkfield(md,'fieldname','smb.rlaps','>=',0,'numel',1);
    9092                                md = checkfield(md,'fieldname','smb.rlapslgm','>=',0,'numel',1);
    91                                 if(self.isd18opd==1)
     93
     94                                if(self.isd18opd==1)
    9295                                        md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    9396                                        md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
     
    104107                                        md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
    105108                                        md = checkfield(md,'fieldname','smb.dpermil','>=',0,'numel',1);
    106                                    md = checkfield(md,'fieldname','smb.f','>=',0,'numel',1);
     109                                        md = checkfield(md,'fieldname','smb.f','>=',0,'numel',1);
    107110                                        if(self.istemperaturescaled==0)
    108111                                                lent=size(self.temperatures_reconstructed,2);
     
    121124                                end
    122125                        end
     126                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    123127                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    124128                end % }}}
     
    133137                        fielddisplay(self,'s0t','should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]');
    134138                        fielddisplay(self,'rlaps','present day lapse rate [degree/km]');
    135                         if(self.isd18opd==1) 
     139                        if(self.isd18opd==1)
    136140                                fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm/d18opd is activated');
    137141                                fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o/mungsm/d18opd is activated');
     
    144148                                        fielddisplay(self,'precipitations_reconstructed','monthly historical precipitation [m/yr water eq], required if delta18o/mungsm/d18opd is activated and isprecipscaled is not activated');
    145149                                end
    146                                 fielddisplay(self,'delta18o','delta18o [per mil], required if pdd is activated and d18opd activated'); 
    147                                 fielddisplay(self,'dpermil','degree per mil, required if d18opd is activated');                           
    148                            fielddisplay(self,'f','precip/temperature scaling factor, required if d18opd is activated');
     150                                fielddisplay(self,'delta18o','delta18o [per mil], required if pdd is activated and d18opd activated');
     151                                fielddisplay(self,'dpermil','degree per mil, required if d18opd is activated');
     152                                fielddisplay(self,'f','precip/temperature scaling factor, required if d18opd is activated');
    149153                        end
    150154                        if(self.issetpddfac==1)
     
    152156                                fielddisplay(self,'pddfac_ice','Pdd factor for ice, at each vertex [mm ice equiv/day/degree C]');
    153157                        end
     158                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    154159                        fielddisplay(self,'requested_outputs','additional outputs requested');
    155160                        % No need to display rlapslgm, Tdiff, ismungsm
     
    173178                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tdiff','format','DoubleMat','mattype',1,'timeserieslength',2,'yts',md.constants.yts);
    174179                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2,'yts',md.constants.yts);
     180                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
    175181
    176182                        if self.isd18opd
     
    181187                                WriteData(fid,prefix,'object',self,'class','smb','fieldname','delta18o','format','DoubleMat','mattype',1,'timeserieslength',2,'yts',md.constants.yts);
    182188                                WriteData(fid,prefix,'object',self,'class','smb','fieldname','dpermil','format','Double');
    183                            WriteData(fid,prefix,'object',self,'class','smb','fieldname','f','format','Double');
     189                                WriteData(fid,prefix,'object',self,'class','smb','fieldname','f','format','Double');
    184190                                if self.istemperaturescaled==0
    185191                                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','temperatures_reconstructed','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     
    193199                                WriteData(fid,prefix,'object',self,'class','smb','fieldname','pddfac_ice','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    194200                        end
    195                        
     201
    196202                        %process requested outputs
    197203                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBd18opdd.py

    r24213 r24240  
    1313          SMBd18opdd = SMBd18opdd()
    1414    """
    15 
    1615    def __init__(self):  # {{{
    1716        self.desfac = 0.
     
    3736        self.pddfac_snow = float('NaN')
    3837        self.pddfac_ice = float('NaN')
     38        self.steps_per_step = 1
    3939
    4040    #set defaults
     
    5151        string = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
    5252        string = "%s\n%s" % (string, fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]'))
    53         string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree / km]'))
    54         if self.isd18opd:
    55             string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o / mungsm is activated'))
    56             string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
     53        string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]'))
     54        if self.isd18opd:
     55            string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
     56            string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
    5757            string = "%s\n%s" % (string, fielddisplay(self, 'istemperaturescaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is temperature scaled to delta18o value? (0 or 1, default is 1)'))
    5858            string = "%s\n%s" % (string, fielddisplay(self, 'isprecipscaled', 'if delta18o parametrisation from present day temperature and precipitation is activated, is precipitation scaled to delta18o value? (0 or 1, default is 1)'))
    5959
    6060            if self.istemperaturescaled == 0:
    61                 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_reconstructed', 'monthly historical surface temperatures [K], required if delta18o / mungsm / d18opd is activated and istemperaturescaled is not activated'))
     61                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_reconstructed', 'monthly historical surface temperatures [K], required if delta18o/mungsm/d18opd is activated and istemperaturescaled is not activated'))
    6262
    6363            if self.isprecipscaled == 0:
    64                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_reconstructed', 'monthly historical precipitation [m / yr water eq], required if delta18o / mungsm / d18opd is activated and isprecipscaled is not activated'))
     64                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_reconstructed', 'monthly historical precipitation [m/yr water eq], required if delta18o/mungsm/d18opd is activated and isprecipscaled is not activated'))
    6565
    6666            string = "%s\n%s" % (string, fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated'))
     
    6969
    7070        if self.issetpddfac == 1:
    71             string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_snow', 'Pdd factor for snow, at each vertex [mm ice equiv / day / degree C]'))
    72             string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_ice', 'Pdd factor for ice, at each vertex [mm ice equiv / day / degree C]'))
     71            string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_snow', 'Pdd factor for snow, at each vertex [mm ice equiv/day/degree C]'))
     72            string = "%s\n%s" % (string, fielddisplay(self, 'pddfac_ice', 'Pdd factor for ice, at each vertex [mm ice equiv/day/degree C]'))
     73        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    7374        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    7475
     
    9394        self.s0p = project3d(md, 'vector', self.s0p, 'type', 'node')
    9495        self.s0t = project3d(md, 'vector', self.s0t, 'type', 'node')
    95 
    9696        return self
    9797    #}}}
     
    109109            self.s0t = np.zeros((md.mesh.numberofvertices))
    110110            print("      no SMBd18opdd.s0t specified: values set as zero")
    111 
    112111        return self
    113112    # }}}
     
    135134            md = checkfield(md, 'fieldname', 'smb.rlaps', '>=', 0, 'numel', [1])
    136135            md = checkfield(md, 'fieldname', 'smb.rlapslgm', '>=', 0, 'numel', [1])
     136            md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    137137
    138138            if self.isd18opd:
     
    163163
    164164        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    165 
    166165        return md
    167166    # }}}
     
    171170
    172171        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 5, 'format', 'Integer')
    173 
    174172        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ismungsm', 'format', 'Boolean')
    175173        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isd18opd', 'format', 'Boolean')
     
    182180        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
    183181        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     182        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    184183
    185184        if self.isd18opd:
  • issm/trunk-jpl/src/m/classes/SMBforcing.m

    r23814 r24240  
    55
    66classdef SMBforcing
    7         properties (SetAccess=public)
    8                 isclimatology = 0;
    9                 mass_balance = NaN;
    10                 requested_outputs      = {};
     7        properties (SetAccess=public)
     8                isclimatology     = 0;
     9                mass_balance      = NaN;
     10                steps_per_step    = 1;
     11                requested_outputs = {};
    1112        end
    1213        methods
     
    5758                                md = checkfield(md,'fieldname','smb.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    5859                        end
     60                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    5961                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    6062                        md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
    6163                        if (self.isclimatology)
    6264                                md = checkfield(md,'fieldname', 'smb.mass_balance', 'size',[md.mesh.numberofvertices+1],...
    63                                         'message',['mass_balance must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     65                                                'message',['mass_balance must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    6466                        end
    6567                end % }}}
     
    6870                        fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]');
    6971                        fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
     72                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    7073                        fielddisplay(self,'requested_outputs','additional outputs requested');
    7174                end % }}}
     
    7780                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    7881                        %WriteData(fid,prefix,'object',self,'class','smb','fieldname','mass_balance','format','CompressedMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    79                        
     82                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     83
    8084                        %process requested outputs
    8185                        outputs = self.requested_outputs;
     
    9094                end % }}}
    9195                function savemodeljs(self,fid,modelname) % {{{
    92                
     96
    9397                        writejs1Darray(fid,[modelname '.smb.mass_balance'],self.mass_balance);
    9498                        writejscellstring(fid,[modelname '.smb.requested_outputs'],self.requested_outputs);
  • issm/trunk-jpl/src/m/classes/SMBforcing.py

    r24213 r24240  
    1818        self.requested_outputs = []
    1919        self.isclimatology = 0
     20        self.steps_per_step = 1
    2021    #}}}
    2122
    2223    def __repr__(self):  # {{{
    2324        string = "   surface forcings parameters:"
    24         string = "%s\n%s" % (string, fielddisplay(self, 'mass_balance', 'surface mass balance [m / yr ice eq]'))
     25        string = "%s\n%s" % (string, fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]'))
    2526        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
     27        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    2628        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    2729        return string
     
    5355            md = checkfield(md, 'fieldname', 'smb.mass_balance', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    5456
     57        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    5558        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    5659        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
     
    6164    # }}}
    6265
    63     def marshall(self, prefix, md, fid):  # {{{
     66    def marshall(self, prefix, md, fid):    # {{{
    6467        yts = md.constants.yts
    65 
    6668        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 1, 'format', 'Integer')
    6769        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'mass_balance', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     70        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    6871
    6972        #process requested outputs
  • issm/trunk-jpl/src/m/classes/SMBgemb.m

    r24203 r24240  
    1 %SMBgemb Class definition. 
    2 %   This is the class that hosts all the inputs for the Alberta Glacier Surface Mass Balance Model 
     1%SMBgemb Class definition.
     2%   This is the class that hosts all the inputs for the Alberta Glacier Surface Mass Balance Model
    33%   Alex Gardner, University of Alberta.
    4 %   
     4%
    55%   Usage:
    66%      SMBgemb=SMBgemb();
    77
    88classdef SMBgemb
    9         properties (SetAccess=public) 
    10         % {{{
    11                 %each one of these properties is a transient forcing to the GEMB model, loaded from meteorological data derived 
    12                 %from an automatic weather stations (AWS). Each property is therefore a matrix, of size (numberofvertices x number 
     9        properties (SetAccess=public)
     10                % {{{
     11                %each one of these properties is a transient forcing to the GEMB model, loaded from meteorological data derived
     12                %from an automatic weather stations (AWS). Each property is therefore a matrix, of size (numberofvertices x number
    1313                %of time steps. )
    1414
     
    2121                ismelt;
    2222                isdensification;
    23                 isturbulentflux;   
     23                isturbulentflux;
    2424                isclimatology;
    2525
    26                 %inputs: 
     26                %inputs:
    2727                Ta    = NaN; %2 m air temperature, in Kelvin
    2828                V     = NaN; %wind speed (m/s-1)
     
    3232                eAir  = NaN; %screen level vapor pressure [Pa]
    3333                pAir  = NaN; %surface pressure [Pa]
    34                
     34
    3535                Tmean = NaN; %mean annual temperature [K]
    3636                Vmean = NaN; %mean annual wind velocity [m s-1]
     
    4242                aValue = NaN; %Albedo forcing at every element.  Used only if aIdx == 0.
    4343                teValue = NaN; %Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)
    44        
     44
    4545                % Initialization of snow properties
    4646                Dzini = NaN; %cell depth (m)
     
    5555                Sizeini = NaN; %Number of layers
    5656
    57                 %settings: 
     57                %settings:
    5858                aIdx   = NaN; %method for calculating albedo and subsurface absorption (default is 1)
    59                            % 0: direct input from aValue parameter
    60                            % 1: effective grain radius [Gardner & Sharp, 2009]
    61                                           % 2: effective grain radius [Brun et al., 2009]
    62                                           % 3: density and cloud amount [Greuell & Konzelmann, 1994]
    63                                           % 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
     59                              % 0: direct input from aValue parameter
     60                              % 1: effective grain radius [Gardner & Sharp, 2009]
     61                              % 2: effective grain radius [Brun et al., 2009]
     62                              % 3: density and cloud amount [Greuell & Konzelmann, 1994]
     63                              % 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
    6464
    6565                swIdx  = NaN; % apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1)
    6666
    6767                denIdx = NaN; %densification model to use (default is 2):
    68                                         % 1 = emperical model of Herron and Langway (1980)
    69                                         % 2 = semi-emperical model of Anthern et al. (2010)
    70                                         % 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
    71                                         % 4 = DO NOT USE: emperical model of Li and Zwally (2004)
    72                                         % 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
    73                                         % 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
    74                                         % 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
    75 
    76                 dsnowIdx = NaN; %model for fresh snow accumulation density (default is 1): 
    77                          % 0 = Original GEMB value, 150 kg/m^3
    78                                         % 1 = Antarctica value of fresh snow density, 350 kg/m^3
    79                                         % 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)
    80                                         % 3 = Antarctica model of Kaspers et al. (2004)
    81                                         % 4 = Greenland model of Kuipers Munneke et al. (2015)
    82                                        
     68                              % 1 = emperical model of Herron and Langway (1980)
     69                              % 2 = semi-emperical model of Anthern et al. (2010)
     70                              % 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
     71                              % 4 = DO NOT USE: emperical model of Li and Zwally (2004)
     72                              % 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
     73                              % 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
     74                              % 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
     75
     76                dsnowIdx = NaN; %model for fresh snow accumulation density (default is 1):
     77                                % 0 = Original GEMB value, 150 kg/m^3
     78                                % 1 = Antarctica value of fresh snow density, 350 kg/m^3
     79                                % 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)
     80                                % 3 = Antarctica model of Kaspers et al. (2004)
     81                                % 4 = Greenland model of Kuipers Munneke et al. (2015)
     82
    8383                zTop  = NaN; % depth over which grid length is constant at the top of the snopack (default 10) [m]
    8484                dzTop = NaN; % initial top vertical grid spacing (default .05) [m]
    85                 dzMin = NaN; % initial min vertical allowable grid spacing (default dzTop/2) [m]
     85                dzMin = NaN; % initial min vertical allowable grid spacing (default dzMin/2) [m]
     86
    8687                zY    = NaN; % strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]
    8788                zMax = NaN; %initial max model depth (default is min(thickness,250)) [m]
     
    8990                outputFreq = NaN; %output frequency in days (default is monthly, 30)
    9091
    91                 %specific albedo parameters: 
    92                 %Method 1 and 2: 
     92                %specific albedo parameters:
     93                %Method 1 and 2:
    9394                aSnow = NaN; % new snow albedo (0.64 - 0.89)
    9495                aIce  = NaN; % range 0.27-0.58 for old snow
    95                 %Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo
     96                             %Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo
    9697                cldFrac = NaN; % average cloud amount
    97                 %Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005)
    98                 t0wet = NaN; % time scale for wet snow (15-21.9) 
    99                 t0dry = NaN; % warm snow timescale (30) 
    100                 K     = NaN; % time scale temperature coef. (7) 
     98                               %Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005)
     99                t0wet = NaN; % time scale for wet snow (15-21.9)
     100                t0dry = NaN; % warm snow timescale (30)
     101                K     = NaN; % time scale temperature coef. (7)
    101102                adThresh = NaN; %Apply aIdx method to all areas with densities below this value,
    102103                                %or else apply direct input value from aValue, allowing albedo to be altered.
    103                                                          %Default value is rho water (1023 kg m-3).
     104                                %Default value is rho water (1023 kg m-3).
    104105
    105106                %densities:
     
    108109                %thermal:
    109110                ThermoDeltaTScaling= NaN; %scaling factor to multiply the thermal diffusion timestep (delta t)
    110                
     111
     112                steps_per_step = 1;
    111113                requested_outputs      = {};
    112114
    113                 %Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM. 
    114                 %dateN: that's the last row of the above fields. 
    115                 %dt:    included in dateN. Not an input. 
     115                %Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM.
     116                %dateN: that's the last row of the above fields.
     117                %dt:    included in dateN. Not an input.
    116118                %elev:  this is taken from the ISSM surface itself.
    117119
     
    121123                        switch nargin
    122124                                case 2
    123                                         mesh=varargin{1}; 
    124                                         geometry=varargin{2}; 
     125                                        mesh=varargin{1};
     126                                        geometry=varargin{2};
    125127                                        self=setdefaultparameters(self,mesh,geometry);
    126128                                otherwise
     
    152154                function self = setdefaultparameters(self,mesh,geometry) % {{{
    153155
    154                 self.isgraingrowth=1;
    155                 self.isalbedo=1;
    156                 self.isshortwave=1;
    157                 self.isthermal=1;
    158                 self.isaccumulation=1;
    159                 self.ismelt=1;
    160                 self.isdensification=1;
    161                 self.isturbulentflux=1;
    162                 self.isclimatology=0;
    163        
    164                 self.aIdx = 1;
    165                 self.swIdx = 1;
    166                 self.denIdx = 2;
    167                 self.dsnowIdx = 1;
    168                 self.zTop=10*ones(mesh.numberofelements,1);
    169                 self.dzTop = .05* ones (mesh.numberofelements,1);
    170                 self.dzMin = self.dzTop/2;
    171                 self.InitDensityScaling = 1.0;
    172                 self.ThermoDeltaTScaling = 1/11;
    173 
    174                 self.Vmean=10.0*ones(mesh.numberofelements,1);
    175                
    176                 self.zMax=250*ones(mesh.numberofelements,1);
    177                 self.zMin=130*ones(mesh.numberofelements,1);
    178                 self.zY = 1.10*ones(mesh.numberofelements,1);
    179                 self.outputFreq = 30;
    180                
    181                 %additional albedo parameters
    182                 self.aSnow = 0.85;
    183                 self.aIce = 0.48;
    184                 self.cldFrac = 0.1;
    185                 self.t0wet = 15;
    186                 self.t0dry = 30;
    187                 self.K = 7;
    188                 self.adThresh = 1023;
    189 
    190                 self.teValue = ones(mesh.numberofelements,1);
    191                 self.aValue = self.aSnow*ones(mesh.numberofelements,1);
    192        
    193                 self.Dzini=0.05*ones(mesh.numberofelements,2);
    194                 self.Dini=910.0*ones(mesh.numberofelements,2);
    195                 self.Reini=2.5*ones(mesh.numberofelements,2);
    196                 self.Gdnini=0.0*ones(mesh.numberofelements,2);
    197                 self.Gspini=0.0*ones(mesh.numberofelements,2);
    198                 self.ECini=0.0*ones(mesh.numberofelements,1);
    199                 self.Wini=0.0*ones(mesh.numberofelements,2);
    200                 self.Aini=self.aSnow*ones(mesh.numberofelements,2);
    201                 self.Tini=273.15*ones(mesh.numberofelements,2);
    202 %               /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
    203 %               If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
    204                 self.Sizeini=2*ones(mesh.numberofelements,1);
     156                        self.isgraingrowth=1;
     157                        self.isalbedo=1;
     158                        self.isshortwave=1;
     159                        self.isthermal=1;
     160                        self.isaccumulation=1;
     161                        self.ismelt=1;
     162                        self.isdensification=1;
     163                        self.isturbulentflux=1;
     164                        self.isclimatology=0;
     165
     166                        self.aIdx = 1;
     167                        self.swIdx = 1;
     168                        self.denIdx = 2;
     169                        self.dsnowIdx = 1;
     170                        self.zTop=10*ones(mesh.numberofelements,1);
     171                        self.dzTop = .05* ones (mesh.numberofelements,1);
     172                        self.dzMin = self.dzTop/2;
     173                        self.InitDensityScaling = 1.0;
     174                        self.ThermoDeltaTScaling = 1/11;
     175
     176                        self.Vmean=10.0*ones(mesh.numberofelements,1);
     177
     178                        self.zMax=250*ones(mesh.numberofelements,1);
     179                        self.zMin=130*ones(mesh.numberofelements,1);
     180                        self.zY = 1.10*ones(mesh.numberofelements,1);
     181                        self.outputFreq = 30;
     182
     183                        %additional albedo parameters
     184                        self.aSnow = 0.85;
     185                        self.aIce = 0.48;
     186                        self.cldFrac = 0.1;
     187                        self.t0wet = 15;
     188                        self.t0dry = 30;
     189                        self.K = 7;
     190                        self.adThresh = 1023;
     191
     192                        self.teValue = ones(mesh.numberofelements,1);
     193                        self.aValue = self.aSnow*ones(mesh.numberofelements,1);
     194
     195                        self.Dzini=0.05*ones(mesh.numberofelements,2);
     196                        self.Dini=910.0*ones(mesh.numberofelements,2);
     197                        self.Reini=2.5*ones(mesh.numberofelements,2);
     198                        self.Gdnini=0.0*ones(mesh.numberofelements,2);
     199                        self.Gspini=0.0*ones(mesh.numberofelements,2);
     200                        self.ECini=0.0*ones(mesh.numberofelements,1);
     201                        self.Wini=0.0*ones(mesh.numberofelements,2);
     202                        self.Aini=self.aSnow*ones(mesh.numberofelements,2);
     203                        self.Tini=273.15*ones(mesh.numberofelements,2);
     204                        %               /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
     205                        %               If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
     206                        self.Sizeini=2*ones(mesh.numberofelements,1);
    205207
    206208                end % }}}
     
    226228                        if (self.isclimatology)
    227229                                md = checkfield(md,'fieldname', 'smb.Ta', 'size',[md.mesh.numberofelements+1],...
    228                                         'message',['Ta must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     230                                                'message',['Ta must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    229231                                md = checkfield(md,'fieldname', 'smb.V', 'size',[md.mesh.numberofelements+1],...
    230                                         'message',['V must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     232                                                'message',['V must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    231233                                md = checkfield(md,'fieldname', 'smb.dswrf', 'size',[md.mesh.numberofelements+1],...
    232                                         'message',['dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     234                                                'message',['dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    233235                                md = checkfield(md,'fieldname', 'smb.dlwrf', 'size',[md.mesh.numberofelements+1],...
    234                                         'message',['dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     236                                                'message',['dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    235237                                md = checkfield(md,'fieldname', 'smb.P', 'size',[md.mesh.numberofelements+1],...
    236                                         'message',['P must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     238                                                'message',['P must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    237239                                md = checkfield(md,'fieldname', 'smb.eAir', 'size',[md.mesh.numberofelements+1],...
    238                                         'message',['eAir must have md.mesh.numberofelements+1 rows in order to force a climatology']);
     240                                                'message',['eAir must have md.mesh.numberofelements+1 rows in order to force a climatology']);
    239241                        end
    240242
    241243                        md = checkfield(md,'fieldname','smb.Tmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value
    242                         md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0); 
     244                        md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);
    243245                        md = checkfield(md,'fieldname','smb.Vmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);
    244                         md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 
    245                         md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 
     246                        md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
     247                        md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
    246248
    247249                        md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);
     
    256258                        md = checkfield(md,'fieldname','smb.dzMin','NaN',1,'Inf',1,'>',0);
    257259                        md = checkfield(md,'fieldname','smb.zY','NaN',1,'Inf',1,'>=',1);
    258                         md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max 
     260                        md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max
    259261                        md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
    260262                        md = checkfield(md,'fieldname','smb.ThermoDeltaTScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
     
    280282                                error('SMBgemb consistency check error: zTop should be smaller than local ice thickness');
    281283                        end
     284                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    282285                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    283286
    284287                end % }}}
    285288                function disp(self) % {{{
    286                        
     289
    287290                        disp(sprintf('   surface forcings for SMB GEMB model :'));
    288                        
     291
    289292                        fielddisplay(self,'isgraingrowth','run grain growth module (default true)');
    290293                        fielddisplay(self,'isalbedo','run albedo module (default true)');
     
    319322                        fielddisplay(self,'adThresh',{'Apply aIdx method to all areas with densities below this value,','or else apply direct input value from aValue, allowing albedo to be altered.'});
    320323                        fielddisplay(self,'aIdx',{'method for calculating albedo and subsurface absorption (default is 1)',...
    321                                 '0: direct input from aValue parameter',...
    322                                 '1: effective grain radius [Gardner & Sharp, 2009]',...
    323                                 '2: effective grain radius [Brun et al., 2009]',...
    324                                 '3: density and cloud amount [Greuell & Konzelmann, 1994]',...
    325                                 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'})
     324                                            '0: direct input from aValue parameter',...
     325                                            '1: effective grain radius [Gardner & Sharp, 2009]',...
     326                                            '2: effective grain radius [Brun et al., 2009]',...
     327                                            '3: density and cloud amount [Greuell & Konzelmann, 1994]',...
     328                                            '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'})
    326329
    327330                        fielddisplay(self,'teValue','Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)');
    328                                
     331
    329332                        %snow properties init
    330333                        fielddisplay(self,'Dzini','Initial cell depth when restart [m]');
     
    338341                        fielddisplay(self,'Tini','Initial snow temperature when restart [K]');
    339342                        fielddisplay(self,'Sizeini','Initial number of layers when restart [K]');
    340            
    341            
    342                         %additional albedo parameters: 
     343
     344
     345                        %additional albedo parameters:
    343346                        switch self.aIdx
    344                         case {0 5}
    345                                 fielddisplay(self,'aValue','Albedo forcing at every element.  Used only if aIdx == {0,5}.');
    346                         case {1 2}
    347                                 fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)');
    348                                 fielddisplay(self,'aIce','albedo of ice (0.27-0.58)');
    349                         case 3
    350                                 fielddisplay(self,'cldFrac','average cloud amount');
    351                         case 4
    352                                 fielddisplay(self,'t0wet','time scale for wet snow (15-21.9) [d]');
    353                                 fielddisplay(self,'t0dry','warm snow timescale (30) [d]');
    354                                 fielddisplay(self,'K','time scale temperature coef. (7) [d]');
     347                                case {0 5}
     348                                        fielddisplay(self,'aValue','Albedo forcing at every element.  Used only if aIdx == {0,5}.');
     349                                case {1 2}
     350                                        fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)');
     351                                        fielddisplay(self,'aIce','albedo of ice (0.27-0.58)');
     352                                case 3
     353                                        fielddisplay(self,'cldFrac','average cloud amount');
     354                                case 4
     355                                        fielddisplay(self,'t0wet','time scale for wet snow (15-21.9) [d]');
     356                                        fielddisplay(self,'t0dry','warm snow timescale (30) [d]');
     357                                        fielddisplay(self,'K','time scale temperature coef. (7) [d]');
    355358                        end
    356359
    357360                        fielddisplay(self,'swIdx','apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1]');
    358361                        fielddisplay(self,'denIdx',{'densification model to use (default is 2):',...
    359                                                                         '1 = emperical model of Herron and Langway (1980)',...
    360                                                                         '2 = semi-emperical model of Anthern et al. (2010)',...
    361                                                                         '3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)',...
    362                                                                         '4 = DO NOT USE: emperical model of Li and Zwally (2004)',...
    363                                                                         '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',...
    364                                                                         '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',...
    365                                                                         '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'});
     362                                            '1 = emperical model of Herron and Langway (1980)',...
     363                                            '2 = semi-emperical model of Anthern et al. (2010)',...
     364                                            '3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)',...
     365                                            '4 = DO NOT USE: emperical model of Li and Zwally (2004)',...
     366                                            '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',...
     367                                            '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',...
     368                                            '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'});
    366369                        fielddisplay(self,'dsnowIdx',{'model for fresh snow accumulation density (default is 1):',...
    367                                                            '0 = Original GEMB value, 150 kg/m^3',...
    368                                                            '1 = Antarctica value of fresh snow density, 350 kg/m^3',...
    369                                                            '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',...
    370                                                            '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',...
    371                                                            '4 = Greenland model of Kuipers Munneke et al. (2015)'});
    372 
     370                                            '0 = Original GEMB value, 150 kg/m^3',...
     371                                            '1 = Antarctica value of fresh snow density, 350 kg/m^3',...
     372                                            '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',...
     373                                            '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',...
     374                                            '4 = Greenland model of Kuipers Munneke et al. (2015)'});
     375
     376                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    373377                        fielddisplay(self,'requested_outputs','additional outputs requested');
    374                                                                        
    375                        
     378
     379
    376380                end % }}}
    377381                function marshall(self,prefix,md,fid) % {{{
     
    380384
    381385                        WriteData(fid,prefix,'name','md.smb.model','data',8,'format','Integer');
    382                        
     386
    383387                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','isgraingrowth','format','Boolean');
    384388                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','isalbedo','format','Boolean');
     
    390394                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','isturbulentflux','format','Boolean');
    391395                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','isclimatology','format','Boolean');
    392            
     396
    393397                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Ta','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    394398                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','V','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
     
    397401                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','P','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    398402                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','eAir','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    399                         WriteData(fid,prefix,'object',self,'class','smb','fieldname','pAir','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);         
     403                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','pAir','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    400404
    401405                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tmean','format','DoubleMat','mattype',2);
     
    410414                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','zMax','format','DoubleMat','mattype',2);
    411415                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','zMin','format','DoubleMat','mattype',2);
    412                
     416
    413417                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','aIdx','format','Integer');
    414418                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','swIdx','format','Integer');
     
    428432                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','aValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    429433                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','teValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
    430            
     434
    431435                        %snow properties init
    432436                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Dzini','format','DoubleMat','mattype',3);
     
    440444                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tini','format','DoubleMat','mattype',3);
    441445                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','Sizeini','format','IntMat','mattype',2);
    442 
    443                         %figure out dt from forcings: 
     446                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     447                        %figure out dt from forcings:
    444448                        time=self.Ta(end,:); %assume all forcings are on the same time step
    445449                        dtime=diff(time,1);
    446450                        dt=min(dtime);
    447            
     451
    448452                        WriteData(fid,prefix,'data',dt,'name','md.smb.dt','format','Double','scale',yts);
    449453
    450454                        % Check if smb_dt goes evenly into transient core time step
    451455                        if (mod(md.timestepping.time_step,dt) >= 1e-10)
    452                 error('smb_dt/dt = %f. The number of SMB time steps in one transient core time step has to be an an integer',md.timestepping.time_step/dt);
    453                         end
    454                        
     456                                error('smb_dt/dt = %f. The number of SMB time steps in one transient core time step has to be an an integer',md.timestepping.time_step/dt);
     457                        end
     458
    455459                        %process requested outputs
    456460                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBgemb.py

    r24213 r24240  
    3131
    3232        #inputs:
    33         self.Ta = float('NaN')  #2 m air temperature, in Kelvin
    34         self.V = float('NaN')  #wind speed (m / s - 1)
    35         self.dswrf = float('NaN')  #downward shortwave radiation flux [W / m^2]
    36         self.dlwrf = float('NaN')  #downward longwave radiation flux [W / m^2]
    37         self.P = float('NaN')  #precipitation [mm w.e. / m^2]
    38         self.eAir = float('NaN')  #screen level vapor pressure [Pa]
    39         self.pAir = float('NaN')  #surface pressure [Pa]
    40         self.Tmean = float('NaN')  #mean annual temperature [K]
    41         self.Vmean = float('NaN')  #mean annual wind velocity [m s - 1]
    42         self.C = float('NaN')  #mean annual snow accumulation [kg m - 2 yr - 1]
    43         self.Tz = float('NaN')  #height above ground at which temperature (T) was sampled [m]
    44         self.Vz = float('NaN')  #height above ground at which wind (V) was sampled [m]
     33        self.Ta = float('NaN')       #2 m air temperature, in Kelvin
     34        self.V = float('NaN')        #wind speed (m/s-1)
     35        self.dswrf = float('NaN')    #downward shortwave radiation flux [W/m^2]
     36        self.dlwrf = float('NaN')    #downward longwave radiation flux [W/m^2]
     37        self.P = float('NaN')        #precipitation [mm w.e. / m^2]
     38        self.eAir = float('NaN')     #screen level vapor pressure [Pa]
     39        self.pAir = float('NaN')     #surface pressure [Pa]
     40        self.Tmean = float('NaN')    #mean annual temperature [K]
     41        self.Vmean = float('NaN')    #mean annual wind velocity [m s-1]
     42        self.C = float('NaN')        #mean annual snow accumulation [kg m-2 yr-1]
     43        self.Tz = float('NaN')       #height above ground at which temperature (T) was sampled [m]
     44        self.Vz = float('NaN')       #height above ground at which wind (V) eas sampled [m]
    4545
    4646        #optional inputs:
     
    4949
    5050        # Initialization of snow properties
    51         self.Dzini = float('NaN')  #cell depth (m)
    52         self.Dini = float('NaN')  #snow density (kg m - 3)
    53         self.Reini = float('NaN')  #effective grain size (mm)
    54         self.Gdnini = float('NaN')  #grain dricity (0 - 1)
    55         self.Gspini = float('NaN')  #grain sphericity (0 - 1)
    56         self.ECini = float('NaN')  #evaporation/condensation (kg m - 2)
    57         self.Wini = float('NaN')  #Water content (kg m - 2)
    58         self.Aini = float('NaN')  #albedo (0 - 1)
    59         self.Tini = float('NaN')  #snow temperature (K)
     51        self.Dzini = float('NaN')    #cell depth (m)
     52        self.Dini = float('NaN')     #snow density (kg m-3)
     53        self.Reini = float('NaN')    #effective grain size (mm)
     54        self.Gdnini = float('NaN')   #grain dricity (0-1)
     55        self.Gspini = float('NaN')   #grain sphericity (0-1)
     56        self.ECini = float('NaN')    #evaporation/condensation (kg m-2)
     57        self.Wini = float('NaN')     #Water content (kg m-2)
     58        self.Aini = float('NaN')     #albedo (0-1)
     59        self.Tini = float('NaN')     #snow temperature (K)
    6060        self.Sizeini = float('NaN')  #Number of layers
    6161
    6262        #settings:
    63         self.aIdx = float('NaN')  #method for calculating albedo and subsurface absorption (default is 1)
    64         # 0: direct input from aValue parameter
    65         # 1: effective grain radius [Gardner & Sharp, 2009]
    66         # 2: effective grain radius [Brun et al., 2009]
    67         # 3: density and cloud amount [Greuell & Konzelmann, 1994]
    68         # 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
    69         # 5: ingest MODIS mode, direct input from aValue parameter applied to surface ice only
    70         self.swIdx = float('NaN')  # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1)
    71         self.denIdx = float('NaN')  #densification model to use (default is 2):
    72         # 1 = emperical model of Herron and Langway (1980)
    73         # 2 = semi - emperical model of Anthern et al. (2010)
    74         # 3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)
    75         # 4 = DO NOT USE: emperical model of Li and Zwally (2004)
    76         # 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
    77         # 6 = Antarctica semi - emperical model of Ligtenberg et al. (2011)
    78         # 7 = Greenland semi - emperical model of Kuipers Munneke et al. (2015)
     63        self.aIdx = float('NaN')     #method for calculating albedo and subsurface absorption (default is 1)
     64        self.swIdx = float('NaN')    # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1)
     65        self.denIdx = float('NaN')   #densification model to use (default is 2):
    7966        self.dsnowIdx = float('NaN')  #model for fresh snow accumulation density (default is 1):
    80         # 0 = Original GEMB value, 150 kg / m^3
    81         # 1 = Antarctica value of fresh snow density, 350 kg / m^3
    82         # 2 = Greenland value of fresh snow density, 315 kg / m^3, Fausto et al. (2008)
    83         # 3 = Antarctica model of Kaspers et al. (2004)
    84         # 4 = Greenland model of Kuipers Munneke et al. (2015)
    85 
    86         self.zTop = float('NaN')  # depth over which grid length is constant at the top of the snopack (default 10) [m]
    87         self.dzTop = float('NaN')  # initial top vertical grid spacing (default .05) [m]
    88         self.dzMin = float('NaN')  # initial min vertical allowable grid spacing (default dzTop / 2) [m]
    89         self.zY = float('NaN')  # strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]
    90         self.zMax = float('NaN')  #initial max model depth (default is min(thickness, 250)) [m]
    91         self.zMin = float('NaN')  #initial min model depth (default is min(thickness, 130)) [m]
    92         self.outputFreq = float('NaN')  #output frequency in days (default is monthly, 30)
     67        self.zTop = float('NaN')     # depth over which grid length is constant at the top of the snopack (default 10) [m]
     68        self.dzTop = float('NaN')    # initial top vertical grid spacing (default .05) [m]
     69        self.dzMin = float('NaN')    # initial min vertical allowable grid spacing (default dzMin/2) [m]
     70        self.zY = float('NaN')       # strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]
     71        self.zMax = float('NaN')     #initial max model depth (default is min(thickness, 500)) [m]
     72        self.zMin = float('NaN')     #initial min model depth (default is min(thickness, 30)) [m]
     73        self.outputFreq = float('NaN')       #output frequency in days (default is monthly, 30)
    9374
    9475        #specific albedo parameters:
    9576        #Method 1 and 2:
    96         self.aSnow = float('NaN')  # new snow albedo (0.64 - 0.89)
    97         self.aIce = float('NaN')  # range 0.27 - 0.58 for old snow
    98         #Method 3: Radiation Correction Factors - > only used for met station data and Greuell & Konzelmann, 1994 albedo
     77        self.aSnow = float('NaN')    # new snow albedo (0.64 - 0.89)
     78        self.aIce = float('NaN')     # range 0.27-0.58 for old snow
     79        #Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo
    9980        self.cldFrac = float('NaN')  # average cloud amount
    10081        #Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005)
    101         self.t0wet = float('NaN')  # time scale for wet snow (15 - 21.9)
    102         self.t0dry = float('NaN')  # warm snow timescale (30)
    103         self.K = float('NaN')  # time scale temperature coef. (7)
     82        self.t0wet = float('NaN')    # time scale for wet snow (15-21.9)
     83        self.t0dry = float('NaN')    # warm snow timescale (30)
     84        self.K = float('NaN')        # time scale temperature coef. (7)
    10485        self.adThresh = float('NaN')  # Apply aIdx method to all areas with densities below this value,
    10586        # or else apply direct input value from aValue, allowing albedo to be altered.
    106         # Default value is rho water (1023 kg m - 3).
     87        # Default value is rho water (1023 kg m-3).
    10788
    10889        #densities:
    109         self.InitDensityScaling = float('NaN')  #initial scaling factor multiplying the density of ice, which describes the density of the snowpack.
     90        self.InitDensityScaling = float('NaN')       #initial scaling factor multiplying the density of ice, which describes the density of the snowpack.
    11091
    11192        #thermo:
    11293        self.ThermoDeltaTScaling = float('NaN')  #scaling factor to multiply the thermal diffusion timestep (delta t)
    11394
     95        self.steps_per_step = 1
    11496        self.requested_outputs = []
    11597
    116     #Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM.
    117     #dateN: that's the last row of the above fields.
    118     #dt:    included in dateN. Not an input.
    119     #elev:  this is taken from the ISSM surface itself.
    120 
    121     #}}}
     98        #Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM.
     99        #dateN: that's the last row of the above fields.
     100        #dt:    included in dateN. Not an input.
     101        #elev:  this is taken from the ISSM surface itself.
     102
     103        #}}}
     104
    122105
    123106    def __repr__(self):  # {{{
    124107        #string = "   surface forcings parameters:"
    125         #string = "  #s\n  #s" % (string, fielddisplay(self, 'mass_balance', 'surface mass balance [m / yr ice eq]'))
    126         #string = "  #s\n  #s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
     108        #string = "#s\n#s"%(string, fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]'))
     109        #string = "#s\n#s"%(string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    127110        string = '   surface forcings for SMB GEMB model :'
    128111        string = "%s\n%s" % (string, fielddisplay(self, 'issmbgradients', 'is smb gradients method activated (0 or 1, default is 0)'))
     
    137120        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
    138121        string = "%s\n%s" % (string, fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin'))
    139         string = "%s\n%s" % (string, fielddisplay(self, 'V', 'wind speed (m s - 1)'))
    140         string = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward shortwave radiation flux [W / m^2]'))
    141         string = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward longwave radiation flux [W / m^2]'))
     122        string = "%s\n%s" % (string, fielddisplay(self, 'V', 'wind speed (m s-1)'))
     123        string = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward shortwave radiation flux [W/m^2]'))
     124        string = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward longwave radiation flux [W/m^2]'))
    142125        string = "%s\n%s" % (string, fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]'))
    143126        string = "%s\n%s" % (string, fielddisplay(self, 'eAir', 'screen level vapor pressure [Pa]'))
    144127        string = "%s\n%s" % (string, fielddisplay(self, 'pAir', 'surface pressure [Pa]'))
    145128        string = "%s\n%s" % (string, fielddisplay(self, 'Tmean', 'mean annual temperature [K]'))
    146         string = "%s\n%s" % (string, fielddisplay(self, 'C', 'mean annual snow accumulation [kg m - 2 yr - 1]'))
    147         string = "%s\n%s" % (string, fielddisplay(self, 'Vmean', 'mean annual wind velocity [m s - 1] (default 10 m / s)'))
     129        string = "%s\n%s" % (string, fielddisplay(self, 'C', 'mean annual snow accumulation [kg m-2 yr-1]'))
     130        string = "%s\n%s" % (string, fielddisplay(self, 'Vmean', 'mean annual temperature [m s-1] (default 10 m/s)'))
    148131        string = "%s\n%s" % (string, fielddisplay(self, 'Tz', 'height above ground at which temperature (T) was sampled [m]'))
    149         string = "%s\n%s" % (string, fielddisplay(self, 'Vz', 'height above ground at which wind (V) was sampled [m]'))
     132        string = "%s\n%s" % (string, fielddisplay(self, 'Vz', 'height above ground at which wind (V) eas sampled [m]'))
    150133        string = "%s\n%s" % (string, fielddisplay(self, 'zTop', 'depth over which grid length is constant at the top of the snopack (default 10) [m]'))
    151134        string = "%s\n%s" % (string, fielddisplay(self, 'dzTop', 'initial top vertical grid spacing (default .05) [m] '))
    152         string = "%s\n%s" % (string, fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin / 2) [m] '))
     135        string = "%s\n%s" % (string, fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin/2) [m] '))
    153136        string = "%s\n%s" % (string, fielddisplay(self, 'zMax', 'initial max model depth (default is min(thickness, 500)) [m]'))
    154137        string = "%s\n%s" % (string, fielddisplay(self, 'zMin', 'initial min model depth (default is min(thickness, 30)) [m]'))
     
    167150        #snow properties init
    168151        string = "%s\n%s" % (string, fielddisplay(self, 'Dzini', 'Initial cell depth when restart [m]'))
    169         string = "%s\n%s" % (string, fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m - 3]'))
     152        string = "%s\n%s" % (string, fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m-3]'))
    170153        string = "%s\n%s" % (string, fielddisplay(self, 'Reini', 'Initial grain size when restart [mm]'))
    171         string = "%s\n%s" % (string, fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [ - ]'))
    172         string = "%s\n%s" % (string, fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [ - ]'))
    173         string = "%s\n%s" % (string, fielddisplay(self, 'ECini', 'Initial evaporation / condensation when restart [kg m - 2]'))
    174         string = "%s\n%s" % (string, fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m - 2]'))
    175         string = "%s\n%s" % (string, fielddisplay(self, 'Aini', 'Initial albedo when restart [ - ]'))
     154        string = "%s\n%s" % (string, fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [-]'))
     155        string = "%s\n%s" % (string, fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [-]'))
     156        string = "%s\n%s" % (string, fielddisplay(self, 'ECini', 'Initial evaporation/condensation when restart [kg m-2]'))
     157        string = "%s\n%s" % (string, fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]'))
     158        string = "%s\n%s" % (string, fielddisplay(self, 'Aini', 'Initial albedo when restart [-]'))
    176159        string = "%s\n%s" % (string, fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]'))
    177160        string = "%s\n%s" % (string, fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [K]'))
    178161
    179162        #additional albedo parameters:
    180         if isinstance(self.aIdx, list) or isinstance(self.aIdx, np.ndarray) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
     163        if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
    181164            string = "%s\n%s" % (string, fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)'))
    182             string = "%s\n%s" % (string, fielddisplay(self, 'aIce', 'albedo of ice (0.27 - 0.58)'))
    183         elif elf.aIdx == 0:
     165            string = "%s\n%s" % (string, fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)'))
     166        elif self.aIdx == 0:
    184167            string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element.  Used only if aIdx == {0, 5}'))
    185         elif elf.aIdx == 5:
     168        elif self.aIdx == 5:
    186169            string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element.  Used only if aIdx == {0, 5}'))
    187170        elif self.aIdx == 3:
    188171            string = "%s\n%s" % (string, fielddisplay(self, 'cldFrac', 'average cloud amount'))
    189172        elif self.aIdx == 4:
    190             string = "%s\n%s" % (string, fielddisplay(self, 't0wet', 'time scale for wet snow (15 - 21.9) [d]'))
     173            string = "%s\n%s" % (string, fielddisplay(self, 't0wet', 'time scale for wet snow (15-21.9) [d]'))
    191174            string = "%s\n%s" % (string, fielddisplay(self, 't0dry', 'warm snow timescale (30) [d]'))
    192175            string = "%s\n%s" % (string, fielddisplay(self, 'K', 'time scale temperature coef. (7) [d]'))
     
    195178        string = "%s\n%s" % (string, fielddisplay(self, 'denIdx', ['densification model to use (default is 2):',
    196179                                                                   '1 = emperical model of Herron and Langway (1980)',
    197                                                                    '2 = semi - emperical model of Anthern et al. (2010)',
     180                                                                   '2 = semi-emperical model of Anthern et al. (2010)',
    198181                                                                   '3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)',
    199182                                                                   '4 = DO NOT USE: emperical model of Li and Zwally (2004)',
    200183                                                                   '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',
    201                                                                    '6 = Antarctica semi - emperical model of Ligtenberg et al. (2011)',
    202                                                                    '7 = Greenland semi - emperical model of Kuipers Munneke et al. (2015)']))
     184                                                                   '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',
     185                                                                   '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)']))
    203186        string = "%s\n%s" % (string, fielddisplay(self, 'dsnowIdx', ['model for fresh snow accumulation density (default is 1):',
    204                                                                      '0 = Original GEMB value, 150 kg / m^3',
    205                                                                      '1 = Antarctica value of fresh snow density, 350 kg / m^3',
    206                                                                      '2 = Greenland value of fresh snow density, 315 kg / m^3, Fausto et al. (2008)',
     187                                                                     '0 = Original GEMB value, 150 kg/m^3',
     188                                                                     '1 = Antarctica value of fresh snow density, 350 kg/m^3',
     189                                                                     '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',
    207190                                                                     '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',
    208191                                                                     '4 = Greenland model of Kuipers Munneke et al. (2015)']))
     192        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    209193        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    210194        return string
     
    247231        self.denIdx = 2
    248232        self.dsnowIdx = 1
    249         self.zTop = 10 * np.ones((mesh.numberofelements, ))
    250         self.dzTop = .05 * np.ones((mesh.numberofelements, ))
     233        self.zTop = 10 * np.ones((mesh.numberofelements,))
     234        self.dzTop = .05 * np.ones((mesh.numberofelements,))
    251235        self.dzMin = self.dzTop / 2
    252236        self.InitDensityScaling = 1.0
    253237        self.ThermoDeltaTScaling = 1 / 11.0
    254238
    255         self.Vmean = 10 * np.ones((mesh.numberofelements, ))
    256 
    257         self.zMax = 250 * np.ones((mesh.numberofelements, ))
    258         self.zMin = 130 * np.ones((mesh.numberofelements, ))
    259         self.zY = 1.10 * np.ones((mesh.numberofelements, ))
     239        self.Vmean = 10 * np.ones((mesh.numberofelements,))
     240
     241        self.zMax = 250 * np.ones((mesh.numberofelements,))
     242        self.zMin = 130 * np.ones((mesh.numberofelements,))
     243        self.zY = 1.10 * np.ones((mesh.numberofelements,))
    260244        self.outputFreq = 30
    261245
    262     #additional albedo parameters
     246        #additional albedo parameters
    263247        self.aSnow = 0.85
    264248        self.aIce = 0.48
     
    269253        self.adThresh = 1023
    270254
    271         self.teValue = np.ones((mesh.numberofelements, ))
    272         self.aValue = self.aSnow * np.ones(mesh.numberofelements, )
     255        self.teValue = np.ones((mesh.numberofelements,))
     256        self.aValue = self.aSnow * np.ones(mesh.numberofelements,)
    273257
    274258        self.Dzini = 0.05 * np.ones((mesh.numberofelements, 2))
     
    277261        self.Gdnini = 0.0 * np.ones((mesh.numberofelements, 2))
    278262        self.Gspini = 0.0 * np.ones((mesh.numberofelements, 2))
    279         self.ECini = 0.0 * np.ones((mesh.numberofelements, ))
     263        self.ECini = 0.0 * np.ones((mesh.numberofelements,))
    280264        self.Wini = 0.0 * np.ones((mesh.numberofelements, 2))
    281265        self.Aini = self.aSnow * np.ones((mesh.numberofelements, 2))
    282266        self.Tini = 273.15 * np.ones((mesh.numberofelements, 2))
    283         #          / !\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
    284         #         If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
    285         self.Sizeini = 2 * np.ones((mesh.numberofelements, ))
     267#       /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
     268#       If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
     269        self.Sizeini = 2 * np.ones((mesh.numberofelements,))
    286270    #}}}
    287271
    288     def checkconsistency(self, md, solution, analyses):  # {{{
     272    def checkconsistency(self, md, solution, analyses):    # {{{
     273
    289274        md = checkfield(md, 'fieldname', 'smb.isgraingrowth', 'values', [0, 1])
    290275        md = checkfield(md, 'fieldname', 'smb.isalbedo', 'values', [0, 1])
     
    297282        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
    298283
    299         md = checkfield(md, 'fieldname', 'smb.Ta', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>', 273 - 100, '<', 273 + 100)  # - 100 / 100 celsius min / max value
    300         md = checkfield(md, 'fieldname', 'smb.V', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<', 45, 'size', np.shape(self.Ta))  #max 500 km / h
    301         md = checkfield(md, 'fieldname', 'smb.dswrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1400, 'size', np.shape(self.Ta))
    302         md = checkfield(md, 'fieldname', 'smb.dlwrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, 'size', np.shape(self.Ta))
    303         md = checkfield(md, 'fieldname', 'smb.P', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 100, 'size', np.shape(self.Ta))
     284        md = checkfield(md, 'fieldname', 'smb.Ta', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>', 273 - 100, '<', 273 + 100)  #-100/100 celsius min/max value
     285        md = checkfield(md, 'fieldname', 'smb.V', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '<', 45, 'size', np.shape(self.Ta))  #max 500 km/h
     286        md = checkfield(md, 'fieldname', 'smb.dswrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1400, 'size', np.shape(self.Ta))
     287        md = checkfield(md, 'fieldname', 'smb.dlwrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, 'size', np.shape(self.Ta))
     288        md = checkfield(md, 'fieldname', 'smb.P', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 100, 'size', np.shape(self.Ta))
    304289        md = checkfield(md, 'fieldname', 'smb.eAir', 'timeseries', 1, 'NaN', 1, 'Inf', 1, 'size', np.shape(self.Ta))
    305290
    306291        if (self.isclimatology > 0):
    307             md = checkfield(md, 'fieldname', 'smb.Ta', 'size', [md.mesh.numberofelements + 1], 'message', 'Ta must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    308             md = checkfield(md, 'fieldname', 'smb.V', 'size', [md.mesh.numberofelements + 1], 'message', 'V must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    309             md = checkfield(md, 'fieldname', 'smb.dswrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dswrf must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    310             md = checkfield(md, 'fieldname', 'smb.dlwrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dlwrf must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    311             md = checkfield(md, 'fieldname', 'smb.P', 'size', [md.mesh.numberofelements + 1], 'message', 'P must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    312             md = checkfield(md, 'fieldname', 'smb.eAir', 'size', [md.mesh.numberofelements + 1], 'message', 'eAir must have md.mesh.numberofelements + 1 rows in order to force a climatology')
    313 
    314         md = checkfield(md, 'fieldname', 'smb.Tmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>', 273 - 100, '<', 273 + 100)  # - 100 / 100 celsius min / max value
    315         md = checkfield(md, 'fieldname', 'smb.C', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>=', 0)
    316         md = checkfield(md, 'fieldname', 'smb.Vmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>=', 0)
    317         md = checkfield(md, 'fieldname', 'smb.Tz', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 5000)
    318         md = checkfield(md, 'fieldname', 'smb.Vz', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 5000)
     292            md = checkfield(md, 'fieldname', 'smb.Ta', 'size', [md.mesh.numberofelements + 1], 'message', 'Ta must have md.mesh.numberofelements+1 rows in order to force a climatology')
     293            md = checkfield(md, 'fieldname', 'smb.V', 'size', [md.mesh.numberofelements + 1], 'message', 'V must have md.mesh.numberofelements+1 rows in order to force a climatology')
     294            md = checkfield(md, 'fieldname', 'smb.dswrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology')
     295            md = checkfield(md, 'fieldname', 'smb.dlwrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology')
     296            md = checkfield(md, 'fieldname', 'smb.P', 'size', [md.mesh.numberofelements + 1], 'message', 'P must have md.mesh.numberofelements+1 rows in order to force a climatology')
     297            md = checkfield(md, 'fieldname', 'smb.eAir', 'size', [md.mesh.numberofelements + 1], 'message', 'eAir must have md.mesh.numberofelements+1 rows in order to force a climatology')
     298
     299        md = checkfield(md, 'fieldname', 'smb.Tmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>', 273 - 100, '<', 273 + 100)  #-100/100 celsius min/max value
     300        md = checkfield(md, 'fieldname', 'smb.C', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0)
     301        md = checkfield(md, 'fieldname', 'smb.Vmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0)
     302        md = checkfield(md, 'fieldname', 'smb.Tz', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 5000)
     303        md = checkfield(md, 'fieldname', 'smb.Vz', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 5000)
    319304
    320305        md = checkfield(md, 'fieldname', 'smb.teValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
     
    325310        md = checkfield(md, 'fieldname', 'smb.dsnowIdx', 'NaN', 1, 'Inf', 1, 'values', [0, 1, 2, 3, 4])
    326311
    327         md = checkfield(md, 'fieldname', 'smb.zTop', 'NaN', 1, 'Inf', 1, '>=', 0)
     312        md = checkfield(md, 'fieldname', 'smb.zTop', 'NaN', 1, 'Inf', 1, '> = ', 0)
    328313        md = checkfield(md, 'fieldname', 'smb.dzTop', 'NaN', 1, 'Inf', 1, '>', 0)
    329314        md = checkfield(md, 'fieldname', 'smb.dzMin', 'NaN', 1, 'Inf', 1, '>', 0)
    330         md = checkfield(md, 'fieldname', 'smb.zY', 'NaN', 1, 'Inf', 1, '>=', 1)
     315        md = checkfield(md, 'fieldname', 'smb.zY', 'NaN', 1, 'Inf', 1, '> = ', 1)
    331316        md = checkfield(md, 'fieldname', 'smb.outputFreq', 'NaN', 1, 'Inf', 1, '>', 0, '<', 10 * 365)  #10 years max
    332         md = checkfield(md, 'fieldname', 'smb.InitDensityScaling', 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
    333         md = checkfield(md, 'fieldname', 'smb.ThermoDeltaTScaling', 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
     317        md = checkfield(md, 'fieldname', 'smb.InitDensityScaling', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1)
     318        md = checkfield(md, 'fieldname', 'smb.ThermoDeltaTScaling', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1)
    334319        md = checkfield(md, 'fieldname', 'smb.adThresh', 'NaN', 1, 'Inf', 1, '>=', 0)
    335320
    336         if isinstance(self.aIdx, list) or isinstance(self.aIdx, np.ndarray) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
    337             md = checkfield(md, 'fieldname', 'smb.aSnow', 'NaN', 1, 'Inf', 1, '>=', .64, '<=', .89)
    338             md = checkfield(md, 'fieldname', 'smb.aIce', 'NaN', 1, 'Inf', 1, '>=', .27, '<=', .58)
     321        if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
     322            md = checkfield(md, 'fieldname', 'smb.aSnow', 'NaN', 1, 'Inf', 1, '> = ', .64, '< = ', .89)
     323            md = checkfield(md, 'fieldname', 'smb.aIce', 'NaN', 1, 'Inf', 1, '> = ', .27, '< = ', .58)
    339324        elif self.aIdx == 0:
    340325            md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
    341326        elif self.aIdx == 3:
    342             md = checkfield(md, 'fieldname', 'smb.cldFrac', 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
     327            md = checkfield(md, 'fieldname', 'smb.cldFrac', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1)
    343328        elif self.aIdx == 4:
    344             md = checkfield(md, 'fieldname', 'smb.t0wet', 'NaN', 1, 'Inf', 1, '>=', 15, '<=', 21.9)
    345             md = checkfield(md, 'fieldname', 'smb.t0dry', 'NaN', 1, 'Inf', 1, '>=', 30, '<=', 30)
    346             md = checkfield(md, 'fieldname', 'smb.K', 'NaN', 1, 'Inf', 1, '>=', 7, '<=', 7)
     329            md = checkfield(md, 'fieldname', 'smb.t0wet', 'NaN', 1, 'Inf', 1, '> = ', 15, '< = ', 21.9)
     330            md = checkfield(md, 'fieldname', 'smb.t0dry', 'NaN', 1, 'Inf', 1, '> = ', 30, '< = ', 30)
     331            md = checkfield(md, 'fieldname', 'smb.K', 'NaN', 1, 'Inf', 1, '> = ', 7, '< = ', 7)
    347332
    348333        #check zTop is < local thickness:
    349334        he = np.sum(md.geometry.thickness[md.mesh.elements - 1], axis=1) / np.size(md.mesh.elements, 1)
    350335        if np.any(he < self.zTop):
    351             error('SMBgemb consistency check error: zTop should be smaller than local ice thickness')
    352 
     336            raise IOError('SMBgemb consistency check error: zTop should be smaller than local ice thickness')
     337        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    353338        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
    354339        return md
    355340    # }}}
    356341
    357     def marshall(self, prefix, md, fid):  # {{{
     342    def marshall(self, prefix, md, fid):    # {{{
     343
    358344        yts = md.constants.yts
    359345
     
    408394        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'teValue', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
    409395
    410     #snow properties init
     396        #snow properties init
    411397        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Dzini', 'format', 'DoubleMat', 'mattype', 3)
    412398        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Dini', 'format', 'DoubleMat', 'mattype', 3)
     
    419405        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tini', 'format', 'DoubleMat', 'mattype', 3)
    420406        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Sizeini', 'format', 'IntMat', 'mattype', 2)
    421 
    422     #figure out dt from forcings:
     407        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
     408        #figure out dt from forcings:
    423409        time = self.Ta[-1]  #assume all forcings are on the same time step
    424410        dtime = np.diff(time, n=1, axis=0)
     
    427413        WriteData(fid, prefix, 'data', dt, 'name', 'md.smb.dt', 'format', 'Double', 'scale', yts)
    428414
    429     # Check if smb_dt goes evenly into transient core time step
     415        # Check if smb_dt goes evenly into transient core time step
    430416        if (md.timestepping.time_step % dt >= 1e-10):
    431             error('smb_dt/dt = #f. The number of SMB time steps in one transient core time step has to be an an integer', md.timestepping.time_step / dt)
    432 
    433     #process requested outputs
     417            raise IOError('smb_dt/dt = #f. The number of SMB time steps in one transient core time step has to be an an integer', md.timestepping.time_step / dt)
     418
     419        #process requested outputs
    434420        outputs = self.requested_outputs
    435421        indices = [i for i, x in enumerate(outputs) if x == 'default']
  • issm/trunk-jpl/src/m/classes/SMBgradients.m

    r21049 r24240  
    55
    66classdef SMBgradients
    7         properties (SetAccess=public)
    8                 href   = NaN;
    9                 smbref = NaN;
    10                 b_pos  = NaN;
    11                 b_neg  = NaN;
    12                 requested_outputs      = {};
     7        properties (SetAccess=public)
     8                href              = NaN;
     9                smbref            = NaN;
     10                b_pos             = NaN;
     11                b_neg             = NaN;
     12                steps_per_step    = 1;
     13                requested_outputs = {};
    1314        end
    1415        methods
     
    4748                                md = checkfield(md,'fieldname','smb.b_neg','timeseries',1,'NaN',1,'Inf',1);
    4849                        end
     50                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    4951                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    5052                end % }}}
     
    5759                        fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated');
    5860                        fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
     61                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    5962                        fielddisplay(self,'requested_outputs','additional outputs requested');
    6063
     
    6871                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    6972                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    70                         WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    71                        
     73                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts, ...
     74                                  'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     75                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     76
    7277                        %process requested outputs
    7378                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBgradients.py

    r24213 r24240  
    99
    1010       Usage:
    11           SMBgradients = SMBgradients()
     11          SMBgradients = SMBgradients();
    1212    """
    1313
     
    1717        self.b_pos = float('NaN')
    1818        self.b_neg = float('NaN')
     19        self.steps_per_step = 1
    1920        self.requested_outputs = []
    2021    #}}}
     
    2829        string = "%s\n%s" % (string, fielddisplay(self, 'b_pos', ' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
    2930        string = "%s\n%s" % (string, fielddisplay(self, 'b_neg', ' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
     31        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    3032        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    3133
     
    4749    #}}}
    4850
    49     def checkconsistency(self, md, solution, analyses):  # {{{
     51    def checkconsistency(self, md, solution, analyses):    # {{{
    5052        if 'MasstransportAnalysis' in analyses:
    5153            md = checkfield(md, 'fieldname', 'smb.href', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     
    5456            md = checkfield(md, 'fieldname', 'smb.b_neg', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    5557
     58        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    5659        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    5760        return md
    5861    # }}}
    5962
    60     def marshall(self, prefix, md, fid):  # {{{
     63    def marshall(self, prefix, md, fid):    # {{{
    6164        yts = md.constants.yts
    6265
    6366        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 6, 'format', 'Integer')
    64         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'href', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     67        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'href', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    6568        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'smbref', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    6669        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_pos', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    6770        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_neg', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     71        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    6872
    69     #process requested outputs
     73        #process requested outputs
    7074        outputs = self.requested_outputs
    7175        indices = [i for i, x in enumerate(outputs) if x == 'default']
  • issm/trunk-jpl/src/m/classes/SMBgradientscomponents.m

    r23365 r24240  
    66classdef SMBgradientscomponents
    77        properties (SetAccess=public)
    8                 accuref                                   = NaN;
    9                 accualti                                  = NaN;
    10                 accugrad                                  = NaN;
    11                 runoffref                                 = NaN;
    12                 runoffalti                        = NaN;
    13                 runoffgrad                        = NaN;
     8
     9                accuref           = NaN;
     10                accualti          = NaN;
     11                accugrad          = NaN;
     12                runoffref         = NaN;
     13                runoffalti        = NaN;
     14                runoffgrad        = NaN;
     15                steps_per_step    = 1;
    1416                requested_outputs = {};
    1517        end
     
    5153                                md = checkfield(md,'fieldname','smb.runoffgrad','numel',1,'NaN',1,'Inf',1);
    5254                        end
     55                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    5356                        md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1);
    5457                end % }}}
     
    6366                        fielddisplay(self,'runoffalti',' Altitude at which the runoff is equal to the reference value');
    6467                        fielddisplay(self,'runoffgrad',' Gradient of the variation of the runoff (0 for uniform runoff) m w.e. m-1 y-1 (lpase rate times ddf)');
     68                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    6569                        fielddisplay(self,'requested_outputs','additional outputs requested');
    6670
     
    7579                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoffalti','format','Double');
    7680                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoffgrad', ...
    77                                                                 'format','Double','scale',1./md.constants.yts);
     81                                  'format','Double','scale',1./md.constants.yts);
     82                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     83
    7884
    7985                        %process requested outputs
  • issm/trunk-jpl/src/m/classes/SMBgradientscomponents.py

    r24213 r24240  
    99
    1010       Usage:
    11           SMBgradients = SMBgradientscomponents()
    12     For now it has accumulation, runoff ans retention which could be aither refreezing and / or evaporation
     11          SMBgradients = SMBgradientscomponents();
     12    For now it has accumulation, runoff ans retention which could be aither refreezing and/or evaporation
    1313    """
    1414
     
    2020        self.runoffalti = float('NaN')
    2121        self.runoffgrad = float('NaN')
     22        self.steps_per_step = 1
    2223        self.requested_outputs = ['default']
    2324    #}}}
     
    2829        string = "%s\n%s" % (string, fielddisplay(self, 'accualti', ' Altitude at which the accumulation is equal to the reference value'))
    2930        string = "%s\n%s" % (string, fielddisplay(self, 'accugrad', ' Gradient of the variation of the accumulation (0 for uniform accumulation)'))
    30         string = "%s\n%s" % (string, fielddisplay(self, 'runoffref', ' reference value of the runoff m w.e. y - 1 (temperature times ddf)'))
     31        string = "%s\n%s" % (string, fielddisplay(self, 'runoffref', ' reference value of the runoff m w.e. y-1 (temperature times ddf)'))
    3132        string = "%s\n%s" % (string, fielddisplay(self, 'runoffalti', ' Altitude at which the runoff is equal to the reference value'))
    32         string = "%s\n%s" % (string, fielddisplay(self, 'runoffgrad', ' Gradient of the variation of the runoff (0 for uniform runoff) m w.e. m - 1 y - 1 (lpase rate times ddf)'))
     33        string = "%s\n%s" % (string, fielddisplay(self, 'runoffgrad', ' Gradient of the variation of the runoff (0 for uniform runoff) m w.e. m-1 y-1 (lapse rate times ddf)'))
     34        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    3335        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    3436
     
    4244
    4345    def defaultoutputs(self, md):  # {{{
    44         return ['SmbMassBalance', 'SmbRunoff']
     46        list = ['SmbMassBalance', 'SmbRunoff']
     47        if self.steps_per_step > 1:
     48            list.extend(['SmbMassBalanceSubstep', 'SmbRunoffSubstep'])
     49        return list
    4550    #}}}
    4651
     
    5863            md = checkfield(md, 'fieldname', 'smb.runoffalti', 'numel', [1], 'NaN', 1, 'Inf', 1)
    5964            md = checkfield(md, 'fieldname', 'smb.runoffgrad', 'numel', [1], 'NaN', 1, 'Inf', 1)
     65
     66        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    6067        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    6168        return md
    6269    # }}}
    6370
    64     def marshall(self, prefix, md, fid):  # {{{
     71    def marshall(self, prefix, md, fid):    # {{{
    6572        yts = md.constants.yts
    6673        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 11, 'format', 'Integer')
    6774        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accuref', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts, 'scale', 1. / yts)
    6875        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accualti', 'format', 'Double')
    69         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accugrad', 'format', 'Double', 'scale', 1. / yts)
     76        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accugrad', 'format', 'Double', 'scale', 1. / md.constants.yts)
    7077        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoffref', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts, 'scale', 1. / yts)
    7178        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoffalti', 'format', 'Double')
    72         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoffgrad', 'format', 'Double', 'scale', 1. / yts)
     79        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoffgrad', 'format', 'Double', 'scale', 1. / md.constants.yts)
     80        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    7381
    74     #process requested outputs
     82        #process requested outputs
    7583        outputs = self.requested_outputs
    7684        indices = [i for i, x in enumerate(outputs) if x == 'default']
  • issm/trunk-jpl/src/m/classes/SMBgradientsela.m

    r21470 r24240  
    55
    66classdef SMBgradientsela
    7         properties (SetAccess=public)
    8                 ela    = NaN;
    9                 b_pos  = NaN;
    10                 b_neg  = NaN;
    11                 b_max  = NaN;
    12                 b_min  = NaN;
    13                 requested_outputs      = {};
     7        properties (SetAccess=public)
     8                ela               = NaN;
     9                b_pos             = NaN;
     10                b_neg             = NaN;
     11                b_max             = NaN;
     12                b_min             = NaN;
     13                steps_per_step    = 1;
     14                requested_outputs = {};
    1415        end
    1516        methods
     
    2425                function self = extrude(self,md) % {{{
    2526
    26                         %Nothing for now
     27                %Nothing for now
    2728
    2829                end % }}}
     
    3233                function self = initialize(self,md) % {{{
    3334
    34                         %Nothing done for now
     35                %Nothing done for now
    3536
    3637                end % }}}
     
    5051                                md = checkfield(md,'fieldname','smb.b_min','timeseries',1,'NaN',1,'Inf',1);
    5152                        end
     53                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    5254                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    5355                end % }}}
     
    6163                        fielddisplay(self,'b_max',' upper cap on smb rate, default: 9999 (no cap) [m ice eq./yr] ');
    6264                        fielddisplay(self,'b_min',' lower cap on smb rate, default: -9999 (no cap) [m ice eq./yr]');
     65                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    6366                        fielddisplay(self,'requested_outputs','additional outputs requested');
    6467
     
    7376                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    7477                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_max','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    75                         WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_min','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    76                        
     78                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','b_min','format','DoubleMat','mattype',1,'scale',1./yts, ...
     79                                  'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     80                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     81
    7782                        %process requested outputs
    7883                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBgradientsela.py

    r24213 r24240  
    1818        self.b_max = float('NaN')
    1919        self.b_min = float('NaN')
     20        self.steps_per_step = 1
    2021        self.requested_outputs = []
    2122        self.setdefaultparameters()
     
    2728
    2829        string = "%s\n%s" % (string, fielddisplay(self, 'ela', ' equilibrium line altitude from which deviation is used to calculate smb using the smb gradients ela method [m a.s.l.]'))
    29         string = "%s\n%s" % (string, fielddisplay(self, 'b_pos', ' vertical smb gradient (dB / dz) above ela'))
    30         string = "%s\n%s" % (string, fielddisplay(self, 'b_neg', ' vertical smb gradient (dB / dz) below ela'))
    31         string = "%s\n%s" % (string, fielddisplay(self, 'b_max', ' upper cap on smb rate, default: 9999 (no cap) [m ice eq. / yr]'))
    32         string = "%s\n%s" % (string, fielddisplay(self, 'b_min', ' lower cap on smb rate, default: - 9999 (no cap) [m ice eq. / yr]'))
     30        string = "%s\n%s" % (string, fielddisplay(self, 'b_pos', ' vertical smb gradient (dB/dz) above ela'))
     31        string = "%s\n%s" % (string, fielddisplay(self, 'b_neg', ' vertical smb gradient (dB/dz) below ela'))
     32        string = "%s\n%s" % (string, fielddisplay(self, 'b_max', ' upper cap on smb rate, default: 9999 (no cap) [m ice eq./yr]'))
     33        string = "%s\n%s" % (string, fielddisplay(self, 'b_min', ' lower cap on smb rate, default: -9999 (no cap) [m ice eq./yr]'))
     34        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    3335        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    34 
    3536        return string
    3637    #}}}
     
    5657    #}}}
    5758
    58     def checkconsistency(self, md, solution, analyses):  # {{{
     59    def checkconsistency(self, md, solution, analyses):    # {{{
    5960        if 'MasstransportAnalysis' in analyses:
    6061            md = checkfield(md, 'fieldname', 'smb.ela', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     
    6465            md = checkfield(md, 'fieldname', 'smb.b_min', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    6566
     67        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    6668        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
    6769        return md
    6870    # }}}
     71    def marshall(self, prefix, md, fid):    # {{{
    6972
    70     def marshall(self, prefix, md, fid):  # {{{
    7173        yts = md.constants.yts
    7274
    7375        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 9, 'format', 'Integer')
    74         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ela', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     76        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ela', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    7577        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_pos', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    7678        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_neg', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    7779        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_max', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    7880        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'b_min', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     81        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    7982
    80     #process requested outputs
     83        #process requested outputs
    8184        outputs = self.requested_outputs
    8285        indices = [i for i, x in enumerate(outputs) if x == 'default']
  • issm/trunk-jpl/src/m/classes/SMBhenning.m

    r21148 r24240  
    55
    66classdef SMBhenning
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                smbref = NaN;
     9                steps_per_step=1;
    910                requested_outputs      = {};
    1011        end
     
    1617                                        inputstruct=varargin{1};
    1718                                        list1 = properties('SMBhenning');
    18                                         list2 = fieldnames(inputstruct);
    19                                         for i=1:length(list1)
    20                                                 fieldname = list1{i};
    21                                                 if ismember(fieldname,list2),
    22                                                         self.(fieldname) = inputstruct.(fieldname);
     19                                                list2 = fieldnames(inputstruct);
     20                                                for i=1:length(list1)
     21                                                        fieldname = list1{i};
     22                                                        if ismember(fieldname,list2),
     23                                                                self.(fieldname) = inputstruct.(fieldname);
     24                                                        end
    2325                                                end
    24                                         end
    2526                                otherwise
    2627                                        error('constructor not supported');
     
    5152                                md = checkfield(md,'fieldname','smb.smbref','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    5253                        end
     54                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    5355                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    5456                end % }}}
     
    5658                        disp(sprintf('   surface forcings parameters:'));
    5759                        fielddisplay(self,'smbref','reference smb from which deviation is calculated [m/yr ice eq]');
     60                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    5861                        fielddisplay(self,'requested_outputs','additional outputs requested');
    5962                end % }}}
     
    6467                        WriteData(fid,prefix,'name','md.smb.model','data',7,'format','Integer');
    6568                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    66                        
     69                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     70
    6771                        %process requested outputs
    6872                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBmeltcomponents.m

    r23814 r24240  
    55
    66classdef SMBmeltcomponents
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                isclimatology = 0;
    99                accumulation = NaN;
     
    1111                melt = NaN;
    1212                refreeze = NaN;
     13                steps_per_step=1;
    1314                requested_outputs      = {};
    1415        end
     
    5657                        if ismember('MasstransportAnalysis',analyses),
    5758                                md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1);
     59                                md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
     60                                md = checkfield(md,'fieldname','smb.refreeze','timeseries',1,'NaN',1,'Inf',1);
     61                                md = checkfield(md,'fieldname','smb.melt','timeseries',1,'NaN',1,'Inf',1);
    5862                        end
    5963                        if ismember('BalancethicknessAnalysis',analyses),
    6064                                md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    61                         end
    62                         if ismember('MasstransportAnalysis',analyses),
    63                                 md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
    64                         end
    65                         if ismember('BalancethicknessAnalysis',analyses),
    6665                                md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    67                         end
    68                         if ismember('MasstransportAnalysis',analyses),
    69                                 md = checkfield(md,'fieldname','smb.refreeze','timeseries',1,'NaN',1,'Inf',1);
    70                         end
    71                         if ismember('BalancethicknessAnalysis',analyses),
    7266                                md = checkfield(md,'fieldname','smb.refreeze','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    73                         end
    74                         if ismember('MasstransportAnalysis',analyses),
    75                                 md = checkfield(md,'fieldname','smb.melt','timeseries',1,'NaN',1,'Inf',1);
    76                         end
    77                         if ismember('BalancethicknessAnalysis',analyses),
    7867                                md = checkfield(md,'fieldname','smb.melt','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    7968                        end
     69                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    8070                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    8171                        md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
    8272                        if (self.isclimatology)
    8373                                md = checkfield(md,'fieldname', 'smb.accumulation', 'size',[md.mesh.numberofvertices+1],...
    84                                         'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     74                                                'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    8575                                md = checkfield(md,'fieldname', 'smb.melt', 'size',[md.mesh.numberofvertices+1],...
    86                                         'message',['melt must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     76                                                'message',['melt must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    8777                                md = checkfield(md,'fieldname', 'smb.refreeze', 'size',[md.mesh.numberofvertices+1],...
    88                                         'message',['refreeze must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     78                                                'message',['refreeze must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    8979                                md = checkfield(md,'fieldname', 'smb.evaporation', 'size',[md.mesh.numberofvertices+1],...
    90                                         'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
     80                                                'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
    9181                        end
    9282                end % }}}
     
    9888                        fielddisplay(self,'refreeze','amount of ice melt refrozen in ice column [m/yr ice eq]');
    9989                        fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
     90                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    10091                        fielddisplay(self,'requested_outputs','additional outputs requested');
    10192                end % }}}
     
    109100                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','melt','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    110101                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','refreeze','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    111                        
     102                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
     103
    112104                        %process requested outputs
    113105                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBmeltcomponents.py

    r24213 r24240  
    1010
    1111       Usage:
    12           SMBmeltcomponents = SMBmeltcomponents()
     12          SMBmeltcomponents = SMBmeltcomponents();
    1313    """
    1414
     
    1818        self.evaporation = float('NaN')
    1919        self.isclimatology = 0
     20        self.steps_per_step = 1
    2021        self.requested_outputs = []
    2122    #}}}
    2223
    2324    def __repr__(self):  # {{{
    24         string = "   surface forcings parameters with melt (SMB = accumulation - evaporation - melt + refreeze) :"
    25         string = "%s\n%s" % (string, fielddisplay(self, 'accumulation', 'accumulated snow [m / yr ice eq]'))
    26         string = "%s\n%s" % (string, fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m / yr ice eq]'))
    27         string = "%s\n%s" % (string, fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m / yr ice eq]'))
    28         string = "%s\n%s" % (string, fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m / yr ice eq]'))
     25        string = "   surface forcings parameters with melt (SMB = accumulation-evaporation-melt+refreeze) :"
     26        string = "%s\n%s" % (string, fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))
     27        string = "%s\n%s" % (string, fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))
     28        string = "%s\n%s" % (string, fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m/yr ice eq]'))
     29        string = "%s\n%s" % (string, fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m/yr ice eq]'))
    2930        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
     31        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    3032        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    3133        return string
     
    6466    #}}}
    6567
    66     def checkconsistency(self, md, solution, analyses):  # {{{
     68    def checkconsistency(self, md, solution, analyses):    # {{{
    6769        if 'MasstransportAnalysis' in analyses:
    6870            md = checkfield(md, 'fieldname', 'smb.accumulation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     71            md = checkfield(md, 'fieldname', 'smb.melt', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     72            md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
     73            md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    6974
    7075        if 'BalancethicknessAnalysis' in analyses:
    7176            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    72 
    73         if 'MasstransportAnalysis' in analyses:
    74             md = checkfield(md, 'fieldname', 'smb.melt', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    75 
    76         if 'BalancethicknessAnalysis' in analyses:
    7777            md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    78 
    79         if 'MasstransportAnalysis' in analyses:
    80             md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    81 
    82         if 'BalancethicknessAnalysis' in analyses:
    8378            md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    84 
    85         if 'MasstransportAnalysis' in analyses:
    86             md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
    87 
    88         if 'BalancethicknessAnalysis' in analyses:
    8979            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
    9080
     81        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    9182        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    9283        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
    9384        return md
    9485    # }}}
     86    def marshall(self, prefix, md, fid):    # {{{
    9587
    96     def marshall(self, prefix, md, fid):  # {{{
    9788        yts = md.constants.yts
    9889
     
    10293        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'melt', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    10394        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'refreeze', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     95        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    10496
    105     #process requested outputs
     97        #process requested outputs
    10698        outputs = self.requested_outputs
    10799        indices = [i for i, x in enumerate(outputs) if x == 'default']
     
    112104        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isclimatology', 'format', 'Boolean')
    113105        if (self.isclimatology > 0):
    114             md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices + 1], 'message', 'accumulation must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
    115             md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices + 1], 'message', 'melt must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
    116             md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices + 1], 'message', 'refreeze must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
    117             md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices + 1], 'message', 'evaporation must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
     106            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices + 1], 'message', 'accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
     107            md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices + 1], 'message', 'melt must have md.mesh.numberofvertices+1 rows in order to force a climatology')
     108            md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices + 1], 'message', 'refreeze must have md.mesh.numberofvertices+1 rows in order to force a climatology')
     109            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices + 1], 'message', 'evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
    118110
    119111    # }}}
  • issm/trunk-jpl/src/m/classes/SMBpdd.m

    r22448 r24240  
    55
    66classdef SMBpdd
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                precipitation             = NaN;
    99                monthlytemperatures       = NaN;
     
    1212                s0t                       = NaN;
    1313                rlaps                     = 0;
    14                 rlapslgm                  = 0; 
     14                rlapslgm                  = 0;
    1515                Pfac                      = NaN;
    1616                Tdiff                     = NaN;
     
    2525                precipitations_presentday = NaN;
    2626                precipitations_lgm        = NaN;
    27                 requested_outputs      = {};
     27                steps_per_step            = 1;
     28                requested_outputs         = {};
    2829        end
    2930        methods
     
    5556                end % }}}
    5657                function self = initialize(self,md) % {{{
    57                    
     58
    5859                        if isnan(self.s0p),
    5960                                self.s0p=zeros(md.mesh.numberofvertices,1);
     
    7374                  self.rlaps      = 6.5;
    7475                  self.rlapslgm   = 6.5;
    75                  
     76
    7677                end % }}}
    7778                function md = checkconsistency(self,md,solution,analyses) % {{{
     
    8687                                        md = checkfield(md,'fieldname','smb.monthlytemperatures','timeseries',1,'NaN',1,'Inf',1);
    8788                                        md = checkfield(md,'fieldname','smb.precipitation','timeseries',1,'NaN',1,'Inf',1);
    88                                 elseif(self.isdelta18o==1) 
     89                                elseif(self.isdelta18o==1)
    8990                                        md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
    9091                                        md = checkfield(md,'fieldname','smb.delta18o_surface','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
     
    9293                                        md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    9394                                        md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    94                                         md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);                                       
     95                                        md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    9596                                        md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
    9697                                        md = checkfield(md,'fieldname','smb.sealev','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
    97                                 elseif(self.ismungsm==1) 
     98                                elseif(self.ismungsm==1)
    9899                                        md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    99100                                        md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    100101                                        md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    101                                         md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);                                       
     102                                        md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
    102103                                        md = checkfield(md,'fieldname','smb.Pfac','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
    103104                                        md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
     
    105106                                end
    106107                        end
     108                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    107109                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    108                        
     110
    109111                end % }}}
    110112                function disp(self) % {{{
     
    140142                                fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated');
    141143                        end
     144                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    142145                        fielddisplay(self,'requested_outputs','additional outputs requested');
    143146                end % }}}
     
    156159                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','rlaps','format','Double');
    157160                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','rlapslgm','format','Double');
    158 
     161                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
    159162                        if(self.isdelta18o==0 & self.ismungsm==0)
    160163                                %WriteData(fid,prefix,'object',self,'class','smb','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
     
    179182                                WriteData(fid,prefix,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2,'yts',md.constants.yts);
    180183                        end
    181                        
     184
    182185                        %process requested outputs
    183186                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/SMBpdd.py

    r24213 r24240  
    3434        self.precipitations_presentday = float('NaN')
    3535        self.precipitations_lgm = float('NaN')
     36        self.steps_per_step = 1
    3637
    3738    #set defaults
     
    4849        string = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
    4950        string = "%s\n%s" % (string, fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]'))
    50         string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree / km]'))
    51         string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree / km]'))
     51        string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]'))
     52        string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree/km]'))
    5253        if not (self.isdelta18o and self.ismungsm):
    53             string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', ['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']))
    54             string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', ['monthly surface precipitation [m / yr water eq], required if pdd is activated and delta18o or mungsm not activated']))
     54            string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', 'monthly surface temperatures [K], required if pdd is activated and delta18o not activated'))
     55            string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', 'monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated'))
    5556            if self.isdelta18o:
    5657                string = "%s\n%s" % (string, fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated'))
    5758                string = "%s\n%s" % (string, fielddisplay(self, 'delta18o_surface', 'surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
    58                 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o / mungsm is activated'))
     59                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
    5960                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
    60                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
    61                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
     61                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     62                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
    6263                string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
    6364                string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated'))
     65
    6466            if self.ismungsm:
    65                 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o / mungsm is activated'))
     67                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
    6668                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
    67                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
    68                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
     69                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     70                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
    6971                string = "%s\n%s" % (string, fielddisplay(self, 'Pfac', 'time interpolation parameter for precipitation, 1D(year), required if mungsm is activated'))
    7072                string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
    7173                string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated'))
     74
     75        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    7276        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    7377
     
    7983            self.precipitation = project3d(md, 'vector', self.precipitation, 'type', 'node')
    8084            self.monthlytemperatures = project3d(md, 'vector', self.monthlytemperatures, 'type', 'node')
     85
    8186        if self.isdelta18o:
    8287            self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node')
    83         if self.isdelta18o:
    8488            self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node')
    85         if self.isdelta18o:
    8689            self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node')
    87         if self.isdelta18o:
    8890            self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node')
     91
    8992        if self.ismungsm:
    9093            self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node')
    91         if self.ismungsm:
    9294            self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node')
    93         if self.ismungsm:
    9495            self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node')
    95         if self.ismungsm:
    9696            self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node')
     97
    9798        self.s0p = project3d(md, 'vector', self.s0p, 'type', 'node')
    9899        self.s0t = project3d(md, 'vector', self.s0t, 'type', 'node')
    99 
    100100        return self
    101101    #}}}
     
    128128    #}}}
    129129
    130     def checkconsistency(self, md, solution, analyses):  # {{{
     130    def checkconsistency(self, md, solution, analyses):    # {{{
     131
    131132        if 'MasstransportAnalysis' in analyses:
    132133            md = checkfield(md, 'fieldname', 'smb.desfac', '<=', 1, 'numel', [1])
     
    157158                md = checkfield(md, 'fieldname', 'smb.sealev', 'NaN', 1, 'Inf', 1, 'size', [2, np.nan], 'singletimeseries', 1)
    158159
     160        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    159161        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    160162        return md
    161163    #}}}
    162164
    163     def marshall(self, prefix, md, fid):  # {{{
     165    def marshall(self, prefix, md, fid):    # {{{
    164166        yts = md.constants.yts
    165167
    166168        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 4, 'format', 'Integer')
     169
    167170        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isdelta18o', 'format', 'Boolean')
    168171        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ismungsm', 'format', 'Boolean')
     
    173176        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlaps', 'format', 'Double')
    174177        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlapslgm', 'format', 'Double')
     178        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    175179
    176180        if (self.isdelta18o == 0 and self.ismungsm == 0):
     
    182186            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    183187            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    184             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    185             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    186             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    187             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
     188            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     189            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     190            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     191            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
    188192        elif self.ismungsm:
    189193            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'temperatures_presentday', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     
    191195            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    192196            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    193             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    194             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    195             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    196 
    197     #process requested outputs
     197            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     198            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     199            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     200
     201        #process requested outputs
    198202        outputs = self.requested_outputs
    199203        indices = [i for i, x in enumerate(outputs) if x == 'default']
  • issm/trunk-jpl/src/m/classes/SMBpddSicopolis.m

    r23317 r24240  
    55
    66classdef SMBpddSicopolis
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                precipitation                                   = NaN;
    99                monthlytemperatures                     = NaN;
     
    1616                rlaps                                                           = 0;
    1717                isfirnwarming                                   = 0;
     18                steps_per_step=1
    1819                requested_outputs                               = {};
    1920        end
     
    4142                end % }}}
    4243                function self = initialize(self,md) % {{{
    43                    
     44
    4445                        if isnan(self.s0p),
    4546                                self.s0p=zeros(md.mesh.numberofvertices,1);
     
    6667                function self = setdefaultparameters(self) % {{{
    6768
    68                   self.isfirnwarming            = 1;
    69                   self.desfac                           = -log(2.0)/1000;
    70                   self.rlaps                            = 7.4;
    71                  
     69                        self.isfirnwarming              = 1;
     70                        self.desfac                             = -log(2.0)/1000;
     71                        self.rlaps                              = 7.4;
     72
    7273                end % }}}
    7374                function md = checkconsistency(self,md,solution,analyses) % {{{
     
    8283                                md = checkfield(md,'fieldname','smb.monthlytemperatures','timeseries',1,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices+1 12]);
    8384                                md = checkfield(md,'fieldname','smb.precipitation','timeseries',1,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices+1 12]);
     85
    8486                        end
     87                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    8588                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    86                        
     89
    8790                end % }}}
    8891                function disp(self) % {{{
     
    100103                        fielddisplay(self,'desfac','desertification elevation factor (default is -log(2.0)/1000)');
    101104                        fielddisplay(self,'isfirnwarming','is firnwarming (Reeh 1991) activated (0 or 1, default is 1)');
     105                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    102106                        fielddisplay(self,'requested_outputs','additional outputs requested (TemperaturePDD, SmbAccumulation, SmbMelt)');
    103107                end % }}}
     
    119123                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','precipitation_anomaly','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    120124                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','smb_corr','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     125                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
    121126
    122127                        %process requested outputs
  • issm/trunk-jpl/src/m/classes/SMBpddSicopolis.py

    r24213 r24240  
    2727        self.rlaps = 0
    2828        self.isfirnwarming = 0
     29        self.steps_per_step = 1
    2930        self.requested_outputs = []
    3031
     
    99100            md = checkfield(md, 'fieldname', 'smb.precipitation', 'timeseries', 1, 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices + 1, 12])
    100101
     102        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    101103        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
    102104
     
    109111
    110112        string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', 'monthly surface temperatures [K]'))
    111         string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', 'monthly surface precipitation [m / yr water eq]'))
     113        string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', 'monthly surface precipitation [m/yr water eq]'))
    112114        string = "%s\n%s" % (string, fielddisplay(self, 'temperature_anomaly', 'anomaly to monthly reference temperature (additive [K])'))
    113         string = "%s\n%s" % (string, fielddisplay(self, 'precipitation_anomaly', 'anomaly to monthly precipitation (multiplicative, e.g. q = q0 * exp(0.070458 * DeltaT) after Huybrechts (2002)) [no unit])'))
    114         string = "%s\n%s" % (string, fielddisplay(self, 'smb_corr', 'correction of smb after PDD call [m / a]'))
     115        string = "%s\n%s" % (string, fielddisplay(self, 'precipitation_anomaly', 'anomaly to monthly precipitation (multiplicative, e.g. q = q0*exp(0.070458*DeltaT) after Huybrechts (2002)) [no unit])'))
     116        string = "%s\n%s" % (string, fielddisplay(self, 'smb_corr', 'correction of smb after PDD call [m/a]'))
    115117        string = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
    116118        string = "%s\n%s" % (string, fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]'))
    117         string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate (default is 7.4 degree / km)'))
    118         string = "%s\n%s" % (string, fielddisplay(self, 'desfac', 'desertification elevation factor (default is - log(2.0) / 1000)'))
     119        string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate (default is 7.4 degree/km)'))
     120        string = "%s\n%s" % (string, fielddisplay(self, 'desfac', 'desertification elevation factor (default is -log(2.0)/1000)'))
    119121        string = "%s\n%s" % (string, fielddisplay(self, 'isfirnwarming', 'is firnwarming (Reeh 1991) activated (0 or 1, default is 1)'))
     122        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    120123        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested (TemperaturePDD, SmbAccumulation, SmbMelt)'))
    121124    # }}}
    122125
    123126    def marshall(self, prefix, md, fid):  # {{{
     127
    124128        yts = md.constants.yts
    125129
     
    132136        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlaps', 'format', 'Double')
    133137
    134         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'monthlytemperatures', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     138        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'monthlytemperatures', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
    135139        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    136140        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'temperature_anomaly', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    137141        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitation_anomaly', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    138142        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'smb_corr', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     143        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    139144
    140     #process requested outputs
     145        #process requested outputs
    141146        outputs = self.requested_outputs
    142147        pos = np.where('default' in outputs)
  • issm/trunk-jpl/src/m/classes/SMBsemic.m

    r23540 r24240  
    55
    66classdef SMBsemic
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                dailysnowfall           = NaN;
    99                dailyrainfall           = NaN;
     
    1919                rdl                                     = 0;
    2020                s0gcm                                   = NaN;
     21                steps_per_step = 1;
    2122                requested_outputs = {};
    2223        end
     
    7879                                md = checkfield(md,'fieldname','smb.dailytemperature','timeseries',1,'NaN',1,'Inf',1);
    7980                        end
     81                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    8082                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    8183
     
    8385                function disp(self) % {{{
    8486                        disp(sprintf('   surface forcings parameters:'));
    85                        
     87
    8688                        disp(sprintf('   Interface for coupling GCM data to the energy balance model SEMIC (Krapp et al (2017) https://doi.org/10.5194/tc-11-1519-2017).'));
    87                         disp(sprintf('   The implemented coupling uses daily mean GCM input to calculate yearly mean smb, accumulation, ablation, and surface temperature.')); 
     89                        disp(sprintf('   The implemented coupling uses daily mean GCM input to calculate yearly mean smb, accumulation, ablation, and surface temperature.'));
    8890                        disp(sprintf('   smb and temperatures are updated every year'));
    8991                        disp(sprintf('\n   SEMIC parameters:'));
    90                         fielddisplay(self,'dailysnowfall','daily surface dailysnowfall [m/s]'); 
     92                        fielddisplay(self,'dailysnowfall','daily surface dailysnowfall [m/s]');
    9193                        fielddisplay(self,'dailyrainfall','daily surface dailyrainfall [m/s]');
    9294                        fielddisplay(self,'dailydsradiation','daily downwelling shortwave radiation [W/m2]');
    9395                        fielddisplay(self,'dailydlradiation','daily downwelling longwave radiation [W/m2]');
    94                         fielddisplay(self,'dailywindspeed','daily surface wind speed [m/s]'); 
     96                        fielddisplay(self,'dailywindspeed','daily surface wind speed [m/s]');
    9597                        fielddisplay(self,'dailypressure','daily surface pressure [Pa]');
    96                         fielddisplay(self,'dailyairdensity','daily air density [kg/m3]'); 
     98                        fielddisplay(self,'dailyairdensity','daily air density [kg/m3]');
    9799                        fielddisplay(self,'dailyairhumidity','daily air specific humidity [kg/kg]');
    98100                        fielddisplay(self,'dailytemperature','daily surface air temperature [K]');
     
    101103                        fielddisplay(self,'rdl','longwave downward radiation decrease (default is 0.29 [W/m^2/km]; Marty et al. 2002)');
    102104                        fielddisplay(self,'s0gcm','GCM reference elevation; (default is 0) [m]');
     105                        fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
    103106                        fielddisplay(self,'requested_outputs','additional outputs requested');
    104107                end % }}}
    105108                function marshall(self,prefix,md,fid) % {{{
    106                        
     109
    107110                        WriteData(fid,prefix,'name','md.smb.model','data',12,'format','Integer');
    108111
     
    120123                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailyairhumidity','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    121124                        WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailytemperature','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    122                        
     125                        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
    123126                        %process requested outputs
    124127                        outputs = self.requested_outputs;
  • issm/trunk-jpl/src/m/classes/clusters/generic.py

    r24213 r24240  
    2222
    2323    def __init__(self, *args):  # {{{
    24 
    2524        self.name = ''
    2625        self.login = ''
     
    116115
    117116        else:  # Windows
    118 
    119117            fid = open(modelname + '.bat', 'w')
    120118            fid.write('@echo off\n')
     
    156154
    157155        else:    # Windows
    158 
    159156            fid = open(modelname + '.bat', 'w')
    160157            fid.write('@echo off\n')
  • issm/trunk-jpl/src/m/classes/clusters/stallo.py

    r24216 r24240  
    4747    #use provided options to change fields
    4848        options = pairoptions(*args)
    49 
    5049    #initialize cluster using user settings if provided
    5150        self = stallo_settings(self)
     
    111110        d, h = divmod(h, 60)
    112111        timestring = "%02d-%02d:%02d:%02d" % (d, h, m, s)
    113 
    114112        fid = open(modelname + '.queue', 'w')
    115113        fid.write('#!/bin/bash -l\n')
  • issm/trunk-jpl/src/m/classes/debug.py

    r24213 r24240  
    2020
    2121    #}}}
     22
    2223    def __repr__(self):  # {{{
    2324        string = "   debug parameters:"
  • issm/trunk-jpl/src/m/classes/hydrologydc.m

    r22899 r24240  
    6464                % }}}
    6565    function list = defaultoutputs(self,md) % {{{
    66         list = {'SedimentHeadHydrostep','SedimentHeadResidual','EffectivePressureHydrostep'};
     66        list = {'SedimentHead','SedimentHeadResidual','EffectivePressure'};
    6767        if self.isefficientlayer,
    68             list=[list,{'EplHeadHydrostep','HydrologydcMaskEplactiveNode','HydrologydcMaskEplactiveElt','EplHeadSlopeX','EplHeadSlopeY','HydrologydcEplThicknessHydrostep'}];
     68            list=[list,{'EplHead','HydrologydcMaskEplactiveNode','HydrologydcMaskEplactiveElt','EplHeadSlopeX','EplHeadSlopeY','HydrologydcEplThickness'}];
    6969        end
    7070        if self.steps_per_step>1,
    71             list = [list,'EffectivePressure','SedimentHead'];
     71            list = [list,'EffectivePressureSubstep','SedimentHeadSubstep'];
    7272            if self.isefficientlayer,
    73                 list = [list,'EplHead','HydrologydcEplThickness'];
     73                list = [list,'EplHeadSubstep','HydrologydcEplThicknessSubstep'];
    7474            end
    7575        end
     
    9898                        self.sedimentlimit_flag       = 0;
    9999                        self.sedimentlimit            = 0;
    100                         self.transfer_flag            = 0;
     100                        self.transfer_flag            = 1;
    101101                        self.unconfined_flag          = 0;
    102                         self.leakage_factor           = 10.0;
     102                        self.leakage_factor           = 1.0e-10;
    103103      self.requested_outputs        = {'default'};
    104104
  • issm/trunk-jpl/src/m/classes/hydrologydc.py

    r24213 r24240  
    128128        self.sedimentlimit_flag = 0
    129129        self.sedimentlimit = 0
    130         self.transfer_flag = 0
     130        self.transfer_flag = 1
    131131        self.unconfined_flag = 0
    132         self.leakage_factor = 10.0
     132        self.leakage_factor = 1.0e-10
    133133        self.requested_outputs = ['default']
    134134        self.sediment_compressibility = 1.0e-08
     
    150150
    151151    def defaultoutputs(self, md):  # {{{
    152         list = ['SedimentHeadHydrostep', 'SedimentHeadResidual', 'EffectivePressureHydrostep']
    153         if self.isefficientlayer == 1:
    154             list.extend(['EplHeadHydrostep', 'HydrologydcMaskEplactiveNode', 'HydrologydcMaskEplactiveElt', 'EplHeadSlopeX', 'EplHeadSlopeY', 'HydrologydcEplThicknessHydrostep'])
     152        list = ['SedimentHead', 'SedimentHeadResidual', 'EffectivePressure']
     153        if self.isefficientlayer == 1:
     154            list.extend(['EplHead', 'HydrologydcMaskEplactiveNode', 'HydrologydcMaskEplactiveElt', 'EplHeadSlopeX', 'EplHeadSlopeY', 'HydrologydcEplThickness'])
    155155        if self.steps_per_step > 1:
    156             list.extend(['EffectivePressure', 'SedimentHead'])
     156            list.extend(['EffectivePressureSubstep', 'SedimentHeadSubstep'])
    157157            if self.isefficientlayer == 1:
    158                 list.extend(['EplHead', 'HydrologydcEplThickness'])
     158                list.extend(['EplHeadSubstep', 'HydrologydcEplThicknessSubstep'])
    159159        return list
    160160    #}}}
     
    180180        md = checkfield(md, 'fieldname', 'hydrology.rel_tol', '>', 0., 'numel', [1])
    181181        md = checkfield(md, 'fieldname', 'hydrology.max_iter', '>', 0., 'numel', [1])
    182         md = checkfield(md, 'fieldname', 'hydrology.steps_per_step', '>', 0., 'numel', [1])
     182        md = checkfield(md, 'fieldname', 'hydrology.steps_per_step', '>=', 1, 'numel', [1])
    183183        md = checkfield(md, 'fieldname', 'hydrology.sedimentlimit_flag', 'numel', [1], 'values', [0, 1, 2, 3])
    184184        md = checkfield(md, 'fieldname', 'hydrology.transfer_flag', 'numel', [1], 'values', [0, 1])
  • issm/trunk-jpl/src/m/classes/linearbasalforcings.py

    r24213 r24240  
    4040        else:
    4141            raise Exception('constructor not supported')
     42    #}}}
    4243
    43     #}}}
    4444    def __repr__(self):  # {{{
    4545        string = "   linear basal forcings parameters:"
    46 
    4746        string = "%s\n%s" % (string, fielddisplay(self, "deepwater_melting_rate", "basal melting rate (positive if melting applied for floating ice whith base < deepwater_elevation) [m/yr]"))
    4847        string = "%s\n%s" % (string, fielddisplay(self, "deepwater_elevation", "elevation of ocean deepwater [m]"))
     
    5352        return string
    5453    #}}}
     54
    5555    def initialize(self, md):  # {{{
    56 
    5756        if np.all(np.isnan(self.groundedice_melting_rate)):
    5857            self.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices))
    5958            print("      no basalforcings.groundedice_melting_rate specified: values set as zero")
    60 
    6159        return self
    6260    #}}}
     61
    6362    def setdefaultparameters(self):  # {{{
    64 
    6563        self.deepwater_melting_rate = 50.0
    6664        self.deepwater_elevation = - 800.0
     
    7068        return self
    7169    #}}}
     70
    7271    def checkconsistency(self, md, solution, analyses):  # {{{
    73 
    7472        if 'MasstransportAnalysis' in analyses and not (solution == 'TransientSolution' and not md.transient.ismasstransport):
    7573            md = checkfield(md, 'fieldname', 'basalforcings.groundedice_melting_rate', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
     
    9694        return md
    9795    # }}}
     96
    9897    def marshall(self, prefix, md, fid):  # {{{
    99 
    10098        yts = md.constants.yts
    10199
  • issm/trunk-jpl/src/m/classes/verbose.py

    r24213 r24240  
    2424          verbose = verbose('module', True, 'solver', False)
    2525
    26     WARNING: some parts of this file are Synchronized with src / c / shared / Numerics / Verbosity.h
    27              Do not modify these sections. See src / c / shared / Numerics / README for more info
     26    WARNING: some parts of this file are Synchronized with src/c/shared/Numerics/Verbosity.h
     27             Do not modify these sections. See src/c/shared/Numerics/README for more info
    2828    """
    2929
     
    8888        s += "   %15s : %s\n" % ('smb', self.smb)
    8989        #ENDDISP
    90 
    9190        return s
    9291    # }}}
  • issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py

    r24213 r24240  
    3636    else:
    3737        raise TypeError("solution type: '%s' not supported yet!" % solutiontype)
    38 
    3938    return analyses
    4039    #}}}
  • issm/trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.py

    r24213 r24240  
    2727    dimindex = 1
    2828    dimlist = [2, md.mesh.numberofelements, md.mesh.numberofvertices, np.shape(md.mesh.elements)[1]]
    29     print(' == =Creating dimensions == = ')
     29    print('===Creating dimensions ===')
    3030    for i in range(0, 4):
    3131        if dimlist[i] not in list(DimDict.keys()):
     
    3838    groups = dict.keys(md.__dict__)
    3939    # get all model classes and create respective groups
    40     print(' == =Creating and populating groups == = ')
     40    print('===Creating and populating groups===')
    4141    for group in groups:
    4242        NCgroup = NCData.createGroup(str(group))
     
    104104    NCData.close()
    105105
    106     # == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
     106    #============================================================================
    107107    # Define the variables
    108108
     
    176176    return DimDict
    177177
    178     # == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
     178    # ============================================================================
    179179    # retriev the dimension tuple from a dictionnary
    180180
  • issm/trunk-jpl/src/m/dev/devpath.py

    r24227 r24240  
    55
    66#Recover ISSM_DIR and USERNAME
    7 ISSM_DIR = os.getenv('ISSM_DIR')
     7ISSM_DIR = os.getenv('ISSM_DEV_DIR')
    88USERNAME = os.getenv('USER')
    99JPL_SVN = os.getenv('JPL_SVN')
    1010if ISSM_DIR is None:
    11     raise NameError('"ISSM_DIR" environment variable is empty! You should define ISSM_DIR in your .cshrc or .bashrc!')
     11    raise NameError('"ISSM_DEV_DIR" environment variable is empty! You should define ISSM_DEV_DIR in your .cshrc or .bashrc!')
    1212
    1313    #Go through src / m and append any directory that contains a * .py file to PATH
     
    3737        warnings.warn('cluster settings should be in, {} / usr / {}'.format(JPL_SVN, USERNAME))
    3838
    39     #Manual imports for commonly used functions
    4039from runme import runme  #first because plotmodel may fail
    4140from plotmodel import plotmodel
  • issm/trunk-jpl/src/m/os/issmscpin.py

    r24213 r24240  
    99    """
    1010    ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
    11 
    1211       usage: issmscpin(host, packages, path)
    1312    """
     
    1514    #first get hostname
    1615    hostname = gethostname()
    17 
    1816    #first be sure packages are not in the current directory, this could conflict with pscp on windows.
    1917    #remove warnings in case the files do not exist
     
    2321        except OSError as e:
    2422            pass
    25 
    2623    #if hostname and host are the same, do a simple copy
    27     if m.strcmpi(hostname, host):
    28 
     24    if hostname == host:
    2925        for package in packages:
    3026            try:
     
    3228            except OSError as e:
    3329                pass
    34 
    3530    else:
    3631        if m.ispc():
     
    4136            else:
    4237                raise OSError("issmscpin error message: could not find ISSM_DIR_WIN environment variable.")
    43 
    4438            username = eval(input('Username: (quoted string) '))
    4539            key = eval(input('Key: (quoted string) '))
    46 
    4740            for package in packages:
    4841                try:
    4942                    subprocess.check_call('%s/externalpackages/ssh/pscp.exe -l "%s" -pw "%s" %s:%s %s' % (ISSM_DIR, username, key, host, os.path.join(path, package), os.getcwd()), shell=True)
    5043                except CalledProcessError as e:
    51                     raise CalledProcessError("issmscpin error message: could not call putty pscp.")
     44                    raise CalledProcessError("issmscpin error message: could not call putty pscp due to ")
    5245
    5346        else:
  • issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py

    r24213 r24240  
    1010
    1111       Usage:
    12           md = loadresultsfromdisk(md = False, filename = False)
     12          md = loadresultsfromdisk(md=False,filename=False);
    1313    """
    14 
    15     #check number of inputs / outputs
     14    #check number of inputs/outputs
    1615    if not md or not filename:
    1716        raise ValueError("loadresultsfromdisk: error message.")
     
    2726            md.results = results()
    2827
    29             #load results onto model
     28        #load results onto model
    3029        structure = parseresultsfromdisk(md, filename, not md.settings.io_gather)
    3130        if not len(structure):
     
    4039        if os.path.exists(md.miscellaneous.name + '.errlog'):
    4140            with open(md.miscellaneous.name + '.errlog', 'r') as f:
    42                 setattr(getattr(md.results, structure[0].SolutionType)[0], 'errlog', [line[: - 1] for line in f])
     41                setattr(getattr(md.results, structure[0].SolutionType)[0], 'errlog', [line[: -1] for line in f])
    4342        else:
    4443            setattr(getattr(md.results, structure[0].SolutionType)[0], 'errlog', [])
     
    4645        if os.path.exists(md.miscellaneous.name + '.outlog'):
    4746            with open(md.miscellaneous.name + '.outlog', 'r') as f:
    48                 setattr(getattr(md.results, structure[0].SolutionType)[0], 'outlog', [line[: - 1] for line in f])
     47                setattr(getattr(md.results, structure[0].SolutionType)[0], 'outlog', [line[: -1] for line in f])
    4948        else:
    5049            setattr(getattr(md.results, structure[0].SolutionType)[0], 'outlog', [])
  • issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m

    r23921 r24240  
    2323counter = 1;
    2424step    = result.step;
    25 while ~isempty(result), 
     25while ~isempty(result),
    2626
    2727        if check_nomoresteps,
    28                 %check that the new result does not add a step, which would be an error: 
     28                %check that the new result does not add a step, which would be an error:
    2929                if result.step>=1,
    3030                        error('parsing results for a steady-state core, which incorporates transient results!');
     
    4040        %Add result
    4141        if(result.step==0),
    42                 %if we have a step = 0, this is a steady state solutoin, don't expect more steps. 
     42                %if we have a step = 0, this is a steady state solutoin, don't expect more steps.
    4343                index = 1;
    4444                check_nomoresteps=1;
     
    7777results=struct();
    7878
    79 %if we have done split I/O, ie, we have results that are fragmented across patches, 
     79%if we have done split I/O, ie, we have results that are fragmented across patches,
    8080%do a first pass, and figure out the structure of results
    8181result=ReadDataDimensions(fid);
     
    8585        results(result.step).step=result.step;
    8686        if result.time~=-9999,
    87                 results(result.step).time=result.time; 
     87                results(result.step).time=result.time;
    8888        end
    8989
     
    111111        results(result.step).step=result.step;
    112112        if result.time~=-9999,
    113                 results(result.step).time=result.time; 
     113                results(result.step).time=result.time;
    114114        end
    115115
     
    205205        elseif strcmp(fieldname,'SmbRunoff'),
    206206                field = field*yts;
     207        elseif strcmp(fieldname,'SmbRunoffSubstep'),
     208                field = field*yts;
    207209        elseif strcmp(fieldname,'SmbEvaporation'),
    208210                field = field*yts;
     
    220222                field = field*yts;
    221223        elseif (strcmp(fieldname,'LoveKernelsReal') | strcmp(fieldname,'LoveKernelsImag')),
    222                 nlayer = md.materials.numlayers; 
    223                 degmax = md.love.sh_nmax; 
    224                 nfreq  = md.love.nfreq; 
    225                 temp_field = cell(degmax+1,nfreq,nlayer+1,6); 
     224                nlayer = md.materials.numlayers;
     225                degmax = md.love.sh_nmax;
     226                nfreq  = md.love.nfreq;
     227                temp_field = cell(degmax+1,nfreq,nlayer+1,6);
    226228                for ii=1:degmax+1
    227229                        for jj=1:nfreq
    228230                                for kk=1:nlayer+1
    229                                         ll = (ii-1)*(nlayer+1)*6 + ((kk-1)*6+1); 
     231                                        ll = (ii-1)*(nlayer+1)*6 + ((kk-1)*6+1);
    230232                                        for mm=1:6
    231                                                 temp_field{ii,jj,kk,mm} = field(ll+(mm-1),jj); 
     233                                                temp_field{ii,jj,kk,mm} = field(ll+(mm-1),jj);
    232234                                        end
    233235                                end
    234236                        end
    235237                end
    236                 field=temp_field; 
     238                field=temp_field;
    237239        end
    238240
  • issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py

    r24213 r24240  
    222222            field = field * yts
    223223        elif fieldname == 'SmbRunoff':
     224            field = field * yts
     225        elif fieldname == 'SmbRunoffSubstep':
    224226            field = field * yts
    225227        elif fieldname == 'SmbEvaporation':
  • issm/trunk-jpl/test/NightlyRun/runme.py

    r24226 r24240  
    195195                            print(('ERROR   difference: {} > {} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname)))
    196196                            errorcount += 1
    197                             np.append(erroredtest_list, id)
     197                            erroredtest_list.append(id)
    198198                        else:
    199199                            print(('SUCCESS difference: {} < {} test id: {} test name: {} field: {}'.format(error_diff, tolerance, id, id_string, fieldname)))
     
    228228
    229229    if errorcount > 0:
    230         print("{} errors were detected in test {}".format(errorcount, erroredtest_list))
     230        print("{} errors were detected in test {}".format(errorcount, np.unique(erroredtest_list)))
    231231    return
    232232
  • issm/trunk-jpl/test/NightlyRun/test330.py

    r24214 r24240  
    5353field_names = ['SedimentWaterHead1', 'SedimentWaterHead2']
    5454field_tolerances = [1e-13, 1e-13]
    55 field_values = [md.results.TransientSolution[10].SedimentHeadHydrostep, md.results.TransientSolution[30].SedimentHeadHydrostep]
     55field_values = [md.results.TransientSolution[10].SedimentHead, md.results.TransientSolution[30].SedimentHead]
  • issm/trunk-jpl/test/NightlyRun/test3300.py

    r24214 r24240  
    6666# sedstore = 20.0 * store
    6767# for i in range(0, 4000):
    68 #       sedvol[i] = np.mean(md.results.TransientSolution[i].SedimentHead) * sedstore
    69 #       eplvol[i] = np.mean(md.results.TransientSolution[i].EplHead) * store * np.mean(md.results.TransientSolution[i].HydrologydcEplThicknessHydrostep)
    70 #       totvol[i + 1] = totvol[i] + md.basalforcings.groundedice_melting_rate[0, i] * 0.002
     68#       sedvol[i]=np.mean(md.results.TransientSolution[i].SedimentHead)*sedstore
     69#       eplvol[i]=np.mean(md.results.TransientSolution[i].EplHead)*store*np.mean(md.results.TransientSolution[i].HydrologydcEplThicknessSubstep)
     70#       totvol[i+1]=totvol[i]+md.basalforcings.groundedice_melting_rate[0, i]*0.002
    7171
    7272field_names = ['SedimentWaterHead5', 'EplWaterHead5', 'SedimentWaterHead40', 'EplWaterHead40']
    7373field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13, 1e-13]
    74 field_values = [md.results.TransientSolution[5].SedimentHeadHydrostep,
    75                 md.results.TransientSolution[5].EplHeadHydrostep,
    76                 md.results.TransientSolution[40].SedimentHeadHydrostep,
    77                 md.results.TransientSolution[40].EplHeadHydrostep]
     74field_values = [md.results.TransientSolution[5].SedimentHeadSubstep,
     75                md.results.TransientSolution[5].EplHeadSubstep,
     76                md.results.TransientSolution[40].SedimentHeadSubstep,
     77                md.results.TransientSolution[40].EplHeadSubstep]
  • issm/trunk-jpl/test/NightlyRun/test332.py

    r24214 r24240  
    4646field_names = ['SedimentWaterHead', 'SedimentHeadResidual']
    4747field_tolerances = [1e-13, 3e-10]
    48 field_values = [md.results.HydrologySolution.SedimentHeadHydrostep, md.results.HydrologySolution.SedimentHeadResidual]
     48field_values = [md.results.HydrologySolution.SedimentHead, md.results.HydrologySolution.SedimentHeadResidual]
  • issm/trunk-jpl/test/NightlyRun/test333.py

    r23793 r24240  
    1010from solve import *
    1111from generic import generic
     12
    1213
    1314md = triangle(model(), '../Exp/Square.exp', 100000.)
     
    2627md.hydrology.sedimentlimit_flag = 1
    2728md.hydrology.sedimentlimit = 800.0
     29md.hydrology.transfer_flag = 0
    2830md.hydrology.mask_thawed_node = np.ones((md.mesh.numberofvertices))
    2931md.initialization.sediment_head = np.zeros((md.mesh.numberofvertices))
     
    5254#re-run with no substeps
    5355mdfine = copy.deepcopy(md)
    54 mdfine.result = []
     56mdfine.results = []
    5557mdfine.hydrology.steps_per_step = 1
    5658mdfine.timestepping.time_step = 0.2
    5759mdfine = solve(mdfine, 'Transient')
    58 
    59 
    60 sedmean = mdfine.results.TransientSolution[0].SedimentHeadHydrostep
    61 eplmean = mdfine.results.TransientSolution[0].EplHeadHydrostep
    62 for i in range(1, 10):
    63     sedmean = sedmean + (mdfine.results.TransientSolution[i].SedimentHeadHydrostep)
    64     eplmean = eplmean + (mdfine.results.TransientSolution[i].EplHeadHydrostep)
    6560
    6661field_names = ['SedimentWaterHead1', 'EplWaterHead1', 'SedimentHeadResidual1',
     
    6863               'SedimentWaterHead5', 'EplWaterHead5', 'SedimentHeadResidual5',
    6964               'SedimentWaterHead9', 'EplWaterHead9', 'SedimentHeadResidual9',
    70                'EplWaterHead10']
     65               'EplWaterHead10', 'EplWaterHeadSubstep10', 'SedimentWaterHead10',
     66               'SedimentWaterHeadSubstep10']
    7167field_tolerances = [1e-13, 1e-13, 1e-13,
    7268                    1e-13, 1e-13, 1e-13,
    7369                    1e-13, 5e-12, 1e-11,
    7470                    1e-13, 5e-12, 1e-11,
     71                    1e-13, 1e-13, 1e-13,
    7572                    1e-13]
    76 field_values = [mdfine.results.TransientSolution[0].SedimentHeadHydrostep,
    77                 mdfine.results.TransientSolution[0].EplHeadHydrostep,
     73field_values = [mdfine.results.TransientSolution[0].SedimentHead,
     74                mdfine.results.TransientSolution[0].EplHead,
    7875                mdfine.results.TransientSolution[0].SedimentHeadResidual,
    79                 mdfine.results.TransientSolution[3].SedimentHeadHydrostep,
    80                 mdfine.results.TransientSolution[3].EplHeadHydrostep,
     76                mdfine.results.TransientSolution[3].SedimentHead,
     77                mdfine.results.TransientSolution[3].EplHead,
    8178                mdfine.results.TransientSolution[3].SedimentHeadResidual,
    82                 mdfine.results.TransientSolution[4].SedimentHeadHydrostep,
    83                 mdfine.results.TransientSolution[4].EplHeadHydrostep,
     79                mdfine.results.TransientSolution[4].SedimentHead,
     80                mdfine.results.TransientSolution[4].EplHead,
    8481                mdfine.results.TransientSolution[4].SedimentHeadResidual,
    85                 mdfine.results.TransientSolution[8].SedimentHeadHydrostep,
    86                 mdfine.results.TransientSolution[8].EplHeadHydrostep,
     82                mdfine.results.TransientSolution[8].SedimentHead,
     83                mdfine.results.TransientSolution[8].EplHead,
    8784                mdfine.results.TransientSolution[8].SedimentHeadResidual,
    88                 md.results.TransientSolution[-1].EplHead]
     85                md.results.TransientSolution[-1].EplHead,
     86                md.results.TransientSolution[-1].EplHeadSubstep,
     87                md.results.TransientSolution[-1].SedimentHead,
     88                md.results.TransientSolution[-1].SedimentHeadSubstep]
  • issm/trunk-jpl/test/NightlyRun/test334.py

    r24214 r24240  
    4646field_names = ['SedimentWaterHead', 'SedimentHeadResidual']
    4747field_tolerances = [1e-13, 3e-10]
    48 field_values = [md.results.HydrologySolution.SedimentHeadHydrostep, md.results.HydrologySolution.SedimentHeadResidual]
     48field_values = [md.results.HydrologySolution.SedimentHead, md.results.HydrologySolution.SedimentHeadResidual]
  • issm/trunk-jpl/test/NightlyRun/test335.py

    r23793 r24240  
    2626md.hydrology.isefficientlayer = 1
    2727md.hydrology.sedimentlimit_flag = 1
     28md.hydrology.transfer_flag = 0
    2829md.hydrology.sedimentlimit = 800.0
    2930md.hydrology.mask_thawed_node = np.ones((md.mesh.numberofvertices))
     
    5859                    1e-13, 5e-12, 2e-11,
    5960                    1e-13, 5e-12, 2e-11]
    60 field_values = [md.results.TransientSolution[0].SedimentHeadHydrostep,
    61                 md.results.TransientSolution[0].EplHeadHydrostep,
     61field_values = [md.results.TransientSolution[0].SedimentHead,
     62                md.results.TransientSolution[0].EplHead,
    6263                md.results.TransientSolution[0].SedimentHeadResidual,
    63                 md.results.TransientSolution[3].SedimentHeadHydrostep,
    64                 md.results.TransientSolution[3].EplHeadHydrostep,
     64                md.results.TransientSolution[3].SedimentHead,
     65                md.results.TransientSolution[3].EplHead,
    6566                md.results.TransientSolution[3].SedimentHeadResidual,
    66                 md.results.TransientSolution[4].SedimentHeadHydrostep,
    67                 md.results.TransientSolution[4].EplHeadHydrostep,
     67                md.results.TransientSolution[4].SedimentHead,
     68                md.results.TransientSolution[4].EplHead,
    6869                md.results.TransientSolution[4].SedimentHeadResidual,
    69                 md.results.TransientSolution[8].SedimentHeadHydrostep,
    70                 md.results.TransientSolution[8].EplHeadHydrostep,
     70                md.results.TransientSolution[8].SedimentHead,
     71                md.results.TransientSolution[8].EplHead,
    7172                md.results.TransientSolution[8].SedimentHeadResidual]
Note: See TracChangeset for help on using the changeset viewer.