IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
FDTDSolverBase.h
Go to the documentation of this file.
1#ifndef IPPL_FDTD_H
2#define IPPL_FDTD_H
3#include <cstddef>
4using std::size_t;
5#include "Types/Vector.h"
6
12
13namespace ippl {
18
27 template <typename EMField, typename SourceField, fdtd_bc boundary_conditions>
28 class FDTDSolverBase : public Maxwell<EMField, SourceField> {
29 public:
30 constexpr static unsigned Dim = EMField::dim;
31 using scalar = typename EMField::value_type::value_type;
33 using SourceVector_t = typename SourceField::value_type;
34
42 FDTDSolverBase(SourceField& source, EMField& E, EMField& B);
43
47 void solve() override;
48
53
59 scalar getDt() const { return dt; }
60
61 SourceField A_n; // Current field.
62 SourceField A_np1; // Field at the next time step.
63 SourceField A_nm1; // Field at the previous time step.
64
68 void timeShift();
69
73 virtual void step() = 0;
77 void evaluate_EB();
78
82 virtual void initialize() = 0;
83
84 protected:
88 void applyBCs();
89
90 typename SourceField::Mesh_t* mesh_mp; // Pointer to the mesh.
91 FieldLayout<Dim>* layout_mp; // Pointer to the layout
92 NDIndex<Dim> domain_m; // Domain of the mesh.
93 Vector_t hr_m; // Mesh spacing.
94
95 Vector<int, Dim> nr_m; // Number of grid points in each direction.
96 scalar dt; // Time step size.
97 };
98} // namespace ippl
99
100#include "FDTDSolverBase.hpp"
101#endif
Definition Archive.h:20
void evaluate_EB()
Evaluates the electric and magnetic fields.
FieldLayout< Dim > * layout_mp
void applyBCs()
Applies the boundary conditions.
Vector< typename EMField::value_type::value_type, Dim > Vector_t
Vector< int, Dim > nr_m
virtual void initialize()=0
Initializes the solver. This is a pure virtual function.
void setPeriodicBoundaryConditions()
Sets periodic boundary conditions.
typename SourceField::value_type SourceVector_t
NDIndex< Dim > domain_m
static constexpr unsigned Dim
scalar getDt() const
Gets the time step size.
virtual void step()=0
Steps the solver forward in time. This is a pure virtual function.
void solve() override
Solves the FDTD equations.
void timeShift()
Shifts the saved fields in time.
SourceField::Mesh_t * mesh_mp
typename EMField::value_type::value_type scalar
FDTDSolverBase(SourceField &source, EMField &E, EMField &B)
Constructor for the FDTDSolverBase class.