PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
YearlyCycle.hh
Go to the documentation of this file.
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021, 2022 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 _PAYEARLYCYCLE_H_
20 #define _PAYEARLYCYCLE_H_
21 
22 #include "pism/coupler/AtmosphereModel.hh"
23 
24 namespace pism {
25 namespace atmosphere {
26 
27 //! A class containing an incomplete implementation of an atmosphere model
28 //! based on a temperature parameterization using mean annual and mean
29 //! summer temperatures and a cosine yearly cycle. Uses a stored
30 //! (constant in time) precipitation field.
31 class YearlyCycle : public AtmosphereModel {
32 public:
33  YearlyCycle(std::shared_ptr<const Grid> g);
34  virtual ~YearlyCycle() = default;
35 
36  virtual const array::Scalar& mean_summer_temp() const;
37 
38 protected:
39  virtual void define_model_state_impl(const File &output) const;
40  virtual void write_model_state_impl(const File &output) const;
41 
42  virtual void init_impl(const Geometry &geometry);
43 
44  virtual const array::Scalar& precipitation_impl() const;
45  virtual const array::Scalar& air_temperature_impl() const;
46 
47  virtual void begin_pointwise_access_impl() const;
48  virtual void end_pointwise_access_impl() const;
49 
50  virtual void init_timeseries_impl(const std::vector<double> &ts) const;
51  virtual void temp_time_series_impl(int i, int j, std::vector<double> &result) const;
52  virtual void precip_time_series_impl(int i, int j, std::vector<double> &result) const;
53 
54  virtual void update_impl(const Geometry &geometry, double t, double dt) = 0;
55 
56  virtual DiagnosticList diagnostics_impl() const;
57 protected:
58  void init_internal(const std::string &input_filename, bool regrid,
59  unsigned int start);
60 
62  std::string m_reference;
64  mutable std::vector<double> m_cosine_cycle;
65 };
66 
67 } // end of namespace atmosphere
68 } // end of namespace pism
69 
70 #endif /* _PAYEARLYCYCLE_H_ */
void regrid(const std::string &module_name, array::Array &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)
Definition: Component.cc:159
High-level PISM I/O class.
Definition: File.hh:56
A purely virtual class defining the interface of a PISM Atmosphere Model.
array::Scalar m_air_temp_mean_summer
Definition: YearlyCycle.hh:63
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: YearlyCycle.cc:87
virtual void update_impl(const Geometry &geometry, double t, double dt)=0
void init_internal(const std::string &input_filename, bool regrid, unsigned int start)
Read precipitation data from a given file.
Definition: YearlyCycle.cc:73
YearlyCycle(std::shared_ptr< const Grid > g)
Definition: YearlyCycle.cc:36
virtual const array::Scalar & mean_summer_temp() const
Copies the stored mean summer near-surface air temperature field into result.
Definition: YearlyCycle.cc:106
virtual void init_impl(const Geometry &geometry)
Reads in the precipitation data from the input file.
Definition: YearlyCycle.cc:65
virtual ~YearlyCycle()=default
std::vector< double > m_cosine_cycle
Definition: YearlyCycle.hh:64
virtual void init_timeseries_impl(const std::vector< double > &ts) const
Definition: YearlyCycle.cc:110
virtual void end_pointwise_access_impl() const
Definition: YearlyCycle.cc:147
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: YearlyCycle.cc:91
virtual void begin_pointwise_access_impl() const
Definition: YearlyCycle.cc:141
virtual DiagnosticList diagnostics_impl() const
Definition: YearlyCycle.cc:177
array::Scalar m_air_temp_mean_annual
Definition: YearlyCycle.hh:63
virtual void temp_time_series_impl(int i, int j, std::vector< double > &result) const
Definition: YearlyCycle.cc:134
virtual const array::Scalar & air_temperature_impl() const
Copies the stored mean annual near-surface air temperature field into result.
Definition: YearlyCycle.cc:101
virtual void precip_time_series_impl(int i, int j, std::vector< double > &result) const
Definition: YearlyCycle.cc:127
virtual const array::Scalar & precipitation_impl() const
Copies the stored precipitation field into result.
Definition: YearlyCycle.cc:96
static const double g
Definition: exactTestP.cc:36
std::map< std::string, Diagnostic::Ptr > DiagnosticList
Definition: Diagnostic.hh:125