9using namespace amrex::literals;
37 throw std::runtime_error(
"Invalid FLLC type");
64 vel_ptr = u_force_pnt_slice.
data();
72 for (
int ip = 0; ip < npts; ++ip) {
73 const auto force = data.
force[ip];
74 const auto vel = data.
vel_rel[ip];
75 const auto dr = fllc.
dr[ip];
76 const auto vmag = amrex::max<amrex::Real>(
78 const auto vmag2 = vmag * vmag;
80 const auto fv = force & vel;
82 G[ip] = (force - vel * fv / vmag2) / dr;
92 dG[npts - 1] = -1 * G[npts - 1];
93 for (
int ip = 1; ip < npts - 1; ++ip) {
94 dG[ip] = 0.5_rt * (G[ip + 1] - G[ip - 1]);
103 for (
int ip = 0; ip < npts; ++ip) {
105 const auto eps_les = fllc.
epsilon;
108 for (
int jp = 0; jp < npts; ++jp) {
115 const auto& vel = data.
vel_rel[jp];
116 const auto vmag = amrex::max<amrex::Real>(
122 1.0_rt - std::exp(-r_dis * r_dis / (eps_les * eps_les));
124 1.0_rt - std::exp(-r_dis * r_dis / (eps_opt * eps_opt));
132 u_les[ip] = u_les[ip] - dG[jp] * coefficient * cLes;
133 u_opt[ip] = u_opt[ip] - dG[jp] * coefficient * cOpt;
138 du[ip] = (1.0_rt - f) * du[ip] + f * (u_opt[ip] - u_les[ip]);
146 for (
int ip = 0; ip < npts; ++ip) {
147 vel_ptr[ip] = vel_ptr[ip] + du[ip];
187 vel_ptr = u_force_pnt_slice.
data();
194 for (
int ip = 0; ip < npts; ++ip) {
195 const auto force = data.
force[ip];
196 const auto vel = data.
vel_rel[ip];
197 const auto dr = fllc.
dr[ip];
198 const auto vmag = amrex::max<amrex::Real>(
200 const auto vmag2 = vmag * vmag;
202 const auto fv = force & vel;
204 G[ip] = (force - vel * fv / vmag2) / dr;
217 const auto optimal_epsilon = (fllc.
nonuniform)
223 const auto G_new = (fllc.
nonuniform) ? nonuniform_G : G;
229 for (
int ip = 0; ip < npts; ++ip) {
233 for (
int jp = 0; jp < dr.size(); ++jp) {
235 const auto eps_les = fllc.
epsilon;
236 const auto eps_opt = optimal_epsilon[jp];
237 const auto eps_les2 = eps_les * eps_les;
238 const auto eps_opt2 = eps_opt * eps_opt;
239 const auto& vel = vel_rel[jp];
240 const auto vmag = amrex::max<amrex::Real>(
252 k_les = 0.5_rt / (eps_les2);
253 k_opt = 0.5_rt / (eps_opt2);
259 auto exp_les = std::exp(-r_dis * r_dis / eps_les2);
260 auto exp_opt = std::exp(-r_dis * r_dis / eps_opt2);
262 k_les = exp_les / eps_les2 + 1.0_rt /
263 (2.0_rt * r_dis * r_dis) *
265 k_opt = exp_opt / eps_opt2 + 1.0_rt /
266 (2.0_rt * r_dis * r_dis) *
271 u_les[ip] + coefficient * G_new[jp] / vmag * k_les * dr[jp];
273 u_opt[ip] + coefficient * G_new[jp] / vmag * k_opt * dr[jp];
278 du[ip] = (1.0_rt - f) * du[ip] + f * (u_opt[ip] - u_les[ip]);
285 for (
int ip = 0; ip < npts; ++ip) {
286 vel_ptr[ip] = vel_ptr[ip] + du[ip];
::amr_wind::utils::Slice< amr_wind::vs::Vector > VecSlice
Definition actuator_types.H:66
@ ConstantChord
Definition FLLC.H:12
@ VariableChord
Definition FLLC.H:12
Definition linear_interpolation.H:10
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:129
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:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T mag(const TensorT< T > &t)
Definition tensorI.H:182
VectorT< amrex::Real > Vector
Definition vector.H:148
Definition actuator_types.H:129
VecSlice vel
Definition actuator_types.H:136
VecSlice vel_rel
Definition actuator_types.H:137
VecSlice force
Definition actuator_types.H:131
VecSlice vel_pos
Definition actuator_types.H:135
RealList span_distance_force
Definition FLLC.H:39
amrex::Real epsilon
Definition FLLC.H:22
RealList nonuniform_r
Definition FLLC.H:44
VecList vel_rel
Definition FLLC.H:46
bool initialized
Definition FLLC.H:36
amrex::Real relaxation_factor
Definition FLLC.H:23
RealList dr
Definition FLLC.H:26
RealList nonuniform_optimal_epsilon
Definition FLLC.H:48
RealList optimal_epsilon
Definition FLLC.H:27
VecList optimal_velocity
Definition FLLC.H:32
bool different_sizes
Definition FLLC.H:37
RealList nonuniform_dr
Definition FLLC.H:45
VecList correction_velocity
Definition FLLC.H:33
bool nonuniform
Definition FLLC.H:42
VecList nonuniform_vel_rel
Definition FLLC.H:47
VecList force_point_velocity
Definition FLLC.H:30
FLLCType correction_type
Definition FLLC.H:21
VecList les_velocity
Definition FLLC.H:31
VecList nonuniform_lift
Definition FLLC.H:49
VecList grad_lift
Definition FLLC.H:35
RealList span_distance_vel
Definition FLLC.H:38
RealList r
Definition FLLC.H:25
VecList lift
Definition FLLC.H:34
This struct will operate on a blade/wing. The velocity from the simulation is corrected using the Fil...
Definition FLLCOp.H:20
static void variable_chord(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:163
void operator()(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:21
static void constant_chord(ComponentView &data, FLLCData &fllc)
Definition FLLCOp.H:41
AMREX_GPU_HOST_DEVICE pointer data()
Definition Slice.H:54