Chart.js Example #1




\(\rho_{l,Sat}\):
\(\rho_{v,Sat}\):
\(\psi_{l} \times 10^7\):
\(\psi_{v} \times 10^7\):




Boundary Layer Mesh Calculator


I will implement some calculators to estimate the proper settings for the boundary prism layer meshing.

Simple mathematical calculations, such as the four arithmetic operations and power, can be done using HTML and JavaScript.

Boundary Layer Mesh

\begin{align}
l_{n} = l_{1} r^{n-1}
\end{align}
\begin{align}
l_{tot} = \sum_{k=1}^{n} l_{1} r^{k-1} = \frac{l_{1} \left( r^n – 1 \right)}{r – 1}    \left( r \neq 1 \right)
\end{align}


First layer thickness \(l_{1}\):
# Prism layers \(n\):
Growth rate \(r\):
Write precision:  6

Output

Last layer thickness \(l_{n}\):
Total thickness \(l_{tot}\):

Boundary Layer Thickness – Internal Flow

Under construction – please check again later

Boundary Layer Thickness – External Flow

Under construction – please check again later

Matplotlib – How to Plot Mathematical expressions (2D)

What We Want to Do

We want to plot the following three mathematical expressions in 2D that describe the speed of sound \(c\) as a function of a vapor fraction \(\gamma\).

\begin{align}
c = \frac{1}{\sqrt{\psi}}. \tag{1} \label{eq:psi-sos}
\end{align}

    • linear

\begin{align}
\psi_{linear} = \gamma \psi_v + \left(1 – \gamma \right)\psi_l \tag{2} \label{eq:linear}
\end{align}

    • Wallis

\begin{align}
\psi_{Wallis} = \left( \gamma \rho_{v, Sat} + \left( 1 – \gamma \right)\rho_{l, Sat} \right)
\left( \gamma \frac{\psi_v}{\rho_{v, Sat}} + \left( 1 – \gamma \right)\frac{\psi_l}{\rho_{l, Sat}} \right) \tag{3} \label{eq:wallis}
\end{align}

    • Chung

\begin{align}
\psi_{Chung} = \left( \left( \frac{1 – \gamma}{\sqrt{\psi_v}} + \gamma \frac{s_{fa}}{\sqrt{\psi_l}} \right)\frac{\sqrt{\psi_v \psi_l}}{s_{fa}} \right)^2 \tag{4} \label{eq:chung}
\end{align}
where
\begin{align}
s_{fa} = \sqrt{ \frac{\frac{\rho_{v, Sat}}{\psi_v}}{\left( 1- \gamma \right)\frac{\rho_{v, Sat}}{\psi_v} + \gamma \frac{\rho_{l, Sat}}{\psi_l}} } \tag{5} \label{eq:chung-sfa}
\end{align}

For more details of the above expressions, you might want to read the following post.

Sample Code

Free Access to A Course of Theoretical Physics by L.D. Landau & E.M. Lifshitz

The famous physics textbook written by the theoretical physicist L. D. Landau and E. M. Lifshitz are freely accessible from the following links.

Mechanics 3rd Edition (Course of Theoretical Physics Vol. 1)

https://archive.org/details/Mechanics3eLandauLifshitz

The Classical Theory of Fields (Course of Theoretical Physics Vol. 2)

https://archive.org/details/TheClassicalTheoryOfFields

Quantum Mechanics (Course of Theoretical Physics Vol. 3)

https://archive.org/details/QuantumMechanics_104

Relativistic Quantum Physics Part1 (Course of Theoretical Physics Vol. 4)

https://archive.org/details/RelativisticQuantumTheoryPart1

Statistical Physics (Course of Theoretical Physics Vol. 5)

https://archive.org/details/ost-physics-landaulifshitz-statisticalphysics

Fluid Mechanics (Course of Theoretical Physics Vol. 6)

https://archive.org/details/FluidMechanics

Theory of Elasticity (Course of Theoretical Physics Vol. 7)

https://archive.org/details/TheoryOfElasticity

Electrodynamics of Continuous Media (Course of Theoretical Physics Vol. 8)

https://archive.org/details/ElectrodynamicsOfContinuousMedia

cavitatingFoam – barotropicCompressibilityModel (v1812)

Last Updated: June 9, 2019

The cavitatingFoam is a transient cavitation solver based on the homogeneous equilibrium model (HEM) from which the compressibility of the liquid/vapour ‘mixture’ is obtained, whose density varies from liquid density to vapor one according to the chosen barotropic equation of state.

Compressibility and speed of sound

\begin{align}
\frac{D \rho}{Dt} = \psi \frac{Dp}{Dt} \tag{1} \label{eq:eos}
\end{align}

\begin{align}
\psi = \rho \beta_s \tag{2} \label{eq:psi}
\end{align}

  • \(\rho\): density
  • \(p\): pressure
  • \(\beta_s\): isentropic compressibility

The definition of the isentropic compressibility can be deformed in the following way:
\begin{align}
\beta_s &\equiv -\frac{1}{V} \left( \frac{\partial V}{\partial p} \right)_s \tag{3} \label{eq:betas} \\
&= -\frac{1}{V} \left(\frac{\partial V}{\partial \rho} \frac{\partial \rho}{\partial p} \right)_s \\
&= \rho \frac{1}{\rho^2} \left(\frac{\partial \rho}{\partial p} \right)_s \\
&= \frac{1}{\rho c^2}
\end{align}
where \(c\) is the speed of sound. We can substitute this expression for \(\beta_s\) in \eqref{eq:psi}, obtaining the following expression:
\begin{align}
\psi = \frac{1}{c^2}. \tag{4} \label{eq:psi-sos}
\end{align}
The compressibility of the mixture equals to the reciprocal of the square of the speed of sound.

