166 n_x, n_y, n_z, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, &
167 kappa, mu_w, rho_w, g_vec, Pr, z0, z0h_in, bc_type, bc_value, tstep, &
168 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, ts_diagn,&
169 q_diagn, h_x_idx, h_y_idx, h_z_idx)
170 integer,
intent(in) :: n_nodes, lx, nelv, tstep
171 real(kind=
rp),
dimension(lx, lx, lx, nelv),
intent(in) :: u, v, w, temp
172 integer,
intent(in),
dimension(n_nodes) :: ind_r, ind_s, ind_t, ind_e
173 real(kind=
rp),
dimension(n_nodes),
intent(in) :: n_x, n_y, n_z, h
174 real(kind=
rp),
intent(in) :: kappa, z0, z0h_in, bc_value, pr
175 real(kind=
rp),
dimension(3),
intent(in) :: g_vec
176 real(kind=
rp),
dimension(n_nodes),
intent(in) :: mu_w, rho_w
177 real(kind=
rp) :: g_dot_n
178 character(len=*),
intent(in) :: bc_type
179 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: tau_x, tau_y, tau_z
180 real(kind=
rp) :: ui, vi, wi, hi, rho, mu
181 real(kind=
rp) :: normu, z0h
182 real(kind=
rp) :: l_upper, l_lower, l_old
183 real(kind=
rp) :: f, dfdl, fd_h, l_new, l_sign
185 integer,
parameter :: max_count = 50
186 real(kind=
rp),
parameter :: tol = 0.001_rp
187 real(kind=
rp),
parameter :: nr_step = 0.001_rp
188 real(kind=
rp),
parameter :: ri_threshold = 0.0001_rp
189 character(len=LOG_SIZE) :: log_buf
190 real(kind=
rp) :: utau, ri_b, l_ob, magu, q, ti, ts
191 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: ri_b_diagn, l_ob_diagn
192 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: utau_diagn, magu_diagn
193 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: ti_diagn, ts_diagn
194 real(kind=
rp),
dimension(n_nodes),
intent(inout) :: q_diagn
195 integer,
dimension(n_nodes),
intent(in) :: h_x_idx
196 integer,
dimension(n_nodes),
intent(in) :: h_y_idx
197 integer,
dimension(n_nodes),
intent(in) :: h_z_idx
201 ui = u(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
202 vi = v(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
203 wi = w(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
204 ti = temp(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
210 normu = ui * n_x(i) + vi * n_y(i) + wi * n_z(i)
211 ui = ui - normu * n_x(i)
212 vi = vi - normu * n_y(i)
213 wi = wi - normu * n_z(i)
216 magu = sqrt(ui**2 + vi**2 + wi**2)
217 magu =
max(magu, 1.0e-6_rp)
218 utau = magu*kappa / log(hi/z0)
223 z0h = z0 * exp(z0h_in*sqrt((utau*z0)/(mu/rho)))
234 g_dot_n = abs(g_vec(1)*n_x(i) + g_vec(2)*n_y(i) + g_vec(3)*n_z(i))
237 call compute_ri_b(bc_type, g_dot_n, hi, ti, ts, magu, kappa, q, pr, ri_b)
240 if (abs((ri_b)) <= ri_threshold)
then
245 if ((ri_b) > 0.0_rp)
then
246 l_ob = hi /
max(ri_b, ri_threshold)
249 l_ob = hi / min(ri_b, -ri_threshold)
257 do while ((abs(l_old - l_ob) / abs(l_ob) > tol) .and. &
264 l_upper = l_ob + fd_h
265 l_lower = l_ob - fd_h
269 dfdl =
dfdl_ptr(l_upper, l_lower, hi, z0, z0h, pr, l_ob, &
271 if (abs(dfdl) < 1.0e-12_rp)
then
274 l_new = l_ob - f/dfdl
276 if (l_new*l_sign <= 0.0_rp)
then
278 l_new = 0.5_rp * l_ob
281 l_ob = sign(
max(abs(l_new), 1.0e-8_rp), l_sign)
282 l_ob = sign(min(abs(l_ob), 1.0e8_rp), l_sign)
285 if (abs(l_ob) > 5e5_rp .or. abs(l_ob) < 1e-6_rp)
then
287 call neko_warning(
"Obukhov length did not converge " // &
291 if (.not.
associated(
f_ptr) .or. .not.
associated(
dfdl_ptr))
then
292 call neko_error(
"Unassociated pointer for f or dfdl")
297 select case (bc_type)
305 q = kappa/pr*utau*(ts - ti)/
slaw_h_ptr(hi, l_ob, z0h)
307 call neko_error(
"Invalid specified temperature b.c. type " // &
308 "('neumann' or 'dirichlet'?)")
313 magu =
max(magu, 1.0e-6_rp)
314 tau_x(i) = -rho * utau**2 * ui / magu
315 tau_y(i) = -rho * utau**2 * vi / magu
316 tau_z(i) = -rho * utau**2 * wi / magu
323 ts_diagn(i) = temp(ind_r(i) - h_x_idx(i), ind_s(i) - h_y_idx(i), &
324 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.