CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Time and space varying source term (http://www.cfd-online.com/Forums/openfoam/103100-time-space-varying-source-term.html)

Rajarshi June 11, 2012 04:26

Time and space varying source term
 
I have added a heat source term in the form of a volScalarfield to the laplacianFoam solver. The internal field of the source field will have a value in a particular mesh region(s) and be 0 everywhere else. If this field does not vary with time, I'm able to set a space varying field easily using funkySetField. But I want to vary the internal field with time(for example, in the form of a step function) and preferably, read the values from a file(or maybe in the form of a function). Either way, how do I vary it with time and space? Please help.

gschaider June 11, 2012 04:43

Quote:

Originally Posted by Rajarshi (Post 365766)
I have added a heat source term in the form of a volScalarfield to the laplacianFoam solver. The internal field of the source field will have a value in a particular mesh region(s) and be 0 everywhere else. If this field does not vary with time, I'm able to set a space varying field easily using funkySetField. But I want to vary the internal field with time(for example, in the form of a step function) and preferably, read the values from a file(or maybe in the form of a function). Either way, how do I vary it with time and space? Please help.

Chances are good that you've already got the solution installed:Search the MessageBoard for "expressionSource" and you will find information about such a thing in swak4Foam. Nevertheless you'll have to modify the solver to use it

Rajarshi June 13, 2012 10:41

Thanks, expressionSource was just what I needed. I have created a heaterSourceDict and can now vary it in all possible ways.
Currently, I am working with only 1 heater zone . However, if I wanted to increase the number of heater zones and set their values independently( or maybe according to where maximum temperature is reached in the mesh) would I have to define a dictionary for each heater zone or is there another way of doing it?

gschaider June 13, 2012 17:29

Quote:

Originally Posted by Rajarshi (Post 366264)
Thanks, expressionSource was just what I needed. I have created a heaterSourceDict and can now vary it in all possible ways.
Currently, I am working with only 1 heater zone . However, if I wanted to increase the number of heater zones and set their values independently( or maybe according to where maximum temperature is reached in the mesh) would I have to define a dictionary for each heater zone or is there another way of doing it?

With one heater zone your mean that your source would for instance be

"(mag(pos()-vector(1,0,0))<0.5) ? 1 : 0"

It is quite easy to extend that to two zones

"(mag(pos()-vector(1,0,0))<0.5 || mag(pos()-vector(-1,0,0))<0.5) ? 1 : 0"

or if you want it to be a bit more 'modular' you define two variables

"src1=(mag(pos()-vector(1,0,0))<0.5) ? 1 : 0;"
"src2=(mag(pos()-vector(-1,0,0))<0.5) ? 1 : 0;"

and let the actual source term be

"src1+src2"


All times are GMT -4. The time now is 08:26.