CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   how to express a heat source term which depends on coordinate (http://www.cfd-online.com/Forums/openfoam/106223-how-express-heat-source-term-depends-coordinate.html)

bryant_k August 22, 2012 08:34

how to express a heat source term which depends on coordinate
 
Hello everyone
I am doing a heat transfer problem with source term. Source term itself depends on the x,y coordinates. The expression of the volumetric heat source is:
Code:

when -0.2<x<0.2,-0.3<y<0.3
q=20*exp(-10*y)
otherwise
q=0

should I use the functionSetFields? If I don't use the function,can you tell me how to write the code when declaring the heat soure q?

There is another question which is related to the x,y coordinate.
Is it correct to express it like:
Code:

volScalarField x = mesh.C().component(vector::X);
volScalarField y = mesh.C().component(vector::Y);

or
Code:

pos().x
pos().y

what is the difference between them?

regards!

bryant

bryant_k August 25, 2012 07:37

Can you tell me about the above things if you know about that?
Thank you very much!

regards!

bryant

wolfindark April 7, 2013 23:54

Dear bryant_k

did you find the solution? I am also working on it...
pleased if you can inform me.

ahmmedshakil April 8, 2013 02:22

@ wolfindK
you can easily use funkySetFields utility, it's easy to apply, http://openfoamwiki.net/index.php/Co...funkySetFields

chegdan April 9, 2013 15:10

@wolfindark

Have you looked at using the new fvOptions capabilities? Here I have defined a source names "energySource1" with a time duration at a single point. The injection rate coefficients are specified as pairs of Su-Sp coefficients e.g. h (10 0) where the 10 is the explicit component and 0 is the implicit component. This is a linearized source term (read Patankar's book for more details and a source of this method)

Code:

        energySource1
        {
                type            scalarSemiImplicitSource;
                active          true;
                timeStart      0.2;
                duration        2.0;
                selectionMode  points;
                points
                (
                    (2.75 0.5 0)
                );

                scalarSemiImplicitSourceCoeffs
                {
                    volumeMode      absolute;
                    injectionRateSuSp
                    {
                        h          (10 0);
                    }
                }
        }

for selectionMode you can use cellZone and then choose a cellZone where you want a heat source to be. For more information, look at the source files located at

Code:

$FOAM_SRC/fvOptions/sources/general/semiImplicitSource
good luck

wolfindark April 9, 2013 22:57

Thank you chegdan,

For my case I needed a constant heat source, therefore, I used another method which was mentioned in this forum sometime ago. I just added explicit source term to temperature equation (in TEqn.H). Then I set the field values with setFields, a spherical heat source covering a particular region in fluid region.
So it works fine until now.

I am not sure but if time dependency is needed, it can be implemented in TEqn.H, What do you think..?

chegdan April 10, 2013 09:14

Quote:

I am not sure but if time dependency is needed, it can be implemented in TEqn.H, What do you think..?
Yes, anything is possible :) but it will require programming and if are comfortable with that then that is a good option.

samiam1000 November 29, 2013 07:19

Dear All,

pardon the interruption. I have a question about fvOption and I think you can help me.

I would like to add a body force on certain cells.

I have tried to write something like

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

momentumSource
{
    type            vectorExplicitSetValue;
    active          on;            //on/off switch
    selectionMode  all;      //cellSet // points //cellZone

    vectorExplicitSetValueCoeffs
    {
        injectionRate
        {
            F    ( 0.1335 0 0 );
        }
    }
}

But I cannot und how to tell OpenFOAM that F is a force. Is that possible?

Thanks a lot,
Samuele

a19910112a December 1, 2014 16:32

Does scalarSemiImplicitSourceCoeffs{ h (10,0)} mean that the source is S=10+0*x, where S is the magnitude of the source and x is the coordinate. If that is true, then:
1.this method is applicable when the source is linearly related to the coordinate. What if it is not a linear function. Such as a cosine or experiential function?
2.Even worse, it is not even an function: it's just a matrix of random numbers.
3. what if the value is changing in both x and y direction?


All times are GMT -4. The time now is 04:59.