Skip to content

Commit c5eed4f

Browse files
temp 1d injector and new 1dsr pgen
1 parent 2314b87 commit c5eed4f

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

pgens/1d_polar_cap/pgen.hpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace user {
1919

2020
template <Dimension D>
2121
struct InitFields {
22-
InitFields(real_t b0_, real_t rho_GJ_, real_t xsurf_, real_t ds_)
22+
InitFields(real_t b0_, real_t coeff_, real_t xsurf_, real_t ds_)
2323
: b0 { b0_ }
24-
, rho_GJ { rho_GJ_ }
24+
, coeff { coeff_ }
2525
, xsurf { xsurf_ }
2626
, ds { ds_ }{}
2727

@@ -30,18 +30,21 @@ namespace user {
3030
}
3131

3232
Inline auto ex1(const coord_t<D>& x_Ph) const -> real_t {
33-
if (x_Ph[0] < xsurf + ds){
33+
if (x_Ph[0] < xsurf + ds ){
3434
return ZERO;
35+
}else if (x_Ph[0] > xsurf + 1.33 * ds){
36+
return -coeff * (x_Ph[0] - xsurf - ds * (ONE + 0.03 * math::log(1.01) - 0.33 * math::log(0.01 + math::exp(-11.0 / ds))));
37+
3538
}else{
36-
// return -rho_GJ * (x_Ph[0] - xsurf - ds
37-
// + 0.03 * ds * math::log(0.01 + math::exp((xsurf + 1.0 * ds - x_Ph[0]) / 0.03 / ds))
38-
// - 0.03 * ds * math::log(0.01 + 1.0));
39-
return -rho_GJ * (x_Ph[0] - xsurf - ds);
39+
return -coeff * (x_Ph[0] - xsurf - ds
40+
+ 0.03 * ds * math::log(0.01 + math::exp((xsurf + 1.0 * ds - x_Ph[0]) / 0.03 / ds))
41+
- 0.03 * ds * math::log(0.01 + ONE));
42+
//return -coeff * (x_Ph[0] - xsurf - ds);
4043
}
4144
}
4245

4346
private:
44-
const real_t b0, rho_GJ, xsurf, ds;
47+
const real_t b0, coeff, xsurf, ds;
4548
};
4649

4750
template <Dimension D>
@@ -105,11 +108,14 @@ namespace user {
105108
, ds { ds_ } {}
106109

107110
Inline auto operator()(const coord_t<M::Dim>& x_Ph) const -> real_t {
108-
if (xsurf < x_Ph[0] and x_Ph[0] <= xsurf + ds){
109-
return ONE;
110-
}else{
111-
// return ONE - 0.01 / (0.01 + math::exp(-(x_Ph[0] - xsurf - 1.0 * ds) / 0.03 / ds));
111+
if ( x_Ph[0] < xsurf or x_Ph[0] > 1.33 * ds + xsurf){
112112
return ZERO;
113+
}else{
114+
if (x_Ph[0] < ds + xsurf){
115+
return ONE;
116+
}else{
117+
return ONE - 0.01 / (0.01 + math::exp(-(x_Ph[0] - xsurf - 1.0 * ds) / 0.03 / ds));
118+
}
113119
}
114120
}
115121
}; // ExtraCharge
@@ -175,7 +181,7 @@ namespace user {
175181
}())
176182
//, l_atm { ZERO }
177183
// , init_flds(b0, TWO * FOUR * constant::PI * b0 * Omega * SQR(skindepth0) / larmor0, l_atm, ds)
178-
, init_flds(b0, ONE, xsurf, ds)
184+
, init_flds(b0, larmor0 / SQR(skindepth0), xsurf, ds)
179185
, ext_current(j0)
180186
{}
181187

src/kernels/injectors.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,13 @@ namespace kernel {
693693
energy_dist(x_Ph, v_T, spidx1);
694694
metric.template transform_xyz<Idx::T, Idx::XYZ>(x_Cd, v_T, v_XYZ);
695695
ux1s_1(index + offset1) = v_XYZ[0];
696-
ux2s_1(index + offset1) = v_XYZ[1];
697-
ux3s_1(index + offset1) = v_XYZ[2];
696+
ux2s_1(index + offset1) = ZERO;
697+
ux3s_1(index + offset1) = ZERO;
698698
energy_dist(x_Ph, v_T, spidx2);
699699
metric.template transform_xyz<Idx::T, Idx::XYZ>(x_Cd, v_T, v_XYZ);
700700
ux1s_2(index + offset2) = v_XYZ[0];
701-
ux2s_2(index + offset2) = v_XYZ[1];
702-
ux3s_2(index + offset2) = v_XYZ[2];
701+
ux2s_2(index + offset2) = ZERO;
702+
ux3s_2(index + offset2) = ZERO;
703703

704704
tags_1(index + offset1) = ParticleTag::alive;
705705
tags_2(index + offset2) = ParticleTag::alive;

0 commit comments

Comments
 (0)