PISM, A Parallel Ice Sheet Model  stable v2.0.4 committed by Constantine Khrulev on 2022-05-25 12:02:27 -0800
FrontalMelt.hh
Go to the documentation of this file.
1 // Copyright (C) 2018, 2019, 2021 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 
28 class IceModelVec2S;
29 class Geometry;
30 
32 public:
34 
36 
37  // used by DischargeRouting
39 
40 };
41 
42 //! @brief Frontal melt models and modifiers.
43 namespace frontalmelt {
44 
45 //! A very rudimentary PISM frontal melt model.
46 class FrontalMelt : public Component {
47 public:
48  // "modifier" constructor
49  FrontalMelt(IceGrid::ConstPtr g, std::shared_ptr<FrontalMelt> input);
50  // "model" constructor
52 
53  virtual ~FrontalMelt() = default;
54 
55  void init(const Geometry &geometry);
56 
57  void update(const FrontalMeltInputs &inputs, double t, double dt);
58 
59  const IceModelVec2S& frontal_melt_rate() const;
60 
61  const IceModelVec2S& retreat_rate() const;
62 
63 protected:
64  virtual void init_impl(const Geometry &geometry);
65 
66  // provides default (pass-through) implementations for "modifiers"
67  virtual void update_impl(const FrontalMeltInputs &inputs, double t, double dt);
68  virtual MaxTimestep max_timestep_impl(double t) const;
69  virtual void define_model_state_impl(const File &output) const;
70  virtual void write_model_state_impl(const File &output) const;
71 
72  virtual DiagnosticList diagnostics_impl() const;
73  virtual TSDiagnosticList ts_diagnostics_impl() const;
74 
75  virtual const IceModelVec2S& frontal_melt_rate_impl() const = 0;
76 
77  void compute_retreat_rate(const Geometry &geometry, const IceModelVec2S &frontal_melt_rate,
78  IceModelVec2S &result) const;
79 
80 protected:
81  std::shared_ptr<FrontalMelt> m_input_model;
82 
84  int stencil_width = 0);
85 
86  bool apply(const IceModelVec2CellType &M, int i, int j);
87 
90 };
91 
92 } // end of namespace frontalmelt
93 } // end of namespace pism
94 
95 #endif // __PISMFrontalMelt_hh
A class defining a common interface for most PISM sub-models.
Definition: Component.hh:101
High-level PISM I/O class.
Definition: File.hh:51
const Geometry * geometry
Definition: FrontalMelt.hh:35
const IceModelVec2S * subglacial_water_flux
Definition: FrontalMelt.hh:38
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
"Cell type" mask. Adds convenience methods to IceModelVec2Int.
std::shared_ptr< IceModelVec2S > Ptr
Definition: iceModelVec.hh:341
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
FrontalMelt(IceGrid::ConstPtr g, std::shared_ptr< FrontalMelt > input)
Definition: FrontalMelt.cc:114
void compute_retreat_rate(const Geometry &geometry, const IceModelVec2S &frontal_melt_rate, IceModelVec2S &result) const
Definition: FrontalMelt.cc:60
virtual MaxTimestep max_timestep_impl(double t) const
Definition: FrontalMelt.cc:165
bool apply(const IceModelVec2CellType &M, int i, int j)
Definition: FrontalMelt.cc:262
void init(const Geometry &geometry)
Definition: FrontalMelt.cc:131
void update(const FrontalMeltInputs &inputs, double t, double dt)
Definition: FrontalMelt.cc:141
const IceModelVec2S & frontal_melt_rate() const
Definition: FrontalMelt.cc:147
const IceModelVec2S & retreat_rate() const
Definition: FrontalMelt.cc:151
std::shared_ptr< FrontalMelt > m_input_model
Definition: FrontalMelt.hh:81
virtual DiagnosticList diagnostics_impl() const
Definition: FrontalMelt.cc:240
virtual void update_impl(const FrontalMeltInputs &inputs, double t, double dt)
Definition: FrontalMelt.cc:157
virtual const IceModelVec2S & frontal_melt_rate_impl() const =0
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: FrontalMelt.cc:173
virtual TSDiagnosticList ts_diagnostics_impl() const
Definition: FrontalMelt.cc:254
virtual void init_impl(const Geometry &geometry)
Definition: FrontalMelt.cc:135
virtual ~FrontalMelt()=default
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: FrontalMelt.cc:181
static IceModelVec2S::Ptr allocate_frontal_melt_rate(IceGrid::ConstPtr g, int stencil_width=0)
Definition: FrontalMelt.cc:38
A very rudimentary PISM frontal melt model.
Definition: FrontalMelt.hh:46
static const double g
Definition: exactTestP.cc:39
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
Definition: Diagnostic.hh:346
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:117