aboutsummaryrefslogtreecommitdiff
path: root/Source/BoundaryConditions/PML_RZ.H
blob: 72c901bf480cc076bd7de075bfcbc96a6311ed0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Copyright 2021 David Grote
 *
 *
 * This file is part of WarpX.
 *
 * License: BSD-3-Clause-LBNL
 */
#ifndef WARPX_PML_RZ_H_
#define WARPX_PML_RZ_H_

#include "PML_RZ_fwd.H"

#ifdef WARPX_USE_PSATD
#   include "FieldSolver/SpectralSolver/SpectralSolverRZ.H"
#endif

#include <AMReX_MultiFab.H>
#include <AMReX_BoxArray.H>
#include <AMReX_Config.H>
#include <AMReX_REAL.H>

#include <AMReX_BaseFwd.H>

#include <array>
#include <string>

enum struct PatchType : int;

class PML_RZ
{
public:
    PML_RZ (int lev, const amrex::BoxArray& grid_ba, const amrex::DistributionMapping& grid_dm,
            const amrex::Geometry* geom, int ncell, int do_pml_in_domain);

    void ApplyDamping(amrex::MultiFab* Et_fp, amrex::MultiFab* Ez_fp,
                      amrex::MultiFab* Bt_fp, amrex::MultiFab* Bz_fp,
                      amrex::Real dt);

    std::array<amrex::MultiFab*,2> GetE_fp ();
    std::array<amrex::MultiFab*,2> GetB_fp ();

#ifdef WARPX_USE_PSATD
    void PushPSATD (int lev);
#endif

    void FillBoundaryE ();
    void FillBoundaryB ();
    void FillBoundaryE (PatchType patch_type);
    void FillBoundaryB (PatchType patch_type);

    void CheckPoint (const std::string& dir) const;
    void Restart (const std::string& dir);

    ~PML_RZ () = default;

private:

    const int m_ncell;
    const int m_do_pml_in_domain;
    const amrex::Geometry* m_geom;

    // Only contains Er and Et, and Br and Bt
    std::array<std::unique_ptr<amrex::MultiFab>,2> pml_E_fp;
    std::array<std::unique_ptr<amrex::MultiFab>,2> pml_B_fp;

#ifdef WARPX_USE_PSATD
    void PushPMLPSATDSinglePatchRZ ( int lev,
                SpectralSolverRZ& solver,
                std::array<std::unique_ptr<amrex::MultiFab>,2>& pml_E,
                std::array<std::unique_ptr<amrex::MultiFab>,2>& pml_B);
#endif

};

#endif