PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Constant.cc
Go to the documentation of this file.
1// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021, 2022, 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#include "pism/coupler/ocean/Constant.hh"
20
21#include "pism/util/Config.hh"
22#include "pism/util/Grid.hh"
23#include "pism/util/MaxTimestep.hh"
24#include "pism/geometry/Geometry.hh"
25#include "pism/util/Logger.hh"
26
27namespace pism {
28namespace ocean {
29
30Constant::Constant(std::shared_ptr<const Grid> g)
32 // empty
33}
34
35void Constant::update_impl(const Inputs &inputs, double t, double dt) {
36 (void) t;
37 (void) dt;
38
39 const double
40 melt_rate = m_config->get_number("ocean.constant.melt_rate", "m second-1"),
41 ice_density = m_config->get_number("constants.ice.density"),
42 water_density = m_config->get_number("constants.sea_water.density"),
43 g = m_config->get_number("constants.standard_gravity"),
44 mass_flux = melt_rate * ice_density;
45
47
48 m_shelf_base_mass_flux->set(mass_flux);
49
50 compute_average_water_column_pressure(*inputs.geometry, ice_density, water_density, g,
52}
53
54void Constant::init_impl(const Geometry &geometry) {
55 (void) geometry;
56
57 m_log->message(2, "* Initializing the constant ocean model...\n");
58 m_log->message(2, " Sub-shelf melt rate set to %f m/year.\n",
59 m_config->get_number("ocean.constant.melt_rate", "m year-1"));
60
61 double
62 ice_density = m_config->get_number("constants.ice.density"),
63 water_density = m_config->get_number("constants.sea_water.density"),
64 g = m_config->get_number("constants.standard_gravity");
65
66 compute_average_water_column_pressure(geometry, ice_density, water_density, g,
68}
69
71 (void) t;
72 return MaxTimestep("ocean constant");
73}
74
75/*!
76 * Compute melting point temperature of ice at the depth `depth`.
77 */
79 array::Scalar &result) const {
80 const double
81 T0 = m_config->get_number("constants.fresh_water.melting_point_temperature"),
82 beta_CC = m_config->get_number("constants.ice.beta_Clausius_Clapeyron"),
83 g = m_config->get_number("constants.standard_gravity"),
84 ice_density = m_config->get_number("constants.ice.density");
85
86 array::AccessScope list{&depth, &result};
87
88 for (auto p : m_grid->points()) {
89 const int i = p.i(), j = p.j();
90 const double pressure = ice_density * g * depth(i, j); // FIXME issue #15
91
92 result(i, j) = T0 - beta_CC * pressure;
93 }
94}
95
96} // end of namespape 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
array::Scalar2 ice_thickness
Definition Geometry.hh:51
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
Definition Array.hh:66
std::shared_ptr< array::Scalar > m_shelf_base_mass_flux
std::shared_ptr< array::Scalar > m_shelf_base_temperature
MaxTimestep max_timestep_impl(double t) const
Definition Constant.cc:70
void update_impl(const Inputs &inputs, double t, double dt)
Definition Constant.cc:35
void init_impl(const Geometry &geometry)
Definition Constant.cc:54
Constant(std::shared_ptr< const Grid > g)
Definition Constant.cc:30
void melting_point_temperature(const array::Scalar &depth, array::Scalar &result) const
Definition Constant.cc:78
std::shared_ptr< array::Scalar > m_water_column_pressure
Definition OceanModel.hh:78
static const double beta_CC
Definition exactTestO.c:23
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition Mask.hh:40
void compute_average_water_column_pressure(const Geometry &geometry, double ice_density, double water_density, double standard_gravity, array::Scalar &result)
static const double g
Definition exactTestP.cc:36
const Geometry * geometry
Definition OceanModel.hh:34