Skip to content

Commit

Permalink
flexible ref ratio for add plasma
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Apr 9, 2024
1 parent 2674acc commit 1bb6369
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,15 +983,15 @@ PhysicalParticleContainer::AddPlasma (PlasmaInjector const& plasma_injector, int
if (WarpX::refineAddplasma)
{
refineplasma = true;
rrfac = m_gdb->refRatio(0);
}
auto fineba = ParticleBoxArray(1);
auto coarsened_fineba = fineba;
coarsened_fineba.coarsen(rrfac);
if (!refinepatch_locator.isValid(coarsened_fineba)) {
refinepatch_locator.build(coarsened_fineba, Geom(0));
rrfac = WarpX::AddplasmaRefRatio;
auto fineba = ParticleBoxArray(1);
auto coarsened_fineba = fineba;
coarsened_fineba.coarsen(m_gdb->refRatio(0));
if (!refinepatch_locator.isValid(coarsened_fineba)) {
refinepatch_locator.build(coarsened_fineba, Geom(0));
}
refinepatch_locator.setGeometry(Geom(0));
}
refinepatch_locator.setGeometry(Geom(0));
auto assignpartgrid = refinepatch_locator.getGridAssignor();
// if assign_grid(ijk_vec) > 0, then we are in refinement patch. therefore refine plasma particles
// else, usual num_part
Expand Down
1 change: 1 addition & 0 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ public:
static bool do_dynamic_scheduling;
static bool refine_plasma;
static bool refineAddplasma;
static amrex::IntVect AddplasmaRefRatio;

static utils::parser::IntervalsParser sort_intervals;
static amrex::IntVect sort_bin_size;
Expand Down
17 changes: 17 additions & 0 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ bool WarpX::use_filter_compensation = false;
bool WarpX::serialize_initial_conditions = false;
bool WarpX::refine_plasma = false;
bool WarpX::refineAddplasma = false;
amrex::IntVect WarpX::AddplasmaRefRatio(AMREX_D_DECL(1,1,1));

int WarpX::num_mirrors = 0;

Expand Down Expand Up @@ -887,6 +888,22 @@ WarpX::ReadParameters ()
pp_warpx.query("serialize_initial_conditions", serialize_initial_conditions);
pp_warpx.query("refine_plasma", refine_plasma);
pp_warpx.query("refineAddplasma", refineAddplasma);
amrex::Vector<int> addplasma_ref_ratio(AMREX_SPACEDIM,1);
const bool addplasma_ref_ratio_specified =
utils::parser::queryArrWithParser(
pp_warpx, "refineplasma_refratio",
addplasma_ref_ratio, 0, AMREX_SPACEDIM);
if (addplasma_ref_ratio_specified){
amrex::Print() << " refratio for addplasma is : ";
for (int i=0; i<AMREX_SPACEDIM; i++) {
AddplasmaRefRatio[i] = addplasma_ref_ratio[i];
amrex::Print() << " " << AddplasmaRefRatio[i];
}
amrex::Print() << "\n";
} else {
AddplasmaRefRatio = RefRatio[0];
}

pp_warpx.query("do_dive_cleaning", do_dive_cleaning);
pp_warpx.query("do_divb_cleaning", do_divb_cleaning);
utils::parser::queryWithParser(
Expand Down

0 comments on commit 1bb6369

Please sign in to comment.