-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add tool for generic operator inversion #1439
Conversation
operator This is a work in progress and relies on PETSc. It has been written according to the PETSc 3.9 api and is unlikely to work with sufficiently old versions currently. Probably easy enough to fix. The class is templated on Field type to define the problem domain.
Seems to allow localmesh to be made private
This allows setup to take any one of: * A function with signature `InvertOperator<T>::function_signature` * A struct derived from `OperatorWrapper` * A lambda matching `InvertOperator<T>::function_signature` This provides flexibility to the user -- they can pass a function if no extra data is required or a struct if further information/state is needed etc.
Provides interface to set the function
Allows the function to be made private
May want to revisit the need/location for these.
This commit should probably be reverted and a better thought out interface to extracting regions from Fields implemented instead. Also adds RGN_NOCORNERS which should be RGN_NOBNDRY plus the actual boundary cells (not the guard cells) without corner locations.
…eneric_operator_inversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all the functions that return PetscErrorCode
called by PETSc functions? If not, could they instead throw BoutException
? This would presumably need to replace CHKERRQ
Please could you add some tests? Preferably unit tests if possible, but integrated ones would be fine! |
I've added an integrated test (although this requires petsc). |
Header only class that can be used to invert arbitrary linear operators (i.e. equations of the form A.x =b). Requires PETSc.
This is adopts a fairly brute force approach which might be useful for testing/development. It may also be possible that with some appropriate tuning of PETSc settings that this could be competitive in some situations.