PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
FrontalMelt.hh
Go to the documentation of this file.
1 // Copyright (C) 2018, 2019, 2021, 2022, 2023 Constantine Khroulev and Andy Aschwanden
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 __PISMFrontalMelt_hh
20 #define __PISMFrontalMelt_hh
21 
22 #include <memory>
23 
24 #include "pism/util/Component.hh"
25 
26 namespace pism {
27 
29 public:
31 
33 
34  // used by DischargeRouting
36 
37 };
38 
39 //! @brief Frontal melt models and modifiers.
40 namespace frontalmelt {
41 
42 //! A very rudimentary PISM frontal melt model.
43 class FrontalMelt : public Component {
44 public:
45  // "modifier" constructor
46  FrontalMelt(std::shared_ptr<const Grid> g, std::shared_ptr<FrontalMelt> input);
47  // "model" constructor
48  FrontalMelt(std::shared_ptr<const Grid> g);
49 
50  virtual ~FrontalMelt() = default;
51 
52  void init(const Geometry &geometry);
53 
54  void update(const FrontalMeltInputs &inputs, double t, double dt);
55 
56  const array::Scalar& frontal_melt_rate() const;
57 
58  const array::Scalar& retreat_rate() const;
59 
60 protected:
61  virtual void init_impl(const Geometry &geometry);
62 
63  // provides default (pass-through) implementations for "modifiers"
64  virtual void update_impl(const FrontalMeltInputs &inputs, double t, double dt);
65  virtual MaxTimestep max_timestep_impl(double t) const;
66  virtual void define_model_state_impl(const File &output) const;
67  virtual void write_model_state_impl(const File &output) const;
68 
69  virtual DiagnosticList diagnostics_impl() const;
70  virtual TSDiagnosticList ts_diagnostics_impl() const;
71 
72  virtual const array::Scalar& frontal_melt_rate_impl() const = 0;
73 
74  void compute_retreat_rate(const Geometry &geometry, const array::Scalar &frontal_melt_rate,
75  array::Scalar &result) const;
76 
77  std::shared_ptr<FrontalMelt> m_input_model;
78 
79  bool apply(const array::CellType1 &M, int i, int j) const;
80 
83 };
84 
85 } // end of namespace frontalmelt
86 } // end of namespace pism
87 
88 #endif // __PISMFrontalMelt_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
const Geometry * geometry
Definition: FrontalMelt.hh:32
const array::Scalar * subglacial_water_flux
Definition: FrontalMelt.hh:35
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
virtual const array::Scalar & frontal_melt_rate_impl() const =0
virtual MaxTimestep max_timestep_impl(double t) const
Definition: FrontalMelt.cc:151
void init(const Geometry &geometry)
Definition: FrontalMelt.cc:117
void update(const FrontalMeltInputs &inputs, double t, double dt)
Definition: FrontalMelt.cc:127
void compute_retreat_rate(const Geometry &geometry, const array::Scalar &frontal_melt_rate, array::Scalar &result) const
Definition: FrontalMelt.cc:43
std::shared_ptr< FrontalMelt > m_input_model
Definition: FrontalMelt.hh:77
virtual DiagnosticList diagnostics_impl() const
Definition: FrontalMelt.cc:226
virtual void update_impl(const FrontalMeltInputs &inputs, double t, double dt)
Definition: FrontalMelt.cc:143
const array::Scalar & retreat_rate() const
Definition: FrontalMelt.cc:137
bool apply(const array::CellType1 &M, int i, int j) const
Definition: FrontalMelt.cc:246
FrontalMelt(std::shared_ptr< const Grid > g, std::shared_ptr< FrontalMelt > input)
Definition: FrontalMelt.cc:98
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: FrontalMelt.cc:159
const array::Scalar & frontal_melt_rate() const
Definition: FrontalMelt.cc:133
virtual TSDiagnosticList ts_diagnostics_impl() const
Definition: FrontalMelt.cc:239
virtual void init_impl(const Geometry &geometry)
Definition: FrontalMelt.cc:121
virtual ~FrontalMelt()=default
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: FrontalMelt.cc:167
A very rudimentary PISM frontal melt model.
Definition: FrontalMelt.hh:43
static const double g
Definition: exactTestP.cc:36
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
Definition: Diagnostic.hh:343
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125