Skip to content
Snippets Groups Projects

Feature/cfs_non-dimensionalization setting

Merged Ganlin requested to merge feature/cfs into master
1 file
+ 107
0
Compare changes
  • Side-by-side
  • Inline
+ 152
0
 
{
 
"cells": [
 
{
 
"cell_type": "markdown",
 
"metadata": {},
 
"source": [
 
"# Tutorial 50: non-dimensionalization\n",
 
"\n",
 
"\n",
 
"## Introduaction\n",
 
"\n",
 
"Welcome to the tutorials of compressible flow solver. Before moving to the detailed settings, we are going to introduce the non-dimensionalization process in Nektar++. As we know that although the flows are various, the governing equations are universal (for general cases). The differences of the flows lie in the flow parameters, such as Reynolds number and etc. These parameters are obtained through the non-dimensionalization (or scaling). \n",
 
"\n",
 
"The proper non-dimensionlization scales the flow variables to the order of 1, which will increase the accuracy of numerical operations. In addition, the flows are usually solved with stabilization technologies, where the parameters are already set for non-dimensionalized flows by default in Nektar++. In other words, the setting process will be eaiser if the flow is non-dimensionalized at first. \n",
 
"\n",
 
"## Governing equations\n",
 
"The compressible flows are governed by the Navier-Stokes equations, which take the form\n",
 
"\n",
 
"$$\n",
 
"\\frac{\\partial \\rho}{\\partial t} + \\frac{\\partial \\rho u}{\\partial x} + \\frac{\\partial \\rho v}{\\partial y} + \\frac{\\partial \\rho w}{\\partial z} = 0 \\\\\n",
 
"\\frac{\\partial \\rho u}{\\partial t} + \\frac{\\partial \\left( \\rho u^{2} + p \\right) }{\\partial x} + \\frac{\\partial \\rho uv}{\\partial y} + \\frac{\\partial \\rho uw}{\\partial z} \n",
 
"= \\frac{\\partial \\tau_{xx}}{\\partial x} + \\frac{\\partial \\tau_{yx}}{\\partial y} + \\frac{\\partial \\tau_{zx}}{\\partial z} \\\\\n",
 
"\\frac{\\partial \\rho v}{\\partial t} + \\frac{\\partial \\rho uv}{\\partial x} + \\frac{\\partial \\left( \\rho v^{2} + p \\right) }{\\partial y} + \\frac{\\partial \\rho vw}{\\partial z} \n",
 
"= \\frac{\\partial \\tau_{xy}}{\\partial x} + \\frac{\\partial \\tau_{yy}}{\\partial y} + \\frac{\\partial \\tau_{zy}}{\\partial z} \\\\\n",
 
"\\frac{\\partial \\rho w}{\\partial t} + \\frac{\\partial \\rho uw}{\\partial x} + \\frac{\\partial \\rho vw}{\\partial y} + \\frac{\\partial \\left( \\rho w^{2} + p \\right) }{\\partial z} \n",
 
"= \\frac{\\partial \\tau_{xz}}{\\partial x} + \\frac{\\partial \\tau_{yz}}{\\partial y} + \\frac{\\partial \\tau_{zz}}{\\partial z} \\\\\n",
 
"\\frac{\\partial E}{\\partial t} + \\frac{\\partial (E+p)u}{\\partial x} + \\frac{\\partial (E+p)v}{\\partial y} + \\frac{\\partial (E+p)w}{\\partial z} \\\\ = \\frac{\\partial \\left( u\\tau_{xx}+v\\tau_{yx}+w\\tau_{zx}+k\\tfrac{\\partial T}{\\partial x} \\right) }{\\partial x} \n",
 
"+ \\frac{\\partial \\left( u\\tau_{xy}+v\\tau_{yy}+w\\tau_{zy}+k\\tfrac{\\partial T}{\\partial y} \\right) }{\\partial y} \n",
 
"+ \\frac{\\partial \\left( u\\tau_{xz}+v\\tau_{yz}+w\\tau_{zz}+k\\tfrac{\\partial T}{\\partial z} \\right) }{\\partial z}\n",
 
"$$\n",
 
"\n",
 
"where $\\rho$ is the density, $u$, $v$ and $w$ are the velocity conpinents in $x$, $y$ and $z$ directions, $p$ is the pressure, $E$ is the total energy per unit volume and $T$ is the temperature.In this work we considered the perfect gas law, for which the pressure is related to the total energy per unit volume, and the ideal gas law by the following expressions\n",
 
"\n",
 
"$$ \n",
 
"E = \\frac{p}{\\gamma -1} + \\frac{1}{2}\\rho \\left( u^{2}+v^{2}+w^{2} \\right) \\\\\n",
 
"p = \\rho RT\n",
 
"$$\n",
 
"\n",
 
"where $\\gamma$ is the specific heat ratio and $R$ is the specific gas constant.\n",
 
"\n",
 
"\n",
 
"\n",
 
"On the right hand side of the Navier-Stokes equations, the terms $\\tau_{xx}$, $\\tau_{xy}$, $\\tau_{xz}$, $\\tau_{yx}$, $\\tau_{yy}$, $\\tau_{yz}$, $\\tau_{zx}$, $\\tau_{zy}$ and $\\tau_{zz}$ are the components of the stress tensor\n",
 
"\n",
 
"$$\n",
 
"\\tau_{xx} = 2\\mu \\left(u_{x} - \\frac{u_{x} + v_{y} + w_{z}}{3} \\right), \\quad \\tau_{xy} = \\tau_{yx} = \\mu \\left( v_x + u_y \\right) \\\\\n",
 
"\\tau_{yy} = 2\\mu \\left(v_{y} - \\frac{u_{x} + v_{y} + w_{z}}{3} \\right), \\quad \\tau_{yz} = \\tau_{zy} = \\mu \\left( w_y + v_z \\right) \\\\\n",
 
"\\tau_{zz} = 2\\mu \\left(w_{z} - \\frac{u_{x} + v_{y} + w_{z}}{3} \\right), \\quad \\tau_{zx} = \\tau_{xz} = \\mu \\left( w_x + u_z \\right)\n",
 
"$$\n",
 
"\n",
 
"where $\\mu$ is the dynamic viscosity calculated using the Sutherland’s law and $k$ is the thermal conductivity computed by $ k = \\mu c_p/Pr $, where $c_p$ is the specific heat at constant pressure and $Pr$ is the Prandtl number. The Sutherland's law takes the form\n",
 
"\n",
 
"$$ \\frac{\\mu}{\\mu_{0}} = \\left( \\frac{T}{T_{0}} \\right)^{3/2} \\frac{T_{0} + C}{T + C} $$\n",
 
"\n",
 
"where the $\\mu_{0}$, $T_{0}$, $C$ are calibrated constants,which vary from gas to gas.\n",
 
"\n",
 
"\n",
 
"\n",
 
"\n",
 
"## Non-dimensionalization\n",
 
"\n",
 
"The freestream values are often chosen as the reference values for non-dimensionalization.Let $L_{ref}$ be the reference length, $U_{\\infty}$ be the reference velocity, $t_{ref} = L_{ref}/U_{\\infty}$ be the reference time, $\\rho_{\\infty}$ be the reference density, $T_{\\infty}$ be the reference temperature, $\\mu_{ref}$ be the reference viscosity, and let the non-dimensionalized parameters denoted by bar, then we have \n",
 
"\n",
 
"$$\n",
 
"t = \\tfrac{L_{ref}}{U_{\\infty}}\\bar{t}, \\quad x = L_{ref}\\bar{x}, \\quad y = L_{ref}\\bar{y}, \\quad z = L_{ref}\\bar{z} \\\\\n",
 
"\\rho = \\rho_{\\infty}\\bar{\\rho}, \\quad u = U_{\\infty}\\bar{u}, \\quad v = U_{\\infty}\\bar{v}, \\quad w = U_{\\infty}\\bar{w} \\\\\n",
 
"p = \\rho_{\\infty}U_{\\infty}^{2}\\bar{p}, \\quad E = \\rho_{\\infty}U_{\\infty}^{2}\\bar{E}, \\quad T = T_{\\infty}\\bar{T}, \\quad \\mu = \\mu_{\\infty}\\bar{\\mu} \\\\\n",
 
"Re = \\frac{\\rho_{\\infty} U_{\\infty} L_{ref}}{\\mu_{\\infty}}, \\quad k = \\frac{\\mu_{\\infty} U_{\\infty}^2}{T_{\\infty}}\\frac{\\bar{\\mu}}{\\left( \\gamma -1\\right) Pr {Ma}^2} = \\frac{\\mu_{\\infty} U_{\\infty}^2}{T_{\\infty}} \\bar{k} \n",
 
"$$\n",
 
"\n",
 
"where $Ma$ is the freestream Mach number. The last equation is derived using thermaldynamic relations. \n",
 
"\n",
 
"Substitute the variables in the Navier-Stokes equations with the above equations and make some manipulations, the non-dimensionalized Navier-Stokes equations are\n",
 
"\n",
 
"$$\n",
 
"\\frac{\\partial \\bar{\\rho}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{w}}{\\partial \\bar{z}} = 0 \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{u}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}^{2} + \\bar{p}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{w}}{\\partial \\bar{z}} \n",
 
"= \\frac{1}{Re} \\left( \\frac{\\partial \\bar{\\tau}_{xx}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\tau}_{yx}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\tau}_{zx}}{\\partial \\bar{z}} \\right) \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{v}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{v}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}^{2} + \\bar{p}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{v}\\bar{w}}{\\partial \\bar{z}} \n",
 
"= \\frac{1}{Re} \\left( \\frac{\\partial \\bar{\\tau}_{xy}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\tau}_{yy}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\tau}_{zy}}{\\partial \\bar{z}} \\right) \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{w}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{w}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}\\bar{w}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{w}^{2} + \\bar{p} }{\\partial \\bar{z}} \n",
 
"= \\frac{1}{Re} \\left( \\frac{\\partial \\bar{\\tau}_{xz}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\tau}_{yz}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\tau}_{zz}}{\\partial \\bar{z}} \\right) \\\\\n",
 
"\\frac{\\partial \\bar{E}}{\\partial \\bar{t}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{u}}{\\partial \\bar{x}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{w}}{\\partial \\bar{z}} \n",
 
"= \\frac{1}{Re} \\left[ \\frac{\\partial \\left( \\bar{u}\\bar{\\tau}_{xx}+\\bar{v}\\bar{\\tau}_{yx}+\\bar{w}\\bar{\\tau}_{zx}+ \\bar{k}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{x}} \\right)}{\\partial \\bar{x}} \n",
 
"+ \\frac{\\partial \\left( \\bar{u}\\bar{\\tau}_{xy}+\\bar{v}\\bar{\\tau}_{yy}+\\bar{w}\\bar{\\tau}_{zy}+ \\bar{k}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{y}} \\right)}{\\partial \\bar{y}} \n",
 
"+ \\frac{\\partial \\left( \\bar{u}\\bar{\\tau}_{xz}+\\bar{v}\\bar{\\tau}_{yz}+\\bar{w}\\bar{\\tau}_{zz}+ \\bar{k}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{z}} \\right)}{\\partial \\bar{z}} \\right]\n",
 
"$$\n",
 
"\n",
 
"\n",
 
"\n",
 
"We noticed that the non-dimensionalized Navier-Stokes equations are different in form to the original ones due to the existance of $1/Re$ in front of the viscous terms. In Nektar++, to be able to compute the equations in both the original form and the non-dimensionalized form, $1/Re$ is absorted into the viscosity as $\\bar{\\bar{\\mu}} = \\bar{\\mu}/Re$, which gives \n",
 
"\n",
 
"$$\n",
 
"\\frac{\\partial \\bar{\\rho}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{w}}{\\partial \\bar{z}} = 0 \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{u}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}^{2} + \\bar{p}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{w}}{\\partial \\bar{z}} \n",
 
"= \\frac{\\partial \\bar{\\bar{\\tau}}_{xx}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{yx}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{zx}}{\\partial \\bar{z}} \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{v}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{v}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}^{2} + \\bar{p}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{v}\\bar{w}}{\\partial \\bar{z}} \n",
 
"= \\frac{\\partial \\bar{\\bar{\\tau}}_{xy}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{yy}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{zy}}{\\partial \\bar{z}} \\\\\n",
 
"\\frac{\\partial \\bar{\\rho} \\bar{w}}{\\partial \\bar{t}} + \\frac{\\partial \\bar{\\rho} \\bar{u}\\bar{w}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\rho} \\bar{v}\\bar{w}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\rho} \\bar{w}^{2} + \\bar{p} }{\\partial \\bar{z}} \n",
 
"= \\frac{\\partial \\bar{\\bar{\\tau}}_{xz}}{\\partial \\bar{x}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{yz}}{\\partial \\bar{y}} + \\frac{\\partial \\bar{\\bar{\\tau}}_{zz}}{\\partial \\bar{z}} \\\\\n",
 
"\\frac{\\partial \\bar{E}}{\\partial \\bar{t}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{u}}{\\partial \\bar{x}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{v}}{\\partial \\bar{y}} + \\frac{\\partial (\\bar{E}+\\bar{p})\\bar{w}}{\\partial \\bar{z}} \\\\\n",
 
"= \\frac{\\partial \\left( \\bar{u}\\bar{\\bar{\\tau}}_{xx}+\\bar{v}\\bar{\\bar{\\tau}}_{yx}+\\bar{w}\\bar{\\bar{\\tau}}_{zx}+ \\bar{\\bar{k}}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{x}} \\right)}{\\partial \\bar{x}} \n",
 
"+ \\frac{\\partial \\left( \\bar{u}\\bar{\\bar{\\tau}}_{xy}+\\bar{v}\\bar{\\bar{\\tau}}_{yy}+\\bar{w}\\bar{\\bar{\\tau}}_{zy}+ \\bar{\\bar{k}}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{y}} \\right)}{\\partial \\bar{y}} \n",
 
"+ \\frac{\\partial \\left( \\bar{u}\\bar{\\bar{\\tau}}_{xz}+\\bar{v}\\bar{\\bar{\\tau}}_{yz}+\\bar{w}\\bar{\\bar{\\tau}}_{zz}+ \\bar{\\bar{k}}\\tfrac{\\partial \\bar{T}}{\\partial \\bar{z}} \\right)}{\\partial \\bar{z}}\n",
 
"$$\n",
 
"\n",
 
"which, as well as the stress tensor components, have exactly the same forms as the original Navier-Stokes equations, except the viscosity, thermal conductivity and specific gas constant, which are changed into\n",
 
"\n",
 
"$$\n",
 
"\\bar{\\bar{\\mu}} = \\frac{\\bar{\\mu}}{Re}, \\quad \\bar{\\bar{k}} = \\frac{\\bar{k}}{Re} = \\frac{\\bar{\\bar{\\mu}}}{\\left( \\gamma -1\\right) Pr {Ma}^2}, \\quad \\bar{R} = \\frac{\\bar{p}}{\\bar{\\rho}\\bar{T}} = \\frac{1}{\\gamma {Ma}^2}\n",
 
"$$\n",
 
"\n",
 
"The above three equations need to be paied attention to in the solver settings.\n",
 
"\n",
 
"If we look into the details of the viscosity, as the Sutherland's law is satisfied everywhere in the field,the freestream viscosity can be expressed as\n",
 
"\n",
 
"$$ \\frac{\\mu_{\\infty}}{\\mu_{0}} = \\left( \\frac{T_{\\infty}}{T_{0}} \\right)^{3/2} \\frac{T_{0} + C}{T_{\\infty} + C} $$\n",
 
"\n",
 
"By dividing the Sutherland's law by the above equation, we have \n",
 
"\n",
 
"$$ \\frac{\\mu}{\\mu_{\\infty}} = \\left( \\frac{T}{T_{\\infty}} \\right)^{3/2} \\frac{T_{\\infty} + C}{T + C} $$\n",
 
"\n",
 
"As a result, the adopted non-dimensionalized viscosity takes the form\n",
 
"\n",
 
"$$ \\bar{\\bar{\\mu}} = \\frac{\\bar{T}^{3/2}}{Re} \\frac{1 + C/T_{\\infty}}{\\bar{T} + C/T_{\\infty}} $$\n",
 
"\n",
 
"\n"
 
]
 
}
 
],
 
"metadata": {
 
"kernelspec": {
 
"display_name": "Python 3",
 
"language": "python",
 
"name": "python3"
 
},
 
"language_info": {
 
"codemirror_mode": {
 
"name": "ipython",
 
"version": 3
 
},
 
"file_extension": ".py",
 
"mimetype": "text/x-python",
 
"name": "python",
 
"nbconvert_exporter": "python",
 
"pygments_lexer": "ipython3",
 
"version": "3.8.3"
 
}
 
},
 
"nbformat": 4,
 
"nbformat_minor": 4
 
}
Loading