|
[Sponsors] |
July 13, 2016, 05:15 |
[Solved] Passive Scalar Source Term "Bug"
|
#1 |
Member
William Tougeron
Join Date: Jan 2011
Location: Czech Republic
Posts: 70
Rep Power: 15 |
Hi everyone,
I would like to share the solution of a problem that have stuck me for numerous days... I actually wanted to add a passive scalar to the pimpleFoam solver and to continuously inject this scalar into a cellSet, but the scalar value was stuck inside the cellSet after few iterations without logical reason. I used OpenFOAM 3.0.1. Case: I first added a very simple passive scalar transport equation (without diffusivity) into pimpleFoam. I inspired myself from this well known tutorial: http://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam Then I created a custom pimpleFoam solver in which I just copy-pasted the transport equation of the basic/scalarTransportFoam solver. Something like this (a is the scalar field): Code:
solve ( fvm::ddt(a) + fvm::div(phi, a) // - fvm::laplacian(Da, a) == fvOptions(a) ); Code:
while (pimple.loop()) Code:
scalarSemiImplicitSource { type scalarSemiImplicitSource; active true; scalarSemiImplicitSourceCoeffs { selectionMode cellSet; cellSet the_cell_set; volumeMode specific; //absolute //specific injectionRateSuSp { a (1 0); } } } Problem: But then, on a more complex case, the scalar increased as expected into the cellSet... before being stuck after few iterations. Something like this: Code:
# Probe 0 (-22.08 0 1.79212) # Probe 0 # Time 0.0001 0.0001 # Growing... 0.0002 0.000199415 # Growing... 0.0003 0.000298911 # Growing... 0.0004 0.00039848 # Growing... 0.0005 0.000498117 # Growing... 0.0006 0.000498117 # Stuck! 0.0007 0.000498117 0.0008 0.000498117 Solution: Now, here it the reason. After switching to OpenFOAM 2.4 and 4.0 (same results), after trying the same with pisoFoam (without any improvement), after trying numerous modifications in my solver and checking one hundred times the fvSolution and fvScheme files, I finally had a look at... the log file of my computation. The Initial residual for my scalar transport equation was under its tolerance, leading to a number of iterations equaling zero. This is why the scalar was stuck. Code:
DILUPBiCG: Solving for a, Initial residual = 7.45438e-06, Final residual = 7.45438e-06, No Iterations 0 Code:
a { solver PBiCG; preconditioner DILU; relTol 0.1; } aFinal { $a; tolerance 1e-5; relTol 0; } When one doesn't know where to find the error, look first around your feet before looking at the horizon... ... Hope this will help people crossing the same issue. Best regards, |
|
July 13, 2016, 09:29 |
|
#2 |
Member
Bruno Blais
Join Date: Sep 2013
Location: Canada
Posts: 64
Rep Power: 13 |
Thanks for sharing!
I had a similar problem before. I think that when debugging or looking at a very specific thing, setting all residual to drastically low value is a good habit just to make sure the issue isnt there. Then you can increase them progressively for the large simulations ! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 04:30 |
implicit - scalar product source term in momentum equation | vinch | OpenFOAM Running, Solving & CFD | 0 | October 28, 2014 15:57 |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 10:17 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 02:41 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |