CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CFX

simulating an 'on/off' valve using UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 21, 2012, 09:11
Default simulating an 'on/off' valve using UDF
  #1
Member
 
Sandeep
Join Date: Oct 2012
Location: India
Posts: 51
Rep Power: 4
sandy_1982 is on a distinguished road
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
sandy_1982 is offline   Reply With Quote

Old   October 21, 2012, 17:24
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 10,553
Rep Power: 83
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
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.
ghorrocks is offline   Reply With Quote

Old   October 22, 2012, 08:05
Default valve open/closed....
  #3
Member
 
Sandeep
Join Date: Oct 2012
Location: India
Posts: 51
Rep Power: 4
sandy_1982 is on a distinguished road
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 is offline   Reply With Quote

Old   October 22, 2012, 13:38
Default small correction + addition w r t point 3
  #4
Member
 
Sandeep
Join Date: Oct 2012
Location: India
Posts: 51
Rep Power: 4
sandy_1982 is on a distinguished road
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
sandy_1982 is offline   Reply With Quote

Old   October 22, 2012, 17:42
Default
  #5
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 10,553
Rep Power: 83
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
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.
ghorrocks is offline   Reply With Quote

Old   October 23, 2012, 10:14
Default
  #6
Member
 
Sandeep
Join Date: Oct 2012
Location: India
Posts: 51
Rep Power: 4
sandy_1982 is on a distinguished road
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
sandy_1982 is offline   Reply With Quote

Old   October 23, 2012, 17:09
Default
  #7
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 461
Rep Power: 10
singer1812 is on a distinguished road
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).
singer1812 is offline   Reply With Quote

Old   October 25, 2012, 10:40
Default on/off valve
  #8
Member
 
Sandeep
Join Date: Oct 2012
Location: India
Posts: 51
Rep Power: 4
sandy_1982 is on a distinguished road
Thanks to Glenn & singer1812 for your answers

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

-Sandeep
sandy_1982 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Help Parallelizing UDF AndresC FLUENT 0 February 25, 2010 16:50
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11
Valve Forces in CFdesign Mike Clapp Main CFD Forum 3 March 8, 2001 15:09
UDF using c_face_loop(c,t,i) frederic FLUENT 2 April 1, 2000 22:42


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