diff options
Diffstat (limited to 'Source/FieldSolver')
4 files changed, 12 insertions, 42 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]) diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp index 72c2b7a28..11d9bbd94 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp @@ -452,15 +452,8 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficients ( } // Auxiliary variable - amrex::Real tmp; - if (om_s != 0.) - { - tmp = (1._rt - C(i,j,k)) / (ep0 * om2_s); - } - else // om_s = 0 - { - tmp = 0.5_rt * dt2 / ep0; - } + const amrex::Real tmp = (om_s != 0.)? + ((1._rt - C(i,j,k)) / (ep0 * om2_s)):(0.5_rt * dt2 / ep0); // T2 if (is_galilean) @@ -606,18 +599,10 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficientsAveraging ( const amrex::Real C1 = std::cos(0.5_rt * om_s * dt); const amrex::Real C3 = std::cos(1.5_rt * om_s * dt); - // S1_om, S3_om - amrex::Real S1_om, S3_om; - if (om_s != 0.) - { - S1_om = std::sin(0.5_rt * om_s * dt) / om_s; - S3_om = std::sin(1.5_rt * om_s * dt) / om_s; - } - else // om_s = 0 - { - S1_om = 0.5_rt * dt; - S3_om = 1.5_rt * dt; - } + const amrex::Real S1_om = (om_s != 0.)? + (std::sin(0.5_rt * om_s * dt) / om_s) : (0.5_rt * dt); + const amrex::Real S3_om = (om_s != 0.)? + (std::sin(1.5_rt * om_s * dt) / om_s) : (1.5_rt * dt); // Psi1 (multiplies E in the update equation for <E>) // Psi1 (multiplies B in the update equation for <B>) diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp index ddd07acad..5d49322b2 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp @@ -64,12 +64,7 @@ HankelTransform::HankelTransform (int const hankel_order, // NB: When compared with the FBPIC article, all the matrices here // are calculated in transposed form. This is done so as to use the // `dot` and `gemm` functions, in the `transform` method. - int p_denom; - if (hankel_order == azimuthal_mode) { - p_denom = hankel_order + 1; - } else { - p_denom = hankel_order; - } + const int p_denom = (hankel_order == azimuthal_mode)?(hankel_order + 1):(hankel_order); amrex::Vector<amrex::Real> denom(m_nk); for (int ik=0 ; ik < m_nk ; ik++) { diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp index 7320b7cf1..b8d81000c 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp @@ -68,14 +68,9 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba, spectralspace_ba.define( spectral_bl ); // Allocate the components of the k vector: kx, ky (only in 3D), kz - bool only_positive_k; for (int i_dim=0; i_dim<AMREX_SPACEDIM; i_dim++) { - if (i_dim==0) { - // Real-to-complex FFTs: first axis contains only the positive k - only_positive_k = true; - } else { - only_positive_k = false; - } + // Real-to-complex FFTs: first axis contains only the positive k + const auto only_positive_k = (i_dim==0); k_vec[i_dim] = getKComponent(dm, realspace_ba, i_dim, only_positive_k); } } |