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  {
54  template <int dim>
55  class Interface : public Plugins::InterfaceBase
56  {
57  public:
70  virtual
71  double boundary_temperature (const types::boundary_id boundary_indicator,
72  const Point<dim> &position) const = 0;
73 
81  virtual
82  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
83  = std::set<types::boundary_id>()) const = 0;
84 
92  virtual
93  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
94  = std::set<types::boundary_id>()) const = 0;
95  };
96 
97 
103  template <int dim>
104  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
105  {
106  public:
111  static
112  void
113  declare_parameters (ParameterHandler &prm);
114 
120  void
121  parse_parameters (ParameterHandler &prm) override;
122 
128  double
129  boundary_temperature (const types::boundary_id boundary_indicator,
130  const Point<dim> &position) const;
131 
136  double minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
137  = std::set<types::boundary_id>()) const;
138 
143  double maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids
144  = std::set<types::boundary_id>()) const;
145 
163  static
164  void
165  register_boundary_temperature (const std::string &name,
166  const std::string &description,
167  void (*declare_parameters_function) (ParameterHandler &),
168  std::unique_ptr<Interface<dim>> (*factory_function) ());
169 
170 
178  DEAL_II_DEPRECATED
179  const std::vector<std::string> &
180  get_active_boundary_temperature_names () const;
181 
189  DEAL_II_DEPRECATED
190  const std::list<std::unique_ptr<Interface<dim>>> &
191  get_active_boundary_temperature_conditions () const;
192 
207  template <typename BoundaryTemperatureType,
208  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
209  DEAL_II_DEPRECATED
210  bool
211  has_matching_boundary_temperature_model () const;
212 
229  template <typename BoundaryTemperatureType,
230  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryTemperatureType>::value>>
231  DEAL_II_DEPRECATED
232  const BoundaryTemperatureType &
233  get_matching_boundary_temperature_model () const;
234 
235  /*
236  * Return a set of boundary indicators for which boundary
237  * temperatures are prescribed.
238  */
239  const std::set<types::boundary_id> &
240  get_fixed_temperature_boundary_indicators() const;
241 
242  /*
243  * Return whether Dirichlet boundary conditions will be applied
244  * on parts of the boundaries where material flows out.
245  */
246  bool
247  allows_fixed_temperature_on_outflow_boundaries() const;
248 
258  static
259  void
260  write_plugin_graph (std::ostream &output_stream);
261 
262 
266  DeclException1 (ExcBoundaryTemperatureNameNotFound,
267  std::string,
268  << "Could not find entry <"
269  << arg1
270  << "> among the names of registered boundary temperature objects.");
271  private:
278  std::vector<aspect::Utilities::Operator> model_operators;
279 
284  std::set<types::boundary_id> fixed_temperature_boundary_indicators;
285 
291  };
292 
293 
294 
295  template <int dim>
296  template <typename BoundaryTemperatureType, typename>
297  inline
298  bool
300  {
301  return this->template has_matching_active_plugin<BoundaryTemperatureType>();
302  }
303 
304 
305  template <int dim>
306  template <typename BoundaryTemperatureType, typename>
307  inline
308  const BoundaryTemperatureType &
310  {
311  return this->template get_matching_active_plugin<BoundaryTemperatureType>();
312  }
313 
314 
321  template <int dim>
322  std::string
324 
325 
333 #define ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL(classname, name, description) \
334  template class classname<2>; \
335  template class classname<3>; \
336  namespace ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL_ ## classname \
337  { \
338  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<2>,classname<2>> \
339  dummy_ ## classname ## _2d (&aspect::BoundaryTemperature::Manager<2>::register_boundary_temperature, \
340  name, description); \
341  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTemperature::Interface<3>,classname<3>> \
342  dummy_ ## classname ## _3d (&aspect::BoundaryTemperature::Manager<3>::register_boundary_temperature, \
343  name, description); \
344  }
345  }
346 }
347 
348 
349 #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:278
Definition: compat.h:59
virtual double maximal_temperature(const std::set< types::boundary_id > &fixed_boundary_ids=std::set< types::boundary_id >()) const =0
static void declare_parameters(ParameterHandler &prm)
std::set< types::boundary_id > fixed_temperature_boundary_indicators
Definition: interface.h:284
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.")