34 throw std::runtime_error(
"Invalid FLLC type");
40 namespace interp = ::amr_wind::interp;
61 vel_ptr = u_force_pnt_slice.
data();
69 for (
int ip = 0; ip < npts; ++ip) {
70 const auto force = data.
force[ip];
71 const auto vel = data.
vel_rel[ip];
72 const auto dr = fllc.
dr[ip];
75 const auto vmag2 = vmag * vmag;
77 const auto fv = force & vel;
79 G[ip] = (force - vel * fv / vmag2) / dr;
88 dG[npts - 1] = -1 * G[npts - 1];
89 for (
int ip = 1; ip < npts - 1; ++ip) {
90 dG[ip] = 0.5 * (G[ip + 1] - G[ip - 1]);
98 for (
int ip = 0; ip < npts; ++ip) {
100 const auto eps_les = fllc.
epsilon;
103 for (
int jp = 0; jp < npts; ++jp) {
110 const auto& vel = data.
vel_rel[jp];
117 1.0 - std::exp(-r_dis * r_dis / (eps_les * eps_les));
119 1.0 - std::exp(-r_dis * r_dis / (eps_opt * eps_opt));
127 u_les[ip] = u_les[ip] - dG[jp] * coefficient * cLes;
128 u_opt[ip] = u_opt[ip] - dG[jp] * coefficient * cOpt;
133 du[ip] = (1. - f) * du[ip] + f * (u_opt[ip] - u_les[ip]);
141 for (
int ip = 0; ip < npts; ++ip) {
142 vel_ptr[ip] = vel_ptr[ip] + du[ip];
160 namespace interp = ::amr_wind::interp;
182 vel_ptr = u_force_pnt_slice.
data();
189 for (
int ip = 0; ip < npts; ++ip) {
190 const auto force = data.
force[ip];
191 const auto vel = data.
vel_rel[ip];
192 const auto dr = fllc.
dr[ip];
195 const auto vmag2 = vmag * vmag;
197 const auto fv = force & vel;
199 G[ip] = (force - vel * fv / vmag2) / dr;
212 const auto optimal_epsilon = (fllc.
nonuniform)
218 const auto G_new = (fllc.
nonuniform) ? nonuniform_G : G;
224 for (
int ip = 0; ip < npts; ++ip) {
228 for (
int jp = 0; jp < dr.size(); ++jp) {
230 const auto eps_les = fllc.
epsilon;
231 const auto eps_opt = optimal_epsilon[jp];
232 const auto eps_les2 = eps_les * eps_les;
233 const auto eps_opt2 = eps_opt * eps_opt;
234 const auto& vel = vel_rel[jp];
247 k_les = .5 / (eps_les2);
248 k_opt = .5 / (eps_opt2);
254 auto exp_les = std::exp(-r_dis * r_dis / eps_les2);
255 auto exp_opt = std::exp(-r_dis * r_dis / eps_opt2);
257 k_les = exp_les / eps_les2 +
258 1. / (2. * r_dis * r_dis) * (exp_les - 1.);
259 k_opt = exp_opt / eps_opt2 +
260 1. / (2. * r_dis * r_dis) * (exp_opt - 1.);
264 u_les[ip] + coefficient * G_new[jp] / vmag * k_les * dr[jp];
266 u_opt[ip] + coefficient * G_new[jp] / vmag * k_opt * dr[jp];
271 du[ip] = (1. - f) * du[ip] + f * (u_opt[ip] - u_les[ip]);
278 for (
int ip = 0; ip < npts; ++ip) {
279 vel_ptr[ip] = vel_ptr[ip] + du[ip];
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::iterator_traits< C2 >::value_type linear(const C1 xbegin, const C1 xend, const C2 yinp, const typename std::iterator_traits< C1 >::value_type &xout, const int ncomp=1, const int comp=0)
Definition linear_interpolation.H:126
Slice< T > slice(std::vector< T > &vec, const size_t start, const size_t count)
Definition Slice.H:66
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real pi()
Return as an amrex::Real.
Definition trig_ops.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T mag(const TensorT< T > &t)
Definition tensorI.H:182
Definition actuator_types.H:126
VecSlice vel
Definition actuator_types.H:133
VecSlice vel_rel
Definition actuator_types.H:134
VecSlice force
Definition actuator_types.H:128
VecSlice vel_pos
Definition actuator_types.H:132
RealList span_distance_force
Definition FLLC.H:36
amrex::Real epsilon
Definition FLLC.H:19
RealList nonuniform_r
Definition FLLC.H:41
VecList vel_rel
Definition FLLC.H:43
bool initialized
Definition FLLC.H:33
amrex::Real relaxation_factor
Definition FLLC.H:20
RealList dr
Definition FLLC.H:23
RealList nonuniform_optimal_epsilon
Definition FLLC.H:45
RealList optimal_epsilon
Definition FLLC.H:24
VecList optimal_velocity
Definition FLLC.H:29
bool different_sizes
Definition FLLC.H:34
RealList nonuniform_dr
Definition FLLC.H:42
VecList correction_velocity
Definition FLLC.H:30
bool nonuniform
Definition FLLC.H:39
VecList nonuniform_vel_rel
Definition FLLC.H:44
VecList force_point_velocity
Definition FLLC.H:27
FLLCType correction_type
Definition FLLC.H:18
VecList les_velocity
Definition FLLC.H:28
VecList nonuniform_lift
Definition FLLC.H:46
VecList grad_lift
Definition FLLC.H:32
RealList span_distance_vel
Definition FLLC.H:35
RealList r
Definition FLLC.H:22
VecList lift
Definition FLLC.H:31
This struct will operate on a blade/wing. The velocity from the simulation is corrected using the Fil...
Definition FLLCOp.H:17
static void variable_chord(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:158
void operator()(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:18
static void constant_chord(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:38
AMREX_GPU_HOST_DEVICE pointer data()
Definition Slice.H:54