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

Where to store solveScalarFields for the data transfer between timesteps?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 13, 2024, 11:23
Default Where to store solveScalarFields for the data transfer between timesteps?
  #1
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 261
Rep Power: 22
klausb will become famous soon enough
I want to use solveScalarField psi and const solveScalarField source from the two previous timesteps and use them in the current timestep in PCG.C for computations. This means I have to create four solveScalarFields in a way that they are accessible from within PCG.C . I want to use the functionality when running simpleFoam.

Where can/should I add the four solveScalarFields to store psi and source from the previous timesteps?
klausb is offline   Reply With Quote

Old   May 13, 2024, 11:55
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 736
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
My extremely limited input:

1/ how exactly do you wish to modify the CG algorithm? Does PETSc offer more flexibility to implement what you are after, i.e., implement first in PETSc and subsequently employ PETSc4Foam?

2/ how do scalarField and solveScalarField differ?

3/ CG stores a vector for conjugate search directions (typically denoted by \vec{p} as in e.g. https://en.wikipedia.org/wiki/Conjugate_gradient_method ). Can you borrow from GMRES type ideas and extend the set of work vectors?
dlahaye is offline   Reply With Quote

Old   May 13, 2024, 15:53
Default
  #3
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 261
Rep Power: 22
klausb will become famous soon enough
Quote:
Originally Posted by dlahaye View Post
My extremely limited input:

1/ how exactly do you wish to modify the CG algorithm? Does PETSc offer more flexibility to implement what you are after, i.e., implement first in PETSc and subsequently employ PETSc4Foam?

I want to implement an approach to improve the initial guess used when solving the linear system. The default is to use the result of the previous timestep. The approach requires information from at least two previous timesteps (psi and source).

2/ how do scalarField and solveScalarField differ?

I want to work with psi and source i.e. the solution and rhs vector of the linear system. These vectors are defined as solveScalarField see.: https://www.openfoam.com/documentati...8C_source.html

3/ CG stores a vector for conjugate search directions (typically denoted by \vec{p} as in e.g. https://en.wikipedia.org/wiki/Conjugate_gradient_method ). Can you borrow from GMRES type ideas and extend the set of work vectors?

It's not about reusing data within a loop e.g. related to restarting GMRES


It's really about finding a storage place to transfer, store and update information from multiple timesteps to be used and updated within PCG.C.
klausb is offline   Reply With Quote

Old   May 13, 2024, 16:30
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 736
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Not sure.

Make a child class of the currently in place symmetric matrix class, foresee two additional vector (aside from source and psi) and specialise PCG as a member function of this new class?

Note that CG converges non-linearly and that the effect of an improved initial guess might be limited.

Note that PETSc does provide tools for a deflated CG implementation. Deflation does more than merely improving the initial guess.
dlahaye is offline   Reply With Quote

Old   Yesterday, 17:48
Default
  #5
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 261
Rep Power: 22
klausb will become famous soon enough
There's only #include "lduMatrix.H"

What I need are "global" variables in the e.g. simpleFoam solver to store psi and source vectors from t-1 and t-2 timesteps for processing and update in the current timestep from within the matrix solvers e.g. PCG, GAMG...
klausb 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
Where to store data from previous timesteps for reuse? klausb OpenFOAM Programming & Development 0 June 23, 2021 18:12
Where does the branch predictor store it's prediction data? aerosayan Main CFD Forum 7 November 15, 2020 12:08
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Transfer data in MPI hall Main CFD Forum 0 May 3, 2004 18:57
Data transfer H. P. LIU Main CFD Forum 5 May 19, 2003 10:47


All times are GMT -4. The time now is 14:48.