|
[Sponsors] |
re-evaluate source term during each linear solver iteration |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 27, 2020, 12:35 |
re-evaluate source term during each linear solver iteration
|
#1 |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
I am trying to add a source term to the momentum equation which is depending on the velocity vector, i.e. ). Let's assume I have the momentum equation in the following form (no pressure gradient):
Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) + turbulence->divDevReff(U) ); solve(UEqn == - source.evaluate()); I want source.evaluate() to be executed for each iteration in the linear solver, i.e. if I have 5 iterations using a GaussSeidel solver, I want this function to be executed 5 times (and since U is changing during each iteration, the velocity vector dependend sourceterm should change for each iteration as well). Testing the above, it seems that source.evaluate() is only executed once at the beginning of the iteration but never called for subsequent iterations. It doesn't matter if it is directly included in the UEqn or in the solve() method. The source term is explicit and does not contribute to the coefficient matrix. Are there any suggestions how to achieve that? |
|
August 30, 2020, 13:02 |
|
#2 |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
I managed to fix my problem, in case someone stumbles upon this in the future, the trick is to add the contribution of the source (depending on the variable that is being solved for) as an implicit source term (either fvm::Sp() or fvm::SuSp). The book of Moukalled et al. (The finite volume Method in Computational Fluid Dynamics, Chapter 14.1 and 14.5.2) is particularly helpful.
|
|
August 30, 2020, 16:37 |
|
#4 |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
Yes, as explained in the opening post, the source term is depending on the variable that is being solved for (here the velocity vector U) so it needs to be added implicitly. The contribution will be added to the coefficient matrix A using fvm::Sp(). Actually the full story is a bit more complicated in my case (there are some explicit contributions as well, which are just added to the right hand side vector b) but with this change I got it to work (validated against analytic data)
__________________
cfd.university |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 11:59 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |
lid-driven cavity in matlab using BiCGStab | Don456 | Main CFD Forum | 1 | January 19, 2012 16:00 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |