Line data Source code
1 : //
2 : // Class Maxwell
3 : // Base class for solvers for Maxwell's equations
4 : //
5 :
6 : #ifndef IPPL_MAXWELL_H
7 : #define IPPL_MAXWELL_H
8 :
9 : #include "Types/Vector.h"
10 :
11 : #include "Field/Field.h"
12 :
13 : #include "FieldLayout/FieldLayout.h"
14 : #include "Meshes/UniformCartesian.h"
15 :
16 : namespace ippl {
17 :
18 : template <typename EMField, typename SourceField>
19 : class Maxwell {
20 : public:
21 : constexpr static unsigned Dim = EMField::dim;
22 :
23 : /*!
24 : * Default constructor for Maxwell solvers;
25 : */
26 0 : Maxwell() {}
27 :
28 : /*!
29 : * Constructor which allows to initialize the field pointers
30 : * (J, E, B) in the Maxwell solvers class
31 : * @param four_current The four current field (rho, J)
32 : * @param E The electric field
33 : * @param B The magnetic field
34 : */
35 : Maxwell(SourceField& four_current, EMField& E, EMField& B) {
36 : setSources(four_current);
37 : setEMFields(E, B);
38 : }
39 :
40 : /*!
41 : * Set the problem RHS (charge & current densities)
42 : * @param four_current The four current field (rho, J)
43 : */
44 0 : virtual void setSources(SourceField& four_current) { JN_mp = &four_current; }
45 :
46 : /*!
47 : * Set the problem LHS (electromagnetic fields)
48 : * @param E The electric field
49 : * @param B The magnetic field
50 : */
51 0 : void setEMFields(EMField& E, EMField& B) {
52 0 : En_mp = &E;
53 0 : Bn_mp = &B;
54 0 : }
55 :
56 : /*!
57 : * Solve the electromagnetic problem (Maxwell's eqs)
58 : */
59 : virtual void solve() = 0;
60 :
61 0 : virtual ~Maxwell() {}
62 :
63 : protected:
64 : // Field for four-current (rho, J)
65 : SourceField* JN_mp = nullptr;
66 :
67 : // E and B fields
68 : EMField* En_mp = nullptr;
69 : EMField* Bn_mp = nullptr;
70 : };
71 : } // namespace ippl
72 :
73 : #endif
|