Skip to content

Commit

Permalink
Rename current_fp/current_cp to j_fp/j_cp
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Sep 24, 2024
1 parent 0337ee1 commit 4915959
Show file tree
Hide file tree
Showing 38 changed files with 279 additions and 279 deletions.
24 changes: 12 additions & 12 deletions Python/pywarpx/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,19 +616,19 @@ def BzWrapper(level=0, include_ghosts=False):

def JxWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=0, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=0, level=level, include_ghosts=include_ghosts
)


def JyWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=1, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=1, level=level, include_ghosts=include_ghosts
)


def JzWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=2, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=2, level=level, include_ghosts=include_ghosts
)


Expand Down Expand Up @@ -706,19 +706,19 @@ def BzFPExternalWrapper(level=0, include_ghosts=False):

def JxFPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=0, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=0, level=level, include_ghosts=include_ghosts
)


def JyFPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=1, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=1, level=level, include_ghosts=include_ghosts
)


def JzFPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_fp", idir=2, level=level, include_ghosts=include_ghosts
mf_name="j_fp", idir=2, level=level, include_ghosts=include_ghosts
)


Expand Down Expand Up @@ -807,19 +807,19 @@ def BzCPWrapper(level=0, include_ghosts=False):

def JxCPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_cp", idir=0, level=level, include_ghosts=include_ghosts
mf_name="j_cp", idir=0, level=level, include_ghosts=include_ghosts
)


def JyCPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_cp", idir=1, level=level, include_ghosts=include_ghosts
mf_name="j_cp", idir=1, level=level, include_ghosts=include_ghosts
)


def JzCPWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="current_cp", idir=2, level=level, include_ghosts=include_ghosts
mf_name="j_cp", idir=2, level=level, include_ghosts=include_ghosts
)


Expand Down Expand Up @@ -875,7 +875,7 @@ def FaceAreaszWrapper(level=0, include_ghosts=False):

def JxFPAmpereWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="hybrid_current_fp_ampere",
mf_name="hybrid_j_fp_ampere",
idir=0,
level=level,
include_ghosts=include_ghosts,
Expand All @@ -884,7 +884,7 @@ def JxFPAmpereWrapper(level=0, include_ghosts=False):

def JyFPAmpereWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="hybrid_current_fp_ampere",
mf_name="hybrid_j_fp_ampere",
idir=1,
level=level,
include_ghosts=include_ghosts,
Expand All @@ -893,7 +893,7 @@ def JyFPAmpereWrapper(level=0, include_ghosts=False):

def JzFPAmpereWrapper(level=0, include_ghosts=False):
return _MultiFABWrapper(
mf_name="hybrid_current_fp_ampere",
mf_name="hybrid_j_fp_ampere",
idir=2,
level=level,
include_ghosts=include_ghosts,
Expand Down
20 changes: 10 additions & 10 deletions Source/BoundaryConditions/PML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ PML::PML (const int lev, const BoxArray& grid_ba,
warpx.m_fields.alloc_init(FieldType::pml_B_fp, Direction{1}, lev, ba_By, dm, ncompb, ngb, 0.0_rt, false, false);
warpx.m_fields.alloc_init(FieldType::pml_B_fp, Direction{2}, lev, ba_Bz, dm, ncompb, ngb, 0.0_rt, false, false);

const amrex::BoxArray ba_jx = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::current_fp, Direction{0}, 0)->ixType().toIntVect());
const amrex::BoxArray ba_jy = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::current_fp, Direction{1}, 0)->ixType().toIntVect());
const amrex::BoxArray ba_jz = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::current_fp, Direction{2}, 0)->ixType().toIntVect());
const amrex::BoxArray ba_jx = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::j_fp, Direction{0}, 0)->ixType().toIntVect());
const amrex::BoxArray ba_jy = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::j_fp, Direction{1}, 0)->ixType().toIntVect());
const amrex::BoxArray ba_jz = amrex::convert(ba, WarpX::GetInstance().m_fields.get(FieldType::j_fp, Direction{2}, 0)->ixType().toIntVect());
warpx.m_fields.alloc_init(FieldType::pml_j_fp, Direction{0}, lev, ba_jx, dm, 1, ngb, 0.0_rt, false, false);
warpx.m_fields.alloc_init(FieldType::pml_j_fp, Direction{1}, lev, ba_jy, dm, 1, ngb, 0.0_rt, false, false);
warpx.m_fields.alloc_init(FieldType::pml_j_fp, Direction{2}, lev, ba_jz, dm, 1, ngb, 0.0_rt, false, false);
Expand Down Expand Up @@ -871,9 +871,9 @@ PML::PML (const int lev, const BoxArray& grid_ba,
warpx.m_fields.alloc_init(FieldType::pml_G_cp, lev, cba_G_nodal, cdm, 3, ngf, 0.0_rt, false, false);
}

