Hyperbolic tangent function to create stretched grid


Hyperbolic tangent function \({\rm tanh}\) is often used to generate the stretched structured grid.

In this blog post, I will introduce some examples I have found in the references.

Example #1 [1]

\begin{equation}
y_j = \frac{1}{\alpha}{\rm tanh} \left[\xi_j {\rm tanh}^{-1}\left(\alpha\right)\right] + 1\;\;\;\left( j = 0, …, N_2 \right), \tag{1}
\end{equation}
with
\begin{equation}
\xi_j = -1 + 2\frac{j}{N_2}, \tag{2}
\end{equation}
where \(\alpha\) is an adjustable parameter of the transformation \((0<\alpha<1)\) and \(N_2\) is the grid number of the direction. As shown in the following figure, the grids are more clustered towards the both ends as the parameter \(\alpha\) approaches 1.

Example #2 [2]

\begin{equation}
y_j = 1 -\frac{{\rm tanh}\left[ \gamma \left( 1 – \frac{2j}{N_2} \right) \right]}{{\rm tanh} \left( \gamma \right)}\;\;\;\left( j = 0, …, N_2 \right), \tag{3}
\end{equation}
where \(\gamma\) is the stretching parameter and \(N_2\) is the number of grid points of the direction.

Grid Images

Coming soon.

References

[1] H. Abe, H. Kawamura and Y. Matsuo, Direct Numerical Simulation of a Fully Developed Turbulent Channel Flow With Respect to the Reynolds Number Dependence. J. Fluids Eng 123(2), 382-393, 2001.
[2] J. Gullbrand, Grid-independent large-eddy simulation in turbulent channel flow using three-dimensional explicit filtering. Center for Turbulence Research Annual Research Briefs, 2003.

Calculation of Reynolds stress field in OpenFOAM


Keywords
Reynolds stress, shear flow, fieldAverage, variance, covariance

In the simulations of wall-bounded turbulent flows, such as turbulent channel flow [1], the distributions of the Reynolds stress components in the wall-normal direction are matters of interest to researchers and engineers.

For a statistically steady turbulent flow, a prime-squared mean of the velocity field (UPrime2Mean in OpenFOAM) gives the Reynolds stress field

\begin{eqnarray}
\frac{1}{N} \sum_{k=1}^{N} \left( U_i^{(k)} – \overline{U_i} \right)^2
&=& \frac{1}{N} \sum_{k=1}^{N} {u_{i}^{(k)}}^2 \\
&=& \frac{1}{N} \sum_{k=1}^{N}
\left[
\begin{array}{ccc}
u_{1}^{(k)}u_{1}^{(k)} & u_{1}^{(k)}u_{2}^{(k)} & u_{1}^{(k)}u_{3}^{(k)} \\
u_{2}^{(k)}u_{1}^{(k)} & u_{2}^{(k)}u_{2}^{(k)} & u_{2}^{(k)}u_{3}^{(k)} \\
u_{3}^{(k)}u_{1}^{(k)} & u_{3}^{(k)}u_{2}^{(k)} & u_{3}^{(k)}u_{3}^{(k)}
\end{array}
\right] \\
&=&
\left[
\begin{array}{ccc}
\overline{u_{1}u_{1}} & \overline{u_{1}u_{2}} & \overline{u_{1}u_{3}} \\
\overline{u_{2}u_{1}} & \overline{u_{2}u_{2}} & \overline{u_{2}u_{3}} \tag{1} \\
\overline{u_{3}u_{1}} & \overline{u_{3}u_{2}} & \overline{u_{3}u_{3}}
\end{array}
\right], \\
\end{eqnarray}
where \(U_i^{(k)}\) denotes the instantaneous velocity field \(U_i(\boldsymbol{x}, k\Delta t)\) and it is decomposed into the time-averaged mean \(\overline{U_i}\) and fluctuating components \({u_{i}}^{(k)}\),
\begin{equation}
{U_{i}}^{(k)} = \overline{U_i} + {u_{i}}^{(k)}. \tag{2}
\end{equation}

The diagonal components of the Reynolds stress tensor are the variances of the velocity components and the off-diagonal elements are the covariances of them.

Function Object – fieldAverage

