ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2024 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_heating_model_interface_h
23 #define _aspect_heating_model_interface_h
24 
25 #include <aspect/plugins.h>
28 #include <aspect/utilities.h>
29 
30 #include <deal.II/base/point.h>
31 #include <deal.II/base/parameter_handler.h>
32 
33 #include <boost/core/demangle.hpp>
34 #include <typeinfo>
35 
36 
37 namespace aspect
38 {
39  template <int dim> class SimulatorAccess;
46  namespace HeatingModel
47  {
55  {
66  HeatingModelOutputs (const unsigned int n_points,
67  const unsigned int n_comp);
68 
76  std::vector<double> heating_source_terms;
77 
97  std::vector<double> rates_of_temperature_change;
98 
103  std::vector<double> lhs_latent_heat_terms;
104 
110  void
111  reset ();
112  };
113 
119  template <int dim>
121  {
122  public:
135  virtual
136  void
137  evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
138  const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs,
139  HeatingModel::HeatingModelOutputs &heating_model_outputs) const = 0;
140 
147  virtual
148  void
149  create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const;
150 
157  virtual
158  void
159  create_additional_material_model_inputs(MaterialModel::MaterialModelInputs<dim> &inputs) const;
160  };
161 
162 
169  template <int dim>
170  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
171  {
172  public:
177  bool
178  adiabatic_heating_enabled() const;
179 
184  bool
185  shear_heating_enabled() const;
186 
191  static
192  void
193  declare_parameters (ParameterHandler &prm);
194 
195 
201  void
202  parse_parameters (ParameterHandler &prm) override;
203 
209  void
210  evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
211  const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs,
212  HeatingModel::HeatingModelOutputs &heating_model_outputs) const;
213 
219  virtual
220  void
221  create_additional_material_model_inputs_and_outputs(MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
222  MaterialModel::MaterialModelOutputs<dim> &material_model_outputs) const;
223 
224 
244  static
245  void
246  register_heating_model (const std::string &name,
247  const std::string &description,
248  void (*declare_parameters_function) (ParameterHandler &),
249  std::unique_ptr<Interface<dim>> (*factory_function) ());
250 
251 
259  DEAL_II_DEPRECATED
260  const std::vector<std::string> &
261  get_active_heating_model_names () const;
262 
270  DEAL_II_DEPRECATED
271  const std::list<std::unique_ptr<Interface<dim>>> &
272  get_active_heating_models () const;
273 
288  template <typename HeatingModelType,
289  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
290  DEAL_II_DEPRECATED
291  bool
292  has_matching_heating_model () const;
293 
310  template <typename HeatingModelType,
311  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
312  DEAL_II_DEPRECATED
313  const HeatingModelType &
314  get_matching_heating_model () const;
315 
316 
326  static
327  void
328  write_plugin_graph (std::ostream &output_stream);
329 
333  DeclException1 (ExcHeatingModelNameNotFound,
334  std::string,
335  << "Could not find entry <"
336  << arg1
337  << "> among the names of registered heating model objects.");
338  };
339 
340 
341 
342  template <int dim>
343  template <typename HeatingModelType, typename>
344  inline
345  bool
347  {
348  return this->template has_matching_active_plugin<HeatingModelType>();
349  }
350 
351 
352  template <int dim>
353  template <typename HeatingModelType, typename>
354  inline
355  const HeatingModelType &
357  {
358  return this->template get_matching_active_plugin<HeatingModelType>();
359  }
360 
361 
368  template <int dim>
369  std::string
371 
372 
380 #define ASPECT_REGISTER_HEATING_MODEL(classname,name,description) \
381  template class classname<2>; \
382  template class classname<3>; \
383  namespace ASPECT_REGISTER_HEATING_MODEL_ ## classname \
384  { \
385  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<2>,classname<2>> \
386  dummy_ ## classname ## _2d (&aspect::HeatingModel::Manager<2>::register_heating_model, \
387  name, description); \
388  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<3>,classname<3>> \
389  dummy_ ## classname ## _3d (&aspect::HeatingModel::Manager<3>::register_heating_model, \
390  name, description); \
391  }
392  }
393 }
394 
395 
396 #endif
std::vector< double > heating_source_terms
Definition: interface.h:76
std::vector< double > rates_of_temperature_change
Definition: interface.h:97
DEAL_II_DEPRECATED bool has_matching_heating_model() const
DEAL_II_DEPRECATED const HeatingModelType & get_matching_heating_model() const
void write_plugin_graph(std::ostream &output_stream)
std::string get_valid_model_names_pattern()
HeatingModelOutputs(const unsigned int n_points, const unsigned int n_comp)
Definition: compat.h:59
std::vector< double > lhs_latent_heat_terms
Definition: interface.h:103
void declare_parameters(ParameterHandler &prm)
DeclException1(ProbabilityFunctionNegative, Point< dim >,<< "Your probability density function in the particle generator " "returned a negative probability density for the following position: "<< arg1<< ". Please check your function expression.")