Changeset 15535
- Timestamp:
- 07/22/13 11:18:34 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 3 edited
-
Elements/Penta.cpp (modified) (8 diffs)
-
Elements/Tria.cpp (modified) (7 diffs)
-
Node.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15517 r15535 1555 1555 1556 1556 /*Step1: Get and Extrude original input: */ 1557 if (object_type==ElementEnum){1557 if(object_type==ElementEnum){ 1558 1558 num_inputs=1; 1559 1559 base_inputs=xNew<Input*>(num_inputs); 1560 1560 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1561 1561 } 1562 else if (object_type==MaterialsEnum){1562 else if(object_type==MaterialsEnum){ 1563 1563 num_inputs=1; 1564 1564 base_inputs=xNew<Input*>(num_inputs); … … 9645 9645 void Penta::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){ 9646 9646 9647 int i,migration_style; 9648 bool floatingelement = false; 9649 bool groundedelement = false; 9650 IssmDouble bed_hydro,yts,gl_melting_rate; 9651 IssmDouble rho_water,rho_ice,density; 9652 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES]; 9653 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 9647 int i,migration_style; 9648 bool floatingelement = false; 9649 bool groundedelement = false; 9650 IssmDouble bed_hydro,yts,gl_melting_rate; 9651 IssmDouble rho_water,rho_ice,density; 9652 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES]; 9653 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES]; 9654 bool grounded[NUMVERTICES],floating[NUMVERTICES]; 9654 9655 9655 9656 if(!IsOnBed()) return; … … 9662 9663 GetInputListOnVertices(&s[0],SurfaceEnum); 9663 9664 GetInputListOnVertices(&b[0],BedEnum); 9664 GetInputListOnVertices(& ba[0],BathymetryEnum);9665 GetInputListOnVertices(&r[0],BathymetryEnum); 9665 9666 if(migration_style==SubelementMigrationEnum) GetInputListOnVertices(&phi[0],GLlevelsetEnum); 9666 rho_water =matpar->GetRhoWater();9667 rho_ice =matpar->GetRhoIce();9668 density =rho_ice/rho_water;9667 rho_water = matpar->GetRhoWater(); 9668 rho_ice = matpar->GetRhoIce(); 9669 density = rho_ice/rho_water; 9669 9670 9670 9671 /*go through vertices, and update inputs, considering them to be PentaVertex type: */ … … 9672 9673 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */ 9673 9674 if(reCast<bool,IssmDouble>(old_floating_ice[nodes[i]->Sid()])){ 9674 if(b[i]<=ba[i]){ 9675 b[i]=ba[i]; 9676 s[i]=b[i]+h[i]; 9675 if(b[i]<=r[i]){ 9676 b[i] = r[i]; 9677 s[i] = b[i]+h[i]; 9678 floating[i] = false; 9679 grounded[i] = true; 9677 9680 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false)); 9678 9681 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true)); … … 9683 9686 else{ 9684 9687 bed_hydro=-density*h[i]; 9685 if (bed_hydro>ba[i]){9688 if(bed_hydro>r[i]){ 9686 9689 /*Unground only if the element is connected to the ice shelf*/ 9687 9690 if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum){ 9688 s[i]=(1-density)*h[i]; 9689 b[i]=-density*h[i]; 9691 s[i] = (1-density)*h[i]; 9692 b[i] = -density*h[i]; 9693 floating[i] = true; 9694 grounded[i] = false; 9690 9695 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 9691 9696 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 9692 9697 } 9693 9698 else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[nodes[i]->Sid()])){ 9694 s[i]=(1-density)*h[i]; 9695 b[i]=-density*h[i]; 9699 s[i] = (1-density)*h[i]; 9700 b[i] = -density*h[i]; 9701 floating[i] = true; 9702 grounded[i] = false; 9696 9703 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 9697 9704 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); … … 9736 9743 /*Recalculate phi*/ 9737 9744 if(migration_style==SubelementMigrationEnum){ 9738 for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+ ba[i]/density;9745 for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+r[i]/density; 9739 9746 this->inputs->AddInput(new PentaInput(GLlevelsetEnum,&phi[0],P1Enum)); 9740 9747 this->InputExtrude(GLlevelsetEnum,ElementEnum); … … 9752 9759 void Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){ 9753 9760 9754 int i; 9755 IssmDouble h[NUMVERTICES],ba[NUMVERTICES]; 9761 IssmDouble h[NUMVERTICES],r[NUMVERTICES]; 9756 9762 IssmDouble bed_hydro; 9757 9763 IssmDouble rho_water,rho_ice,density; … … 9762 9768 density=rho_ice/rho_water; 9763 9769 GetInputListOnVertices(&h[0],ThicknessEnum); 9764 GetInputListOnVertices(& ba[0],BathymetryEnum);9770 GetInputListOnVertices(&r[0],BathymetryEnum); 9765 9771 9766 9772 /*go through vertices, and figure out which ones are on the ice sheet, and want to unground: */ 9767 for(i =0;i<NUMVERTICES;i++){9773 for(int i=0;i<NUMVERTICES;i++){ 9768 9774 /*Find if grounded vertices want to start floating*/ 9769 9775 if (!nodes[i]->IsFloating()){ 9770 9776 bed_hydro=-density*h[i]; 9771 if (bed_hydro>ba[i]){9777 if(bed_hydro>r[i]){ 9772 9778 /*Vertex that could potentially unground, flag it*/ 9773 9779 potential_ungrounding->SetValue(nodes[i]->Sid(),1,INS_VAL); -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15525 r15535 7166 7166 void Tria::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){ 7167 7167 7168 int i,migration_style; 7169 bool floatingelement = false; 7170 bool groundedelement = false; 7171 IssmDouble bed_hydro,yts,gl_melting_rate; 7172 IssmDouble rho_water,rho_ice,density; 7173 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];; 7174 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 7168 int i,migration_style; 7169 bool floatingelement = false; 7170 bool groundedelement = false; 7171 IssmDouble bed_hydro,yts,gl_melting_rate; 7172 IssmDouble rho_water,rho_ice,density; 7173 IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];; 7174 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES]; 7175 bool grounded[NUMVERTICES],floating[NUMVERTICES]; 7175 7176 7176 7177 /*Recover info at the vertices: */ … … 7181 7182 GetInputListOnVertices(&s[0],SurfaceEnum); 7182 7183 GetInputListOnVertices(&b[0],BedEnum); 7183 GetInputListOnVertices(& ba[0],BathymetryEnum);7184 GetInputListOnVertices(&r[0],BathymetryEnum); 7184 7185 if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum) GetInputListOnVertices(&phi[0],GLlevelsetEnum); 7185 rho_water =matpar->GetRhoWater();7186 rho_ice =matpar->GetRhoIce();7187 density =rho_ice/rho_water;7186 rho_water = matpar->GetRhoWater(); 7187 rho_ice = matpar->GetRhoIce(); 7188 density = rho_ice/rho_water; 7188 7189 7189 7190 /*go through vertices, and update inputs, considering them to be TriaVertex type: */ … … 7191 7192 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */ 7192 7193 if(reCast<bool>(old_floating_ice[nodes[i]->Sid()])){ 7193 if(b[i]<=ba[i]){ 7194 b[i]=ba[i]; 7195 s[i]=b[i]+h[i]; 7194 if(b[i]<=r[i]){ 7195 b[i] = r[i]; 7196 s[i] = b[i]+h[i]; 7197 floating[i] = false; 7198 grounded[i] = true; 7196 7199 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false)); 7197 7200 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true)); … … 7202 7205 else{ 7203 7206 bed_hydro=-density*h[i]; 7204 if (bed_hydro> ba[i]){7207 if (bed_hydro>r[i]){ 7205 7208 /*Unground only if the element is connected to the ice shelf*/ 7206 7209 if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ 7207 s[i]=(1-density)*h[i]; 7208 b[i]=-density*h[i]; 7210 s[i] = (1-density)*h[i]; 7211 b[i] = -density*h[i]; 7212 floating[i] = true; 7213 grounded[i] = false; 7209 7214 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 7210 7215 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 7211 7216 } 7212 7217 else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){ 7213 s[i]=(1-density)*h[i]; 7214 b[i]=-density*h[i]; 7218 s[i] = (1-density)*h[i]; 7219 b[i] = -density*h[i]; 7220 floating[i] = true; 7221 grounded[i] = false; 7215 7222 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true)); 7216 7223 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); … … 7256 7263 /*Recalculate phi*/ 7257 7264 if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){ 7258 for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+ ba[i]/density;7265 for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+r[i]/density; 7259 7266 this->inputs->AddInput(new TriaInput(GLlevelsetEnum,&phi[0],P1Enum)); 7260 7267 } … … 7264 7271 void Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){ 7265 7272 7266 int i; 7267 IssmDouble h[NUMVERTICES],ba[NUMVERTICES]; 7273 IssmDouble h[NUMVERTICES],r[NUMVERTICES]; 7268 7274 IssmDouble bed_hydro; 7269 7275 IssmDouble rho_water,rho_ice,density; … … 7274 7280 density=rho_ice/rho_water; 7275 7281 GetInputListOnVertices(&h[0],ThicknessEnum); 7276 GetInputListOnVertices(& ba[0],BathymetryEnum);7282 GetInputListOnVertices(&r[0],BathymetryEnum); 7277 7283 7278 7284 /*go through vertices, and figure out which ones are grounded and want to unground: */ 7279 for(i =0;i<NUMVERTICES;i++){7285 for(int i=0;i<NUMVERTICES;i++){ 7280 7286 /*Find if grounded vertices want to start floating*/ 7281 7287 if (!nodes[i]->IsFloating()){ 7282 7288 bed_hydro=-density*h[i]; 7283 if (bed_hydro>ba[i]){7289 if(bed_hydro>r[i]){ 7284 7290 /*Vertex that could potentially unground, flag it*/ 7285 7291 potential_ungrounding->SetValue(nodes[i]->Sid(),1,INS_VAL); -
issm/trunk-jpl/src/c/classes/Node.h
r15464 r15535 65 65 /*}}}*/ 66 66 /*Node numerical routines {{{*/ 67 void CreateNodalConstraints(Vector<IssmDouble>* ys);68 void SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);69 int Sid(void);67 void CreateNodalConstraints(Vector<IssmDouble>* ys); 68 void SetCurrentConfiguration(DataSet* nodes,Vertices* vertices); 69 int Sid(void); 70 70 #ifdef _HAVE_DIAGNOSTIC_ 71 void GetCoordinateSystem(IssmDouble* coord_system_out);71 void GetCoordinateSystem(IssmDouble* coord_system_out); 72 72 #endif 73 bool InAnalysis(int analysis_type);74 int GetApproximation();75 int GetNumberOfDofs(int approximation_enum,int setenum);76 int IsClone();77 void ApplyConstraint(int dof,IssmDouble value);78 void RelaxConstraint(int dof);79 void DofInSSet(int dof);80 void DofInFSet(int dof);81 int GetDof(int dofindex,int setenum);82 void CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s);83 void GetDofList(int* poutdoflist,int approximation_enum,int setenum);84 void GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum);85 void FreezeDof(int dof);86 bool IsActive(void);87 void Activate(void);88 void Deactivate(void);89 int IsFloating();90 int IsGrounded();91 void UpdateSpcs(IssmDouble* ys);92 void VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum);93 void VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setnum);73 bool InAnalysis(int analysis_type); 74 int GetApproximation(); 75 int GetNumberOfDofs(int approximation_enum,int setenum); 76 int IsClone(); 77 void ApplyConstraint(int dof,IssmDouble value); 78 void RelaxConstraint(int dof); 79 void DofInSSet(int dof); 80 void DofInFSet(int dof); 81 int GetDof(int dofindex,int setenum); 82 void CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s); 83 void GetDofList(int* poutdoflist,int approximation_enum,int setenum); 84 void GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum); 85 void FreezeDof(int dof); 86 bool IsActive(void); 87 void Activate(void); 88 void Deactivate(void); 89 void UpdateSpcs(IssmDouble* ys); 90 int IsFloating(); 91 int IsGrounded(); 92 void VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum); 93 void VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setnum); 94 94 void DistributeDofs(int* pdofcount,int setenum); 95 95 void OffsetDofs(int dofcount,int setenum);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)