CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Gmres

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2010, 14:52
Default Gmres
  #1
OFU
New Member
 
Jennifer
Join Date: Aug 2009
Location: Germany
Posts: 28
Rep Power: 17
OFU is on a distinguished road
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=b-Ax0 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 v1-vm 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
Attached Images
File Type: jpg Algorithmus GMRES.JPG (34.1 KB, 218 views)
OFU is offline   Reply With Quote

Old   January 12, 2010, 06:26
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Have a look at how I did it in the lduSolvers librari in 1.5-dev:

http://openfoam-extend.svn.sourcefor...79&view=markup

The two algorithms are close enough to each other to directly re-use most of the code.

Enjoy,

Hrv
mm.abdollahzadeh likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   January 4, 2013, 10:50
Default nDIrections?
  #3
New Member
 
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 13
a7ashraf is on a distinguished road
Hi all,

I am a new user to Openfoam and I am trying to run shallowWaterFoam simulations using the GMRES solver in the openfoam-1.6-ext 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
a7ashraf is offline   Reply With Quote

Old   January 4, 2013, 11:42
Default
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   January 4, 2013, 15:11
Default
  #5
New Member
 
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 13
a7ashraf is on a distinguished road
Thank you for your help.

Last edited by a7ashraf; January 7, 2013 at 20:48.
a7ashraf is offline   Reply With Quote

Old   January 7, 2013, 20:46
Default
  #6
New Member
 
Amir
Join Date: Jan 2013
Posts: 3
Rep Power: 13
a7ashraf is on a distinguished road
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
a7ashraf is offline   Reply With Quote

Old   January 8, 2013, 05:18
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Can you be much more specific in what is going wrong or where you are stuck? Do you get compilation errors?
Bernhard is offline   Reply With Quote

Old   March 10, 2013, 18:59
Default
  #8
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
Originally Posted by a7ashraf View Post
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
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.
chegdan is offline   Reply With Quote

Old   March 18, 2015, 10:12
Default
  #9
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Is anyone still interested in this?
I have ported the GMRES solver from foam-extend 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?
chriss85 is offline   Reply With Quote

Old   October 18, 2015, 11:26
Default
  #10
mgg
New Member
 
Join Date: Nov 2012
Posts: 27
Rep Power: 13
mgg is on a distinguished road
Quote:
Originally Posted by chriss85 View Post
Is anyone still interested in this?
I have ported the GMRES solver from foam-extend 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?
Hallo Chriss,

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?
mgg is offline   Reply With Quote

Old   October 19, 2015, 05:57
Default
  #11
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
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/
Attached Files
File Type: h GMRES.H (3.3 KB, 60 views)
File Type: c GMRES.C (8.1 KB, 65 views)
chriss85 is offline   Reply With Quote

Old   November 3, 2015, 09:08
Default
  #12
mgg
New Member
 
Join Date: Nov 2012
Posts: 27
Rep Power: 13
mgg is on a distinguished road
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:
Originally Posted by chriss85 View Post
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/
mgg is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 06:24
GMRES zhaohuiyong Main CFD Forum 2 June 1, 1999 14:03
Nonlinear/Linear GMRES is... Saebyuk Main CFD Forum 0 May 10, 1999 09:31


All times are GMT -4. The time now is 06:44.