diff options
Diffstat (limited to 'Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms')
3 files changed, 42 insertions, 42 deletions
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H index 5f15af899..09b69361c 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CKCAlgorithm.H @@ -30,7 +30,7 @@ struct CKCAlgorithm { Real const inv_dx = 1./cell_size[0]; Real const inv_dy = 1./cell_size[1]; Real const inv_dz = 1./cell_size[2]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D const Real delta = std::max( { inv_dx,inv_dy,inv_dz } ); const Real rx = (inv_dx/delta)*(inv_dx/delta); const Real ry = (inv_dy/delta)*(inv_dy/delta); @@ -60,7 +60,7 @@ struct CKCAlgorithm { gammax *= inv_dx; gammay *= inv_dy; gammaz *= inv_dz; -# elif defined WARPX_DIM_XZ +#elif defined WARPX_DIM_XZ const Real delta = std::max(inv_dx,inv_dz); const Real rx = (inv_dx/delta)*(inv_dx/delta); const Real rz = (inv_dz/delta)*(inv_dz/delta); @@ -72,7 +72,7 @@ struct CKCAlgorithm { betazx *= inv_dz; alphax *= inv_dx; alphaz *= inv_dz; -# endif +#endif // Store the coefficients in array `stencil_coefs`, in prescribed order stencil_coefs_x.resize(6); @@ -107,7 +107,7 @@ struct CKCAlgorithm { amrex::Real const betaxy = coefs_x[2]; amrex::Real const betaxz = coefs_x[3]; amrex::Real const gammax = coefs_x[4]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return alphax * (F(i+1,j ,k ) - F(i, j, k )) + betaxy * (F(i+1,j+1,k ) - F(i ,j+1,k ) + F(i+1,j-1,k ) - F(i ,j-1,k )) @@ -117,11 +117,11 @@ struct CKCAlgorithm { + F(i+1,j-1,k+1) - F(i ,j-1,k+1) + F(i+1,j+1,k-1) - F(i ,j+1,k-1) + F(i+1,j-1,k-1) - F(i ,j-1,k-1)); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return alphax * (F(i+1,j ,k ) - F(i, j, k )) + betaxz * (F(i+1,j+1,k ) - F(i ,j+1,k ) + F(i+1,j-1,k ) - F(i ,j-1,k )); -# endif +#endif }; /** @@ -144,7 +144,7 @@ struct CKCAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const alphay = coefs_y[1]; amrex::Real const betayz = coefs_y[2]; amrex::Real const betayx = coefs_y[3]; @@ -158,9 +158,9 @@ struct CKCAlgorithm { + F(i-1,j+1,k+1) - F(i-1,j ,k+1) + F(i+1,j+1,k-1) - F(i+1,j ,k-1) + F(i-1,j+1,k-1) - F(i-1,j ,k-1)); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 -# endif +#endif }; /** @@ -171,12 +171,12 @@ struct CKCAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const inv_dy = coefs_y[0]; return inv_dy*( F(i,j,k) - F(i,j-1,k) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 -# endif +#endif }; /** @@ -191,7 +191,7 @@ struct CKCAlgorithm { amrex::Real const betazx = coefs_z[2]; amrex::Real const betazy = coefs_z[3]; amrex::Real const gammaz = coefs_z[4]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return alphaz * (F(i ,j ,k+1) - F(i ,j ,k )) + betazx * (F(i+1,j ,k+1) - F(i+1,j ,k ) + F(i-1,j ,k+1) - F(i-1,j ,k )) @@ -201,11 +201,11 @@ struct CKCAlgorithm { + F(i-1,j+1,k+1) - F(i-1,j+1,k ) + F(i+1,j-1,k+1) - F(i+1,j-1,k ) + F(i-1,j-1,k+1) - F(i-1,j-1,k )); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return alphaz * (F(i ,j+1,k ) - F(i ,j ,k )) + betazx * (F(i+1,j+1,k ) - F(i+1,j ,k ) + F(i-1,j+1,k ) - F(i-1,j ,k )); -# endif +#endif }; /** @@ -217,11 +217,11 @@ struct CKCAlgorithm { int const i, int const j, int const k ) { amrex::Real const inv_dz = coefs_z[0]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return inv_dz*( F(i,j,k) - F(i,j,k-1) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return inv_dz*( F(i,j,k) - F(i,j-1,k) ); -# endif +#endif }; }; diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H index c040a7846..82527bc5f 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/NodalAlgorithm.H @@ -67,12 +67,12 @@ struct NodalAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const inv_dy = coefs_y[0]; return 0.5*inv_dy*( F(i,j+1,k) - F(i,j-1,k) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 -# endif +#endif }; /** @@ -85,12 +85,12 @@ struct NodalAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const inv_dy = coefs_y[0]; return 0.5*inv_dy*( F(i,j+1,k) - F(i,j-1,k) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 -# endif +#endif }; /** @@ -104,11 +104,11 @@ struct NodalAlgorithm { int const i, int const j, int const k ) { amrex::Real const inv_dz = coefs_z[0]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return 0.5*inv_dz*( F(i,j,k+1) - F(i,j,k-1) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0.5*inv_dz*( F(i,j+1,k) - F(i,j-1,k) ); -# endif +#endif }; /** @@ -122,11 +122,11 @@ struct NodalAlgorithm { int const i, int const j, int const k ) { amrex::Real const inv_dz = coefs_z[0]; -# if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return 0.5*inv_dz*( F(i,j,k+1) - F(i,j,k-1) ); -# elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0.5*inv_dz*( F(i,j+1,k) - F(i,j-1,k) ); -# endif +#endif }; }; diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H index 0ad9c6345..75d191467 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/YeeAlgorithm.H @@ -61,12 +61,12 @@ struct YeeAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { - #if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const inv_dy = coefs_y[0]; return inv_dy*( F(i,j+1,k) - F(i,j,k) ); - #elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 - #endif +#endif }; /** @@ -77,12 +77,12 @@ struct YeeAlgorithm { amrex::Real const* coefs_y, int const n_coefs_y, int const i, int const j, int const k ) { - #if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D amrex::Real const inv_dy = coefs_y[0]; return inv_dy*( F(i,j,k) - F(i,j-1,k) ); - #elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return 0; // 2D Cartesian: derivative along y is 0 - #endif +#endif }; /** @@ -94,11 +94,11 @@ struct YeeAlgorithm { int const i, int const j, int const k ) { amrex::Real const inv_dz = coefs_z[0]; - #if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return inv_dz*( F(i,j,k+1) - F(i,j,k) ); - #elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return inv_dz*( F(i,j+1,k) - F(i,j,k) ); - #endif +#endif }; /** @@ -110,11 +110,11 @@ struct YeeAlgorithm { int const i, int const j, int const k ) { amrex::Real const inv_dz = coefs_z[0]; - #if defined WARPX_DIM_3D +#if defined WARPX_DIM_3D return inv_dz*( F(i,j,k) - F(i,j,k-1) ); - #elif (defined WARPX_DIM_XZ) +#elif (defined WARPX_DIM_XZ) return inv_dz*( F(i,j,k) - F(i,j-1,k) ); - #endif +#endif }; }; |