ASPECT
interface.h
Go to the documentation of this file.
1 // ------------------------------------------------------
2 //
3 // SPDX-License-Identifier: GPL-2.0-or-later
4 //
5 // SPDX-FileCopyrightText: Copyright (C) 2011-2026 by the ASPECT authors.
6 //
7 // This file is part of ASPECT.
8 //
9 // Detailed license information governing the source code and
10 // contributions can be found in the folder LICENSES and in
11 // LICENSE and CONTRIBUTING.md at the top level directory.
12 //
13 // ------------------------------------------------------
14 
15 
16 #ifndef _aspect_boundary_temperature_interface_h
17 #define _aspect_boundary_temperature_interface_h
18 
19 #include <aspect/plugins.h>
21 #include <aspect/utilities.h>
23 
26 
27 #include <boost/core/demangle.hpp>
28 #include <typeinfo>
29 
30 
31 namespace aspect
32 {
33  template <int dim> class SimulatorAccess;
34 
41  namespace BoundaryTemperature
42  {
48  template <int dim>
49  class Interface : public Plugins::InterfaceBase
50  {
51  public:
64  virtual
65  double boundary_temperature (const types::boundary_id boundary_indicator,
66  const Point<dim> &position) const = 0;
67 
75  virtual
76  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
77  = std::set<types::boundary_id>()) const = 0;
78 
86  virtual
87  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
88  = std::set<types::boundary_id>()) const = 0;
89  };
90 
91 
97  template <int dim>
98  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
99  {
100  public:
105  static
106  void
108 
114  void
115  parse_parameters (ParameterHandler &prm) override;
116 
122  double
123  boundary_temperature (const types::boundary_id boundary_indicator,
124  const Point<dim> &position) const;
125 
130  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
131  = std::set<types::boundary_id>()) const;
132 
137  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
138  = std::set<types::boundary_id>()) const;
139 
157  static
158  void
159  register_boundary_temperature (const std::string &name,
160  const std::string &description,
161  void (*declare_parameters_function) (ParameterHandler &),
162  std::unique_ptr<Interface<dim>> (*factory_function) ());
163 
164 
173  const std::vector<std::string> &
174  get_active_boundary_temperature_names () const;
175 
184  const std::list<std::unique_ptr<Interface<dim>>> &
185  get_active_boundary_temperature_conditions () const;
186 
201  template <typename BoundaryTemperatureType,
202  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
204  bool
205  has_matching_boundary_temperature_model () const;
206 
223  template <typename BoundaryTemperatureType,
224  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
226  const BoundaryTemperatureType &
227  get_matching_boundary_temperature_model () const;
228 
229  /*
230  * Return a set of boundary indicators for which boundary
231  * temperatures are prescribed.
232  */
233  const std::set<types::boundary_id> &
234  get_fixed_temperature_boundary_indicators() const;
235 
236  /*
237  * Return whether Dirichlet boundary conditions will be applied
238  * on parts of the boundaries where material flows out.
239  */
240  bool
241  allows_fixed_temperature_on_outflow_boundaries() const;
242 
252  static
253  void
254  write_plugin_graph (std::ostream &output_stream);
255 
256 
260  DeclException1 (ExcBoundaryTemperatureNameNotFound,
261  std::string,
262  << "Could not find entry <"
263  << arg1
264  << "> among the names of registered boundary temperature objects.");
265  private:
272  std::vector<aspect::Utilities::Operator> model_operators;
273 
278  std::set<types::boundary_id> fixed_temperature_boundary_indicators;
279 
287  };
288 
289 
290 
291  template <int dim>
292  template <typename BoundaryTemperatureType, typename>
293  inline
294  bool
296  {
297  return this->template has_matching_active_plugin<BoundaryTemperatureType>();
298  }
299 
300 
301  template <int dim>
302  template <typename BoundaryTemperatureType, typename>
303  inline
304  const BoundaryTemperatureType &
306  {
307  return this->template get_matching_active_plugin<BoundaryTemperatureType>();
308  }
309 
310 
317  template <int dim>
318  std::string
320 
321 
329 #define ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL(classname, name, description) \
330  template class classname<2>; \
331  template class classname<3>; \
332  namespace ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL_ ## classname \
333  { \
334  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<2>,classname<2>> \
335  dummy_ ## classname ## _2d (&aspect::BoundaryTemperature::Manager<2>::register_boundary_temperature, \
336  name, description); \
337  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<3>,classname<3>> \
338  dummy_ ## classname ## _3d (&aspect::BoundaryTemperature::Manager<3>::register_boundary_temperature, \
339  name, description); \
340  }
341  }
342 }
343 
344 
345 #endif
virtual void parse_parameters(ParameterHandler &prm)
DEAL_II_DEPRECATED const BoundaryTemperatureType & get_matching_boundary_temperature_model() const
virtual double boundary_temperature(const types::boundary_id boundary_indicator, const Point< dim > &position) const =0
virtual double minimal_temperature(const std::set< types::boundary_id > &fixed_boundary_ids=std::set< types::boundary_id >()) const =0
std::string get_valid_model_names_pattern()
DEAL_II_DEPRECATED bool has_matching_boundary_temperature_model() const
void write_plugin_graph(std::ostream &output_stream)
std::vector< aspect::Utilities::Operator > model_operators
Definition: interface.h:272
virtual double maximal_temperature(const std::set< types::boundary_id > &fixed_boundary_ids=std::set< types::boundary_id >()) const =0
#define DEAL_II_DEPRECATED
unsigned int boundary_id
static void declare_parameters(ParameterHandler &prm)
std::set< types::boundary_id > fixed_temperature_boundary_indicators
Definition: interface.h:278
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.")