PISM, A Parallel Ice Sheet Model  stable v2.0.4 committed by Constantine Khrulev on 2022-05-25 12:02:27 -0800
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
20 #ifndef __PISMSurfaceModel_hh
21 #define __PISMSurfaceModel_hh
23 /*!
24  * This file should contain the class definition and nothing else.
25  * Implementations should go in separate files.
26  */
28 #include "pism/util/Component.hh"
30 namespace pism {
32 namespace atmosphere {
33 class AtmosphereModel;
34 }
36 class Geometry;
37 class IceModelVec2S;
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 {
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);
51  virtual ~SurfaceModel() = default;
53  void init(const Geometry &geometry);
55  // the interface:
56  void update(const Geometry &geometry, double t, double dt);
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;
67 protected:
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;
78  virtual void init_impl(const Geometry &geometry);
79  virtual void update_impl(const Geometry &geometry, double t, double dt);
81  virtual void define_model_state_impl(const File &output) const;
82  virtual void write_model_state_impl(const File &output) const;
84  virtual MaxTimestep max_timestep_impl(double my_t) const;
86  virtual DiagnosticList diagnostics_impl() const;
87  virtual TSDiagnosticList ts_diagnostics_impl() const;
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);
102 protected:
110  std::shared_ptr<SurfaceModel> m_input_model;
111  std::shared_ptr<atmosphere::AtmosphereModel> m_atmosphere;
112 };
114 } // end of namespace surface
115 } // end of namespace pism
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