CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   How to implement equation of mixture fraction and variance of mixture fraction? (

Tobi April 23, 2012 04:13

How to implement equation of mixture fraction and variance of mixture fraction?
1 Attachment(s)
Hi all,

I am using OF for two years now and wanna get deeper into the code and wanna make a new solver using an old one and transform the steady equations into the time dependent equations.

Okay my problem for now is, that I am not sure if I interpret the *Eqn.H files correct. I read a few threats here in the forum which helped me a lot but now I need your help.
I added an attachment with my problem. There you can see my solving equations. I just wanna have a look at the differential equations but I think that I transformed them not right, or?

Further more I do not know what "Sp" means.

Thx in advance.

Regards Tobi

akidess April 23, 2012 08:17

fvm::Sp denotes an implicit source term. You can ignore it when translating code into equations, it's purely related to numerics.

niklas April 23, 2012 09:32

suppose you want to solve this equation

dU/dt = A + BU

implemented like
fvm:ddt(U) == A + B*U

using euler scheme,
this results in

U^n - U^{n-1} = dt*A + dt*B*U^{n-1}
U^n = dt*A + (dt*B + 1)*U_{n-1}

implemented like this
fvm::ddt(U) == A + fvm::Sp(B, U)

this results in
U^n - U^{n-1} = dt*A + dt*B*U^n
(1 - dt*B)*U^n = dt*A + U^{n-1}

so the first implementation is explicit treatment of the B*U term, while the other is implicit treatment.
Hope this makes it clearer

This also makes it possible to do some 'cheating' of large explicit source-terms by linearizing them

dU/dt = A + B*U = A*1 + B*U + A*(U/U) + B*U

which can be implemented like
fvm::ddt(U) = fvm:Sp(A/U, U) + B*U

which in turn is treated numerically like
U^{n} - U ^{n-1} = dt*(A*U^n / U^{n-1} + B*U^{n-1})
so you see now that A is no longer multiplied by 1, but by something else, which for the
converged solution hopefully is 1 and have a stabilizing effect on the solver.

Tobi April 24, 2012 04:24

3 Attachment(s)
Hi nicklas,

thanks for your good explanation!
I used your statement and generated a file (attachment). can you have a look at the file?

I am interessted in the last line I added. Thats my understanding of your post.

The second file is a transformation from openfoam equation code into scalar equation. Is that correct? Its a while ago that I used grad, div and laplacian.

thx in advance

Tobi December 1, 2015 14:23

Hi all,

I just want to comment, that the "Schemes.pdf" file is incorrect.

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