/home/runner/work/amr-wind/amr-wind/amr-wind/utilities/FieldPlaneAveraging.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/FieldPlaneAveraging.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
FieldPlaneAveraging.H
Go to the documentation of this file.
1#ifndef FieldPlaneAveraging_H
2#define FieldPlaneAveraging_H
3
5#include "amr-wind/CFDSim.H"
8
19namespace amr_wind {
20
28template <typename FType>
30{
31public:
40 const FType& field_in,
41 const amr_wind::SimTime& time,
42 int axis_in,
43 bool compute_deriv = false);
44
45 virtual ~FPlaneAveraging() = default;
46
47 virtual void operator()();
48
50 amrex::Real line_average_interpolated(amrex::Real x, int comp) const;
52 amrex::Real line_average_cell(int ind, int comp) const;
53
56 amrex::Real line_derivative_interpolated(amrex::Real x, int comp) const;
59 amrex::Real line_derivative_of_average_cell(int ind, int comp) const;
60
62 const std::string& filename, int step, amrex::Real time);
63 void output_line_average_ascii(int step, amrex::Real time);
64
66 void set_precision(int p) { m_precision = p; };
67
68 amrex::Real dx() const { return m_dx; };
69 amrex::Real xlo() const { return m_xlo; };
70
71 int axis() const { return m_axis; };
72 int level() const { return m_level; };
73 int ncomp() const { return m_ncomp; };
74 int ncell_plane() const { return m_ncell_plane; };
75 int ncell_line() const { return m_ncell_line; };
77
78 const amrex::Vector<amrex::Real>& line_average() const
79 {
80 return m_line_average;
81 };
82 const amrex::Vector<amrex::Real>& line_deriv() const
83 {
84 return m_line_deriv;
85 };
86 void line_average(int comp, amrex::Vector<amrex::Real>& l_vec);
87 const amrex::Vector<amrex::Real>& line_centroids() const
88 {
89 return m_line_xcentroid;
90 };
91
92 const FType& field() const { return m_field; };
93
94protected:
95 int m_ncomp;
97 amrex::Vector<amrex::Real>
101 amrex::Vector<amrex::Real> m_line_deriv;
102
103 amrex::Vector<amrex::Real> m_line_xcentroid;
106 amrex::Real m_dx;
107 amrex::Real m_xlo;
112 int m_precision = 4;
113 const int m_level =
114 0;
118 const FType& m_field;
120 const int m_axis;
121 const bool m_comp_deriv;
122
123public: // public for GPU
125 template <typename IndexSelector>
126 void
127 compute_averages(const IndexSelector& idxOp, const amrex::MultiFab& mfab);
128
131};
132
135
140{
141public:
142 VelPlaneAveraging(CFDSim& sim, int axis_in);
143
144 ~VelPlaneAveraging() override = default;
145
146 void operator()() override;
147
148private:
149 amrex::Vector<amrex::Real>
153 amrex::Vector<amrex::Real> m_line_hvelmag_deriv;
154
155public: // public for GPU
157 template <typename IndexSelector>
159 const IndexSelector& idx_op,
160 const int h1_idx,
161 const int h2_idx,
162 const amrex::MultiFab& mfab);
163
165 const amrex::Vector<amrex::Real>& line_hvelmag_average()
166 {
168 };
169
172 amrex::Real line_hvelmag_average_interpolated(amrex::Real x) const;
175 amrex::Real line_hvelmag_average_cell(int ind) const;
176
181 amrex::Real line_hvelmag_derivative_interpolated(amrex::Real x) const;
184 amrex::Real line_hvelmag_derivative_of_average_cell(int ind) const;
185
187 const std::string& filename, int step, amrex::Real time);
188 void output_line_average_ascii(int step, amrex::Real time);
189};
190
191} // namespace amr_wind
192
193#endif /* FieldPlaneAveraging_H */
Definition CFDSim.H:47
Definition FieldPlaneAveraging.H:30
amrex::Real xlo() const
Definition FieldPlaneAveraging.H:69
int m_ncomp
Definition FieldPlaneAveraging.H:95
virtual void operator()()
Definition FieldPlaneAveraging.cpp:227
amrex::Real line_derivative_of_average_cell(int ind, int comp) const
Definition FieldPlaneAveraging.cpp:171
amrex::Real line_average_cell(int ind, int comp) const
Definition FieldPlaneAveraging.cpp:147
void compute_line_derivatives()
Definition FieldPlaneAveraging.cpp:158
int ncell_line() const
Definition FieldPlaneAveraging.H:75
amrex::Real dx() const
Definition FieldPlaneAveraging.H:68
int m_last_updated_index
Definition FieldPlaneAveraging.H:115
amrex::Real m_xlo
Definition FieldPlaneAveraging.H:107
amrex::Vector< amrex::Real > m_line_deriv
line storage for the derivative of average field
Definition FieldPlaneAveraging.H:101
amrex::Real line_average_interpolated(amrex::Real x, int comp) const
Definition FieldPlaneAveraging.cpp:106
const amrex::Vector< amrex::Real > & line_average() const
Definition FieldPlaneAveraging.H:78
const FType & m_field
Definition FieldPlaneAveraging.H:118
const amrex::Vector< amrex::Real > & line_centroids() const
Definition FieldPlaneAveraging.H:87
int m_ncell_line
Definition FieldPlaneAveraging.H:110
int ncell_plane() const
Definition FieldPlaneAveraging.H:74
int m_precision
Definition FieldPlaneAveraging.H:112
int ncomp() const
Definition FieldPlaneAveraging.H:73
const FType & field() const
Definition FieldPlaneAveraging.H:92
virtual ~FPlaneAveraging()=default
amrex::Vector< amrex::Real > m_line_xcentroid
Definition FieldPlaneAveraging.H:103
const bool m_comp_deriv
Definition FieldPlaneAveraging.H:121
int last_updated_index() const
Definition FieldPlaneAveraging.H:76
int m_ncell_plane
Definition FieldPlaneAveraging.H:109
const int m_axis
Definition FieldPlaneAveraging.H:120
amrex::Real line_derivative_interpolated(amrex::Real x, int comp) const
Definition FieldPlaneAveraging.cpp:199
amrex::Real m_dx
Definition FieldPlaneAveraging.H:106
void compute_averages(const IndexSelector &idxOp, const amrex::MultiFab &mfab)
Definition FieldPlaneAveraging.cpp:257
int axis() const
Definition FieldPlaneAveraging.H:71
amrex::Vector< amrex::Real > m_line_average
Definition FieldPlaneAveraging.H:98
const SimTime & m_time
Definition FieldPlaneAveraging.H:119
const amrex::Vector< amrex::Real > & line_deriv() const
Definition FieldPlaneAveraging.H:82
const int m_level
Definition FieldPlaneAveraging.H:113
void output_line_average_ascii(const std::string &filename, int step, amrex::Real time)
Definition FieldPlaneAveraging.cpp:54
int level() const
Definition FieldPlaneAveraging.H:72
void set_precision(int p)
Definition FieldPlaneAveraging.H:66
FPlaneAveraging(const FType &field_in, const amr_wind::SimTime &time, int axis_in, bool compute_deriv=false)
Definition FieldPlaneAveraging.cpp:8
Definition SimTime.H:30
Definition FieldPlaneAveraging.H:140
amrex::Vector< amrex::Real > m_line_hvelmag_average
Definition FieldPlaneAveraging.H:150
VelPlaneAveraging(CFDSim &sim, int axis_in)
Definition FieldPlaneAveraging.cpp:322
void output_line_average_ascii(const std::string &filename, int step, amrex::Real time)
Definition FieldPlaneAveraging.cpp:494
amrex::Vector< amrex::Real > m_line_hvelmag_deriv
line storage for the derivative of average horizontal velocity magnitude
Definition FieldPlaneAveraging.H:153
amrex::Real line_hvelmag_average_cell(int ind) const
Definition FieldPlaneAveraging.cpp:485
void compute_hvelmag_averages(const IndexSelector &idx_op, const int h1_idx, const int h2_idx, const amrex::MultiFab &mfab)
Definition FieldPlaneAveraging.cpp:363
void operator()() override
Definition FieldPlaneAveraging.cpp:332
const amrex::Vector< amrex::Real > & line_hvelmag_average()
Definition FieldPlaneAveraging.H:165
void compute_line_hvelmag_derivatives()
Definition FieldPlaneAveraging.cpp:425
~VelPlaneAveraging() override=default
amrex::Real line_hvelmag_derivative_interpolated(amrex::Real x) const
amrex::Real line_hvelmag_derivative_of_average_cell(int ind) const
Definition FieldPlaneAveraging.cpp:434
amrex::Real line_hvelmag_average_interpolated(amrex::Real x) const
Definition FieldPlaneAveraging.cpp:460
Definition BCInterface.cpp:7