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) 2013-2025 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_composition_interface_h
17 #define _aspect_boundary_composition_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 {
39  namespace BoundaryComposition
40  {
46  template <int dim>
47  class Interface : public Plugins::InterfaceBase
48  {
49  public:
64  virtual
65  double
66  boundary_composition (const types::boundary_id boundary_indicator,
67  const Point<dim> &position,
68  const unsigned int compositional_field) const = 0;
69  };
70 
76  template <int dim>
77  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
78  {
79  public:
84  static
85  void
87 
93  void
94  parse_parameters (ParameterHandler &prm) override;
95 
101  double
102  boundary_composition (const types::boundary_id boundary_indicator,
103  const Point<dim> &position,
104  const unsigned int compositional_field) const;
105 
123  static
124  void
125  register_boundary_composition (const std::string &name,
126  const std::string &description,
127  void (*declare_parameters_function) (ParameterHandler &),
128  std::unique_ptr<Interface<dim>> (*factory_function) ());
129 
130 
139  const std::vector<std::string> &
140  get_active_boundary_composition_names () const;
141 
150  const std::list<std::unique_ptr<Interface<dim>>> &
151  get_active_boundary_composition_conditions () const;
152 
167  template <typename BoundaryCompositionType,
168  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
170  bool
171  has_matching_boundary_composition_model () const;
172 
189  template <typename BoundaryCompositionType,
190  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
192  const BoundaryCompositionType &
193  get_matching_boundary_composition_model () const;
194 
195  /*
196  * Return a set of boundary indicators for which boundary
197  * compositions are prescribed.
198  */
199  const std::set<types::boundary_id> &
200  get_fixed_composition_boundary_indicators() const;
201 
202  /*
203  * Return whether Dirichlet boundary conditions will be applied
204  * on parts of the boundaries where material flows out.
205  */
206  bool
207  allows_fixed_composition_on_outflow_boundaries() const;
208 
218  static
219  void
220  write_plugin_graph (std::ostream &output_stream);
221 
222 
226  DeclException1 (ExcBoundaryCompositionNameNotFound,
227  std::string,
228  << "Could not find entry <"
229  << arg1
230  << "> among the names of registered boundary composition objects.");
231  private:
238  std::vector<aspect::Utilities::Operator> model_operators;
239 
244  std::set<types::boundary_id> fixed_composition_boundary_indicators;
245 
251  };
252 
253 
254 
255  template <int dim>
256  template <typename BoundaryCompositionType, typename>
257  inline
258  bool
260  {
261  return this->template has_matching_active_plugin<BoundaryCompositionType>();
262  }
263 
264 
265 
266  template <int dim>
267  template <typename BoundaryCompositionType, typename>
268  inline
269  const BoundaryCompositionType &
271  {
272  return this->template get_matching_active_plugin<BoundaryCompositionType>();
273  }
274 
275 
276 
283  template <int dim>
284  std::string
286 
287 
295 #define ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL(classname, name, description) \
296  template class classname<2>; \
297  template class classname<3>; \
298  namespace ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL_ ## classname \
299  { \
300  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<2>,classname<2>> \
301  dummy_ ## classname ## _2d (&aspect::BoundaryComposition::Manager<2>::register_boundary_composition, \
302  name, description); \
303  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<3>,classname<3>> \
304  dummy_ ## classname ## _3d (&aspect::BoundaryComposition::Manager<3>::register_boundary_composition, \
305  name, description); \
306  }
307  }
308 }
309 
310 
311 #endif
virtual void parse_parameters(ParameterHandler &prm)
std::vector< aspect::Utilities::Operator > model_operators
Definition: interface.h:238
void write_plugin_graph(std::ostream &output_stream)
DEAL_II_DEPRECATED bool has_matching_boundary_composition_model() const
DEAL_II_DEPRECATED const BoundaryCompositionType & get_matching_boundary_composition_model() const
std::string get_valid_model_names_pattern()
#define DEAL_II_DEPRECATED
unsigned int boundary_id
virtual double boundary_composition(const types::boundary_id boundary_indicator, const Point< dim > &position, const unsigned int compositional_field) const =0
std::set< types::boundary_id > fixed_composition_boundary_indicators
Definition: interface.h:244
static 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.")