Ignore:
Timestamp:
06/13/13 09:45:43 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: moving mask transformation from UpdateFromSolution to GetMask

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r15249 r15252  
    64076407
    64086408        /*Intermediaries*/
    6409         const int   numdof         = NDOF1 *NUMVERTICES;
    6410         int        *doflist        = NULL;
     6409        const int   numdof   = NDOF1 *NUMVERTICES;
     6410        int        *doflist  = NULL;
    64116411        bool        converged;
    64126412        bool        isefficientlayer;
    6413         IssmDouble  activeEpl[numdof],activate[numdof]={0.0};
    64146413        IssmDouble  values[numdof];
    64156414        IssmDouble  residual[numdof];
     
    64336432
    64346433        /*Get inputs*/
    6435         if(isefficientlayer){
    6436                 GetInputListOnVertices(&activeEpl[0],HydrologydcMaskEplactiveEnum);
    6437         }
    64386434        if(converged){
    64396435                this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
    64406436                this->parameters->FindParam(&kmax,HydrologySedimentKmaxEnum);
    64416437                this->parameters->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
    6442                
    64436438               
    64446439                kappa=kmax*pow(10.,penalty_factor);
     
    64486443                        if(values[i]>h_max){
    64496444                                residual[i]=kappa*(values[i]-h_max);
    6450                                 if(isefficientlayer) activate[i]=1.0;
    64516445                        }
    64526446                        else{
    6453                                 if(isefficientlayer){
    6454                                         if(activeEpl[i]==1.0)activate[i]=1.0;
    6455                                 }                               
    64566447                                residual[i]=0.0;
    64576448                        }
    64586449                }
    64596450        }
    6460         else{
    6461                 for(int i=0;i<NUMVERTICES;i++){
    6462                         if(isefficientlayer){
    6463                                 if(activeEpl[i]==1.0)activate[i]=1.0;
    6464                         }                               
    6465                 }
    6466         }
    64676451
    64686452        /*Add input to the element: */
    6469         if(isefficientlayer) this->inputs->AddInput(new TriaP1Input(HydrologydcMaskEplactiveEnum,&activate[0]));
    64706453        this->inputs->AddInput(new TriaP1Input(SedimentHeadEnum,values));
    64716454        this->inputs->AddInput(new TriaP1Input(SedimentHeadResidualEnum,residual));
     
    64736456        /*Free ressources:*/
    64746457        xDelete<int>(doflist);
    6475 
    64766458}
    64776459/*}}}*/
     
    65846566
    65856567        /*Constants*/
    6586         const int  numnodes         =NUMVERTICES;
    6587         int        flag;
     6568        const int  numnodes = NUMVERTICES;
     6569        IssmDouble flag     = 0.;
    65886570        IssmDouble active[numnodes];
    65896571       
    65906572        GetInputListOnVertices(&active[0],HydrologydcMaskEplactiveEnum);
    6591                
     6573
    65926574        for(int i=0;i<numnodes;i++) flag+=active[i];
    65936575       
    65946576        if(flag>0.){
    6595                 for(int i=0;i<numnodes;i++) nodes[i]->Activate();
    6596         }
    6597        
    6598         else if(!this->AnyActive()){
    6599                 for(int i=0;i<numnodes;i++) nodes[i]->Deactivate();
    6600                
     6577                for(int i=0;i<numnodes;i++){
     6578                        active_vec->SetValue(nodes[i]->Sid(),1.,INS_VAL);
     6579                }
    66016580        }
    66026581        else{
     
    66176596        IssmDouble  sedhead[numdof];
    66186597        IssmDouble  eplhead[numdof];
    6619 
     6598        IssmDouble  residual[numdof];
    66206599
    66216600        GetInputListOnVertices(&old_active[0],HydrologydcMaskEplactiveEnum);   
    66226601        GetInputListOnVertices(&sedhead[0],SedimentHeadEnum);
    66236602        GetInputListOnVertices(&eplhead[0],EplHeadEnum);
    6624 
     6603        GetInputListOnVertices(&residual[0],SedimentHeadResidualEnum);
     6604
     6605        /*Get minimum sediment head*/
    66256606        sedheadmin=sedhead[0];
    6626         for(i=1;i<numdof;i++){
    6627                 if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
    6628         }
     6607        for(i=1;i<numdof;i++) if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
    66296608       
    66306609        for(i=0;i<numdof;i++){
     6610
     6611                /*Activate EPL if residual is >0 */
     6612                if(residual[i]>0.){
     6613                        vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
     6614                }
     6615               
    66316616                /*If mask was alread one, keep one*/
    6632                 if(old_active[i]>0.){
     6617                else if(old_active[i]>0.){
    66336618                        vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
    66346619                }
    6635                
    6636                 this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
     6620
    66376621                /*Increase the size of the efficient system if needed*/
    66386622                /*Increase is needed if the epl head reach the maximum value (sediment value for now)*/
     6623                this->GetHydrologyDCInefficientHmax(&h_max,nodes[i]);
    66396624                if(eplhead[i]>=h_max){
    6640                         vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
    6641                         for(j=0;j<numdof;j++){
    6642 
    6643                                 /*Increase of the domain is on the downstream node in term of sediment head*/
    6644                                 if(sedhead[j] == sedheadmin){
    6645                                         vec_mask->SetValue(nodes[j]->Sid(),1.,INS_VAL);
    6646                                         break;
    6647                                 }
    6648                         }
     6625                        //vec_mask->SetValue(nodes[i]->Sid(),1.,INS_VAL);
     6626                        //for(j=0;j<numdof;j++){
     6627
     6628                        //      /*Increase of the domain is on the downstream node in term of sediment head*/
     6629                        //      if(sedhead[j] == sedheadmin){
     6630                        //              vec_mask->SetValue(nodes[j]->Sid(),1.,INS_VAL);
     6631                        //              break;
     6632                        //      }
     6633                        //}
    66496634                }
    66506635        }
Note: See TracChangeset for help on using the changeset viewer.