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

How to implement a Jacobian-Free Newton-Krylov (JFNK) method

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2023, 12:05
Question How to implement a Jacobian-Free Newton-Krylov (JFNK) method
  #1
New Member
 
Join Date: Apr 2023
Posts: 1
Rep Power: 0
Murielle MG is on a distinguished road
Dear Foamers,

I am seeking your guidance and assistance in the implementation of JFNK (Jacobian-Free Newton-Krylov) methods based on the Gmres solver in foam-extend-4.1 for my current project.

To provide some context, I am working on an open-source software based on Foam Extend. In order to enhance the accuracy and efficiency of simulations, the JFNK method has been identified as a potential solution to achieve these objectives.

However, my limited familiarity with OpenFOAM, Foam Extend, and C++ is posing challenges in effectively implementing this method. Therefore, I kindly request your help on the following aspects:

1. How to modify the existing Foam Extend (GMRES) codebase to effectively incorporate the JFNK method.

For this first point, I have made a copy of the GMRES solver files within a "libraries" folder in my application in order to make changes to the GMRES solver as it seems difficult to built a general Gmres JFNK solver.
In the existing code (BlockGMRES and gmresSolver files), what I identified in the existing code (present in the BlockGMRES and gmresSolver files) is that the matrix.Amul command should be replaced by the finite difference of the numericals fluxes for the JFNK method as shown in the file attached. The numerical flux phi (u^k) refers to argument b of the GMRES method.
My difficulty lies therefore in constructing the second numerical flux phi (u^k+epsilon*z) as it is expected to change in every iteration.

I therefore tried to obtain in this solver the variables allowing the construction of the numerical flux such as: rho, rhoU, rhoE (to built it directly in the solver) by using the following command :
Code:
const volScalarField& rho = this->Mesh_.lookupObject<volScalarField>("rho");
but this command doesn't work.

The first error is :
Code:
error: 'class Foam::BlockGMRES<Foam::Tensor<double> >' has no member named 'Mesh_'
Which brings me to the second point.

2. How to obtain from this solver, the values of the variables present on the mesh. (If I am on the right path to mplement the JFNK in the GMRES solver)

I sincerely appreciate any support or guidance you can provide regarding these challenges.

Thank you in advance for your assistance.
Attached Images
File Type: jpg Algorithmus GMRES.JPG (34.1 KB, 12 views)
File Type: png Algorithmus GMRES-JFNK.png (51.4 KB, 12 views)
Attached Files
File Type: pdf Jacobian_Free_Newton_Krylov_method_for_solving_sparse_linear_systems.pdf (143.2 KB, 17 views)

Last edited by Murielle MG; July 17, 2023 at 06:19. Reason: Addition of pictures for the GMRES and GMRES with JFNK algorithms
Murielle MG is offline   Reply With Quote

Reply

Tags
foam extend 4.1, gmres, jacobian matrix, solver development


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
free package for the "direct method" ztdep Main CFD Forum 0 May 31, 2006 12:55
about the numerical method for the free surface ztdep Main CFD Forum 5 May 1, 2006 17:09
free surface potential method paolo Main CFD Forum 0 September 19, 2004 14:29
seeking free 3D panel method code frederic felten Main CFD Forum 2 January 24, 2001 05:42
Numerical method for free surface flow? Oleg Melnik Main CFD Forum 4 January 22, 1999 06:28


All times are GMT -4. The time now is 11:15.