-
Notifications
You must be signed in to change notification settings - Fork 0
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
Hermes-3 merges #1
base: next
Are you sure you want to change the base?
Conversation
Enable 1D arrays of integers to be read from NetCDF files, and made available via `Mesh::get()`. Mainly useful for mesh construction.
When reading 1D vector of ints, check that the input is long enough, and resize the output vector.
A short-term fix, allowing extra limiters to be added with inputs: limiter_count : int limiter_yinds : [int], length limiter_count limiter_xstarts : [int], length limiter_count limiter_xends : [int], length limiter_count The limiter(s) are added between yinds[i] and yinds[i] + 1
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.
gcc 9.4 is unable to correctly parse the construction for the function argument, if name.change is used directly. First making a copy seems to work around that issue.
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
} | ||
|
||
// Ensure that output variable has the correct size | ||
var.resize(len); |
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 'it' is too short, expected at least 3 characters [readability-identifier-length]
const auto* it = std::begin(full_var);
^
int limiter_count = 0; | ||
Mesh::get(limiter_count, "limiter_count", 0); | ||
if (limiter_count > 0) { | ||
std::vector<int> limiter_yinds, limiter_xstarts, limiter_xends; |
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: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
std::vector<int> limiter_yinds, limiter_xstarts, limiter_xends; | |
std::vector<int> limiter_yinds; | |
std::vector<int> limiter_xstarts; | |
std::vector<int> limiter_xends; |
if (!source->get(this, limiter_xends, "limiter_xends", limiter_count)) { | ||
throw BoutException("Couldn't read limiter_xend vector of length {} from mesh", | ||
limiter_count); | ||
} |
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 'yind' of type 'int' can be declared 'const' [misc-const-correctness]
} | |
int const yind = limiter_yinds[i]; |
throw BoutException("Couldn't read limiter_xend vector of length {} from mesh", | ||
limiter_count); | ||
} | ||
|
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 'xstart' of type 'int' can be declared 'const' [misc-const-correctness]
int const xstart = limiter_xstarts[i]; |
limiter_count); | ||
} | ||
|
||
for (int i = 0; i < limiter_count; ++i) { |
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 'xend' of type 'int' can be declared 'const' [misc-const-correctness]
for (int i = 0; i < limiter_count; ++i) { | |
int const xend = limiter_xends[i]; |
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.
This one is just a merge of the automatic clang-format commits that desynced my local branch from the remote one.
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
template Options* Field3D::track<FieldPerp>(const FieldPerp&, std::string); | ||
|
||
Options* Field3D::track(const BoutReal& change, std::string operation) { | ||
if (tracking and tracking_state) { |
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: implicit conversion 'Options *' -> bool [readability-implicit-bool-conversion]
if (tracking and tracking_state) { | |
if ((tracking != nullptr) and tracking_state) { |
template Options* Field3D::track<FieldPerp>(const FieldPerp&, std::string); | ||
|
||
Options* Field3D::track(const BoutReal& change, std::string operation) { | ||
if (tracking and tracking_state) { |
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: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
if (tracking and tracking_state) { | |
if (tracking and (tracking_state != 0)) { |
// Ensure that output variable has the correct size | ||
var.resize(len); | ||
|
||
const auto* it = std::begin(full_var); |
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 'it' is too short, expected at least 3 characters [readability-identifier-length]
const auto* it = std::begin(full_var);
^
} | ||
|
||
for (int i = 0; i < limiter_count; ++i) { | ||
int yind = limiter_yinds[i]; |
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 'yind' of type 'int' can be declared 'const' [misc-const-correctness]
int yind = limiter_yinds[i]; | |
int const yind = limiter_yinds[i]; |
|
||
for (int i = 0; i < limiter_count; ++i) { | ||
int yind = limiter_yinds[i]; | ||
int xstart = limiter_xstarts[i]; |
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 'xstart' of type 'int' can be declared 'const' [misc-const-correctness]
int xstart = limiter_xstarts[i]; | |
int const xstart = limiter_xstarts[i]; |
.withDefault(false); | ||
|
||
cvode_mem = CVodeMalloc(neq, solver_f, simtime, u, use_adam ? ADAMS : BDF, NEWTON, SS, | ||
&reltol, &abstol, this, nullptr, optIn, iopt, ropt, machEnv); |
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: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
&reltol, &abstol, this, nullptr, optIn, iopt, ropt, machEnv);
^
@@ -293,6 +358,54 @@ BoutReal PvodeSolver::run(BoutReal tout) { | |||
// Check return flag | |||
if (flag != SUCCESS) { | |||
output_error.write("ERROR CVODE step failed, flag = {:d}\n", flag); | |||
CVodeMemRec* cv_mem = (CVodeMem)cvode_mem; |
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: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
CVodeMemRec* cv_mem = (CVodeMem)cvode_mem;
^
for (const auto& prefix : {"pre_"s, "residuum_"s}) { | ||
std::vector<Field3D> list_of_fields{}; | ||
std::vector<bool> evolve_bndrys{}; | ||
for (const auto& f : f3d) { |
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 'f' is too short, expected at least 3 characters [readability-identifier-length]
for (const auto& f : f3d) {
^
prefix == "pre_"s ? udata : N_VDATA(cv_mem->cv_acor)); | ||
} | ||
|
||
for (auto& f : f3d) { |
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 'f' is too short, expected at least 3 characters [readability-identifier-length]
for (auto& f : f3d) {
^
} | ||
run_rhs(simtime); | ||
|
||
for (auto& f : f3d) { |
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 'f' is too short, expected at least 3 characters [readability-identifier-length]
for (auto& f : f3d) {
^
This is a Hermes-3 BOUT-dev merge to help with debugging a spurious slowdown in the nonlinear solves due to new, improved neutral transport equation flux limiter approach. The Hermes-3 PR for this work is here: mikekryjak/hermes-3#8
Merge of recent Next as of July 2024 with the CVODE modification to know when we're in a linear solve or not. This comes from this PR: boutproject#2932
And has further merges as per this latest commit: d7f88073f3ad707d624f8b9fed0a97a49596c542
I am also merging this with: