source: issm/oecreview/Archive/21337-21723/ISSM-21573-21574.diff@ 21726

Last change on this file since 21726 was 21726, checked in by Mathieu Morlighem, 8 years ago

CHG added Archive/21337-21723

File size: 5.7 KB
  • ../trunk-jpl/src/c/classes/FemModel.cpp

     
    29532953}
    29542954/*}}}*/
    29552955void FemModel::ReMesh(void){/*{{{*/
    2956        
     2956
    29572957        /*Variables*/
    29582958        IssmDouble *newx                        = NULL;
    29592959        IssmDouble *newy                        = NULL;
     
    29722972        /*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
    29732973        this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
    29742974
    2975         if(this->loads->Size()!=0){
    2976                 _error_("not supported yet");
    2977         }
     2975        if(this->loads->Size()!=0) _error_("not supported yet");
    29782976
    29792977        /*Create vertices*/
    29802978        Vertices* new_vertices=new Vertices();
     
    30083006                if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
    30093007                this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
    30103008
    3011 
    3012                 if(IssmComm::GetRank()==2){
    3013                         _printf_("New constraints: CPU 1\n");
    3014                         //this->constraints->DeepEcho();
    3015                         new_constraints->DeepEcho();
    3016                         printarray(my_vertices,newnumberofvertices,1);
    3017                         _error_("stop!");
    3018                 }
    3019 
    3020 
    30213009                if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
    30223010                constraintcounter = new_constraints->NumberOfConstraints();
    30233011                /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
     
    30693057        /*Finally: interpolate all inputs and insert them into the new elements.*/
    30703058        this->InterpolateInputs(new_vertices,new_elements);
    30713059
    3072         if(IssmComm::GetRank()==2){
    3073                 _printf_("New constraints: CPU 1\n");
    3074                 //this->constraints->DeepEcho();
    3075                 new_constraints->DeepEcho();
    3076                 _error_("stop!");
    3077         }
    3078 
    3079 
    30803060        /*Delete old structure and set new pointers*/
    30813061        delete this->vertices;          this->vertices          = new_vertices;
    30823062        delete this->elements;          this->elements          = new_elements;
     
    36303610        Vector<IssmDouble>* vspcvxflag  = new Vector<IssmDouble>(numberofnodes_analysistype);
    36313611        Vector<IssmDouble>* vspcvyflag  = new Vector<IssmDouble>(numberofnodes_analysistype);
    36323612       
    3633         for(int i=0;i<numberofnodes_analysistype;i++){
    3634                 vspcvx->SetValue(i,0.,INS_VAL);
    3635                 vspcvy->SetValue(i,0.,INS_VAL);
    3636                 vspcvxflag->SetValue(i,0.,INS_VAL);
    3637                 vspcvyflag->SetValue(i,0.,INS_VAL);
    3638         }
    3639 
    36403613        for(int i=0;i<this->constraints->Size();i++){
    36413614                SpcStatic* spc                  = xDynamicCast<SpcStatic*>(this->constraints->GetObjectByOffset(i));
    36423615                int dof                                 = spc->GetDof();
     
    36443617                IssmDouble spcvalue     = spc->GetValue();
    36453618                int nodeindex                   = node-1;
    36463619               
    3647                 if(IssmComm::GetRank()==0)     
    3648                   {//itapopo
    3649                  if(dof==0) {//vx
    3650                         if(IssmComm::GetRank()==0) _printf_("Node: " << nodeindex << "\tdof: " << dof << "\tspcvalue: " << spcvalue << "\n") ;
     3620                if(dof==0) {//vx
    36513621                        vspcvx->SetValue(nodeindex,spcvalue,INS_VAL);
    36523622                        vspcvxflag->SetValue(nodeindex,1,INS_VAL);
    36533623                }
     
    36553625                        vspcvy->SetValue(nodeindex,spcvalue,INS_VAL);
    36563626                        vspcvyflag->SetValue(nodeindex,1,INS_VAL);
    36573627                }
    3658 
    3659                   }//itapopo
    36603628        }
    36613629
    3662         #ifdef _HAVE_PETSC_
    3663                 _printf_("Tem PETSC\n");
    3664         #endif
    3665 
    36663630        /*Assemble*/
    36673631        vspcvx->Assemble();
    36683632        vspcvy->Assemble();
    36693633        vspcvxflag->Assemble();
    36703634        vspcvyflag->Assemble();
    36713635
    3672         IssmDouble pvalue1,pvalue2;
    3673         vspcvx->GetValue(&pvalue1,0);
    3674         vspcvxflag->GetValue(&pvalue2,0);
    3675         if(IssmComm::GetRank()==0) _printf_("Node: " << 0 << "\tspcvalue: " << pvalue1 << "\tflag: " << pvalue2 << "\n") ;
    3676         vspcvx->GetValue(&pvalue1,5);
    3677         vspcvxflag->GetValue(&pvalue2,5);
    3678         if(IssmComm::GetRank()==0) _printf_("Node: " << 5 << "\tspcvalue: " << pvalue1 << "\tflag: " << pvalue2 << "\n") ;
    3679        
    3680        
    3681        
    36823636        /*Serialize*/
    36833637        spcvx            = vspcvx->ToMPISerial();
    36843638        spcvy            = vspcvy->ToMPISerial();
     
    37013655        InterpFromMeshToMesh2dx(&newspcvxflag,elementslist,x,y,nods_data,nels_data,spcvxflag,M_data,N_data,newx,newy,N_interp,NULL);
    37023656        InterpFromMeshToMesh2dx(&newspcvyflag,elementslist,x,y,nods_data,nels_data,spcvyflag,M_data,N_data,newx,newy,N_interp,NULL);
    37033657
    3704         if(IssmComm::GetRank()==1){
    3705                 _printf_("CPU 1:\n");
    3706                 _printf_("Old spcvx:\n");
    3707                 printarray(spcvx,nods_data,1);
    3708                 _printf_("Old spcvxflag:\n");
    3709                 printarray(spcvxflag,nods_data,1);
    3710                 _error_("Stop!!");
    3711         }
    3712 
    3713 
    3714 
    3715 
    3716 
    37173658        int count                                       = 0;
    37183659        IssmDouble eps                          = 1.e-8;
    37193660
    37203661        /*Now, insert the interpolated constraints in the data set (constraints)*/
    37213662        for(int i=0;i<newnumberofvertices;i++){
    3722                 if(my_vertices[i])
    3723                 /*spcvx*/
    3724                 if(!xIsNan<IssmDouble>(newspcvx[i]) && newspcvxflag[i]>(1-eps)){
    3725                         constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,0,newspcvx[i],StressbalanceAnalysisEnum));
    3726                         //add count'th spc, on node i+1, setting dof 1 to vx.
    3727                         count++;
     3663                if(my_vertices[i]){
     3664                        /*spcvx*/
     3665                        if(!xIsNan<IssmDouble>(newspcvx[i]) && newspcvxflag[i]>(1-eps)){
     3666                                constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,0,newspcvx[i],StressbalanceAnalysisEnum));
     3667                                //add count'th spc, on node i+1, setting dof 1 to vx.
     3668                                count++;
     3669                        }
    37283670                }
    37293671        }
    37303672        count=0;
    37313673        for(int i=0;i<newnumberofvertices;i++){
    3732                 if(my_vertices[i])
    3733                 /*spcvy*/
    3734                 if(!xIsNan<IssmDouble>(newspcvy[i]) && newspcvyflag[i]>(1-eps) ){
    3735                         constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,1,newspcvy[i],StressbalanceAnalysisEnum));
    3736                         //add count'th spc, on node i+1, setting dof 1 to vx.
    3737                         count++;
     3674                if(my_vertices[i]){
     3675                        /*spcvy*/
     3676                        if(!xIsNan<IssmDouble>(newspcvy[i]) && newspcvyflag[i]>(1-eps) ){
     3677                                constraints->AddObject(new SpcStatic(constraintcounter+count+1,nodecounter+i+1,1,newspcvy[i],StressbalanceAnalysisEnum));
     3678                                //add count'th spc, on node i+1, setting dof 1 to vx.
     3679                                count++;
     3680                        }
    37383681                }
    37393682        }
    37403683
Note: See TracBrowser for help on using the repository browser.