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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/ABLFieldInit.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ABLFieldInit.H
Go to the documentation of this file.
1#ifndef ABLFIELDINIT_H
2#define ABLFIELDINIT_H
3
5
6#include "AMReX_Array.H"
7#include "AMReX_Array4.H"
8#include "AMReX_Box.H"
9#include "AMReX_Geometry.H"
10#include "AMReX_REAL.H"
11#include "AMReX_Vector.H"
12#include "AMReX_Gpu.H"
13
14namespace amr_wind {
15
19{
20 static_assert(AMREX_SPACEDIM == 3, "ABL requires 3 dimensional mesh");
21
22public:
24
25 void initialize_from_inputfile(); // default
26 void initialize_from_netcdf(); // general wind/temperature profiles
27
28 void operator()(
29 const amrex::Box& vbx,
30 const amrex::Geometry& geom,
31 const amrex::Array4<amrex::Real>& velocity,
32 const amrex::Array4<amrex::Real>& density,
33 const amrex::Array4<amrex::Real>& temperature) const;
34
41 const int lev, const amrex::Geometry& geom, Field& temperature) const;
42
45
47 void init_tke(const amrex::Geometry& geom, amrex::MultiFab& tke) const;
48
49private:
51 amrex::Vector<amrex::Real> m_vel;
52
54 std::string m_vel_timetable;
55
57 amrex::Real m_vel_speed;
58
60 amrex::Real m_vel_dir;
61
65 amrex::Vector<amrex::Real> m_theta_heights;
66 amrex::Vector<amrex::Real> m_theta_values;
67
72 std::string m_1d_rans;
73 amrex::Vector<amrex::Real> m_wind_heights;
74 amrex::Vector<amrex::Real> m_u_values;
75 amrex::Vector<amrex::Real> m_v_values;
76 amrex::Vector<amrex::Real> m_tke_values;
78
79 // Device copies of the above arrays
80 amrex::Gpu::DeviceVector<amrex::Real> m_thht_d;
81 amrex::Gpu::DeviceVector<amrex::Real> m_thvv_d;
82
83 amrex::Gpu::DeviceVector<amrex::Real> m_windht_d;
84 amrex::Gpu::DeviceVector<amrex::Real> m_prof_u_d;
85 amrex::Gpu::DeviceVector<amrex::Real> m_prof_v_d;
86 amrex::Gpu::DeviceVector<amrex::Real> m_prof_tke_d;
88 amrex::Real m_rho;
89
91 amrex::Real m_deltaU{1.0};
92
94 amrex::Real m_deltaV{1.0};
95
97 amrex::Real m_Uperiods{4.0};
98
100 amrex::Real m_Vperiods{4.0};
101
103 amrex::Real m_ref_height{50.0};
104
106 amrex::Real m_delta_t{0.8};
107
109 amrex::Real m_theta_gauss_mean{0.0};
110
112 amrex::Real m_theta_gauss_var{1.0};
113
115 amrex::Real m_theta_cutoff_height{1.0e16};
116
118 amrex::Real m_tke_init{0.1};
119
121 amrex::Real m_tke_init_factor{0.4};
122
124 amrex::Real m_tke_cutoff_height{250.};
125
127 amrex::RealArray m_top_vel{20.0};
128
130 amrex::RealArray m_bottom_vel{4.0};
131
133 bool m_linear_profile{false};
134
136 bool m_perturb_vel{true};
137
139 bool m_perturb_theta{false};
140
143
146};
147
148} // namespace amr_wind
149
150#endif /* ABLFIELDINIT_H */
Definition ABLFieldInit.H:19
amrex::Real m_tke_cutoff_height
Cutoff height for init tke profile.
Definition ABLFieldInit.H:124
bool m_perturb_theta
Perturb temperature field with random fluctuations.
Definition ABLFieldInit.H:139
amrex::Gpu::DeviceVector< amrex::Real > m_thvv_d
Definition ABLFieldInit.H:81
amrex::Gpu::DeviceVector< amrex::Real > m_prof_tke_d
Definition ABLFieldInit.H:86
amrex::RealArray m_bottom_vel
Bottom velocity.
Definition ABLFieldInit.H:130
std::string m_1d_rans
File name for 1-D data file.
Definition ABLFieldInit.H:72
amrex::Gpu::DeviceVector< amrex::Real > m_prof_v_d
Definition ABLFieldInit.H:85
amrex::Real m_Vperiods
Number of sinusoidal waves in y-direction.
Definition ABLFieldInit.H:100
void operator()(const amrex::Box &vbx, const amrex::Geometry &geom, const amrex::Array4< amrex::Real > &velocity, const amrex::Array4< amrex::Real > &density, const amrex::Array4< amrex::Real > &temperature) const
Definition ABLFieldInit.cpp:182
bool add_temperature_perturbations() const
Flag indicating whether temperature field needs perturbations.
Definition ABLFieldInit.H:44
amrex::Real m_rho
Initial density field.
Definition ABLFieldInit.H:88
void initialize_from_inputfile()
Definition ABLFieldInit.cpp:23
amrex::Real m_deltaU
Amplitude of fluctuations in x-direction.
Definition ABLFieldInit.H:91
amrex::Real m_tke_init_factor
Multiplicative factor for init tke profile.
Definition ABLFieldInit.H:121
amrex::Vector< amrex::Real > m_v_values
Definition ABLFieldInit.H:75
amrex::Real m_tke_init
Initial value for tke field.
Definition ABLFieldInit.H:118
bool m_init_uvtheta_profile
Profiles of u, v, and theta are read in from a NetCDF File.
Definition ABLFieldInit.H:145
amrex::Vector< amrex::Real > m_theta_values
Definition ABLFieldInit.H:66
amrex::Vector< amrex::Real > m_tke_values
Definition ABLFieldInit.H:76
amrex::Real m_theta_cutoff_height
Cutoff height for temperature fluctuations.
Definition ABLFieldInit.H:115
amrex::Gpu::DeviceVector< amrex::Real > m_windht_d
Definition ABLFieldInit.H:83
amrex::Real m_Uperiods
Number of sinusoidal waves in x-direction.
Definition ABLFieldInit.H:97
amrex::Real m_theta_gauss_var
Variance for Gaussian number generator.
Definition ABLFieldInit.H:112
amrex::Real m_vel_dir
Initial wind direction (rad)
Definition ABLFieldInit.H:60
amrex::Vector< amrex::Real > m_vel
Initial velocity components.
Definition ABLFieldInit.H:51
amrex::Real m_deltaV
Amplitude of fluctuations in y-direction.
Definition ABLFieldInit.H:94
amrex::Gpu::DeviceVector< amrex::Real > m_thht_d
Definition ABLFieldInit.H:80
amrex::RealArray m_top_vel
Top velocity.
Definition ABLFieldInit.H:127
void perturb_temperature(const int lev, const amrex::Geometry &geom, Field &temperature) const
Definition ABLFieldInit.cpp:348
void initialize_from_netcdf()
Definition ABLFieldInit.cpp:133
amrex::Real m_vel_speed
Initial wind speed.
Definition ABLFieldInit.H:57
bool m_initial_wind_profile
Definition ABLFieldInit.H:70
amrex::Real m_theta_gauss_mean
Mean for Gaussian number generator.
Definition ABLFieldInit.H:109
amrex::Real m_delta_t
Amplitude of temperature perturbations.
Definition ABLFieldInit.H:106
bool m_linear_profile
Initial linear velocity profile boolean.
Definition ABLFieldInit.H:133
bool m_perturb_vel
Perturb initial velocity field with sinusoidal fluctuations.
Definition ABLFieldInit.H:136
amrex::Gpu::DeviceVector< amrex::Real > m_prof_u_d
Definition ABLFieldInit.H:84
void init_tke(const amrex::Geometry &geom, amrex::MultiFab &tke) const
Initialize TKE field.
Definition ABLFieldInit.cpp:386
amrex::Vector< amrex::Real > m_u_values
Definition ABLFieldInit.H:74
amrex::Vector< amrex::Real > m_theta_heights
Definition ABLFieldInit.H:65
amrex::Vector< amrex::Real > m_wind_heights
Definition ABLFieldInit.H:73
bool m_tke_init_profile
Initialize tke profile non-constant.
Definition ABLFieldInit.H:142
std::string m_vel_timetable
File name for velocity forcing time table.
Definition ABLFieldInit.H:54
ABLFieldInit()
Definition ABLFieldInit.cpp:13
amrex::Real m_ref_height
Reference height for velocity perturbations.
Definition ABLFieldInit.H:103
Definition Field.H:116
Definition BCInterface.cpp:7