PDE Collections¶
Contents¶
- SolMuseum.pde.gas.ngs_pipe(p: Var, q: Var, lam, va, D, S, dx, dt, M, pipe_name: str, method='euler')¶
This function model and discretize natural gas equations
\[\begin{split}\pdv{p}{t}+\frac{c^2}{S}\pdv{q}{x}=&0,\\ \pdv{q}{t}+S\pdv{p}{x}+\frac{\lambda c^2q|q|}{2DSp}=&0\end{split}\]where \(p\) is the two-dimensional pressure distribution, \(p\) is the two-dimensional mass flow distribution, \(c\) is the sound speed, \(S\) is the cross-sectional area, \(\lambda\) is the friction coefficient, and \(D\) is the pipe diameter.
For semi-discretization method, the boundaries are approximated using characteristics [4], [5].
- Parameters:
- pVar
The pressure w.r.t. x and t
- qVar
The mass flow w.r.t. x and t
- lamParam or Number
The friction \(\lambda\)
- vaParam or Number
The speed of sound
- DParam or Number
The pipe diameter
- SParam or Number
The cross-section area
- dxParam or Number
The spatial difference step size
- dtParam or Number
The temporal step size. dt can be set to 0 if one uses the kt2 scheme.
- MParam or Number
The friction \(\lambda\)
- pipe_namestr
The name of the pipe
- methodstr
‘euler’ - Default, the euler scheme [3]
\[\begin{split}\left\{ \begin{aligned} &\pdv{u}{t}=\frac{u_{i+1}^{j+1}-u_{i+1}^{j}}{\Delta t}\\ &\pdv{u}{x}=\frac{u_{i+1}^{j+1}-u_{i}^{j+1}}{\Delta x}\\ &u=u_{i+1}^{j+1} \end{aligned} \right.\end{split}\]‘cdm’ - The central difference scheme [3]
\[\begin{split}\left\{ \begin{aligned} &\pdv{u}{t}=\frac{u_{i}^{j+1}+u_{i+1}^{j+1}-u_{i}^{j}-u_{i+1}^{j}}{2\Delta t}\\ &\pdv{u}{x}=\frac{u_{i+1}^{j+1}+u_{i+1}^{j}-u_{i}^{j+1}-u_{i}^{j}}{2\Delta x}\\ &u=\frac{u_{i}^{j+1}+u_{i+1}^{j+1}+u_{i}^{j}+u_{i+1}^{j}}{4} \end{aligned} \right.\end{split}\]‘cha’ - The method of characteristics [3]
\[\begin{split}p_i^{j+1}-p_{i-1}^j+\frac{c}{S}\left(q_i^{j+1}-q_{i-1}^j\right)+\frac{\lambda c^2 \Delta x}{4 D S^2} \frac{\left(q_i^{j+1}+q_{i-1}^j\right)\left|q_i^{j+1}+q_{i-1}^j\right|}{p_i^{j+1}+p_{i-1}^j}&=0,\quad 1\leq i\leq M,\\ p_{i+1}^j-p_i^{j+1}+\frac{c}{S}\left(q_i^{j+1}-q_{i+1}^j\right)+\frac{\lambda c^2 \Delta x}{4 D S^2} \frac{\left(q_i^{j+1}+q_{i+1}^j\right)\left|q_i^{j+1}+q_{i+1}^j\right|}{p_i^{j+1}+p_{i+1}^j}&=0,\quad 0\leq i\leq M-1.\end{split}\]‘kt1’ - The first order Kurganov-Tadmor semi-discretization scheme
\[\pdv{u_j}{t}=-\frac{1}{\Delta x}\qty(\hat{f}_{j+1/2}-\hat{f}_{j-1/2})+S(u_j)\]where \(\hat{f}_{j+1/2}\) and \(\hat{f}_{j-1/2}\) are reconstructed by the first order Kurganov-Tadmor scheme [2].
‘kt2’ - The second order Kurganov-Tadmor semi-discretization scheme
\[\pdv{u_j}{t}=-\frac{1}{\Delta x}\qty(\hat{f}_{j+1/2}-\hat{f}_{j-1/2})+S(u_j)\]where \(\hat{f}_{j+1/2}\) and \(\hat{f}_{j-1/2}\) are reconstructed by the second order Kurganov-Tadmor scheme [2].
The default value of \(\theta\) in minmod limiter is set to be 1.
‘weno3’ - The second order WENO semi-discretization scheme
\[\pdv{u_j}{t}=-\frac{1}{\Delta x}\qty(\hat{f}_{j+1/2}-\hat{f}_{j-1/2})+S(u_j)\]where \(\hat{f}_{j+1/2}\) and \(\hat{f}_{j-1/2}\) are reconstructed by the weighted essentially non-oscillatory scheme [1].
- Returns:
- artifactdict()
The dict of derived equations and variables.
References
[1]C.-W. Shu, “Essentially non-oscillatory and weighted essentially non- oscillatory schemes for hyperbolic conservation laws,” in Advanced Numerical Approximation of Nonlinear Hyperbolic Equations: Lectures given at the 2nd Session of the Centro Internazionale Matematico Estivo (C.I.M.E.) held in Cetraro, Italy, June 23–28, 1997, A. Quarteroni, Ed. Berlin, Heidelberg: Springer Berlin Heidelberg, 1998, pp. 325–432.
- SolMuseum.pde.gas.broken_pipe.rupture_pipe(p: Var, q: Var, lam, va, D, S, dx, dt, M, pipe_name: str, idx_leak, method='weno3')¶
The rupture fault model of ngs pipes, with the fault boundary condition
\[\begin{split}\begin{aligned} &p_i = p_a\\ &q_\text{i} = q_\text{upstream} - q_\text{downstream} \end{aligned}\end{split}\]where \(p_i\) is the pressure of the rupture position, \(p_a\) is the atmospheric pressure, \(q_i\) is the mass flow of the rupture position, \(q_\text{upstream}\) is the upstream leakage mass flow and \(q_\text{downstream}\) is the downstream leakage mass flow. The fault model is based on the normal ngs pipe defined above. The details can be found in [1].
- Parameters:
- idx_leak: Number
The index of rupture location.
- methodstr
‘euler’ - Default, the euler scheme
‘cdm’ - The central difference scheme
‘cha’ - The method of characteristics
‘kt1’ - The first order Kurganov-Tadmor semi-discretization scheme
‘kt2’ - The second order Kurganov-Tadmor semi-discretization scheme
‘weno3’ - The third order WENO semi-discretization scheme
- Returns:
- artifactdict()
The dict of derived equations and variables.
References
- SolMuseum.pde.gas.broken_pipe.leakage_pipe(p: Var, q: Var, lam, va, D, S, dx, dt, M, pipe_name: str, idx_leak, d, method='weno3')¶
The leakage fault model of ngs pipes, with the fault boundary condition
\[\begin{split}q_\text{leak}= \begin{cases} 0.61S_\text{h}p_j\sqrt{\frac{2M}{ZRT}\frac{k}{k-1}\left(\left(\frac{p_\text{a}}{p_j}\right)^{\frac{2}{k}}-\left(\frac{p_\text{a}}{p_j}\right)^{\frac{k+1}{k}}\right)}&p_j\leq {p_\text{sw}}\\ S_\text{h}p_j\sqrt{\frac{M}{ZRT}k\left(\frac{2}{k+1}\right)^{\frac{k+1}{k-1}}} & p_j > {p_\text{sw}}\\ \end{cases}\end{split}\]where \(k\) is the adiabatic coefficient, \(M\) is the molar mass of gas, \(T\) is 273.15K, \(Z\) is the gas compressibility factor, \(R\) is the ideal gas constant, \(S_\text{h}\) is the area of the leakage hole;
\[S_\text{h} = \pi\qty(\frac{d}{2})^2,\]\(d\) is the diameter of the leakage hole; the switching pressure
\[p_\text{sw}=\left(\frac{2}{k+1}\right)^{-k/(k-1)}\cdot p_{a}.\]The fault model is based on the normal ngs pipe defined above.
- Parameters:
- idx_leak: Number
The index of rupture location.
- d: Number or Param
The diameter of the leakage hole.
- methodstr
‘euler’ - Default, the euler scheme
‘cdm’ - The central difference scheme
‘cha’ - The method of characteristics
‘kt1’ - The first order Kurganov-Tadmor semi-discretization scheme
‘kt2’ - The second order Kurganov-Tadmor semi-discretization scheme
‘weno3’ - The third order WENO semi-discretization scheme
- Returns:
- artifactdict()
The dict of derived equations and variables.
- SolMuseum.pde.heat.heat_pipe(T: Var, m, lam, rho, Cp, S, Tamb, dx, dt, M, pipe_name: str, method='kt2', T_offset: int = 0)¶
This function model and discretize heat pipe equations
\[\frac{\partial\tau}{\partial t}+\frac{\dot{m}}{\gamma \rho}\frac{\partial\tau}{\partial x}+ \frac{\lambda }{\gamma\rho C_\mathrm{p}}(\tau-\tau^\mathrm{amb})=0\]where \(\tau\) denotes the two-dimensional temperature distribution, \(\gamma\) is the cross sectional ares, \(\rho\) is the water density, \(\dot{m}\) is the water mass flow, \(\lambda\) is the friction coefficient, \(C_p\) is the thermal capacity, and \(\tau^\text{amb}\) is the ambient temperature.
- Parameters:
- TVar
The temperature distribution w.r.t. x and t
- m: Param or Var
The mass flow rate
- lamParam or Number
The friction \(\lambda\)
- rho: Param or Number
The water density
- Cp: Param or Number
Thermal capacity of mass flow
- SParam or Number
The cross-section area
- Tamb: Param or Number
The ambient temperature
- dxParam or Number
The spatial difference step size
- dtParam or Number
The temporal step size. dt can be set to 0 if one uses the kt2 scheme.
- MParam or Number
The friction \(\lambda\)
- pipe_namestr
The name of the pipe
- methodstr
‘iu’ - The method of implicit upwind [1]
\[\begin{split}\left\{ \begin{aligned} &\frac{\partial \tau}{\partial t}=\frac{\tau_{k+1}^{n+1}-\tau_{k+1}^{n}}{\Delta t}\\ &\frac{\partial \tau}{\partial x}=\frac{\tau_{k+1}^{n+1}-\tau_k^{n+1}}{\Delta x}\\ &\tau=\tau_{k+1}^{n+1} \end{aligned} \right.\end{split}\]‘yao’ - The Yao’s scheme, i.e. the second order explicit scheme [2]
\[\begin{split}\left\{ \begin{aligned} &\frac{\partial \tau}{\partial t}=\frac{\tau_k^{n+1}-\tau_k^{n}+\tau_{k+1}^{n+1}-\tau_{k+1}^{n}}{2\Delta t}\\ &\frac{\partial \tau}{\partial x}=\frac{\tau_{k+1}^{n+1}-\tau_k^{n+1}+\tau_{k+1}^{n}-\tau_{k}^{n}}{2\Delta x}\\ &\tau=\frac{\tau_{k+1}^{n+1}+\tau_k^{n+1}+\tau_{k+1}^{n}+\tau_{k}^{n}}{4} \end{aligned} \right.\end{split}\]‘kt2’ - Default, the second order kurganov-tadmor scheme [3]
\[\pdv{u_j}{t}=-\frac{1}{\Delta x}\qty(\hat{f}_{j+1/2}-\hat{f}_{j-1/2})+S(u_j)\]where \(\hat{f}_{j+1/2}\) and \(\hat{f}_{j-1/2}\) are reconstructed by the second order kurganov-tadmor scheme.
- Returns:
- artifactdict()
The dict of derived equations and variables.
References