Turbulent Channel Flow

Turbulent channel flow is one of the most fundamental wall-bounded shear flows and it has been widely used to study the structure of near-wall turbulence. Many DNS calculations have been carried out and produced a lot of informative data, which has contributed considerably to the improvements of other turbulence models, such as RANS and LES.

Moser et al. have released the statistical data obtained from their DNS of turbulent channel flow on their web site [2]. The data set contains, among other information, the components of the Reynolds stress tensor at three Reynolds numbers
\begin{equation}
Re_{\tau} = \frac{u_{\tau}h}{\nu} \approx 180,\; 395,\; 590, \tag{3}
\end{equation}
where \(u_{\tau}\) is the friction velocity, \(h\) is the channel half-height and \(\nu\) is the kinematic viscosity.

I will post my DNS results, which will help us to understand the flow behaviors in the near-wall region. The channel395 tutorial in OpenFOAM is the case of large eddy simulation (LES) instead of DNS at \(Re_{\tau}=395\).

References

[1] R. D. Moser, J. Kim and N. N. Mansour, Direct numerical simulation of turbulent channel flow up to \({\rm Re}_{\tau}\)=590. Physics of Fluids 11(4), 943-945, 1999.
[2] DNS Data for Turbulent Channel Flow. Available at: http://turbulence.ices.utexas.edu/data/MKM/ [Accessed: 9 April 2017].
[3] turbulence.ices.utexas.edu file server. Available at: http://turbulence.ices.utexas.edu/ [Accessed: 4 May 2017].

Temperature calculation from energy variables in OpenFOAM


The energy conservation equation is expressed in terms of internal energy \(e\) or enthalpy \(h\) in OpenFOAM and the temperature field is calculated from these solution variables. More precisely, we can specify the energy variable in the energy entry in the thermophysicalProperties file and the available options are the followings:

  • specific sensible enthalpy \(h {\rm [J/kg]}\) (sensibleEnthalpy)
  • specific sensible internal energy \(e {\rm [J/kg]}\) (sensibleInternalEnergy)

If we select the hePsiThermo thermophysical model, the temperature field \(T\) is calculated from the solved energy variable in the following function, where the compressibility \(\psi\), dynamic viscosity \(\mu\) and thermal diffusivity \(\alpha\) are also calculated.

Source Code

The calculation procedure of the temperature field depends on the selected energy variable, so the following THE function accordingly switches the called method.

If we choose the sensible enthalpy as the energy variable, the following THs function is called to calculate the temperature from the sensible enthalpy.

The calculation of the temperature is done iteratively using the Newton-Raphson method.

If the specific heat capacity at constant pressure \(c_p\) is expressed in the form of temperature polynomial function (hPolynomial)
\begin{equation}
c_p(T) = \sum_{i=0}^7 c_i T^i, \tag{1}
\end{equation}
the temperature in the j-th cell \(T_j\) is calculated from the following equation
\begin{equation}
\displaystyle \int_{T_{std}}^{T_j} \left( \sum_{i=0}^7 c_i T^i \right) dT = h_j, \tag{2}
\end{equation}
where \(h_j\) is the sensible enthalpy value in the j-th cell. In general the equation will be nonlinear, the iterative solution technique is implemented.

Compressible Flow Solvers

The above function calculate() is called by rhoPimpleFoam, rhoSimpleFoam and sonicFoam etc. from the line “thermo.correct()” after solving the energy conservation equation EEqn:

After updating the compressibility field \(\psi\), the pressure Poisson equation pEqn is constructed and solved.

The density field \(\rho\) is calculated with updated pressure and compressibility fields.

Summary
Energy variable Function used to calculate temperature
sensible enthalpy THs
absolute enthalpy THa
sensible internal energy TEs
absolute internal energy TEa

Study with great curiosity and let’s see the physical phenomena from a HIGHER point of view!

Interesting News – Vanadium Dioxide Violates the Wiedemann-Franz Law


It is an interesting news on conduction heat transfer.

The new article reports that vanadium dioxide conducts electricity much better than it conducts heat at near room temperature:

Abstract

