Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OceanModel.hh
Go to the documentation of this file.
1// Copyright (C) 2008-2021, 2025 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
26namespace 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.
31namespace ocean {
32//! A very rudimentary PISM ocean model.
33class OceanModel : public Component {
34public:
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
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
56protected:
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;
66
67 virtual const array::Scalar& shelf_base_temperature_impl() const;
68 virtual const array::Scalar& shelf_base_mass_flux_impl() const;
70
71 std::shared_ptr<OceanModel> m_input_model;
72 std::shared_ptr<array::Scalar> m_water_column_pressure;
73
74
75};
76
77void compute_average_water_column_pressure(const Geometry &geometry, double ice_density,
78 double water_density, double standard_gravity,
79 array::Scalar &result);
80
81} // end of namespace ocean
82} // end of namespace pism
83
84#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:55
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
std::shared_ptr< OceanModel > m_input_model
Definition OceanModel.hh:71
virtual MaxTimestep max_timestep_impl(double t) const
const array::Scalar & shelf_base_mass_flux() const
Definition OceanModel.cc:93
std::shared_ptr< array::Scalar > m_water_column_pressure
Definition OceanModel.hh:72
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
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
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
virtual TSDiagnosticList ts_diagnostics_impl() const
void update(const Geometry &geometry, double t, double dt)
Definition OceanModel.cc:89
virtual const array::Scalar & shelf_base_temperature_impl() const
virtual const array::Scalar & shelf_base_mass_flux_impl() const
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).
virtual ~OceanModel()=default
virtual void update_impl(const Geometry &geometry, double t, double dt)
virtual const array::Scalar & average_water_column_pressure_impl() const
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 standard_gravity, array::Scalar &result)
static const double g
Definition exactTestP.cc:36
std::map< std::string, TSDiagnostic::Ptr > TSDiagnosticList
std::map< std::string, Diagnostic::Ptr > DiagnosticList