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
PyOceanModel.cc
Go to the documentation of this file.
1/* Copyright (C) 2023 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
20#include "pism/coupler/ocean/PyOceanModel.hh"
21
22#include "pism/util/MaxTimestep.hh"
23
24#include <exception>
25#include <memory>
26
27namespace pism {
28namespace ocean {
29
35
37 (void) t;
38 return {};
39}
40
41void PyOceanModel::init(const Geometry &geometry) {
42 (void) geometry;
43 throw RuntimeError(PISM_ERROR_LOCATION, "PyOceanModel.init(geometry) is not implemented");
44}
45
46void PyOceanModel::update(const Geometry &geometry, double t, double dt) {
47 (void) geometry;
48 (void) t;
49 (void) dt;
50 throw RuntimeError(PISM_ERROR_LOCATION, "PyOceanModel.update(geometry, t, dt) is not implemented");
51}
52
53void PyOceanModel::define_model_state(const File &output) const {
54 (void) output;
55 // empty
56}
57
58void PyOceanModel::write_model_state(const File &output) const {
59 (void) output;
60 // empty
61}
62
63PyOceanModelAdapter::PyOceanModelAdapter(std::shared_ptr<const Grid> grid,
64 std::shared_ptr<PyOceanModel> implementation)
65 : CompleteOceanModel(grid), m_impl(implementation) {
66
68 m_impl->shelf_base_temperature = m_shelf_base_temperature;
69 m_impl->water_column_pressure = m_water_column_pressure;
70}
71
73 return m_impl->max_timestep(t);
74}
75
76void PyOceanModelAdapter::update_impl(const Geometry &geometry, double t, double dt) {
77 m_impl->update(geometry, t, dt);
78}
79
81 m_impl->init(geometry);
82}
83
84
86 m_impl->define_model_state(output);
87}
88
90 m_impl->write_model_state(output);
91}
92
93} // namespace ocean
94} // namespace pism
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< array::Scalar > m_shelf_base_mass_flux
std::shared_ptr< array::Scalar > m_shelf_base_temperature
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
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
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
Definition OceanModel.cc:49
void update_impl(const Geometry &geometry, double my_t, double my_dt)
void init_impl(const Geometry &geometry)
PyOceanModelAdapter(std::shared_ptr< const Grid > grid, std::shared_ptr< PyOceanModel > implementation)
MaxTimestep max_timestep_impl(double t) const
void write_model_state_impl(const File &output) const
The default (empty implementation).
void define_model_state_impl(const File &output) const
The default (empty implementation).
std::shared_ptr< PyOceanModel > m_impl
virtual void init(const Geometry &geometry)
virtual void write_model_state(const File &output) const
virtual void update(const Geometry &geometry, double t, double dt)
virtual MaxTimestep max_timestep(double t) const
std::shared_ptr< pism::array::Scalar > shelf_base_temperature
virtual void define_model_state(const File &output) const
std::shared_ptr< array::Scalar > water_column_pressure
std::shared_ptr< array::Scalar > shelf_base_mass_flux
void allocate(std::shared_ptr< const Grid > grid)
#define PISM_ERROR_LOCATION
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition Mask.hh:40