|
[Sponsors] |
How to add a passive scalar to the simpleFoam solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 13, 2014, 17:18 |
How to add a passive scalar to the simpleFoam solver
|
#1 |
Member
Join Date: Feb 2014
Posts: 63
Rep Power: 12 |
Hi all,
I am new to OpenFOAM software. I ran a simulation of a Jet in a crossflow simulation using simpleFoam. I need to add a passive scalar transportation equation to the simpleFoam solver. I went through the following example. http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam But my problem of including passive scalar transportation equation with a turbulent Schmidt number is slightly different from this example. So, How do I add a passive scalar transport equation to the simpleFoam solver? Appreciate any guidance on this issue. Thank you. |
|
February 20, 2015, 13:50 |
For anyone searching for the solution for this problem.
|
#2 |
Member
Join Date: Feb 2014
Posts: 63
Rep Power: 12 |
For anyone who is trying to solve a problem like this i am posting the method i followed.
create a TEqn as of other UEqn and PEqn for the passive scalar. Code:
{ volScalarField kappaEff ( "kappaEff", (turbulence->nut()/Prt) +(turbulence->nu()/Pr) ); fvScalarMatrix TEqn ( fvm::div(phi, T) - fvm::laplacian(kappaEff, T) ); TEqn.relax(); TEqn.solve(); } Code:
Info<< "Reading field T\n" <<endl; volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Then include the TEqn into simpleFoam.C after turbulence correction. Code:
turbulence->correct(); #include "TEqn.H" Code:
singlePhaseTransportModel laminarTransport(U, phi); dimensionedScalar Pr(laminarTransport.lookup("Pr")); dimensionedScalar Prt(laminarTransport.lookup("Prt")); This example was also useful. https://openfoamwiki.net/index.php/H...ure_to_icoFoam |
|
June 21, 2017, 22:04 |
Solution diverging
|
#3 |
Member
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14 |
Hi all,
I followed the procedure as posted by Uyan and found that the scalar transport solution diverging. But the scalar is transported throughout the region as expected. What could be the cause of divergence? It does not make sense to me since the solution looks acceptable, it is the divergence bothering me Below is the output from OF, fvSchemes, fvSolution and U BC. Attached are the solver and case files. All comments and suggestions are welcome output Code:
Time = 101 smoothSolver: Solving for Ux, Initial residual = 0.00120042, Final residual = 3.7046e-06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.00120393, Final residual = 3.70971e-06, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 0.000836939, Final residual = 2.79653e-06, No Iterations 4 GAMG: Solving for p, Initial residual = 4.31652e-05, Final residual = 8.86733e-07, No Iterations 9 time step continuity errors : sum local = 3.83691e-06, global = 4.17804e-07, cumulative = 0.00012566 GAMG: Solving for CF, Initial residual = 0.685496, Final residual = 0.513947, No Iterations 1000 ExecutionTime = 211.28 s ClockTime = 212 s From function virtual bool Foam::regIOobject::readIfModified() in file db/regIOobject/regIOobjectRead.C at line 291 Re-reading object controlDict from file "/home/ipalab/OpenFOAM/ipalab-4.1/simplefoamexample/system/controlDict" Time = 102 smoothSolver: Solving for Ux, Initial residual = 0.00118109, Final residual = 3.65892e-06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.001184, Final residual = 3.66113e-06, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 0.000818525, Final residual = 2.73043e-06, No Iterations 4 GAMG: Solving for p, Initial residual = 4.16364e-05, Final residual = 8.8246e-07, No Iterations 9 time step continuity errors : sum local = 3.81498e-06, global = 4.26037e-07, cumulative = 0.000126086 GAMG: Solving for CF, Initial residual = 0.684755, Final residual = 0.514736, No Iterations 1000 ExecutionTime = 214.31 s ClockTime = 215 s Code:
ddtSchemes { default steadyState; } gradSchemes { default Gauss linear; } divSchemes { default none; div(phi,U) bounded Gauss linearUpwind grad(U); div(phi,nuTilda) bounded Gauss linearUpwind grad(nuTilda); div((nuEff*dev2(T(grad(U))))) Gauss linear; div(phi,CF) bounded Gauss linearUpwind grad(CF); } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } wallDist { method meshWave; } Code:
solvers { p { solver GAMG; tolerance 1e-06; relTol 0.01; smoother GaussSeidel; } CF { solver GAMG; tolerance 1e-06; relTol 0.01; smoother GaussSeidel; }; U { solver smoothSolver; smoother GaussSeidel; nSweeps 2; tolerance 1e-08; relTol 0.01; } nuTilda { solver smoothSolver; smoother GaussSeidel; nSweeps 2; tolerance 1e-08; relTol 0.01; } } SIMPLE { nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; residualControl { p 1e-5; U 1e-5; nuTilda 1e-5; CF 1e-5; } } relaxationFactors { fields { p 0.3; CF 0.3; } equations { U 0.7; nuTilda 0.7; } } Code:
dimensions [0 1 -1 0 0 0 0]; internalField uniform (0.0 0.0 0.1); boundaryField { inlet { type fixedValue; value uniform (0.0 0.0 0.1); } outlet { type zeroGradient; } xWalls { type noSlip; } yWalls { type noSlip; } |
|
June 22, 2017, 11:37 |
|
#4 |
Senior Member
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19 |
Does your solution diverge using the original application, i.e. without transport of the passive scalar? This is the first thing I would check.
|
|
June 22, 2017, 13:32 |
|
#5 |
Member
Join Date: Feb 2014
Posts: 63
Rep Power: 12 |
Sugajen,
I think, how do you calculate diffusion term coefficient DS is the problem here. Change the DS value and see how it affects the solver performance then you'll see it depends on DS value. But why do you use a user defined diffusion coefficient in the first place? If you look at my post #2,you'll see i have used the diffusion coefficient as a function of eddy viscosity. |
|
June 22, 2017, 15:58 |
|
#6 |
Member
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14 |
@Uyan I have constant diffusion coefficient. That is why making it user defined. But why would that matter?
@tas38 That's a good point. It does converge with simpleFoam |
|
June 22, 2017, 18:36 |
|
#7 |
Member
Join Date: Feb 2014
Posts: 63
Rep Power: 12 |
Sugen,
In my case i did not relax scalar equation , i simply solved the pressure velocity loop and then using that velocity i solved the scalar. Even if i had used TEqn.relax() in the above code, i have not under relaxed the field. So it was a redundant statement. Try without under relaxing. No need to under-relax a passive scalar. |
|
Tags |
passive scalar, schmidt, simplefoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
passive scalar with simpleFoam | Uyan | OpenFOAM Programming & Development | 2 | March 1, 2016 11:07 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
Climbing inlet pressure with simpleFoam and directMappedPatches | chegdan | OpenFOAM Running, Solving & CFD | 1 | January 2, 2012 20:35 |