Skip to content

Changes for FCI with hermes-3 #3079

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

Draft
wants to merge 276 commits into
base: next
Choose a base branch
from
Draft

Conversation

dschwoerer
Copy link
Contributor

Opened a PR to get the documentation build.

The PR needs likely be split up, in e.g. #2651 #2887 #3004 and once they are merged likely more ...

dschwoerer and others added 30 commits February 4, 2024 20:27
mesh may not be initialised or be a different mesh
Use the new track feature (better name required) to dump the different
components of the ddt() as well as the residuum for the evolved fields.
This keeps track of all the changes done to the field and stores them to
a OptionsObject.
This keeps track of all the changes done to the field and stores them to
a OptionsObject.
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

There were too many comments to post at once. Showing the first 25 out of 381. Check the log or trigger a new build to see more.

@@ -138,7 +138,7 @@ typedef struct bandmat_type {
* *
******************************************************************/

#define PVODE_BAND_ELEM(A,i,j) ((A->data)[j][i-j+(A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function-like macro 'PVODE_BAND_ELEM' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]

#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
        ^

@@ -138,7 +138,7 @@
* *
******************************************************************/

#define PVODE_BAND_ELEM(A,i,j) ((A->data)[j][i-j+(A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
#define PVODE_BAND_ELEM(A, i, j) (((A)->data)[j][i - j + (A->smu)])

@@ -138,7 +138,7 @@
* *
******************************************************************/

#define PVODE_BAND_ELEM(A,i,j) ((A->data)[j][i-j+(A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][(i) - j + (A->smu)])

@@ -138,7 +138,7 @@
* *
******************************************************************/

#define PVODE_BAND_ELEM(A,i,j) ((A->data)[j][i-j+(A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - (j) + (A->smu)])

@@ -138,7 +138,7 @@
* *
******************************************************************/

#define PVODE_BAND_ELEM(A,i,j) ((A->data)[j][i-j+(A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + (A->smu)])
#define PVODE_BAND_ELEM(A, i, j) ((A->data)[j][i - j + ((A)->smu)])

int abs_offset() const { return 1; }

#if BOUT_USE_METRIC_3D == 0
BoutReal& ynext(Field2D& f) const { return f[ind().yp(by).xp(bx)]; }
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 "Field2D" is directly included [misc-include-cleaner]

include/bout/boundary_iterator.hxx:2:

- #include "bout/mesh.hxx"
+ #include "bout/field2d.hxx"
+ #include "bout/mesh.hxx"

const BoutReal& yprev(const Field2D& f) const { return f[ind().yp(-by).xp(-bx)]; }
#endif

const int dir;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'dir' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int dir;
            ^

const BoutReal& yprev(const Field2D& f) const { return f[ind().yp(-by).xp(-bx)]; }
#endif

const int dir;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'dir' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  const int dir;
            ^

const int dir;

protected:
int z{0};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'z' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  int z{0};
      ^


protected:
int z{0};
int x;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'x' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  int x;
      ^

@dschwoerer dschwoerer force-pushed the fci-auto-with-debug-higher-order branch from b1ee735 to be5e285 Compare March 14, 2025 09:31
@@ -12,10 +12,41 @@
{% if lhs == rhs == "Field3D" %}
{{out.name}}.setRegion({{lhs.name}}.getMesh()->getCommonRegion({{lhs.name}}.getRegionID(),
{{rhs.name}}.getRegionID()));
#if BOUT_USE_FCI_AUTOMAGIC
Copy link
Contributor

Choose a reason for hiding this comment

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

I think BOUT_USE_FCI_AUTOMAGIC may be useful to get something working, but I don't think it's a good way to go: We will have code that either breaks when this is turned off, or performs too many operations when it is turned on. I think the options are:

a) Have two functions / operators: One that discards yup/ydown, and the other that keeps them.

b) Always operate on yup/down if they are present, but add a method to fields e.g withoutParallelSlices() that returns a copy of the field without the yup/down slices. That could be used e.g in assignment

Field3D f = g; // f has copies of g.yup and g.ydown
Field3D f = g.withoutParallelSlices(); // f has no parallel slices

I suspect that operating on two fields, one with slices and one without, should be an error: Either they should both have slices, or neither have.

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

There were too many comments to post at once. Showing the first 25 out of 417. Check the log or trigger a new build to see more.

return (f[ind()] * 3 - yprev(f)) * 0.5;
}

BoutReal extrapolate_next_o2(const Field3D& f) const { return 2 * f[ind()] - yprev(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: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
BoutReal extrapolate_next_o2(const Field3D& f) const { return 2 * f[ind()] - yprev(f); }
BoutReal extrapolate_next_o2(const Field3D& f) const { return (2 * f[ind()]) - yprev(f); }


BoutReal
extrapolate_next_o2(const std::function<BoutReal(int yoffset, Ind3D ind)>& f) const {
return 2 * f(0, ind()) - f(0, ind().yp(-by).xp(-bx));
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
return 2 * f(0, ind()) - f(0, ind().yp(-by).xp(-bx));
return (2 * f(0, ind())) - f(0, ind().yp(-by).xp(-bx));

protected:
int z{0};
int x;
int y;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'y' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  int y;
      ^

int z{0};
int x;
int y;
const int bx;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'bx' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int bx;
            ^

int z{0};
int x;
int y;
const int bx;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'bx' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  const int bx;
            ^

return result;
}

#undef FIELD_FUNC

template <typename T, typename = bout::utils::EnableIfField<T>, class... Types>
inline void setName(T& f, const std::string& name, Types... args) {
#if BOUT_USE_TRACK
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 "BOUT_USE_TRACK" is directly included [misc-include-cleaner]

{
      ^

}

template <typename T, typename = bout::utils::EnableIfField<T>, class... Types>
inline T setName(T&& f, const std::string& name, Types... args) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: forwarding reference parameter 'f' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]

>
                       ^

@@ -66,7 +66,8 @@ public:
*/
Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'Field2D::Field2D' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]

  Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
  ^
Additional context

src/field/field2d.cxx:50: the definition seen here

Field2D::Field2D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in,
         ^

include/bout/field2d.hxx:66: differing parameters are named here: ('region'), in definition: ('UNUSED_regionID')

  Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
  ^

@@ -66,7 +66,8 @@
*/
Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
DirectionTypes directions_in = {YDirectionType::Standard,
ZDirectionType::Average});
ZDirectionType::Average},
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 "ZDirectionType" is directly included [misc-include-cleaner]

                                          ZDirectionType::Average},
                                          ^

@@ -66,7 +66,8 @@
*/
Field2D(Mesh* localmesh = nullptr, CELL_LOC location_in = CELL_CENTRE,
DirectionTypes directions_in = {YDirectionType::Standard,
ZDirectionType::Average});
ZDirectionType::Average},
std::optional<size_t> region = {});
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]

include/bout/field2d.hxx:26:

- class Field2D;
+ #include <cstddef>
+ class Field2D;

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.

3 participants