Skip to content

Commit

Permalink
add rmax for RR scaled
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Dec 21, 2023
1 parent 28c199d commit 0a5ceac
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
16 changes: 12 additions & 4 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,10 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
amrex::Real gather_buffer_boxmin = Pulsar::m_gatherbuffer_min;
amrex::Real gather_buffer_boxmax = Pulsar::m_gatherbuffer_max;
amrex::Real re_scaledratio = 1.;
if (cur_time > Pulsar::m_RR_start_time) { re_scaledratio = Pulsar::m_re_scaledratio;}
amrex::Real scaledRR_rmax = Pulsar::m_scaledRR_rmax;
if (cur_time > Pulsar::m_RR_start_time) {
re_scaledratio = Pulsar::m_re_scaledratio;
}
int do_zero_uperpB_driftframe = 0;
amrex::Real rmax_zero_uperp_driftframe = 0.;
if (cur_time > Pulsar::m_zerouperp_start_time) {
Expand Down Expand Up @@ -3026,7 +3029,9 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
Exp, Eyp, Ezp, Bxp,
Byp, Bzp, qp, m,
#ifdef PULSAR
re_scaledratio, do_zero_uperpB_driftframe, r_p, rmax_zero_uperp_driftframe,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p,
rmax_zero_uperp_driftframe,
#endif
dt);
} else if (pusher_algo == ParticlePusherAlgo::Boris) {
Expand Down Expand Up @@ -3175,6 +3180,7 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
amrex::Real gather_buffer_boxmin = Pulsar::m_gatherbuffer_min;
amrex::Real gather_buffer_boxmax = Pulsar::m_gatherbuffer_max;
amrex::Real re_scaledratio = 1.;
amrex::Real scaledRR_rmax = Pulsar::m_scaledRR_rmax;
if (cur_time > Pulsar::m_RR_start_time) { re_scaledratio = Pulsar::m_re_scaledratio;}
int do_zero_uperpB_driftframe = 0;
amrex::Real rmax_zero_uperp_driftframe = 0.;
Expand Down Expand Up @@ -3433,7 +3439,8 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
t_chi_max,
#endif
#ifdef PULSAR
re_scaledratio, do_zero_uperpB_driftframe, r_p, rmax_zero_uperp_driftframe,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p, rmax_zero_uperp_driftframe,
#endif
dt);
// PulsarPartDiagData);
Expand Down Expand Up @@ -3473,7 +3480,8 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
m, q, pusher_algo, do_crr, do_copy,
t_chi_max,
#ifdef PULSAR
re_scaledratio, do_zero_uperpB_driftframe, r_p, rmax_zero_uperp_driftframe,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p, rmax_zero_uperp_driftframe,
#endif
dt);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Particles/PulsarParameters.H
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ public:
static amrex::Real m_BLC;
static amrex::Real m_beta_rec_RR;
static amrex::Real m_re_scaledratio;
static amrex::Real m_scaledRR_rmax;
static int m_do_zero_uperpB_driftframe;
static amrex::Real m_rmax_zero_uperpB_driftframe;
static amrex::Real m_RR_start_time;
Expand Down
2 changes: 2 additions & 0 deletions Source/Particles/PulsarParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ int Pulsar::m_do_zero_uperpB_driftframe = 0;
amrex::Real Pulsar::m_rmax_zero_uperpB_driftframe;
amrex::Real Pulsar::m_RR_start_time;
amrex::Real Pulsar::m_zerouperp_start_time;
amrex::Real Pulsar::m_scaledRR_rmax;

Pulsar::Pulsar ()
{
Expand Down Expand Up @@ -412,6 +413,7 @@ Pulsar::ReadParameters () {
pp.get("rmax_zero_uperpB_driftframe",m_rmax_zero_uperpB_driftframe);
pp.get("RR_start_time",m_RR_start_time);
pp.get("zerouperp_start_time",m_zerouperp_start_time);
pp.get("scaledRR_rmax",m_scaledRR_rmax);
}


Expand Down
7 changes: 5 additions & 2 deletions Source/Particles/Pusher/PushSelector.H
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void doParticlePush(const GetParticlePosition& GetPosition,
#endif
#ifdef PULSAR
const amrex::Real re_scaledratio,
const amrex::Real scaledRR_rmax,
const int do_zero_uperpB_driftframe,
const amrex::ParticleReal r_p,
const amrex::Real rmax_zero_uperp_driftframe,
Expand Down Expand Up @@ -94,7 +95,8 @@ void doParticlePush(const GetParticlePosition& GetPosition,
Ex, Ey, Ez, Bx,
By, Bz, qp, m,
#ifdef PULSAR
re_scaledratio, do_zero_uperpB_driftframe, r_p,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p,
rmax_zero_uperp_driftframe,
#endif
dt);
Expand Down Expand Up @@ -126,7 +128,8 @@ void doParticlePush(const GetParticlePosition& GetPosition,
Ex, Ey, Ez, Bx,
By, Bz, qp, m,
#ifdef PULSAR
re_scaledratio, do_zero_uperpB_driftframe, r_p,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p,
rmax_zero_uperp_driftframe,
#endif
dt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void UpdateMomentumBorisWithRadiationReaction(
const amrex::ParticleReal q, const amrex::ParticleReal m,
#ifdef PULSAR
const amrex::Real re_scaledratio,
const amrex::Real scaledRR_rmax,
const int do_zero_uperpB_driftframe,
const amrex::ParticleReal r_p,
const amrex::Real rmax_zero_uperpB_driftframe,
Expand Down Expand Up @@ -108,9 +109,11 @@ void UpdateMomentumBorisWithRadiationReaction(
RRcoeff*(PhysConst::c*(flx_q*By - fly_q*Bx) + bdotE*Ez - coeff*bz_n);

//Update momentum using the RR force
ux += frx*dt;
uy += fry*dt;
uz += frz*dt;
if (r_p < scaledRR_rmax) {
ux += frx*dt;
uy += fry*dt;
uz += frz*dt;
}
}

#endif // WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_BORIS_WITHRR_H_
3 changes: 2 additions & 1 deletion Source/Particles/RigidInjectedParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,

#ifdef PULSAR
amrex::Real re_scaledratio = Pulsar::m_re_scaledratio;
amrex::Real scaledRR_rmax = Pulsar::m_scaledRR_rmax;
int do_zero_uperpB_driftframe = Pulsar::m_do_zero_uperpB_driftframe;
amrex::Real rmax_zero_uperp_driftframe = Pulsar::m_rmax_zero_uperpB_driftframe;
#endif
Expand Down Expand Up @@ -445,7 +446,7 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,
Exp, Eyp, Ezp, Bxp,
Byp, Bzp, qp, m,
#ifdef PULSAR
re_scaledratio,
re_scaledratio, scaledRR_rmax,
do_zero_uperpB_driftframe, r_p,
rmax_zero_uperp_driftframe,
#endif
Expand Down

0 comments on commit 0a5ceac

Please sign in to comment.