PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
Delta_SL.cc
Go to the documentation of this file.
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 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 #include "pism/coupler/ocean/sea_level/Delta_SL.hh"
20 #include "pism/util/ScalarForcing.hh"
21 
22 namespace pism {
23 namespace ocean {
24 namespace sea_level {
25 
26 Delta_SL::Delta_SL(std::shared_ptr<const Grid> grid, std::shared_ptr<SeaLevel> in)
27  : SeaLevel(grid, in) {
28 
29  m_forcing.reset(new ScalarForcing(*grid->ctx(),
30  "ocean.delta_sl", "delta_SL",
31  "m", "m",
32  "sea level elevation offsets"));
33 }
34 
36  // empty
37 }
38 
39 void Delta_SL::init_impl(const Geometry &geometry) {
40 
41  m_input_model->init(geometry);
42 
43  m_log->message(2, "* Initializing scalar sea level forcing...\n");
44 }
45 
46 void Delta_SL::update_impl(const Geometry &geometry, double t, double dt) {
47  m_input_model->update(geometry, t, dt);
48 
49  m_sea_level.copy_from(m_input_model->elevation());
50  m_sea_level.shift(m_forcing->value(t + 0.5 * dt));
51 }
52 
53 } // end of namespace sea_level
54 } // end of namespace ocean
55 } // end of namespace pism
std::shared_ptr< const Grid > grid() const
Definition: Component.cc:105
const Logger::ConstPtr m_log
logger (for easy access)
Definition: Component.hh:162
void copy_from(const Array2D< T > &source)
Definition: Array2D.hh:73
void shift(double alpha)
Result: v[j] <- v[j] + alpha for all j. Calls VecShift.
Definition: Array.cc:245
Delta_SL(std::shared_ptr< const Grid > grid, std::shared_ptr< SeaLevel > in)
Definition: Delta_SL.cc:26
void update_impl(const Geometry &geometry, double t, double dt)
Definition: Delta_SL.cc:46
std::unique_ptr< ScalarForcing > m_forcing
Definition: Delta_SL.hh:40
void init_impl(const Geometry &geometry)
Definition: Delta_SL.cc:39
std::shared_ptr< SeaLevel > m_input_model
Definition: SeaLevel.hh:61
bool ocean(int M)
An ocean cell (floating ice or ice-free).
Definition: Mask.hh:40