Skip to content

Field3DParallel #3149

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

Open
wants to merge 37 commits into
base: fci-auto-with-debug-higher-order
Choose a base branch
from
Open

Field3DParallel #3149

wants to merge 37 commits into from

Conversation

dschwoerer
Copy link
Contributor

This should replace #3004

dschwoerer and others added 7 commits June 26, 2025 10:53
Field3DParallel enforces that parallel derivatives can be taken.
This means for FCI, parallel fields are present.
It also ensures that if an operation is taken on such a field, the
parallel fields are retained.
This replaces part of fci-automagic, that always retained parallel
fields on operations.
dicts have been preserving order for several releases now.
Copy link
Contributor

@github-actions github-actions bot left a 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

@@ -533,4 +533,13 @@ private:
}
};

template <typename T>
auto& getStore() {
if constexpr (std::is_same<T, Field3DParallel>::value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3DParallel" is directly included [misc-include-cleaner]

include/bout/deriv_store.hxx:36:

- #include <bout/scorepwrapper.hxx>
+ #include "bout/field3d.hxx"
+ #include <bout/scorepwrapper.hxx>

@@ -533,4 +533,13 @@ private:
}
};

template <typename T>
auto& getStore() {
if constexpr (std::is_same<T, Field3DParallel>::value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::is_same" is directly included [misc-include-cleaner]

include/bout/deriv_store.hxx:34:

- #include <unordered_map>
+ #include <type_traits>
+ #include <unordered_map>

template <typename T>
auto& getStore() {
if constexpr (std::is_same<T, Field3DParallel>::value) {
return DerivativeStore<Field3D>::getInstance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3D" is directly included [misc-include-cleaner]

    return DerivativeStore<Field3D>::getInstance();
                           ^

@@ -369,6 +364,11 @@ T VDDY(const T& vel, const T& f, CELL_LOC outloc = CELL_DEFAULT,
return are_unaligned ? fromFieldAligned(result, region) : result;
}
}
inline Field3D VDDY(const Field3D& v, const Field3DParallel& f,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3DParallel" is directly included [misc-include-cleaner]

include/bout/index_derivs_interface.hxx:31:

- #include "bout/traits.hxx"
+ #include "bout/field3d.hxx"
+ #include "bout/traits.hxx"

result.setRegion(lhs.getMesh()->getCommonRegion(lhs.getRegionID(), rhs.getRegionID()));
if (lhs.isFci()) {
result.splitParallelSlices();
for (size_t i{0}; i < lhs.numberParallelSlices(); ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "size_t" is directly included [misc-include-cleaner]

src/field/generated_fieldops.cxx:7:

+ #include <cstddef>

@@ -1510,8 +1510,8 @@ Coordinates::FieldMetric Coordinates::DDY(const Field2D& f, CELL_LOC loc,
return bout::derivatives::index::DDY(f, loc, method, region) / dy;
}

Field3D Coordinates::DDY(const Field3D& f, CELL_LOC outloc, const std::string& method,
const std::string& region) const {
Field3D Coordinates::DDY(const Field3DParallel& f, CELL_LOC outloc,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3DParallel" is directly included [misc-include-cleaner]

Field3D Coordinates::DDY(const Field3DParallel& f, CELL_LOC outloc,
                               ^

@@ -70,7 +70,7 @@ Coordinates::FieldMetric DDX(const Field2D& f, CELL_LOC outloc, const std::strin

////////////// Y DERIVATIVE /////////////////

Field3D DDY(const Field3D& f, CELL_LOC outloc, const std::string& method,
Field3D DDY(const Field3DParallel& f, CELL_LOC outloc, const std::string& method,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3DParallel" is directly included [misc-include-cleaner]

Field3D DDY(const Field3DParallel& f, CELL_LOC outloc, const std::string& method,
                  ^

@ZedThree
Copy link
Member

Nice, thanks @dschwoerer! Please could you add a docstring to the class to explain the motivation for it, when it should be used and how?

I think most of the clang-tidy warnings can be fixed automatically if you run it locally

dschwoerer and others added 9 commits July 17, 2025 11:02
Otherwise, the Field3DParallel is casted to Field3D and the wrong
overloads are used
The communication was a no-op, as that did never calculate the parallel
fields.
It is needed for e.g. calculating d1_dy
They should return Field3D, not Field3DParallel
dschwoerer and others added 6 commits July 18, 2025 10:20
It seems something changed, that make hypre be less precise
Bumps [ZedThree/clang-tidy-review](https://github.com/zedthree/clang-tidy-review) from 0.20.1 to 0.21.0.
- [Release notes](https://github.com/zedthree/clang-tidy-review/releases)
- [Changelog](https://github.com/ZedThree/clang-tidy-review/blob/master/CHANGELOG.md)
- [Commits](ZedThree/clang-tidy-review@v0.20.1...v0.21.0)

---
updated-dependencies:
- dependency-name: ZedThree/clang-tidy-review
  dependency-version: 0.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bump ZedThree/clang-tidy-review from 0.20.1 to 0.21.0
Copy link
Contributor

@github-actions github-actions bot left a 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

@@ -177,6 +177,11 @@ T DDX(const T& f, CELL_LOC outloc = CELL_DEFAULT, const std::string& method = "D
AUTO_TRACE();
return standardDerivative<T, DIRECTION::X, DERIV::Standard>(f, outloc, method, region);
}
inline Field3D DDX(const Field3DParallel& f, CELL_LOC outloc = CELL_DEFAULT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Field3DParallel" is directly included [misc-include-cleaner]

include/bout/index_derivs_interface.hxx:31:

- #include "bout/traits.hxx"
+ #include "bout/field3d.hxx"
+ #include "bout/traits.hxx"

@dschwoerer
Copy link
Contributor Author

I think most of the clang-tidy warnings can be fixed automatically if you run it locally

I tried

git diff -U0 origin/fci-auto-with-debug-higher-order | \
     clang-tidy-diff.py -p1 -path build-cont-debug/ -fix -config-file .clang-tidy -j 8

but that only added one header. Do you know how to run clang-tidy on this diff?

@dschwoerer
Copy link
Contributor Author

The hypre3d test is failing with 2d metrics, as it seems it is not setting the y-boundaries in the SOL, but only in the core region.

Copy link
Contributor

@github-actions github-actions bot left a 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

BOUT_FOR(d, result.yup(i).getRegion(rgn)) {
if (result.yup(i)[d] < f) {
result.yup(i)[d] = f;
if constexpr (std::is_same_v<T, Field3DParallel>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'Field3DParallel' [clang-diagnostic-error]

}
                                    ^

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

Successfully merging this pull request may close these issues.

2 participants