PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
Formulas.cc
Go to the documentation of this file.
1 /* Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 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/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(std::shared_ptr<const Grid> grid)
28  : SurfaceModel(grid) {
29 
35 }
36 
38  return *m_mass_flux;
39 }
40 
42  return *m_temperature;
43 }
44 
46  return *m_accumulation;
47 }
48 
50  return *m_melt;
51 }
52 
54  return *m_runoff;
55 }
56 
57 void PSFormulas::define_model_state_impl(const File &output) const {
58  // these are *not* model state, but I want to be able to re-start from a file produced using this
59  // class
60  m_mass_flux->define(output, io::PISM_DOUBLE);
61  m_temperature->define(output, io::PISM_DOUBLE);
62 }
63 
64 void PSFormulas::write_model_state_impl(const File &output) const {
65  // these are *not* model state, but I want to be able to re-start from a file produced using this
66  // class
67  m_mass_flux->write(output);
68  m_temperature->write(output);
69 }
70 
71 } // end of namespace surface
72 } // end of namespace pism
std::shared_ptr< const Grid > grid() const
Definition: Component.cc:105
High-level PISM I/O class.
Definition: File.hh:56
std::shared_ptr< array::Scalar > m_temperature
Definition: Formulas.hh:50
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: Formulas.cc:64
const array::Scalar & mass_flux_impl() const
Definition: Formulas.cc:37
const array::Scalar & temperature_impl() const
Definition: Formulas.cc:41
PSFormulas(std::shared_ptr< const Grid > g)
Definition: Formulas.cc:27
const array::Scalar & melt_impl() const
Definition: Formulas.cc:49
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: Formulas.cc:57
const array::Scalar & runoff_impl() const
Definition: Formulas.cc:53
const array::Scalar & accumulation_impl() const
Definition: Formulas.cc:45
std::shared_ptr< array::Scalar > m_mass_flux
Definition: Formulas.hh:49
static std::shared_ptr< array::Scalar > allocate_runoff(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_mass_flux(std::shared_ptr< const Grid > grid)
Definition: SurfaceModel.cc:73
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
static std::shared_ptr< array::Scalar > allocate_accumulation(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_melt(std::shared_ptr< const Grid > grid)
std::shared_ptr< array::Scalar > m_runoff
std::shared_ptr< array::Scalar > m_accumulation
The interface of PISM's surface models.
Definition: SurfaceModel.hh:42
@ PISM_DOUBLE
Definition: IO_Flags.hh:52