# Mulpuru and Wilkin 1982 - A Model for vented deflagration of hydrogen in a volume
###### tags: `Research`
# Discussion
## Which variables will be updated with each iteration?
> Variables to be updated: $\bar{P}$, $\eta^3$, $n$, $r$ (flame radius, updated as $\eta^3$ is updated), $\frac{A}{V_i}$ (updated as $r$(flame radius) is updated), $S$, $\frac{d}{dt}\frac{m_v}{m_i}$, $T_u$, $T_b$.
> [name=Furkan][color=#93C47D]
> @Furkan You have mentioned $T_b$ before but after that you said it only needed to be calculated once for the initial condition. Could you clarify this point
> [name=Saad]
> That's true Saad, it is not needed anywhere else. But it is easy to calculate after each iteration and Mulpuru and Wilkin calculates it. That's why I wanted to calculate.
> [name=Furkan][color=#93C47D]
> I see $T_u$ being used in $17$ under energy balance for the calculation of contant $b$ so how is this value updated with each iteration? I have assumed that $b$ is calculated using $\gamma_e\bar{P}_f - 1$
> [name=Saad]
> Yes Saad, the constant b is calculated using the expression you are saying. The iteration of $T_u$ (as well as $T_b$) comes from the ideal gas equation $PV=mRT$. As the $P$ and $V$ is updated $T_u$ and $T_b$ are updated as well. I can write expressions for these two later. Notice that we will use each updated $T_u$ values in the calculation of $S_{lo}$. Updated $T_b$ values are not used anywhere. Only the initial value of $T_b$ is what we need.
> [name=Furkan][color=#93C47D]
> Under section `2.5.4` could you also explain the case `2-a-2` and `2-b-2` where the flame radius is greater then the vessel
> [name=Saad]
> Saad, it is not where the flame radius is greater than the vessel. The cases 2-a-2 and 2-b-2 correspond to cylinder vessel, the first one for center ignition, the second is for top or bottom ignition. See Figure 2. These two expressions are valid when the flame radius becomes greater than the cylinder "radius". Let me know if you do not understand anything here.
> [name=Furkan][color=#93C47D]
## Would the user specify which gas is venting?
> Yes but, I have an idea about this selection. Let us make it that user specifies which gas is venting initially and let us reproduce the Figures 4 and 7 first.
> [name=Furkan][color=#93C47D]
> Ok
> [name=Saad]
## How to know if choked and subsonic condition should be used?
> Choked condition is if $\frac{P_a}{P}<=\frac{1}{\bar{P}_{critical}}$ and subsonic condition is if $\frac{P_a}{P}>\frac{1}{\bar{P}_{critical}}$. Here $\frac{1}{\bar{P}_{critical}}=(\frac{2}{\gamma+1})^{\frac{\gamma}{\gamma-1}}$. See the end of Section 2.4.1. In $\frac{1}{\bar{P}_{critical}}$ equation, $\gamma$ value is $\gamma_u$ if unburned gas is venting, or it is $\gamma_b$ if burnt gas is venting. Another important thing is to watch out that in the conditions of $\frac{P_a}{P}$, $P$ in the denominator is $P$, not $\bar{P}$, so this $P$ is actually equal to $\bar{P}*P_i$ where $P_i$ is the initial pressure. Overall another note is that this venting condition being either subsonic or supersonic must be checked at each iteration as $\bar{P}$, thereby $P$, changes at each iteration. As for future, not for now, I have an idea to add problem dependent-conditions that will decide which gas is venting, so that which gas is venting may change for type of each problem set-up and also maybe may change even during the problem set-up as iterations go on. It can be complicated for now but if we can (or I can) do it later that would be very good.
> [name=Furkan][color=#93C47D]
> Ok
> [name=Saad]
## Anything else which is important?
> Make sure that you are solving the $\frac{A}{V_i}$ with Newton-Raphson method and this solution procedure is inside the $4^{th}$-order Runge-Kutta method. In some cases you do not need to use the Newton-Raphson method to calculate the parameter $\frac{A}{V_i}$ at each iteration but still make sure that you are putting its calculation inside the $4^{th}$-order Runge-Kutta method.
> [name=Furkan][color=#93C47D]
> Another point that you also mention in the comments is the calculation of $S$. $S$ is calculated using the Equations (32),(33) and (34) in the Sections 2.5.1 and 2.5.2. Mulpuru and Wilkin do not use the Equation (35) in their calculations. The only input in these equations by the user is the constant $f$ that in Eq. (34) multiplies the $S_l$. $S_l$ is in Eq. (33) calculated by $S_{lo}*(\frac{P}{P_o})^x$. $S_{lo}$ is calculated in Eq. (32). In the fraction of $(\frac{P}{P_o})^x$, here $P$ again is dimensional pressure which is $\bar{P}*P_i$, $P_o$ is taken as 101 kPa and the exponent $x$ is $(-0.051)$.
> [name=Furkan][color=#93C47D]
> @Furkan
> - For $\frac{dn}{dt}$ is it $S_l$ or $S_t$
> - If $x_{h_2}=0.42$ which coefficient values will be used
> [name=Saad]
> - For $\frac{dn}{dt}$,it is $S_t$
> - For $x_{h_2}=0.42$, use the condition $x_{h_2}<0.42$. The other condition is only for $x_{h_2}>0.42$
> [name=Furkan][color=#93C47D]
> Additionally Saad, I said that we only need initial value of the $T_b$. However I found out that this isn't true. Because in the $\frac{d}{dt}\frac{m_v}{m_i}$ terms, there are density values $\rho$ and this value is either density of unburned gas or burnt. At each iteration these density values are updated, as $P$ and $T$ of unburnt and burnt gases are updated. This is from the ideal gas equation $\rho=\frac{PW}{RT}$. Here $W$ is the molecular weight of either unburnt or burnt gas and they are constant. $P$ is dimensinal pressure $\bar{P}*P_i$ in terms of $Pa$ unit. $R$ is gas constant as $8314 \,\,\, j/molK$.
> There is another way of calculating updated densities but let us use this.
> [name=Furkan][color=#93C47D]
> Acknowledged
> [name=Saad]
# Initial Values
| Variable | Initial Value | Update With Each Iteration | Questions | Comments
| - | - | - | - | -
| $\eta^3$ | GasEQ | True |
| $\epsilon$ | $10^{-5}$ | False
| $n$ | $\epsilon$ | True
| $\bar{P}$ | $1$ | True
| $r$ (flame radius) | depends on type of enclosure and ignition location, see Section 2.5.4 | True
| $\gamma_u$ | GasEQ | False | specific heat ratio
| $\gamma_b$ | GasEQ | False | specific heat ratio
| $\gamma_e$ | $\frac{\gamma_u - 1}{\gamma_b - 1}$ | False
| $\bar{P}_f$ | GasEQ | False
| $b$ | $\gamma_e\bar{P}_f - 1$ | False
| $\frac{dn}{dt}$
| $\frac{d}{dt}\frac{m_v}{m_i}$
# Pending
## Would the user specify which gas is venting?
> I may want to correlate this selection into the problem type being solved. (can explain later).
> (regarding which gas is venting question -->) But let me inform you about one point how this selection is used in one case of Mulpuru and Wilkin paper, in Figure 7 you can see this as well. They say in sphere volume, surface ignition can be two options (bottom ignition and top ignition). How this surface ignition is related to bottom ignition or top ignition logically depends on which gas is venting.(they say it). They say that if the burnt gas is venting (if burnt gas venting is specified by user), then this is bottom ignition (ignition close to the vent location). If the unburnt gas is venting (if unburnt gas venting is specified by user) then this is top ignition.
> [name=Furkan][color=#93C47D]
>
# Code Issues
## Optimization
1. `S_t` is set twice in a single iteration in functions `set_difft_n` and `set_n` module `difft_n.py`