Changeset 10377 for issm/trunk
- Timestamp:
- 10/31/11 14:39:39 (13 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r10376 r10377 13 13 void GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters){ 14 14 15 int i, migration_style ;15 int i, migration_style,analysis_type; 16 16 double* vertices_potentially_ungrounding = NULL; 17 17 double* vertices_ungrounding = NULL; 18 double* old_floatingice = NULL; 18 19 Element* element = NULL; 19 20 … … 22 23 /*retrieve parameters: */ 23 24 parameters->FindParam(&migration_style,GroundinglineMigrationEnum); 25 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 26 24 27 if(migration_style==NoneEnum) return; 25 28 if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error_("%s not supported yet!",EnumToStringx(migration_style)); … … 33 36 } 34 37 38 /*Create vector with vertices initially floating*/ 39 old_floatingice=CreateNodesOnIceShelf(nodes,analysis_type); 40 35 41 /*Migrate grounding line : */ 36 42 for(i=0;i<elements->Size();i++){ 37 43 element=(Element*)elements->GetObjectByOffset(i); 38 element->MigrateGroundingLine(vertices_ungrounding); 39 } 40 41 /*Synchronise mask: */ 42 for(i=0;i<elements->Size();i++){ 43 element=(Element*)elements->GetObjectByOffset(i); 44 element->ShelfSync(); 44 element->MigrateGroundingLine(old_floatingice,vertices_ungrounding); 45 45 } 46 46 … … 48 48 xfree((void**)&vertices_potentially_ungrounding); 49 49 xfree((void**)&vertices_ungrounding); 50 xfree((void**)&old_floatingice); 50 51 } 51 52 /*FUNCTION PotentialSheetUngrounding {{{1*/ … … 67 68 } 68 69 69 /*Assemble vector :*/70 /*Assemble vector and serialize */ 70 71 VecAssemblyBegin(vec_vertices_potentially_ungrounding); 71 72 VecAssemblyEnd(vec_vertices_potentially_ungrounding); 72 73 /*Serialize vector: */74 73 VecToMPISerial(&vertices_potentially_ungrounding,vec_vertices_potentially_ungrounding); 75 74 … … 162 161 } 163 162 /*}}}*/ 163 /*FUNCTION CreateNodesOnIceShelf {{{1*/ 164 double* CreateNodesOnIceShelf(Nodes* nodes,int configuration_type){ 165 166 int i,numnods; 167 double* nodes_on_floatingice = NULL; 168 Vec vec_nodes_on_iceshelf = NULL; 169 Node* node = NULL; 170 171 /*First, initialize nodes_on_iceshelf, which will track which nodes have changed status: */ 172 numnods=nodes->NumberOfNodes(configuration_type); 173 vec_nodes_on_iceshelf=NewVec(numnods); 174 175 /*Loop through nodes, and fill vec_nodes_on_iceshelf: */ 176 for(i=0;i<nodes->Size();i++){ 177 node=(Node*)nodes->GetObjectByOffset(i); 178 if(node->InAnalysis(configuration_type)){ 179 if(node->IsFloating()){ 180 VecSetValue(vec_nodes_on_iceshelf,node->Sid(),1.0,INSERT_VALUES); 181 } 182 } 183 } 184 185 /*Assemble vector: */ 186 VecAssemblyBegin(vec_nodes_on_iceshelf); 187 VecAssemblyEnd(vec_nodes_on_iceshelf); 188 VecToMPISerial(&nodes_on_floatingice,vec_nodes_on_iceshelf); 189 190 /*Free ressources*/ 191 VecFree(&vec_nodes_on_iceshelf); 192 193 return nodes_on_floatingice; 194 } 195 /*%}}}*/ -
issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h
r10376 r10377 15 15 double* PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters); 16 16 double* PropagateFloatingiceToGrounded(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding); 17 double* CreateNodesOnIceShelf(Nodes* nodes,int configuration_type); 17 18 #endif /* _GROUNDINGLINEMIGRATIONX_H */ -
issm/trunk/src/c/objects/Elements/Element.h
r10376 r10377 65 65 virtual int* GetHorizontalNeighboorSids(void)=0; 66 66 virtual double TimeAdapt()=0; 67 virtual void MigrateGroundingLine(double* sheet_ungrounding)=0; 68 virtual void ShelfSync()=0; 67 virtual void MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding)=0; 69 68 virtual void PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0; 70 69 virtual int UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r10376 r10377 304 304 void Penta::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){ 305 305 _error_("Not supported yet!"); 306 }307 /*}}}*/308 /*FUNCTION Penta::ShelfSync{{{1*/309 void Penta::ShelfSync(void){310 _error_("not supported yet!");311 306 } 312 307 /*}}}*/ … … 2042 2037 }/*}}}*/ 2043 2038 /*FUNCTION Penta::MigrateGroundingLine{{{1*/ 2044 void Penta::MigrateGroundingLine(double* sheet_ungrounding){2039 void Penta::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){ 2045 2040 _error_("not supported yet!"); 2046 2041 } -
issm/trunk/src/c/objects/Elements/Penta.h
r10376 r10377 103 103 104 104 void InputToResult(int enum_type,int step,double time); 105 void MigrateGroundingLine(double* sheet_ungrounding);105 void MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding); 106 106 void PotentialSheetUngrounding(Vec potential_sheet_ungrounding); 107 void ShelfSync();108 107 void RequestedOutput(int output_enum,int step,double time); 109 108 void ListResultsEnums(int** results_enums,int* num_results); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r10376 r10377 1923 1923 }/*}}}*/ 1924 1924 /*FUNCTION Tria::MigrateGroundingLine{{{1*/ 1925 void Tria::MigrateGroundingLine(double* sheet_ungrounding){1925 void Tria::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){ 1926 1926 1927 1927 int i,migration_style,unground; 1928 1928 bool elementonshelf = false; 1929 double bed_hydro ;1929 double bed_hydro,yts,gl_melting_rate; 1930 1930 double rho_water,rho_ice,density; 1931 double melting[NUMVERTICES]; 1931 1932 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 1932 1933 1933 1934 /*Recover info at the vertices: */ 1934 1935 parameters->FindParam(&migration_style,GroundinglineMigrationEnum); 1936 parameters->FindParam(&yts,ConstantsYtsEnum); 1935 1937 GetInputListOnVertices(&h[0],ThicknessEnum); 1936 1938 GetInputListOnVertices(&s[0],SurfaceEnum); … … 1944 1946 for(i=0;i<NUMVERTICES;i++){ 1945 1947 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */ 1946 if (nodes[i]->IsFloating()){1948 if(old_floating_ice[nodes[i]->Sid()]){ 1947 1949 if(b[i]<=ba[i]){ 1948 1950 b[i]=ba[i]; 1949 1951 s[i]=b[i]+h[i]; 1952 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false)); 1953 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true)); 1950 1954 } 1951 1955 } … … 1959 1963 s[i]=(1-density)*h[i]; 1960 1964 b[i]=-density*h[i]; 1965 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 1966 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 1961 1967 } 1962 1968 else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){ 1963 1969 s[i]=(1-density)*h[i]; 1964 1970 b[i]=-density*h[i]; 1971 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 1972 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 1965 1973 } 1966 1974 } 1967 1975 } 1968 1976 } 1977 1978 /*If at least one vertex is now floating, the element is now floating*/ 1979 for(i=0;i<NUMVERTICES;i++){ 1980 if(nodes[i]->IsFloating()){ 1981 elementonshelf=true; 1982 break; 1983 } 1984 } 1985 1986 /*Add basal melting rate if element just ungrounded*/ 1987 if(!this->IsFloating() && elementonshelf==true){ 1988 for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts; 1989 this->inputs->AddInput(new TriaVertexInput(BasalforcingsMeltingRateEnum,&melting[0])); 1990 } 1991 1992 /*Update inputs*/ 1993 this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf)); 1969 1994 1970 1995 /*Update inputs*/ … … 2108 2133 else this->nodes=NULL; 2109 2134 2110 }2111 /*}}}*/2112 /*FUNCTION Tria::ShelfSync{{{1*/2113 void Tria::ShelfSync(void){2114 2115 int i;2116 bool elementonshelf = false;2117 double bed_hydro,gl_melting_rate;2118 double yts,rho_water,rho_ice,density;2119 double melting[NUMVERTICES];2120 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];2121 2122 /*recover parameters: */2123 parameters->FindParam(&yts,ConstantsYtsEnum);2124 parameters->FindParam(&gl_melting_rate,GroundinglineMeltingRateEnum);2125 rho_water=matpar->GetRhoWater();2126 rho_ice=matpar->GetRhoIce();2127 density=rho_ice/rho_water;2128 2129 /*Recover info at the vertices: */2130 GetInputListOnVertices(&h[0],ThicknessEnum);2131 GetInputListOnVertices(&s[0],SurfaceEnum);2132 GetInputListOnVertices(&b[0],BedEnum);2133 GetInputListOnVertices(&ba[0],BathymetryEnum);2134 2135 /*go through vertices, and update inputs, considering them to be TriaVertex type: */2136 for(i=0;i<NUMVERTICES;i++){2137 if(b[i]==ba[i]){2138 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));2139 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));2140 }2141 else{2142 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));2143 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));2144 }2145 }2146 2147 /*If at least one vertex is now floating, the element is an iceshelf*/2148 for(i=0;i<NUMVERTICES;i++){2149 if(nodes[i]->IsFloating()){2150 elementonshelf=true;2151 break;2152 }2153 }2154 2155 /*Add basal melting rate if element just ungrounded*/2156 if(!this->IsFloating() && elementonshelf==true){2157 for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts;2158 this->inputs->AddInput(new TriaVertexInput(BasalforcingsMeltingRateEnum,&melting[0]));2159 }2160 2161 /*Update inputs*/2162 this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf));2163 2135 } 2164 2136 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r10376 r10377 102 102 void DeleteResults(void); 103 103 void MaterialUpdateFromTemperature(void){_error_("not implemented yet");}; 104 void MigrateGroundingLine(double* sheet_ungrounding); 105 void ShelfSync(); 104 void MigrateGroundingLine(double* oldfloating,double* sheet_ungrounding); 106 105 void PotentialSheetUngrounding(Vec potential_sheet_ungrounding); 107 106 void RequestedOutput(int output_enum,int step,double time);
Note:
See TracChangeset
for help on using the changeset viewer.