PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
GeometryEvolution.hh
Go to the documentation of this file.
1 /* Copyright (C) 2016, 2017, 2019, 2020, 2022, 2023 PISM Authors
2  *
3  * This file is part of PISM.
4  *
5  * PISM is free software; you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation; either version 3 of the License, or (at your option) any later
8  * version.
9  *
10  * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with PISM; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef GEOMETRYEVOLUTION_H
21 #define GEOMETRYEVOLUTION_H
22 
23 #include "pism/geometry/Geometry.hh"
24 #include "pism/util/Component.hh"
25 #include "pism/util/array/Scalar.hh"
26 
27 namespace pism {
28 
29 /*!
30  * NB! Write this in a way that does not use ghosts of input fields (copy to temp. storage and
31  * communicate).
32  *
33  * The promise:
34  *
35  * H_change + Href_change = dt * (SMB_rate + BMB_rate - flux_divergence) + conservation_error
36  *
37  * Href == 0 if H > 0
38  */
39 class GeometryEvolution : public Component {
40 public:
41  GeometryEvolution(std::shared_ptr<const Grid> grid);
43 
44  void init(const InputOptions &opts);
45 
46  void reset();
47 
48  void flow_step(const Geometry &ice_geometry, double dt,
49  const array::Vector &advective_velocity,
50  const array::Staggered &diffusive_flux,
51  const array::Scalar &thickness_bc_mask);
52 
53  void source_term_step(const Geometry &geometry, double dt,
54  const array::Scalar &thickness_bc_mask,
55  const array::Scalar &surface_mass_flux,
56  const array::Scalar &basal_melt_rate);
57 
58  void apply_flux_divergence(Geometry &geometry) const;
59  void apply_mass_fluxes(Geometry &geometry) const;
60 
63 
66 
67  const array::Scalar& conservation_error() const;
68 
69  // diagnostic
70  const array::Staggered1& flux_staggered() const;
71  const array::Scalar& flux_divergence() const;
72 
73  // "regional" setup
74  virtual void set_no_model_mask(const array::Scalar &mask);
75 protected:
76  std::map<std::string,Diagnostic::Ptr> diagnostics_impl() const;
77 
78  virtual void init_impl(const InputOptions &opts);
79 
80  void update_in_place(double dt,
81  const array::Scalar& bed_elevation,
82  const array::Scalar& sea_level,
84  array::Scalar& ice_thickness,
85  array::Scalar& area_specific_volume);
86 
87  void residual_redistribution_iteration(const array::Scalar &bed_topography,
88  const array::Scalar &sea_level,
89  array::Scalar1 &ice_surface_elevation,
90  array::Scalar &ice_thickness,
91  array::CellType1 &cell_type,
92  array::Scalar &Href,
93  array::Scalar &H_residual,
94  bool &done);
95 
96  virtual void compute_interface_fluxes(const array::CellType1 &cell_type,
97  const array::Scalar &ice_thickness,
98  const array::Vector &velocity,
99  const array::Staggered &diffusive_flux,
100  array::Staggered &output);
101 
102  virtual void compute_flux_divergence(double dt,
104  const array::Scalar &thickness_bc_mask,
106  array::Scalar &flux_fivergence);
107 
108  virtual void ensure_nonnegativity(const array::Scalar &ice_thickness,
109  const array::Scalar &area_specific_volume,
110  array::Scalar &thickness_change,
111  array::Scalar &area_specific_volume_change,
113 
114  virtual void set_no_model_mask_impl(const array::Scalar &mask);
115 
116  // note: cells with area_specific_volume > 0 do not experience changes due to surface and basal
117  // mass balance sources
118  virtual void compute_surface_and_basal_mass_balance(double dt,
119  const array::Scalar &thickness_bc_mask,
120  const array::Scalar &ice_thickness,
121  const array::CellType &cell_type,
122  const array::Scalar &surface_mass_flux,
123  const array::Scalar &basal_melt_rate,
124  array::Scalar &effective_SMB,
125  array::Scalar &effective_BMB);
126 protected:
127  struct Impl;
129 };
130 
132 public:
133  RegionalGeometryEvolution(std::shared_ptr<const Grid> grid);
134 
135 protected:
136  void set_no_model_mask_impl(const array::Scalar &mask);
137 
138  void compute_interface_fluxes(const array::CellType1 &cell_type,
139  const array::Scalar &ice_thickness,
140  const array::Vector &velocity,
141  const array::Staggered &diffusive_flux,
142  array::Staggered &output);
143 
145  const array::Scalar &thickness_bc_mask,
146  const array::Scalar &ice_thickness,
147  const array::CellType &cell_type,
148  const array::Scalar &surface_mass_flux,
149  const array::Scalar &basal_melt_rate,
150  array::Scalar &effective_SMB,
151  array::Scalar &effective_BMB);
152 private:
154 };
155 
156 /*!
157  * Compute the grounding line flux.
158  *
159  * The units of `result` are "kg m-2". Negative flux corresponds to ice moving into
160  * the ocean, i.e. from grounded to floating areas.
161  *
162  * This convention makes it easier to compare this quantity to the surface mass balance or
163  * calving fluxes.
164  */
165 void grounding_line_flux(const array::CellType1 &cell_type,
166  const array::Staggered1 &flux,
167  double dt,
168  bool add_values,
169  array::Scalar &result);
170 
171 double total_grounding_line_flux(const array::CellType1 &cell_type,
172  const array::Staggered1 &flux,
173  double dt);
174 } // end of namespace pism
175 
176 #endif /* GEOMETRYEVOLUTION_H */
std::shared_ptr< const Grid > grid() const
Definition: Component.cc:105
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:118
const array::Scalar & thickness_change_due_to_flow() const
virtual void set_no_model_mask(const array::Scalar &mask)
virtual void init_impl(const InputOptions &opts)
virtual void compute_surface_and_basal_mass_balance(double dt, const array::Scalar &thickness_bc_mask, const array::Scalar &ice_thickness, const array::CellType &cell_type, const array::Scalar &surface_mass_flux, const array::Scalar &basal_melt_rate, array::Scalar &effective_SMB, array::Scalar &effective_BMB)
const array::Scalar & bottom_surface_mass_balance() const
void apply_mass_fluxes(Geometry &geometry) const
void residual_redistribution_iteration(const array::Scalar &bed_topography, const array::Scalar &sea_level, array::Scalar1 &ice_surface_elevation, array::Scalar &ice_thickness, array::CellType1 &cell_type, array::Scalar &Href, array::Scalar &H_residual, bool &done)
Perform one iteration of the residual mass redistribution.
virtual void set_no_model_mask_impl(const array::Scalar &mask)
const array::Scalar & flux_divergence() const
void update_in_place(double dt, const array::Scalar &bed_elevation, const array::Scalar &sea_level, const array::Scalar &flux_divergence, array::Scalar &ice_thickness, array::Scalar &area_specific_volume)
virtual void ensure_nonnegativity(const array::Scalar &ice_thickness, const array::Scalar &area_specific_volume, array::Scalar &thickness_change, array::Scalar &area_specific_volume_change, array::Scalar &conservation_error)
virtual void compute_interface_fluxes(const array::CellType1 &cell_type, const array::Scalar &ice_thickness, const array::Vector &velocity, const array::Staggered &diffusive_flux, array::Staggered &output)
GeometryEvolution(std::shared_ptr< const Grid > grid)
void flow_step(const Geometry &ice_geometry, double dt, const array::Vector &advective_velocity, const array::Staggered &diffusive_flux, const array::Scalar &thickness_bc_mask)
virtual void compute_flux_divergence(double dt, const array::Staggered1 &flux_staggered, const array::Scalar &thickness_bc_mask, array::Scalar &conservation_error, array::Scalar &flux_fivergence)
const array::Scalar & top_surface_mass_balance() const
void source_term_step(const Geometry &geometry, double dt, const array::Scalar &thickness_bc_mask, const array::Scalar &surface_mass_flux, const array::Scalar &basal_melt_rate)
void apply_flux_divergence(Geometry &geometry) const
const array::Scalar & area_specific_volume_change_due_to_flow() const
const array::Scalar & conservation_error() const
const array::Staggered1 & flux_staggered() const
void init(const InputOptions &opts)
std::map< std::string, Diagnostic::Ptr > diagnostics_impl() const
RegionalGeometryEvolution(std::shared_ptr< const Grid > grid)
void compute_surface_and_basal_mass_balance(double dt, const array::Scalar &thickness_bc_mask, const array::Scalar &ice_thickness, const array::CellType &cell_type, const array::Scalar &surface_mass_flux, const array::Scalar &basal_melt_rate, array::Scalar &effective_SMB, array::Scalar &effective_BMB)
void compute_interface_fluxes(const array::CellType1 &cell_type, const array::Scalar &ice_thickness, const array::Vector &velocity, const array::Staggered &diffusive_flux, array::Staggered &output)
void set_no_model_mask_impl(const array::Scalar &mask)
"Cell type" mask. Adds convenience methods to array::Scalar.
Definition: CellType.hh:30
A class for storing and accessing internal staggered-grid 2D fields. Uses dof=2 storage....
Definition: Staggered.hh:35
double total_grounding_line_flux(const array::CellType1 &cell_type, const array::Staggered1 &flux, double dt)
void grounding_line_flux(const array::CellType1 &cell_type, const array::Staggered1 &flux, double dt, bool add_values, array::Scalar &output)