/home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/ABLStats.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/ABLStats.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ABLStats.H
Go to the documentation of this file.
1#ifndef ABLISTATS_H
2#define ABLISTATS_H
3
5#include "amr-wind/CFDSim.H"
14
15namespace amr_wind {
16
17namespace pde::icns {
18class ABLForcing;
19class ABLMesoForcingMom;
20} // namespace pde::icns
21
22namespace pde::temperature {
23class ABLMesoForcingTemp;
24}
25
34class ABLStats : public ABLStatsBase::Register<ABLStats>
35{
36public:
37 static std::string identifier() { return "precursor"; }
38
40 CFDSim& /*sim*/,
41 const ABLWallFunction& /*abl_wall_func*/,
42 const int dir);
43
44 ~ABLStats() override;
45
46 ABLStatsMode abl_mode() const override { return ABLStatsMode::computed; }
47
48 // Perform initialization actions after the mesh has been created
49 void post_init_actions() override;
50
52 void pre_advance_work() override {}
53
55 void post_advance_work() override;
56
58 void compute_zi();
59
61 const VelPlaneAveragingFine& vel_profile() const override
62 {
63 return m_pa_vel_fine;
64 };
65
67 const VelPlaneAveraging& vel_profile_coarse() const override
68 {
69 return m_pa_vel;
70 };
71
73 const FieldPlaneAveraging& theta_profile() const override
74 {
75 return m_pa_temp;
76 }
77
80 {
81 return m_pa_temp_fine;
82 }
83
84 void register_forcing_term(pde::icns::ABLForcing* forcing) const override
85 {
86 m_abl_forcing = forcing;
87 }
88
90 pde::icns::ABLMesoForcingMom* forcing) const override
91 {
92 m_abl_meso_mom_forcing = forcing;
93 }
94
96 pde::temperature::ABLMesoForcingTemp* forcing) const override
97 {
99 }
100
102 void
103 calc_sfs_stress_avgs(ScratchField& sfs_stress, ScratchField& t_sfs_stress);
104
108 const Field& buoy_prod,
109 const Field& shear_prod,
110 const Field& dissipation,
111 const amrex::Real dt);
112
113protected:
115 void initialize();
116
118 void calc_averages();
119
121 virtual void process_output();
122
124 virtual void prepare_ascii_file();
126 virtual void prepare_netcdf_file();
127
129 void write_netcdf();
130
136 virtual void write_ascii();
137
138private:
143
153
156
160
162#ifdef AMR_WIND_USE_NETCDF
163 std::string m_out_fmt{"netcdf"};
164 std::string m_ncfile_name;
165#else
166 std::string m_out_fmt{"ascii"};
167#endif
168 std::string m_ascii_file_name;
169
171 int m_out_freq{100};
172
174 amrex::Real m_gravity{9.81};
175
177 amrex::Real m_kappa{0.41};
178
180 amrex::Real m_ref_theta{300.0};
181
183 amrex::Real m_zi{0.0};
184
187
189 amrex::Real m_dn{0.0};
190
192 size_t m_ncells_h1{0};
193 size_t m_ncells_h2{0};
194
197};
198
199} // namespace amr_wind
200
201#endif /* ABLISTATS_H */
Definition ABLStats.H:35
void register_forcing_term(pde::icns::ABLForcing *forcing) const override
Definition ABLStats.H:84
void post_init_actions() override
Definition ABLStats.cpp:41
Field & m_mueff
Definition ABLStats.H:142
void write_netcdf()
Write sampled data into a NetCDF file.
Definition ABLStats.cpp:494
pde::temperature::ABLMesoForcingTemp * m_abl_meso_temp_forcing
Definition ABLStats.H:158
~ABLStats() override
amrex::Real m_ref_theta
Reference surface temperature.
Definition ABLStats.H:180
virtual void prepare_ascii_file()
Prepare ASCII file.
Definition ABLStats.cpp:364
Field & m_temperature
Definition ABLStats.H:141
const ABLWallFunction & m_abl_wall_func
Definition ABLStats.H:140
void calc_tke_diffusion(ScratchField &diffusion, const Field &buoy_prod, const Field &shear_prod, const Field &dissipation, const amrex::Real dt)
Calculate tke diffusion term by eliminating other terms.
Definition ABLStats.cpp:152
amrex::Real m_zi
Variable to store capping inversion height.
Definition ABLStats.H:183
ABLStatsMode abl_mode() const override
Definition ABLStats.H:46
virtual void prepare_netcdf_file()
Prepare NetCDF metadata.
Definition ABLStats.cpp:389
ThirdMomentAveraging m_pa_uuu
Definition ABLStats.H:152
const VelPlaneAveragingFine & vel_profile() const override
Return vel plane averaging instance.
Definition ABLStats.H:61
void initialize()
Read user inputs and create the necessary files.
Definition ABLStats.cpp:47
pde::icns::ABLMesoForcingMom * m_abl_meso_mom_forcing
Definition ABLStats.H:157
amrex::Real m_dn
Cell spacing at the coarsest level.
Definition ABLStats.H:189
const FieldPlaneAveragingFine & theta_profile_fine() const override
Return instance that handles temperature statistics.
Definition ABLStats.H:79
int m_out_freq
Frequency of data sampling and output.
Definition ABLStats.H:171
ABLStats(CFDSim &, const ABLWallFunction &, const int dir)
Definition ABLStats.cpp:22
const VelPlaneAveraging & vel_profile_coarse() const override
Return vel plane averaging instance.
Definition ABLStats.H:67
FieldPlaneAveraging m_pa_temp
Definition ABLStats.H:145
void register_meso_mom_forcing(pde::icns::ABLMesoForcingMom *forcing) const override
Definition ABLStats.H:89
std::string m_out_fmt
Format of the data output (ascii, netcdf, etc.)
Definition ABLStats.H:163
const FieldPlaneAveraging & theta_profile() const override
Return instance that handles temperature statistics.
Definition ABLStats.H:73
void register_meso_temp_forcing(pde::temperature::ABLMesoForcingTemp *forcing) const override
Definition ABLStats.H:95
virtual void write_ascii()
Definition ABLStats.cpp:295
CFDSim & m_sim
Definition ABLStats.H:139
VelPlaneAveraging m_pa_vel
Definition ABLStats.H:144
int m_normal_dir
Wall-normal direction axis.
Definition ABLStats.H:186
SecondMomentAveraging m_pa_tt
Definition ABLStats.H:149
SecondMomentAveraging m_pa_uu
Definition ABLStats.H:151
void pre_advance_work() override
Perform actions before a new timestep.
Definition ABLStats.H:52
pde::icns::ABLForcing * m_abl_forcing
Reference to ABL forcing term if present.
Definition ABLStats.H:155
static std::string identifier()
Definition ABLStats.H:37
VelPlaneAveragingFine m_pa_vel_fine
Definition ABLStats.H:146
virtual void process_output()
Output data based on user-defined format.
Definition ABLStats.cpp:283
size_t m_ncells_h1
Number of cells in the horizontal direction.
Definition ABLStats.H:192
void compute_zi()
Compute height of capping inversion.
Definition ABLStats.cpp:233
std::string m_ncfile_name
Definition ABLStats.H:164
FieldPlaneAveragingFine m_pa_temp_fine
Definition ABLStats.H:147
SecondMomentAveraging m_pa_tu
Definition ABLStats.H:150
size_t m_ncells_h2
Definition ABLStats.H:193
amrex::Real m_gravity
Acceleration due to gravity magnitude.
Definition ABLStats.H:174
void post_advance_work() override
Process fields given timestep and output to disk.
Definition ABLStats.cpp:209
void calc_averages()
Calculate plane average profiles.
Definition ABLStats.cpp:93
void calc_sfs_stress_avgs(ScratchField &sfs_stress, ScratchField &t_sfs_stress)
Calculate sfs stress averages.
Definition ABLStats.cpp:103
amrex::Real m_kappa
Von-Karman constant.
Definition ABLStats.H:177
std::string m_ascii_file_name
Definition ABLStats.H:168
FieldPlaneAveraging m_pa_mueff
Definition ABLStats.H:148
bool m_do_energy_budget
Do energy budget.
Definition ABLStats.H:196
Definition ABLWallFunction.H:20
Definition CFDSim.H:47
Definition Field.H:116
Definition ScratchField.H:30
Definition SecondMomentAveraging.H:26
Definition ThirdMomentAveraging.H:16
Definition FieldPlaneAveragingFine.H:114
Definition FieldPlaneAveraging.H:140
Definition ABLForcing.H:17
Definition ABLMesoForcingMom.H:26
Definition ABLMesoForcingTemp.H:19
Definition BCInterface.cpp:7
ABLStatsMode
Definition ABLStatsBase.H:17
Definition diffusion.H:8