Changeset 10355
- Timestamp:
- 10/28/11 16:46:03 (13 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Vertices.cpp
r9320 r10355 155 155 int Vertices::NumberOfVertices(void){ 156 156 157 int i; 158 157 int i,sid; 159 158 int max_sid=0; 160 int sid;161 159 int vertex_max_sid; 162 160 163 161 for(i=0;i<this->Size();i++){ 164 165 162 Vertex* vertex=(Vertex*)this->GetObjectByOffset(i); 166 163 sid=vertex->Sid(); -
issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r10354 r10355 14 14 void GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters){ 15 15 16 int i, migration_style; 17 Element* element=NULL; 16 int i, migration_style; 17 double* vertices_potentially_ungrounding = NULL; 18 double* sheet_ungrounding = NULL; 19 Element* element = NULL; 18 20 19 21 _printf_(VerboseModule()," Migrating grounding line\n"); … … 21 23 /*retrieve parameters: */ 22 24 parameters->FindParam(&migration_style,GroundinglineMigrationEnum); 25 if(migration_style==NoneEnum) return; 26 if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error_("%s not supported yet!",EnumToStringx(migration_style)); 23 27 24 /*call different migration modules, according to user wishes: */ 25 if(migration_style==AgressiveMigrationEnum){ 26 /*Migrate grounding line : */ 27 for(i=0;i<elements->Size();i++){ 28 element=(Element*)elements->GetObjectByOffset(i); 29 element->AgressiveMigration(); 30 } 31 32 /*Synchronise mask: */ 33 for(i=0;i<elements->Size();i++){ 34 element=(Element*)elements->GetObjectByOffset(i); 35 element->ShelfSync(); 36 } 37 } 38 else if(migration_style==SoftMigrationEnum){ 39 28 if(migration_style==SoftMigrationEnum){ 40 29 /*Create flag for nodes above the hydrostatic equilibrium: */ 41 double*vertices_potentially_ungrounding=PotentialSheetUngrounding(elements,vertices,parameters);30 vertices_potentially_ungrounding=PotentialSheetUngrounding(elements,vertices,parameters); 42 31 43 32 /*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */ 44 double* sheet_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,parameters,vertices_potentially_ungrounding); 33 sheet_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,parameters,vertices_potentially_ungrounding); 34 } 45 35 46 /*Now, use the sheet_ungrounding flags to unground the ice sheet (at the same time, take care of grounding elements of the ice shelf 47 * that want to: */ 48 for(i=0;i<elements->Size();i++){ 49 element=(Element*)elements->GetObjectByOffset(i); 50 element->SoftMigration(sheet_ungrounding); 51 } 36 /*Migrate grounding line : */ 37 for(i=0;i<elements->Size();i++){ 38 element=(Element*)elements->GetObjectByOffset(i); 39 element->Migration(sheet_ungrounding); 40 } 52 41 53 /*Synchronise mask*/54 55 56 57 42 /*Synchronise mask: */ 43 for(i=0;i<elements->Size();i++){ 44 element=(Element*)elements->GetObjectByOffset(i); 45 element->ShelfSync(); 46 } 58 47 59 /*free ressouces: */ 60 xfree((void**)&vertices_potentially_ungrounding); 61 xfree((void**)&sheet_ungrounding); 62 } 63 else if(migration_style==NoneEnum) _printf_(true,"%s\n","NoneEnum supplied for migration style, doing nothing!"); 64 else _error_("%s not supported yet!",EnumToStringx(migration_style)); 48 /*free ressouces: */ 49 xfree((void**)&vertices_potentially_ungrounding); 50 xfree((void**)&sheet_ungrounding); 65 51 } -
issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp
r10354 r10355 16 16 int i,numberofvertices; 17 17 double* vertices_potentially_ungrounding = NULL; 18 Vec vec_vertices_potentially_ungrounding = NULL;18 Vec vec_vertices_potentially_ungrounding = NULL; 19 19 Element* element = NULL; 20 20 -
issm/trunk/src/c/objects/Elements/Element.h
r10298 r10355 65 65 virtual int* GetHorizontalNeighboorSids(void)=0; 66 66 virtual double TimeAdapt()=0; 67 virtual void AgressiveMigration()=0; 68 virtual void SoftMigration(double* sheet_ungrounding)=0; 67 virtual void Migration(double* sheet_ungrounding)=0; 69 68 virtual void ShelfSync()=0; 70 69 virtual void PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r10298 r10355 306 306 } 307 307 /*}}}*/ 308 /*FUNCTION Penta::AgressiveMigration{{{1*/ 309 void Penta::AgressiveMigration(void){ 310 _error_("not supported yet!"); 311 } 312 /*}}}*/ 313 /*FUNCTION Penta::SoftMigration{{{1*/ 314 void Penta::SoftMigration(double* sheet_ungrounding){ 308 /*FUNCTION Penta::Migration{{{1*/ 309 void Penta::Migration(double* sheet_ungrounding){ 315 310 _error_("not supported yet!"); 316 311 } -
issm/trunk/src/c/objects/Elements/Penta.h
r10298 r10355 103 103 104 104 void InputToResult(int enum_type,int step,double time); 105 void AgressiveMigration(); 106 void SoftMigration(double* sheet_ungrounding); 105 void Migration(double* sheet_ungrounding); 107 106 void PotentialSheetUngrounding(Vec potential_sheet_ungrounding); 108 107 void ShelfSync(); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r10321 r10355 278 278 279 279 /*Other*/ 280 /*FUNCTION Tria::AgressiveMigration{{{1*/281 void Tria::AgressiveMigration(void){282 283 int i;284 bool elementonshelf = false;285 double bed_hydro;286 double rho_water,rho_ice,density;287 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];288 289 /*vertices and material parameters: */290 GetInputListOnVertices(&h[0],ThicknessEnum);291 GetInputListOnVertices(&s[0],SurfaceEnum);292 GetInputListOnVertices(&b[0],BedEnum);293 GetInputListOnVertices(&ba[0],BathymetryEnum);294 rho_water=matpar->GetRhoWater();295 rho_ice=matpar->GetRhoIce();296 density=rho_ice/rho_water;297 298 /*go through vertices, and update inputs, considering them to be TriaVertex type: */299 for(i=0;i<NUMVERTICES;i++){300 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */301 if (nodes[i]->IsFloating()){302 if(b[i]<=ba[i]){303 b[i]=ba[i];304 s[i]=b[i]+h[i];305 }306 }307 /*Ice sheet: if hydrostatic bed above bathymetry, the ice sheet start to unground, elso do nothing */308 else{309 bed_hydro=-density*h[i];310 if (bed_hydro>ba[i]){311 s[i]=(1-density)*h[i];312 b[i]=-density*h[i];313 }314 }315 }316 317 /*Update inputs*/318 this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0]));319 this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0]));320 }321 /*}}}*/322 280 /*FUNCTION Tria::AverageOntoPartition {{{1*/ 323 281 void Tria::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){ … … 1964 1922 1965 1923 }/*}}}*/ 1924 /*FUNCTION Tria::Migration{{{1*/ 1925 void Tria::Migration(double* sheet_ungrounding){ 1926 1927 int i,migration_style,unground; 1928 bool elementonshelf = false; 1929 double bed_hydro; 1930 double rho_water,rho_ice,density; 1931 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 1932 1933 /*Recover info at the vertices: */ 1934 parameters->FindParam(&migration_style,GroundinglineMigrationEnum); 1935 GetInputListOnVertices(&h[0],ThicknessEnum); 1936 GetInputListOnVertices(&s[0],SurfaceEnum); 1937 GetInputListOnVertices(&b[0],BedEnum); 1938 GetInputListOnVertices(&ba[0],BathymetryEnum); 1939 rho_water=matpar->GetRhoWater(); 1940 rho_ice=matpar->GetRhoIce(); 1941 density=rho_ice/rho_water; 1942 1943 /*go through vertices, and update inputs, considering them to be TriaVertex type: */ 1944 for(i=0;i<NUMVERTICES;i++){ 1945 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */ 1946 if (nodes[i]->IsFloating()){ 1947 if(b[i]<=ba[i]){ 1948 b[i]=ba[i]; 1949 s[i]=b[i]+h[i]; 1950 } 1951 } 1952 /*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */ 1953 /*Change only if AgressiveMigration or if the ice sheet is in contact with the ocean*/ 1954 else{ 1955 bed_hydro=-density*h[i]; 1956 if (bed_hydro>ba[i]){ 1957 /*Unground only if the element is connected to the ice shelf*/ 1958 if(migration_style==AgressiveMigrationEnum){ 1959 s[i]=(1-density)*h[i]; 1960 b[i]=-density*h[i]; 1961 } 1962 else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){ 1963 s[i]=(1-density)*h[i]; 1964 b[i]=-density*h[i]; 1965 } 1966 } 1967 } 1968 } 1969 1970 /*Update inputs*/ 1971 this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0])); 1972 this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0])); 1973 } 1974 /*}}}*/ 1966 1975 /*FUNCTION Tria::MigrateGroundingline{{{1*/ 1967 1976 void Tria::MigrateGroundingline(void){ … … 2085 2094 void Tria::PotentialSheetUngrounding(Vec potential_sheet_ungrounding){ 2086 2095 2087 2088 double *values = NULL; 2089 double h[3],s[3],b[3],ba[3]; 2096 int i; 2097 double h[NUMVERTICES],ba[NUMVERTICES]; 2090 2098 double bed_hydro; 2091 2099 double rho_water,rho_ice,density; 2092 int i;2093 2100 bool elementonshelf = false; 2094 2095 /*Recover info at the vertices: */2096 Input* surface_input =inputs->GetInput(SurfaceEnum); _assert_(surface_input);2097 Input* bed_input =inputs->GetInput(BedEnum); _assert_(bed_input);2098 if((surface_input->ObjectEnum()!=TriaVertexInputEnum) | (bed_input->ObjectEnum()!=TriaVertexInputEnum))_error_(" not supported yet for bed and surface interpolations not P1!");2099 2100 GetInputListOnVertices(&h[0],ThicknessEnum);2101 GetInputListOnVertices(&s[0],SurfaceEnum);2102 GetInputListOnVertices(&b[0],BedEnum);2103 GetInputListOnVertices(&ba[0],BathymetryEnum);2104 2101 2105 2102 /*material parameters: */ … … 2107 2104 rho_ice=matpar->GetRhoIce(); 2108 2105 density=rho_ice/rho_water; 2106 GetInputListOnVertices(&h[0],ThicknessEnum); 2107 GetInputListOnVertices(&ba[0],BathymetryEnum); 2109 2108 2110 2109 /*go through vertices, and figure out which ones are on the ice sheet, and want to unground: */ 2111 for(i=0;i<3;i++){ 2110 for(i=0;i<NUMVERTICES;i++){ 2111 /*Find if grounded vertices want to start floating*/ 2112 2112 if (!nodes[i]->IsFloating()){ 2113 2114 /*This node is on the sheet, near the grounding line. See if wants to unground. To2115 * do so, we compute the hydrostatic bed, and if it is > bathymetry, then we unground: */2116 2113 bed_hydro=-density*h[i]; 2117 2114 if (bed_hydro>ba[i]){ 2118 /* ok, this node wants to unground. flag it:*/2115 /*Vertex that could potentially unground, flag it*/ 2119 2116 VecSetValue(potential_sheet_ungrounding,nodes[i]->Sid(),1,INSERT_VALUES); 2120 2117 } … … 2225 2222 /*Update inputs*/ 2226 2223 this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf)); 2227 }2228 /*}}}*/2229 /*FUNCTION Tria::SoftMigration{{{1*/2230 void Tria::SoftMigration(double* sheet_ungrounding){2231 2232 int i;2233 bool elementonshelf = false;2234 double bed_hydro;2235 double rho_water,rho_ice,density;2236 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];2237 2238 /*Recover info at the vertices: */2239 GetInputListOnVertices(&h[0],ThicknessEnum);2240 GetInputListOnVertices(&s[0],SurfaceEnum);2241 GetInputListOnVertices(&b[0],BedEnum);2242 GetInputListOnVertices(&ba[0],BathymetryEnum);2243 rho_water=matpar->GetRhoWater();2244 rho_ice=matpar->GetRhoIce();2245 density=rho_ice/rho_water;2246 2247 /*go through vertices, and update inputs, considering them to be TriaVertex type: */2248 for(i=0;i<NUMVERTICES;i++){2249 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */2250 if (nodes[i]->IsFloating()){2251 if(b[i]<=ba[i]){2252 b[i]=ba[i];2253 s[i]=b[i]+h[i];2254 }2255 }2256 /*Ice sheet: if hydrostatic bed above bathymetry, the ice sheet starts to unground if it is connected to the ice shelf, elso do nothing */2257 else{2258 bed_hydro=-density*h[i];2259 if (bed_hydro>ba[i]){2260 /*Unground only if the element is connected to the ice shelf*/2261 if(sheet_ungrounding[nodes[i]->Sid()]){2262 s[i]=(1-density)*h[i];2263 b[i]=-density*h[i];2264 }2265 }2266 }2267 }2268 2269 /*Update inputs*/2270 this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0]));2271 this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0]));2272 2224 } 2273 2225 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r10298 r10355 104 104 void MaterialUpdateFromTemperature(void){_error_("not implemented yet");}; 105 105 106 void AgressiveMigration(); 107 void SoftMigration(double* sheet_ungrounding); 106 void Migration(double* sheet_ungrounding); 108 107 void ShelfSync(); 109 108 void PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
Note:
See TracChangeset
for help on using the changeset viewer.