PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Simple.cc
Go to the documentation of this file.
1// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 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
20#include "pism/coupler/surface/Simple.hh"
21
22#include "pism/coupler/AtmosphereModel.hh"
23#include "pism/util/Logger.hh"
24
25namespace pism {
26namespace surface {
27
28Simple::Simple(std::shared_ptr<const Grid> g, std::shared_ptr<atmosphere::AtmosphereModel> atmosphere)
29 : SurfaceModel(g, atmosphere) {
30
33}
34
35void Simple::init_impl(const Geometry &geometry) {
36
37 m_atmosphere->init(geometry);
38
39 m_log->message(2,
40 "* Initializing the simplest PISM surface (snow) processes model Simple.\n"
41 " It passes atmospheric state directly to upper ice fluid surface:\n"
42 " surface mass balance := precipitation,\n"
43 " ice upper surface temperature := 2m air temperature.\n");
44}
45
46void Simple::update_impl(const Geometry &geometry, double t, double dt) {
47 if (m_atmosphere) {
48 m_atmosphere->update(geometry, t, dt);
49 }
50
51 m_mass_flux->copy_from(m_atmosphere->precipitation());
52 m_temperature->copy_from(m_atmosphere->air_temperature());
53
57}
58
60 return *m_mass_flux;
61}
62
64 return *m_temperature;
65}
66
70
72 return *m_melt;
73}
74
76 return *m_runoff;
77}
78
79} // end of namespace surface
80} // end of namespace pism
std::shared_ptr< const Logger > m_log
logger (for easy access)
Definition Component.hh:164
const array::Scalar & accumulation_impl() const
Definition Simple.cc:67
Simple(std::shared_ptr< const Grid > g, std::shared_ptr< atmosphere::AtmosphereModel > atmosphere)
Definition Simple.cc:28
const array::Scalar & temperature_impl() const
Definition Simple.cc:63
virtual void update_impl(const Geometry &geometry, double t, double dt)
Definition Simple.cc:46
std::shared_ptr< array::Scalar > m_mass_flux
Definition Simple.hh:54
const array::Scalar & mass_flux_impl() const
Definition Simple.cc:59
std::shared_ptr< array::Scalar > m_temperature
Definition Simple.hh:55
const array::Scalar & melt_impl() const
Definition Simple.cc:71
virtual void init_impl(const Geometry &geometry)
Definition Simple.cc:35
const array::Scalar & runoff_impl() const
Definition Simple.cc:75
std::shared_ptr< atmosphere::AtmosphereModel > m_atmosphere
static std::shared_ptr< array::Scalar > allocate_mass_flux(std::shared_ptr< const Grid > grid)
void dummy_accumulation(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_melt
static std::shared_ptr< array::Scalar > allocate_temperature(std::shared_ptr< const Grid > grid)
std::shared_ptr< array::Scalar > m_runoff
void dummy_melt(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_accumulation
void dummy_runoff(const array::Scalar &smb, array::Scalar &result)
The interface of PISM's surface models.
static const double g
Definition exactTestP.cc:36