CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   NEED HELP for position field function!! (http://www.cfd-online.com/Forums/star-ccm/108461-need-help-position-field-function.html)

 EnronZhang October 24, 2012 08:56

NEED HELP for position field function!!

Hey guys, I am currently working on a project about the oil spill tank. I am wondering if there is a field function which is relatively corresponding to the global coordinate?

That means, if I have known X and Y in the Cartesian coordinate, is it possible to create a field function to obtain the Z?

Thank you so much in advance!!

 abdul099 October 24, 2012 13:46

Maybe. What exactly do you want to achieve? How should your result look like?

 siara817 October 24, 2012 13:47

You can generate easily a field function by right clicking on Tools/ Field functions and select New. Then open the Definition node. But, how does Z variable depend on the value of X and Y theoretically? Do you have some equation that gives you the value of Z according to X and Y?

 EnronZhang October 25, 2012 10:23

Quote:
 Originally Posted by siara817 (Post 388349) You can generate easily a field function by right clicking on Tools/ Field functions and select New. Then open the Definition node. But, how does Z variable depend on the value of X and Y theoretically? Do you have some equation that gives you the value of Z according to X and Y?
Hi siara, that's what I want to generate. For instance, I have a tank which is full of oil and water inside. It is two phase model. Of course, the oil is on top of the water as its light density. In this case, the top boundary surface is not flat, instead, it is inclined plane. I would like to create a field function to obtain all the Z values on this top surface to determine the the oil domain. Since the top surface of the tank is inclined, the oil thickness is variable. But I want to define the oil thickness to be constant in 2mm under the tank's top surface. How should I create this field function? Thank you for your help in advance.

 EnronZhang October 25, 2012 10:24

Quote:
 Originally Posted by abdul099 (Post 388347) Maybe. What exactly do you want to achieve? How should your result look like?
Hi abdul, that's what I want to generate. For instance, I have a tank which is full of oil and water inside. It is two phase model. Of course, the oil is on top of the water as its light density. In this case, the top boundary surface is not flat, instead, it is inclined plane. I would like to create a field function to obtain all the Z values on this top surface to determine the the oil domain. Since the top surface of the tank is inclined, the oil thickness is variable. But I want to define the oil thickness to be constant in 2mm under the tank's top surface. How should I create this field function? Thank you for your help in advance.

 siara817 October 25, 2012 14:17

Ok, I assume that you know what is the equation for the surface according to the viscosity of surface. Then you can put X and Y to get the Z value.
You can show scalar variables by \$ and vectors by \$\$. to find more about programming, search in the help "field function programming reference"

 abdul099 October 26, 2012 16:30

Quote:
 Originally Posted by EnronZhang (Post 388497) I want to define the oil thickness to be constant in 2mm under the tank's top surface.
Do you want this to be an initial condition or a boundary condition?
When the top surface is just inclined but flat, I would create a coordinate system parallel to the plane. Than you can reference the Z-coordinate directly. Something like \$\$Position("Coordinate System 1")[2]. Not fully sure about the syntax, I don't have the user guide open right now, but I'm pretty sure you'll find it.
When the top surface is corrugated, it's much more complicated, so I'm too lazy to explain it when it's not necessary ;)

 All times are GMT -4. The time now is 11:43.