35#ifndef RICHARDSON_KERNEL_H
36#define RICHARDSON_KERNEL_H
49 return 0.17 * (0.25 + 0.75 / (1.0 + 4.0 *
Ri_b));
55 return -0.145 / (1.0 + 4.0 *
Ri_b);
92 T a = kappa / log(h / z0);
94 T c = 7.4 * (
a *
a) * b *
sqrt(h / z0);
102 T a = kappa / log(h /
z0h);
116 T val = (kappa * magu) / log(h / z0);
123 return kappa * utau * (ti - ts) / log(h /
z0h);
129template<
typename T,
int BC_TYPE>
171 if(idx >= n_nodes)
return;
176 for (
int i = idx;
i < n_nodes;
i +=
str) {
177 const int index = (ind_e_d[
i] - 1) * lx * lx * lx +
178 (ind_t_d[
i] - 1) * lx * lx +
179 (ind_s_d[
i] - 1) * lx +
186 T ti = temp_d[index];
203 magu =
fmax(magu, (
T)1
e-6);
205 T utau = kappa * magu / log(
hi/z0);
212 z0h = z0 *
exp(z0h_in *
sqrt((utau*z0)/(mu/rho)));
225 q = kappa * utau * (ts - ti) / log(
hi/
z0h);
233 Ri_b = -
g_dot_n *
hi / ti * q / (magu * magu * magu * kappa * kappa);
272 const int index_ts = (ind_e_d[
i] - 1) * lx * lx * lx +
273 (ind_t_d[
i] - 1 - h_z_idx[
i]) * lx * lx +
274 (ind_s_d[
i] - 1 - h_y_idx[
i]) * lx +
275 (ind_r_d[
i] - 1 - h_x_idx[
i]);
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
__device__ T f_tau_stable(T Ri_b)
__device__ T tau_convective(T magu, T Ri_b, T h, T z0, T kappa)
__device__ T heat_flux_neutral(T ti, T ts, T h, T z0h, T utau, T kappa)
__device__ T tau_neutral(T magu, T h, T z0, T kappa)
__device__ T heat_flux_convective(T ti, T ts, T Ri_b, T h, T magu, T z0h, T kappa)
__device__ T tau_stable(T magu, T Ri_b, T h, T z0, T kappa)
__device__ T f_theta_convective(T Ri_b, T c)
__global__ void richardson_compute(const T *__restrict__ u_d, const T *__restrict__ v_d, const T *__restrict__ w_d, const T *__restrict__ temp_d, const T *__restrict__ h_d, const T *__restrict__ n_x_d, const T *__restrict__ n_y_d, const T *__restrict__ n_z_d, const int *__restrict__ ind_r_d, const int *__restrict__ ind_s_d, const int *__restrict__ ind_t_d, const int *__restrict__ ind_e_d, T *__restrict__ tau_x_d, T *__restrict__ tau_y_d, T *__restrict__ tau_z_d, int n_nodes, int lx, T kappa, const T *__restrict__ mu_w_d, const T *__restrict__ rho_w_d, T g1, T g2, T g3, T Pr, T z0, T z0h_in, T bc_value, T *__restrict__ Ri_b_diagn, T *__restrict__ L_ob_diagn, T *__restrict__ utau_diagn, T *__restrict__ magu_diagn, T *__restrict__ ti_diagn, T *__restrict__ ts_diagn, T *__restrict__ q_diagn, const int *__restrict__ h_x_idx, const int *__restrict__ h_y_idx, const int *__restrict__ h_z_idx)
__device__ T heat_flux_stable(T ti, T ts, T Ri_b, T h, T z0h, T utau, T kappa, T Pr)
__device__ T f_tau_convective(T Ri_b, T c)
__device__ T f_theta_stable(T Ri_b)