source: issm/oecreview/Archive/16554-17801/ISSM-16760-16761.diff@ 17802

Last change on this file since 17802 was 17802, checked in by Mathieu Morlighem, 11 years ago

Added archives

File size: 9.9 KB
  • ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp

     
    8585        element->GetSolutionFromInputsOneDof(solution,WatercolumnEnum);
    8686}/*}}}*/
    8787void HydrologyShreveAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    88         _error_("not implemented yet");
     88
     89        /*Intermediary*/
     90        int* doflist = NULL;
     91
     92        /*Fetch number of nodes for this finite element*/
     93        int numnodes = element->GetNumberOfNodes();
     94
     95        /*Fetch dof list and allocate solution vector*/
     96        element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
     97        IssmDouble* values = xNew<IssmDouble>(numnodes);
     98
     99        /*Use the dof list to index into the solution vector: */
     100        for(int i=0;i<numnodes;i++){
     101                values[i]=solution[doflist[i]];
     102                if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
     103                if (values[i]<10e-10) values[i]=10e-10; //correcting the water column to positive values
     104        }
     105
     106        /*Add input to the element: */
     107        element->AddInput(WatercolumnEnum,values,P1Enum);
     108
     109        /*Free ressources:*/
     110        xDelete<IssmDouble>(values);
     111        xDelete<int>(doflist);
    89112}/*}}}*/
  • ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp

     
    9999        element->GetSolutionFromInputsOneDof(solution,EplHeadEnum);
    100100}/*}}}*/
    101101void HydrologyDCEfficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    102         _error_("not implemented yet");
     102        int meshtype;
     103        element->FindParam(&meshtype,MeshTypeEnum);
     104        switch(meshtype){
     105                case Mesh2DhorizontalEnum:
     106                        element->InputUpdateFromSolutionOneDof(solution,EplHeadEnum);
     107                        break;
     108                case Mesh3DEnum:
     109                        element->InputUpdateFromSolutionOneDofCollapsed(solution,EplHeadEnum);
     110                        break;
     111                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
     112        }
    103113}/*}}}*/
  • ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp

     
    140140        element->GetSolutionFromInputsOneDof(solution,SedimentHeadEnum);
    141141}/*}}}*/
    142142void HydrologyDCInefficientAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    143         _error_("not implemented yet");
     143
     144        int        meshtype;
     145        bool       converged;
     146        int*       doflist=NULL;
     147        Element*   basalelement=NULL;
     148
     149        element->FindParam(&meshtype,MeshTypeEnum);
     150        if(meshtype!=Mesh2DhorizontalEnum){
     151                if(!element->IsOnBed()) return;
     152                basalelement=element->SpawnBasalElement();
     153        }
     154        else{
     155                basalelement = element;
     156        }
     157
     158        /*Fetch number of nodes for this finite element*/
     159        int numnodes = basalelement->GetNumberOfNodes();
     160
     161        /*Fetch dof list and allocate solution vector*/
     162        basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
     163        IssmDouble* values   = xNew<IssmDouble>(numnodes);
     164        IssmDouble* residual = xNew<IssmDouble>(numnodes);
     165
     166        /*Use the dof list to index into the solution vector: */
     167        for(int i=0;i<numnodes;i++){
     168                values[i] =solution[doflist[i]];
     169                if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
     170        }
     171
     172        /*If converged keep the residual in mind*/
     173        element->GetInputValue(&converged,ConvergedEnum);
     174
     175        /*Get inputs*/
     176        if(converged){
     177                IssmDouble penalty_factor,kmax,kappa,h_max;
     178                element->FindParam(&kmax,HydrologySedimentKmaxEnum);
     179                element->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
     180
     181                kappa=kmax*pow(10.,penalty_factor);
     182
     183                for(int i=0;i<numnodes;i++){
     184                        basalelement->GetHydrologyDCInefficientHmax(&h_max,i);
     185                        if(values[i]>h_max) residual[i] = kappa*(values[i]-h_max);
     186                        else                residual[i] = 0.;
     187                }
     188        }
     189
     190        /*Add input to the element: */
     191        element->AddBasalInput(SedimentHeadEnum,values,P1Enum);
     192        element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
     193
     194        /*Free ressources:*/
     195        xDelete<IssmDouble>(values);
     196        xDelete<IssmDouble>(residual);
     197        xDelete<int>(doflist);
     198        if(meshtype!=Mesh2DhorizontalEnum) delete basalelement;
    144199}/*}}}*/
  • ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp

     
    7373           _error_("not implemented yet");
    7474}/*}}}*/
    7575void L2ProjectionEPLAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    76         _error_("not implemented yet");
     76        int inputenum,meshtype;
     77
     78        element->FindParam(&inputenum,InputToL2ProjectEnum);
     79        element->FindParam(&meshtype,MeshTypeEnum);
     80        switch(meshtype){
     81                case Mesh2DhorizontalEnum:
     82                        element->InputUpdateFromSolutionOneDof(solution,inputenum);
     83                        break;
     84                case Mesh2DverticalEnum:
     85                        element->InputUpdateFromSolutionOneDof(solution,inputenum);
     86                        break;
     87                case Mesh3DEnum:
     88                        element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
     89                        break;
     90                default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
     91        }
    7792}/*}}}*/
    7893
  • ../trunk-jpl/src/c/classes/Elements/Element.h

     
    168168
    169169                #ifdef _HAVE_HYDROLOGY_
    170170                virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode)=0;
     171                virtual void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, int index)=0;
    171172                virtual void GetHydrologyTransfer(Vector<IssmDouble>* transfer)=0;
    172173                virtual void HydrologyEPLGetMask(Vector<IssmDouble>* mask)=0;
    173174                virtual void HydrologyEPLGetActive(Vector<IssmDouble>* active)=0;
  • ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    72267226                *ph_max=h_max;
    72277227}
    72287228/*}}}*/
     7229/*FUNCTION Tria::GetHydrologyDCInefficientHmax{{{*/
     7230void  Tria::GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){
     7231
     7232        int        hmax_flag;
     7233        IssmDouble h_max;
     7234        IssmDouble rho_ice,rho_water;
     7235        IssmDouble thickness,bed;
     7236        /*Get the flag to the limitation method*/
     7237        this->parameters->FindParam(&hmax_flag,HydrologydcSedimentlimitFlagEnum);
     7238
     7239        /*Switch between the different cases*/
     7240        switch(hmax_flag){
     7241                case 0:
     7242                        h_max=1.0e+10;
     7243                        break;
     7244                case 1:
     7245                        parameters->FindParam(&h_max,HydrologydcSedimentlimitEnum);
     7246                        break;
     7247                case 2:
     7248                        rho_ice=matpar->GetRhoIce();
     7249                        rho_water=matpar->GetRhoFreshwater();
     7250                        this->GetInputValue(&thickness,this->nodes[index],ThicknessEnum);
     7251                        this->GetInputValue(&bed,this->nodes[index],BedEnum);
     7252                        h_max=((rho_ice*thickness)/rho_water)+bed;
     7253                        break;
     7254                case 3:
     7255                        _error_("Using normal stress  not supported yet");
     7256                        break;
     7257                default:
     7258                        _error_("no case higher than 3 for SedimentlimitFlag");
     7259        }
     7260        /*Assign output pointer*/
     7261        *ph_max=h_max;
     7262}
     7263/*}}}*/
    72297264/*FUNCTION Tria::GetHydrologyTransfer{{{*/
    72307265void  Tria::GetHydrologyTransfer(Vector<IssmDouble>* transfer){
    72317266
  • ../trunk-jpl/src/c/classes/Elements/Tria.h

     
    327327                void             InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
    328328                void             InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
    329329                void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
     330                void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index);
    330331                void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
    331332                void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
    332333                void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
  • ../trunk-jpl/src/c/classes/Elements/Penta.h

     
    343343                ElementVector* CreatePVectorHydrologyDCEfficient(void);
    344344                ElementVector* CreatePVectorL2ProjectionEPL(void);
    345345                void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
     346                void           GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
    346347                void           GetHydrologyTransfer(Vector<IssmDouble>* transfer);
    347348                void           HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
    348349                void           HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
  • ../trunk-jpl/src/c/classes/Elements/Seg.h

     
    127127                #endif
    128128                #ifdef _HAVE_HYDROLOGY_
    129129                void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode){_error_("not implemented yet");};
     130                void    GetHydrologyDCInefficientHmax(IssmDouble* ph_max,int index){_error_("not implemented yet");};
    130131                void    GetHydrologyTransfer(Vector<IssmDouble>* transfer){_error_("not implemented yet");};
    131132                void    HydrologyEPLGetActive(Vector<IssmDouble>* active_vec){_error_("not implemented yet");};
    132133                void    HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");};
Note: See TracBrowser for help on using the repository browser.