DanWBR / dwsim

DWSIM is a Steady-State and Dynamic Sequential Modular Chemical Process Simulator for Windows, Linux and macOS.
https://dwsim.org
GNU General Public License v3.0
296 stars 95 forks source link

[Enhancement] Dynamic pipe simulation #105

Open JarlPed opened 3 years ago

JarlPed commented 3 years ago

Many components in the DWSIM simulation environment can be simulated dynamically, however pipes are not. I usually find myself producing solutions that has the flow rate settings corresponding to conjugant pressures in down stream material streams. However, it would be nice to have the pipe simulation in a dynamic mode that also can capture the multiphase flow phenomena, such as plug flow and the like, in addition to controller response.

I have a background in thermohydraulics, but there are many different approaches. Homogenous Equilibrium Model (HEM) is likely the most straightforward approach, but lacks the the phase slip effect (inhomogenous fluid valocity of phases). I guess the most complete approach is a Navier-Stokes based model equation with energy conservation.

Any thoughts about this improvement, and which approach should be pursued first?

DanWBR commented 3 years ago

I was thinking about working on the complete approach, but this is not on my priority list. If someone wants to implement such a model, it just needs to work on the RunDynamicModel() procedure of the Pipe class. There is a single AccumulationStream (an internal material stream representing the accumulation volume) instance that can be worked on but the developer can choose to use a list of accumulation streams like I do on the PFR.

JarlPed commented 3 years ago

Thanks Daniel,

What comes to mind is the complexity of the different phases. Solids are particular tricky, as one has to specify particle sizing, or rather a distribution of sizes. I know Schlumberger OLGA uses a two Liquid bulk and droplet model with gas phase interaction to model Water-Oil-Gas systems. Also, DWSIM models the PVT for VLLS systems (apparently, Mercury-Water-Decane erroneously separates to a Mercury phase and a Water-Decane mix.).

I guess that a fair approach is to support VLL systems, and issue an error if a solid phase is present. The bulk-droplet liquid model should be able to conceptually, simulate an N-liquid and gas material streams.

The discharge coefficients could be calculated according to the paper: https://www.researchgate.net/publication/281775227_Multiphase_Flow_of_Hydrocarbon_Fluids_through_Orifices_Validation_of_OLGA_2000_Flow_Model The model should closely resemble the single liquid model in the paper, with additions of the second bulk-droplet liquid equations and couplings: https://onepetro.org/PO/article-abstract/6/02/171/53376/The-Dynamic-Two-Fluid-Model-OLGA-Theory-and?redirectedFrom=fulltext

DanWBR commented 3 years ago

@JarlPed the mercury-water-decane system may need some adjusted binary interaction parameters. I'm not sure if I've included BIPS for Mercury-C10 and Mercury-H2O.

JarlPed commented 3 years ago

@DanWBR , I can see that SVLLE (i.e. two liquids) supported at the time being for the Flash equilibria settings (dunno how certain phases are to be fused in this framework). It's known that up to 8 different liquid can co-exist: https://en.wikipedia.org/wiki/Multiphasic_liquid Anyway, it's beyond the scope of this Issue.

For now, simple discharge calculations is probably sufficient, and the model equations would have to be initialized automatically wrt. to the number of phases.

JarlPed commented 3 years ago

Hi @DanWBR . I'm looking into an approach to model the differential equations and find that the best option is probably to use a symbolic algebra system (i.e. MathNet.Symbolics) to write up the equations more or less as from that from the papers. The algebra system can rearrange the equations to a form suitable for a numerical solution.

I think the MacCormack solution scheme is the easiest to implement, but also an N-corrector method is also fairly straightforward.

We're looking at adding an aditional dependency for DWSIM.UnitOperations and DWSIM.Math (or else where to place the numerical solution scheme).

AlexanderSemenyak commented 6 months ago

Unsteady Simulation of Natural Gas Networks.pdf