CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Convection Term (https://www.cfd-online.com/Forums/openfoam-programming-development/118792-convection-term.html)

anton_lias June 4, 2013 10:25

Convection Term
 
1 Attachment(s)
Hello Foamers,
I have modified the solver MRFInterFoam to solve the population balance equation via the Quadratic method of Moments.
Now I would like to add the convection term (see attached file)
m is a scalarField
c1 and c2 are constants (scalars)

First I tried this Equation, but I understand, that I can't calculate "scalar - tensor".
Code:

fvScalarMatrix mEqn
(
    U & fvc::grad(m)
    - fvc::grad(c1 * fvc::grad(m1)
    +c2
);

So I tried this Equation (found in a paper) and add c2 later on.
Code:

fvScalarMatrix mEqn
(
        fvm::div(phi, m)
        - fvm::laplacian(c1, m)
);

Does this Equation computes the Equation given in the attachment?

Thanks for your help.

thomasArk47 June 5, 2013 18:49

Hi,

yes it is better. Don't forget to add the temporal derivative and the source term. Look at applications/solvers/basic/scalarTransportFoam.

anton_lias June 6, 2013 10:05

Thank you Thomas.

Do you mean something like that?
Code:

solve
    (
        fvm::ddt(m)
        + fvm::div(phi, m)
        - fvm::laplacian(c1, m)
        +c2
    );


thomasArk47 June 6, 2013 16:52

Ok for the time derivative.

For the source term, it is not good. Ok, I assume your "c2" is a fixed variable. This way, you have 2 possibility:

1- use
solve
(
fvm::ddt(m)
+ fvm::div(phi, m)
- fvm::laplacian(c1, m)
==
fvm::Su(c2f,m)
);
...where c2f can be declared after the m variable as follows:
DimensionedField<scalar,volMesh> c2f
(
IOobject
(
"c2f",
m.time().timeName(),
m.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
m.mesh(),
dimensionedScalar("c2f",m.dimensions()/dimTime,c2)
);

2- cleaner approach by using the fvOptions framework. Needs to write:
solve
(
fvm::ddt(m)
+ fvm::div(phi, m)
- fvm::laplacian(c1, m)
==
fvOptions(m)
);
In this approach, you need to define in the right way the fvOptions file located in the system file. Look at the tutorials to find the syntax you need.

N.B : if c2 is not a fixed variable, the first approach is probably the simpler for first try (you could use the second one in combinaison of the codedFunctionObject)

anton_lias June 18, 2013 08:02

Thank you thomas its working

sharonyue August 17, 2017 13:40

Hello Lias,

I am working on the Quadratic method of Moments. AFAIK, VOF (interFoam) solve the dispersed phase directly, you dont need the QMOM to track the dispersed phase. Or are you coupling other variables?


All times are GMT -4. The time now is 14:28.