PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
OceanModel.hh
Go to the documentation of this file.
1 // Copyright (C) 2008-2021 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 __PISMOceanModel_hh
20 #define __PISMOceanModel_hh
21 
22 #include <memory>
23 
24 #include "pism/util/Component.hh"
25 
26 namespace pism {
27 
28 //! @brief Ocean models and modifiers: provide sea level elevation,
29 //! melange back pressure, shelf base mass flux and shelf base
30 //! temperature.
31 namespace ocean {
32 //! A very rudimentary PISM ocean model.
33 class OceanModel : public Component {
34 public:
35  // "modifier" constructor
36  OceanModel(std::shared_ptr<const Grid> g, std::shared_ptr<OceanModel> input);
37  // "model" constructor
38  OceanModel(std::shared_ptr<const Grid> g);
39 
40  virtual ~OceanModel() = default;
41 
42  void init(const Geometry &geometry);
43 
44  void update(const Geometry &geometry, double t, double dt);
45 
47  const array::Scalar& shelf_base_mass_flux() const;
49 
50  // These methods allocate storage and set metadata. They are public (and not protected)
51  // so we can use them in PyOceanModel::allocate().
52  static std::shared_ptr<array::Scalar> allocate_shelf_base_temperature(std::shared_ptr<const Grid> g);
53  static std::shared_ptr<array::Scalar> allocate_shelf_base_mass_flux(std::shared_ptr<const Grid> g);
54  static std::shared_ptr<array::Scalar> allocate_water_column_pressure(std::shared_ptr<const Grid> g);
55 
56 protected:
57  virtual void init_impl(const Geometry &geometry);
58  // provides default (pass-through) implementations for "modifiers"
59  virtual void update_impl(const Geometry &geometry, double t, double dt);
60  virtual MaxTimestep max_timestep_impl(double t) const;
61  virtual void define_model_state_impl(const File &output) const;
62  virtual void write_model_state_impl(const File &output) const;
63 
64  virtual DiagnosticList diagnostics_impl() const;
65  virtual TSDiagnosticList ts_diagnostics_impl() const;
66 
67  virtual const array::Scalar& shelf_base_temperature_impl() const;
68  virtual const array::Scalar& shelf_base_mass_flux_impl() const;
70 
71 protected:
72  std::shared_ptr<OceanModel> m_input_model;
73  std::shared_ptr<array::Scalar> m_water_column_pressure;
74 
75 
76 };
77 
78 void compute_average_water_column_pressure(const Geometry &geometry, double ice_density,
79  double water_density, double standard_gravity,
80  array::Scalar &result);
81 
82 } // end of namespace ocean
83 } // end of namespace pism
84 
85 #endif // __PISMOceanModel_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
std::shared_ptr< OceanModel > m_input_model
Definition: OceanModel.hh:72
virtual MaxTimestep max_timestep_impl(double t) const
Definition: OceanModel.cc:115
const array::Scalar & shelf_base_mass_flux() const
Definition: OceanModel.cc:93
std::shared_ptr< array::Scalar > m_water_column_pressure
Definition: OceanModel.hh:73
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: OceanModel.cc:122
static std::shared_ptr< array::Scalar > allocate_shelf_base_temperature(std::shared_ptr< const Grid > g)
Definition: OceanModel.cc:31
static std::shared_ptr< array::Scalar > allocate_shelf_base_mass_flux(std::shared_ptr< const Grid > g)
Definition: OceanModel.cc:39
const array::Scalar & average_water_column_pressure() const
Definition: OceanModel.cc:101
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
Definition: OceanModel.cc:49
virtual DiagnosticList diagnostics_impl() const
Definition: OceanModel.cc:198
virtual TSDiagnosticList ts_diagnostics_impl() const
Definition: OceanModel.cc:210
void update(const Geometry &geometry, double t, double dt)
Definition: OceanModel.cc:89
virtual const array::Scalar & shelf_base_temperature_impl() const
Definition: OceanModel.cc:136
virtual const array::Scalar & shelf_base_mass_flux_impl() const
Definition: OceanModel.cc:143
virtual void init_impl(const Geometry &geometry)
Definition: OceanModel.cc:76
void init(const Geometry &geometry)
Definition: OceanModel.cc:72
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: OceanModel.cc:129
virtual ~OceanModel()=default
OceanModel(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > input)
Definition: OceanModel.cc:58
virtual void update_impl(const Geometry &geometry, double t, double dt)
Definition: OceanModel.cc:107
virtual const array::Scalar & average_water_column_pressure_impl() const
Definition: OceanModel.cc:150
const array::Scalar & shelf_base_temperature() const
Definition: OceanModel.cc:97
A very rudimentary PISM ocean model.
Definition: OceanModel.hh:33
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition: Mask.hh:40
void compute_average_water_column_pressure(const Geometry &geometry, double ice_density, double water_density, double g, array::Scalar &result)
Definition: OceanModel.cc:217
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