CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   simulating an 'on/off' valve using UDF (https://www.cfd-online.com/Forums/cfx/108361-simulating-off-valve-using-udf.html)

sandy_1982 October 21, 2012 09:11

simulating an 'on/off' valve using UDF
 
Hi,

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

Sandeep:)

ghorrocks October 21, 2012 17:24

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.

sandy_1982 October 22, 2012 08:05

valve open/closed....
 
Hello Glenn,

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)

thanks

Sandeep

sandy_1982 October 22, 2012 13:38

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


Thanks,

Sandeep

ghorrocks October 22, 2012 17:42

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.

sandy_1982 October 23, 2012 10:14

Glenn,

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)

Thanks,

Sandeep

singer1812 October 23, 2012 17:09

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).

sandy_1982 October 25, 2012 10:40

on/off valve
 
Thanks to Glenn & singer1812 for your answers

and singer1812 ,to borrow from you "she's now rip"

-Sandeep


All times are GMT -4. The time now is 07:19.