CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to use fvOption to define a constant source term? (https://www.cfd-online.com/Forums/openfoam/196292-how-use-fvoption-define-constant-source-term.html)

fabrice November 30, 2017 12:50

How to use fvOption to define a constant source term?
 
Hi Foamers,
I am trying to define a constant source term with the solver pimpleFoam and I use channel395 case to test.
I modified the solver of pimpleFoam and add concentration equation to it:
fvScalarMatrix CEqn
(
fvm::ddt(C)+fvm::div(phi,C)+ fvm::laplacian(turbulence->nu()/Sc,C)
);
CEqn.solve();
then I want to define a constant source for concentration equation in certain area. How can I do this?
1,I try to use setFields but it only works on initial field
2,I found it can set in fvOption files
momentumSource
{
type meanVelocityForce;
active yes;

meanVelocityForceCoeffs
{
selectionMode all;

fields (U);
Ubar (0.1335 0 0);
relaxation 1.0;
}
}

In my case, I think openFoam dose not have concentration equation, what should I do, can you please give me some suggestions?

Alasir November 30, 2017 17:16

The meanVelocityForce in fvOptions seem to be quite videly used for these kinds of things. It will be applied for all timesteps.

Do you get any errors by simply trying to run it?

student666 December 1, 2017 00:20

Hi,

I successfully applied this source term for velocity field, maybe you can use as well.
Code:

velocitySource
{
    type            vectorFixedValueConstraint;
    active          true;


    vectorFixedValueConstraintCoeffs
    {

        selectionMode  cellZone;
        cellZone        heater;
        volumeMode absolute;
        fieldValues
        {
            U          (0 1 0);
        }
    }
}

you can have a quite complete overview of fvOptions at
http://www.geocities.jp/penguinitis2...fvOptions.html

(just use google translate)

Regards

RobertHB December 1, 2017 09:06

Great link! Thank you sooo much!

fabrice December 1, 2017 10:22

Quote:

Originally Posted by Alasir (Post 673484)
The meanVelocityForce in fvOptions seem to be quite videly used for these kinds of things. It will be applied for all timesteps.

Do you get any errors by simply trying to run it?

Hi Alasir,
Sorry for my bad explanation, I mean people can use this method to define a source in momentum equation but in my case how can I add a constant source to concentration equation.

fabrice December 1, 2017 10:33

Quote:

Originally Posted by student666 (Post 673525)
Hi,

I successfully applied this source term for velocity field, maybe you can use as well.
Code:

velocitySource
{
    type            vectorFixedValueConstraint;
    active          true;


    vectorFixedValueConstraintCoeffs
    {

        selectionMode  cellZone;
        cellZone        heater;
        volumeMode absolute;
        fieldValues
        {
            U          (0 1 0);
        }
    }
}

you can have a quite complete overview of fvOptions at
http://www.geocities.jp/penguinitis2...fvOptions.html

(just use google translate)

Regards

Thanks a lot for your link I will read it. By the way, in my case I add concentration equation myself as far as I know openfoam only have utility for
momentum or energy source. Should I define it myself in solver every time step?

student666 December 2, 2017 03:29

Hi,

sorry, I thought you needed a velocity field source term.
Are you meaning you have to add a constant scalar source for a species?

If that's the case,
https://www.researchgate.net/publica...ers%27_version

has some more tutorials.

If you give more informations about your needs and what you're doing, others on this forum could be of much more help.

Regards

fabrice December 2, 2017 07:49

Quote:

Originally Posted by student666 (Post 673644)
Hi,

sorry, I thought you needed a velocity field source term.
Are you meaning you have to add a constant scalar source for a species?

If that's the case,
https://www.researchgate.net/publica...ers%27_version

has some more tutorials.

If you give more informations about your needs and what you're doing, others on this forum could be of much more help.

Regards

M.C
Thank you for help. What I am doing now is add convection diffusion equation to the solver 'pimpleFoam'. I want to simulate a constant pollutant source dispersion, for instance, in a channel. I do not know what's the proper way to define the source in some certain of the area.

fidu November 5, 2020 14:34

Source therm for TKE and TDR for a porous material
 
Hi,
I would like to implement some additional source code for my porous media. I have already applied the Darcy-Frochheimer source term with fvOptions and explicitpourouszone for the momentum therm. Now I would like to implement the turbulent kinetic energy (TKE) and the turbulent dissipation rate (TDR) source term of my porous material. Both terms are dependent on the magnitude of the flow, epsilon, k and some constants. Could you recommend me a strategy how to implement this or are there source terms which I could easily modify?

My source terms are:

s_{TKE} = \rho * c_d a (\beta_p|\overline{u}|^3 - \beta_d |\overline{u}|k)
s_{TDR} = \rho c_d a (\beta_p C_4\epsilon |\overline{u}|^3 \frac{\epsilon}{k} - \beta_d C_5\epsilon |\overline{u}\epsilon))


Sorry if this is stupid question but I quite new to all of this and would greatly appreciate all recommendation or hints :D

Best
fidu


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