Skip to content

Commit

Permalink
fix cubic profile and add user input for damping strength
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Oct 6, 2023
1 parent 561a34a commit aeb088f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/BoundaryConditions/PML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,23 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, const
sigma_star_cumsum_fac[idim].m_hi = hi[idim]+1;
}

#ifdef PULSAR
int pml_cubic_sigma = Pulsar::m_pml_cubic_sigma;
amrex::Real damping_strength = Pulsar::m_damping_strength;
#endif
Array<Real,AMREX_SPACEDIM> fac;
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
#ifdef PULSAR
if (pml_cubic_sigma == 1) {
fac[idim] = damping_strength * PhysConst::c
/ ( dx[idim]*static_cast<Real>(delta[idim]*delta[idim]*delta[idim]) );
} else {
fac[idim] = damping_strength * PhysConst::c
/ ( dx[idim]*static_cast<Real>(delta[idim]*delta[idim]) );
}
#else
fac[idim] = 4.0_rt*PhysConst::c/(dx[idim]*static_cast<Real>(delta[idim]*delta[idim]));
#endif
}

if (regdomain.ok()) { // The union of the regular grids is a single box
Expand Down
1 change: 1 addition & 0 deletions Source/Particles/PulsarParameters.H
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ public:
static int m_pml_cubic_sigma;
static amrex::Real m_gammarad_real;
static amrex::Real m_gammarad_scaled;
static amrex::Real m_damping_strength;
private:
};

Expand Down
4 changes: 4 additions & 0 deletions Source/Particles/PulsarParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ amrex::Real Pulsar::m_depositbuffer_max = 0.;
int Pulsar::m_pml_cubic_sigma;
amrex::Real Pulsar::m_gammarad_real = 1.;
amrex::Real Pulsar::m_gammarad_scaled = 1.;
amrex::Real Pulsar::m_damping_strength = 4.;

Pulsar::Pulsar ()
{
Expand Down Expand Up @@ -378,6 +379,9 @@ Pulsar::ReadParameters () {
pp.get("pml_cubic_sigma", m_pml_cubic_sigma);
pp.query("gammarad_real", m_gammarad_real);
pp.query("gammarad_scaled", m_gammarad_scaled);
pp.get("damping_strength", m_damping_strength);
amrex::Print() << " damping strength in PML " << m_damping_strength << "\n";
amrex::Print() << " cubic pml flag : " << m_pml_cubic_sigma << "\n";
}


Expand Down

0 comments on commit aeb088f

Please sign in to comment.