-
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
Refactor coordinates #2873
base: next
Are you sure you want to change the base?
Refactor coordinates #2873
Conversation
Thanks @tomc271 ! This is quite an epic amount of work. |
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.
Thanks @tomc271! I've made a bunch of comments on things to work through. A couple of big things though:
- this has diverged from
next
a bit, so that will need merging in and conflicts resolving. There's been some important bug fixes and CI changes innext
that would be good to get in ASAP - some of the changes haven't propagated through to some subsystems, such as the various PETSc laplace operators. You will need to either build against PETSc locally to find them, or use some searching to find the remaining places
…t be marked explicit to avoid unintentional implicit conversions.
…FakeMesh has no 'source', which causes a crash when the constructor leads to initialisation of FieldMetric objects).
…void unintentional implicit conversions.
…ntMetricTensor in Coordinates::setBoundaryCells method, to avoid recalculation of the christoffel symbols, which would (at this stage) involve field data at different locations (specifically the metric tensor and jacobian).
…constructor that is used with FakeMesh.
Location will already be set from initialising using `emptyFrom`
f970905
to
47cff9e
Compare
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.
clang-tidy made some suggestions
} | ||
} | ||
// Utility function for fixing up guard cells of zShift | ||
void Coordinates::fixZShiftGuards(Field2D& zShift) const { |
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.
warning: method 'fixZShiftGuards' can be made static [readability-convert-member-functions-to-static]
include/bout/coordinates.hxx:479:
- void fixZShiftGuards(Field2D& zShift) const;
+ static void fixZShiftGuards(Field2D& zShift) ;
void Coordinates::fixZShiftGuards(Field2D& zShift) const { | |
void Coordinates::fixZShiftGuards(Field2D& zShift) { |
*coords_map[location] = std::move(new_coordinates); | ||
|
||
auto recalculate_staggered = false; | ||
new_coordinates.recalculateAndReset(recalculate_staggered, |
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.
warning: 'new_coordinates' used after it was moved [bugprone-use-after-move]
new_coordinates.recalculateAndReset(recalculate_staggered,
^
Additional context
src/mesh/mesh.cxx:790: move occurred here
*coords_map[location] = std::move(new_coordinates);
^
double yn = (double(y) + 0.5) / double(mesh->yend + 1); | ||
{ | ||
auto dy = emptyFrom(coord->dx()); | ||
auto J = emptyFrom(coord->J()); |
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.
warning: variable name 'J' is too short, expected at least 3 characters [readability-identifier-length]
auto J = emptyFrom(coord->J());
^
otherwise when Coordinates setters call mesh->communicate() and that calls calcParallelSlices() and that calls getCoordinates() the coordinates field will be a null pointer.
…nd MetricTensor inverse() method Add method Coordinates::communicateMetricTensor() and call after constructing Coordinates to avoid circular dependency (between Mesh and Coordinates) as a result of the setter methods calling communicate()
to prevent getUniform(coords->zlength()) failing because the field is not const.
Update existing dy and J fields, to avoid invalid values in the guard cells.
…icate Fixes to address failing tests after changes to refactor-coordinates
…-coordinates-with-next-merged-in
…erivatives::index::DDY() as the former checks canToFromFieldAligned().
This reverts commit e5010e4. Fix for failing fci tests.
Encapsulate all private members of Coordinates class.
New classes for metric tensor, Christoffel symbols.