Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

added diagnostic_interval int for nonlinear solver diagnostic. #5748

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

JustinRayAngus
Copy link
Contributor

This PR adds the ability to parse in a step interval for the nonlinear diagnostic.

@JustinRayAngus JustinRayAngus requested a review from dpgrote March 10, 2025 17:47
@JustinRayAngus JustinRayAngus added the component: implicit solvers Anything related to implicit solvers label Mar 10, 2025
@@ -356,7 +357,8 @@ void NewtonSolver<Vec,Ops>::Solve ( Vec& a_U,
}
}

if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor()) {
if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor() &&
a_step%this->m_diagnostic_interval==0) {
Copy link
Member

Choose a reason for hiding this comment

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

You can make this change here to get the counting correct.

Suggested change
a_step%this->m_diagnostic_interval==0) {
(a_step + 1)%this->m_diagnostic_interval==0) {

@@ -356,7 +357,8 @@ void NewtonSolver<Vec,Ops>::Solve ( Vec& a_U,
}
}

if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor()) {
if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor() &&
a_step%this->m_diagnostic_interval==0) {
std::ofstream diagnostic_file{this->m_diagnostic_file, std::ofstream::out | std::ofstream::app};
diagnostic_file << std::setprecision(14);
diagnostic_file << a_step;
Copy link
Member

Choose a reason for hiding this comment

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

And here also

Suggested change
diagnostic_file << a_step;
diagnostic_file << a_step + 1;

Copy link
Member

Choose a reason for hiding this comment

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

And also below, increment the time diagnostic_file << a_time + a_dt;

@ax3l ax3l added the component: diagnostics all types of outputs label Mar 10, 2025
Copy link
Member

@dpgrote dpgrote left a comment

Choose a reason for hiding this comment

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

Looks good!

@JustinRayAngus JustinRayAngus force-pushed the nonlinear_diagnostic branch 2 times, most recently from d518331 to 894f8ab Compare March 11, 2025 20:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
component: diagnostics all types of outputs component: implicit solvers Anything related to implicit solvers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants