CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   internal Field BC (

T.D. March 11, 2011 06:05

internal Field BC
1 Attachment(s)
Hi foamers,
I have a rectangular internal field, and i need to define different values at start (0 folder) for all cells of a circular part inside that internal field, that you can see in the attached image.
Any ideas with blockMesh?

note: BC1 and BC2 are not really boundaries, they represent two different regions, that i need give different initial values inside the whole total internal field

thanks a lot

maddalena March 11, 2011 08:19

I think that setField does what you want...


T.D. March 11, 2011 09:30

Thanks a lot, i found it at last lol, the funkySetFields

thanks a lot


hossein.mashhadi March 13, 2011 02:54

Hi T.D

i m simulating the mass transfer from a single drop to a continuous stagnant phase. so for initial boundary i should define a spherical region for the drop phase. i did it for the alpha by funkySetField. now the question is can i do for the concentration of transporting species same as alpha using funky?


T.D. March 14, 2011 04:51

Hi hossein
you can give any values you like inside any region for any volume field you have defined, that's by simply writing the equations that describe that shape of the seeked region in your domain.
For example, if you have a 2D disk, you can simply add the following code before the time loop inside the solver:
//the disk equation is (x-xc)^2 + (y-yc)^2 <= R^2, here i took xc=0.25,yc=0.05,R=0.015, but you can do similarly for any equation (sphere, cylinder, etc..) and any field, here my field was "c" where i gave it 0.30 values inside the disk, and zeroes anywhere else where, where it is defined in the 0 Folder.

//the code just before the time loop


if (sqr(mesh.C()[cellI].component(0) - 0.25) + sqr(mesh.C()[cellI].component(1) - 0.05) <= sqr(0.015))
c[cellI] = 0.30;

I hope that your problem will be solved like that;


hossein.mashhadi March 14, 2011 05:48

Hi T.D
thanks for your quick reply, i will try like yours and will give you the results , i hope this help me.

All times are GMT -4. The time now is 10:27.