PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
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
33struct Inputs {
35};
36
37//! A very rudimentary PISM ocean model.
38class OceanModel : public Component {
39public:
40 // "modifier" constructor
41 OceanModel(std::shared_ptr<const Grid> g, std::shared_ptr<OceanModel> input);
42 // "model" constructor
43 OceanModel(std::shared_ptr<const Grid> g);
44
45 virtual ~OceanModel() = default;
46
47 void init(const Geometry &geometry);
48
49 void update(const Inputs &geometry, double t, double dt);
50
54
55 // These methods allocate storage and set metadata. They are public (and not protected)
56 // so we can use them in PyOceanModel::allocate().
57 static std::shared_ptr<array::Scalar> allocate_shelf_base_temperature(std::shared_ptr<const Grid> g);
58 static std::shared_ptr<array::Scalar> allocate_shelf_base_mass_flux(std::shared_ptr<const Grid> g);
59 static std::shared_ptr<array::Scalar> allocate_water_column_pressure(std::shared_ptr<const Grid> g);
60
61protected:
62 virtual void init_impl(const Geometry &geometry);
63 // provides default (pass-through) implementations for "modifiers"
64 virtual void update_impl(const Inputs &inputs, double t, double dt);
65 virtual MaxTimestep max_timestep_impl(double t) const;
66
67 virtual std::set<VariableMetadata> state_impl() const;
68 virtual void write_state_impl(const OutputFile &output) const;
69
72
73 virtual const array::Scalar& shelf_base_temperature_impl() const;
74 virtual const array::Scalar& shelf_base_mass_flux_impl() const;
76
77 std::shared_ptr<OceanModel> m_input_model;
78 std::shared_ptr<array::Scalar> m_water_column_pressure;
79
80
81};
82
83void compute_average_water_column_pressure(const Geometry &geometry, double ice_density,
84 double water_density, double standard_gravity,
85 array::Scalar &result);
86
87} // end of namespace ocean
88} // end of namespace pism
89
90#endif // __PISMOceanModel_hh
A class defining a common interface for most PISM sub-models.
Definition Component.hh:118
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:77
void update(const Inputs &geometry, double t, double dt)
Definition OceanModel.cc:89
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:78
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 void write_state_impl(const OutputFile &output) const
The default (empty implementation).
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
virtual DiagnosticList spatial_diagnostics_impl() const
void init(const Geometry &geometry)
Definition OceanModel.cc:72
virtual ~OceanModel()=default
virtual const array::Scalar & average_water_column_pressure_impl() const
virtual TSDiagnosticList scalar_diagnostics_impl() const
virtual void update_impl(const Inputs &inputs, double t, double dt)
virtual std::set< VariableMetadata > state_impl() const
const array::Scalar & shelf_base_temperature() const
Definition OceanModel.cc:97
A very rudimentary PISM ocean model.
Definition OceanModel.hh:38
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
const Geometry * geometry
Definition OceanModel.hh:34