# How to implement equation of mixture fraction and variance of mixture fraction?

 Register Blogs Members List Search Today's Posts Mark Forums Read

April 23, 2012, 05:13
How to implement equation of mixture fraction and variance of mixture fraction?
#1
Super Moderator

Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,680
Blog Entries: 6
Rep Power: 49
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.

Regards Tobi
Attached Files
 mixtureFraction.pdf (90.9 KB, 139 views)

 April 23, 2012, 09:17 #2 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,377 Rep Power: 28 fvm::Sp denotes an implicit source term. You can ignore it when translating code into equations, it's purely related to numerics. __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 April 23, 2012, 10:32 #3 Super Moderator     Niklas Nordin Join Date: Mar 2009 Location: Stockholm, Sweden Posts: 694 Rep Power: 28 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 again... 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. sylvester and Tobi like this.

April 24, 2012, 05:24
#4
Super Moderator

Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,680
Blog Entries: 6
Rep Power: 49
Hi nicklas,

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.

tobi
Attached Files
 schemes.pdf (85.5 KB, 86 views) Niklas2.pdf (79.4 KB, 65 views) Niklas1.pdf (96.1 KB, 60 views)

 December 1, 2015, 14:23 #5 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,680 Blog Entries: 6 Rep Power: 49 Hi all, I just want to comment, that the "Schemes.pdf" file is incorrect. __________________ Keep foaming, Tobias Holzmann

 December 19, 2019, 00:55 fvc and Sp #6 New Member   Deepak J Join Date: Jun 2019 Location: India Posts: 5 Rep Power: 5 Sorry for bumping into this old thread. I am a beginner in CFD and OpenFoam and i am trying to implement mixture fraction and mixture fraction variance equations. Can anyone help me understand why we need fvc apart from the fact that it is an explicit equation? I have seen that for calculating gradient or with source terms (Sp), it is always accompanied with fvc. Why is it so? Also what is happening when the Sp term is introduced. Thanks in advance Last edited by dj18deepak; December 19, 2019 at 10:28.

 December 26, 2019, 06:41 #7 New Member   Deepak J Join Date: Jun 2019 Location: India Posts: 5 Rep Power: 5 Hi all, I am trying to implement mixture fraction and mixture fraction variance conserved transport equations to simulate a simple propane non reacting jet flame. The simulation is well and running with slight amount of deviations from experimental data while using small value of grading in the x and y directions (8 and 8 resp). The problem i am facing is that with higher values of grading (12 in x-direction and 15 in y-direction), even though the velocity, temperature and all profiles are evolving, the mixture fraction and mixture fraction variance variables are having very low values of the order of 10^-70 (for mixture fraction). What might be the possible causes of the error. Kindly help me. I am a beginner. Code fvScalarMatrix mifEqn ( fvm::ddt(rho, mif) + fvm::div(phi, mif) - fvm::laplacian(turbulence->mut()/0.7, mif) ); mifEqn.relax(); mifEqn.solve(); fvScalarMatrix mifvarEqn ( fvm::ddt(rho, mifvar) + fvm::div(phi, mifvar) - fvm::laplacian(turbulence->mut()/0.7, mifvar) - 2.86*turbulence->mut()*magSqr(fvc::grad(mif)) + 2*rho*(turbulence->epsilon()/(turbulence->k()+k_small))*mifvar ); mifvarEqn.relax(); mifvarEqn.solve(mesh.solver("mifvar")); fvSchemes dictionary ddtSchemes { default Euler; } gradSchemes { default cellLimited Gauss linear 1; } divSchemes { default none; div(phi,U) Gauss limitedLinearV 1; div(phiU,p) Gauss limitedLinear 1; div(phi,epsilon) Gauss limitedLinear 1; div(phi,K) Gauss limitedLinear 1; div(phi,k) Gauss limitedLinear 1; div(phi,H) Gauss limitedLinear 1; div(phi,Yi_h) Gauss limitedLinear 1; div(phi,mif) Gauss limitedLinear 1; div(phi,mifvar) Gauss limitedLinear 1; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } fluxRequired { p; } fvSolution dictionary solvers { "rho.*" { solver diagonal; } p { solver PCG; preconditioner DIC; tolerance 1e-6; relTol 0.1; } pFinal { \$p; tolerance 1e-6; relTol 0.1; } "(U|h|k|epsilon)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-6; relTol 0.1; } "(U|h|k|epsilon|mif)Final" { \$U; relTol 0.1; } "(mif|mifvar)" { solver PBiCG; preconditioner DILU; tolerance 1e-07; relTol 0.; } Yi { \$hFinal; } } relaxationFactors { fields { p 0.4; rho 0.5; } equations { U 0.4; k 0.5; epsilon 0.5; //H 0.5; mif 0.5; mifvar 0.2; } } PIMPLE { momentumPredictor no; nOuterCorrectors 1; nCorrectors 2; nNonOrthogonalCorrectors 0; } Kindly note: mif is mixture fraction and mifvar is mixture fraction variance Thanks and regards Deepak J

 December 26, 2019, 10:01 #8 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,680 Blog Entries: 6 Rep Power: 49 Hi, check out my repository of the flamelet model. There you see how it has to be implemented. __________________ Keep foaming, Tobias Holzmann

 December 26, 2019, 10:47 #9 New Member   Deepak J Join Date: Jun 2019 Location: India Posts: 5 Rep Power: 5 Hi Tobi, Thanks for the reply. Will definitely check the same. Thanks and regards Deepak