AAGAN / WilliamsonMethod

c++ implementation of Williamson's method
0 stars 0 forks source link

Williamson Method

Based on the 1985 paper "Calculating H-1301 discharge pressures and densities" by H.V.Williamson, this theory calculates the container and pipe states during the instantaneous discharge of super-pressurized fire extinguishing agent (liquid) propelled by inert gas (N2).

Complex thermodynamics is going on inside the system: Liquid will boil in the tank during discharge due to the super saturation effect from nitrogen. Liquid-vapor two-phase flow inside pipeline. This is a 1-D model that does not consider the hydraulics.

Specifically it consists of two parts: 1.: Pressure recession in the storage container during discharge. 2.: Pressure and density in the piping for specific increments of liquid leaving the storage container.

Refer to that paper for details and equations of this theory, which is based on Halon. This code is capable to generalize to other futuristic agents or inert gases, and all equations would still hold. Only need to change the molecular weight ratio of inert gas vs agent (0.188), coefficient for the expansion effect of dissolved inert gas on the liquid volume (0.053), as well as the corresponding property data file.

Limitations:

C++ implementation of Williamson's method and How to use it

A verbose flag has default as False. User can choose to turn on verbose in order to see detailed information during williamson calculation, including: input temperature interpolation, pressure at each convergence iteration, and the converged state at each temperature step. Verbose messages can be too long, especially for the convergence steps, that the print screen cannot show all.

Williamson Method exit code:

Property file:

Each agent is read in from its specific file, which has to obey the following format:

After being read into williamson class, each physical property is a private vector.

The current data file used for Halon-1301 is from Williamson paper and that for Novec-1230 is from Tom. For Halon the Williamson paper has its Henry's constant data, but for Novec Tom assumes Henry's constant is linear with temperature in VB code, and we are currently using the same expression ( C_henry = 0.9286*T(F) + 3494.6 ). Verification cases simply using constant values (3400 and 3600) for Henry's Law constant show that it's not affecting the pressure recession table, so we can reasonably worry less about it.

In order to calculate ideal gas expansion in tank after liquid is depleted, specific heat ratio data is needed for agent. Currently using a constant specific heat ratio at 25C and 1 bar for both Halon and Novec. Added in the agent property file after Henry's Law constant. For Nitrogen the specific heat ratio is 7/5.

Core algorithm for the theory - Pressure convergence criterion:

In solving for the tank or pipe state at a temperature, a pressure value is firstly guessed. After plugging this value into those coupled equations the resultant pressure should be the same as the assumed pressure. If they are not equal (not converged), adjusting the assuming pressure until convergence. Due to numerical issue, the guessed and resultant values have trouble coming infinitely close sometime, so a criterion for convergence is needed. When the input/output pressure difference is within this small criterion, we accept it as converged.

Converging pressure is really a flimsy process of finding the pressure solution of the coupled equations. Whether the calculation could converge as well as the temperature at which the agent depletes could both depend on this criterion. Theoretically calculation converges more precisely with a smaller criterion, but it turns out that if the criterion is too small the solution would even diverge and reduce to negative value without finding a solution. Therefore using a lower threshold may not always be desirable. Some step is just not able to converge as accurate as asked.

Other than the convergence criterion, the pressure increment (P_inc), which is the step adjustment when not converging, can also affect the convergence. Solution could infinitely loop between two values without converging for too large of this increment.

Caveats:

Miscellaneous:

The calculated pressure recession matches Figure H.1(b) of NFPA 12A for Halon 1301. The slight difference could be due to many reasons:

Developing notes: