Add tool for generic operator inversion#1439
Merged
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
bendudson
reviewed
Dec 11, 2018
ZedThree
reviewed
Dec 11, 2018
ZedThree
reviewed
Dec 12, 2018
Member
ZedThree
left a comment
There was a problem hiding this comment.
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
Member
|
Please could you add some tests? Preferably unit tests if possible, but integrated ones would be fine! |
Member
Author
|
I've added an integrated test (although this requires petsc). |
ZedThree
approved these changes
Dec 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.