
[Sponsors] 
January 11, 2010, 14:52 
Gmres

#1 
New Member
Jennifer
Join Date: Aug 2009
Location: Germany
Posts: 28
Rep Power: 9 
Hi,
for my work I need to implement the restarted generalized minimal residual method (GMRES(m)) in OpenFOAM. As I am new to OpenFOAM I have several problems with the types of the variables and the corresponding operations I need for the GMRES. So I hope somebody can give me some help or information on how to solve the problems. Like shown in the attached picture the GMRES algorithm uses the Arnoldi process to construct an orthonormal basis Vm=[v1,…,vm]. v1 is computed by v1=r0/beta with r0=bAx0 and beta=r0. r0 as well as beta are of the type volScalarField. Now I don't know of which type the vector v must be, so that I can store the components v1vm in it. The same applies to the hessenberg matrix Hij and the vector wij. I don't know how to implement the matrix and the vector, so can anybody help me with this problem? I tried different ways of implementing these things but nothing works. Perhaps is there already something like GMRES implemented in OpenFOAM, so that I can have look at how it is implemented there? Thanks, Jennifer 

January 12, 2010, 06:26 

#2 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,783
Rep Power: 22 
Have a look at how I did it in the lduSolvers librari in 1.5dev:
http://openfoamextend.svn.sourcefor...79&view=markup The two algorithms are close enough to each other to directly reuse most of the code. Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

January 4, 2013, 10:50 
nDIrections?

#3 
New Member
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 5 
Hi all,
I am a new user to Openfoam and I am trying to run shallowWaterFoam simulations using the GMRES solver in the openfoam1.6ext package. When I changed the solver to GMRES it said that "nDirections is not defined" I added this parameter in the fvSolution file and gave it a value of 1, It started to run. I am not sure what this parameter means. Can anyone help? Thank you in advance, Amir 

January 4, 2013, 11:42 

#4 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,783
Rep Power: 22 
This is a number of search directions GMRES uses  have a look at a book that expains the algorithm. nDirections 5; is a good choice.
Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

January 4, 2013, 15:11 

#5 
New Member
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 5 
Thank you for your help.
Last edited by a7ashraf; January 7, 2013 at 20:48. 

January 7, 2013, 20:46 

#6 
New Member
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 5 
Hi all,
Does anyone have a guide on how to compile new linear solvers in openfoam 2.1.1? I am trying to compile the GMRES solver above but I cant get to work. Thanks, Amir 

January 8, 2013, 05:18 

#7 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 14 
Can you be much more specific in what is going wrong or where you are stuck? Do you get compilation errors?


March 10, 2013, 18:59 

#8 
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 581
Rep Power: 20 
Thats due to the fact that the lduSolvers library has classes which make it slightly incompatible with 2.1.x. You will have to go through the library the hjasak provided and change a few things to make the lduSolvers library work in 2.1.x and beyond.


March 18, 2015, 10:12 

#9 
Senior Member
Join Date: Oct 2013
Posts: 365
Rep Power: 6 
Is anyone still interested in this?
I have ported the GMRES solver from foamextend to OpenFOAM 2.3.x. I haven't tested it much, in my case the residuals behaved very weird, but the results were ok in the test case I used. Is this expected behavior? 

October 18, 2015, 10:26 

#10  
New Member
Join Date: Nov 2012
Posts: 27
Rep Power: 5 
Quote:
it that ported GMRES solver still available? And is that solver compatible to OF 2.4? I have great interest to test it on my application. If my target is scalability and HPC performace, can I expect that on GMRES solver instead of PCG? 

October 19, 2015, 04:57 

#11 
Senior Member
Join Date: Oct 2013
Posts: 365
Rep Power: 6 
Here it is. You can include it either directly in a solver or recompile the appropriate OpenFOAM library. I haven't tested it very much, since I didn't get better convergence in my application compared to the included linear solvers.
It should go in src/OpenFOAM/matrices/lduMatrix/solvers/GMRES/ 

November 3, 2015, 09:08 

#12  
New Member
Join Date: Nov 2012
Posts: 27
Rep Power: 5 
Hallo Chriss,
thank you very much. I will try to test it in my case. The reason I wanna use GMRES is that I am running a DNS heat transfer case using buoyantpimplefoam. For better scalability I use PCG for pressure equation. If I use perfect gas equation of state, the number of iterations using PCG solver will be around 100, which is acceptable. If I use polynom to describe the density as a function of temperature, the number of iterations will be around 4000! If I use GAMG for p equation, number of iteration will be under 5, but the scalability is poor with more than 500 cores. Do you have an opinion of that? Thank you very much. Quote:


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Control volume renumbering for GMRES  ztdep  Main CFD Forum  1  October 26, 2009 08:37 
GMRES  Mehdi  Main CFD Forum  3  December 31, 2006 12:03 
Preconditioned Gmres  carlos  Main CFD Forum  2  April 14, 2003 05:24 
GMRES  zhaohuiyong  Main CFD Forum  2  June 1, 1999 13:03 
Nonlinear/Linear GMRES is...  Saebyuk  Main CFD Forum  0  May 10, 1999 08:31 