aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-07-26 20:55:34 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-26 18:55:34 +0000
commit766d71146a8314a48db88f29b0e0548d1d9c5397 (patch)
tree630ae577a1856ae0f5fb2e236a4e85b9346566d2 /Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H
parent4783ad60809fc5fdff164a4ed0cacca4b3fffa70 (diff)
downloadWarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.tar.gz
WarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.tar.zst
WarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.zip
Initialize variables at declaration if it improves readability (#4117)
* init some variables at declaration * make code more readable * avoid lossy function result cast * Update Source/Initialization/WarpXInitData.cpp Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov> * replace with equality * Revert "replace with equality" This reverts commit e3164f9e053d345b153d770ae107a7f68c4bb260. * Update Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.cpp Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov> --------- Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov>
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H')
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H11
1 files changed, 3 insertions, 8 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H
index 622f7fa82..ad8194a13 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H
@@ -50,14 +50,9 @@ struct CylindricalYeeAlgorithm {
// semi-analytically by R. Lehe, and resulted in the following
// coefficients.
std::array< amrex::Real, 6 > const multimode_coeffs = {{ 0.2105_rt, 1.0_rt, 3.5234_rt, 8.5104_rt, 15.5059_rt, 24.5037_rt }};
- amrex::Real multimode_alpha;
- if (n_rz_azimuthal_modes < 7) {
- // Use the table of the coefficients
- multimode_alpha = multimode_coeffs[n_rz_azimuthal_modes-1];
- } else {
- // Use a realistic extrapolation
- multimode_alpha = (n_rz_azimuthal_modes - 1._rt)*(n_rz_azimuthal_modes - 1._rt) - 0.4_rt;
- }
+ const amrex::Real multimode_alpha = (n_rz_azimuthal_modes < 7)?
+ multimode_coeffs[n_rz_azimuthal_modes-1]: // Use the table of the coefficients
+ (n_rz_azimuthal_modes - 1._rt)*(n_rz_azimuthal_modes - 1._rt) - 0.4_rt; // Use a realistic extrapolation
const amrex::Real delta_t = 1._rt / ( std::sqrt(
(1._rt + multimode_alpha) / (dx[0]*dx[0])
+ 1._rt / (dx[1]*dx[1])