aboutsummaryrefslogtreecommitdiff
path: root/Source/Filter/NCIGodfreyFilter.H
blob: 18b93189d7637ac162a96326cf2b7b0ceee205f1 (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
/* Copyright 2019 Maxence Thevenet
 *
 * This file is part of WarpX.
 *
 * License: BSD-3-Clause-LBNL
 */
#ifndef WARPX_GODFREY_FILTER_H_
#define WARPX_GODFREY_FILTER_H_

#include "NCIGodfreyFilter_fwd.H"

#include "Filter.H"

#include <AMReX_REAL.H>

enum class godfrey_coeff_set { Ex_Ey_Bz=0, Bx_By_Ez=1 };

/**
 * \brief Class for Godrey's filter to suppress Numerical Cherenkov Instability
 *
 * It derives from the base class Filter.
 * The filter stencil is initialized in method ComputeStencils. Computing the
 * stencil requires to read parameters from a table, where each lines stands
 * for a value of c*dt/dz.
 * The filter is applied using the base class' method ApplyStencil.
 */
class NCIGodfreyFilter : public Filter
{
public:

    NCIGodfreyFilter () = default;

    NCIGodfreyFilter(godfrey_coeff_set coeff_set, amrex::Real cdtodz,
                     bool nodal_gather);

    void ComputeStencils();

    static constexpr int m_stencil_width = 4;

private:

    // Set of coefficients (different fields require to read
    // different coefficients from the table)
    godfrey_coeff_set m_coeff_set;
    // The stencil depends on parameter c*dt/dz
    amrex::Real m_cdtodz;
    // Whether the gather is from nodal fields or staggered fields
    bool m_nodal_gather;
};

#endif // #ifndef WARPX_GODFREY_FILTER_H_