Appearance
adam_flume_wall_model_library
ADAM, FLUME equilibrium wall model (issue #119, T3.4).
The thin-layer equations between the wall and a sample at height h, parallel velocity us, temperature ts, pressure ps (uniform across the layer): d/dy[(mu + mu_t) dU/dy] = 0, d/dy[(mu + mu_t) U dU/dy + cp (mu/Pr + mu_t/Pr_t) dT/dy] = 0, with mu_t = kappa y sqrt(rho tau_w) (1 - exp(-y+ / A+))^2, with the local density, y+ = y sqrt(tau_w rho_w) / mu_w, kappa 0.41, A+ 17, Pr_t 0.9 (Kawai & Larsson 2012). Both integrate once: (mu + mu_t) dU/dy = tau_w, cp (mu/Pr + mu_t/Pr_t) dT/dy + tau_w U = Q_w, Q_w = k_w dT/dy|_w. Given T(y), the two quadratures on a fixed stretched grid give tau_w and Q_w from the sample values: a fixed number of iterations, so a fixed cost per wall face on the device, with no tridiagonal solve.
Source: src/app/flume/common/adam_flume_wall_model_library.F90
Dependencies
Contents
- sample_cells
- wall_coupling_viscosity
- wall_model_solve
- wall_model_solve_pressure
- wall_model_solve_convective
- wall_model_solve_inverse
- wall_eddy_viscosity
- forcing_at
- inverse_layer_speed
- inverse_strain
- log_mean_inverse
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
WM_POINTS | integer(kind=I4P) | parameter | Intervals of the layer; tau within 1 % up to h+ = 1e5, 5.5 % off at 1e6. |
WM_ITERATIONS | integer(kind=I4P) | parameter | Plain fixed-point iterations (an Aitken step every second one, before #121 S4d, stopped a few samples on an extrapolated iterate, tau up to 2.7 times the fixed point). |
WM_STRETCH | real(kind=R8P) | parameter | Ratio of consecutive intervals. |
WM_KAPPA | real(kind=R8P) | parameter | von Karman constant. |
WM_APLUS | real(kind=R8P) | parameter | Damping constant. |
WM_PRT | real(kind=R8P) | parameter | Turbulent Prandtl number. |
WM_SRA | real(kind=R8P) | parameter | Reynolds analogy factor of the inverse model (Griffin et al. 2023, after Zhang et al. 2014). |
WM_SHOTS | integer(kind=I4P) | parameter | Shots of the inverse model, secant on ln(tau) after the first. |
WM_SUBITERATIONS | integer(kind=I4P) | parameter | Corrections of each step of the inverse model. |
WM_CONV_CELLS | integer(kind=I4P) | parameter | Cells below (and at) the sample whose convection feeds wall_model_solve_convective. |
WM_SAMPLE_SNAP | real(kind=R8P) | parameter | A sample weight below it is 0: the matching height on a cell centre (sample_cells). |
Subroutines
sample_cells
The cells of a wall-model sample: from the matching height hwm (0: the 3rd cell), the cell m counted from the wall and the weight w of cell m + 1, both within the n cells of the block, and the height of the sample actually taken.
Attributes: pure
fortran
subroutine sample_cells(hwm, dx, n, m, w, h)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
hwm | real(kind=R8P) | in | Matching height, spacing along the normal. | |
dx | real(kind=R8P) | in | Matching height, spacing along the normal. | |
n | integer(kind=I4P) | in | Cells of the block along the normal. | |
m | integer(kind=I4P) | out | Cell counted from the wall. | |
w | real(kind=R8P) | out | Weight of cell m + 1. | |
h | real(kind=R8P) | out | Height of the sample. |
Call graph
wall_coupling_viscosity
The viscosity coupling of a modelled wall (wall_model_coupling = viscosity, issue #126, after De Vanna et al. 2022): the stress of the no-slip gradient of the first cell, (mu_w + mu_w^sgs) 2 v / dy, with the wall's subgrid viscosity mu_w^sgs >= 0 raised until its magnitude reaches the model's |tau|. It takes the direction t of the first cell's wall-parallel velocity v and the magnitude max(mu_w 2 |v| / dy, |tau|), so a reversed first cell reverses the wall stress whatever the sample does; a first cell at rest gives none.
Attributes: pure
fortran
subroutine wall_coupling_viscosity(tau, v1, v2, v3, dy, muw, t1, t2, t3, taum)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tau | real(kind=R8P) | in | The model's wall shear stress. | |
v1 | real(kind=R8P) | in | Wall-parallel velocity of the first cell (its normal component zero). | |
v2 | real(kind=R8P) | in | Wall-parallel velocity of the first cell (its normal component zero). | |
v3 | real(kind=R8P) | in | Wall-parallel velocity of the first cell (its normal component zero). | |
dy | real(kind=R8P) | in | Cell spacing along the normal. | |
muw | real(kind=R8P) | in | Molecular viscosity at the wall temperature. | |
t1 | real(kind=R8P) | out | Direction of the stress, the unit vector of v (zero at rest). | |
t2 | real(kind=R8P) | out | Direction of the stress, the unit vector of v (zero at rest). | |
t3 | real(kind=R8P) | out | Direction of the stress, the unit vector of v (zero at rest). | |
taum | real(kind=R8P) | out | Magnitude of the stress. |
Call graph
wall_model_solve
Return the wall shear stress tau and the heat flux q (k dT/dy at the wall, positive when the gas is hotter than the wall) of an isothermal wall.
Attributes: pure
fortran
subroutine wall_model_solve(h, us, ts, ps, tw, R, cp, pr, mu0, tref, suth, omega_mu, tau, q, semilocal)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
h | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
us | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ts | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ps | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
tw | real(kind=R8P) | in | Wall temperature. | |
R | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
cp | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
pr | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
mu0 | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tref | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
suth | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
omega_mu | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tau | real(kind=R8P) | out | Wall shear stress, wall heat flux. | |
q | real(kind=R8P) | out | Wall shear stress, wall heat flux. | |
semilocal | logical | in | optional | Semi-local damping, y* = y sqrt(rho tau) / mu with the local rho, mu (else wall units). |
Call graph
wall_model_solve_pressure
wall_model_solve with the pressure gradient px (along the sample velocity) in the momentum balance (issue #121, S4d): (mu + mu_t) dU/dy = tau_w + px y, so U(h) = tau_w I0 + px I1, I0 = int dy / (mu + mu_t), I1 = int y dy / (mu + mu_t): an adverse gradient strong enough gives tau_w < 0 with U(h) > 0. The eddy viscosity takes the velocity scale sqrt((|tau_w| + |px| y) / rho) (u_tau and the pressure scale combined, as Duprat et al. 2011 do), so px = 0 is the equilibrium model; the energy flux cp (mu / Pr + mu_t / Pr_t) dT/dy + (tau_w + px y) U is constant across the layer. The convective terms are dropped and dp/dx kept, as Wang & Moin (2002) do. tau_w is no longer a power of the sample speed: WM_ITERATIONS plain fixed-point steps, as wall_model_solve, within 7e-5 of |tau_w| + |px| h of the converged value over a sweep of samples (sbli_oracle.py apriori, the Python port, with S4c's mean samples among them). ypg > 0 (issue #121, P1): the Bernoulli-consistent variant of Hickel, Touber, Bodart & Larsson (CTR Summer Program 2012, eq. 4.1). Above the viscous layer the convective term balances the pressure gradient, so the model takes it as -(dp/dx) min(y / y_pg, 1), y_pg = ypg (mu_w^2 / (rho_w |dp/dx|))^(1/3): the total stress is tau_w + px g(y), g(y) = y - y^2 / (2 y_pg) below y_pg and y_pg / 2 above, and g replaces y in the stress, in I1 and in the velocity scale of the eddy viscosity. Absent or 0: g = y, the model above, bit for bit.
Attributes: pure
fortran
subroutine wall_model_solve_pressure(h, us, ts, ps, tw, px, R, cp, pr, mu0, tref, suth, omega_mu, tau, q, semilocal, ypg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
h | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
us | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ts | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ps | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
tw | real(kind=R8P) | in | Wall temperature. | |
px | real(kind=R8P) | in | Pressure gradient along the sample velocity. | |
R | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
cp | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
pr | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
mu0 | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tref | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
suth | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
omega_mu | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tau | real(kind=R8P) | out | Wall shear stress (along the sample velocity), wall heat flux. | |
q | real(kind=R8P) | out | Wall shear stress (along the sample velocity), wall heat flux. | |
semilocal | logical | in | optional | Semi-local damping, y* = y sqrt(rho tau_s) / mu with the local rho, mu (else wall units). |
ypg | real(kind=R8P) | in | optional | Bernoulli-consistent variant: y_pg in viscous units of the pressure gradient, 0 for none. |
Call graph
wall_model_solve_convective
wall_model_solve_pressure fed with the flow's own convection (issue #121, P2): the thin-boundary-layer balance between the wall and the sample keeps the convection with the pressure gradient (Wang & Moin 2002; Park & Moin 2014), (mu + mu_t) dU/dy = tau_w + S(y), S(y) = int_0^y F, F = px + C, with C the convection along the sample velocity of the resolved cells below the sample, cc(1:nc) at the cell centres (c - 1/2) dyc, linear in y between them, 0 at the wall (no-slip), constant beyond the last centre. S replaces px y of the pressure model in the stress, in I1 and in the velocity scale sqrt((|tau_w| + |S|) / rho); cc = 0 is that model to round-off. Where the resolved convection balances the pressure gradient (Bernoulli) the forcing vanishes, where the near-wall flow is slow it is the gradient. rc (#121 P3): the resolved shear stress <rho u'_e u'_eta> of the same cells (eta away from the wall), linear between the wall (0) and the centres, constant beyond: the mean of the instantaneous convection holds its gradient, which the model's eddy viscosity already carries, so S(y) - R(y) replaces S (the stress form of Park & Moin's 2014 reduced eddy viscosity). rc = 0 is the model without it, bit for bit. ftau (#121 P3): the velocity scale of the eddy viscosity sqrt(|tau_w| / rho), the forcing kept out of it and linear in the balance (as Wang & Moin's 2002 thin-boundary-layer model): the filtered resolved forcing fluctuates as much as tau_w itself, and |S| in the scale biases the mean tau_w up (a priori on a zero-gradient layer: +12 % with it, -1.5 % without). .false.: the scale |tau_w| + |S|.
Attributes: pure
fortran
subroutine wall_model_solve_convective(h, us, ts, ps, tw, px, nc, dyc, cc, rc, ftau, R, cp, pr, mu0, tref, suth, omega_mu, tau, q, semilocal)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
h | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
us | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ts | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ps | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
tw | real(kind=R8P) | in | Wall temperature. | |
px | real(kind=R8P) | in | Pressure gradient along the sample velocity. | |
nc | integer(kind=I4P) | in | Cells with a convection, 0 to WM_CONV_CELLS. | |
dyc | real(kind=R8P) | in | Cell spacing along the normal. | |
cc | real(kind=R8P) | in | Convection along the sample velocity at the centres of cells 1 to nc. | |
rc | real(kind=R8P) | in | Resolved shear stress at the centres of cells 1 to nc, 0 for none. | |
ftau | logical | in | The velocity scale of the eddy viscosity from tau_w alone. | |
R | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
cp | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
pr | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
mu0 | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tref | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
suth | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
omega_mu | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tau | real(kind=R8P) | out | Wall shear stress (along the sample velocity), wall heat flux. | |
q | real(kind=R8P) | out | Wall shear stress (along the sample velocity), wall heat flux. | |
semilocal | logical | in | optional | Semi-local damping. |
Call graph
wall_model_solve_inverse
Return the wall shear stress tau and the heat flux q (k dT/dy at the wall, positive when the gas is hotter than the wall) of an isothermal wall by the model of Griffin, Fu & Moin (2023, JFM 970 A36): the strain of the constant-property layer at the same semi-local height, S_t = 1 / (1 + kappa y* D^2), D = 1 - exp(-y* / A+), y* = y sqrt(rho tau) / mu, mapped to the compressible one by the inverse total-stress-based transformation (their Eq. 2.2), with the temperature from the matching-anchored Reynolds analogy (Eq. 2.5) T = Tw + s Pr (Tr - Tw) (U / Ue) (1 - U / Us) + (U / Us)^2 (Ts - Tw), Tr = Te + Pr^(1/3) Ue^2 / (2 cp), s 1.14; so q = s cp tau (Tr - Tw) / Ue. Ue, Te: the state at the edge of the layer (the channel centre), given.
Eq. 2.2 written for the physical strain g = dU/dy, its property gradients through T(U): with E = (1 / S_t - 1) mu_w / mu, F = sqrt(rho / rho_w), K = tau F / mu, beta = (dT/dU) (1/2 + d ln mu / d ln T) / T (ideal gas at uniform pressure; the slope is omega_mu, less T / (T + S) under Sutherland), F beta y g^2 - (E + F + K beta y) g + K = 0; its positive root when beta < 0 (the other is negative), else the one nearer K / (E + F), the strain without the gradients (the exact tau / mu of the laminar layer, where the equation also holds the spurious root 1 / (beta y) of dy*/dy = 0). The layer is integrated from the wall on the stretched grid of wall_model_solve, each interval exact for 1 / g linear in y (the viscous and the log layer), corrected WM_SUBITERATIONS times, then shot on ln(tau) to the sample speed.
Attributes: pure
fortran
subroutine wall_model_solve_inverse(h, us, ts, ps, tw, ue, te, R, cp, pr, mu0, tref, suth, omega_mu, tau, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
h | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
us | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ts | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
ps | real(kind=R8P) | in | Height, parallel speed, temperature and pressure of the sample. | |
tw | real(kind=R8P) | in | Wall temperature. | |
ue | real(kind=R8P) | in | Speed and temperature at the edge of the layer. | |
te | real(kind=R8P) | in | Speed and temperature at the edge of the layer. | |
R | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
cp | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
pr | real(kind=R8P) | in | Gas constant, specific heat, Prandtl number. | |
mu0 | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tref | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
suth | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
omega_mu | real(kind=R8P) | in | Viscosity law, as compute_dissipative_flux. | |
tau | real(kind=R8P) | out | Wall shear stress, wall heat flux. | |
q | real(kind=R8P) | out | Wall shear stress, wall heat flux. |
Call graph
Functions
wall_eddy_viscosity
The eddy viscosity of the layer, kappa y sqrt(rho tau_w) D^2, D = 1 - exp(-y+ / A+) with y+ = y sqrt(tau_w rho_w) / mu_w (wall units) or, semilocal, y* = y sqrt(rho tau_w) / mu (local density and viscosity): the mu_t of wall_model_solve, at the height y of a cell below the matching height with that cell's density and viscosity (issue #119, wall_model_eddy_viscosity).
Attributes: pure
Returns: real(kind=R8P)
fortran
function wall_eddy_viscosity(y, rho, mu, tau, rhow, muw, semilocal) result(mt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
y | real(kind=R8P) | in | Height, density and viscosity of the cell. | |
rho | real(kind=R8P) | in | Height, density and viscosity of the cell. | |
mu | real(kind=R8P) | in | Height, density and viscosity of the cell. | |
tau | real(kind=R8P) | in | Wall shear stress. | |
rhow | real(kind=R8P) | in | Density and viscosity at the wall. | |
muw | real(kind=R8P) | in | Density and viscosity at the wall. | |
semilocal | logical | in | Semi-local damping. |
Call graph
forcing_at
The forcing of wall_model_solve_convective at the height yy: linear between the knots yk(0:nk), constant beyond the last.
Attributes: pure
Returns: real(kind=R8P)
fortran
function forcing_at(yy, nk, yk, fk) result(f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
yy | real(kind=R8P) | in | Height. | |
nk | integer(kind=I4P) | in | Last knot. | |
yk | real(kind=R8P) | in | Knots. | |
fk | real(kind=R8P) | in | Forcing at the knots. |
Call graph
inverse_layer_speed
The speed at the height h of the layer of wall stress tau of the inverse model (wall_model_solve_inverse).
Attributes: pure
Returns: real(kind=R8P)
fortran
function inverse_layer_speed(h, tau, us, ts, ps, tw, c1, R, mu0, tref, suth, omega_mu) result(u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
h | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
tau | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
us | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
ts | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
ps | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
tw | real(kind=R8P) | in | Height, wall stress, sample speed, temperature, pressure, wall temperature. | |
c1 | real(kind=R8P) | in | dT/dU at the wall. | |
R | real(kind=R8P) | in | Gas constant, viscosity law. | |
mu0 | real(kind=R8P) | in | Gas constant, viscosity law. | |
tref | real(kind=R8P) | in | Gas constant, viscosity law. | |
suth | real(kind=R8P) | in | Gas constant, viscosity law. | |
omega_mu | real(kind=R8P) | in | Gas constant, viscosity law. |
Call graph
inverse_strain
The strain dU/dy at the height y and speed u of the layer of wall stress tau of the inverse model (wall_model_solve_inverse).
Attributes: pure
Returns: real(kind=R8P)
fortran
function inverse_strain(y, u, tau, us, ts, ps, tw, c1, R, mu0, tref, suth, omega_mu) result(g)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
y | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
u | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
tau | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
us | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
ts | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
ps | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
tw | real(kind=R8P) | in | Height, speed, wall stress, sample speed, temperature, pressure, wall temperature. | |
c1 | real(kind=R8P) | in | dT/dU at the wall. | |
R | real(kind=R8P) | in | Gas constant, viscosity law. | |
mu0 | real(kind=R8P) | in | Gas constant, viscosity law. | |
tref | real(kind=R8P) | in | Gas constant, viscosity law. | |
suth | real(kind=R8P) | in | Gas constant, viscosity law. | |
omega_mu | real(kind=R8P) | in | Gas constant, viscosity law. |
Call graph
log_mean_inverse
The mean of 1 / c(y) over an interval where c is linear between a and b.
Attributes: pure
Returns: real(kind=R8P)
fortran
function log_mean_inverse(a, b) result(r)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | End values. | |
b | real(kind=R8P) | in | End values. |
Call graph