ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2019 - 2022 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #ifndef _aspect_time_stepping_interface_h
23 #define _aspect_time_stepping_interface_h
24 
25 #include <aspect/global.h>
28 
29 namespace aspect
30 {
31  using namespace dealii;
32 
36  namespace TimeStepping
37  {
38 
47  enum class Reaction
48  {
64  advance
65  };
66 
71  struct TimeStepInfo
72  {
78 
84  };
85 
91  template <int dim>
93  {
94  public:
103  virtual
104  double
105  execute() = 0;
106 
119  virtual
120  std::pair<Reaction, double>
121  determine_reaction(const TimeStepInfo &info);
122  };
123 
124 
129  template <int dim>
130  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
131  {
132  public:
137  void initialize_simulator (const Simulator<dim> &simulator_object) override;
138 
139 
147  void
148  update() override;
149 
153  double get_next_time_step_size() const;
154 
159  bool should_repeat_time_step() const;
160 
165  bool should_refine_mesh() const;
166 
170  bool need_checkpoint_on_terminate() const;
171 
175  bool should_simulation_terminate_now() const;
176 
181  static
182  void
183  declare_parameters (ParameterHandler &prm);
184 
190  void
191  parse_parameters (ParameterHandler &prm) override;
192 
202  static
203  void
204  write_plugin_graph (std::ostream &output_stream);
205 
224  static
225  void
226  register_time_stepping_model (const std::string &name,
227  const std::string &description,
228  void (*declare_parameters_function) (ParameterHandler &),
229  std::unique_ptr<Interface<dim>> (*factory_function) ());
230 
231  private:
232 
237 
242 
247 
253 
259  };
260 
261 
262 
269 #define ASPECT_REGISTER_TIME_STEPPING_MODEL(classname,name,description) \
270  template class classname<2>; \
271  template class classname<3>; \
272  namespace ASPECT_REGISTER_TIME_STEPPING_MODEL_ ## classname \
273  { \
274  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<2>,classname<2>> \
275  dummy_ ## classname ## _2d (&aspect::TimeStepping::Manager<2>::register_time_stepping_model, \
276  name, description); \
277  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<3>,classname<3>> \
278  dummy_ ## classname ## _3d (&aspect::TimeStepping::Manager<3>::register_time_stepping_model, \
279  name, description); \
280  }
281 
282  }
283 }
284 
285 #endif
TerminationCriteria::Manager< dim > termination_manager
Definition: interface.h:258
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:59
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:42