In electrically conductive solids, the Wiedemann-Franz law requires the electronic contribution to thermal conductivity to be proportional to electrical conductivity. Violations of the Wiedemann-Franz law are typically an indication of unconventional quasiparticle dynamics, such as inelastic scattering, or hydrodynamic collective motion of charge carriers, typically pronounced only at cryogenic temperatures. We report an order-of-magnitude breakdown of the Wiedemann-Franz law at high temperatures ranging from 240 to 340 kelvin in metallic vanadium dioxide in the vicinity of its metal-insulator transition. Different from previously established mechanisms, the unusually low electronic thermal conductivity is a signature of the absence of quasiparticles in a strongly correlated electron fluid where heat and charge diffuse independently.

Wiedemann–Franz(-Lorenz) Law

In solids, heat is transported by vibrations of the solid lattice (Phonon contribution) and motion of free electrons (Electronic contribution). In metals, thermal energy transport by electrons predominates. Thus, good electrical conductors are also good thermal conductors as the Wiedemann–Franz law states that:
\begin{equation}
\frac{\lambda}{\sigma} = LT \tag{1}
\end{equation}

  • \(\lambda\): thermal conductivity
  • \(\sigma\): electrical conductivity
  • \(T\): absolute temperature
  • \(L\): Lorenz number (\(=2.45 \times 10^{-8}\)) [\({\rm W}\Omega/{\rm K}^2\)]

The news reports that vanadium dioxide does not obey this empirical law.

Related Topics and Refereces (Japanese)

Thermal Boundary Conditions in OpenFOAM


Many thermal boundary conditions are available in OpenFOAM. I will upload some basic cases that explain the usage of these boundary conditions.

