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