ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 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_composition_interface_h
23 #define _aspect_boundary_composition_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 {
45  namespace BoundaryComposition
46  {
52  template <int dim>
53  class Interface : public Plugins::InterfaceBase
54  {
55  public:
70  virtual
71  double
72  boundary_composition (const types::boundary_id boundary_indicator,
73  const Point<dim> &position,
74  const unsigned int compositional_field) const = 0;
75  };
76 
82  template <int dim>
83  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
84  {
85  public:
90  static
91  void
92  declare_parameters (ParameterHandler &prm);
93 
99  void
100  parse_parameters (ParameterHandler &prm) override;
101 
107  double
108  boundary_composition (const types::boundary_id boundary_indicator,
109  const Point<dim> &position,
110  const unsigned int compositional_field) const;
111 
129  static
130  void
131  register_boundary_composition (const std::string &name,
132  const std::string &description,
133  void (*declare_parameters_function) (ParameterHandler &),
134  std::unique_ptr<Interface<dim>> (*factory_function) ());
135 
136 
144  DEAL_II_DEPRECATED
145  const std::vector<std::string> &
146  get_active_boundary_composition_names () const;
147 
155  DEAL_II_DEPRECATED
156  const std::list<std::unique_ptr<Interface<dim>>> &
157  get_active_boundary_composition_conditions () const;
158 
173  template <typename BoundaryCompositionType,
174  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
175  DEAL_II_DEPRECATED
176  bool
177  has_matching_boundary_composition_model () const;
178 
195  template <typename BoundaryCompositionType,
196  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
197  DEAL_II_DEPRECATED
198  const BoundaryCompositionType &
199  get_matching_boundary_composition_model () const;
200 
201  /*
202  * Return a set of boundary indicators for which boundary
203  * compositions are prescribed.
204  */
205  const std::set<types::boundary_id> &
206  get_fixed_composition_boundary_indicators() const;
207 
208  /*
209  * Return whether Dirichlet boundary conditions will be applied
210  * on parts of the boundaries where material flows out.
211  */
212  bool
213  allows_fixed_composition_on_outflow_boundaries() const;
214 
224  static
225  void
226  write_plugin_graph (std::ostream &output_stream);
227 
228 
232  DeclException1 (ExcBoundaryCompositionNameNotFound,
233  std::string,
234  << "Could not find entry <"
235  << arg1
236  << "> among the names of registered boundary composition objects.");
237  private:
244  std::vector<aspect::Utilities::Operator> model_operators;
245 
250  std::set<types::boundary_id> fixed_composition_boundary_indicators;
251 
257  };
258 
259 
260 
261  template <int dim>
262  template <typename BoundaryCompositionType, typename>
263  inline
264  bool
266  {
267  return this->template has_matching_active_plugin<BoundaryCompositionType>();
268  }
269 
270 
271 
272  template <int dim>
273  template <typename BoundaryCompositionType, typename>
274  inline
275  const BoundaryCompositionType &
277  {
278  return this->template get_matching_active_plugin<BoundaryCompositionType>();
279  }
280 
281 
282 
289  template <int dim>
290  std::string
292 
293 
301 #define ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL(classname, name, description) \
302  template class classname<2>; \
303  template class classname<3>; \
304  namespace ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL_ ## classname \
305  { \
306  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<2>,classname<2>> \
307  dummy_ ## classname ## _2d (&aspect::BoundaryComposition::Manager<2>::register_boundary_composition, \
308  name, description); \
309  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<3>,classname<3>> \
310  dummy_ ## classname ## _3d (&aspect::BoundaryComposition::Manager<3>::register_boundary_composition, \
311  name, description); \
312  }
313  }
314 }
315 
316 
317 #endif
virtual void parse_parameters(ParameterHandler &prm)
std::vector< aspect::Utilities::Operator > model_operators
Definition: interface.h:244
void write_plugin_graph(std::ostream &output_stream)
DEAL_II_DEPRECATED bool has_matching_boundary_composition_model() const
Definition: compat.h:59
DEAL_II_DEPRECATED const BoundaryCompositionType & get_matching_boundary_composition_model() const
std::string get_valid_model_names_pattern()
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:250
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.")