Changeset 1784
- Timestamp:
- 08/20/09 09:30:06 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/DataSet/DataSet.cpp
r1628 r1784 1146 1146 1147 1147 #undef __FUNCT__ 1148 #define __FUNCT__ "RiftConstraints"1149 void DataSet::RiftConstraints(int* pnum_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type){1150 1151 throw ErrorException(__FUNCT__," not implemented yet!");1152 1153 }1154 1155 #undef __FUNCT__1156 1148 #define __FUNCT__ "MeltingIsPresent" 1157 1149 int DataSet::MeltingIsPresent(){ … … 1181 1173 #undef __FUNCT__ 1182 1174 #define __FUNCT__ "MeltingConstraints" 1183 void DataSet::MeltingConstraints(int* p num_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type){1175 void DataSet::MeltingConstraints(int* pconverged, int* pnum_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type){ 1184 1176 1185 1177 /* generic object pointer: */ … … 1189 1181 int unstable=0; 1190 1182 int num_unstable_constraints=0; 1183 int converged=0; 1191 1184 int sum_num_unstable_constraints=0; 1192 1185 … … 1212 1205 #endif 1213 1206 1207 /*Have we converged? : */ 1208 if (num_unstable_constraints==0) converged=1; 1209 else converged=0; 1210 1214 1211 /*Assign output pointers: */ 1212 *pconverged=converged; 1215 1213 *pnum_unstable_constraints=num_unstable_constraints; 1216 1214 } -
issm/trunk/src/c/DataSet/DataSet.h
r1628 r1784 70 70 void PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type); 71 71 int RiftIsPresent(); 72 void RiftConstraints(int* pnum_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type);73 72 int MeltingIsPresent(); 74 void MeltingConstraints(int* p num_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type);73 void MeltingConstraints(int* pconverged, int* pnum_unstable_constraints,void* inputs,int analysis_type,int sub_analysis_type); 75 74 DataSet* Copy(void); 76 75 void Du(Vec du_g,void* inputs,int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.cpp
r1728 r1784 92 92 /*GEOGRAPHY:*/ 93 93 int GeographyEnum(void){ return 500; } 94 int WaterEnum(void){ return 501; }95 94 int IceSheetEnum(void){ return 502; } 96 95 int IceShelfEnum(void){ return 502; } 97 96 98 97 /*FILL:*/ 99 int FillEnum(void){ return 600; }100 int WaterFillEnum(void){ return 601; }101 int IceFillEnum(void){ return 602; }102 int AirFillEnum(void){ return 603; }98 int WaterEnum(void){ return 601; } 99 int IceEnum(void){ return 602; } 100 int AirEnum(void){ return 603; } 101 int MelangeEnum(void){ return 604; } 103 102 104 103 /*functions on enums: */ -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r1741 r1784 93 93 /*GEOGRAPHY:*/ 94 94 int GeographyEnum(void); 95 int WaterEnum(void);96 95 int IceSheetEnum(void); 97 96 int IceShelfEnum(void); 98 97 99 98 /*FILL: */ 100 int FillEnum(void);101 int WaterFillEnum(void);102 int IceFillEnum(void);103 int AirFillEnum(void);99 int WaterEnum(void); 100 int IceEnum(void); 101 int AirEnum(void); 102 int MelangeEnum(void); 104 103 105 104 /*Functions on enums: */ -
issm/trunk/src/c/Makefile.am
r1671 r1784 604 604 bin_PROGRAMS = 605 605 else 606 bin_PROGRAMS = diagnostic.exe control.exe thermal.exe prognostic.exe transient.exe606 dnl bin_PROGRAMS = diagnostic.exe control.exe thermal.exe prognostic.exe transient.exe 607 607 endif 608 608 -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp
r1734 r1784 183 183 184 184 for(i=0;i<model->numrifts;i++){ 185 el1=(int)*(model->riftinfo+ 9*i+2)-1; //matlab indexing to c indexing186 el2=(int)*(model->riftinfo+ 9*i+3)-1; //matlab indexing to c indexing185 el1=(int)*(model->riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing 186 el2=(int)*(model->riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing 187 187 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding grids; 188 188 } -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r1762 r1784 54 54 int riftfront_fill; 55 55 double riftfront_friction; 56 double riftfront_fraction; 56 57 bool riftfront_shelf; 57 58 double riftfront_penalty_offset; … … 66 67 int fill; 67 68 double friction; 69 double fraction; 68 70 69 71 /*Create loads: */ … … 158 160 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat"); 159 161 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat"); 160 162 161 163 if(model->numrifts){ 162 164 for(i=0;i<model->numrifts;i++){ 163 165 164 el1=(int)*(model->riftinfo+ 9*i+2);166 el1=(int)*(model->riftinfo+RIFTINFOSIZE*i+2); 165 167 #ifdef _PARALLEL_ 166 168 if (model->epart[el1-1]!=my_rank){ … … 172 174 173 175 /*Ok, retrieve all the data needed to add a penalty between the two grids: */ 174 el2=(int)*(model->riftinfo+9*i+3); 175 176 grid1=(int)*(model->riftinfo+9*i+0); 177 grid2=(int)*(model->riftinfo+9*i+1); 178 179 normal[0]=*(model->riftinfo+9*i+4); 180 normal[1]=*(model->riftinfo+9*i+5); 181 length=*(model->riftinfo+9*i+6); 182 183 fill = (int)*(model->riftinfo+9*i+7); 184 friction=*(model->riftinfo+9*i+8); 176 el2=(int)*(model->riftinfo+RIFTINFOSIZE*i+3); 177 178 grid1=(int)*(model->riftinfo+RIFTINFOSIZE*i+0); 179 grid2=(int)*(model->riftinfo+RIFTINFOSIZE*i+1); 180 181 normal[0]=*(model->riftinfo+RIFTINFOSIZE*i+4); 182 normal[1]=*(model->riftinfo+RIFTINFOSIZE*i+5); 183 length=*(model->riftinfo+RIFTINFOSIZE*i+6); 184 185 fill = (int)*(model->riftinfo+RIFTINFOSIZE*i+7); 186 friction=*(model->riftinfo+RIFTINFOSIZE*i+8); 187 fraction=*(model->riftinfo+RIFTINFOSIZE*i+9); 185 188 186 189 strcpy(riftfront_type,"2d"); … … 205 208 riftfront_fill=fill; 206 209 riftfront_friction=friction; 210 riftfront_fraction=fraction; 207 211 riftfront_shelf=(bool)model->gridoniceshelf[grid1-1]; 208 212 … … 214 218 riftfront_prestable=0; 215 219 216 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_ penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_counter,riftfront_prestable,riftfront_shelf);220 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_penalty_offset, riftfront_penalty_lock, riftfront_active,riftfront_counter,riftfront_prestable,riftfront_shelf); 217 221 218 222 loads->AddObject(riftfront); 219 223 } 220 224 } 225 221 226 222 227 /*free ressources: */ … … 227 232 xfree((void**)&model->gridoniceshelf); 228 233 234 229 235 cleanup_and_return: 230 236 -
issm/trunk/src/c/ModelProcessorx/Model.h
r1762 r1784 10 10 #include "../DataSet/DataSet.h" 11 11 #include "../toolkits/toolkits.h" 12 13 #define RIFTINFOSIZE 10 12 14 13 15 struct Model { -
issm/trunk/src/c/PenaltyConstraintsx/PenaltyConstraintsx.cpp
r1628 r1784 32 32 * management routine, otherwise, skip : */ 33 33 if (RiftIsPresent(loads)){ 34 RiftConstraints(& num_unstable_constraints,loads,inputs,analysis_type,sub_analysis_type);34 RiftConstraints(&converged,&num_unstable_constraints,loads,inputs,analysis_type,sub_analysis_type); 35 35 } 36 36 else if(loads->MeltingIsPresent()){ 37 loads->MeltingConstraints(& num_unstable_constraints,inputs,analysis_type,sub_analysis_type);37 loads->MeltingConstraints(&converged,&num_unstable_constraints,inputs,analysis_type,sub_analysis_type); 38 38 } 39 39 else{ … … 42 42 } 43 43 44 /*Have we converged? : */ 45 if (num_unstable_constraints==0) converged=1; 46 else converged=0; 47 44 48 45 /*Assign output pointers: */ 49 46 *pconverged=converged; 50 47 *pnum_unstable_constraints=num_unstable_constraints; 51 52 48 } -
issm/trunk/src/c/PenaltyConstraintsx/RiftConstraints.cpp
r1628 r1784 6 6 #include "../EnumDefinitions/EnumDefinitions.h" 7 7 8 #define _ZIGZAGCOUNTER_ 9 8 10 #undef __FUNCT__ 9 11 #define __FUNCT__ "RiftConstrain" 10 int RiftConstraints(int* p num_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 analysis_type,int sub_analysis_type){ 11 13 12 14 int num_unstable_constraints=0; 15 int converged=0; 13 16 int potential; 14 17 15 /*First, is set of constraints pre-stabilised? Ie: all unstable rifts are penalised? :*/ 16 if(!IsPreStable(loads)){ 17 18 PreConstrain(&num_unstable_constraints,loads,inputs,analysis_type); 19 20 if(!num_unstable_constraints){ 21 /*Ok, preconstraining is done. Figure out size of unstable constraints pool. Then set 22 * prestable flag to 1 for all rift grids: */ 23 24 potential=PotentialUnstableConstraints(loads,inputs,analysis_type); 25 printf(" set of constraints is prestabilised; unstable constraints potentialnumber: %i\n",potential); 26 27 SetPreStable(loads); 28 num_unstable_constraints=-1; //ensure convergence does not happen! 29 } 30 18 /*First, has the material non-linearity stabilized? : */ 19 if(!IsMaterialStable(loads,inputs,analysis_type)){ 20 /*Do nothing, no constraints activated!: */ 21 printf("converging material\n"); 22 num_unstable_constraints=0; 23 converged=0; 31 24 } 32 25 else{ 33 /*Ok, set of constraints is stable. Start increasing number of inactive constraints, one by one: */ 34 35 /*Figure out max penetration: */ 36 MaxPenetrationInInputs(loads,inputs,analysis_type); 26 /*Ok, start constraining: */ 27 printf("converged material: constraining\n"); 28 29 #ifdef _ZIGZAGCOUNTER_ 30 if(!IsPreStable(loads)){ 31 32 PreConstrain(&num_unstable_constraints,loads,inputs,analysis_type); 33 34 if(!num_unstable_constraints){ 35 /*Ok, preconstraining is done. Figure out size of unstable constraints pool. Then set 36 * prestable flag to 1 for all rift grids: */ 37 38 potential=PotentialUnstableConstraints(loads,inputs,analysis_type); 39 printf(" set of constraints is prestabilised; unstable constraints potentialnumber: %i\n",potential); 40 41 SetPreStable(loads); 42 num_unstable_constraints=-1; //ensure convergence does not happen! 43 } 44 45 } 46 else{ 47 /*Ok, set of constraints is stable. Start increasing number of inactive constraints, one by one: */ 37 48 38 /*Constrain rifts: */ 39 Constrain(&num_unstable_constraints,loads,inputs,analysis_type); 49 /*Figure out max penetration: */ 50 MaxPenetrationInInputs(loads,inputs,analysis_type); 51 52 /*Constrain rifts: */ 53 Constrain(&num_unstable_constraints,loads,inputs,analysis_type); 54 } 55 #else 56 Constrain(&num_unstable_constraints,loads,inputs,analysis_type); 57 #endif 58 59 if(num_unstable_constraints==0)converged=1; 40 60 } 41 61 42 62 /*Assign output pointers: */ 63 *pconverged=converged; 43 64 *pnum_unstable_constraints=num_unstable_constraints; 44 65 } 66 67 #undef __FUNCT__ 68 #define __FUNCT__ "IsMaterialStable" 69 int IsMaterialStable(DataSet* loads,ParameterInputs* inputs,int analysis_type){ 70 71 int i; 72 73 Riftfront* riftfront=NULL; 74 int found=0; 75 int mpi_found=0; 76 77 /*go though loads, and if non-linearity of the material has converged, let all penalties know: */ 78 for (i=0;i<loads->Size();i++){ 79 80 if(RiftfrontEnum()==loads->GetEnum(i)){ 81 82 riftfront=(Riftfront*)loads->GetObjectByOffset(i); 83 84 if (riftfront->IsMaterialStable(inputs,analysis_type)){ 85 found=1; 86 /*do not break! all penalties should get informed the non-linearity converged!*/ 87 } 88 } 89 } 90 91 #ifdef _PARALLEL_ 92 MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD ); 93 MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD); 94 found=mpi_found; 95 #endif 96 97 return found; 45 98 } 46 99 … … 239 292 riftfront=(Riftfront*)loads->GetObjectByOffset(i); 240 293 241 riftfront-> Penetration(&penetration,inputs,analysis_type);294 riftfront->MaxPenetration(&penetration,inputs,analysis_type); 242 295 243 296 if (penetration>max_penetration)max_penetration=penetration; -
issm/trunk/src/c/PenaltyConstraintsx/RiftConstraints.h
r1628 r1784 10 10 #include "../DataSet/DataSet.h" 11 11 12 int RiftConstraints(int* p num_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 analysis_type,int sub_analysis_type); 13 13 14 14 int RiftIsPresent(DataSet* loads); … … 25 25 26 26 int PotentialUnstableConstraints(DataSet* loads,ParameterInputs* inputs,int analysis_type_enum); 27 28 int IsMaterialStable(DataSet* loads,ParameterInputs* inputs,int analysis_type_enum); 27 29 #endif -
issm/trunk/src/c/objects/Icefront.cpp
r1728 r1784 366 366 /*Recover material and fill parameters: */ 367 367 matpar=(Matpar*)element->GetMatPar(); 368 if (element->GetShelf())fill=Water FillEnum();369 else fill=Air FillEnum();368 if (element->GetShelf())fill=WaterEnum(); 369 else fill=AirEnum(); 370 370 371 371 //check that the element is onbed (collapsed formulation) otherwise:pe=0 … … 494 494 /*Recover material and fill parameters: */ 495 495 matpar=(Matpar*)element->GetMatPar(); 496 if (element->GetShelf())fill=Water FillEnum();497 else fill=Air FillEnum();496 if (element->GetShelf())fill=WaterEnum(); 497 else fill=AirEnum(); 498 498 499 499 /* Set pe_g to 0: */ … … 657 657 /*Recover material and fill parameters: */ 658 658 matpar=(Matpar*)element->GetMatPar(); 659 if (element->GetShelf())fill=Water FillEnum();660 else fill=Air FillEnum();659 if (element->GetShelf())fill=WaterEnum(); 660 else fill=AirEnum(); 661 661 662 662 /* Set pe_g to 0: */ … … 868 868 bed=b1*(1+segment_gauss_coord[ig])/2+b2*(1-segment_gauss_coord[ig])/2; 869 869 870 if (fill==Water FillEnum()){870 if (fill==WaterEnum()){ 871 871 //icefront ends in water: 872 872 ice_pressure=1.0/2.0*gravity*rho_ice*pow(thickness,2); … … 878 878 water_pressure=1.0/2.0*gravity*rho_water*(pow(surface_under_water,2) - pow(base_under_water,2)); 879 879 } 880 else if (fill==Air FillEnum()){880 else if (fill==AirEnum()){ 881 881 ice_pressure=1.0/2.0*gravity*rho_ice*pow(thickness,2); 882 882 air_pressure=0; … … 1132 1132 1133 1133 //Now deal with water pressure: 1134 if(fill==Water FillEnum()){ //icefront ends in water1134 if(fill==WaterEnum()){ //icefront ends in water 1135 1135 water_level_above_g_tria=min(0,z_g[i]);//0 if the gaussian point is above water level 1136 1136 water_pressure_tria=rho_water*gravity*water_level_above_g_tria; 1137 1137 } 1138 else if(fill==Air FillEnum()){1138 else if(fill==AirEnum()){ 1139 1139 water_pressure_tria=0; 1140 1140 } … … 1381 1381 1382 1382 //Now deal with water pressure: 1383 if(fill==Water FillEnum()){ //icefront ends in water1383 if(fill==WaterEnum()){ //icefront ends in water 1384 1384 water_level_above_g_tria=min(0,z_g[i]);//0 if the gaussian point is above water level 1385 1385 water_pressure_tria=rho_water*gravity*water_level_above_g_tria; 1386 1386 } 1387 else if(fill==Air FillEnum()){1387 else if(fill==AirEnum()){ 1388 1388 water_pressure_tria=0; 1389 1389 } -
issm/trunk/src/c/objects/Riftfront.cpp
r1735 r1784 20 20 21 21 Riftfront::Riftfront(){ 22 /*in case :*/ 23 material_converged=0; 22 24 return; 23 25 } 24 26 25 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_ penalty_offset, int riftfront_penalty_lock, bool riftfront_active,int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){27 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_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){ 26 28 27 29 int i; … … 51 53 fill=riftfront_fill; 52 54 friction=riftfront_friction; 55 fraction=riftfront_fraction; 53 56 penalty_offset=riftfront_penalty_offset; 54 57 penalty_lock=riftfront_penalty_lock; … … 58 61 shelf=riftfront_shelf; 59 62 63 /*not in the constructor, but still needed: */ 64 material_converged=0; 65 60 66 return; 61 67 } … … 79 85 80 86 printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]); 81 printf("fill: %i friction %g \n",fill,friction);87 printf("fill: %i friction %g fraction %g\n",fill,friction,fraction); 82 88 printf("penalty_offset %g\n",penalty_offset); 83 89 printf("penalty_lock %i\n",penalty_lock); … … 85 91 printf("counter %i\n",counter); 86 92 printf("prestable %i\n",prestable); 93 printf("material_converged %i\n",material_converged); 87 94 printf("shelf %i\n",shelf); 88 95 } … … 107 114 108 115 printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]); 109 printf("fill: %i friction %g \n",fill,friction);116 printf("fill: %i friction %g fraction %g\n",fill,friction,fraction); 110 117 printf("penalty_offset %g\n",penalty_offset); 111 118 printf("penalty_lock %i\n",penalty_lock); … … 113 120 printf("counter %i\n",counter); 114 121 printf("prestable %i\n",prestable); 122 printf("material_converged %i\n",material_converged); 115 123 printf("shelf %i\n",shelf); 116 124 … … 147 155 memcpy(marshalled_dataset,&fill,sizeof(fill));marshalled_dataset+=sizeof(fill); 148 156 memcpy(marshalled_dataset,&friction,sizeof(friction));marshalled_dataset+=sizeof(friction); 157 memcpy(marshalled_dataset,&fraction,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 149 158 memcpy(marshalled_dataset,&penalty_offset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset); 150 159 memcpy(marshalled_dataset,&penalty_lock,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); … … 152 161 memcpy(marshalled_dataset,&counter,sizeof(counter));marshalled_dataset+=sizeof(counter); 153 162 memcpy(marshalled_dataset,&prestable,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 163 memcpy(marshalled_dataset,&material_converged,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 154 164 memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 155 165 … … 173 183 sizeof(fill)+ 174 184 sizeof(friction)+ 185 sizeof(fraction)+ 175 186 sizeof(penalty_offset)+ 176 187 sizeof(penalty_lock)+ … … 178 189 sizeof(counter)+ 179 190 sizeof(prestable)+ 191 sizeof(material_converged)+ 180 192 sizeof(shelf)+ 181 193 sizeof(int); //sizeof(int) for enum type … … 212 224 memcpy(&fill,marshalled_dataset,sizeof(fill));marshalled_dataset+=sizeof(fill); 213 225 memcpy(&friction,marshalled_dataset,sizeof(friction));marshalled_dataset+=sizeof(friction); 226 memcpy(&fraction,marshalled_dataset,sizeof(fraction));marshalled_dataset+=sizeof(fraction); 214 227 memcpy(&penalty_offset,marshalled_dataset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset); 215 228 memcpy(&penalty_lock,marshalled_dataset,sizeof(penalty_lock));marshalled_dataset+=sizeof(penalty_lock); … … 217 230 memcpy(&counter,marshalled_dataset,sizeof(counter));marshalled_dataset+=sizeof(counter); 218 231 memcpy(&prestable,marshalled_dataset,sizeof(prestable));marshalled_dataset+=sizeof(prestable); 232 memcpy(&material_converged,marshalled_dataset,sizeof(material_converged));marshalled_dataset+=sizeof(material_converged); 219 233 memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 220 234 … … 410 424 double bed; 411 425 double pressure; 426 double pressure_litho; 427 double pressure_air; 428 double pressure_melange; 429 double pressure_water; 412 430 413 431 /*Some pointer intialization: */ … … 445 463 446 464 /*Ok, now compute the pressure (in norm) that is being applied to the flanks, depending on the type of fill: */ 447 if(fill==Water FillEnum()){465 if(fill==WaterEnum()){ 448 466 if(shelf){ 449 467 /*We are on an ice shelf, hydrostatic equilibrium is used to determine the pressure for water fill: */ … … 455 473 } 456 474 } 457 else if(fill==Air FillEnum()){475 else if(fill==AirEnum()){ 458 476 pressure=rho_ice*gravity*pow(thickness,(double)2)/(double)2; //icefront on an ice sheet, pressure imbalance ice vs air. 459 477 } 460 else if(fill==Ice FillEnum()){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice)478 else if(fill==IceEnum()){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) 461 479 pressure=0; 480 } 481 else if(fill==IceEnum()){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) 482 pressure=0; 483 } 484 else if(fill==MelangeEnum()){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) 485 486 if(!shelf) throw ErrorException(__FUNCT__,exprintf("%s%s%i%s",__FUNCT__," error message: fill type ",fill," not supported on ice sheets yet.")); 487 488 pressure_litho=rho_ice*gravity*pow(thickness,(double)2)/(double)2; 489 pressure_air=0; 490 pressure_melange=rho_ice*gravity*pow(fraction*thickness,(double)2)/(double)2; 491 pressure_water=1.0/2.0*rho_water*gravity* ( pow(bed,2.0)-pow(rho_ice/rho_water*fraction*thickness,2.0) ); 492 493 pressure=pressure_litho-pressure_air-pressure_melange-pressure_water; 462 494 } 463 495 else{ … … 559 591 *punstable=unstable; 560 592 } 593 594 595 #define _ZIGZAGCOUNTER_ 561 596 562 597 #undef __FUNCT__ … … 582 617 if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!"); 583 618 619 620 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 621 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 622 623 #ifdef _ZIGZAGCOUNTER_ 624 584 625 found=inputs->Recover("max_penetration",&max_penetration); 585 626 if(!found)throw ErrorException(__FUNCT__," could not find max_penetration in inputs!"); 586 587 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */588 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];589 627 590 628 /*Activate or deactivate penalties: */ … … 624 662 } 625 663 } 664 #else 665 if(penetration<0)activate=1; 666 else activate=0; 667 #endif 626 668 627 669 //Figure out stability of this penalty … … 636 678 //Set penalty flag 637 679 this->active=activate; 680 681 //if ((penetration>0) & (this->active==1))printf("Riftfront %i wants to be released\n",GetId()); 638 682 639 683 /*assign output pointer: */ … … 665 709 /*Now, we return penetration only if we are active!: */ 666 710 if(this->active==0)penetration=0; 711 712 /*assign output pointer: */ 713 *ppenetration=penetration; 714 715 } 716 717 #undef __FUNCT__ 718 #define __FUNCT__ "Riftfront::MaxPenetration" 719 int Riftfront::MaxPenetration(double* ppenetration, void* vinputs, int analysis_type){ 720 721 const int numgrids=2; 722 int dofs[2]={0,1}; 723 double vxvy_list[2][2]; //velocities for all grids 724 double max_penetration; 725 double penetration=0; 726 int found; 727 728 ParameterInputs* inputs=NULL; 729 730 inputs=(ParameterInputs*)vinputs; 731 732 //initialize: 733 penetration=-1; 734 735 found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 736 if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!"); 737 738 /*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */ 739 penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1]; 740 741 /*Now, we return penetration only if we are active!: */ 742 if(this->active==0)penetration=-1; 743 744 /*If we are zigzag locked, same thing: */ 745 if(this->counter>this->penalty_lock)penetration=-1; 667 746 668 747 /*assign output pointer: */ … … 711 790 *punstable=unstable; 712 791 } 792 793 794 #undef __FUNCT__ 795 #define __FUNCT__ "Riftfront::IsMaterialStable" 796 int Riftfront::IsMaterialStable(void* vinputs, int analysis_type){ 797 798 int found=0; 799 ParameterInputs* inputs=NULL; 800 double converged=0; 801 802 inputs=(ParameterInputs*)vinputs; 803 804 found=inputs->Recover("converged",&converged); 805 if(!found)throw ErrorException(__FUNCT__," could not find converged flag in inputs!"); 806 807 if(converged){ 808 /*ok, material non-linearity has converged. If that was already the case, we keep 809 * constraining the rift front. If it was not, and this is the first time the material 810 * has converged, we start constraining now!: */ 811 this->material_converged=1; 812 } 813 814 return this->material_converged; 815 } -
issm/trunk/src/c/objects/Riftfront.h
r1717 r1784 41 41 int fill; 42 42 double friction; 43 double fraction; 43 44 bool shelf; 44 45 … … 50 51 int counter; 51 52 bool prestable; 53 bool material_converged; 52 54 53 55 … … 55 57 56 58 Riftfront(); 57 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 penalty_offset, int penalty_lock,bool active,int counter,bool prestable,bool shelf);59 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 penalty_offset, int penalty_lock,bool active,int counter,bool prestable,bool shelf); 58 60 ~Riftfront(); 59 61 … … 79 81 int Constrain(int* punstable, void* inputs, int analysis_type); 80 82 int Penetration(double* ppenetration, void* inputs, int analysis_type); 83 int MaxPenetration(double* ppenetration, void* inputs, int analysis_type); 81 84 int PotentialUnstableConstraint(int* punstable, void* inputs, int analysis_type); 85 int IsMaterialStable(void* inputs, int analysis_type); 82 86 Object* copy(); 83 87 }; -
issm/trunk/src/c/parallel/CreateFemModel.cpp
r1648 r1784 73 73 DeleteModel(&model); 74 74 75 76 75 /*Assign output pointers:*/ 77 76 femmodel->elements=elements; -
issm/trunk/src/c/parallel/diagnostic_core_nonlinear.cpp
r1669 r1784 112 112 PenaltyConstraintsx(&constraints_converged, &num_unstable_constraints, fem->elements,fem->nodes,loads,fem->materials,inputs,analysis_type,sub_analysis_type); 113 113 114 //if(debug)_printf_(" number of unstable constraints: %i\n",num_unstable_constraints); 115 _printf_(" number of unstable constraints: %i\n",num_unstable_constraints); 116 114 117 /*Figure out if convergence is reached.*/ 115 118 convergence(&converged,Kff,pf,uf,old_uf,fem->parameters); 116 119 MatFree(&Kff);VecFree(&pf); 120 121 /*add converged to inputs: */ 122 inputs->Add("converged",converged); 117 123 118 124 //rift convergence -
issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m
r1 r1784 63 63 %plot relative velocities 64 64 h=quiver(md.x(penaltypairs(:,1)),md.y(penaltypairs(:,1)),md.vx(penaltypairs(:,2))-md.vx(penaltypairs(:,1)),md.vy(penaltypairs(:,2))-md.vy(penaltypairs(:,1))); 65 set(h,'Color',[ 1 00]);65 set(h,'Color',[0 1 0]); 66 66 end 67 67 if isp1 & isp2 -
issm/trunk/src/m/classes/public/presolve.m
r1717 r1784 17 17 end 18 18 19 md.riftinfo=zeros(numpairs, 9); % 2 for grids + 2 for elements+ 2 for normals + 1 for length + 1 for fill + 1 for friction.19 md.riftinfo=zeros(numpairs,10); % 2 for grids + 2 for elements+ 2 for normals + 1 for length + 1 for fill + 1 for friction + 1 for fraction. 20 20 21 21 count=1; … … 25 25 md.riftinfo(count:count+numpairsforthisrift-1,8)=md.rifts(i).fill; 26 26 md.riftinfo(count:count+numpairsforthisrift-1,9)=md.rifts(i).friction; 27 md.riftinfo(count:count+numpairsforthisrift-1,10)=md.rifts(i).fraction; 27 28 count=count+numpairsforthisrift; 28 29 end -
issm/trunk/src/m/solutions/cielo/diagnostic_core_nonlinear.m
r1667 r1784 12 12 soln(count).u_g=get(inputs,'velocity',[1 1 (m.parameters.numberofdofspernode>=3) (m.parameters.numberofdofspernode>=3)]); %only keep vz if running with more than 3 dofs per node 13 13 soln(count).u_f= Reducevectorgtof(soln(count).u_g,m.nodesets); 14 15 %add converged=0 flag first in inputs. 16 inputs=add(inputs,'converged',converged,'double'); 14 17 15 18 displaystring(m.parameters.debug,'\n%s',[' starting direct shooting method']); … … 53 56 %penalty constraints 54 57 [loads,constraints_converged,num_unstable_constraints] =PenaltyConstraints( m.elements,m.nodes, loads, m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 58 59 %displaystring(m.parameters.debug,'%s%i',' number of unstable constraints: ',num_unstable_constraints); 60 displaystring(1,'%s%i',' number of unstable constraints: ',num_unstable_constraints); 55 61 56 62 %Figure out if convergence have been reached 57 63 converged=convergence(K_ff,p_f,soln(count).u_f,soln(count-1).u_f,m.parameters); 64 65 %add convergence status into inputs 66 inputs=add(inputs,'converged',converged,'double'); 58 67 59 68 %rift convergence criterion … … 61 70 converged=0; 62 71 end 72 63 73 end 64 74 -
issm/trunk/src/mex/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r1743 r1784 27 27 /*empty rifts structure: */ 28 28 double* pNaN=NULL; 29 const char* fnames[ 7];29 const char* fnames[8]; 30 30 mwSize ndim=2; 31 31 mwSize dimensions[2] = {1,1}; … … 239 239 fnames[5] = "fill"; 240 240 fnames[6] = "friction"; 241 fnames[7] = "fraction"; 241 242 242 243 dimensions[0]=out_numrifts; 243 244 244 pmxa_array=mxCreateStructArray( ndim,dimensions, 7,fnames);245 pmxa_array=mxCreateStructArray( ndim,dimensions,8,fnames); 245 246 246 247 for (i=0;i<out_numrifts;i++){ … … 283 284 mxSetField(pmxa_array,i,"penaltypairs",pmxa_array3); 284 285 285 /*Friction and fill: set to 0 both */286 /*Friction fraction and fill: set to 0 both */ 286 287 mxSetField(pmxa_array,i,"friction",mxCreateDoubleScalar(0)); 287 mxSetField(pmxa_array,i,"fill",mxCreateDoubleScalar(WaterFillEnum())); //default is water 288 289 290 288 mxSetField(pmxa_array,i,"fill",mxCreateDoubleScalar(IceEnum())); //default is ice 289 mxSetField(pmxa_array,i,"fraction",mxCreateDoubleScalar(0)); //default is ice 291 290 } 292 291 }
Note:
See TracChangeset
for help on using the changeset viewer.