PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
PyOceanModel.cc
Go to the documentation of this file.
1/* Copyright (C) 2023, 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
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 Inputs &inputs, double t, double dt) {
47 (void) inputs;
48 (void) t;
49 (void) dt;
50 throw RuntimeError(PISM_ERROR_LOCATION, "PyOceanModel.update(geometry, t, dt) is not implemented");
51}
52
53std::set<VariableMetadata> PyOceanModel::state() const {
54 return {};
55}
56
57void PyOceanModel::write_state(const OutputFile &output) const {
58 (void) output;
59 // empty
60}
61
62PyOceanModelAdapter::PyOceanModelAdapter(std::shared_ptr<const Grid> grid,
63 std::shared_ptr<PyOceanModel> implementation)
64 : CompleteOceanModel(grid), m_impl(implementation) {
65
67 m_impl->shelf_base_temperature = m_shelf_base_temperature;
68 m_impl->water_column_pressure = m_water_column_pressure;
69}
70
72 return m_impl->max_timestep(t);
73}
74
75void PyOceanModelAdapter::update_impl(const Inputs &inputs, double t, double dt) {
76 m_impl->update(inputs, t, dt);
77}
78
80 m_impl->init(geometry);
81}
82
83std::set<VariableMetadata> PyOceanModelAdapter::state_impl() const {
84 return m_impl->state();
85}
86
88 m_impl->write_state(output);
89}
90
91} // namespace ocean
92} // namespace pism
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: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
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
Definition OceanModel.cc:49
void write_state_impl(const OutputFile &output) const
The default (empty implementation).
std::set< VariableMetadata > state_impl() const
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
std::shared_ptr< PyOceanModel > m_impl
void update_impl(const Inputs &inputs, double my_t, double my_dt)
virtual void update(const Inputs &inputs, double t, double dt)
virtual std::set< VariableMetadata > state() const
virtual void init(const Geometry &geometry)
virtual MaxTimestep max_timestep(double t) const
std::shared_ptr< pism::array::Scalar > shelf_base_temperature
std::shared_ptr< array::Scalar > water_column_pressure
std::shared_ptr< array::Scalar > shelf_base_mass_flux
virtual void write_state(const OutputFile &output) const
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