162 n_x, n_y, n_z, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, &
163 kappa, mu_w, rho_w, g_vec, Pr, z0, z0h_in, bc_type, bc_value, tstep, &
164 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, ts_diagn,&
165 q_diagn, h_x_idx, h_y_idx, h_z_idx)
166 integer,
intent(in) :: n_nodes, lx, nelv, tstep
167 real(kind=
rp),
dimension(lx, lx, lx, nelv),
intent(in) :: u, v, w, temp
168 integer,
intent(in),
dimension(n_nodes) :: ind_r, ind_s, ind_t, ind_e
169 real(kind=
rp),
dimension(n_nodes),
intent(in) :: n_x, n_y, n_z, h
170 real(kind=
rp),
intent(in) :: kappa, z0, z0h_in, bc_value, pr
171 real(kind=
rp),
dimension(3),
intent(in) :: g_vec
172 real(kind=
rp),
dimension(n_nodes),
intent(in) :: mu_w, rho_w
173 real(kind=
rp) :: g_dot_n
174 character(len=*),
intent(in) :: bc_type
175 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: tau_x, tau_y, tau_z
176 real(kind=
rp) :: ui, vi, wi, hi, rho, mu
177 real(kind=
rp) :: normu, z0h
178 real(kind=
rp) :: l_upper, l_lower, l_old
179 real(kind=
rp) :: f, dfdl, fd_h, l_new, l_sign
181 integer,
parameter :: max_count = 50
182 real(kind=
rp),
parameter :: tol = 0.001_rp
183 real(kind=
rp),
parameter :: nr_step = 0.001_rp
184 real(kind=
rp),
parameter :: ri_threshold = 0.0001_rp
185 character(len=LOG_SIZE) :: log_buf
186 real(kind=
rp) :: utau, ri_b, l_ob, magu, q, ti, ts
187 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: ri_b_diagn, l_ob_diagn
188 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: utau_diagn, magu_diagn
189 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: ti_diagn, ts_diagn
190 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: q_diagn
191 integer,
dimension(n_nodes),
intent(in) :: h_x_idx
192 integer,
dimension(n_nodes),
intent(in) :: h_y_idx
193 integer,
dimension(n_nodes),
intent(in) :: h_z_idx
197 ui = u(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
198 vi = v(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
199 wi = w(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
200 ti = temp(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
206 normu = ui * n_x(i) + vi * n_y(i) + wi * n_z(i)
207 ui = ui - normu * n_x(i)
208 vi = vi - normu * n_y(i)
209 wi = wi - normu * n_z(i)
212 magu = sqrt(ui**2 + vi**2 + wi**2)
213 magu =
max(magu, 1.0e-6_rp)
214 utau = magu*kappa / log(hi/z0)
219 z0h = z0 * exp(z0h_in*sqrt((utau*z0)/(mu/rho)))
229 g_dot_n = abs(g_vec(1)*n_x(i) + g_vec(2)*n_y(i) + g_vec(3)*n_z(i))
232 call compute_ri_b(bc_type, g_dot_n, hi, ti, ts, magu, kappa, q, pr, ri_b)
235 if (abs((ri_b)) <= ri_threshold)
then
240 if ((ri_b) > 0.0_rp)
then
241 l_ob = hi /
max(ri_b, ri_threshold)
244 l_ob = hi / min(ri_b, -ri_threshold)
252 do while ((abs(l_old - l_ob)/abs(l_ob) > tol) .and. (count < max_count))
257 l_upper = l_ob + fd_h
258 l_lower = l_ob - fd_h
262 dfdl =
dfdl_ptr(l_upper, l_lower, hi, z0, z0h, pr, l_ob, &
264 if (abs(dfdl) < 1.0e-12_rp)
call neko_error(
"Division by zero in dfdl")
265 l_new = l_ob - f/dfdl
267 if (l_new*l_sign <= 0.0_rp)
then
269 l_new = 0.5_rp * l_ob
272 l_ob = sign(
max(abs(l_new), 1.0e-8_rp), l_sign)
273 l_ob = sign(min(abs(l_ob), 1.0e8_rp), l_sign)
276 if (abs(l_ob) > 5e5_rp .or. abs(l_ob) < 1e-6_rp)
then
278 call neko_warning(
"Obukhov length did not converge (MOST wall model)")
281 if (.not.
associated(
f_ptr) .or. .not.
associated(
dfdl_ptr))
then
282 call neko_error(
"Unassociated pointer for f or dfdl")
287 select case (bc_type)
295 q = kappa/pr*utau*(ts - ti)/
slaw_h_ptr(hi, l_ob, z0h)
297 call neko_error(
"Invalid specified temperature b.c. type ('neumann' or 'dirichlet'?)")
301 magu =
max(magu, 1.0e-6_rp)
302 tau_x(i) = -rho * utau**2 * ui / magu
303 tau_y(i) = -rho * utau**2 * vi / magu
304 tau_z(i) = -rho * utau**2 * wi / magu
311 ts_diagn(i) = temp(ind_r(i)-h_x_idx(i), ind_s(i)-h_y_idx(i), ind_t(i)-h_z_idx(i), ind_e(i))
subroutine, public most_compute_cpu(u, v, w, temp, ind_r, ind_s, ind_t, ind_e, n_x, n_y, n_z, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, kappa, mu_w, rho_w, g_vec, pr, z0, z0h_in, bc_type, bc_value, tstep, ri_b_diagn, l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, ts_diagn, q_diagn, h_x_idx, h_y_idx, h_z_idx)
Main routine to compute the surface stresses based on MOST.