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