Changeset 3201
- Timestamp:
- 03/05/10 13:47:09 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ModelProcessorx/CreateParameters.cpp
r2383 r3201 109 109 parameters->AddObject(param); 110 110 111 /*max_nonlinear_iterations: */ 112 count++; 113 param= new Param(count,"max_nonlinear_iterations",DOUBLE); 114 param->SetDouble(iomodel->max_nonlinear_iterations); 115 parameters->AddObject(param); 116 111 117 /*yts: */ 112 118 count++; … … 191 197 param= new Param(count,"min_thermal_constraints",DOUBLE); 192 198 param->SetDouble(iomodel->min_thermal_constraints); 199 parameters->AddObject(param); 200 201 /*min_mechanical_constraints: */ 202 count++; 203 param= new Param(count,"min_mechanical_constraints",DOUBLE); 204 param->SetDouble(iomodel->min_mechanical_constraints); 193 205 parameters->AddObject(param); 194 206 -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r3105 r3201 61 61 int riftfront_penalty_lock; 62 62 bool riftfront_active; 63 bool riftfront_frozen; 63 64 int riftfront_counter; 64 65 bool riftfront_prestable; … … 227 228 228 229 riftfront_active=0; 230 riftfront_frozen=0; 229 231 riftfront_counter=0; 230 232 riftfront_prestable=0; 231 233 232 riftfront=new Riftfront(riftfront_type,riftfront_id, riftfront_node_ids, riftfront_mparid, riftfront_h,riftfront_b,riftfront_s,riftfront_normal,riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction, riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_ counter,riftfront_prestable,riftfront_shelf);234 riftfront=new Riftfront(riftfront_type,riftfront_id, riftfront_node_ids, riftfront_mparid, riftfront_h,riftfront_b,riftfront_s,riftfront_normal,riftfront_length,riftfront_fill,riftfront_friction, riftfront_fraction, riftfront_fractionincrement, riftfront_penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_frozen,riftfront_counter,riftfront_prestable,riftfront_shelf); 233 235 234 236 loads->AddObject(riftfront); -
issm/trunk/src/c/ModelProcessorx/IoModel.cpp
r2959 r3201 129 129 iomodel->eps_rel=0; 130 130 iomodel->eps_abs=0; 131 iomodel->max_nonlinear_iterations=0; 131 132 iomodel->dt=0; 132 133 iomodel->ndt=0; … … 151 152 iomodel->thermalconductivity=0; 152 153 iomodel->min_thermal_constraints=0; 154 iomodel->min_mechanical_constraints=0; 153 155 iomodel->stabilize_constraints=0; 154 156 iomodel->mixed_layer_capacity=0; … … 355 357 IoModelFetchData(&iomodel->eps_rel,iomodel_handle,"eps_rel"); 356 358 IoModelFetchData(&iomodel->eps_abs,iomodel_handle,"eps_abs"); 359 IoModelFetchData(&iomodel->max_nonlinear_iterations,iomodel_handle,"max_nonlinear_iterations"); 357 360 IoModelFetchData(&iomodel->dt,iomodel_handle,"dt"); 358 361 IoModelFetchData(&iomodel->ndt,iomodel_handle,"ndt"); … … 376 379 IoModelFetchData(&iomodel->thermalconductivity,iomodel_handle,"thermalconductivity"); 377 380 IoModelFetchData(&iomodel->min_thermal_constraints,iomodel_handle,"min_thermal_constraints"); 381 IoModelFetchData(&iomodel->min_mechanical_constraints,iomodel_handle,"min_mechanical_constraints"); 378 382 IoModelFetchData(&iomodel->stabilize_constraints,iomodel_handle,"stabilize_constraints"); 379 383 IoModelFetchData(&iomodel->mixed_layer_capacity,iomodel_handle,"mixed_layer_capacity"); -
issm/trunk/src/c/ModelProcessorx/IoModel.h
r2959 r3201 135 135 double eps_rel; 136 136 double eps_abs; 137 double max_nonlinear_iterations; 137 138 double dt,ndt; 138 139 double penalty_offset; … … 152 153 double heatcapacity,thermalconductivity; 153 154 int min_thermal_constraints; 155 int min_mechanical_constraints; 154 156 int stabilize_constraints; 155 157 double mixed_layer_capacity; -
issm/trunk/src/c/PenaltyConstraintsx/PenaltyConstraintsx.cpp
r2333 r3201 25 25 int converged=0; 26 26 int num_unstable_constraints=0; 27 int min_mechanical_constraints=0; 28 29 /*recover parameters: */ 30 parameters->FindParam(&min_mechanical_constraints,"min_mechanical_constraints"); 27 31 28 32 /*First, get loads configured: */ … … 32 36 * management routine, otherwise, skip : */ 33 37 if (RiftIsPresent(loads)){ 34 RiftConstraints(&converged,&num_unstable_constraints,loads,inputs, analysis_type,sub_analysis_type);38 RiftConstraints(&converged,&num_unstable_constraints,loads,inputs,min_mechanical_constraints,analysis_type,sub_analysis_type); 35 39 } 36 40 else if(loads->MeltingIsPresent()){ -
issm/trunk/src/c/PenaltyConstraintsx/RiftConstraints.cpp
r1904 r3201 5 5 #include "./RiftConstraints.h" 6 6 #include "../EnumDefinitions/EnumDefinitions.h" 7 #include "../include/macros.h" 8 #include "../shared/shared.h" 7 9 8 10 #define _ZIGZAGCOUNTER_ … … 10 12 #undef __FUNCT__ 11 13 #define __FUNCT__ "RiftConstrain" 12 int RiftConstraints(int* pconverged, int* pnum_unstable_constraints,DataSet* loads,ParameterInputs* inputs,int analysis_type,int sub_analysis_type){14 int RiftConstraints(int* pconverged, int* pnum_unstable_constraints,DataSet* loads,ParameterInputs* inputs,int min_mechanical_constraints,int analysis_type,int sub_analysis_type){ 13 15 14 16 int num_unstable_constraints=0; 15 17 int converged=0; 16 18 int potential; 19 extern int my_rank; 17 20 18 21 Constrain(&num_unstable_constraints,loads,inputs,analysis_type); 19 22 if(num_unstable_constraints==0)converged=1; 23 24 25 if(IsFrozen(loads)){ 26 converged=1; 27 num_unstable_constraints=0; 28 } 29 else if(num_unstable_constraints<=min_mechanical_constraints){ 30 _printf_(" freezing constraints\n"); 31 FreezeConstraints(loads,inputs,analysis_type); 32 } 20 33 21 34 /*Assign output pointers: */ … … 227 240 228 241 #undef __FUNCT__ 242 #define __FUNCT__ "FreezeConstraints" 243 244 void FreezeConstraints(DataSet* loads,ParameterInputs* inputs,int analysis_type){ 245 246 int i; 247 248 /* generic object pointer: */ 249 Riftfront* riftfront=NULL; 250 251 /*Enforce constraints: */ 252 for (i=0;i<loads->Size();i++){ 253 254 if (RiftfrontEnum()==loads->GetEnum(i)){ 255 256 riftfront=(Riftfront*)loads->GetObjectByOffset(i); 257 258 riftfront->FreezeConstraints(inputs,analysis_type); 259 260 } 261 } 262 263 } 264 265 #undef __FUNCT__ 266 #define __FUNCT__ "IsFrozen" 267 int IsFrozen(DataSet* loads){ 268 269 int i; 270 271 /* generic object pointer: */ 272 Riftfront* riftfront=NULL; 273 int found=0; 274 int mpi_found=0; 275 276 /*Enforce constraints: */ 277 for (i=0;i<loads->Size();i++){ 278 279 if (RiftfrontEnum()==loads->GetEnum(i)){ 280 281 riftfront=(Riftfront*)loads->GetObjectByOffset(i); 282 if (riftfront->IsFrozen()){ 283 found=1; 284 break; 285 } 286 } 287 } 288 289 /*Is there just one found? that would mean we have frozen! : */ 290 #ifdef _PARALLEL_ 291 MPI_Reduce (&found,&mpi_found,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD ); 292 MPI_Bcast(&mpi_found,1,MPI_DOUBLE,0,MPI_COMM_WORLD); 293 found=mpi_found; 294 #endif 295 296 return found; 297 } 298 299 #undef __FUNCT__ 229 300 #define __FUNCT__ "MaxPenetrationInInputs" 230 301 -
issm/trunk/src/c/PenaltyConstraintsx/RiftConstraints.h
r1784 r3201 10 10 #include "../DataSet/DataSet.h" 11 11 12 int RiftConstraints(int* pconverged, int* pnum_unstable_constraints,DataSet* loads,ParameterInputs* inputs,int analysis_type,int sub_analysis_type);12 int RiftConstraints(int* pconverged, int* pnum_unstable_constraints,DataSet* loads,ParameterInputs* inputs,int min_mechanical_constraints,int analysis_type,int sub_analysis_type); 13 13 14 14 int RiftIsPresent(DataSet* loads); … … 22 22 int Constrain(int* pnum_unstable_constraints,DataSet* loads,ParameterInputs* inputs,int analysis_type_enum); 23 23 24 void FreezeConstraints(DataSet* loads,ParameterInputs* inputs,int analysis_type); 25 24 26 int MaxPenetrationInInputs(DataSet* loads,ParameterInputs* inputs,int analysis_type_enum); 25 27 … … 27 29 28 30 int IsMaterialStable(DataSet* loads,ParameterInputs* inputs,int analysis_type_enum); 31 32 int IsFrozen(DataSet* loads); 29 33 #endif -
issm/trunk/src/c/objects/Riftfront.cpp
r2908 r3201 28 28 /*}}}1*/ 29 29 /*FUNCTION Riftfront::creation {{{1*/ 30 Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){30 Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,bool riftfront_frozen, int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 31 31 32 32 int i; … … 61 61 penalty_lock=riftfront_penalty_lock; 62 62 active=riftfront_active; 63 frozen=riftfront_frozen; 63 64 counter=riftfront_counter; 64 65 prestable=riftfront_prestable; … … 114 115 memcpy(marshalled_dataset,&penalty_lock,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 115 116 memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active); 117 memcpy(marshalled_dataset,&frozen,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 116 118 memcpy(marshalled_dataset,&counter,sizeof(counter));marshalled_dataset+=sizeof(counter); 117 119 memcpy(marshalled_dataset,&prestable,sizeof(prestable));marshalled_dataset+=sizeof(prestable); … … 144 146 sizeof(penalty_lock)+ 145 147 sizeof(active)+ 148 sizeof(frozen)+ 146 149 sizeof(counter)+ 147 150 sizeof(prestable)+ … … 182 185 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); 183 186 memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active); 187 memcpy(&frozen,marshalled_dataset,sizeof(frozen));marshalled_dataset+=sizeof(frozen); 184 188 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter); 185 189 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable); … … 237 241 inputs=(ParameterInputs*)vinputs; 238 242 243 /*Is this constraint frozen? In which case we don't touch: */ 244 if (this->frozen){ 245 *punstable=0; 246 return 1; 247 } 239 248 240 249 /*First recover parameter inputs: */ … … 322 331 printf("penalty_lock %i\n",penalty_lock); 323 332 printf("active %i\n",active); 333 printf("frozen %i\n",frozen); 324 334 printf("counter %i\n",counter); 325 335 printf("prestable %i\n",prestable); … … 348 358 printf("penalty_lock %i\n",penalty_lock); 349 359 printf("active %i\n",active); 360 printf("frozen %i\n",frozen); 350 361 printf("counter %i\n",counter); 351 362 printf("prestable %i\n",prestable); … … 709 720 } 710 721 /*}}}1*/ 711 /*FUNCTION Riftfront::PotentialUnstableConstraint {{{1*/ 722 /*FUNCTION Riftfront::PotentialUnstableC 723 * nstraint {{{1*/ 712 724 #undef __FUNCT__ 713 725 #define __FUNCT__ "Riftfront::PotentialUnstableConstraint" … … 831 843 } 832 844 /*}}}1*/ 845 /*FUNCTION Riftfront::FreezeConstraints{{{1*/ 846 #undef __FUNCT__ 847 #define __FUNCT__ "Riftfront::FreezeConstraints" 848 void Riftfront::FreezeConstraints(void* vinputs, int analysis_type){ 849 850 /*Just set frozen flag to 1: */ 851 this->frozen=1; 852 853 } 854 /*}}}1*/ 855 /*FUNCTION Riftfront::IsFrozen{{{1*/ 856 #undef __FUNCT__ 857 #define __FUNCT__ "Riftfront::IsFrozen" 858 bool Riftfront::IsFrozen(void){ 859 860 /*Just set frozen flag to 1: */ 861 if(this->frozen)return 1; 862 else return 0; 863 } 864 /*}}}1*/ -
issm/trunk/src/c/objects/Riftfront.h
r1805 r3201 50 50 /*computational: */ 51 51 bool active; 52 bool frozen; 52 53 int counter; 53 54 bool prestable; … … 58 59 59 60 Riftfront(); 60 Riftfront(char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active, int counter,bool prestable,bool shelf);61 Riftfront(char type[RIFTFRONTSTRING],int id, int node_ids[MAX_RIFTFRONT_GRIDS], int mparid, double h[MAX_RIFTFRONT_GRIDS],double b[MAX_RIFTFRONT_GRIDS],double s[MAX_RIFTFRONT_GRIDS],double normal[2],double length,int fill,double friction, double fraction, double fractionincrement, double penalty_offset, int penalty_lock,bool active,bool frozen, int counter,bool prestable,bool shelf); 61 62 ~Riftfront(); 62 63 … … 81 82 int PreConstrain(int* punstable, void* inputs, int analysis_type); 82 83 int Constrain(int* punstable, void* inputs, int analysis_type); 84 void FreezeConstraints(void* inputs, int analysis_type); 85 bool IsFrozen(void); 83 86 int Penetration(double* ppenetration, void* inputs, int analysis_type); 84 87 int MaxPenetration(double* ppenetration, void* inputs, int analysis_type); -
issm/trunk/src/c/objects/Tria.cpp
r3189 r3201 4772 4772 4773 4773 /*Update internal data if inputs holds new values: */ 4774 if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n");4774 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n"); 4775 4775 //For now 4776 4776 inputs->Recover("thickness",&h[0],1,dofs,3,(void**)nodes); -
issm/trunk/src/c/parallel/diagnostic_core_nonlinear.cpp
r3186 r3201 33 33 int count; 34 34 int numberofnodes; 35 int min_mechanical_constraints; 36 int max_nonlinear_iterations; 35 37 36 38 /*parameters:*/ … … 47 49 fem->FindParam(&solver_string,"solverstring"); 48 50 fem->FindParam(&verbose,"verbose"); 49 51 fem->FindParam(&min_mechanical_constraints,"min_mechanical_constraints"); 52 fem->FindParam(&max_nonlinear_iterations,"max_nonlinear_iterations"); 53 50 54 /*Were loads requested as output? : */ 51 55 if(!input_loads){ … … 129 133 130 134 //rift convergence 131 if (!constraints_converged) converged=0; 135 if (!constraints_converged) { 136 if (converged){ 137 if (num_unstable_constraints <= min_mechanical_constraints) converged=1; 138 else converged=0; 139 } 140 } 132 141 133 142 /*Increase count: */ 134 143 count++; 135 144 if(converged==1)break; 136 if(count>= 1000){137 _printf_(" maximum number of iterations exceeded\n");145 if(count>=max_nonlinear_iterations){ 146 _printf_(" maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations); 138 147 break; 139 148 } … … 155 164 156 165 } 157 166 158 167 /*Delete loads only if no ouput was requested: */ 159 168 if(!input_loads)delete loads; -
issm/trunk/src/m/classes/@model/model.m
r3136 r3201 116 116 md.thermal_exchange_velocity=0; 117 117 md.min_thermal_constraints=0; 118 md.min_mechanical_constraints=0; 118 119 md.stabilize_constraints=0; 119 120 … … 165 166 md.eps_rel=0; 166 167 md.eps_abs=0; 168 md.max_nonlinear_iterations=0; 167 169 md.sparsity=0; 168 170 md.connectivity=0; -
issm/trunk/src/m/classes/@model/setdefaultparameters.m
r2892 r3201 65 65 md.eps_abs=10; 66 66 67 %maximum of non-linear iterations. 68 md.max_nonlinear_iterations=100; 69 67 70 %sparsity 68 71 md.sparsity=0.001; … … 114 117 %parameter is often used. 115 118 md.min_thermal_constraints=0; 119 md.min_mechanical_constraints=0; 116 120 117 121 %Transient parameters -
issm/trunk/src/m/classes/public/display/displaydiagnostic.m
r2330 r3201 15 15 fielddisplay(md,'eps_rel','velocity relative convergence criterion, NaN -> not applied'); 16 16 fielddisplay(md,'eps_abs','velocity absolute convergence criterion, NaN -> not applied'); 17 fielddisplay(md,'max_nonlinear_iterations','maximum number of nonlinear iterations'); 17 18 fielddisplay(md,'viscosity_overshoot','over-shooting constant new=new+C*(new-old)'); 18 19 … … 23 24 disp(sprintf('\n %s','Penalties:')); 24 25 fielddisplay(md,'penalty_offset','offset used by penalties: penalty = Kmax*10^offset'); 26 fielddisplay(md,'min_mechanical_constraints','threshold for instability of mechanical constraints'); 25 27 26 28 disp(sprintf('\n %s','Memory management:')); -
issm/trunk/src/m/classes/public/marshall.m
r2959 r3201 122 122 WriteData(fid,md.eps_rel,'Scalar','eps_rel'); 123 123 WriteData(fid,md.eps_abs,'Scalar','eps_abs'); 124 WriteData(fid,md.max_nonlinear_iterations,'Scalar','max_nonlinear_iterations'); 124 125 WriteData(fid,md.dt,'Scalar','dt'); 125 126 WriteData(fid,md.ndt,'Scalar','ndt'); … … 143 144 WriteData(fid,md.thermalconductivity,'Scalar','thermalconductivity'); 144 145 WriteData(fid,md.min_thermal_constraints,'Integer','min_thermal_constraints'); 146 WriteData(fid,md.min_mechanical_constraints,'Integer','min_mechanical_constraints'); 145 147 WriteData(fid,md.mixed_layer_capacity,'Scalar','mixed_layer_capacity'); 146 148 WriteData(fid,md.thermal_exchange_velocity,'Scalar','thermal_exchange_velocity');
Note:
See TracChangeset
for help on using the changeset viewer.