aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-19 21:50:52 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-23 12:43:53 -0700
commitd96e23d67f6b181657169453daef7c37cb62e635 (patch)
tree2fded957a5a26cef71fd2e2501ae178f0316b60c /Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
parente54e25a2cf23007bc8132b87079664fcf891fdfb (diff)
downloadWarpX-d96e23d67f6b181657169453daef7c37cb62e635.tar.gz
WarpX-d96e23d67f6b181657169453daef7c37cb62e635.tar.zst
WarpX-d96e23d67f6b181657169453daef7c37cb62e635.zip
Implement spectral solver in 2D
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index d05748192..76e8aef15 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -6,7 +6,7 @@ using namespace Gpu;
SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba,
const DistributionMapping& dm,
- const Array<Real,3> realspace_dx )
+ const RealVect realspace_dx )
{
// Store the cell size
dx = realspace_dx;
@@ -25,20 +25,26 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba,
// Allocate the 1D vectors
kx_vec = SpectralKVector( spectralspace_ba, dm );
+#if (AMREX_SPACEDIM == 3)
ky_vec = SpectralKVector( spectralspace_ba, dm );
+#endif
kz_vec = SpectralKVector( spectralspace_ba, dm );
// Initialize the values on each box
for ( MFIter mfi(spectralspace_ba, dm); mfi.isValid(); ++mfi ){
Box bx = spectralspace_ba[mfi];
AllocateAndFillKvector( kx_vec[mfi], bx, dx, 0 );
+#if (AMREX_SPACEDIM == 3)
AllocateAndFillKvector( ky_vec[mfi], bx, dx, 1 );
AllocateAndFillKvector( kz_vec[mfi], bx, dx, 2 );
+#else
+ AllocateAndFillKvector( kz_vec[mfi], bx, dx, 1 );
+#endif
}
}
void
AllocateAndFillKvector( ManagedVector<Real>& k, const Box& bx,
- const Array<Real,3> dx, const int i_dim )
+ const RealVect dx, const int i_dim )
{
// Alllocate k to the right size
int N = bx.length( i_dim );