114 auto dx = geom.CellSizeArray();
117 const amrex::Box& domain = geom.Domain();
118 int domlo_z = domain.smallEnd(2);
119 int domhi_z = domain.bigEnd(2) + 1;
126 mf_vars_fitch.setVal(0.0);
129 Gpu::DeviceVector<Real> d_wind_speed(
wind_speed.size());
130 Gpu::DeviceVector<Real> d_thrust_coeff(
thrust_coeff.size());
136 for ( MFIter mfi(cons_in,TilingIfNotGPU()); mfi.isValid(); ++mfi) {
138 const Box& gbx = mfi.growntilebox(1);
139 auto fitch_array = mf_vars_fitch.array(mfi);
140 auto Nturb_array = mf_Nturb.array(mfi);
141 auto u_vel = U_old.array(mfi);
142 auto v_vel = V_old.array(mfi);
143 auto w_vel = W_old.array(mfi);
145 const Real* wind_speed_d = d_wind_speed.dataPtr();
146 const Real* thrust_coeff_d = d_thrust_coeff.dataPtr();
147 const int n_spec_table = d_wind_speed.size();
149 ParallelFor(gbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
150 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
153 Real z_kp1 = (kk+1)*dx[2];
155 Real A_ijk =
compute_Aijk(z_k, z_kp1, d_hub_height, d_rotor_rad);
159 Real Vabs = std::pow(u_vel(i,j,k)*u_vel(i,j,k) +
160 v_vel(i,j,k)*v_vel(i,j,k) +
161 w_vel(i,j,kk)*w_vel(i,j,kk), 0.5);
163 Real C_T =
interpolate_1d(wind_speed_d, thrust_coeff_d, Vabs, n_spec_table);
166 fitch_array(i,j,k,0) = Vabs;
167 fitch_array(i,j,k,1) = -0.5*Nturb_array(i,j,k)/(dx[0]*dx[1])*C_T*Vabs*Vabs*A_ijk/(z_kp1 - z_k);
168 fitch_array(i,j,k,2) = u_vel(i,j,k)/Vabs*fitch_array(i,j,k,1);
169 fitch_array(i,j,k,3) = v_vel(i,j,k)/Vabs*fitch_array(i,j,k,1);
170 fitch_array(i,j,k,4) = 0.5*Nturb_array(i,j,k)/(dx[0]*dx[1])*C_TKE*std::pow(Vabs,3)*A_ijk/(z_kp1 - z_k);
AMREX_FORCE_INLINE AMREX_GPU_DEVICE Real compute_Aijk(const Real z_k, const Real z_kp1, const Real hub_height, const Real rotor_rad)
Definition: ERF_AdvanceFitch.cpp:25
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real interpolate_1d(const amrex::Real *alpha, const amrex::Real *beta, const amrex::Real alpha_interp, const int alpha_size)
Definition: ERF_Interpolation_1D.H:12
amrex::Vector< amrex::Real > thrust_coeff
Definition: ERF_Fitch.H:44
amrex::Vector< amrex::Real > power
Definition: ERF_Fitch.H:44
amrex::Real rotor_rad
Definition: ERF_Fitch.H:43
amrex::Real thrust_coeff_standing
Definition: ERF_Fitch.H:43
amrex::Real hub_height
Definition: ERF_Fitch.H:43
amrex::Vector< amrex::Real > wind_speed
Definition: ERF_Fitch.H:44
void get_turb_spec(amrex::Real &rotor_rad, amrex::Real &hub_height, amrex::Real &thrust_coeff_standing, amrex::Vector< amrex::Real > &wind_speed, amrex::Vector< amrex::Real > &thrust_coeff, amrex::Vector< amrex::Real > &power)
Definition: ERF_NullWindFarm.H:84