Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Runoff_SMB.cc
Go to the documentation of this file.
1// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021, 2022, 2023, 2024 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 <cmath>
20
21#include "pism/coupler/ocean/Runoff_SMB.hh"
22#include "pism/util/ScalarForcing.hh"
23
24namespace pism {
25namespace ocean {
26
27Runoff_SMB::Runoff_SMB(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.runoff_to_ocean_melt",
32 "delta_T",
33 "kelvin",
34 "kelvin",
35 "air temperature offsets"));
36
37 m_temp_to_runoff_a = m_config->get_number("surface.temp_to_runoff_a");
38 m_runoff_to_ocean_melt_b = m_config->get_number("ocean.runoff_to_ocean_melt.b");
39
40 m_runoff_to_ocean_melt_power_alpha = m_config->get_number("ocean.runoff_to_ocean_melt.power_alpha");
41 m_runoff_to_ocean_melt_power_beta = m_config->get_number("ocean.runoff_to_ocean_melt.power_beta");
42
44}
45
47 // empty
48}
49
50void Runoff_SMB::init_impl(const Geometry &geometry) {
51
52 m_input_model->init(geometry);
53
54 m_log->message(2,
55 "* Initializing ice shelf base mass flux forcing using scalar multiplier...\n"
56 "* derived from delta_T air temperature modifier\n");
57}
58
59void Runoff_SMB::update_impl(const Geometry &geometry, double t, double dt) {
60 m_input_model->update(geometry, t, dt);
61
62 mass_flux(m_forcing->value(t + 0.5 * dt), *m_shelf_base_mass_flux);
63}
64
65void Runoff_SMB::mass_flux(double delta_T, array::Scalar &result) const {
66
67 // short-cuts, just to make the formula below easier to read
68 double
73 scale_factor = 1.0;
74
75 /*
76 This parameterization only works if delta_T > 0 because
77 negative numbers cannot be raised to a fractional power
78 so we do not scale the forcing if delta_T < 0
79 */
80 if (delta_T > 0.0) {
81 scale_factor = 1 + B * pow(a * delta_T, alpha) * pow(delta_T, beta);
82 }
83 result.scale(scale_factor);
84}
85
86} // end of namespace ocean
87} // 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
void scale(double alpha)
Result: v <- v * alpha. Calls VecScale.
Definition Array.cc:224
std::shared_ptr< OceanModel > m_input_model
Definition OceanModel.hh:71
static std::shared_ptr< array::Scalar > allocate_shelf_base_mass_flux(std::shared_ptr< const Grid > g)
Definition OceanModel.cc:39
A very rudimentary PISM ocean model.
Definition OceanModel.hh:33
std::unique_ptr< ScalarForcing > m_forcing
Definition Runoff_SMB.hh:76
double m_runoff_to_ocean_melt_power_beta
Definition Runoff_SMB.hh:73
void mass_flux(double delta_T, array::Scalar &result) const
Definition Runoff_SMB.cc:65
double m_runoff_to_ocean_melt_power_alpha
Definition Runoff_SMB.hh:72
std::shared_ptr< array::Scalar > m_shelf_base_mass_flux
Definition Runoff_SMB.hh:75
void update_impl(const Geometry &geometry, double t, double dt)
Definition Runoff_SMB.cc:59
Runoff_SMB(std::shared_ptr< const Grid > g, std::shared_ptr< OceanModel > in)
Definition Runoff_SMB.cc:27
void init_impl(const Geometry &geometry)
Definition Runoff_SMB.cc:50
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition Mask.hh:40
static const double g
Definition exactTestP.cc:36