tSimple.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tSimple.cc (2410B)
---
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 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 "Simple.hh"
21
22 #include "pism/coupler/AtmosphereModel.hh"
23
24 namespace pism {
25 namespace surface {
26
27 Simple::Simple(IceGrid::ConstPtr g, std::shared_ptr<atmosphere::AtmosphereModel> atmosphere)
28 : SurfaceModel(g, atmosphere) {
29
30 m_temperature = allocate_temperature(g);
31 m_mass_flux = allocate_mass_flux(g);
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->mean_precipitation());
51 m_temperature->copy_from(m_atmosphere->mean_annual_temp());
52
53 dummy_accumulation(*m_mass_flux, *m_accumulation);
54 dummy_melt(*m_mass_flux, *m_melt);
55 dummy_runoff(*m_mass_flux, *m_runoff);
56 }
57
58 const IceModelVec2S &Simple::mass_flux_impl() const {
59 return *m_mass_flux;
60 }
61
62 const IceModelVec2S &Simple::temperature_impl() const {
63 return *m_temperature;
64 }
65
66 const IceModelVec2S &Simple::accumulation_impl() const {
67 return *m_accumulation;
68 }
69
70 const IceModelVec2S &Simple::melt_impl() const {
71 return *m_melt;
72 }
73
74 const IceModelVec2S &Simple::runoff_impl() const {
75 return *m_runoff;
76 }
77
78 } // end of namespace surface
79 } // end of namespace pism