|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include <ERF_WakeLines.H>

Public Member Functions | |
| WakeLines (std::string name, std::string output_root, const std::array< amrex::Real, 3 > &hub, const std::array< amrex::Real, 3 > &axis, amrex::Real diameter, const std::vector< amrex::Real > &lines_xD, amrex::Real half_width, int num_points, amrex::Real z_min) | |
| WakeLines (std::string name, std::string output_root, const std::array< amrex::Real, 3 > &hub, const std::array< amrex::Real, 3 > &axis, amrex::Real diameter, const std::vector< amrex::Real > &lines_xD, amrex::Real half_width, int num_points, const std::vector< amrex::Real > &z_min) | |
| const std::string & | name () const |
| int | num_points () const |
| const std::vector< amrex::Real > & | positions () const |
| const std::array< amrex::Real, 3 > & | hub () const |
| const std::array< amrex::Real, 3 > & | axis () const |
| amrex::Real | diameter () const |
| int | num_samples () const |
| void | accumulate (const std::vector< amrex::Real > &vel) |
| std::vector< amrex::Real > | average () const |
| void | write_instantaneous (double time, const std::vector< amrex::Real > &vel, bool truncate) const |
| void | write_average () const |
| void | write_state (const std::string &dir) const |
| bool | read_state (const std::string &dir) |
Private Member Functions | |
| void | write_rows (std::ofstream &out, const std::vector< amrex::Real > &vel, const std::string &prefix) const |
Private Attributes | |
| std::string | m_name |
| std::string | m_output_root |
| std::array< amrex::Real, 3 > | m_hub |
| std::array< amrex::Real, 3 > | m_axis |
| std::array< amrex::Real, 3 > | m_lateral |
| amrex::Real | m_diameter {0.0} |
| std::vector< amrex::Real > | m_xD |
| amrex::Real | m_half_width {1.5} |
| int | m_npts {0} |
| std::vector< amrex::Real > | m_s |
| n offsets along the lines, in diameters More... | |
| std::vector< amrex::Real > | m_pos |
| 3*n More... | |
| std::vector< double > | m_sum |
| 3*n running sums, in double whatever Real is More... | |
| int | m_count {0} |
Wake sampling lines behind one rotor: at each downstream distance x/D along the horizontal projection of the rotor axis through the hub (a wake follows the wind at hub height, not a tilted shaft), one lateral line (horizontal, normal to that direction) and one vertical line, each of num_points points spanning +-half_width diameters about the center. The sampled velocities are written as they are and accumulated into a running time average.
Point order: for each x/D, the lateral line then the vertical line, each from -half_width to +half_width; the vertical line is clipped at z_min (the ground), so its lowest point may sit above -half_width. Every point's offset s (in diameters) is recorded in the files. The lateral line runs along (-axis_y, axis_x, 0), from the right of the downstream direction to its left; the vertical line runs up. Positions in m, ERF domain coordinates; velocities in m/s.
| erf_actuator::WakeLines::WakeLines | ( | std::string | name, |
| std::string | output_root, | ||
| const std::array< amrex::Real, 3 > & | hub, | ||
| const std::array< amrex::Real, 3 > & | axis, | ||
| amrex::Real | diameter, | ||
| const std::vector< amrex::Real > & | lines_xD, | ||
| amrex::Real | half_width, | ||
| int | num_points, | ||
| amrex::Real | z_min | ||
| ) |
Build the sampling points.
| hub | the rotor's hub (m) |
| axis | the rotor axis (any non-vertical vector; its horizontal projection is used) |
| diameter | the rotor diameter (m, > 0) |
| lines_xD | downstream distances of the lines, in diameters (at least one) |
| half_width | half the length of each line, in diameters (> 0) |
| num_points | points per line (>= 2) |
| z_min | the ground under the hub (m, finite): the vertical line starts no lower |
| erf_actuator::WakeLines::WakeLines | ( | std::string | name, |
| std::string | output_root, | ||
| const std::array< amrex::Real, 3 > & | hub, | ||
| const std::array< amrex::Real, 3 > & | axis, | ||
| amrex::Real | diameter, | ||
| const std::vector< amrex::Real > & | lines_xD, | ||
| amrex::Real | half_width, | ||
| int | num_points, | ||
| const std::vector< amrex::Real > & | z_min | ||
| ) |
The same with one ground height per downstream distance (z_min[n] under the center of the lines at lines_xD[n], from terrain_heights), so that on terrain rising or falling downstream each vertical line stops at its own ground. z_min must have lines_xD's size.
| void erf_actuator::WakeLines::accumulate | ( | const std::vector< amrex::Real > & | vel | ) |
Add one set of sampled velocities (3*n, m/s, finite) to the running average.

| std::vector< Real > erf_actuator::WakeLines::average | ( | ) | const |
|
inline |
The unit downstream direction: the rotor axis projected on the horizontal plane.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
3*n positions of the sampling points (m).
| bool erf_actuator::WakeLines::read_state | ( | const std::string & | dir | ) |
Restore the state written by write_state(), geometry included; false when there is none. Aborts, changing nothing, when the file is malformed: a negative count, a diameter that is not positive, an axis that is not a horizontal unit vector, or a non-finite value.

| void erf_actuator::WakeLines::write_average | ( | ) | const |
Rewrite <output_root>_wake_avg.csv with the running average (the file always holds the current mean).

| void erf_actuator::WakeLines::write_instantaneous | ( | double | time, |
| const std::vector< amrex::Real > & | vel, | ||
| bool | truncate | ||
| ) | const |
Write the sampled velocities to <output_root>_wake.csv, one row per point: truncate starts the file afresh, otherwise the rows are appended; the header is written when open_log() asks for one. Units: time s, x y z m, u v w m/s.

|
private |
| void erf_actuator::WakeLines::write_state | ( | const std::string & | dir | ) | const |
The lines' state for a checkpoint, <dir>/<name>_wake_avg.dat: the sampling geometry (hub, axis, diameter, the points) and the running sums. The geometry is stored because a body model may rebuild the hub and diameter from lower-precision data after a restart and land a few ulps away; the stored points keep the average on the same positions.
|
private |
Referenced by axis().
|
private |
Referenced by num_samples().
|
private |
Referenced by diameter().
|
private |
|
private |
Referenced by hub().
|
private |
|
private |
Referenced by name().
|
private |
|
private |
|
private |
3*n
Referenced by num_points(), and positions().
|
private |
n offsets along the lines, in diameters
|
private |
3*n running sums, in double whatever Real is
|
private |