Fluid structure interaction suite
grid_refinement.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 by Luca Heltai
4 //
5 // This file is part of the FSI-suite platform, based on the deal.II library.
6 //
7 // The FSI-suite platform is free software; you can use it, redistribute it,
8 // and/or modify it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation; either version 3.0 of the License,
10 // or (at your option) any later version. The full text of the license can be
11 // found in the file LICENSE at the top level of the FSI-suite platform
12 // distribution.
13 //
14 // ---------------------------------------------------------------------
15 
17 
18 using namespace dealii;
19 
20 namespace ParsedTools
21 {
22  GridRefinement::GridRefinement(
23  const std::string &section_name,
24  const unsigned int &n_refinement_cycles,
25  const RefinementStrategy &strategy,
26  const std::string &estimator_type,
27  const double &top_parameter,
28  const double &bottom_parameter,
29  const unsigned int &max_cells,
30  const int &min_level,
31  const int &max_level,
32  const std::map<std::string, std::function<void(dealii::Vector<float> &)>>
33  &optional_estimators,
34  const dealii::ComponentMask &component_mask)
35  : ParameterAcceptor(section_name)
36  , n_refinement_cycles(n_refinement_cycles)
37  , strategy(strategy)
38  , top_parameter(top_parameter)
39  , bottom_parameter(bottom_parameter)
40  , max_cells(max_cells)
41  , min_level(min_level)
42  , max_level(max_level)
43  , estimator_type(estimator_type)
44  , optional_estimators(optional_estimators)
45  , component_mask(component_mask)
46  {
47  add_parameter("Number of refinement cycles", this->n_refinement_cycles);
48 
49  enter_subsection("Marking strategy");
50 
51  add_parameter("Refinement strategy", this->strategy);
52 
53  add_parameter("Refinement parameter",
54  this->top_parameter,
55  "Theta parameter, used to determine refinement fraction.",
56  this->prm,
57  Patterns::Double(0.0));
58 
59  add_parameter("Coarsening parameter",
60  this->bottom_parameter,
61  "Theta parameter, used to determine coearsening fraction.",
62  this->prm,
63  Patterns::Double(0.0));
64 
65  add_parameter("Maximum number of cells (if available)",
66  this->max_cells,
67  "Maximum number of cells.");
68 
69  add_parameter("Minimum level",
70  this->min_level,
71  "Any cell at refinement level below this number "
72  "will be marked for refinement.");
73 
74  add_parameter("Maximum level",
75  this->max_level,
76  "Any cell at refinement level above this number "
77  "will be marked for coarsening.");
79 
80  enter_subsection("Error estimator");
81  std::string selection = "kelly";
82  for (const auto &[e, f] : optional_estimators)
83  selection += "|" + e;
84  add_parameter("Estimator type",
85  this->estimator_type,
86  "",
87  this->prm,
88  Patterns::Selection(selection));
89  add_parameter("Component mask", this->component_mask);
91  }
92 } // namespace ParsedTools
static ParameterHandler prm
void enter_subsection(const std::string &subsection)
void add_parameter(const std::string &entry, ParameterType &parameter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern())
std::map< std::string, std::function< void(Vector< float > &)> > optional_estimators
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
We collect in this namespace some wrappers around commonly used deal.II classes, derived from the Par...
RefinementStrategy
Refinement strategy implemented in the GridRefinement class.