PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
SteadyState.hh
Go to the documentation of this file.
1 /* Copyright (C) 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 #ifndef STEADY_STATE_H
21 #define STEADY_STATE_H
22 
23 #include "pism/hydrology/NullTransport.hh"
24 
25 namespace pism {
26 namespace hydrology {
27 
28 class EmptyingProblem;
29 
30 /*!
31  * A version of the "null-transport" hydrology model that adds the steady state water
32  * flux.
33  */
34 class SteadyState : public NullTransport {
35 public:
36  SteadyState(std::shared_ptr<const Grid> g);
37  virtual ~SteadyState() = default;
38 
39 protected:
40  void initialization_message() const;
41 
42  void init_time(const std::string &input_file);
43 
44  void init_impl(const array::Scalar &W_till, const array::Scalar &W, const array::Scalar &P);
45 
46  void bootstrap_impl(const File &input_file,
47  const array::Scalar &ice_thickness);
48  void restart_impl(const File &input_file, int record);
49 
50  void update_impl(double t, double dt, const Inputs& inputs);
51 
52  std::map<std::string, Diagnostic::Ptr> diagnostics_impl() const;
53 
54  MaxTimestep max_timestep_impl(double t) const;
55  void define_model_state_impl(const File &output) const;
56  void write_model_state_impl(const File &output) const;
57 
58  std::shared_ptr<EmptyingProblem> m_emptying_problem;
59 
60  //! time of the last water flux update
61  double m_t_last;
62  //! Update interval in seconds
64  //! Temporal resolution to use when checking whether it's time to update
65  double m_t_eps;
66  //! Name of the variable used to store the last update time.
67  std::string m_time_name;
68 
69  //! Times corresponding to records in the input file
70  std::vector<double> m_time;
71  //! Time bounds corresponding to records in the input file
72  std::vector<double> m_time_bounds;
73 
74  //! Set to true in bootstrap_impl() if update_impl() has to bootstrap m_Q.
76 };
77 
78 } // end of namespace hydrology
79 } // end of namespace pism
80 
81 #endif /* STEADY_STATE_H */
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
double m_update_interval
Update interval in seconds.
Definition: SteadyState.hh:63
virtual ~SteadyState()=default
void init_time(const std::string &input_file)
Definition: SteadyState.cc:283
void write_model_state_impl(const File &output) const
The default (empty implementation).
Definition: SteadyState.cc:204
double m_t_last
time of the last water flux update
Definition: SteadyState.hh:61
void update_impl(double t, double dt, const Inputs &inputs)
Solves an implicit step of a highly-simplified ODE.
Definition: SteadyState.cc:80
std::vector< double > m_time_bounds
Time bounds corresponding to records in the input file.
Definition: SteadyState.hh:72
MaxTimestep max_timestep_impl(double t) const
Definition: SteadyState.cc:110
std::string m_time_name
Name of the variable used to store the last update time.
Definition: SteadyState.hh:67
void restart_impl(const File &input_file, int record)
Definition: SteadyState.cc:211
bool m_bootstrap
Set to true in bootstrap_impl() if update_impl() has to bootstrap m_Q.
Definition: SteadyState.hh:75
std::map< std::string, Diagnostic::Ptr > diagnostics_impl() const
Definition: SteadyState.cc:104
std::shared_ptr< EmptyingProblem > m_emptying_problem
Definition: SteadyState.hh:58
void define_model_state_impl(const File &output) const
The default (empty implementation).
Definition: SteadyState.cc:189
std::vector< double > m_time
Times corresponding to records in the input file.
Definition: SteadyState.hh:70
void initialization_message() const
Definition: SteadyState.cc:53
SteadyState(std::shared_ptr< const Grid > g)
Definition: SteadyState.cc:58
void bootstrap_impl(const File &input_file, const array::Scalar &ice_thickness)
Definition: SteadyState.cc:230
void init_impl(const array::Scalar &W_till, const array::Scalar &W, const array::Scalar &P)
Definition: SteadyState.cc:266
double m_t_eps
Temporal resolution to use when checking whether it's time to update.
Definition: SteadyState.hh:65
static const double g
Definition: exactTestP.cc:36