PISM, A Parallel Ice Sheet Model  stable v2.0.6 committed by Constantine Khrulev on 2023-01-23 15:14:38 -0900
SurfaceModel.hh
Go to the documentation of this file.
1 // Copyright (C) 2008-2018, 2021 Ed Bueler, Constantine Khroulev, Ricarda Winkelmann,
2 // Gudfinna Adalgeirsdottir and Andy Aschwanden
3 //
4 // This file is part of PISM.
5 //
6 // PISM is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3 of the License, or (at your option) any later
9 // version.
10 //
11 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with PISM; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef __PISMSurfaceModel_hh
21 #define __PISMSurfaceModel_hh
22 
23 /*!
24  * This file should contain the class definition and nothing else.
25  * Implementations should go in separate files.
26  */
27 
28 #include "pism/util/Component.hh"
29 
30 namespace pism {
31 
32 namespace atmosphere {
33 class AtmosphereModel;
34 }
35 
36 class Geometry;
37 class IceModelVec2S;
38 
39 //! @brief Surface models and modifiers: provide top-surface
40 //! temperature, mass flux, liquid water fraction, mass and thickness of the surface
41 //! layer.
42 namespace surface {
43 
44 //! \brief The interface of PISM's surface models.
45 class SurfaceModel : public Component {
46 public:
48  SurfaceModel(IceGrid::ConstPtr g, std::shared_ptr<SurfaceModel> input);
49  SurfaceModel(IceGrid::ConstPtr g, std::shared_ptr<atmosphere::AtmosphereModel> atmosphere);
50 
51  virtual ~SurfaceModel() = default;
52 
53  void init(const Geometry &geometry);
54 
55  // the interface:
56  void update(const Geometry &geometry, double t, double dt);
57 
58  const IceModelVec2S& accumulation() const;
59  const IceModelVec2S& layer_mass() const;
60  const IceModelVec2S& layer_thickness() const;
61  const IceModelVec2S& liquid_water_fraction() const;
62  const IceModelVec2S& mass_flux() const;
63  const IceModelVec2S& melt() const;
64  const IceModelVec2S& runoff() const;
65  const IceModelVec2S& temperature() const;
66 
67 protected:
68 
69  virtual const IceModelVec2S& accumulation_impl() const;
70  virtual const IceModelVec2S& layer_mass_impl() const;
71  virtual const IceModelVec2S& layer_thickness_impl() const;
72  virtual const IceModelVec2S& liquid_water_fraction_impl() const;
73  virtual const IceModelVec2S& mass_flux_impl() const;
74  virtual const IceModelVec2S& melt_impl() const;
75  virtual const IceModelVec2S& runoff_impl() const;
76  virtual const IceModelVec2S& temperature_impl() const;
77 
78  virtual void init_impl(const Geometry &geometry);
79  virtual void update_impl(const Geometry &geometry, double t, double dt);
80 
81  virtual void define_model_state_impl(const File &output) const;
82  virtual void write_model_state_impl(const File &output) const;
83 
84  virtual MaxTimestep max_timestep_impl(double my_t) const;
85 
86  virtual DiagnosticList diagnostics_impl() const;
87  virtual TSDiagnosticList ts_diagnostics_impl() const;
88 
89  void dummy_accumulation(const IceModelVec2S& smb, IceModelVec2S& result);
90  void dummy_melt(const IceModelVec2S& smb, IceModelVec2S& result);
91  void dummy_runoff(const IceModelVec2S& smb, IceModelVec2S& result);
92 
101 
102 protected:
109 
110  std::shared_ptr<SurfaceModel> m_input_model;
111  std::shared_ptr<atmosphere::AtmosphereModel> m_atmosphere;
112 };
113 
114 } // end of namespace surface
115 } // end of namespace pism
116 
117 #endif // __PISMSurfaceModel_hh
IceGrid::ConstPtr grid() const
Definition: Component.cc:105
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
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
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
static IceModelVec2S::Ptr allocate_mass_flux(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:76
const IceModelVec2S & liquid_water_fraction() const
Returns the liquid water fraction of the ice at the top ice surface.
IceModelVec2S::Ptr m_liquid_water_fraction
void update(const Geometry &geometry, double t, double dt)
std::shared_ptr< atmosphere::AtmosphereModel > m_atmosphere
const IceModelVec2S & temperature() const
virtual DiagnosticList diagnostics_impl() const
virtual const IceModelVec2S & temperature_impl() const
virtual void update_impl(const Geometry &geometry, double t, double dt)
void init(const Geometry &geometry)
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
static IceModelVec2S::Ptr allocate_liquid_water_fraction(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:62
IceModelVec2S::Ptr m_melt
static IceModelVec2S::Ptr allocate_melt(IceGrid::ConstPtr grid)
const IceModelVec2S & layer_thickness() const
Returns thickness of the surface layer. Could be used to compute surface elevation as a sum of elevat...
virtual MaxTimestep max_timestep_impl(double my_t) const
SurfaceModel(IceGrid::ConstPtr g)
IceModelVec2S::Ptr m_layer_mass
virtual const IceModelVec2S & melt_impl() const
IceModelVec2S::Ptr m_accumulation
const IceModelVec2S & melt() const
Returns melt.
static IceModelVec2S::Ptr allocate_temperature(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:93
std::shared_ptr< SurfaceModel > m_input_model
void dummy_accumulation(const IceModelVec2S &smb, IceModelVec2S &result)
const IceModelVec2S & mass_flux() const
static IceModelVec2S::Ptr allocate_accumulation(IceGrid::ConstPtr grid)
virtual ~SurfaceModel()=default
virtual const IceModelVec2S & mass_flux_impl() const
static IceModelVec2S::Ptr allocate_layer_mass(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:38
const IceModelVec2S & layer_mass() const
Returns mass held in the surface layer.
virtual TSDiagnosticList ts_diagnostics_impl() const
static IceModelVec2S::Ptr allocate_runoff(IceGrid::ConstPtr grid)
const IceModelVec2S & runoff() const
Returns runoff.
virtual const IceModelVec2S & layer_mass_impl() const
virtual const IceModelVec2S & liquid_water_fraction_impl() const
const IceModelVec2S & accumulation() const
Returns accumulation.
IceModelVec2S::Ptr m_runoff
virtual void init_impl(const Geometry &geometry)
void dummy_runoff(const IceModelVec2S &smb, IceModelVec2S &result)
virtual const IceModelVec2S & runoff_impl() const
IceModelVec2S::Ptr m_layer_thickness
virtual const IceModelVec2S & accumulation_impl() const
static IceModelVec2S::Ptr allocate_layer_thickness(IceGrid::ConstPtr grid)
Definition: SurfaceModel.cc:49
virtual const IceModelVec2S & layer_thickness_impl() const
void dummy_melt(const IceModelVec2S &smb, IceModelVec2S &result)
The interface of PISM's surface models.
Definition: SurfaceModel.hh:45
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