CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   using setFields to make a sinusodial phase condition (

wschosta June 9, 2011 16:12

using setFields to make a sinusodial phase condition
Hello foamers!

I'm working on a two phase flow simulation that will (hopefully eventually) model the kelvin helmholtz instability test. I was wondering if it's possible to set an initial phase condition other than a box using the setFields command. Currently what I'm doing is rewriting all of the alpha1 and U values from within createFields.H and I feel like this is a very roundabout way of accomplishing what I'm trying to do.

So, any suggestions on setFields? I know it goes back to setFieldsDict but I don't know what the possible parameters are.

gwierink June 10, 2011 09:10

Hi Walter,

Have a look at swak4Foam.

wschosta June 13, 2011 16:05

Hi Gijs, I have considered using the groovyBC and funkyFields parts of swak4Foam but for my purposes it would be optimal to only use the functions contained within the distributed libraries of OpenFOAM. I realize the documentation of such functions isn't as great as user made functions such as those in swak4Foam but it's a burden I have to live with.

I appreciate your input but I guess I'll just stick to setFields and the reassigning loops I've constructed.

gwierink June 14, 2011 01:11

Hi Walter,

Alright, well, many things are possible with the "standard" OpenFOAM pack as well. There are also other cell selection methods, to call it like that, in e.g. the cellSet utility. For instance, nearestToCell, sphereToCell, surfaceToCell, and so on. Maybe having a look there is useful. cellSet lives in: $FOAM_UTILITIES/mesh/manipulation/cellSet

Hope that is of any help.

marzbali November 9, 2011 15:20

Hello Gijs,

Do these functioned that you mentioned such as sphereToCell work in 2D axisymmetric simulations? Because I tried to patch a droplet in my domain and I got a cylinder instead!! I have used sphereToCell, cellSet, FunkySet and they all gave me the same shape!

Thanks a lot in advance.

gwierink November 9, 2011 19:29

Hi Marzbali,

A sphere in 2D should result in a cylinder of one cell length. If you would a like to set a cylinder specifically, there is also a cylinderToCell function. To be honest, I do not really understand the problem. In 2D you should get a circle/cylinder, right?

marzbali November 9, 2011 23:47

sorry I found my mistake, i didn't consider x as my axis!

All times are GMT -4. The time now is 02:36.