CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Help to create a CEL expression for Step function (https://www.cfd-online.com/Forums/cfx/83805-help-create-cel-expression-step-function.html)

anirudster January 11, 2011 20:24

Help to create a CEL expression for Step function
 
I have understood the use of step function for a 1-D rectangular profile as in CFX help:

h = 2[m]
IniVOFAir = step[((z - h)/1 [m])]
IniVOFWater = 1 - IniVOFAir

But, now I want to this for a cylinder. I mean, a volume fraction of cylindrical air profile in a big volume fraction fraction of cylindrical water profile. So, a cylindrical region of air (on top) in a cylindrical region of water. How can I write the expression for VOFAir and VOFWater in this case?

Thank you!

ghorrocks January 12, 2011 05:14

radius = sqr((x-X_Centre)^2+(y-Y_Centre)^2+(z-Z_Centre)^2)
InitialVOF=step((radius-Cylinder_radius)/1[m])

I have used a sphere centred on X_Centre,Y_Centre,Z_Centre of radius Cylinder_radius.

anirudster January 14, 2011 17:31

Thank you so much!
Because my case is cylinder, I am using If Statement:

IniVOFAir= if(sqrt(x^2+y^2)<=0.01[m] && z<=0.01[m],1,0)
IniVOFWat= 1-IniVOFAir

In this case, the radial part works fine but the height part (z) isn't getting satisfied. The height for VOFAir should be restricted to 0.01m and beyond 0.01m, it should just be water but using the expression above I am finding the height getting extended till the domain end, which it shouldn't do. God knows, what mistake I am making. I got to know about using if statement recently, so may be I am stating the expression wrongly. If you find anything wrong, please tell me.

ghorrocks January 15, 2011 06:29

Try putting the logic statement in brackets. Just a guess.

anirudster January 18, 2011 17:22

You will laugh at it, the formulation is correct; I was actually making a silly mistake, so it was a mistake from my side. Thank you for your advice and help.

anirudster January 18, 2011 17:31

Can I ask you one thing more?
I am modeling a two phase problem, like solid Al in liquid Ti using multiphase feature in CFX. In this case, I have chosen to go with heterogeneous model and not homogeneous model. I have unable to understand the free surface model feature in that, there are two options under it: standard and none.

I tried from help to understand but didn't get a very clear idea. If you have some info on this. Can you explain me these three things?
1. When to use heterogeneous model?
- my understanding says, when we have two phases involved like: solid Al having its own physical and chemical properties which is different from that of Ti, use heterogeneous model. In the problem, I want to see the mass transfer and heat transfer happening between the two (solid Al and liquid Ti). Hence using which model would be better? Heterogeneous or homogeneous?

2. When to use homogeneous model?

3. What is free flow model?
- my understanding is, free flow feature comes into play when we want to model the splashes etc at the top surface and hence keeping the surface free to move. Is this thinking of mine right?

Many thanks!
Ani

ghorrocks January 18, 2011 18:23

Use the heterogenous model when the different phases share the same variable field (usually velocity, but it can be other variables). In other words, at any point in the domain does a single velocity describe the flow velocity (ie homogenous), or is one phase going one way and another phase going another direction (ie inhomogeneous)?

The free surface model is used when you wish to explicitly model the interface between two phases. This means the smallest region of a phase which can be modelled is a few element volumes in size. If the phase is in smaller blobs than that (ie smaller than the element volume) then you cannot use free surface approaches and should consider particle tracking or eularian approaches.

anirudster January 18, 2011 21:59

I seriously appreciate you greatly as a person, as a mentor and as a guide. Thank you so much for answering my doubts.

"Use the heterogenous model when the different phases share the same variable field (usually velocity, but it can be other variables). In other words, at any point in the domain does a single velocity describe the flow velocity (ie homogenous), or is one phase going one way and another phase going another direction (ie inhomogeneous)?

The free surface model is used when you wish to explicitly model the interface between two phases. This means the smallest region of a phase which can be modelled is a few element volumes in size. If the phase is in smaller blobs than that (ie smaller than the element volume) then you cannot use free surface approaches and should consider particle tracking or eularian approaches. "

So, you mean to say: if we have two phases and both phases have their individual properties and don't share any variable among themselves then its heterogeneous. But if they share one of the parameter/variable among themselves, sometimes velocity then it is called Homogeneous. Am I right?
Can you please give me an example to get a concrete understanding?

Free surface, I understood from you that it is a interface layer created b/w the two phases based on the width you mention. Hence, this layer is kind of a resistance provided between the two layer to obstruct the heat and mass flow b/w the phases. Am I right?
When do we use it and how do we define the properties of this interface?

Thank you for all the knowledge & experience, you are sharing with me.

If you don't mind, can I know who are you and what do you do? Your name is Glenn and you are from Sydney. I would love to know your background and the field/company you belong to or work with.

Regards
Ani

ghorrocks January 18, 2011 22:23

Quote:

So, you mean to say: if we have two phases and both phases have their individual properties and don't share any variable among themselves then its heterogeneous. But if they share one of the parameter/variable among themselves, sometimes velocity then it is called Homogeneous. Am I right?
No, that is wrong. The distinction is whether the mixing of the phases is small compared to the element size. If it is small then the mesh cannot capture it so you need a model to capture it - usually a lagrangian particle tracking or a eularian model. It is large compared to the element size then the mesh can capture it so it can be modelled directly using a free surface model.

Quote:

Free surface, I understood from you that it is a interface layer created b/w the two phases based on the width you mention.
No, a free surface is modelled with no thickness. But numerically it is smeared over a small number of elements so it has a thickness proportional to the element size.

Quote:

Hence, this layer is kind of a resistance provided between the two layer to obstruct the heat and mass flow b/w the phases. Am I right?
Yes, this is correct. Look in the documentation for free surface interface conditions.

My name is Glenn Horrocks and I am an engineer in Sydney, Australia. I work for Silverbrook research developing printhead integrated circuits for ink jet printers. I have previously done work in the forging and automotive industries (IC engines). I have used CFX since about 1996 when it was CFX3.

mayj October 29, 2013 18:15

step fuction
 
Hi
How can I set a step function to calculate mixing in a mixing column, which contains water?
Any suggestion will be most appreciated.

mayj October 29, 2013 18:15

step fuction
 
Hi
How can I set a step function to calculate mixing in a mixing column, which contains water?
Any suggestion will be most appreciated.

ghorrocks October 29, 2013 20:59

What metric which represents mixing do you wish to calculate?

mayj October 29, 2013 23:16

step fuction
 
Hi
I'm using a mixing reactor contains water witch is oscillating throughout the column. I'm trying to write an expression for an additional variable (named dye) to quantify this mixing. This mixing can be initially two different colour (ie: blue and red) and turn to green when full mixing is achieved.

ghorrocks October 30, 2013 04:53

You will need to explain what you are doing and how you propose to measure the mixing. An image of the geometry would help.

mayj October 30, 2013 05:53

Step function
 
http://www.sciencedirect.com/science...09250902000817
There are different methods of calculating mixing in the column. One way is to calculate velocity ratio (the ratio of axial velocity to radial velocity). In this case the optimal mixing is around 2.5 (ie: axial velocity is 2.5 times greater than radial velocity). Another way is to use additional variable as concentration and calculate the full mixing in the column. To achieve this an expression(s) needed to evaluate the amount of mixing from totally unmixed to a fully mixed state. How we evaluate the amount of mixing here? I thought if I write an expression using "step" function or "if" function then I can use two different colour initially and a result colour due to full mixing. Not sure how to do that.

ghorrocks October 30, 2013 06:16

Yes, you could use an additional variable which is initialised as 0 on one side and 1 on the other and as the stuff mixes the additional variable will diffuse and convect around.

This is easy to do. It is just an initial condition on the additional variable, then some elementary post processing.

mayj October 30, 2013 20:08

Thanks for your response. Not sure how to set two different values for one additional variable. I set inlet to “1” and initial condition to zero. I’m also not sure what’s the unit for this additional value.

ghorrocks October 31, 2013 04:42

Set the initial condition for the AV to something like if(x<1[m],0,1) and that will put the division at x=1m.

There are several approaches for AVs and they have different units depending on the approach you use. Read the documentaiton and see the tutorials for more details.

mayj November 1, 2013 23:42

step function
 
Hi Glenn

Thanks for the tip. I will set this and test it out.
Another question is; if this works, how can I quantify and analyse mixing?

ghorrocks November 2, 2013 04:15

There are many ways to analyse mixing. Best go to the library and do some research to find how other people in a similar area do it.


All times are GMT -4. The time now is 05:46.