/home/runner/work/amr-wind/amr-wind/amr-wind/physics/ScalarAdvection.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/physics/ScalarAdvection.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ScalarAdvection.H
Go to the documentation of this file.
1#ifndef ScalarAdvection_H
2#define ScalarAdvection_H
3
7
8namespace amr_wind {
9
15class ScalarAdvection : public Physics::Register<ScalarAdvection>
16{
17public:
18 static std::string identifier() { return "ScalarAdvection"; }
19
20 explicit ScalarAdvection(CFDSim& sim);
21
22 ~ScalarAdvection() override = default;
23
25 void initialize_fields(int level, const amrex::Geometry& geom) override;
26
27 template <typename Shape>
28 amrex::Vector<amrex::Real> compute_error(const Shape& scalar_function);
29
30 void post_init_actions() override;
31
32 void post_regrid_actions() override {}
33
34 void pre_advance_work() override {}
35
36 void post_advance_work() override;
37
38 template <typename Shape>
39 void initialize_scalar(const Shape& scalar_function);
40
41private:
46 std::string m_output_fname = "error.log";
47 const int m_w = 20;
48
50 Field* m_scalar{nullptr};
51
53 amrex::Real m_u{1.0};
54 amrex::Real m_v{0.0};
55
57 amrex::Real m_x0{0.1};
58 amrex::Real m_y0{0.1};
59
61 amrex::Real m_amplitude{1.0};
62
65 amrex::Real m_x_width{0.01};
66 amrex::Real m_y_width{0.01};
67
69 amrex::Real m_x_wavenumber{16 * utils::pi()};
70 amrex::Real m_y_wavenumber{16 * utils::pi()};
71
73 std::string m_shape{"gaussian"};
74
76 amrex::Real m_rho{1.0};
77};
78
80{
81 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(
82 const amrex::Real /*x*/,
83 const amrex::Real /*x0*/,
84 const amrex::Real /*amplitude*/,
85 const amrex::Real /*x_width*/,
86 const amrex::Real /*x_wavenumber*/) const;
87};
88
90{
91 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(
92 const amrex::Real /*x*/,
93 const amrex::Real /*unused*/,
94 const amrex::Real /*dx*/,
95 const amrex::Real /*unused*/,
96 const amrex::Real /*x0*/,
97 const amrex::Real /*unused*/,
98 const amrex::Real /*amplitude*/,
99 const amrex::Real /*x_width*/,
100 const amrex::Real /*unused*/,
101 const amrex::Real /*unused*/,
102 const amrex::Real /*unused*/) const;
103};
104
106{
107 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(
108 const amrex::Real /*x*/,
109 const amrex::Real /*y*/,
110 const amrex::Real /*dx*/,
111 const amrex::Real /*dy*/,
112 const amrex::Real /*x0*/,
113 const amrex::Real /*y0*/,
114 const amrex::Real /*amplitude*/,
115 const amrex::Real /*x_width*/,
116 const amrex::Real /*y_width*/,
117 const amrex::Real /*unused*/,
118 const amrex::Real /*unused*/) const;
119};
120
122{
123 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(
124 const amrex::Real /*x*/,
125 const amrex::Real /*unused*/,
126 const amrex::Real /*dx*/,
127 const amrex::Real /*unused*/,
128 const amrex::Real /*x0*/,
129 const amrex::Real /*unused*/,
130 const amrex::Real /*amplitude*/,
131 const amrex::Real /*x_width*/,
132 const amrex::Real /*unused*/,
133 const amrex::Real /*unused*/,
134 const amrex::Real /*unused*/) const;
135};
136
138{
139 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(
140 const amrex::Real /*x*/,
141 const amrex::Real /*unused*/,
142 const amrex::Real /*dx*/,
143 const amrex::Real /*unused*/,
144 const amrex::Real /*x0*/,
145 const amrex::Real /*unused*/,
146 const amrex::Real /*amplitude*/,
147 const amrex::Real /*x_width*/,
148 const amrex::Real /*unused*/,
149 const amrex::Real /*x_wavenumber*/,
150 const amrex::Real /*unused*/) const;
151};
152
153} // namespace amr_wind
154
155#endif /* ScalarAdvection_H */
Definition CFDSim.H:47
Definition Field.H:116
Definition FieldRepo.H:86
Definition ScalarAdvection.H:16
void post_advance_work() override
Definition ScalarAdvection.cpp:304
amrex::Vector< amrex::Real > compute_error(const Shape &scalar_function)
Definition ScalarAdvection.cpp:237
amrex::Real m_v
Definition ScalarAdvection.H:54
amrex::Real m_x_width
Definition ScalarAdvection.H:65
const FieldRepo & m_repo
Definition ScalarAdvection.H:43
const SimTime & m_time
Definition ScalarAdvection.H:42
Field & m_velocity
Definition ScalarAdvection.H:44
amrex::Real m_y_wavenumber
Definition ScalarAdvection.H:70
amrex::Real m_y_width
Definition ScalarAdvection.H:66
Field * m_scalar
Scalar field.
Definition ScalarAdvection.H:50
void pre_advance_work() override
Definition ScalarAdvection.H:34
void post_regrid_actions() override
Definition ScalarAdvection.H:32
amrex::Real m_x0
Initial wave/pulse packet location.
Definition ScalarAdvection.H:57
const int m_w
Definition ScalarAdvection.H:47
amrex::Real m_x_wavenumber
Wave numbers.
Definition ScalarAdvection.H:69
Field & m_density
Definition ScalarAdvection.H:45
void post_init_actions() override
Definition ScalarAdvection.cpp:178
void initialize_fields(int level, const amrex::Geometry &geom) override
Initialize the fields for ScalarAdvection simulations.
Definition ScalarAdvection.cpp:156
amrex::Real m_y0
Definition ScalarAdvection.H:58
amrex::Real m_amplitude
Initial wave/pulse amplitude.
Definition ScalarAdvection.H:61
static std::string identifier()
Definition ScalarAdvection.H:18
amrex::Real m_rho
Density.
Definition ScalarAdvection.H:76
std::string m_shape
Initial wave/pulse shape.
Definition ScalarAdvection.H:73
amrex::Real m_u
Flow velocity in x-direction.
Definition ScalarAdvection.H:53
std::string m_output_fname
Definition ScalarAdvection.H:46
void initialize_scalar(const Shape &scalar_function)
Definition ScalarAdvection.cpp:203
~ScalarAdvection() override=default
ScalarAdvection(CFDSim &sim)
Definition ScalarAdvection.cpp:126
Definition SimTime.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real pi()
Return as an amrex::Real.
Definition trig_ops.H:16
Definition BCInterface.cpp:7
Definition ScalarAdvection.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real) const
Definition ScalarAdvection.cpp:9
Definition ScalarAdvection.H:138
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real) const
Definition ScalarAdvection.cpp:81
Definition ScalarAdvection.H:80
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real) const
Definition ScalarAdvection.cpp:111
Definition ScalarAdvection.H:122
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real) const
Definition ScalarAdvection.cpp:58
Definition ScalarAdvection.H:106
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator()(const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real) const
Definition ScalarAdvection.cpp:33