source:
issm/oecreview/Archive/21337-21723/ISSM-21573-21574.diff@
21726
Last change on this file since 21726 was 21726, checked in by , 8 years ago | |
---|---|
File size: 5.7 KB |
-
../trunk-jpl/src/c/classes/FemModel.cpp
2953 2953 } 2954 2954 /*}}}*/ 2955 2955 void FemModel::ReMesh(void){/*{{{*/ 2956 2956 2957 2957 /*Variables*/ 2958 2958 IssmDouble *newx = NULL; 2959 2959 IssmDouble *newy = NULL; … … 2972 2972 /*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/ 2973 2973 this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices); 2974 2974 2975 if(this->loads->Size()!=0){ 2976 _error_("not supported yet"); 2977 } 2975 if(this->loads->Size()!=0) _error_("not supported yet"); 2978 2976 2979 2977 /*Create vertices*/ 2980 2978 Vertices* new_vertices=new Vertices(); … … 3008 3006 if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints); 3009 3007 this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements); 3010 3008 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 3021 3009 if(new_nodes->Size()) nodecounter=new_nodes->MaximumId(); 3022 3010 constraintcounter = new_constraints->NumberOfConstraints(); 3023 3011 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/ … … 3069 3057 /*Finally: interpolate all inputs and insert them into the new elements.*/ 3070 3058 this->InterpolateInputs(new_vertices,new_elements); 3071 3059 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 3080 3060 /*Delete old structure and set new pointers*/ 3081 3061 delete this->vertices; this->vertices = new_vertices; 3082 3062 delete this->elements; this->elements = new_elements; … … 3630 3610 Vector<IssmDouble>* vspcvxflag = new Vector<IssmDouble>(numberofnodes_analysistype); 3631 3611 Vector<IssmDouble>* vspcvyflag = new Vector<IssmDouble>(numberofnodes_analysistype); 3632 3612 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 3640 3613 for(int i=0;i<this->constraints->Size();i++){ 3641 3614 SpcStatic* spc = xDynamicCast<SpcStatic*>(this->constraints->GetObjectByOffset(i)); 3642 3615 int dof = spc->GetDof(); … … 3644 3617 IssmDouble spcvalue = spc->GetValue(); 3645 3618 int nodeindex = node-1; 3646 3619 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 3651 3621 vspcvx->SetValue(nodeindex,spcvalue,INS_VAL); 3652 3622 vspcvxflag->SetValue(nodeindex,1,INS_VAL); 3653 3623 } … … 3655 3625 vspcvy->SetValue(nodeindex,spcvalue,INS_VAL); 3656 3626 vspcvyflag->SetValue(nodeindex,1,INS_VAL); 3657 3627 } 3658 3659 }//itapopo3660 3628 } 3661 3629 3662 #ifdef _HAVE_PETSC_3663 _printf_("Tem PETSC\n");3664 #endif3665 3666 3630 /*Assemble*/ 3667 3631 vspcvx->Assemble(); 3668 3632 vspcvy->Assemble(); 3669 3633 vspcvxflag->Assemble(); 3670 3634 vspcvyflag->Assemble(); 3671 3635 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 3682 3636 /*Serialize*/ 3683 3637 spcvx = vspcvx->ToMPISerial(); 3684 3638 spcvy = vspcvy->ToMPISerial(); … … 3701 3655 InterpFromMeshToMesh2dx(&newspcvxflag,elementslist,x,y,nods_data,nels_data,spcvxflag,M_data,N_data,newx,newy,N_interp,NULL); 3702 3656 InterpFromMeshToMesh2dx(&newspcvyflag,elementslist,x,y,nods_data,nels_data,spcvyflag,M_data,N_data,newx,newy,N_interp,NULL); 3703 3657 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 3717 3658 int count = 0; 3718 3659 IssmDouble eps = 1.e-8; 3719 3660 3720 3661 /*Now, insert the interpolated constraints in the data set (constraints)*/ 3721 3662 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 } 3728 3670 } 3729 3671 } 3730 3672 count=0; 3731 3673 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 } 3738 3681 } 3739 3682 } 3740 3683
Note:
See TracBrowser
for help on using the repository browser.