Source Code
src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/

  • convectiveHeatTransfer

    It calculates the heat transfer coefficients from the following empirical correlations for forced convection heat transfer:
    \begin{eqnarray}
    \left\{
    \begin{array}{l}
    Nu = 0.664 Re^{\frac{1}{2}} Pr^{\frac{1}{3}} \left( Re \lt 5 \times 10^5 \right) \\
    Nu = 0.037 Re^{\frac{4}{5}} Pr^{\frac{1}{3}} \left( Re \ge 5 \times 10^5 \right) \tag{1} \label{eq:NuPlate}
    \end{array}
    \right.
    \end{eqnarray}
    where \(Nu\) is the Nusselt number, \(Re\) is the Reynolds number and \(Pr\) is the Prandtl number.

  • externalCoupledTemperature
  • externalWallHeatFluxTemperature

    This boundary condition can operate in the following two modes:
    Mode#1 Specify the heat flux \(q\)
    \begin{equation}
    -k \frac{T_p – T_b}{\vert \boldsymbol{d} \vert} = q + q_r \tag{2} \label{eq:fixedHeatFlux}
    \end{equation}
    * \(k\): thermal conductivity
    * \(q_r\): radiative heat flux
    * \(T_b\): temperature on the boundary

    Mode#2 Specify the heat transfer coefficient \(h\) and the ambient temperature \(T_a\) (Fig. 1)
    \begin{equation}
    -k \frac{T_p – T_b}{\vert \boldsymbol{d} \vert} = \frac{T_a – T_b}{R_{th}} + q_r \tag{3} \label{eq:fixedHeatTransferCoeff}
    \end{equation}
    * \(R_{th}\): total thermal resistance of convective and conductive heat transfer
    \begin{equation}
    R_{th} = \frac{1}{h} + \sum_{i=1}^{n} \frac{l_i}{k_i} \tag{4} \label{eq:Rth}
    \end{equation}

    Figure 1
  • fixedIncidentRadiation
  • lumpedMassWallTemperature

    There is a dimensionless quantity called the Biot number, which is defined as
    \begin{equation}
    Bi = \frac{l/k}{1/h} = \frac{hl}{k}, \tag{5} \label{eq:Biot}
    \end{equation}
    where \(h\) is the heat transfer coefficient, \(k\) is the thermal conductivity of a solid and \(l\) is the characteristic length of the solid. As the definition in Eq. \eqref{eq:Biot} indicates, it represents the ratio of the internal conduction resistance \(l/k\) and the external convection resistance \(1/h\). If the Biot number is small (\(Bi \ll 1\)), the solid may be treated as a simple lumped mass system of an uniform temperature. This boundary condition calculates the uniform temperature variation \(\Delta T\) on the boundary from the following equation:
    \begin{equation}
    m c_p \Delta T = Q \Delta t. \tag{6} \label{eq:lumpedmass}
    \end{equation}
    * \(m\): total mass [kg]
    * \(c_p\): specific heat capacity [J/(kg.K)]
    * \(Q\): net heat flux on the boundary [W]
    * \(\Delta t\): time step [s]

  • outletMappedUniformInletHeatAddition
  • totalFlowRateAdvectiveDiffusive
  • wallHeatTransfer
  • compressible::thermalBaffle1D
  • compressible::turbulentHeatFluxTemperature
  • compressible::turbulentTemperatureCoupledBaffleMixed
  • compressible::turbulentTemperatureRadCoupledMixed
  • compressible::alphatJayatillekeWallFunction
  • compressible::alphatPhaseChangeWallFunction
  • compressible::alphatWallFunction

Filter Width – maxDeltaxyz


Several options are available in OpenFOAM for calculation of the filter width used in the large eddy simulation (LES) and detached eddy simulation (DES). In this blog post, the maxDeltaxyz option is covered in some detail.

OpenFOAM Version: OpenFOAM-dev, OpenFOAM v1612+

Implementation in OpenFOAM

The maxDeltaxyz option calculates the filter width of the \(i-\)th cell \(\Delta_i\) by taking the maximum distance between the cell center \(P_i\) and each face center \(F_j\)
\begin{equation}
\Delta_i = {\rm deltaCoeff} \times \max_{1 \le j \le n_i} \left\{ \overline{P_iF_j} \right\}, \tag{1} \label{eq:deltaxyz}
\end{equation}
where \({\rm deltaCoeff}\) is a constant of proportion (user input) and \(n_i\) is the number of the faces of the \(i-\)th cell.

Fig. 1 Graphical illustration for the case of a regular hex cell.

For a regular hexahedral cell shown in Fig. 1, the computed \(\Delta\) using Eq. \eqref{eq:deltaxyz} equals one-half of the maximum cell width \(\Delta x\), so the deltaCoeff coefficient should be set to 2 in the turbulenceProperties file as shown below.

The filter width is calculated in the following function.

Implementation in OpenFOAM v1612+

In OpenFOAM v1612+, the face normal vectors are considered in order to take into account the mesh non-orthogonality.

Some comments

This definition \eqref{eq:deltaxyz} is often used in the detached eddy simulation (DES) where some anisotropic grid cells such as “book”, “pencil” and “ribbon”-shaped cells exist in a boundary layer mesh. The position where switching between the RANS and LES modes occurs in the DES97 model [1] depends on how to calculate the filter width \(\Delta\)
\begin{equation}
\tilde{d} \equiv {\rm min}\left( d, C_{DES}\Delta \right), \tag{2} \label{eq:dTilda}
\end{equation}
where \(d\) is the distance to the closest wall and \(C_{DES}\) is a calibration constant.
Several modified length scales have been developed to prevent a delay of the Kelvin-Helmholtz instability in free and separated shear layers [2].

References

[1] P. R. Spalart, W.-H. Jou, M. Strelets and S. R. Allmaras, Comments on the feasibility of LES for wings, and on a hybrid RANS/LES approach. 1st AFOSR Int. Conf. on DNS/LES, Aug. 4-8, 1997, Ruston, LA. In “Advances in DNS/LES”, C. Liu and Z. Liu Eds., Greyden Press, Columbus, OH.
[2] P. R. Spalart, Detached-Eddy Simulation. Annu. Rev. Fluid Mech. 41, 181-202, 2009.

32th TSFD Symposium

第32回生研TSFD (Turbulence Simulation and Flow Design) シンポジウム 「乱流シミュレーションと流れの設計 -数値計算による熱流体現象の理解、予測、制御」 が,2017年3月22日(水) に東京大学生産技術研究所 (駒場IIリサーチキャンパス) において開催されるそうです.プログラム等はまだ未確定ですが,ぜひ勉強してきたいと思います.

URL:
http://www.iis.u-tokyo.ac.jp/~tsfd2017/