PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
Frac_MBP.cc
Go to the documentation of this file.
1 /* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021, 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/Frac_MBP.hh"
21 #include "pism/geometry/Geometry.hh"
22 #include "pism/util/ScalarForcing.hh"
23 
24 namespace pism {
25 namespace ocean {
26 
27 Frac_MBP::Frac_MBP(std::shared_ptr<const Grid> g, std::shared_ptr<OceanModel> in)
28  : OceanModel(g, in) {
29 
30  m_forcing.reset(new ScalarForcing(*g->ctx(),
31  "ocean.frac_MBP",
32  "frac_MBP",
33  "1", "1",
34  "melange back pressure fraction"));
35 
37 }
38 
40  // empty
41 }
42 
43 void Frac_MBP::init_impl(const Geometry &geometry) {
44 
45  m_input_model->init(geometry);
46 
47  m_log->message(2,
48  "* Initializing melange back pressure fraction forcing...\n");
49 }
50 
51 
52 /*!
53  * Modify water column pressure using a scalar factor `\lambda`
54  *
55  * We assume that the "melange back pressure" `P_m = \lambda (P_i - P_o)`, where `P_i` is
56  * the vertically-integrated cryostatic pressure of an ice column and, similarly, `P_o` is
57  * the vertically-integrated pressure of a water column and `\lambda \in [0, 1]`.
58  *
59  * Then the modified integrated water column pressure is
60  *
61  * `P_o^{*} = P_o + P_m`.
62  */
63 void Frac_MBP::update_impl(const Geometry &geometry, double t, double dt) {
64  m_input_model->update(geometry, t, dt);
65 
66  m_water_column_pressure->copy_from(m_input_model->average_water_column_pressure());
67 
68  double
69  lambda = m_forcing->value(t + 0.5 * dt),
70  ice_density = m_config->get_number("constants.ice.density"),
71  g = m_config->get_number("constants.standard_gravity");
72 
74 
75  array::AccessScope list{&P_o, &geometry.ice_thickness};
76 
77  for (auto p = m_grid->points(); p; p.next()) {
78  const int i = p.i(), j = p.j();
79 
80  double
81  P_i = 0.5 * ice_density * g * geometry.ice_thickness(i, j), // vertical average
82  P_m = lambda * (P_i - P_o(i, j));
83 
84  P_o(i, j) += P_m;
85  }
86 }
87 
90 }
91 
92 
93 } // end of namespace ocean
94 } // end of namespace pism
const Config::ConstPtr m_config
configuration database used by this component
Definition: Component.hh:158
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:162
const std::shared_ptr< const Grid > m_grid
grid used by this component
Definition: Component.hh:156
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:65
virtual ~Frac_MBP()
Definition: Frac_MBP.cc:39
Frac_MBP(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > in)
Definition: Frac_MBP.cc:27
void update_impl(const Geometry &geometry, double t, double dt)
Definition: Frac_MBP.cc:63
std::unique_ptr< ScalarForcing > m_forcing
Definition: Frac_MBP.hh:48
void init_impl(const Geometry &geometry)
Definition: Frac_MBP.cc:43
const array::Scalar & average_water_column_pressure_impl() const
Definition: Frac_MBP.cc:88
std::shared_ptr< OceanModel > m_input_model
Definition: OceanModel.hh:72
std::shared_ptr< array::Scalar > m_water_column_pressure
Definition: OceanModel.hh:73
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:33
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition: Mask.hh:40
static const double g
Definition: exactTestP.cc:36