Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to scale the linear system Ax = b? #91

Open
klausbu opened this issue Sep 21, 2021 · 1 comment
Open

How to scale the linear system Ax = b? #91

klausbu opened this issue Sep 21, 2021 · 1 comment

Comments

@klausbu
Copy link

klausbu commented Sep 21, 2021

Hello,

I am working on a stronger preconditioner for symmetric matrices which requires scaling of the linear system Ax = b as follows:

A' = D^-1/2 A D^-1/2

x' = D^1/2 x

b' = D^-1/2 b

Where A'x' = b' is the scaled linear system and D is the Diagonal as defined in the OpenFOAM standard LDU matrix storage format.

Are you aware of functors/transformations I could reuse, implemented in other parts of RapidCFD?

Klaus

@daniel-jasinski
Copy link
Contributor

Hi,

You can take a look at the AINVPreconditioner.
Instead of using the divideOperatorSFFunctor<scalar,scalar,scalar>(1.0), apply sqrtUnaryFunctionFunctor<scalar,scalar>().

You can then use the computed scaling field and use it in the actual preconditioner kernel.

The AINV implementation is a bit more complicated than it could be, because of some optimization tricks.
Just to make your implementation working, you can remove half of the branches in preconditionImpl by assuming that fastPath is always false.

Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants