Time to fill a pressure vessel, finite difference approximation is the solution?
- September 17, 2021
- 2 replies
- 8232 views
Hi all, first post here.
I'm trying to learn a bit more of Mathcad, instead of solving problems on several lines of Excel for a finite discretization.
The problem I’m studying is a very real and common situation of cascade gas filling.
It consists of a source (infinity size for simplicity) feeding start-empty vessel (1atm) thought a regulator valve that obey a function critical or sub-critical flow rate f(Delta P), until both source and vessel pressure are equalized. Then plotting a Pressure Vs Time for that system. The pressure would ramp up (critical flow), then level horizontal to zero flow as the pressure accumulation at the end.

I want to keep the math simple, in the future to add z-factor for the gas compressibility factor.
p1=pressure source
p2=pressure vessel (to be filled)
T=temp (constant)
V=vessel volume
Cg=valve flow capacity
SG=relative density
MW=gas molecular mass
ni=mole at P_tank empty (1 atm)
nf=mole at P_tank full (P_tank=P_source)
P=n*(R*T*z)/V, (R,T,z)/V = constant C1)
For each infinitesimal time step, the flow rate will drop after entering sub-critical condition, as the pressure of the tank goes up until, it equalizes with 0 flow.
1) Flow rate (Qmol) is a function of p2.
2) p2 is a function of moles accumulated at the tank due to flow rate at a time interval.
I know how to write a simple equation to calculate time for accumulated moles during the critical flow (fixed flow), but the sub-critical regime flow is a function of the vessel pressure that is building up.
I'm stuck after some day reading posts, the math should not be difficult, but...
Can a differential equation be solved using a finite difference approximation? Should I try to learn program, so the pressure can be added like time steps?
I tried this example (c) "common sense":
Attached my file up to where I could.
Many thanks in advance,
Fred.


