Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafedeli88 committed Sep 18, 2024
2 parents fe87f93 + 1dfeb9f commit 6558340
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 25 deletions.
12 changes: 6 additions & 6 deletions Source/Diagnostics/WarpXIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,18 @@ WarpX::InitFromCheckpoint ()

if (lev > 0)
{
VisMF::Read(*m_fields.get("Efield_fp", Direction{0}, lev),
VisMF::Read(*m_fields.get("Efield_cp", Direction{0}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ex_cp"));
VisMF::Read(*m_fields.get("Efield_fp", Direction{1}, lev),
VisMF::Read(*m_fields.get("Efield_cp", Direction{1}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ey_cp"));
VisMF::Read(*m_fields.get("Efield_fp", Direction{2}, lev),
VisMF::Read(*m_fields.get("Efield_cp", Direction{2}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ez_cp"));

VisMF::Read(*m_fields.get("Bfield_fp", Direction{0}, lev),
VisMF::Read(*m_fields.get("Bfield_cp", Direction{0}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Bx_cp"));
VisMF::Read(*m_fields.get("Bfield_fp", Direction{1}, lev),
VisMF::Read(*m_fields.get("Bfield_cp", Direction{1}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "By_cp"));
VisMF::Read(*m_fields.get("Bfield_fp", Direction{2}, lev),
VisMF::Read(*m_fields.get("Bfield_cp", Direction{2}, lev),
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Bz_cp"));

if (WarpX::fft_do_time_averaging)
Expand Down
2 changes: 1 addition & 1 deletion Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void FiniteDifferenceSolver::EvolveE (
fields.get_alldirs("current_fp", lev) : fields.get_alldirs("current_cp", lev);

amrex::MultiFab* Ffield = nullptr;
if (fields.has("F_fp", Direction{0}, lev)) {
if (fields.has("F_fp", lev)) {
Ffield = patch_type == PatchType::fine ?
fields.get("F_fp", lev) : fields.get("F_cp", lev);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void HybridPICModel::FillElectronPressureMF (

void HybridPICModel::BfieldEvolveRK (
ablastr::fields::MultiLevelVectorField const& Bfield,
ablastr::fields::MultiLevelVectorField const&Efield,
ablastr::fields::MultiLevelVectorField const& Efield,
ablastr::fields::MultiLevelVectorField const& Jfield,
ablastr::fields::MultiLevelScalarField const& rhofield,
ablastr::fields::MultiLevelVectorField const& edge_lengths,
Expand Down
4 changes: 2 additions & 2 deletions Source/FieldSolver/WarpXPushFieldsHybridPIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void WarpX::HybridPICEvolveFields ()
m_fields.get_mr_levels_alldirs("Bfield_fp", finest_level),
m_fields.get_mr_levels_alldirs("Efield_fp", finest_level),
current_fp_temp, rho_fp_temp,
m_fields.get_mr_levels_alldirs("edge_lenghts", finest_level),
m_fields.get_mr_levels_alldirs("edge_lengths", finest_level),
0.5_rt/sub_steps*dt[0],
DtType::FirstHalf, guard_cells.ng_FieldSolver,
WarpX::sync_nodal_points
Expand All @@ -134,7 +134,7 @@ void WarpX::HybridPICEvolveFields ()
m_fields.get_mr_levels_alldirs("Efield_fp", finest_level),
m_fields.get_mr_levels_alldirs("current_fp", finest_level),
rho_fp_temp,
m_fields.get_mr_levels_alldirs("edge_lenghts", finest_level),
m_fields.get_mr_levels_alldirs("edge_lengths", finest_level),
0.5_rt/sub_steps*dt[0],
DtType::SecondHalf, guard_cells.ng_FieldSolver,
WarpX::sync_nodal_points
Expand Down
2 changes: 1 addition & 1 deletion Source/Particles/MultiParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ MultiParticleContainer::Evolve (ablastr::fields::MultiFabRegister& fields,
fields.get(current_fp_string, Direction{2}, lev)->setVal(0.0);
if (fields.has("current_buf", Direction{0}, lev)) { fields.get("current_buf", Direction{0}, lev)->setVal(0.0); }
if (fields.has("current_buf", Direction{1}, lev)) { fields.get("current_buf", Direction{1}, lev)->setVal(0.0); }
if (fields.has("current_buf", Direction{1}, lev)) { fields.get("current_buf", Direction{2}, lev)->setVal(0.0); }
if (fields.has("current_buf", Direction{2}, lev)) { fields.get("current_buf", Direction{2}, lev)->setVal(0.0); }
if (fields.has("rho_fp", lev)) { fields.get("rho_fp", lev)->setVal(0.0); }
if (fields.has("rho_buf", lev)) { fields.get("rho_buf", lev)->setVal(0.0); }
}
Expand Down
1 change: 0 additions & 1 deletion Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,6 @@ PhysicalParticleContainer::Evolve (ablastr::fields::MultiFabRegister& fields,
const iMultiFab* current_masks = WarpX::CurrentBufferMasks(lev);
const iMultiFab* gather_masks = WarpX::GatherBufferMasks(lev);

using ablastr::fields::Direction;
const bool has_rho = fields.has("rho_fp", lev);
const bool has_cjx = fields.has("current_buf", Direction{0}, lev);
const bool has_cEx = fields.has("Efield_cax", Direction{0}, lev);
Expand Down
2 changes: 1 addition & 1 deletion Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public:
* Set the dotMask container
*/
void SetDotMask( std::unique_ptr<amrex::iMultiFab>& field_dotMask,
const std::string& field_name, int lev, int dir ) const;
std::string const & field_name, int lev, int dir ) const;

[[nodiscard]] bool DoPML () const {return do_pml;}
[[nodiscard]] bool DoFluidSpecies () const {return do_fluid_species;}
Expand Down
30 changes: 21 additions & 9 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2259,12 +2259,12 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
if (fft_do_time_averaging)
{
m_fields.alloc_init( "Bfield_avg_fp", Direction{0}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Bfield_avg_fp", Direction{1}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Bfield_avg_fp", Direction{2}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Bfield_avg_fp", Direction{1}, lev, amrex::convert(ba, By_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Bfield_avg_fp", Direction{2}, lev, amrex::convert(ba, Bz_nodal_flag), dm, ncomps, ngEB, 0.0_rt);

m_fields.alloc_init( "Efield_avg_fp", Direction{0}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Efield_avg_fp", Direction{1}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Efield_avg_fp", Direction{2}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Efield_avg_fp", Direction{1}, lev, amrex::convert(ba, Ey_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init( "Efield_avg_fp", Direction{2}, lev, amrex::convert(ba, Ez_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
}

if (EB::enabled()) {
Expand Down Expand Up @@ -2530,9 +2530,15 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
}
if (mypc->m_B_ext_particle_s == "read_from_file") {
// These fields will be added to the fields that the particles see, and need to match the index type
<<<<<<< HEAD
auto* Bfield_aux_levl_0 = m_fields.get("Bfield_aux", Direction{0}, lev);
auto* Bfield_aux_levl_1 = m_fields.get("Bfield_aux", Direction{1}, lev);
auto* Bfield_aux_levl_2 = m_fields.get("Bfield_aux", Direction{2}, lev);
=======
auto *Bfield_aux_levl_0 = m_fields.get("Bfield_aux", Direction{0}, lev);
auto *Bfield_aux_levl_1 = m_fields.get("Bfield_aux", Direction{1}, lev);
auto *Bfield_aux_levl_2 = m_fields.get("Bfield_aux", Direction{2}, lev);
>>>>>>> 1dfeb9f0ff8b104502d31bfd8aa90827de58ea7a

// Same as Bfield_fp for reading external field data
m_fields.alloc_init( "B_external_particle_field", Direction{0}, lev, amrex::convert(ba, Bfield_aux_levl_0->ixType()),
Expand All @@ -2553,9 +2559,15 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
}
if (mypc->m_E_ext_particle_s == "read_from_file") {
// These fields will be added to the fields that the particles see, and need to match the index type
<<<<<<< HEAD
auto* Efield_aux_levl_0 = m_fields.get("Efield_aux", Direction{0}, lev);
auto* Efield_aux_levl_1 = m_fields.get("Efield_aux", Direction{1}, lev);
auto* Efield_aux_levl_2 = m_fields.get("Efield_aux", Direction{2}, lev);
=======
auto *Efield_aux_levl_0 = m_fields.get("Efield_aux", Direction{0}, lev);
auto *Efield_aux_levl_1 = m_fields.get("Efield_aux", Direction{1}, lev);
auto *Efield_aux_levl_2 = m_fields.get("Efield_aux", Direction{2}, lev);
>>>>>>> 1dfeb9f0ff8b104502d31bfd8aa90827de58ea7a

// Same as Efield_fp for reading external field data
m_fields.alloc_init( "E_external_particle_field", Direction{0}, lev, amrex::convert(ba, Efield_aux_levl_0->ixType()),
Expand Down Expand Up @@ -2588,12 +2600,12 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
if (fft_do_time_averaging)
{
m_fields.alloc_init("Bfield_avg_cp", Direction{0}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Bfield_avg_cp", Direction{1}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Bfield_avg_cp", Direction{2}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Bfield_avg_cp", Direction{1}, lev, amrex::convert(cba, By_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Bfield_avg_cp", Direction{2}, lev, amrex::convert(cba, Bz_nodal_flag), dm, ncomps, ngEB, 0.0_rt);

m_fields.alloc_init("Efield_avg_cp", Direction{0}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Efield_avg_cp", Direction{1}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Efield_avg_cp", Direction{2}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Efield_avg_cp", Direction{1}, lev, amrex::convert(cba, Ey_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
m_fields.alloc_init("Efield_avg_cp", Direction{2}, lev, amrex::convert(cba, Ez_nodal_flag), dm, ncomps, ngEB, 0.0_rt);
}

// Create the MultiFabs for the current
Expand Down Expand Up @@ -3410,7 +3422,7 @@ WarpX::getFieldDotMaskPointer ( FieldType field_type, int lev, int dir ) const
}

void WarpX::SetDotMask( std::unique_ptr<amrex::iMultiFab>& field_dotMask,
const std::string& field_name, int lev, int dir ) const
std::string const & field_name, int lev, int dir ) const
{
// Define the dot mask for this field_type needed to properly compute dotProduct()
// for field values that have shared locations on different MPI ranks
Expand Down
5 changes: 2 additions & 3 deletions Source/ablastr/fields/MultiFabRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,9 @@ namespace ablastr::fields
// C++20: Replace with std::erase_if
for (auto first = m_mf_register.begin(), last = m_mf_register.end(); first != last;)
{
if (first->second.m_level == level){
if (first->second.m_level == level) {
first = m_mf_register.erase(first);
}
else{
} else {
++first;
}
}
Expand Down

0 comments on commit 6558340

Please sign in to comment.