
[Sponsors] 
Difference between "fields" and "equations" relaxation subdirectories in fvSolution 

LinkBack  Thread Tools  Search this Thread  Display Modes 
November 28, 2017, 11:05 
Difference between "fields" and "equations" relaxation subdirectories in fvSolution

#1  
Senior Member
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 6 
Hello Foamers,
I was trying to solve a simple problem with porousSimpleFoam and I was getting a time step continuity error. I got rid of this by making a change to fvSolutions file as shown below. Commented line was the earlier version. Code:
relaxationFactors { fields { p 0.3; U 0.7; } equations { // U 0.7; k 0.9; epsilon 0.9; } } Quote:


January 15, 2018, 05:46 

#2 
Senior Member
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 6 
Anyone ? Please.


January 16, 2018, 05:53 

#3 
Senior Member

Hi,
It depends on the solver. Sometimes the equations are relaxed, sometimes the fields. For simpleFoam U is relaxed on the equation, p on the field. For safety you can include a Code:
default 0 Example: Code:
relaxationFactors { fields { default 0; p 0.3; // U 0.7; } equations { default 0; U 0.7; k 0.9; epsilon 0.9; } } 

January 16, 2018, 05:58 

#4 
Senior Member
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 6 
Thanks. I'll keep it in mind.


September 9, 2020, 13:53 

#5  
New Member
Ilteber Ozdemir
Join Date: Dec 2019
Posts: 2
Rep Power: 0 
Quote:
As to your question on which one to use where, you should check the source code of the solver to see which variable is relaxed in which way. I'd suggest you to check the following files to understand the working of field and equation relaxation: Code:
OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C finiteVolume/fvMatrices/fvMatrix/fvMatrix.C Code:
cd $FOAM_SRC grep r "relax" Additionally there is a beautiful video of Dr. Aidan Wimshurst on YouTube where he mentiones these two types of relaxation: HTML Code:
https://youtu.be/ahdW5TKacok?t=1594 Cheers, 

September 10, 2020, 09:27 

#6 
Super Moderator

Well explained, totally agree and I want to give a few more informations regarding this particular topic:
Field relaxation:
Here alpha is the relaxation factor. If it is 1, the new value corresponds to the new calculated one. If it is zero, it will not change. n is the iteration counter as we can iterate over one variable more often. Matrix Relaxation The matrix relaxation is, as Rilteber already mentioned, completely different. What we do is actually very simple. Simply spoken: We divide the main diagonal by the relaxation factor. As this factor is commonly smaller than one, we increase the main diagonal numbers such as: Code:
1 / 0.8 > 1.25 However, it can happen that the value of the sum of the offdiagonal elements is larger compared to the value of the main diagonal element (commonly for shockwaves etc.), hence, for stabilizing the linear solvers and to get to the needed requirements for linear solver, we have to make the matrix at least diagonal dominant. Now you can imagine that the worst diagonaldominant matrix is defined to be as follows:
The linear solvers work much better if we do have a diagonaldominant matrix. By the way, e.g., for the pressure field we commonly do have a field relaxation. However, if you switch on the transonic option, you can see in the pEqn.H of pimpleFoam for example, that the pressure equation can be relaxed in addition. So far so good. However, this is not the full story. Just imagine that you have the equation: And you add something to the RHS, you also do have to make it equally on the LHS to get the correct solution: Hence, as we change the diagonal elements of the matrix, we have to incorporate this change to the RHS (the solution vector b) too. This leads in fact to an increase of the explicit part in b which  could lead  to more outer iterations as we have to converge the explicit part too. Therefore, matrix relaxation is primarily used to support our linear solver but will make the equation more explicit. So it is a con and pro topic. However, better to have more explicit part and one has to make 4 more outer loops than ignoring the criterion for the linear solvers and the solution will just crash all the time **** The above given information is not the complete story but it is a good summary **** More information can be found in the source code primarly in the fvMatrix class.
__________________
Keep foaming, Tobias Holzmann 

May 30, 2021, 10:57 

#7  
Member
Lourenço SM
Join Date: Jul 2014
Location: Lisboa, Portugal
Posts: 33
Rep Power: 9 
Quote:
Quote:
Thank you 

Thread Tools  Search this Thread 
Display Modes  

