Changeset 22276
- Timestamp:
- 11/26/17 10:52:08 (7 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp ¶
r22241 r22276 32 32 this->refinement_type = cp.refinement_type; 33 33 this->level_max = cp.level_max; 34 this->radius_level_max = cp.radius_level_max;35 34 this->gradation = cp.gradation; 36 35 this->lag = cp.lag; … … 39 38 this->thicknesserror_threshold = cp.thicknesserror_threshold; 40 39 this->deviatoricerror_threshold = cp.deviatoricerror_threshold; 41 this-> max_deviatoricerror = cp.max_deviatoricerror;42 this-> max_thicknesserror = cp.max_thicknesserror;40 this->deviatoricerror_maximum = cp.deviatoricerror_maximum; 41 this->thicknesserror_maximum = cp.thicknesserror_maximum; 43 42 this->sid2index.clear(); 44 43 this->sid2index.resize(cp.sid2index.size()); … … 66 65 this->refinement_type = -1; 67 66 this->level_max = -1; 68 this->radius_level_max = -1;69 67 this->gradation = -1; 70 68 this->lag = -1; … … 73 71 this->thicknesserror_threshold = -1; 74 72 this->deviatoricerror_threshold = -1; 75 this-> max_deviatoricerror= -1;76 this-> max_thicknesserror= -1;73 this->deviatoricerror_maximum = -1; 74 this->thicknesserror_maximum = -1; 77 75 this->sid2index.clear(); 78 76 this->index2sid.clear(); … … 87 85 this->refinement_type = -1; 88 86 this->level_max = -1; 89 this->radius_level_max = -1;90 87 this->gradation = -1; 91 88 this->lag = -1; … … 94 91 this->thicknesserror_threshold = -1; 95 92 this->deviatoricerror_threshold = -1; 96 this-> max_deviatoricerror= -1;97 this-> max_thicknesserror= -1;93 this->deviatoricerror_maximum = -1; 94 this->thicknesserror_maximum = -1; 98 95 this->sid2index.clear(); 99 96 this->index2sid.clear(); … … 139 136 int numberofcriteria =-1; 140 137 int nconformelements = this->sid2index.size(); 141 double gl_ radius_h =-1;142 double gl_ radius_hmax = std::max(this->radius_level_max,this->groundingline_distance);143 double if_ radius_h =-1;144 double if_ radius_hmax = std::max(this->radius_level_max,this->icefront_distance);138 double gl_distance_h =-1; 139 double gl_distance_hmax = this->groundingline_distance; 140 double if_distance_h =-1; 141 double if_distance_hmax = this->icefront_distance; 145 142 double gl_groupdistance =-1; 146 143 double if_groupdistance =-1; … … 163 160 164 161 /*Calculate the maximum of the estimators, if requested{{{*/ 165 if(this->deviatoricerror_threshold>0 && this-> max_deviatoricerror<0){166 for(int i=0;i<nconformelements;i++) this-> max_deviatoricerror=max(this->max_deviatoricerror,deviatoricerror[i]);167 } 168 if(this->thicknesserror_threshold>0 && this-> max_thicknesserror<0){169 for(int i=0;i<nconformelements;i++) this-> max_thicknesserror=max(this->max_thicknesserror,thicknesserror[i]);162 if(this->deviatoricerror_threshold>0 && this->deviatoricerror_maximum<DBL_EPSILON){ 163 for(int i=0;i<nconformelements;i++) this->deviatoricerror_maximum=max(this->deviatoricerror_maximum,deviatoricerror[i]); 164 } 165 if(this->thicknesserror_threshold>0 && this->thicknesserror_maximum<DBL_EPSILON){ 166 for(int i=0;i<nconformelements;i++) this->thicknesserror_maximum=max(this->thicknesserror_maximum,thicknesserror[i]); 170 167 } 171 168 /*}}}*/ … … 181 178 gmesh->Element(this->specialelementsindex[i])->Father()->GetHigherSubElements(sons); 182 179 /*Limits*/ 183 gl_ radius_h = gl_radius_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(this->specialelementsindex[i])->Level());184 if_ radius_h = if_radius_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(this->specialelementsindex[i])->Level());185 d_maxerror = this->deviatoricerror_threshold*this->max_deviatoricerror;186 t_maxerror = this->thicknesserror_threshold*this->max_thicknesserror;180 gl_distance_h = gl_distance_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(this->specialelementsindex[i])->Level()); 181 if_distance_h = if_distance_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(this->specialelementsindex[i])->Level()); 182 d_maxerror = this->deviatoricerror_threshold*this->deviatoricerror_maximum; 183 t_maxerror = this->thicknesserror_threshold*this->thicknesserror_maximum; 187 184 /*Calculate the distance and error of the group (sons)*/ 188 185 gl_groupdistance=INFINITY;if_groupdistance=INFINITY;deviatoric_grouperror=0;thickness_grouperror=0; … … 196 193 } 197 194 criteria=0; 198 if(this->groundingline_distance>0 && gl_groupdistance<gl_ radius_h)criteria++;199 if(this->icefront_distance>0 && if_groupdistance<if_ radius_h)criteria++;200 if(this->deviatoricerror_threshold>0 && deviatoric_grouperror>d_maxerror ) criteria++;201 if(this->thicknesserror_threshold>0 && thickness_grouperror>t_maxerror ) criteria++;195 if(this->groundingline_distance>0 && gl_groupdistance<gl_distance_h+DBL_EPSILON) criteria++; 196 if(this->icefront_distance>0 && if_groupdistance<if_distance_h+DBL_EPSILON) criteria++; 197 if(this->deviatoricerror_threshold>0 && deviatoric_grouperror>d_maxerror-DBL_EPSILON) criteria++; 198 if(this->thicknesserror_threshold>0 && thickness_grouperror>t_maxerror-DBL_EPSILON) criteria++; 202 199 /*Finally, it keeps the father index if it must be refine*/ 203 200 if(criteria) index.push_back(gmesh->Element(this->specialelementsindex[i])->FatherIndex()); … … 230 227 if(!gmesh->Element(i)->Father()) _error_("father is NULL!\n"); 231 228 /*Limits with lag*/ 232 gl_ radius_h = this->lag*gl_radius_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(i)->Level());233 if_ radius_h = this->lag*if_radius_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(i)->Level());234 d_maxerror = 0.05*this->max_deviatoricerror;//itapopo definir melhor235 t_maxerror = 0.05*this->max_thicknesserror;//itapopo definir melhor229 gl_distance_h = this->lag*gl_distance_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(i)->Level()); 230 if_distance_h = this->lag*if_distance_hmax*std::pow(this->gradation,this->level_max-gmesh->Element(i)->Level()); 231 d_maxerror = 0.01*this->deviatoricerror_maximum;//itapopo definir melhor 0.05 232 t_maxerror = 0.01*this->thicknesserror_maximum;//itapopo definir melhor 0.05 236 233 /*Get the sons of the father (sibilings)*/ 237 234 sons.clear(); … … 252 249 /*Verify the criteria*/ 253 250 criteria=0; 254 if(this->groundingline_distance>0 && gl_groupdistance>gl_ radius_h)criteria++;255 if(this->icefront_distance>0 && if_groupdistance>if_ radius_h)criteria++;256 if(this->deviatoricerror_threshold>0 && deviatoric_grouperror<d_maxerror ) criteria++;257 if(this->thicknesserror_threshold>0 && thickness_grouperror<t_maxerror ) criteria++;251 if(this->groundingline_distance>0 && gl_groupdistance>gl_distance_h-DBL_EPSILON) criteria++; 252 if(this->icefront_distance>0 && if_groupdistance>if_distance_h-DBL_EPSILON) criteria++; 253 if(this->deviatoricerror_threshold>0 && deviatoric_grouperror<d_maxerror+DBL_EPSILON) criteria++; 254 if(this->thicknesserror_threshold>0 && thickness_grouperror<t_maxerror+DBL_EPSILON) criteria++; 258 255 /*Now, if the group attends the criteria, unrefine it*/ 259 256 if(criteria==numberofcriteria){ … … 280 277 sid=this->index2sid[gmesh->Element(i)->Index()]; 281 278 if(sid<0) continue; 282 /* Filter: set the region/radiusfor level h*/283 gl_ radius_h = gl_radius_hmax*std::pow(this->gradation,this->level_max-(gmesh->Element(i)->Level()+1));//+1,current element level is <level_max284 if_ radius_h = if_radius_hmax*std::pow(this->gradation,this->level_max-(gmesh->Element(i)->Level()+1));//+1,current element level is <level_max285 d_maxerror = this->deviatoricerror_threshold*this->max_deviatoricerror;286 t_maxerror = this->thicknesserror_threshold*this->max_thicknesserror;279 /*Set the distance for level h*/ 280 gl_distance_h = gl_distance_hmax*std::pow(this->gradation,this->level_max-(gmesh->Element(i)->Level()+1));//+1: current element level is <level_max 281 if_distance_h = if_distance_hmax*std::pow(this->gradation,this->level_max-(gmesh->Element(i)->Level()+1));//+1: current element level is <level_max 282 d_maxerror = this->deviatoricerror_threshold*this->deviatoricerror_maximum; 283 t_maxerror = this->thicknesserror_threshold*this->thicknesserror_maximum; 287 284 /*Verify distance and error of the element, if requested*/ 288 285 criteria=0; 289 if(this->groundingline_distance>0 && gl_distance[sid]<gl_ radius_h)criteria++;290 if(this->icefront_distance>0 && if_distance[sid]<if_ radius_h)criteria++;291 if(this->deviatoricerror_threshold>0 && deviatoricerror[sid]>d_maxerror ) criteria++;292 if(this->thicknesserror_threshold>0 && thicknesserror[sid]>t_maxerror ) criteria++;286 if(this->groundingline_distance>0 && gl_distance[sid]<gl_distance_h+DBL_EPSILON) criteria++; 287 if(this->icefront_distance>0 && if_distance[sid]<if_distance_h+DBL_EPSILON) criteria++; 288 if(this->deviatoricerror_threshold>0 && deviatoricerror[sid]>d_maxerror-DBL_EPSILON) criteria++; 289 if(this->thicknesserror_threshold>0 && thicknesserror[sid]>t_maxerror-DBL_EPSILON) criteria++; 293 290 /*Now, if it attends any criterion, keep the element index to refine in next step*/ 294 291 if(criteria)index.push_back(i); -
TabularUnified issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h ¶
r22241 r22276 8 8 #include <fstream> 9 9 #include <string> 10 #include <climits> 11 #include <cfloat> 10 12 11 13 /*NeoPZ includes*/ … … 48 50 public: 49 51 /*Public attributes{{{*/ 50 /* Filter (distance to the points)52 /* 51 53 * to refine: 52 * radius_h = initial_radius* gradation ^ (level_max-h)53 * to un irefine54 * radius_h = lag * initial_radius* gradation ^ (level_max-h)54 * distance_h = initial_distance * gradation ^ (level_max-h) 55 * to unrefine: 56 * distance_h = lag * initial_distance * gradation ^ (level_max-h) 55 57 */ 56 58 int refinement_type; //0 uniform (faster); 1 refpattern 57 59 int level_max; //max level of refinement 58 double radius_level_max; //initial radius which in the elements will be refined with level max59 60 double gradation; //geometric progression ratio to calculate radius of level h 60 61 double lag; //lag used in the unrefine process 61 62 /*Target and estimators*/ 62 double groundingline_distance; // if groundingline_distance>initial_radius, groundingline_distance will be used instead initial_radius63 double icefront_distance; // if icefront_distance>initial_radius, icefront_distance will be used instead initial_radius63 double groundingline_distance; //all elements with distance from grounding line <= groundingline_distance will be refined 64 double icefront_distance; //all elements with distance from ice front <= icefront_distance will be refined 64 65 double thicknesserror_threshold; //if ==0, it will not be used 66 double thicknesserror_maximum; //max value of the error estimator; in general, it is defined in the first time step. Attention with restart 65 67 double deviatoricerror_threshold; //if ==0, it will not be used 66 double max_deviatoricerror; // Max value of the error estimator; in general, it is defined in the first time step. Attention with restart 67 double max_thicknesserror; // Max value of the error estimator; in general, it is defined in the first time step. Attention with restart 68 double deviatoricerror_maximum; //max value of the error estimator; in general, it is defined in the first time step. Attention with restart 68 69 /*}}}*/ 69 70 /*Public methods{{{*/ -
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp ¶
r22266 r22276 4794 4794 for(int j=0;j<elementswidth;j++){ 4795 4795 vid=index[i*elementswidth+j]-1;//Matlab to C indexing 4796 if(error_vertices[vid]>0.0 05*maxerror) refine=true;//itapopo must be better defined4796 if(error_vertices[vid]>0.01*maxerror) refine=true;//itapopo must be better defined 4797 4797 } 4798 4798 } … … 4934 4934 IssmDouble* z = NULL; 4935 4935 int* elements = NULL; 4936 int level_max = -1;4937 IssmDouble radius_level_max = -1;4938 IssmDouble gradation = -1;4939 IssmDouble lag = -1;4940 IssmDouble groundingline_distance = -1;4941 IssmDouble icefront_distance = -1;4942 IssmDouble thicknesserror_threshold = -1;4943 IssmDouble deviatoricerror_threshold = -1;4944 4936 4945 4937 /*Initialize field as NULL for now*/ … … 4949 4941 /*elements comes in Matlab indexing*/ 4950 4942 this->GetMesh(this->vertices,this->elements,&x,&y,&z,&elements); 4951 4952 /*Get amr parameters*/4953 this->parameters->FindParam(&level_max,AmrLevelMaxEnum);4954 this->parameters->FindParam(&radius_level_max,AmrRadiusLevelMaxEnum);4955 this->parameters->FindParam(&gradation,AmrGradationEnum);4956 this->parameters->FindParam(&lag,AmrLagEnum);4957 this->parameters->FindParam(&groundingline_distance,AmrGroundingLineDistanceEnum);4958 this->parameters->FindParam(&icefront_distance,AmrIceFrontDistanceEnum);4959 this->parameters->FindParam(&thicknesserror_threshold,AmrThicknessErrorThresholdEnum);4960 this->parameters->FindParam(&deviatoricerror_threshold,AmrDeviatoricErrorThresholdEnum);4961 4943 4962 4944 /*Create initial mesh (coarse mesh) in neopz data structure*/ … … 4965 4947 this->SetRefPatterns(); 4966 4948 this->amr = new AdaptiveMeshRefinement(); 4967 this->amr->refinement_type = 1;//1 is refpattern; 0 is uniform (faster) 4968 this->amr->level_max = level_max; 4969 this->amr->radius_level_max = radius_level_max; 4970 this->amr->gradation = gradation; 4971 this->amr->lag = lag; 4972 this->amr->groundingline_distance = groundingline_distance; 4973 this->amr->icefront_distance = icefront_distance; 4974 this->amr->thicknesserror_threshold = thicknesserror_threshold; 4975 this->amr->deviatoricerror_threshold = deviatoricerror_threshold; 4949 this->amr->refinement_type=1;//1 is refpattern; 0 is uniform (faster) 4950 /*Get amr parameters*/ 4951 this->parameters->FindParam(&this->amr->level_max,AmrLevelMaxEnum); 4952 this->parameters->FindParam(&this->amr->gradation,AmrGradationEnum); 4953 this->parameters->FindParam(&this->amr->lag,AmrLagEnum); 4954 this->parameters->FindParam(&this->amr->groundingline_distance,AmrGroundingLineDistanceEnum); 4955 this->parameters->FindParam(&this->amr->icefront_distance,AmrIceFrontDistanceEnum); 4956 this->parameters->FindParam(&this->amr->thicknesserror_threshold,AmrThicknessErrorThresholdEnum); 4957 this->parameters->FindParam(&this->amr->thicknesserror_maximum,AmrThicknessErrorMaximumEnum); 4958 this->parameters->FindParam(&this->amr->deviatoricerror_threshold,AmrDeviatoricErrorThresholdEnum); 4959 this->parameters->FindParam(&this->amr->deviatoricerror_maximum,AmrDeviatoricErrorMaximumEnum); 4976 4960 if(my_rank==0){ 4977 4961 this->amr->CreateInitialMesh(numberofvertices,numberofelements,x,y,elements); -
TabularUnified issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp ¶
r22241 r22276 130 130 case AmrNeopzEnum: 131 131 parameters->AddObject(iomodel->CopyConstantObject("md.amr.level_max",AmrLevelMaxEnum)); 132 parameters->AddObject(iomodel->CopyConstantObject("md.amr.radius_level_max",AmrRadiusLevelMaxEnum));133 132 parameters->AddObject(iomodel->CopyConstantObject("md.amr.gradation",AmrGradationEnum)); 134 133 parameters->AddObject(iomodel->CopyConstantObject("md.amr.lag",AmrLagEnum)); -
TabularUnified issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h ¶
r22266 r22276 879 879 AmrLevelMaxEnum, 880 880 AmrLagEnum, 881 AmrRadiusLevelMaxEnum,882 881 AmrBamgEnum, 883 882 AmrHminEnum, -
TabularUnified issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp ¶
r22266 r22276 852 852 case AmrLevelMaxEnum : return "AmrLevelMax"; 853 853 case AmrLagEnum : return "AmrLag"; 854 case AmrRadiusLevelMaxEnum : return "AmrRadiusLevelMax";855 854 case AmrBamgEnum : return "AmrBamg"; 856 855 case AmrHminEnum : return "AmrHmin"; -
TabularUnified issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp ¶
r22266 r22276 866 866 else if (strcmp(name,"TransientAmrFrequency")==0) return TransientAmrFrequencyEnum; 867 867 else if (strcmp(name,"AmrType")==0) return AmrTypeEnum; 868 else if (strcmp(name,"AmrRestart")==0) return AmrRestartEnum; 868 869 else if (strcmp(name,"AmrNeopz")==0) return AmrNeopzEnum; 869 870 else if (strcmp(name,"AmrLevelMax")==0) return AmrLevelMaxEnum; 870 871 else if (strcmp(name,"AmrLag")==0) return AmrLagEnum; 871 else if (strcmp(name,"AmrRadiusLevelMax")==0) return AmrRadiusLevelMaxEnum;872 872 else if (strcmp(name,"AmrBamg")==0) return AmrBamgEnum; 873 873 else if (strcmp(name,"AmrHmin")==0) return AmrHminEnum; … … 886 886 else if (strcmp(name,"AmrThicknessErrorResolution")==0) return AmrThicknessErrorResolutionEnum; 887 887 else if (strcmp(name,"AmrThicknessErrorThreshold")==0) return AmrThicknessErrorThresholdEnum; 888 else if (strcmp(name,"AmrThicknessErrorMaximum")==0) return AmrThicknessErrorMaximumEnum; 888 889 else if (strcmp(name,"AmrDeviatoricErrorResolution")==0) return AmrDeviatoricErrorResolutionEnum; 889 890 else if (strcmp(name,"AmrDeviatoricErrorThreshold")==0) return AmrDeviatoricErrorThresholdEnum; 891 else if (strcmp(name,"AmrDeviatoricErrorMaximum")==0) return AmrDeviatoricErrorMaximumEnum; 890 892 else if (strcmp(name,"DeviatoricStressErrorEstimator")==0) return DeviatoricStressErrorEstimatorEnum; 891 893 else if (strcmp(name,"ThicknessErrorEstimator")==0) return ThicknessErrorEstimatorEnum; … … 996 998 else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum; 997 999 else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum; 998 else if (strcmp(name,"SmoothAnalysis")==0) return SmoothAnalysisEnum;999 else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;1000 1000 else stage=9; 1001 1001 } 1002 1002 if(stage==9){ 1003 if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum; 1003 if (strcmp(name,"SmoothAnalysis")==0) return SmoothAnalysisEnum; 1004 else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum; 1005 else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum; 1004 1006 else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum; 1005 1007 else if (strcmp(name,"UzawaPressureAnalysis")==0) return UzawaPressureAnalysisEnum; -
TabularUnified issm/trunk-jpl/src/m/classes/amrneopz.m ¶
r22242 r22276 7 7 properties (SetAccess=public) 8 8 level_max = 0; 9 radius_level_max = 0;10 9 gradation = 0; 11 10 lag = 0; … … 57 56 %end 58 57 58 %2017 November 24th 59 %radius_level_max was deleted! 60 59 61 %end% }}} 60 62 end … … 72 74 %filter parameters: 73 75 self.level_max = 2; 74 self.radius_level_max= 10000;75 76 self.gradation = 1.5; 76 77 self.lag = 1.1; … … 88 89 89 90 md = checkfield(md,'fieldname','amr.level_max','numel',[1],'>=',0,'<=',5); 90 md = checkfield(md,'fieldname','amr.radius_level_max','numel',[1],'>',0,'NaN',1,'Inf',1);91 91 md = checkfield(md,'fieldname','amr.gradation','numel',[1],'>=',1.1,'<=',5.0,'NaN',1); 92 92 md = checkfield(md,'fieldname','amr.lag','numel',[1],'>=',1.0,'<=',3.0,'NaN',1); … … 103 103 104 104 fielddisplay(self,'level_max',['maximum refinement level (1, 2, 3, 4 or 5)']); 105 fielddisplay(self,'radius_level_max',['region which will be refined with level_max [ m ]']);106 105 fielddisplay(self,'gradation',['maximum ratio between two adjacent edges']); 107 106 fielddisplay(self,'lag',['lag used to unrefine the elements']); … … 118 117 WriteData(fid,prefix,'name','md.amr.type','data',2,'format','Integer'); 119 118 WriteData(fid,prefix,'object',self,'class','amr','fieldname','level_max','format','Integer'); 120 WriteData(fid,prefix,'object',self,'class','amr','fieldname','radius_level_max','format','Double');121 119 WriteData(fid,prefix,'object',self,'class','amr','fieldname','gradation','format','Double'); 122 120 WriteData(fid,prefix,'object',self,'class','amr','fieldname','lag','format','Double'); … … 132 130 133 131 writejsdouble(fid,[modelname '.amr.level_max'],self.level_max); 134 writejsdouble(fid,[modelname '.amr.radius_level_max'],self.radius_level_max);135 132 writejsdouble(fid,[modelname '.amr.gradation'],self.gradation); 136 133 writejsdouble(fid,[modelname '.amr.lag'],self.lag);
Note:
See TracChangeset
for help on using the changeset viewer.