aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/PlasmaProfiles.cpp
blob: e3382db06910e5f92a43956e897a91db80ff7086 (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
#include <PlasmaInjector.H>
#include <cmath>
#include <iostream>
#include <WarpXConst.H>

using namespace amrex;

Real PredefinedDensityProfile::getDensity(Real x, Real y, Real z) const {
    Real n;
    if ( which_profile == predefined_profile_flag::parabolic_channel ) {
        n = ParabolicChannel(x,y,z);
    }
    return n;
}

///
/// plateau between linear upramp and downramp, and parab transverse profile
///
Real PredefinedDensityProfile::ParabolicChannel(Real x, Real y, Real z) const {
    //  params = [ramp_up   plateau   ramp_down   rc       n0]
    Real ramp_up   = params[0];
    Real plateau   = params[1];
    Real ramp_down = params[2];
    Real rc        = params[3];
    Real n0        = params[4];
    Real n;
    Real kp = PhysConst::q_e/PhysConst::c*sqrt( n0/(PhysConst::m_e*PhysConst::ep0) );

    if        (z>=0               and z<ramp_up                  ) {
        n = z/ramp_up;
    } else if (z>=ramp_up         and z<ramp_up+plateau          ) {
        n = 1;
    } else if (z>=ramp_up+plateau and z<ramp_up+plateau+ramp_down) {
        n = 1-(z-ramp_up-plateau)/ramp_down;
    } else {
        n = 0;
    }
    n *= n0*(1+4*(x*x+y*y)/(kp*kp*std::pow(rc,4)));
    return n;
}