Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
ale.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2023-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_ale_h
5#define lethe_ale_h
6
7#include <deal.II/base/function.h>
8#include <deal.II/base/parameter_handler.h>
9#include <deal.II/base/parsed_function.h>
10
11using namespace dealii;
12
13namespace Parameters
14{
15 /**
16 * @brief An interface for all the common parameters required to consider
17 * a moving frame of reference in a simplified Arbitrary Lagrangian Eulerian
18 * (ALE) module.
19 *
20 * @tparam dim An integer that denotes the dimension of the space in which
21 * the problem is solved.
22 */
23 template <int dim>
24 class ALE
25 {
26 public:
27 /**
28 * @brief Construct a new ALE object.
29 */
31 {
32 velocity = std::make_shared<Functions::ParsedFunction<dim>>(dim);
33 }
34
35
36 /**
37 * @brief Declare the parameters.
38 *
39 * @param[in,out] prm The ParameterHandler object.
40 */
41 virtual void
42 declare_parameters(ParameterHandler &prm);
43
44 /**
45 * @brief Parse the parameters.
46 *
47 * @param[in] prm The ParameterHandler object.
48 */
49 virtual void
50 parse_parameters(ParameterHandler &prm);
51
52
53 /**
54 * @brief ALE velocity function
55 */
56 std::shared_ptr<Functions::ParsedFunction<dim>> velocity;
57
58 /**
59 * @brief Return if the ALE module is enabled.
60 *
61 * @return enable A boolean that indicates if the ALE module is enabled.
62 */
63 bool
64 enabled() const
65 {
66 return enable;
67 }
68
69 private:
70 /**
71 * @brief Boolean indicating if the ALE module is enabled.
72 */
73 bool enable;
74 };
75
76 template <int dim>
77 void
78 ALE<dim>::declare_parameters(ParameterHandler &prm)
79 {
80 prm.enter_subsection("ALE");
81 prm.declare_entry(
82 "enable",
83 "false",
84 Patterns::Bool(),
85 "Enable simulations in a Galilean moving frame of reference");
86
87 prm.enter_subsection("velocity");
88 velocity->declare_parameters(prm, dim);
89 prm.leave_subsection();
90
91 prm.leave_subsection();
92 }
93
94 template <int dim>
95 void
96 ALE<dim>::parse_parameters(ParameterHandler &prm)
97 {
98 prm.enter_subsection("ALE");
99 enable = prm.get_bool("enable");
100
101 prm.enter_subsection("velocity");
102 velocity->parse_parameters(prm);
103 prm.leave_subsection();
104
105 prm.leave_subsection();
106 }
107} // namespace Parameters
108
109
110
111#endif
bool enable
Boolean indicating if the ALE module is enabled.
Definition ale.h:73
bool enabled() const
Return if the ALE module is enabled.
Definition ale.h:64
std::shared_ptr< Functions::ParsedFunction< dim > > velocity
ALE velocity function.
Definition ale.h:56
virtual void parse_parameters(ParameterHandler &prm)
Parse the parameters.
Definition ale.h:96
ALE()
Construct a new ALE object.
Definition ale.h:30
virtual void declare_parameters(ParameterHandler &prm)
Declare the parameters.
Definition ale.h:78