tFormulas.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
---
tFormulas.cc (2241B)
---
1 /* Copyright (C) 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 "Formulas.hh"
21 #include "pism/coupler/AtmosphereModel.hh"
22 #include "pism/util/pism_utilities.hh"
23
24 namespace pism {
25 namespace surface {
26
27 PSFormulas::PSFormulas(IceGrid::ConstPtr grid)
28 : SurfaceModel(grid) {
29
30 m_mass_flux = allocate_mass_flux(grid);
31 m_temperature = allocate_temperature(grid);
32 m_accumulation = allocate_accumulation(grid);
33 m_melt = allocate_melt(grid);
34 m_runoff = allocate_runoff(grid);
35 }
36
37 PSFormulas::~PSFormulas() {
38 // empty
39 }
40
41 const IceModelVec2S &PSFormulas::mass_flux_impl() const {
42 return *m_mass_flux;
43 }
44
45 const IceModelVec2S & PSFormulas::temperature_impl() const {
46 return *m_temperature;
47 }
48
49 const IceModelVec2S &PSFormulas::accumulation_impl() const {
50 return *m_accumulation;
51 }
52
53 const IceModelVec2S &PSFormulas::melt_impl() const {
54 return *m_melt;
55 }
56
57 const IceModelVec2S &PSFormulas::runoff_impl() const {
58 return *m_runoff;
59 }
60
61 void PSFormulas::define_model_state_impl(const File &output) const {
62 // these are *not* model state, but I want to be able to re-start from a file produced using this
63 // class
64 m_mass_flux->define(output);
65 m_temperature->define(output);
66 }
67
68 void PSFormulas::write_model_state_impl(const File &output) const {
69 // these are *not* model state, but I want to be able to re-start from a file produced using this
70 // class
71 m_mass_flux->write(output);
72 m_temperature->write(output);
73 }
74
75 } // end of namespace surface
76 } // end of namespace pism