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_boundary_temperature_interface_h
23 #define _aspect_boundary_temperature_interface_h
24 
25 #include <aspect/plugins.h>
27 #include <aspect/utilities.h>
29 
30 #include <deal.II/base/parameter_handler.h>
31 #include <deal.II/distributed/tria.h>
32 
33 #include <boost/core/demangle.hpp>
34 #include <typeinfo>
35 
36 
37 namespace aspect
38 {
39  template <int dim> class SimulatorAccess;
40 
47  namespace BoundaryTemperature
48  {
49  using namespace dealii;
50 
56  template <int dim>
57  class Interface : public Plugins::InterfaceBase
58  {
59  public:
72  virtual
73  double boundary_temperature (const types::boundary_id boundary_indicator,
74  const Point<dim> &position) const = 0;
75 
83  virtual
84  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
85  = std::set<types::boundary_id>()) const = 0;
86 
94  virtual
95  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
96  = std::set<types::boundary_id>()) const = 0;
97  };
98 
99 
105  template <int dim>
106  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
107  {
108  public:
113  static
114  void
115  declare_parameters (ParameterHandler &prm);
116 
122  void
123  parse_parameters (ParameterHandler &prm) override;
124 
130  double
131  boundary_temperature (const types::boundary_id boundary_indicator,
132  const Point<dim> &position) const;
133 
138  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
139  = std::set<types::boundary_id>()) const;
140 
145  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
146  = std::set<types::boundary_id>()) const;
147 
165  static
166  void
167  register_boundary_temperature (const std::string &name,
168  const std::string &description,
169  void (*declare_parameters_function) (ParameterHandler &),
170  std::unique_ptr<Interface<dim>> (*factory_function) ());
171 
172 
180  DEAL_II_DEPRECATED
181  const std::vector<std::string> &
182  get_active_boundary_temperature_names () const;
183 
191  DEAL_II_DEPRECATED
192  const std::list<std::unique_ptr<Interface<dim>>> &
193  get_active_boundary_temperature_conditions () const;
194 
209  template <typename BoundaryTemperatureType,
210  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
211  DEAL_II_DEPRECATED
212  bool
213  has_matching_boundary_temperature_model () const;
214 
231  template <typename BoundaryTemperatureType,
232  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
233  DEAL_II_DEPRECATED
234  const BoundaryTemperatureType &
235  get_matching_boundary_temperature_model () const;
236 
237  /*
238  * Return a set of boundary indicators for which boundary
239  * temperatures are prescribed.
240  */
241  const std::set<types::boundary_id> &
242  get_fixed_temperature_boundary_indicators() const;
243 
244  /*
245  * Return whether Dirichlet boundary conditions will be applied
246  * on parts of the boundaries where material flows out.
247  */
248  bool
249  allows_fixed_temperature_on_outflow_boundaries() const;
250 
260  static
261  void
262  write_plugin_graph (std::ostream &output_stream);
263 
264 
268  DeclException1 (ExcBoundaryTemperatureNameNotFound,
269  std::string,
270  << "Could not find entry <"
271  << arg1
272  << "> among the names of registered boundary temperature objects.");
273  private:
280  std::vector<aspect::Utilities::Operator> model_operators;
281 
286  std::set<types::boundary_id> fixed_temperature_boundary_indicators;
287 
293  };
294 
295 
296 
297  template <int dim>
298  template <typename BoundaryTemperatureType, typename>
299  inline
300  bool
302  {
303  return this->template has_matching_active_plugin<BoundaryTemperatureType>();
304  }
305 
306 
307  template <int dim>
308  template <typename BoundaryTemperatureType, typename>
309  inline
310  const BoundaryTemperatureType &
312  {
313  return this->template get_matching_active_plugin<BoundaryTemperatureType>();
314  }
315 
316 
323  template <int dim>
324  std::string
326 
327 
335 #define ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL(classname, name, description) \
336  template class classname<2>; \
337  template class classname<3>; \
338  namespace ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL_ ## classname \
339  { \
340  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<2>,classname<2>> \
341  dummy_ ## classname ## _2d (&aspect::BoundaryTemperature::Manager<2>::register_boundary_temperature, \
342  name, description); \
343  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<3>,classname<3>> \
344  dummy_ ## classname ## _3d (&aspect::BoundaryTemperature::Manager<3>::register_boundary_temperature, \
345  name, description); \
346  }
347  }
348 }
349 
350 
351 #endif
DEAL_II_DEPRECATED const BoundaryTemperatureType & get_matching_boundary_temperature_model() const
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:280
Definition: compat.h:59
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:42
std::set< types::boundary_id > fixed_temperature_boundary_indicators
Definition: interface.h:286
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.")