9 #ifndef INJECTOR_DENSITY_H_ 10 #define INJECTOR_DENSITY_H_ 16 #include <AMReX_Array.H> 17 #include <AMReX_GpuQualifiers.H> 18 #include <AMReX_Math.H> 19 #include <AMReX_Parser.H> 20 #include <AMReX_REAL.H> 32 getDensity (amrex::Real, amrex::Real, amrex::Real)
const noexcept
45 : m_parser(a_parser) {}
49 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
51 return m_parser(
x,y,
z);
66 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
72 case Profile::parabolic_channel:
80 double z_start = p[0];
81 double ramp_up = p[1];
82 double plateau = p[2];
83 double ramp_down = p[3];
87 double kp = PhysConst::q_e/PhysConst::c
88 *std::sqrt( n0/(PhysConst::m_e*PhysConst::ep0) );
91 if ((
z-z_start)>=0 and
92 (
z-z_start)<ramp_up ) {
93 n = 0.5*(1.-std::cos(MathConst::pi*(
z-z_start)/ramp_up));
94 }
else if ((
z-z_start)>=ramp_up and
95 (
z-z_start)< ramp_up+plateau ) {
97 }
else if ((
z-z_start)>=ramp_up+plateau and
98 (
z-z_start)< ramp_up+plateau+ramp_down) {
99 n = 0.5*(1.+std::cos(MathConst::pi*((
z-z_start)-ramp_up-plateau)/ramp_down));
104 n *= n0*(1.+4.*(
x*
x+y*y)/(kp*kp*rc*rc*rc*rc));
105 return static_cast<amrex::Real
>(
n);
108 amrex::Abort(
"InjectorDensityPredefined: how did we get here?");
109 return amrex::Real(0.0);
114 enum struct Profile { null, parabolic_channel };
116 amrex::GpuArray<amrex::Real,6>
p;
145 object(t,a_species_name)
151 object(t,a_species_name)
165 AMREX_GPU_HOST_DEVICE
167 getDensity (amrex::Real
x, amrex::Real y, amrex::Real
z)
const noexcept
173 return object.parser.getDensity(
x,y,
z);
177 return object.constant.getDensity(
x,y,
z);
181 return object.custom.getDensity(
x,y,
z);
183 case Type::predefined:
185 return object.predefined.getDensity(
x,y,
z);
189 amrex::Abort(
"InjectorDensity: unknown type");
207 : custom(a_species_name) {}
209 : predefined(a_species_name) {}
Type type
Definition: InjectorDensity.H:197
InjectorDensity(InjectorDensityCustom *t, std::string const &a_species_name)
Definition: InjectorDensity.H:143
Definition: InjectorDensity.H:201
void clear()
Definition: InjectorDensity.cpp:22
parser
Definition: run_alltests.py:107
Type
Definition: InjectorDensity.H:196
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:49
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:66
def x
Definition: read_lab_particles.py:25
Object(InjectorDensityConstant *, amrex::Real a_rho) noexcept
Definition: InjectorDensity.H:202
Definition: InjectorDensity.H:220
InjectorDensityConstant constant
Definition: InjectorDensity.H:210
amrex::Real m_rho
Definition: InjectorDensity.H:38
def z
Definition: read_lab_particles.py:26
InjectorDensityPredefined predefined
Definition: InjectorDensity.H:213
InjectorDensity(InjectorDensityPredefined *t, std::string const &a_species_name)
Definition: InjectorDensity.H:149
Definition: CustomDensityProb.H:21
Definition: InjectorDensity.H:42
InjectorDensityCustom custom
Definition: InjectorDensity.H:212
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorDensity.H:32
int n
Definition: run_libensemble_on_warpx.py:68
Object(InjectorDensityPredefined *, std::string const &a_species_name) noexcept
Definition: InjectorDensity.H:208
Profile profile
Definition: InjectorDensity.H:115
InjectorDensity(InjectorDensityParser *t, amrex::ParserExecutor< 3 > const &a_parser)
Definition: InjectorDensity.H:137
amrex::ParserExecutor< 3 > m_parser
Definition: InjectorDensity.H:54
type
Definition: run_alltests_1node.py:67
InjectorDensityParser parser
Definition: InjectorDensity.H:211
Definition: InjectorDensity.H:58
Profile
Definition: InjectorDensity.H:114
amrex::GpuArray< amrex::Real, 6 > p
Definition: InjectorDensity.H:116
Object(InjectorDensityCustom *, std::string const &a_species_name) noexcept
Definition: InjectorDensity.H:206
InjectorDensityConstant(amrex::Real a_rho) noexcept
Definition: InjectorDensity.H:28
InjectorDensityParser(amrex::ParserExecutor< 3 > const &a_parser) noexcept
Definition: InjectorDensity.H:44
Definition: InjectorDensity.H:26
Object object
Definition: InjectorDensity.H:215
Object(InjectorDensityParser *, amrex::ParserExecutor< 3 > const &a_parser) noexcept
Definition: InjectorDensity.H:204
InjectorDensity(InjectorDensityConstant *t, amrex::Real a_rho)
Definition: InjectorDensity.H:131
Definition: InjectorDensity.H:128
AMREX_GPU_HOST_DEVICE amrex::Real getDensity(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorDensity.H:167