PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
BedDef.hh
Go to the documentation of this file.
1 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 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 #ifndef __BedDef_hh
20 #define __BedDef_hh
21 
22 #include "pism/util/Component.hh"
23 
24 namespace pism {
25 
26 //! @brief Bed-related models: bed deformation (provide bed elevation
27 //! and uplift) and (soon) bed erosion.
28 namespace bed {
29 
30 double compute_load(double bed, double ice_thickness, double sea_level,
31  double ice_density, double ocean_density);
32 
33 void compute_load(const array::Scalar &bed_elevation,
34  const array::Scalar &ice_thickness,
35  const array::Scalar &sea_level_elevation,
36  array::Scalar &result);
37 
38 //! PISM bed deformation model (base class).
39 class BedDef : public Component {
40 public:
41  BedDef(std::shared_ptr<const Grid> g);
42  virtual ~BedDef() = default;
43 
44  void init(const InputOptions &opts, const array::Scalar &ice_thickness,
45  const array::Scalar &sea_level_elevation);
47  const array::Scalar &bed_uplift,
48  const array::Scalar &ice_thickness,
49  const array::Scalar &sea_level_elevation);
50 
51  void update(const array::Scalar &ice_thickness,
52  const array::Scalar &sea_level_elevation,
53  double t, double dt);
54 
55  const array::Scalar& bed_elevation() const;
56  const array::Scalar& uplift() const;
57 
58 protected:
59  virtual void define_model_state_impl(const File &output) const;
60  virtual void write_model_state_impl(const File &output) const;
61 
62  virtual DiagnosticList diagnostics_impl() const;
63 
64  virtual void update_impl(const array::Scalar &ice_thickness,
65  const array::Scalar &sea_level_elevation,
66  double t, double dt) = 0;
67  virtual void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness,
68  const array::Scalar &sea_level_elevation);
69  virtual void bootstrap_impl(const array::Scalar &bed_elevation,
70  const array::Scalar &bed_uplift,
71  const array::Scalar &ice_thickness,
72  const array::Scalar &sea_level_elevation);
73  virtual void apply_topg_offset(const std::string &filename);
74 
75  void compute_uplift(const array::Scalar &bed, const array::Scalar &bed_last,
76  double dt, array::Scalar &result);
77 protected:
78  const int m_wide_stencil;
79  //! current bed elevation
81 
82  //! bed elevation at the time of the last update
84 
85  //! bed uplift rate
87 };
88 
89 /*!
90  * The do-nothing bed deformation model.
91  */
92 class Null : public BedDef {
93 public:
94  Null(std::shared_ptr<const Grid> g);
95 protected:
96  void update_impl(const array::Scalar &ice_thickness,
97  const array::Scalar &sea_level_elevation,
98  double t, double dt);
99  MaxTimestep max_timestep_impl(double t) const;
100  void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness,
101  const array::Scalar &sea_level_elevation);
102 };
103 
104 //! Point-wise isostasy bed deformation model.
105 class PointwiseIsostasy : public BedDef {
106 public:
107  PointwiseIsostasy(std::shared_ptr<const Grid> g);
108  virtual ~PointwiseIsostasy() = default;
109 protected:
110  MaxTimestep max_timestep_impl(double t) const;
111  void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness,
112  const array::Scalar &sea_level_elevation);
114  const array::Scalar &bed_uplift,
115  const array::Scalar &ice_thickness,
116  const array::Scalar &sea_level_elevation);
117  void update_impl(const array::Scalar &ice_thickness,
118  const array::Scalar &sea_level_elevation,
119  double t, double dt);
120  //! last ice load (ice-equivalent thickness)
122 };
123 
124 } // end of namespace bed
125 } // end of namespace pism
126 
127 #endif // __BedDef_hh
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:118
High-level PISM I/O class.
Definition: File.hh:56
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: BedDef.cc:64
virtual DiagnosticList diagnostics_impl() const
Definition: BedDef.cc:69
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: BedDef.cc:59
virtual void bootstrap_impl(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Definition: BedDef.cc:88
virtual void update_impl(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)=0
void init(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Definition: BedDef.cc:76
array::Scalar2 m_topg_last
bed elevation at the time of the last update
Definition: BedDef.hh:83
void update(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)
Definition: BedDef.cc:99
void bootstrap(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize using provided bed elevation and uplift.
Definition: BedDef.cc:82
virtual ~BedDef()=default
array::Scalar2 m_topg
current bed elevation
Definition: BedDef.hh:80
virtual void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize from the context (input file and the "variables" database).
Definition: BedDef.cc:105
BedDef(std::shared_ptr< const Grid > g)
Definition: BedDef.cc:27
virtual void apply_topg_offset(const std::string &filename)
Definition: BedDef.cc:155
const int m_wide_stencil
Definition: BedDef.hh:78
array::Scalar m_uplift
bed uplift rate
Definition: BedDef.hh:86
const array::Scalar & uplift() const
Definition: BedDef.cc:55
const array::Scalar & bed_elevation() const
Definition: BedDef.cc:51
void compute_uplift(const array::Scalar &bed, const array::Scalar &bed_last, double dt, array::Scalar &result)
Compute bed uplift (dt is in seconds).
Definition: BedDef.cc:167
PISM bed deformation model (base class).
Definition: BedDef.hh:39
void update_impl(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)
Definition: Null.cc:47
Null(std::shared_ptr< const Grid > g)
Definition: Null.cc:27
MaxTimestep max_timestep_impl(double t) const
Definition: Null.cc:42
void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize from the context (input file and the "variables" database).
Definition: Null.cc:32
void bootstrap_impl(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
array::Scalar m_load_last
last ice load (ice-equivalent thickness)
Definition: BedDef.hh:121
MaxTimestep max_timestep_impl(double t) const
virtual ~PointwiseIsostasy()=default
PointwiseIsostasy(std::shared_ptr< const Grid > g)
void update_impl(const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double t, double dt)
Updates the pointwise isostasy model.
void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize from the context (input file and the "variables" database).
Point-wise isostasy bed deformation model.
Definition: BedDef.hh:105
double compute_load(double bed, double ice_thickness, double sea_level, double ice_density, double ocean_density)
Definition: BedDef.cc:174
static const double g
Definition: exactTestP.cc:36
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125