aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/VelocityProperties.H
blob: e9e6362bf35cfd798c286649b4a433862a75ad6e (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
/* Copyright 2021 Hannah Klion
 *
 * This file is part of WarpX.
 *
 * License: BSD-3-Clause-LBNL
 */

#ifndef VELOCITY_PROPERTIES_H_
#define VELOCITY_PROPERTIES_H_

#include <Utils/WarpXUtil.H>

#include <AMReX_ParmParse.H>
#include <AMReX_Parser.H>
#include <AMReX_REAL.H>

/* Type of velocity initialization. Used by VelocityProperties and GetVelocity. */
enum VelocityInitType {VelConstantValue, VelParserFunction};

/**
 * \brief Struct to store velocity properties, for use in momentum initialization.
 *
 * Reads in and stores velocity used to initialize the Maxwell-Boltzmann and Maxwell-Juttner
 * momentum distributions in InjectorMomentum. The information is read from the parameters of
 * the species being initialized, and will be accessed by GetVelocity.
 */
struct VelocityProperties
{
    /**
     * \brief Read runtime parameters to populate constant or spatially-varying velocity
     * information
     *
     * Construct VelocityProperties based on the passed parameters.
     * If velocity is a constant, store value. If a parser, make and
     * store the parser function
     *
     * \param[in] pp: Reference to the parameter parser object for the species being initialized
     */
    VelocityProperties (amrex::ParmParse& pp);

    /* Type of velocity initialization */
    VelocityInitType m_type;

    /* Velocity direction */
    int m_dir; // Index x=0, y=1, z=2
    int m_sign_dir; // Sign of the velocity direction positive=1, negative=-1

    /* Constant velocity value, if m_type == VelConstantValue */
    amrex::Real m_velocity;
    /* Storage of the parser function, if m_type == VelParserFunction */
    std::unique_ptr<amrex::Parser> m_ptr_velocity_parser;
};

#endif