const amrex::BoxArray cba_jx = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::current_cp, Direction{0}, 1)->ixType().toIntVect());
const amrex::BoxArray cba_jy = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::current_cp, Direction{1}, 1)->ixType().toIntVect());
const amrex::BoxArray cba_jz = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::current_cp, Direction{2}, 1)->ixType().toIntVect());
const amrex::BoxArray cba_jx = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::j_cp, Direction{0}, 1)->ixType().toIntVect());
const amrex::BoxArray cba_jy = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::j_cp, Direction{1}, 1)->ixType().toIntVect());
const amrex::BoxArray cba_jz = amrex::convert(cba, WarpX::GetInstance().m_fields.get(FieldType::j_cp, Direction{2}, 1)->ixType().toIntVect());
warpx.m_fields.alloc_init(FieldType::pml_j_cp, Direction{0}, lev, cba_jx, cdm, 1, ngb, 0.0_rt, false, false);
warpx.m_fields.alloc_init(FieldType::pml_j_cp, Direction{1}, lev, cba_jy, cdm, 1, ngb, 0.0_rt, false, false);
warpx.m_fields.alloc_init(FieldType::pml_j_cp, Direction{2}, lev, cba_jz, cdm, 1, ngb, 0.0_rt, false, false);
Expand Down Expand Up @@ -1060,23 +1060,23 @@ PML::CopyJtoPMLs (
{
using ablastr::fields::Direction;

bool const has_j_fp = fields.has_vector(FieldType::current_fp, lev);
bool const has_j_fp = fields.has_vector(FieldType::j_fp, lev);
bool const has_pml_j_fp = fields.has_vector(FieldType::pml_j_fp, lev);
bool const has_j_cp = fields.has_vector(FieldType::current_cp, lev);
bool const has_j_cp = fields.has_vector(FieldType::j_cp, lev);
bool const has_pml_j_cp = fields.has_vector(FieldType::pml_j_cp, lev);

if (patch_type == PatchType::fine && has_pml_j_fp && has_j_fp)
{
ablastr::fields::VectorField pml_j_fp = fields.get_alldirs(FieldType::pml_j_fp, lev);
ablastr::fields::VectorField jp = fields.get_alldirs(FieldType::current_fp, lev);
ablastr::fields::VectorField jp = fields.get_alldirs(FieldType::j_fp, lev);
CopyToPML(*pml_j_fp[0], *jp[0], *m_geom);
CopyToPML(*pml_j_fp[1], *jp[1], *m_geom);
CopyToPML(*pml_j_fp[2], *jp[2], *m_geom);
}
else if (patch_type == PatchType::coarse && has_j_cp && has_pml_j_cp)
{
ablastr::fields::VectorField pml_j_cp = fields.get_alldirs(FieldType::pml_j_cp, lev);
ablastr::fields::VectorField jp = fields.get_alldirs(FieldType::current_cp, lev);
ablastr::fields::VectorField jp = fields.get_alldirs(FieldType::j_cp, lev);
CopyToPML(*pml_j_cp[0], *jp[0], *m_cgeom);
CopyToPML(*pml_j_cp[1], *jp[1], *m_cgeom);
CopyToPML(*pml_j_cp[2], *jp[2], *m_cgeom);
Expand Down
12 changes: 6 additions & 6 deletions Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ BTDiagnostics::InitializeFieldFunctors (int lev)
} else if ( m_cellcenter_varnames[comp] == "Bz" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::Bfield_aux, Direction{2}, lev), lev, m_crse_ratio);
} else if ( m_cellcenter_varnames[comp] == "jx" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp,Direction{0}, lev), lev, m_crse_ratio);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp,Direction{0}, lev), lev, m_crse_ratio);
} else if ( m_cellcenter_varnames[comp] == "jy" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp,Direction{1}, lev), lev, m_crse_ratio);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp,Direction{1}, lev), lev, m_crse_ratio);
} else if ( m_cellcenter_varnames[comp] == "jz" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp,Direction{2}, lev), lev, m_crse_ratio);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp,Direction{2}, lev), lev, m_crse_ratio);
} else if ( m_cellcenter_varnames[comp] == "rho" ){
m_cell_center_functors[lev][comp] = std::make_unique<RhoFunctor>(lev, m_crse_ratio);
}
Expand Down Expand Up @@ -701,11 +701,11 @@ BTDiagnostics::InitializeFieldFunctorsRZopenPMD (int lev)
} else if ( m_cellcenter_varnames_fields[comp] == "Bz" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::Bfield_aux, Direction{2}, lev), lev, m_crse_ratio, false, ncomp);
} else if ( m_cellcenter_varnames_fields[comp] == "jr" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp, Direction{0}, lev), lev, m_crse_ratio, false, ncomp);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp, Direction{0}, lev), lev, m_crse_ratio, false, ncomp);
} else if ( m_cellcenter_varnames_fields[comp] == "jt" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp, Direction{1}, lev), lev, m_crse_ratio, false, ncomp);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp, Direction{1}, lev), lev, m_crse_ratio, false, ncomp);
} else if ( m_cellcenter_varnames_fields[comp] == "jz" ){
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::current_fp, Direction{2}, lev), lev, m_crse_ratio, false, ncomp);
m_cell_center_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.m_fields.get(FieldType::j_fp, Direction{2}, lev), lev, m_crse_ratio, false, ncomp);
} else if ( m_cellcenter_varnames_fields[comp] == "rho" ){
m_cell_center_functors[lev][comp] = std::make_unique<RhoFunctor>(lev, m_crse_ratio, false, -1, false, ncomp);
}
Expand Down
10 changes: 5 additions & 5 deletions Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ JFunctor::operator() (amrex::MultiFab& mf_dst, int dcomp, const int /*i_buffer*/

auto& warpx = WarpX::GetInstance();
/** pointer to source multifab (can be multi-component) */
amrex::MultiFab* m_mf_src = warpx.m_fields.get(FieldType::current_fp,Direction{m_dir},m_lev);
amrex::MultiFab* m_mf_src = warpx.m_fields.get(FieldType::j_fp,Direction{m_dir},m_lev);

// Deposit current if no solver or the electrostatic solver is being used
if (m_deposit_current)
{
// allocate temporary multifab to deposit current density into
ablastr::fields::MultiLevelVectorField current_fp_temp {
warpx.m_fields.get_alldirs(FieldType::current_fp, m_lev)
ablastr::fields::MultiLevelVectorField j_fp_temp {
warpx.m_fields.get_alldirs(FieldType::j_fp, m_lev)
};

auto& mypc = warpx.GetPartContainer();
mypc.DepositCurrent(current_fp_temp, warpx.getdt(m_lev), 0.0);
mypc.DepositCurrent(j_fp_temp, warpx.getdt(m_lev), 0.0);

// sum values in guard cells - note that this does not filter the
// current density.
for (int idim = 0; idim < 3; ++idim) {
current_fp_temp[0][idim]->FillBoundary(warpx.Geom(m_lev).periodicity());
j_fp_temp[0][idim]->FillBoundary(warpx.Geom(m_lev).periodicity());
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ JdispFunctor::operator() (amrex::MultiFab& mf_dst, int dcomp, const int /*i_buff
auto* hybrid_pic_model = warpx.get_pointer_HybridPICModel();

/** pointer to total simulation current (J) multifab */
amrex::MultiFab* mf_j = warpx.m_fields.get(FieldType::current_fp, Direction{m_dir}, m_lev);
amrex::MultiFab* mf_j = warpx.m_fields.get(FieldType::j_fp, Direction{m_dir}, m_lev);

WARPX_ALWAYS_ASSERT_WITH_MESSAGE(hybrid_pic_model,
"Displacement current diagnostic is only implemented for the HybridPICModel.");
AMREX_ASSUME(hybrid_pic_model != nullptr);

/** pointer to current calculated from Ampere's Law (Jamp) multifab */
amrex::MultiFab* mf_curlB = warpx.m_fields.get(FieldType::hybrid_current_fp_ampere, Direction{m_dir}, m_lev);
amrex::MultiFab* mf_curlB = warpx.m_fields.get(FieldType::hybrid_j_fp_ampere, Direction{m_dir}, m_lev);

//if (!hybrid_pic_model) {
// To finish this implementation, we need to implement a method to
Expand All @@ -66,7 +66,7 @@ JdispFunctor::operator() (amrex::MultiFab& mf_dst, int dcomp, const int /*i_buff
if (hybrid_pic_model) {
// Subtract the interpolated j_external value from j_displacement.
/** pointer to external currents (Jext) multifab */
amrex::MultiFab* mf_j_external = warpx.m_fields.get(FieldType::hybrid_current_fp_external, Direction{m_dir}, m_lev);
amrex::MultiFab* mf_j_external = warpx.m_fields.get(FieldType::hybrid_j_fp_external, Direction{m_dir}, m_lev);

// Index type required for interpolating Jext from their respective
// staggering (nodal) to the Jx_displacement, Jy_displacement, Jz_displacement
Expand Down
12 changes: 6 additions & 6 deletions Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ FlushFormatCheckpoint::WriteToFile (

if (warpx.getis_synchronized()) {
// Need to save j if synchronized because after restart we need j to evolve E by dt/2.
VisMF::Write(*warpx.m_fields.get(FieldType::current_fp, Direction{0}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_fp, Direction{0}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jx_fp"));
VisMF::Write(*warpx.m_fields.get(FieldType::current_fp, Direction{1}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_fp, Direction{1}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jy_fp"));
VisMF::Write(*warpx.m_fields.get(FieldType::current_fp, Direction{2}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_fp, Direction{2}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jz_fp"));
}

Expand Down Expand Up @@ -142,11 +142,11 @@ FlushFormatCheckpoint::WriteToFile (

if (warpx.getis_synchronized()) {
// Need to save j if synchronized because after restart we need j to evolve E by dt/2.
VisMF::Write(*warpx.m_fields.get(FieldType::current_cp, Direction{0}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_cp, Direction{0}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jx_cp"));
VisMF::Write(*warpx.m_fields.get(FieldType::current_cp, Direction{1}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_cp, Direction{1}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jy_cp"));
VisMF::Write(*warpx.m_fields.get(FieldType::current_cp, Direction{2}, lev),
VisMF::Write(*warpx.m_fields.get(FieldType::j_cp, Direction{2}, lev),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jz_cp"));
}
}
Expand Down
10 changes: 5 additions & 5 deletions Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ FlushFormatPlotfile::WriteAllRawFields(
default_level_prefix, "Ey_fp", lev, plot_raw_fields_guards );
WriteRawMF( *warpx.m_fields.get(FieldType::Efield_fp, Direction{2}, lev), dm, raw_pltname,
default_level_prefix, "Ez_fp", lev, plot_raw_fields_guards );
WriteRawMF( *warpx.m_fields.get(FieldType::current_fp,Direction{0}, lev), dm, raw_pltname,
WriteRawMF( *warpx.m_fields.get(FieldType::j_fp,Direction{0}, lev), dm, raw_pltname,
default_level_prefix, "jx_fp", lev,plot_raw_fields_guards );
WriteRawMF( *warpx.m_fields.get(FieldType::current_fp,Direction{1}, lev), dm, raw_pltname,
WriteRawMF( *warpx.m_fields.get(FieldType::j_fp,Direction{1}, lev), dm, raw_pltname,
default_level_prefix, "jy_fp", lev,plot_raw_fields_guards );
WriteRawMF( *warpx.m_fields.get(FieldType::current_fp,Direction{2}, lev), dm, raw_pltname,
WriteRawMF( *warpx.m_fields.get(FieldType::j_fp,Direction{2}, lev), dm, raw_pltname,
default_level_prefix, "jz_fp", lev,plot_raw_fields_guards );
WriteRawMF( *warpx.m_fields.get(FieldType::Bfield_fp, Direction{0}, lev), dm, raw_pltname,
default_level_prefix, "Bx_fp", lev, plot_raw_fields_guards );
Expand Down Expand Up @@ -653,8 +653,8 @@ FlushFormatPlotfile::WriteAllRawFields(
warpx.m_fields.get(FieldType::Bfield_fp, Direction{2}, lev),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards);
WriteCoarseVector( "j",
warpx.m_fields.get(FieldType::current_cp, Direction{0}, lev), warpx.m_fields.get(FieldType::current_cp, Direction{1}, lev), warpx.m_fields.get(FieldType::current_cp, Direction{2}, lev),
warpx.m_fields.get(FieldType::current_fp, Direction{0}, lev), warpx.m_fields.get(FieldType::current_fp, Direction{1}, lev), warpx.m_fields.get(FieldType::current_fp, Direction{2}, lev),
warpx.m_fields.get(FieldType::j_cp, Direction{0}, lev), warpx.m_fields.get(FieldType::j_cp, Direction{1}, lev), warpx.m_fields.get(FieldType::j_cp, Direction{2}, lev),
warpx.m_fields.get(FieldType::j_fp, Direction{0}, lev), warpx.m_fields.get(FieldType::j_fp, Direction{1}, lev), warpx.m_fields.get(FieldType::j_fp, Direction{2}, lev),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards);
if (warpx.m_fields.has(FieldType::F_fp, lev) && warpx.m_fields.has(FieldType::F_cp, lev))
{
Expand Down
Loading

0 comments on commit 4915959

Please sign in to comment.