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  {
47  using namespace dealii;
48 
54  template <int dim>
55  class Interface : public Plugins::InterfaceBase
56  {
57  public:
72  virtual
73  double
74  boundary_composition (const types::boundary_id boundary_indicator,
75  const Point<dim> &position,
76  const unsigned int compositional_field) const = 0;
77  };
78 
84  template <int dim>
85  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
86  {
87  public:
92  static
93  void
94  declare_parameters (ParameterHandler &prm);
95 
101  void
102  parse_parameters (ParameterHandler &prm) override;
103 
109  double
110  boundary_composition (const types::boundary_id boundary_indicator,
111  const Point<dim> &position,
112  const unsigned int compositional_field) const;
113 
131  static
132  void
133  register_boundary_composition (const std::string &name,
134  const std::string &description,
135  void (*declare_parameters_function) (ParameterHandler &),
136  std::unique_ptr<Interface<dim>> (*factory_function) ());
137 
138 
146  DEAL_II_DEPRECATED
147  const std::vector<std::string> &
148  get_active_boundary_composition_names () const;
149 
157  DEAL_II_DEPRECATED
158  const std::list<std::unique_ptr<Interface<dim>>> &
159  get_active_boundary_composition_conditions () const;
160 
175  template <typename BoundaryCompositionType,
176  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
177  DEAL_II_DEPRECATED
178  bool
179  has_matching_boundary_composition_model () const;
180 
197  template <typename BoundaryCompositionType,
198  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,BoundaryCompositionType>::value>>
199  DEAL_II_DEPRECATED
200  const BoundaryCompositionType &
201  get_matching_boundary_composition_model () const;
202 
203  /*
204  * Return a set of boundary indicators for which boundary
205  * compositions are prescribed.
206  */
207  const std::set<types::boundary_id> &
208  get_fixed_composition_boundary_indicators() const;
209 
210  /*
211  * Return whether Dirichlet boundary conditions will be applied
212  * on parts of the boundaries where material flows out.
213  */
214  bool
215  allows_fixed_composition_on_outflow_boundaries() const;
216 
226  static
227  void
228  write_plugin_graph (std::ostream &output_stream);
229 
230 
234  DeclException1 (ExcBoundaryCompositionNameNotFound,
235  std::string,
236  << "Could not find entry <"
237  << arg1
238  << "> among the names of registered boundary composition objects.");
239  private:
246  std::vector<aspect::Utilities::Operator> model_operators;
247 
252  std::set<types::boundary_id> fixed_composition_boundary_indicators;
253 
259  };
260 
261 
262 
263  template <int dim>
264  template <typename BoundaryCompositionType, typename>
265  inline
266  bool
268  {
269  return this->template has_matching_active_plugin<BoundaryCompositionType>();
270  }
271 
272 
273 
274  template <int dim>
275  template <typename BoundaryCompositionType, typename>
276  inline
277  const BoundaryCompositionType &
279  {
280  return this->template get_matching_active_plugin<BoundaryCompositionType>();
281  }
282 
283 
284 
291  template <int dim>
292  std::string
294 
295 
303 #define ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL(classname, name, description) \
304  template class classname<2>; \
305  template class classname<3>; \
306  namespace ASPECT_REGISTER_BOUNDARY_COMPOSITION_MODEL_ ## classname \
307  { \
308  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<2>,classname<2>> \
309  dummy_ ## classname ## _2d (&aspect::BoundaryComposition::Manager<2>::register_boundary_composition, \
310  name, description); \
311  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryComposition::Interface<3>,classname<3>> \
312  dummy_ ## classname ## _3d (&aspect::BoundaryComposition::Manager<3>::register_boundary_composition, \
313  name, description); \
314  }
315  }
316 }
317 
318 
319 #endif
std::vector< aspect::Utilities::Operator > model_operators
Definition: interface.h:246
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
void declare_parameters(ParameterHandler &prm)
std::string get_valid_model_names_pattern()
Definition: compat.h:42
std::set< types::boundary_id > fixed_composition_boundary_indicators
Definition: interface.h:252
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.")