We can specify a compressibility function \(\psi\) that defines the coupling between the density and pressure in the thermophysicalProperties file.

barotropicCompressibilityModel

The following three models for \(\psi\) are available in OpenFOAM v1812.

  • linear
  • Chung
  • Wallis

  • psiv: compressibility \(\psi\) of the vapor phase
  • psil: compressibility \(\psi\) of the liquid phase
  • pSat: saturation pressure
  • rhovSat: density of vapor at saturation point
  • rholSat: density of liquid at saturation point

The expressions of the speed of sound \(c\) in the liquid/vapour mixture are different according to the selected function.

linear

\begin{align}
\psi = \gamma \psi_v + \left(1 – \gamma \right)\psi_l \tag{5} \label{eq:linear}
\end{align}

Chung

\begin{align}
s_{fa} = \sqrt{ \frac{\frac{\rho_{v, Sat}}{\psi_v}}{\left( 1- \gamma \right)\frac{\rho_{v, Sat}}{\psi_v} + \gamma \frac{\rho_{l, Sat}}{\psi_l}} } \tag{6} \label{eq:chung-sfa}
\end{align}
\begin{align}
\psi = \left( \left( \frac{1 – \gamma}{\sqrt{\psi_v}} + \gamma \frac{s_{fa}}{\sqrt{\psi_l}} \right)\frac{\sqrt{\psi_v \psi_l}}{s_{fa}} \right)^2 \tag{7} \label{eq:chung}
\end{align}

Wallis

\begin{align}
\psi = \left( \gamma \rho_{v, Sat} + \left( 1 – \gamma \right)\rho_{l, Sat} \right)
\left( \gamma \frac{\psi_v}{\rho_{v, Sat}} + \left( 1 – \gamma \right)\frac{\psi_l}{\rho_{l, Sat}} \right) \tag{8} \label{eq:wallis}
\end{align}
\begin{align}
\frac{\psi}{\gamma \rho_{v, Sat} + \left( 1 – \gamma \right)\rho_{l, Sat}} = \gamma \frac{\psi_v}{\rho_{v, Sat}} + \left( 1 – \gamma \right)\frac{\psi_l}{\rho_{l, Sat}} \tag{8′} \label{eq:wallis2}
\end{align}

References

[1] Christopher Earls Brennen, Fundamentals of Multiphase Flow. Cambridge University Press (2005)

twoPhaseEulerFoam – Diameter Model (v1812)

constant

Constant dispersed-phase particle diameter model.

isothermal

Isothermal dispersed-phase particle diameter model.
\begin{align}
p \times \frac{4}{3} \pi \left( \frac{d}{2} \right)^3 &= p_0 \times \frac{4}{3} \pi \left( \frac{d_0}{2} \right)^3 \\
d &= d_0 \left( \frac{p_0}{p} \right)^{1/3} \tag{1} \label{eq:levmdiffusion}
\end{align}

IATE

IATE (Interfacial Area Transport Equation) bubble diameter model.
Solves for the interfacial curvature per unit volume of the phase rather than interfacial area per unit volume to avoid stability issues relating to the consistency requirements between the phase fraction and interfacial area per unit volume.

The following bubble interaction mechanisms are considered in this model.

    • wakeEntrainmentCoalescence
      Bubble coalescence by wake entrainment
    • randomCoalescence
      Bubble coalescence by random collision
    • turbulentBreakUp
      Bubble break-up due to the impact of turbulent eddies
      \begin{align}
      \phi_{TI} = \frac{C_{ti}}{3} \frac{U_t}{d} \sqrt{1 – \frac{We_{Cr}}{We}} e^{-\frac{We_{Cr}}{We}}
      \end{align}

      • \(We\): Weber number [-]
      • \(U_t\): Turbulent fluctuation velocity [m/s]

twoPhaseEulerFoam – phaseProperties



In solving two-phase flow problems, we can use a variety of simulation techniques, such as Eulerian-Eulerian, Eulerian-Lagrangian methods, Volume of Fluid (VOF) method and homogeneous equilibrium model (HEM).

In this page, I will organize information on the physical models available in twoPhaseEulerFoam, an Eulerian-Eulerian solver available in OpenFOAM.

I will add descriptions of each model.


Selected OpenFOAM version:

drag model
  • Ergun
  • Gibilaro
  • GidaspowErgunWenYu
  • GidaspowSchillerNaumann
  • IshiiZuber
  • Lain
  • SchillerNaumann
  • SyamlalOBrien
  • TomiyamaAnalytic
  • TomiyamaCorrelated
  • WenYu
  • segregated

Read more

lift model
  • LegendreMagnaudet
  • Moraga
  • Tomiyama
  • constantCoefficient
  • none
heatTransfer model
  • RanzMarshall
  • spherical
turbulentDispersion model
  • Burns
  • Gosman
  • LopezDeBertodano
  • constantCoefficient
  • none
virtualMass model
  • Lamb
  • constantCoefficient
  • none
aspectRatio model
  • Tomiyama
  • VakhrushevEfremov
  • Wellek
  • constant
wallLubrication model
  • Antal
  • Frank
  • Tomiyama
  • none
diameter model
  • constant
  • isothermal
  • IATE

Read more