I am trying to adjust dnsFoam
I am trying to adjust dnsFoam to calculate the decay of turbulence (in space). For that, in my domain (say 32, 16, 16  with inlet bc) the turbulence forcing is active in the first half only (1:16,1:16,1:16), the other part should be calculated without the extra source term. How can I do that in a compact and elegant way? Some CFD codes allow to define different fluid zones, is that a case with OF? I've got no experience with OF and need some help
Regards, Mick 
A possible way to do this (far
A possible way to do this (far from clever, tough http://www.cfdonline.com/OpenFOAM_D...lipart/sad.gif ) is to create a new scalar field (say, alpha) to act like a switch:
it is 0 outside your forcing subdomain and 1 inside. Then you set the initial conditions accordingly and never change this variable (alpha). In the main code, you multiply alpha by the force, and that's it. Cheers, luiz 
Please post your message under
Please post your message under one topic only.
Mattijs 
Luiz,
That's indeed my questi
Luiz,
That's indeed my question. How to create such a scalar field to be 1 in the first half of the domain and 0 in the second. Could you give me an example? Regards, Mick 
Add your switch variable (alph
Add your switch variable (alpha) to createFields.H
volScalarField alpha ( IOobject ( "alpha", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Your "0" directory must now contain initial value for this variable all over the domain. Set it to 0 over all domain and boundary conditions. Then, create a auxiliar case, whose geometry is exactly that of your forcing subdomain. Construct such a case and set alpha = 1 in all this auxiliary geometry (case). Use mapFields utility to map fields from the auxiliary case to the real one: mapFields . auxiliar_case . real_case This way, your variable alph (dont forget to alter mapFieldsDict accordingly) will now be 1 in the region coincident with the auxiliar case geometry and 0 elsewhere. Then, run the case (real one) Good luck 
the setFields utility might be
the setFields utility might be helpful. Have a look at the dam break tutorial for the interFoam solver. You can also look at the guide. Hope this helps.

Luiz, Pierre,
Thanks a lot fo
Luiz, Pierre,
Thanks a lot for your prompt reactions and valuable remarks. I think that now I will be able to go further with my project. Cheerio, M 
Guys,
What is great about our
Guys,
What is great about our life is that solving one problem creates at least 2 new ;). Anyway, I simply overlooked that Kmesh generates the forcing field based on the entire geometry. My idea is to generate nonzero forcing for the half of my domain only (e.g. 16 16 16) and solve the problem in a bigger domain (32 16 16). As mentioned in the first post I have got no experience with OF and rather little with C programming (especially using OF macros). Does anyone know how to fool Kmesh and consequently UOprocess to take only the half of my domain to generate forcing? Regards, Mick 
All times are GMT 4. The time now is 03:55. 