PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
Anomaly.hh
Go to the documentation of this file.
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 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 _PAANOMALY_H_
20 #define _PAANOMALY_H_
21 
22 #include "pism/coupler/AtmosphereModel.hh"
23 
24 namespace pism {
25 namespace atmosphere {
26 
27 //! \brief Reads and uses air_temp and precipitation anomalies from a file.
28 class Anomaly : public AtmosphereModel
29 {
30 public:
31  Anomaly(std::shared_ptr<const Grid> g, std::shared_ptr<AtmosphereModel> in);
32  virtual ~Anomaly() = default;
33 
34 protected:
35  void init_impl(const Geometry &geometry);
36  void update_impl(const Geometry &geometry, double t, double dt);
37 
38  const array::Scalar& precipitation_impl() const;
39  const array::Scalar& air_temperature_impl() const;
40 
41  void init_timeseries_impl(const std::vector<double> &ts) const;
42  void begin_pointwise_access_impl() const;
43  void end_pointwise_access_impl() const;
44  void temp_time_series_impl(int i, int j, std::vector<double> &values) const;
45  void precip_time_series_impl(int i, int j, std::vector<double> &values) const;
46 protected:
47  mutable std::vector<double> m_mass_flux_anomaly, m_temp_anomaly;
48 
49  std::shared_ptr<array::Forcing> m_air_temp_anomaly;
50  std::shared_ptr<array::Forcing> m_precipitation_anomaly;
51 
52  std::shared_ptr<array::Scalar> m_precipitation;
53  std::shared_ptr<array::Scalar> m_temperature;
54 };
55 
56 } // end of namespace atmosphere
57 } // end of namespace pism
58 
59 #endif /* _PAANOMALY_H_ */
std::shared_ptr< array::Forcing > m_air_temp_anomaly
Definition: Anomaly.hh:49
std::shared_ptr< array::Scalar > m_temperature
Definition: Anomaly.hh:53
std::vector< double > m_mass_flux_anomaly
Definition: Anomaly.hh:47
void init_timeseries_impl(const std::vector< double > &ts) const
Definition: Anomaly.cc:126
const array::Scalar & precipitation_impl() const
Definition: Anomaly.cc:106
std::shared_ptr< array::Forcing > m_precipitation_anomaly
Definition: Anomaly.hh:50
void temp_time_series_impl(int i, int j, std::vector< double > &values) const
Definition: Anomaly.cc:134
void end_pointwise_access_impl() const
Definition: Anomaly.cc:120
void init_impl(const Geometry &geometry)
Definition: Anomaly.cc:68
std::shared_ptr< array::Scalar > m_precipitation
Definition: Anomaly.hh:52
void precip_time_series_impl(int i, int j, std::vector< double > &values) const
Definition: Anomaly.cc:145
void begin_pointwise_access_impl() const
Definition: Anomaly.cc:114
virtual ~Anomaly()=default
void update_impl(const Geometry &geometry, double t, double dt)
Definition: Anomaly.cc:84
const array::Scalar & air_temperature_impl() const
Definition: Anomaly.cc:110
std::vector< double > m_temp_anomaly
Definition: Anomaly.hh:47
Anomaly(std::shared_ptr< const Grid > g, std::shared_ptr< AtmosphereModel > in)
Definition: Anomaly.cc:29
Reads and uses air_temp and precipitation anomalies from a file.
Definition: Anomaly.hh:29
A purely virtual class defining the interface of a PISM Atmosphere Model.
static const double g
Definition: exactTestP.cc:36