# simulating an 'on/off' valve using UDF

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

 October 21, 2012, 09:11 simulating an 'on/off' valve using UDF #1 Member   Sandeep Join Date: Oct 2012 Location: India Posts: 51 Rep Power: 4 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

 October 21, 2012, 17:24 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 10,931 Rep Power: 85 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.

 October 22, 2012, 08:05 valve open/closed.... #3 Member   Sandeep Join Date: Oct 2012 Location: India Posts: 51 Rep Power: 4 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

 October 22, 2012, 13:38 small correction + addition w r t point 3 #4 Member   Sandeep Join Date: Oct 2012 Location: India Posts: 51 Rep Power: 4 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

 October 22, 2012, 17:42 #5 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 10,931 Rep Power: 85 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.

 October 23, 2012, 10:14 #6 Member   Sandeep Join Date: Oct 2012 Location: India Posts: 51 Rep Power: 4 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

 October 23, 2012, 17:09 #7 Senior Member   Edmund Singer P.E. Join Date: Aug 2010 Location: Minneapolis, MN Posts: 495 Rep Power: 11 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).

 October 25, 2012, 10:40 on/off valve #8 Member   Sandeep Join Date: Oct 2012 Location: India Posts: 51 Rep Power: 4 Thanks to Glenn & singer1812 for your answers and singer1812 ,to borrow from you "she's now rip" -Sandeep

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post kim FLUENT 3 October 26, 2011 21:38 AndresC FLUENT 0 February 25, 2010 16:50 Abhi Main CFD Forum 12 July 8, 2002 09:11 Mike Clapp Main CFD Forum 3 March 8, 2001 15:09 frederic FLUENT 2 April 1, 2000 22:42

All times are GMT -4. The time now is 09:32.