aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/ParticleBoundaries.H
blob: 00b6368a5eae3257b758c5d8345dcd1eddad5148 (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
/* Copyright 2021 David Grote
 *
 * This file is part of WarpX.
 *
 * License: BSD-3-Clause-LBNL
 */
#ifndef PARTICLEBOUNDARIES_H_
#define PARTICLEBOUNDARIES_H_

#include "Utils/WarpXAlgorithmSelection.H"
#include "Utils/WarpXUtil.H"

#include <AMReX_AmrCore.H>
#include <AMReX_Parser.H>

/**
 *  This allows a different boundary condition on each edge of the grid.
 */
struct ParticleBoundaries
{

    ParticleBoundaries () noexcept;

    void Set_reflect_all_velocities (bool flag);
    void SetAll (ParticleBoundaryType bc);

    void SetBoundsX (ParticleBoundaryType bc_lo, ParticleBoundaryType bc_hi);
    void SetBoundsY (ParticleBoundaryType bc_lo, ParticleBoundaryType bc_hi);
    void SetBoundsZ (ParticleBoundaryType bc_lo, ParticleBoundaryType bc_hi);

    bool CheckAll (ParticleBoundaryType bc);

    void BuildReflectionModelParsers ();

    // reflection models for absorbing boundaries
    std::string reflection_model_xlo_str = "0.0";
    std::string reflection_model_xhi_str = "0.0";
    std::string reflection_model_ylo_str = "0.0";
    std::string reflection_model_yhi_str = "0.0";
    std::string reflection_model_zlo_str = "0.0";
    std::string reflection_model_zhi_str = "0.0";

    std::unique_ptr<amrex::Parser> reflection_model_xlo_parser;
    std::unique_ptr<amrex::Parser> reflection_model_xhi_parser;
    std::unique_ptr<amrex::Parser> reflection_model_ylo_parser;
    std::unique_ptr<amrex::Parser> reflection_model_yhi_parser;
    std::unique_ptr<amrex::Parser> reflection_model_zlo_parser;
    std::unique_ptr<amrex::Parser> reflection_model_zhi_parser;

    struct ParticleBoundariesData {

        ParticleBoundaryType xmin_bc;
        ParticleBoundaryType xmax_bc;
        ParticleBoundaryType ymin_bc;
        ParticleBoundaryType ymax_bc;
        ParticleBoundaryType zmin_bc;
        ParticleBoundaryType zmax_bc;

        amrex::ParserExecutor<1> reflection_model_xlo;
        amrex::ParserExecutor<1> reflection_model_xhi;
        amrex::ParserExecutor<1> reflection_model_ylo;
        amrex::ParserExecutor<1> reflection_model_yhi;
        amrex::ParserExecutor<1> reflection_model_zlo;
        amrex::ParserExecutor<1> reflection_model_zhi;

        bool reflect_all_velocities;
    };
    ParticleBoundariesData data;

};
#endif /*PARTICLEBOUNDARIES_H_*/