9 #ifndef INJECTOR_DENSITY_H_ 10 #define INJECTOR_DENSITY_H_ 16 #include <AMReX_Gpu.H> 17 #include <AMReX_Dim3.H> 26 getDensity (amrex::Real, amrex::Real, amrex::Real)
const noexcept
39 : m_parser(a_parser) {}
43 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
45 return m_parser(
x,y,
z);
61 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
67 case Profile::parabolic_channel:
75 double z_start = p[0];
76 double ramp_up = p[1];
77 double plateau = p[2];
78 double ramp_down = p[3];
82 double kp = PhysConst::q_e/PhysConst::c
83 *std::sqrt( n0/(PhysConst::m_e*PhysConst::ep0) );
86 if ((
z-z_start)>=0 and
87 (
z-z_start)<ramp_up ) {
88 n = 0.5*(1.-std::cos(MathConst::pi*(
z-z_start)/ramp_up));
89 }
else if ((
z-z_start)>=ramp_up and
90 (
z-z_start)< ramp_up+plateau ) {
92 }
else if ((
z-z_start)>=ramp_up+plateau and
93 (
z-z_start)< ramp_up+plateau+ramp_down) {
94 n = 0.5*(1.+std::cos(MathConst::pi*((
z-z_start)-ramp_up-plateau)/ramp_down));
99 n *= n0*(1.+4.*(
x*
x+y*y)/(kp*kp*rc*rc*rc*rc));
103 amrex::Abort(
"InjectorDensityPredefined: how did we get here?");
109 enum struct Profile { null, parabolic_channel };
111 amrex::GpuArray<amrex::Real,6>
p;
140 object(t,a_species_name)
146 object(t,a_species_name)
160 AMREX_GPU_HOST_DEVICE
162 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
168 return object.parser.getDensity(
x,y,
z);
172 return object.constant.getDensity(
x,y,
z);
176 return object.custom.getDensity(
x,y,
z);
178 case Type::predefined:
180 return object.predefined.getDensity(
x,y,
z);
184 amrex::Abort(
"InjectorDensity: unknown type");
202 : custom(a_species_name) {}
204 : predefined(a_species_name) {}
InjectorDensity(InjectorDensityParser *t, WarpXParser const &a_parser)
Definition: InjectorDensity.H:132
Type type
Definition: InjectorDensity.H:192
InjectorDensity(InjectorDensityCustom *t, std::string const &a_species_name)
Definition: InjectorDensity.H:138
GpuParser< 3 > m_parser
Definition: InjectorDensity.H:49
Definition: InjectorDensity.H:196
void clear()
Definition: InjectorDensity.cpp:14
parser
Definition: run_alltests.py:107
Type
Definition: InjectorDensity.H:191
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:43
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:61
def x
Definition: read_lab_particles.py:25
Object(InjectorDensityConstant *, amrex::Real a_rho) noexcept
Definition: InjectorDensity.H:197
Definition: InjectorDensity.H:215
InjectorDensityConstant constant
Definition: InjectorDensity.H:205
Object(InjectorDensityParser *, WarpXParser const &a_parser) noexcept
Definition: InjectorDensity.H:199
amrex::Real m_rho
Definition: InjectorDensity.H:32
def z
Definition: read_lab_particles.py:26
InjectorDensityPredefined predefined
Definition: InjectorDensity.H:208
InjectorDensity(InjectorDensityPredefined *t, std::string const &a_species_name)
Definition: InjectorDensity.H:144
Definition: CustomDensityProb.H:19
Definition: InjectorDensity.H:36
InjectorDensityCustom custom
Definition: InjectorDensity.H:207
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorDensity.H:26
int n
Definition: run_libensemble_on_warpx.py:68
Object(InjectorDensityPredefined *, std::string const &a_species_name) noexcept
Definition: InjectorDensity.H:203
Profile profile
Definition: InjectorDensity.H:110
type
Definition: run_alltests_1node.py:67
InjectorDensityParser parser
Definition: InjectorDensity.H:206
Definition: InjectorDensity.H:53
Profile
Definition: InjectorDensity.H:109
Definition: WarpXParser.H:26
amrex::GpuArray< amrex::Real, 6 > p
Definition: InjectorDensity.H:111
Object(InjectorDensityCustom *, std::string const &a_species_name) noexcept
Definition: InjectorDensity.H:201
InjectorDensityConstant(amrex::Real a_rho) noexcept
Definition: InjectorDensity.H:22
Definition: InjectorDensity.H:20
InjectorDensityParser(WarpXParser const &a_parser) noexcept
Definition: InjectorDensity.H:38
Object object
Definition: InjectorDensity.H:210
InjectorDensity(InjectorDensityConstant *t, amrex::Real a_rho)
Definition: InjectorDensity.H:126
Definition: InjectorDensity.H:123
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:162