PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Delta_MBP.cc
Go to the documentation of this file.
1/* Copyright (C) 2021, 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/Delta_MBP.hh"
21#include "pism/util/ScalarForcing.hh"
22#include "pism/geometry/Geometry.hh"
23#include "pism/util/Logger.hh"
24
25namespace pism {
26namespace ocean {
27
28Delta_MBP::Delta_MBP(std::shared_ptr<const Grid> g, std::shared_ptr<OceanModel> in)
29 : OceanModel(g, in) {
30
31 m_forcing.reset(new ScalarForcing(*g->ctx(),
32 "ocean.delta_MBP",
33 "delta_MBP",
34 "Pa", "Pa",
35 "melange back pressure"));
36
38}
39
41 // empty
42}
43
44void Delta_MBP::init_impl(const Geometry &geometry) {
45
46 m_input_model->init(geometry);
47
48 m_log->message(2,
49 "* Initializing melange back pressure forcing using scalar offsets...\n");
50}
51
52void Delta_MBP::update_impl(const Inputs &inputs, double t, double dt) {
53 m_input_model->update(inputs, t, dt);
54
55 const auto &geometry = *inputs.geometry;
56
57 double
58 melange_thickness = m_config->get_number("ocean.delta_MBP.melange_thickness"),
59 dP_melange = m_forcing->value(t + 0.5 * dt);
60
61 const auto &P = m_input_model->average_water_column_pressure();
62 const auto &H = geometry.ice_thickness;
63 auto &P_new = *m_water_column_pressure;
64 array::AccessScope list{&P, &H, &P_new};
65
66 for (auto p : m_grid->points()) {
67 const int i = p.i(), j = p.j();
68
69 double dP = H(i, j) > 0.0 ? (melange_thickness * dP_melange) / H(i, j) : 0.0;
70
71 P_new(i, j) = P(i, j) + dP;
72 }
73}
74
78
79
80} // end of namespace ocean
81} // end of namespace pism
std::shared_ptr< const Config > m_config
configuration database used by this component
Definition Component.hh:160
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition Component.hh:158
std::shared_ptr< const Logger > m_log
logger (for easy access)
Definition Component.hh:164
array::Scalar2 ice_thickness
Definition Geometry.hh:51
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition Array.hh:66
const array::Scalar & average_water_column_pressure_impl() const
Definition Delta_MBP.cc:75
Delta_MBP(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > in)
Definition Delta_MBP.cc:28
void init_impl(const Geometry &geometry)
Definition Delta_MBP.cc:44
void update_impl(const Inputs &inputs, double t, double dt)
Definition Delta_MBP.cc:52
std::unique_ptr< ScalarForcing > m_forcing
Definition Delta_MBP.hh:47
std::shared_ptr< OceanModel > m_input_model
Definition OceanModel.hh:77
std::shared_ptr< array::Scalar > m_water_column_pressure
Definition OceanModel.hh:78
static std::shared_ptr< array::Scalar > allocate_water_column_pressure(std::shared_ptr< const Grid > g)
Definition OceanModel.cc:49
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
static const double g
Definition exactTestP.cc:36
const Geometry * geometry
Definition OceanModel.hh:34