PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Frac_MBP.cc
Go to the documentation of this file.
1/* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 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/Frac_MBP.hh"
21#include "pism/geometry/Geometry.hh"
22#include "pism/util/ScalarForcing.hh"
23#include "pism/util/Logger.hh"
24
25namespace pism {
26namespace ocean {
27
28Frac_MBP::Frac_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.frac_MBP",
33 "frac_MBP",
34 "1", "1",
35 "melange back pressure fraction"));
36
38}
39
41 // empty
42}
43
44void Frac_MBP::init_impl(const Geometry &geometry) {
45
46 m_input_model->init(geometry);
47
48 m_log->message(2,
49 "* Initializing melange back pressure fraction forcing...\n");
50}
51
52
53/*!
54 * Modify water column pressure using a scalar factor `\lambda`
55 *
56 * We assume that the "melange back pressure" `P_m = \lambda (P_i - P_o)`, where `P_i` is
57 * the vertically-integrated cryostatic pressure of an ice column and, similarly, `P_o` is
58 * the vertically-integrated pressure of a water column and `\lambda \in [0, 1]`.
59 *
60 * Then the modified integrated water column pressure is
61 *
62 * `P_o^{*} = P_o + P_m`.
63 */
64void Frac_MBP::update_impl(const Inputs &inputs, double t, double dt) {
65 m_input_model->update(inputs, t, dt);
66
67 m_water_column_pressure->copy_from(m_input_model->average_water_column_pressure());
68
69 const auto &geometry = *inputs.geometry;
70
71 double
72 lambda = m_forcing->value(t + 0.5 * dt),
73 ice_density = m_config->get_number("constants.ice.density"),
74 g = m_config->get_number("constants.standard_gravity");
75
77
78 array::AccessScope list{&P_o, &geometry.ice_thickness};
79
80 for (auto p : m_grid->points()) {
81 const int i = p.i(), j = p.j();
82
83 double
84 P_i = 0.5 * ice_density * g * geometry.ice_thickness(i, j), // vertical average
85 P_m = lambda * (P_i - P_o(i, j));
86
87 P_o(i, j) += P_m;
88 }
89}
90
94
95
96} // end of namespace ocean
97} // 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
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition Array.hh:66
Frac_MBP(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > in)
Definition Frac_MBP.cc:28
std::unique_ptr< ScalarForcing > m_forcing
Definition Frac_MBP.hh:48
void init_impl(const Geometry &geometry)
Definition Frac_MBP.cc:44
void update_impl(const Inputs &inputs, double t, double dt)
Definition Frac_MBP.cc:64
const array::Scalar & average_water_column_pressure_impl() const
Definition Frac_MBP.cc:91
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