From f0456518f3a1c1168e37c5498a6595d44395bb2b Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Mon, 29 Apr 2019 11:39:07 -0700 Subject: Add separate file for constructor --- .../FieldSolver/SpectralSolver/SpectralSolver.cpp | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Source/FieldSolver/SpectralSolver/SpectralSolver.cpp (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp new file mode 100644 index 000000000..a04a68d2c --- /dev/null +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -0,0 +1,30 @@ +#include +#include +#include + +/* \brief TODO Description + */ +SpectralSolver( const amrex::BoxArray& realspace_ba, + const amrex::DistributionMapping& dm, + const int norder_x, const int norder_y, + const int norder_z, const bool nodal, + const amrex::RealVect dx, const amrex::Real dt ) { + + // Initialize all structures using the same distribution mapping dm + + // - Initialize k space object (Contains info about the size of + // the spectral space corresponding to each box in `realspace_ba`, + // as well as the value of the corresponding k coordinates) + const SpectralKSpace k_space= SpectralKSpace(realspace_ba, dm, dx); + + // - Select the algorithm depending on the input parameters + // Initialize the corresponding coefficients over k space + // TODO: Add more algorithms + selection depending on input parameters + // For the moment, this only uses the standard PsatdAlgorithm + algorithm = std::unique_ptr( new PsatdAlgorithm( + k_space, dm, norder_x, norder_y, norder_z, nodal, dt ) ); + + // - Initialize arrays for fields in spectral space + FFT plans + field_data = SpectralFieldData( realspace_ba, k_space, dm ); + +}; -- cgit v1.2.3 From 91f27c7e814666aed85f505094635128a80dade6 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 30 Apr 2019 12:00:10 -0700 Subject: Fix typo --- Source/FieldSolver/SpectralSolver/SpectralSolver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index a04a68d2c..5da39a7c7 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -4,7 +4,8 @@ /* \brief TODO Description */ -SpectralSolver( const amrex::BoxArray& realspace_ba, +SpectralSolver::SpectralSolver( + const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, const int norder_x, const int norder_y, const int norder_z, const bool nodal, -- cgit v1.2.3 From e4985aa4188ce6f9605171db2a1c621ecc730e26 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Wed, 1 May 2019 08:20:32 -0700 Subject: Add comments --- .../SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H | 5 ++++- Source/FieldSolver/SpectralSolver/SpectralSolver.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H index 18d26e0c8..5c662e533 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H @@ -6,7 +6,10 @@ /* \brief Class that updates the field in spectral space * and stores the coefficients of the corresponding update equation. - * TODO: Mention base class + * + * `SpectralBaseAlgorithm` is only a base class and cannot be used directly. + * Instead use its subclasses, which implement the specific field update + * equations for a given spectral algorithm. */ class SpectralBaseAlgorithm { diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index 5da39a7c7..c21c3cfb1 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -2,7 +2,11 @@ #include #include -/* \brief TODO Description +/* \brief Initialize the spectral Maxwell solver + * + * This function selects the spectral algorithm to be used, allocates the + * corresponding coefficients for the discretized field update equation, + * and prepares the structures that store the fields in spectral space. */ SpectralSolver::SpectralSolver( const amrex::BoxArray& realspace_ba, -- cgit v1.2.3