-
Notifications
You must be signed in to change notification settings - Fork 90
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
Staggered grids in InvertPar #2087
Conversation
Previously was 'Create(Mesh*)' which was inconsistent with our case-convention and missing Options* and CELL_LOC arguments.
I keep forgetting - do we have a list of breaking changes that I should add |
The fedora test is failing :-( I don't have a fedora system to test on. Could someone please check the latest |
I just merged a couple of PRs, I guess we'll see if the problem is also in CHANGELOG.md has a |
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.
Looks good, thanks @ZedThree!
return source | ||
return re.sub( | ||
r"({factory_name})\s*::\s*{old_create_method}\b".format(**factory), | ||
r"\1::{create_method}".format(**factory), |
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.
Can we check that there's no argument to the Create
method? The old version could take a Mesh*
argument, which I'd be surprised if anyone was using, but if they were it'd be an error to pass as the first argument to the new create
(which is an Options*
). Don't think it's worth bothering to fix if there was an argument, but raising an error or a warning might be nice?
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.
Done. It's a bit dumb, in that it always warns if a factory where the arguments have changed is used. Hopefully the documentation is sufficiently useful for users to know what to do, otherwise we'll have to rely on the compiler. For me, using gcc 10.2, I get the following error (with nice colours too):
../tests/integrated/test-invpar/test_invpar.cxx: In function ‘int main(int, char**)’:
../tests/integrated/test-invpar/test_invpar.cxx:33:32: error: cannot convert ‘Mesh*’ to ‘Options*’
33 | auto inv = InvertPar::create(mesh);
| ^~~~
| |
| Mesh*
In file included from ../tests/integrated/test-invpar/test_invpar.cxx:8:
../include/invert_parderiv.hxx:104:53: note: initializing argument 1 of ‘static std::unique_ptr<InvertPar> InvertPar::create(Options*, CELL_LOC, Mesh*)’
104 | static std::unique_ptr<InvertPar> create(Options *opt_in = nullptr,
| ~~~~~~~~~^~~~~~~~~~~~~~~~
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.
looks good to me, thanks @ZedThree!
Default arguments mean it may only have a single argument
Allows
InvertPar
to work on staggered grids.CELL_YLOW
version requires changes to the boundary conditions. The Neumann boundary conditions have to be put in with one-sided differences, which (because the matrix inInvertParCR
is tri-diagonal) are only first-order accurate. As long asInvertPar
is only being used for preconditioners, hopefully this should not be a problem.Also addresses a comment above the
InvertPar::Create()
method that it should be calledcreate
and takeOptions*
(and nowCELL_LOC
) arguments.Adds tests both for staggered grids and on open field lines (which were not previously tested).
InvertPar::create()
supported inbin/bout-b5-factory-upgrader.py