WarpX
Loading...
Searching...
No Matches
GetVelocity.H
Go to the documentation of this file.
1/* Copyright 2021 Hannah Klion
2 *
3 * This file is part of WarpX.
4 *
5 * License: BSD-3-Clause-LBNL
6 */
7
8#ifndef WARPX_GET_VELOCITY_H_
9#define WARPX_GET_VELOCITY_H_
10
11#include "VelocityProperties.H"
12
21{
22 /* Type of velocity initialization */
24
25 /* Velocity direction */
26 int m_dir;
28
33
40 explicit GetVelocity (VelocityProperties const& vel) noexcept;
41
54 amrex::Real operator() (amrex::Real const x, amrex::Real const y, amrex::Real const z) const noexcept
55 {
56 switch (m_type)
57 {
58 case (VelConstantValue):
59 {
60 return m_sign_dir * m_velocity;
61 }
62 case (VelParserFunction):
63 {
64 return m_sign_dir * m_velocity_parser(x,y,z);
65 }
66 default:
67 {
68 amrex::Abort("Get initial velocity: unknown type");
69 return 0.0;
70 }
71 }
72 }
73
82 [[nodiscard]]
84 int direction () const noexcept
85 {
86 return m_dir;
87 }
88};
89
91{
92 /* Type of velocity initialization */
94
105 explicit GetVelocityVector (VelocityProperties const& vel) noexcept;
106
119 amrex::XDim3 operator() (amrex::Real const x, amrex::Real const y, amrex::Real const z) const noexcept
120 {
121 switch (m_type)
122 {
123 case (VelConstantVector):
124 {
126 }
128 {
129 return amrex::XDim3{ m_ux_mean_parser(x,y,z), m_uy_mean_parser(x,y,z), m_uz_mean_parser(x,y,z) };
130 }
131 default:
132 {
133 amrex::Abort("Get initial velocity: unknown type");
134 return amrex::XDim3{0.0, 0.0, 0.0};
135 }
136 }
137 }
138};
139
140#endif //WARPX_GET_VELOCITY_H_
#define AMREX_GPU_HOST_DEVICE
VelocityInitType
Definition VelocityProperties.H:16
@ VelConstantValue
Definition VelocityProperties.H:16
@ VelParserFunctionVector
Definition VelocityProperties.H:16
@ VelConstantVector
Definition VelocityProperties.H:16
@ VelParserFunction
Definition VelocityProperties.H:16
amrex_real Real
void Abort(const std::string &msg)
AMREX_GPU_HOST_DEVICE int direction() const noexcept
Returns the index of the direction of the bulk velocity.
Definition GetVelocity.H:84
int m_dir
Definition GetVelocity.H:26
int m_sign_dir
Index x=0, y=1, z=2.
Definition GetVelocity.H:27
VelocityInitType m_type
Definition GetVelocity.H:23
amrex::ParserExecutor< 3 > m_velocity_parser
Definition GetVelocity.H:32
AMREX_GPU_HOST_DEVICE amrex::Real operator()(amrex::Real const x, amrex::Real const y, amrex::Real const z) const noexcept
Functor call. Returns the value of velocity at the location (x,y,z)
Definition GetVelocity.H:54
amrex::Real m_velocity
Sign of the velocity direction positive=1, negative=-1.
Definition GetVelocity.H:30
GetVelocity(VelocityProperties const &vel) noexcept
Construct the functor with information provided by vel.
Definition GetVelocity.cpp:10
amrex::Real m_uz_mean
Definition GetVelocity.H:96
AMREX_GPU_HOST_DEVICE amrex::XDim3 operator()(amrex::Real const x, amrex::Real const y, amrex::Real const z) const noexcept
Functor call. Returns the value of velocity at the location (x,y,z)
Definition GetVelocity.H:119
VelocityInitType m_type
Definition GetVelocity.H:93
amrex::Real m_uy_mean
Definition GetVelocity.H:96
amrex::Real m_ux_mean
Definition GetVelocity.H:96
amrex::ParserExecutor< 3 > m_uz_mean_parser
Definition GetVelocity.H:98
amrex::ParserExecutor< 3 > m_uy_mean_parser
Definition GetVelocity.H:98
amrex::ParserExecutor< 3 > m_ux_mean_parser
Definition GetVelocity.H:98
GetVelocityVector(VelocityProperties const &vel) noexcept
Construct the functor with information provided by vel.
Definition GetVelocity.cpp:21
Struct to store velocity properties, for use in momentum initialization.
Definition VelocityProperties.H:26