Changeset 21213


Ignore:
Timestamp:
09/20/16 09:30:18 (9 years ago)
Author:
bdef
Message:

NEW:Moved the treatment of DC moulins inut to Moulin.cpp and define input in EPL when it exists

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

Legend:

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

    r21203 r21213  
    105105void HydrologyDCEfficientAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    106106        /*Nothing for now*/
     107
     108        /*Fetch parameters: */
     109        int hydrology_model;
     110        iomodel->FindConstant(&hydrology_model,"md.hydrology.model");
     111        if(hydrology_model!=HydrologydcEnum) return;
     112
     113        if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,"md.mesh.vertexonbase");
     114
     115        //create penalties for nodes: no node can have water above the max
     116        CreateSingleNodeToElementConnectivity(iomodel);
     117        for(int i=0;i<iomodel->numberofvertices;i++){
     118                if (iomodel->domaintype!=Domain3DEnum){
     119                        /*keep only this partition's nodes:*/
     120                        if(iomodel->my_vertices[i]){
     121                                loads->AddObject(new Moulin(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCEfficientAnalysisEnum));
     122                        }
     123                }
     124                else if(reCast<int>(iomodel->Data("md.mesh.vertexonbase")[i])){
     125                        if(iomodel->my_vertices[i]){
     126                                loads->AddObject(new Moulin(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCEfficientAnalysisEnum));
     127                        }       
     128                }
     129        }
     130        iomodel->DeleteData(1,"md.mesh.vertexonbase");
    107131}/*}}}*/
    108132
  • issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp

    r20690 r21213  
    140140                        if(iomodel->my_vertices[i]){
    141141                                loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
     142                                loads->AddObject(new Moulin(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
    142143                        }
    143144                }
     
    145146                        if(iomodel->my_vertices[i]){
    146147                                loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
     148                                loads->AddObject(new Moulin(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
    147149                        }       
    148150                }
  • issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp

    r20827 r21213  
    180180               
    181181        case HydrologySommersAnalysisEnum:
    182                 pe = this->CreatePVectorMoulin();
     182                pe = this->CreatePVectorHydrologySommers();
     183                break;
     184        case HydrologyDCInefficientAnalysisEnum:
     185                pe = CreatePVectorHydrologyDCInefficient();
     186                break;
     187        case HydrologyDCEfficientAnalysisEnum:
     188                pe = CreatePVectorHydrologyDCEfficient();
    183189                break;
    184190        default:
     
    331337/*}}}*/
    332338
    333 ElementVector* Moulin::CreatePVectorMoulin(void){/*{{{*/
     339ElementVector* Moulin::CreatePVectorHydrologySommers(void){/*{{{*/
    334340
    335341        /*If this node is not the master node (belongs to another partition of the
     
    349355}
    350356/*}}}*/
     357ElementVector* Moulin::CreatePVectorHydrologyDCInefficient(void){/*{{{*/
     358
     359        /*If this node is not the master node (belongs to another partition of the
     360         * mesh), don't add the moulin input a second time*/
     361        if(node->IsClone()) return NULL;
     362        bool isefficientlayer;
     363        IssmDouble moulin_load,dt;
     364        IssmDouble epl_active;
     365
     366        /*Initialize Element matrix*/
     367        ElementVector* pe=new ElementVector(&node,1,this->parameters);
     368
     369        this->element->GetInputValue(&moulin_load,node,HydrologydcBasalMoulinInputEnum);
     370        parameters->FindParam(&dt,TimesteppingTimeStepEnum);
     371        parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
     372        // Test version input in EPL when active
     373        if(isefficientlayer){
     374                this->element->GetInputValue(&epl_active,node,HydrologydcMaskEplactiveNodeEnum);
     375                if(epl_active){
     376                        pe->values[0]=moulin_load*0.0;
     377                }
     378                else{
     379                        pe->values[0]=moulin_load*dt;
     380                }
     381        }
     382        else{
     383                pe->values[0]=moulin_load*dt;
     384        }
     385        /*Clean up and return*/
     386        return pe;
     387 }
     388/*}}}*/
     389ElementVector* Moulin::CreatePVectorHydrologyDCEfficient(void){/*{{{*/
     390
     391        /*If this node is not the master node (belongs to another partition of the
     392         * mesh), don't add the moulin input a second time*/
     393        if(node->IsClone()) return NULL;
     394        if(!this->node->IsActive()) return NULL;
     395        IssmDouble moulin_load,dt;
     396        ElementVector* pe=new ElementVector(&node,1,this->parameters);
     397       
     398        this->element->GetInputValue(&moulin_load,node,HydrologydcBasalMoulinInputEnum);
     399        parameters->FindParam(&dt,TimesteppingTimeStepEnum);
     400       
     401        pe->values[0]=moulin_load*dt;
     402        /*Clean up and return*/
     403        return pe;
     404}
     405/*}}}*/
  • issm/trunk-jpl/src/c/classes/Loads/Moulin.h

    r20827 r21213  
    8080                /*}}}*/
    8181
    82                 ElementVector* CreatePVectorMoulin(void);
     82                ElementVector* CreatePVectorHydrologySommers(void);
     83                ElementVector* CreatePVectorHydrologyDCInefficient(void);
     84                ElementVector* CreatePVectorHydrologyDCEfficient(void);
    8385};
    8486
  • issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp

    r21203 r21213  
    193193/*}}}*/
    194194void  Pengrid::CreatePVector(Vector<IssmDouble>* pf){/*{{{*/
    195 
    196         ElementVector* pe=NULL;
    197         int analysis_type;
    198         this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    199 
    200         switch(analysis_type){
    201                
    202         case HydrologyDCInefficientAnalysisEnum:
    203                 pe = CreatePVectorHydrologyDCInefficient();
    204                 break;
    205         case HydrologyDCEfficientAnalysisEnum:
    206                 pe = CreatePVectorHydrologyDCEfficient();
    207                 break;
    208         default:
    209                 /*No loads applied, do nothing: */
    210                 return;
    211         }
    212         if(pe){
    213                 pe->AddToGlobal(pf);
    214                 delete pe;
    215         }
    216 
     195        /*No loads applied, do nothing, originaly used for moulin input: */
     196        return;
     197       
    217198}
    218199/*}}}*/
     
    415396        this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    416397
    417         if (analysis_type==StressbalanceAnalysisEnum){
     398        switch(analysis_type){
     399        case StressbalanceAnalysisEnum:
    418400                /*No penalty to check*/
    419401                return;
    420         }
    421         else if (analysis_type==ThermalAnalysisEnum){
     402        case ThermalAnalysisEnum:
    422403                ConstraintActivateThermal(punstable);
    423         }
    424         else if (analysis_type==MeltingAnalysisEnum){
     404                break;
     405        case MeltingAnalysisEnum:
    425406                /*No penalty to check*/
    426407                return;
    427         }
    428         else if (analysis_type==HydrologyDCInefficientAnalysisEnum){
     408        case HydrologyDCInefficientAnalysisEnum:
    429409                ConstraintActivateHydrologyDCInefficient(punstable);
    430                 return;
    431         }
    432         else{
     410                break;
     411        default:
    433412                _error_("analysis: " << EnumToStringx(analysis_type) << " not supported yet");
    434413        }
    435 
    436414}
    437415/*}}}*/
     
    559537}
    560538/*}}}*/
    561 ElementVector* Pengrid::CreatePVectorHydrologyDCInefficient(void){/*{{{*/
    562 
    563         bool active_element,isefficientlayer;
    564         IssmDouble moulin_load,dt;
    565         IssmDouble epl_active;
    566 
    567         /*Initialize Element matrix*/
    568         ElementVector* pe=new ElementVector(&node,1,this->parameters);
    569 
    570         this->element->GetInputValue(&moulin_load,node,HydrologydcBasalMoulinInputEnum);
    571         parameters->FindParam(&dt,TimesteppingTimeStepEnum);
    572         parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);
    573 
    574 
    575         // Test version input in EPL when active
    576         if(isefficientlayer){
    577                 this->element->GetInputValue(&epl_active,node,HydrologydcMaskEplactiveNodeEnum);
    578                 if(epl_active){
    579                         pe->values[0]=moulin_load*0.0;
    580                 }
    581                 else{
    582                         if(dt!=0.0) pe->values[0]=moulin_load*dt;
    583                 }
    584         }
    585         else{
    586                         if(dt!=0.0) pe->values[0]=moulin_load*dt;
    587         }
    588 
    589         //Initial treatment, allways input in sediment
    590         /* if(dt!=0.0) pe->values[0]=moulin_load*dt; */
    591 
    592         /*Clean up and return*/
    593         return pe;
    594  }
    595 /*}}}*/
    596 ElementVector* Pengrid::CreatePVectorHydrologyDCEfficient(void){/*{{{*/
    597 
    598         IssmDouble moulin_load,dt;
    599 
    600         /*Initialize Element matrix*/
    601         if(!this->active) return NULL;
    602         ElementVector* pe=new ElementVector(&node,1,this->parameters);
    603 
    604         this->element->GetInputValue(&moulin_load,node,HydrologydcBasalMoulinInputEnum);
    605         parameters->FindParam(&dt,TimesteppingTimeStepEnum);
    606 
    607         if(dt!=0.0) pe->values[0]=moulin_load*dt;
    608 
    609         /*Clean up and return*/
    610         return pe;
    611  }
    612 /*}}}*/
    613539ElementMatrix* Pengrid::PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax){/*{{{*/
    614540        IssmDouble    penalty_factor;
  • issm/trunk-jpl/src/c/classes/Loads/Pengrid.h

    r21203 r21213  
    8787                void           ConstraintActivateHydrologyDCInefficient(int* punstable);
    8888                void           ConstraintActivateThermal(int* punstable);
    89                 ElementVector* CreatePVectorHydrologyDCInefficient(void);
    90                 ElementVector* CreatePVectorHydrologyDCEfficient(void);
    9189                ElementMatrix* PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax);
    9290                ElementMatrix* PenaltyCreateKMatrixMelting(IssmDouble kmax);
Note: See TracChangeset for help on using the changeset viewer.