simulating an 'on/off' valve using UDF
i am using CFX and the following situation is what i am trying to model :
there are two cylindrical tanks of equal diameter and height that are connected by a constant diameter (straight)tube. One of the tanks has CO2 gas at a high temperature (50 deg C) while the other tank is having the same gas at a lower temperature (30 deg C). The gas in the two tanks will surely be having a tendency to mix together , but a valve (on -off kind of valve) stops the gas from doing so. Then after 3 seconds , the valve is OPENED, i want to see what happens next how does the gas mix from one to the other cylinder.
I am planning to do a 2D case.
My problem is how to model the valve , which is initially closed (i.e it is a 'wall' in the fluid domain) remains closed for 3 seconds and then 'opens' (i.e as if there is no 'wall' now and all is fluid).
How to do this using CEL / writing a UDF ?
thanks and regards
Assuming you do not want to actually model the true motion of the valve (eg a gate sliding open or a ball valve rotating or whatever it is), then simplified models of valves can be done by any of these options:
1) Do a steady state run with the two sides of the valve no connected. When it is converged stop the run. Generate a new mesh with the two sides connected and start a new run with the previous run interpolated as an initial condition.
2) If the initial condition is simple enough that you can specify it easily (eg no motion and a known pressure and temperature) then define this as an initial condition on a mesh which has the valve open. This is a much simpler single simulation approach.
3) Put a momentum source term in for the valve which initially has the velocities pulled to zero so nothing happens. Then use a CEL expression to remove it and allow the flow to proceed.
4) Put a normal mesh interface at the valve and use the new (new for CFX V14 that is) conditional opening stuff so you can open the valve using a CEL expression.
5) Put a small section of mesh which you can slide open with GGI interfaces.
Note: none of these approaches require fortran. They can all be set up using CFX-Pre with CEL expressions.
Option 2 sounds the best option for you, providing your initial condition is simple enough to be described as CEL expressions.
You mention the valve is shut for 3 seconds before opening. What happens during these 3 seconds? If nothing happens then it can be ignored.
i've been following you on this forum for quite some time now , so its really nice that you've answered my doubt first :)
Option 4 is what i have tried : " Put a normal mesh interface at the valve and use the new (new for CFX V14 that is) conditional opening stuff so you can open the valve using a CEL expression."
[ Valve as such is not important in the analysis]
but here's what i have done in CFX Pre (version 14 i'm using)
1. defined CO2 gas in 'materials' twice under the names CO1 and CO2 , and i've kept their 'reference temperatures' different each time , i.e 30 deg C for 'CO1' and 50 deg C for 'CO2'.
2. the 'fluid-fluid' interface which is created as a result of slicing operation done in DM .
i,ve used the 'conditional opening' by means of expression t > 3[s]
3. here's when the problem comes, when i try to define the material in the second domain ,it overwrites the one i have defined for the first domain , i.e if i have assigned CO1 to the left tank , then when i assign CO2 to the domain corresponding to right tank , then what i am getting is CO1 for both the tanks.
4. The fluid domains are taking only one material at a time it seems.
Where am i going wrong ?
(Note : i am also trying to define have both CO1 and CO2 and then keep their respective Volume Fractions 1 and 0 is the respective tanks , but i wonder whether this 'multiphase approach' is the right one for this case)
small correction + addition w r t point 3
3. here's when the problem comes, when i try to define the material in the second domain ,it overwrites the one i have defined for the first domain , i.e if i have first assigned CO1 to the left tank , then when i assign CO2 to the domain corresponding to right tank , then what i am getting is CO2 (and not CO1) for both the tanks.
or if i assign C02 first and then C01 to the next tank , then i get CO1 in both tanks
Your approach is not a good one. If the gas is the same composition initially then you do not need a multi-component or multi-phase model. It is a single phase and a single component so just model it as simple CO2. You can assign different initial temperatures to the different regions. And to track where gas on one side goes as it diffuses into the other use an additional variable.
It sounds like you can do this model with option 2, which is by far the simplest.
If i've understood correctly, there is not much different b/w the Options 2 and 4 which you suggested , except the 'conditional opening stuff' at the interface in Option 4 ;
my problem remains the following , which really comes during the 'domain initialisation' phase :
When i try to define the material in the second domain ,it overwrites the one i have defined for the first domain , i.e if i have assigned CO1 to the left tank , then when i assign CO2 to the domain corresponding to right tank , then what i am getting is CO1 for both the tanks.
(Note : The domains 'right tank' and 'left tank' because of the 'slicing' of the fluid domain done in DM)
As Glenn said, you dont need 2 materials for this. They are both CO2, just initialize the domains to the correct T and P for each tank.
From what you have described, it appears the 3 seconds is meaningless. It would seem you dont need a conditional "valve", just start the simulation with the prescribed IC's and let her rip (you will probably have to be even more careful with time step at the start).
Thanks to Glenn & singer1812 for your answers
and singer1812 ,to borrow from you "she's now rip"
|All times are GMT -4. The time now is 02:58.|