ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2023 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  {
48  using namespace dealii;
49 
57  {
68  HeatingModelOutputs (const unsigned int n_points,
69  const unsigned int n_comp);
70 
78  std::vector<double> heating_source_terms;
79 
99  std::vector<double> rates_of_temperature_change;
100 
105  std::vector<double> lhs_latent_heat_terms;
106 
112  void
113  reset ();
114  };
115 
121  template <int dim>
123  {
124  public:
137  virtual
138  void
139  evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
140  const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs,
141  HeatingModel::HeatingModelOutputs &heating_model_outputs) const = 0;
142 
149  virtual
150  void
151  create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const;
152 
159  virtual
160  void
161  create_additional_material_model_inputs(MaterialModel::MaterialModelInputs<dim> &inputs) const;
162  };
163 
164 
171  template <int dim>
172  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
173  {
174  public:
179  bool
180  adiabatic_heating_enabled() const;
181 
186  bool
187  shear_heating_enabled() const;
188 
193  static
194  void
195  declare_parameters (ParameterHandler &prm);
196 
197 
203  void
204  parse_parameters (ParameterHandler &prm) override;
205 
211  void
212  evaluate (const MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
213  const MaterialModel::MaterialModelOutputs<dim> &material_model_outputs,
214  HeatingModel::HeatingModelOutputs &heating_model_outputs) const;
215 
221  virtual
222  void
223  create_additional_material_model_inputs_and_outputs(MaterialModel::MaterialModelInputs<dim> &material_model_inputs,
224  MaterialModel::MaterialModelOutputs<dim> &material_model_outputs) const;
225 
226 
246  static
247  void
248  register_heating_model (const std::string &name,
249  const std::string &description,
250  void (*declare_parameters_function) (ParameterHandler &),
251  std::unique_ptr<Interface<dim>> (*factory_function) ());
252 
253 
262  const std::vector<std::string> &
263  get_active_heating_model_names () const;
264 
273  const std::list<std::unique_ptr<Interface<dim>>> &
274  get_active_heating_models () const;
275 
290  template <typename HeatingModelType,
291  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
293  bool
294  has_matching_heating_model () const;
295 
312  template <typename HeatingModelType,
313  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,HeatingModelType>::value>>
315  const HeatingModelType &
316  get_matching_heating_model () const;
317 
318 
328  static
329  void
330  write_plugin_graph (std::ostream &output_stream);
331 
335  DeclException1 (ExcHeatingModelNameNotFound,
336  std::string,
337  << "Could not find entry <"
338  << arg1
339  << "> among the names of registered heating model objects.");
340  };
341 
342 
343 
344  template <int dim>
345  template <typename HeatingModelType, typename>
346  inline
347  bool
349  {
350  return this->template has_matching_active_plugin<HeatingModelType>();
351  }
352 
353 
354  template <int dim>
355  template <typename HeatingModelType, typename>
356  inline
357  const HeatingModelType &
359  {
360  return this->template get_matching_active_plugin<HeatingModelType>();
361  }
362 
363 
370  template <int dim>
371  std::string
373 
374 
382 #define ASPECT_REGISTER_HEATING_MODEL(classname,name,description) \
383  template class classname<2>; \
384  template class classname<3>; \
385  namespace ASPECT_REGISTER_HEATING_MODEL_ ## classname \
386  { \
387  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<2>,classname<2>> \
388  dummy_ ## classname ## _2d (&aspect::HeatingModel::Manager<2>::register_heating_model, \
389  name, description); \
390  aspect::internal::Plugins::RegisterHelper<aspect::HeatingModel::Interface<3>,classname<3>> \
391  dummy_ ## classname ## _3d (&aspect::HeatingModel::Manager<3>::register_heating_model, \
392  name, description); \
393  }
394  }
395 }
396 
397 
398 #endif
std::vector< double > heating_source_terms
Definition: interface.h:78
std::vector< double > rates_of_temperature_change
Definition: interface.h:99
DEAL_II_DEPRECATED bool has_matching_heating_model() const
StructuredDataLookup< dim > DEAL_II_DEPRECATED
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()
Definition: compat.h:59
std::vector< double > lhs_latent_heat_terms
Definition: interface.h:105
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:42
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.")