PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
TemperatureIndex.hh
Go to the documentation of this file.
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021, 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 #ifndef _PSTEMPERATUREINDEX_H_
20 #define _PSTEMPERATUREINDEX_H_
21 
22 #include <memory>
23 
24 #include "pism/coupler/SurfaceModel.hh"
25 #include "pism/coupler/surface/localMassBalance.hh"
26 
27 namespace pism {
28 namespace surface {
29 
30 //! @brief A class implementing a temperature-index (positive degree-day) scheme
31 //! to compute melt and runoff, and thus surface mass balance, from
32 //! precipitation and air temperature.
33 /*!
34  Temperature-index schemes are far from perfect as a way of modeling surface mass
35  balance on ice sheets which experience surface melt, but they are known to have
36  reasonable data requirements and to do a good job when tuned appropriately
37  [@ref Hock05].
38 */
40 public:
41  TemperatureIndex(std::shared_ptr<const Grid> g, std::shared_ptr<atmosphere::AtmosphereModel> input);
42  virtual ~TemperatureIndex() = default;
43 
44  // diagnostics (for the last time step)
45  const array::Scalar& firn_depth() const;
46  const array::Scalar& snow_depth() const;
47  // these represent totals (not rates) over the time step
48  const array::Scalar& air_temp_sd() const;
49 
50 protected:
51  virtual void init_impl(const Geometry &geometry);
52  virtual void update_impl(const Geometry &geometry, double t, double dt);
53  virtual MaxTimestep max_timestep_impl(double t) const;
54 
55  virtual void define_model_state_impl(const File &output) const;
56  virtual void write_model_state_impl(const File &output) const;
57 
58  virtual DiagnosticList diagnostics_impl() const;
59 
60  virtual const array::Scalar& mass_flux_impl() const;
61  virtual const array::Scalar& temperature_impl() const;
62 
63  virtual const array::Scalar& accumulation_impl() const;
64  virtual const array::Scalar& melt_impl() const;
65  virtual const array::Scalar& runoff_impl() const;
66 
68 protected:
69  //! mass balance scheme to use
70 
71  std::unique_ptr<LocalMassBalance> m_mbscheme;
72 
73  //! if not NULL then user wanted fausto PDD stuff
74  std::unique_ptr<FaustoGrevePDDObject> m_faustogreve;
75 
76  //! holds degree-day factors in location-independent case
78 
79  //! K; daily amount of randomness
81 
83 
84  //! cached surface mass balance rate
86 
87  std::shared_ptr<array::Scalar> m_temperature;
88 
89  //! firn depth
91 
92  //! snow depth (reset once a year)
94 
95  //! standard deviation of the daily variability of the air temperature
96  std::shared_ptr<array::Forcing> m_air_temp_sd;
97 
98  //! total accumulation during the last time step
99  std::shared_ptr<array::Scalar> m_accumulation;
100 
101  //! total melt during the last time step
102  std::shared_ptr<array::Scalar> m_melt;
103 
104  //! total runoff during the last time step
105  std::shared_ptr<array::Scalar> m_runoff;
106 
109 };
110 
111 } // end of namespace surface
112 } // end of namespace pism
113 
114 #endif /* _PSTEMPERATUREINDEX_H_ */
const Time & time() const
Definition: Component.cc:109
High-level PISM I/O class.
Definition: File.hh:56
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Definition: MaxTimestep.hh:31
The interface of PISM's surface models.
Definition: SurfaceModel.hh:42
std::shared_ptr< array::Scalar > m_accumulation
total accumulation during the last time step
virtual const array::Scalar & accumulation_impl() const
virtual void init_impl(const Geometry &geometry)
virtual const array::Scalar & runoff_impl() const
virtual void update_impl(const Geometry &geometry, double t, double dt)
virtual const array::Scalar & melt_impl() const
virtual const array::Scalar & mass_flux_impl() const
const array::Scalar & snow_depth() const
array::Scalar m_snow_depth
snow depth (reset once a year)
virtual const array::Scalar & temperature_impl() const
std::shared_ptr< array::Forcing > m_air_temp_sd
standard deviation of the daily variability of the air temperature
std::unique_ptr< FaustoGrevePDDObject > m_faustogreve
if not NULL then user wanted fausto PDD stuff
const array::Scalar & air_temp_sd() const
double compute_next_balance_year_start(double time)
virtual MaxTimestep max_timestep_impl(double t) const
virtual ~TemperatureIndex()=default
double m_base_pddStdDev
K; daily amount of randomness.
array::Scalar m_mass_flux
cached surface mass balance rate
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
std::shared_ptr< array::Scalar > m_runoff
total runoff during the last time step
array::Scalar m_firn_depth
firn depth
std::shared_ptr< array::Scalar > m_melt
total melt during the last time step
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
std::shared_ptr< array::Scalar > m_temperature
virtual DiagnosticList diagnostics_impl() const
TemperatureIndex(std::shared_ptr< const Grid > g, std::shared_ptr< atmosphere::AtmosphereModel > input)
std::unique_ptr< LocalMassBalance > m_mbscheme
mass balance scheme to use
const array::Scalar & firn_depth() const
LocalMassBalance::DegreeDayFactors m_base_ddf
holds degree-day factors in location-independent case
A class implementing a temperature-index (positive degree-day) scheme to compute melt and runoff,...
static const double g
Definition: exactTestP.cc:36
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125
A struct which holds degree day factors.