-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backwards Compatible
algo.space_charge
evolution
- Loading branch information
Showing
17 changed files
with
226 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright 2022-2025 The Regents of the University of California, through Lawrence | ||
* Berkeley National Laboratory (subject to receipt of any required | ||
* approvals from the U.S. Dept. of Energy). All rights reserved. | ||
* | ||
* This file is part of ImpactX. | ||
* | ||
* Authors: Axel Huebl, Chad Mitchell | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
#ifndef IMPACTX_ALGORITHMS_H | ||
#define IMPACTX_ALGORITHMS_H | ||
|
||
#include <AMReX_Enum.H> | ||
|
||
|
||
namespace impactx | ||
{ | ||
AMREX_ENUM(SpaceChargeAlgo, | ||
False, | ||
True_3D, | ||
True_2D | ||
); | ||
|
||
SpaceChargeAlgo | ||
get_space_charge_algo (); | ||
|
||
} // namespace impactx | ||
|
||
#endif // IMPACTX_ALGORITHMS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* Copyright 2022-2025 The Regents of the University of California, through Lawrence | ||
* Berkeley National Laboratory (subject to receipt of any required | ||
* approvals from the U.S. Dept. of Energy). All rights reserved. | ||
* | ||
* This file is part of ImpactX. | ||
* | ||
* Authors: Axel Huebl, Chad Mitchell | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
#include "initialization/Algorithms.H" | ||
|
||
#include <ablastr/warn_manager/WarnManager.H> | ||
|
||
#include <AMReX_ParmParse.H> | ||
|
||
#include <algorithm> // for std::transform | ||
#include <stdexcept> | ||
#include <string> | ||
|
||
|
||
namespace impactx | ||
{ | ||
SpaceChargeAlgo | ||
get_space_charge_algo () | ||
{ | ||
amrex::ParmParse const pp_algo("algo"); | ||
std::string space_charge; | ||
bool has_space_charge = pp_algo.query("space_charge", space_charge); | ||
|
||
if (!has_space_charge) { return SpaceChargeAlgo::False; } | ||
|
||
// TODO: at some point, remove backwards compatibility to pre 25.03 | ||
std::string space_charge_lower = space_charge; | ||
std::transform(space_charge.begin(), space_charge.end(), space_charge_lower.begin(), | ||
[](unsigned char c){ return std::tolower(c); }); | ||
if (space_charge_lower == "1" || space_charge_lower == "true" || space_charge_lower == "on") | ||
{ | ||
ablastr::warn_manager::WMRecordWarning( | ||
"algo.space_charge", | ||
"The option algo.space_charge = true is deprecated and will be removed in a future version of ImpactX. " | ||
"Please use algo.space_charge = 3D instead.", | ||
ablastr::warn_manager::WarnPriority::high | ||
); | ||
return SpaceChargeAlgo::True_3D; | ||
} | ||
if (space_charge_lower == "0") | ||
{ | ||
ablastr::warn_manager::WMRecordWarning( | ||
"algo.space_charge", | ||
"The option algo.space_charge = 0 is deprecated and will be removed in a future version of ImpactX. " | ||
"Please use algo.space_charge = false instead.", | ||
ablastr::warn_manager::WarnPriority::high | ||
); | ||
return SpaceChargeAlgo::False; | ||
} | ||
|
||
if (space_charge == "false" || space_charge == "off") | ||
{ | ||
return SpaceChargeAlgo::False; | ||
} | ||
else if (space_charge == "3D") | ||
{ | ||
return SpaceChargeAlgo::True_3D; | ||
} | ||
else if (space_charge == "2D") | ||
{ | ||
return SpaceChargeAlgo::True_2D; | ||
} | ||
else | ||
{ | ||
throw std::runtime_error("algo.space_charge = " + space_charge + " is not a valid option"); | ||
} | ||
} | ||
|
||
} // namespace impactx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
target_sources(lib | ||
PRIVATE | ||
Algorithms.cpp | ||
AmrCoreData.cpp | ||
InitAMReX.cpp | ||
InitAmrCore.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.