Skip to content

Commit 649da53

Browse files
minor ajustment
1 parent e9a124a commit 649da53

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

pgens/BZjet/pgen.hpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ namespace user {
201201
, d0 { params.template get<real_t>("scales.skindepth0") }
202202
, rho0 { params.template get<real_t>("scales.larmor0") }
203203
, inv_n0 { ONE / params.template get<real_t>("scales.n0") }
204-
, inv_ppc0 { ONE / params.template get<real_t>("particles.ppc0") }
204+
, ppc0 { params.template get<real_t>("particles.ppc0") }
205205
, inj_coeff { inj_coeff }
206206
, is_weight { is_weight } {
207207
std::copy(xi_min.begin(), xi_min.end(), x_min);
@@ -270,26 +270,27 @@ namespace user {
270270
for (auto d = 0u; d < M::Dim; ++d) {
271271
fill &= x_Ph[d] > x_min[d] and x_Ph[d] < x_max[d] and sigma_crit(x_Ph);
272272
}
273-
coord_t<M::Dim> xi { ZERO };
274-
metric.template convert<Crd::Ph, Crd::Cd>(x_Ph, xi);
275-
const auto i1 = static_cast<int>(xi[0]) + static_cast<int>(N_GHOSTS);
276-
const auto i2 = static_cast<int>(xi[1]) + static_cast<int>(N_GHOSTS);
277-
const vec_t<Dim::_3D> B_cntrv { EM(i1, i2, em::bx1),
278-
EM(i1, i2, em::bx2),
279-
EM(i1, i2, em::bx3) };
280-
const vec_t<Dim::_3D> D_cntrv { EM(i1, i2, em::dx1),
281-
EM(i1, i2, em::dx2),
282-
EM(i1, i2, em::dx3) };
283-
vec_t<Dim::_3D> B_cov { ZERO };
284-
metric.template transform<Idx::U, Idx::D>(xi, B_cntrv, B_cov);
285-
const auto bsqr =
286-
DOT(B_cntrv[0], B_cntrv[1], B_cntrv[2], B_cov[0], B_cov[1], B_cov[2]);
287-
const auto db = DOT(D_cntrv[0], D_cntrv[1], D_cntrv[2], B_cov[0], B_cov[1], B_cov[2]);
288-
const real_t inj_n = inj_coeff * db * SIGN(db) / math::sqrt(bsqr) * SQR(d0) / rho0;
289273
if (is_weight) {
290-
return fill ? inj_n : ZERO;
274+
coord_t<M::Dim> xi { ZERO };
275+
metric.template convert<Crd::Ph, Crd::Cd>(x_Ph, xi);
276+
const auto i1 = static_cast<int>(xi[0]) + static_cast<int>(N_GHOSTS);
277+
const auto i2 = static_cast<int>(xi[1]) + static_cast<int>(N_GHOSTS);
278+
const vec_t<Dim::_3D> B_cntrv { EM(i1, i2, em::bx1),
279+
EM(i1, i2, em::bx2),
280+
EM(i1, i2, em::bx3) };
281+
const vec_t<Dim::_3D> D_cntrv { EM(i1, i2, em::dx1),
282+
EM(i1, i2, em::dx2),
283+
EM(i1, i2, em::dx3) };
284+
vec_t<Dim::_3D> B_cov { ZERO };
285+
metric.template transform<Idx::U, Idx::D>(xi, B_cntrv, B_cov);
286+
const auto bsqr =
287+
DOT(B_cntrv[0], B_cntrv[1], B_cntrv[2], B_cov[0], B_cov[1], B_cov[2]);
288+
const auto db = DOT(D_cntrv[0], D_cntrv[1], D_cntrv[2], B_cov[0], B_cov[1], B_cov[2]);
289+
const real_t inj_n = inj_coeff * db * SIGN(db) / math::sqrt(bsqr) * SQR(d0) / rho0;
290+
291+
return fill ? inj_n * ppc0: ZERO;
291292
} else {
292-
return fill ? TWO * inv_ppc0 * 1.01 : ZERO;
293+
return fill ? TWO / ppc0 * 1.01 : ZERO;
293294
}
294295
}
295296

@@ -302,7 +303,7 @@ namespace user {
302303
const real_t inv_n0;
303304
const real_t d0;
304305
const real_t rho0;
305-
const real_t inv_ppc0;
306+
const real_t ppc0;
306307
Domain<S, M>* domain_ptr;
307308
ndfield_t<M::Dim, 3> density;
308309
ndfield_t<M::Dim, 6> EM;

0 commit comments

Comments
 (0)