13#ifndef SYNTHETIC_INFLOW_H
14#define SYNTHETIC_INFLOW_H
22#include <Kokkos_Core.hpp>
34using Point = std::array<double, N_DIM>;
46 InletProfile(
const toml::value & boundary,
const std::string & where);
49 static bool turbulent(
const toml::value & boundary) {
return boundary.contains(
"turbulence"); }
63 std::shared_ptr<Expression> expression;
64 double at(
const Point & x)
const;
68 std::vector<Field> stress;
71 std::vector<double> coordinate;
72 std::vector<std::vector<double>> columns;
74 void read_table(
const toml::value &
turbulence,
const std::string & where);
75 double table(
size_t column,
double s)
const;
108 const std::vector<uint32_t> & faces,
const std::vector<int32_t> &
char_index);
114 std::string
summary()
const {
return summary_; }
128 static constexpr int N_T =
N_DIM - 1;
129 static constexpr uint32_t N_CACHE = 4;
130 static constexpr uint32_t CHUNK = 256;
132 std::string summary_;
139 double spacing[N_T] = {};
140 double origin[N_T] = {};
141 bool periodic[N_T] = {};
145 double dt_plane = 0.0;
147 bool zero_net_flux =
true;
153 Kokkos::View<rtype ***> kernels;
157 Kokkos::View<int32_t *> face_char;
158 Kokkos::View<int32_t *[N_T][2]> face_corner;
159 Kokkos::View<rtype *[N_T]> face_fraction;
160 Kokkos::View<rtype *[N_DIM]> face_scale;
161 Kokkos::View<rtype *[N_DIM]> face_mean;
162 Kokkos::View<rtype *[N_STRESS]> face_cholesky;
165 Kokkos::View<rtype **> random_work;
166 Kokkos::View<rtype **> filter_work;
167 Kokkos::View<rtype ***> filtered;
168 std::vector<int64_t> filtered_index;
169 Kokkos::View<rtype ***> planes;
170 std::vector<int64_t> plane_index;
171 std::vector<uint64_t> plane_used;
173 Kokkos::View<rtype **> flux_weight;
174 Kokkos::View<rtype **> chunk_sums;
175 Kokkos::View<rtype **> plane_flux;
Mean velocity and Reynolds stress of an nscbc_inlet at given points: u (numbers or expressions in x,...
Definition synthetic_inflow.h:44
bool uniform() const
Whether the mean velocity is the same everywhere.
Definition synthetic_inflow.h:52
std::array< double, N_DIM > velocity(const Point &x) const
Definition synthetic_inflow.cpp:285
std::array< double, N_STRESS > stress_at(const Point &x) const
Reynolds stress in N_STRESS order (zero without turbulence).
Definition synthetic_inflow.cpp:291
static bool turbulent(const toml::value &boundary)
Whether the boundary has a [boundaries.turbulence] table.
Definition synthetic_inflow.h:49
Synthetic turbulence for one nscbc_inlet: the digital filter of Klein, Sadiki & Janicka (2003),...
Definition synthetic_inflow.h:97
void time_filter(int64_t m, uint32_t slot)
Definition synthetic_inflow.cpp:725
double time_spacing() const
Time between filtered planes.
Definition synthetic_inflow.h:117
std::string summary() const
One-line description for the run log.
Definition synthetic_inflow.h:114
uint32_t plane(int64_t m)
Definition synthetic_inflow.cpp:631
double convection_velocity() const
Convection velocity of Taylor's hypothesis.
Definition synthetic_inflow.h:119
void net_flux(uint32_t slot)
Definition synthetic_inflow.cpp:740
void random_plane(int64_t m, uint32_t slot)
Definition synthetic_inflow.cpp:654
void fill(double t, const Kokkos::View< rtype *[N_DIM]> &target)
Write the target velocity (mean plus fluctuation) of the inlet's faces at time t into target(k).
Definition synthetic_inflow.cpp:761
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
float rtype
Definition common_typedef.h:39
#define N_DIM
Definition common_typedef.h:28
Host-side analytical expressions of (x, y, z, t) from input files.
std::array< double, N_DIM > Point
Point in space.
Definition synthetic_inflow.h:34
constexpr uint8_t N_STRESS
Independent components of a symmetric tensor: 2D [xx, yy, xy], 3D [xx, yy, zz, xy,...
Definition synthetic_inflow.h:31