Skip to content

Commit efd77ff

Browse files
authored
two separate fixes -- particle_compare and ref_ratio=1 (#3655)
## Summary ## Additional background ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [X] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
1 parent 2f1b1d1 commit efd77ff

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Src/AmrCore/AMReX_AmrMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ AmrMesh::checkInput ()
10821082
for (int i = 0; i < max_level; i++)
10831083
{
10841084
if (MaxRefRatio(i) < 2) {
1085-
amrex::Error("Amr::checkInput: bad ref_ratios");
1085+
amrex::Warning("Amr::checkInput: ref_ratios all equal to one!");
10861086
}
10871087
}
10881088

Tools/Postprocessing/C_Src/particle_compare.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,15 @@ int main_main()
438438
std::string fn2;
439439
std::string pt;
440440
Real rtol = 0.0;
441+
Real atol = 0.0;
441442

442443
int farg=1;
443444
while (farg <= narg) {
444445
const std::string fname = amrex::get_command_argument(farg);
445446
if (fname == "-r" || fname == "--rel_tol") {
446447
rtol = std::stod(amrex::get_command_argument(++farg));
448+
} else if (fname == "--abs_tol") {
449+
atol = std::stod(amrex::get_command_argument(++farg));
447450
} else {
448451
break;
449452
}
@@ -472,6 +475,7 @@ int main_main()
472475
<< "\n"
473476
<< " optional arguments:\n"
474477
<< " -r|--rel_tol rtol : relative tolerance (default is 0)\n"
478+
<< " --abs_tol atol : absolute tolerance (default is 0)\n"
475479
<< std::endl;
476480
return EXIT_SUCCESS;
477481
}
@@ -555,16 +559,25 @@ int main_main()
555559

556560
int exit_code = 0;
557561
for (int i = 0; i < header1.num_comp; ++i) {
558-
if (global_norms[i+header1.num_comp] > rtol) exit_code = 1;
562+
if (global_norms[i ] > atol &&
563+
global_norms[i+header1.num_comp] > rtol) exit_code = 1;
559564
}
560565

561566
if (exit_code == 0)
562567
{
563-
amrex::Print() << " PARTICLES AGREE to relative tolerance " << rtol << "\n";
568+
if (atol > 0.) {
569+
amrex::Print() << " PARTICLES AGREE to relative tolerance " << rtol << " and/or absolute tolerance " << atol << "\n";
570+
} else {
571+
amrex::Print() << " PARTICLES AGREE to relative tolerance " << rtol << "\n";
572+
}
564573
}
565574
else
566575
{
567-
amrex::Print() << " PARTICLES DISAGREE to relative tolerance " << rtol << "\n";
576+
if (atol > 0.) {
577+
amrex::Print() << " PARTICLES DISAGREE to relative tolerance " << rtol << " and/or absolute tolerance " << atol << "\n";
578+
} else {
579+
amrex::Print() << " PARTICLES DISAGREE to relative tolerance " << rtol << "\n";
580+
}
568581
}
569582

570583
return exit_code;

0 commit comments

Comments
 (0)