PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Delta_SL_2D.cc
Go to the documentation of this file.
1// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 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/sea_level/Delta_SL_2D.hh"
20
21#include "pism/util/Grid.hh"
22#include "pism/coupler/util/options.hh"
23#include "pism/util/array/Forcing.hh"
24#include "pism/util/Logger.hh"
25#include "pism/util/io/IO_Flags.hh"
26
27namespace pism {
28namespace ocean {
29namespace sea_level {
30
31Delta_SL_2D::Delta_SL_2D(std::shared_ptr<const Grid> grid, std::shared_ptr<SeaLevel> in)
32 : SeaLevel(grid, in) {
33
34 ForcingOptions opt(*m_grid->ctx(), "ocean.delta_sl_2d");
35
36 {
37 unsigned int buffer_size = m_config->get_number("input.forcing.buffer_size");
38
40
41 m_forcing = std::make_shared<array::Forcing>(m_grid,
42 file,
43 "delta_SL",
44 "", // no standard name
45 buffer_size,
46 opt.periodic,
47 LINEAR);
48 m_forcing->metadata(0)
49 .long_name("two-dimensional sea level offsets")
50 .units("meters");
51 }
52}
53
54void Delta_SL_2D::init_impl(const Geometry &geometry) {
55
56 m_input_model->init(geometry);
57
58 ForcingOptions opt(*m_grid->ctx(), "ocean.delta_sl_2d");
59
60 m_log->message(2, "* Initializing 2D sea level forcing...\n");
61 m_log->message(2, " reading anomalies from %s ...\n", opt.filename.c_str());
62
63 m_forcing->init(opt.filename, opt.periodic);
64}
65
66void Delta_SL_2D::update_impl(const Geometry &geometry, double t, double dt) {
67 m_input_model->update(geometry, t, dt);
68
69 m_forcing->update(t, dt);
70 m_forcing->average(t, dt);
71
72 m_input_model->elevation().add(1.0, *m_forcing, m_sea_level);
73}
74
75} // end of namespace sea_level
76} // end of namespace ocean
77} // 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
High-level PISM I/O class.
Definition File.hh:57
void init_impl(const Geometry &geometry)
Delta_SL_2D(std::shared_ptr< const Grid > g, std::shared_ptr< SeaLevel > in)
std::shared_ptr< array::Forcing > m_forcing
void update_impl(const Geometry &geometry, double t, double dt)
std::shared_ptr< SeaLevel > m_input_model
Definition SeaLevel.hh:61
@ PISM_NETCDF3
Definition IO_Flags.hh:58
@ PISM_READONLY
open an existing file for reading only
Definition IO_Flags.hh:69
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition Mask.hh:40
std::string filename
Definition options.hh:33