|
[Sponsors] |
May 3, 2022, 04:52 |
Under-relaxation: Misunderstanding or bug?
|
#1 |
New Member
Join Date: Dec 2019
Posts: 19
Rep Power: 6 |
Hello,
I am currently having troubles understanding how OpenFOAM handles under-relaxation. As I understand it, under-relaxation of fields will result in only a fraction of the newly calculated value being taken as new result, which only makes sense for a steady-state solver. Under-relaxation of equations should (at least according to https://doc.cfd.direct/notes/cfd-gen...der-relaxation) be working on the level of the linear system solver, ensuring diagonal dominance and thus I would understand that choosing a certain equation under-relaxation factor should not have an influence on the final result (and therefore make sense for use in a transient simulation). Either I misunderstand the concept up to here, or there seems to be a bug. I noticed, that choosing an equation under-relaxation factor <1 will lead to what I would expect from field under-relaxation: To reproduce this I took scalarTransportFoam (I tested it in Foundation versions OpenFOAM 6 and OpenFOAM 7) and modified the equation it solves for to the following: Code:
while (simple.correctNonOrthogonal()) { fvScalarMatrix HEqn ( fvm::ddt(H) == heatSource ); HEqn.relax(); HEqn.solve(); } I tested both PBiCGStab and smoothSolver, using different values for tolerance, with no difference in this behaviour. If someone is interested I can also make availabe the solver and a quick test case (which take about 10 seconds to compile and 10 seconds to run). Any advice is very much appreciated. |
|
May 3, 2022, 07:44 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
I suspect it's due to the way that you have defined your source term - as a scalar field instead of using the fvm::Su function. Take a look at kEpsilon.C, as an example. Maybe try rewriting the source term and let us know if that fixes the problem.
|
|
May 3, 2022, 08:31 |
|
#3 |
New Member
Join Date: Dec 2019
Posts: 19
Rep Power: 6 |
@Tobermory, thanks for the suggestion. I tried using fvm::Su(), but it did not change the outcome.
If I am correct, fvm::Su() would add the source term as implicit, while adding a volScalarField directly will have it treated as explicit, correct? |
|
May 3, 2022, 12:55 |
|
#4 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
Hmm - that's odd. If you can share your testcase, I am happy to take a look.
PS Su is the explicit term, Sp would be the implicit term. |
|
May 5, 2022, 04:52 |
|
#5 |
New Member
Join Date: Dec 2019
Posts: 19
Rep Power: 6 |
Thanks for your help. In the attached folder you can find two folders, "scalarTransportFoam" (the solver) and "energyAnalysis" (the case). Solver compilation should work fine using the Allwmake script. You may need to change the location for sourcing your openfoam installation's bashrc in the case's Allrun3D.sh script (also depending on which OpenFOAM version you want to use).
Try out different values for the relaxationFactor in fvSolution and look at the output in the log file. |
|
Tags |
openfoam 6, openfoam 7, source term, under-relaxation |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Lets talk about relaxation factor optimization | chriss85 | OpenFOAM Running, Solving & CFD | 35 | June 21, 2019 10:54 |
Long output in terminal. | ssa_cfd | OpenFOAM Running, Solving & CFD | 1 | March 18, 2019 06:25 |
About equation relaxation | chriss85 | OpenFOAM Running, Solving & CFD | 1 | May 2, 2017 20:52 |
buoyantPimpleFoam - no relaxation | Tobi | OpenFOAM Bugs | 1 | January 14, 2014 18:14 |
Relaxation and convergence | sammi | Phoenics | 0 | March 20, 2008 04:32 |