aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/FieldSolver/SpectralSolver/PsatdSolver.H6
-rw-r--r--Source/FieldSolver/SpectralSolver/PsatdSolver.cpp35
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.H8
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp16
4 files changed, 49 insertions, 16 deletions
diff --git a/Source/FieldSolver/SpectralSolver/PsatdSolver.H b/Source/FieldSolver/SpectralSolver/PsatdSolver.H
index bb46da670..06a355021 100644
--- a/Source/FieldSolver/SpectralSolver/PsatdSolver.H
+++ b/Source/FieldSolver/SpectralSolver/PsatdSolver.H
@@ -14,8 +14,10 @@ class PsatdSolver
using SpectralCoefficients = FabArray<BaseFab<Real>>;
public:
- PsatdSolver( const SpectralKSpace& spectral_kspace,
- const DistributionMapping& dm, Real dt );
+ PsatdSolver(const SpectralKSpace& spectral_kspace,
+ const DistributionMapping& dm,
+ const int norder_x, const int norder_y,
+ const int norder_z, const Real dt);
void pushSpectralFields( SpectralData& f ) const;
private:
diff --git a/Source/FieldSolver/SpectralSolver/PsatdSolver.cpp b/Source/FieldSolver/SpectralSolver/PsatdSolver.cpp
index 66409ca33..f8a3f7c6e 100644
--- a/Source/FieldSolver/SpectralSolver/PsatdSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/PsatdSolver.cpp
@@ -4,20 +4,33 @@
using namespace amrex;
-/*
- * ba: BoxArray for spectral space
- * dm: DistributionMapping for spectral space
- */
+
PsatdSolver::PsatdSolver(const SpectralKSpace& spectral_kspace,
- const DistributionMapping& dm, const Real dt)
+ const DistributionMapping& dm,
+ const int norder_x, const int norder_y,
+ const int norder_z, const Real dt)
{
+ const BoxArray& ba = spectral_kspace.spectralspace_ba;
+
// Allocate the 1D vectors
- modified_kx_vec = spectral_kspace.getModifiedKVector( 0 );
- modified_ky_vec = spectral_kspace.getModifiedKVector( 1 );
- modified_kz_vec = spectral_kspace.getModifiedKVector( 2 );
+ modified_kx_vec = SpectralKVector( ba, dm );
+ modified_ky_vec = SpectralKVector( ba, dm );
+ modified_kz_vec = SpectralKVector( ba, dm );
+ // Allocate and fill them by computing the modified vector
+ for ( MFIter mfi(ba, dm); mfi.isValid(); ++mfi ){
+ Box bx = ba[mfi];
+ ComputeModifiedKVector(
+ modified_kx_vec[mfi], spectral_kspace.kx_vec[mfi],
+ bx, spectral_kspace.dx[0], norder_x );
+ ComputeModifiedKVector(
+ modified_ky_vec[mfi], spectral_kspace.ky_vec[mfi],
+ bx, spectral_kspace.dx[1], norder_y );
+ ComputeModifiedKVector(
+ modified_kz_vec[mfi], spectral_kspace.kz_vec[mfi],
+ bx, spectral_kspace.dx[2], norder_z );
+ }
// Allocate the arrays of coefficients
- const BoxArray& ba = spectral_kspace.spectralspace_ba;
C_coef = SpectralCoefficients( ba, dm, 1, 0 );
S_ck_coef = SpectralCoefficients( ba, dm, 1, 0 );
X1_coef = SpectralCoefficients( ba, dm, 1, 0 );
@@ -69,7 +82,7 @@ PsatdSolver::PsatdSolver(const SpectralKSpace& spectral_kspace,
}
});
}
-}
+};
void
PsatdSolver::pushSpectralFields( SpectralData& f ) const{
@@ -155,4 +168,4 @@ PsatdSolver::pushSpectralFields( SpectralData& f ) const{
+ X1*I*(kx*Jy - ky*Jx );
});
}
-}
+};
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
index d1aea836e..04264e629 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
@@ -16,10 +16,7 @@ class SpectralKSpace
{
public:
SpectralKSpace( const BoxArray& realspace_ba, const DistributionMapping& dm, const Real* dx );
- SpectralKVector& getModifiedKVector( const int i_dim ) const;
BoxArray spectralspace_ba;
-
- private:
SpectralKVector kx_vec, ky_vec, kz_vec;
const Real* dx;
};
@@ -27,4 +24,9 @@ class SpectralKSpace
void
AllocateAndFillKvector( ManagedVector<Real>& k, const Box& bx, const Real* dx, const int i_dim );
+void
+ComputeModifiedKVector( ManagedVector<Real>& modified_k,
+ const ManagedVector<Real>& k,
+ const Box& bx, const Real dx, const int norder );
+
#endif
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index ab684444d..03d62892f 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -60,3 +60,19 @@ AllocateAndFillKvector( ManagedVector<Real>& k, const Box& bx, const Real* dx, c
// TODO: For real-to-complex,
}
+
+void
+ComputeModifiedKVector( ManagedVector<Real>& modified_k,
+ const ManagedVector<Real>& k,
+ const Box& bx, const Real dx, const int norder )
+{
+ // Allocate modified_k to the right size
+ int N = k.size();
+ modified_k.resize( N );
+
+ // For now, this simply copies the infinite order k
+ for (int i=0; i<N; i++ ){
+ modified_k[i] = k[i];
+ }
+
+}