ASPECT
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
165  virtual
167  get_required_properties() const;
168  };
169 
170 
177  template <int dim>
178  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
179  {
180  public:
185  bool
186  adiabatic_heating_enabled() const;
187 
192  bool
193  shear_heating_enabled() const;
194 
199  static
200  void
201  declare_parameters (ParameterHandler &prm);
202 
203 
209  void
210  parse_parameters (ParameterHandler &prm) override;
211 
217  void
218  evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
219  const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs,
220  HeatingModel::HeatingModelOutputs &heating_model_outputs) const;
221 
227  virtual
228  void
229  create_additional_material_model_inputs_and_outputs(MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
230  MaterialModel::MaterialModelOutputs<dim> &material_model_outputs) const;
231 
232 
252  static
253  void
254  register_heating_model (const std::string &name,
255  const std::string &description,
256  void (*declare_parameters_function) (ParameterHandler &),
257  std::unique_ptr<Interface<dim>> (*factory_function) ());
258 
259 
267  DEAL_II_DEPRECATED
268  const std::vector<std::string> &
269  get_active_heating_model_names () const;
270 
278  DEAL_II_DEPRECATED
279  const std::list<std::unique_ptr<Interface<dim>>> &
280  get_active_heating_models () const;
281 
296  template <typename HeatingModelType,
297  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
298  DEAL_II_DEPRECATED
299  bool
300  has_matching_heating_model () const;
301 
318  template <typename HeatingModelType,
319  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
320  DEAL_II_DEPRECATED
321  const HeatingModelType &
322  get_matching_heating_model () const;
323 
324 
334  static
335  void
336  write_plugin_graph (std::ostream &output_stream);
337 
341  DeclException1 (ExcHeatingModelNameNotFound,
342  std::string,
343  << "Could not find entry <"
344  << arg1
345  << "> among the names of registered heating model objects.");
346  };
347 
348 
349 
350  template <int dim>
351  template <typename HeatingModelType, typename>
352  inline
353  bool
355  {
356  return this->template has_matching_active_plugin<HeatingModelType>();
357  }
358 
359 
360  template <int dim>
361  template <typename HeatingModelType, typename>
362  inline
363  const HeatingModelType &
365  {
366  return this->template get_matching_active_plugin<HeatingModelType>();
367  }
368 
369 
376  template <int dim>
377  std::string
379 
380 
388 #define ASPECT_REGISTER_HEATING_MODEL(classname,name,description) \
389  template class classname<2>; \
390  template class classname<3>; \
391  namespace ASPECT_REGISTER_HEATING_MODEL_ ## classname \
392  { \
393  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<2>,classname<2>> \
394  dummy_ ## classname ## _2d (&aspect::HeatingModel::Manager<2>::register_heating_model, \
395  name, description); \
396  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<3>,classname<3>> \
397  dummy_ ## classname ## _3d (&aspect::HeatingModel::Manager<3>::register_heating_model, \
398  name, description); \
399  }
400  }
401 }
402 
403 
404 #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)
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.")