Skip to content

Commit

Permalink
Revert "fix merge conflict"
Browse files Browse the repository at this point in the history
This reverts commit 6558340, reversing
changes made to 1dfeb9f.
  • Loading branch information
lucafedeli88 committed Sep 18, 2024
1 parent 6558340 commit a20f7dd
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 52 deletions.
4 changes: 2 additions & 2 deletions Source/BoundaryConditions/PML_RZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ PML_RZ::FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patc
if (patch_type == PatchType::fine && pml_Er->nGrowVect().max() > 0)
{
amrex::Periodicity const& period = m_geom->periodicity();
const amrex::Vector<amrex::MultiFab*> mf = {pml_Er, pml_Et};
amrex::Vector<amrex::MultiFab*> mf = {pml_Er, pml_Et};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync);
}
}
Expand All @@ -152,7 +152,7 @@ PML_RZ::FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patc
amrex::MultiFab * pml_Bt = fields.get("pml_B_fp", Direction{1}, 0);

amrex::Periodicity const& period = m_geom->periodicity();
const amrex::Vector<amrex::MultiFab*> mf = {pml_Br, pml_Bt};
amrex::Vector<amrex::MultiFab*> mf = {pml_Br, pml_Bt};
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
// (after checking that pointer to rho_fp on MR level 0 is not null)
if (m_fields.has("rho_fp", 0) && rho_in_time == RhoInTime::Linear)
{
const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level);
ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level);

// Deposit rho at relative time -dt
// (dt[0] denotes the time step on mesh refinement level 0)
Expand Down Expand Up @@ -732,8 +732,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time)
// (after checking that pointer to rho_fp on MR level 0 is not null)
if (m_fields.has("rho_fp", 0))
{
const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_cp", finest_level);
ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_cp", finest_level);

// Move rho from new to old if rho is linear in time
if (rho_in_time == RhoInTime::Linear) { PSATDMoveRhoNewToRhoOld(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ void LabFrameExplicitES::ComputeSpaceChargeField (
using ablastr::fields::MultiLevelScalarField;
using ablastr::fields::MultiLevelVectorField;

const MultiLevelScalarField rho_fp = fields.get_mr_levels("rho_fp", max_level);
const MultiLevelScalarField rho_cp = fields.get_mr_levels("rho_cp", max_level);
MultiLevelScalarField rho_fp = fields.get_mr_levels("rho_fp", max_level);
MultiLevelScalarField rho_cp = fields.get_mr_levels("rho_cp", max_level);
MultiLevelScalarField phi_fp = fields.get_mr_levels("phi_fp", max_level);
const MultiLevelVectorField Efield_fp = fields.get_mr_levels_alldirs("Efield_fp", max_level);
MultiLevelVectorField Efield_fp = fields.get_mr_levels_alldirs("Efield_fp", max_level);

mpc.DepositCharge(rho_fp, 0.0_rt);
if (mfl) {
Expand All @@ -41,7 +41,7 @@ void LabFrameExplicitES::ComputeSpaceChargeField (
}

// Apply filter, perform MPI exchange, interpolate across levels
const Vector<std::unique_ptr<MultiFab> > rho_buf(num_levels);
Vector<std::unique_ptr<MultiFab> > rho_buf(num_levels);
auto & warpx = WarpX::GetInstance();
warpx.SyncRho( rho_fp, rho_cp, amrex::GetVecOfPtrs(rho_buf) );

Expand Down
4 changes: 2 additions & 2 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ void FiniteDifferenceSolver::EvolveB (
[[maybe_unused]] amrex::Real const dt ) {

using ablastr::fields::Direction;
const ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ?
ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ?
fields.get_alldirs("Bfield_fp", lev) : fields.get_alldirs("Bfield_cp", lev);
const ablastr::fields::VectorField Efield = patch_type == PatchType::fine ?
ablastr::fields::VectorField Efield = patch_type == PatchType::fine ?
fields.get_alldirs("Efield_fp", lev) : fields.get_alldirs("Efield_cp", lev);

// Select algorithm (The choice of algorithm is a runtime option,
Expand Down
4 changes: 2 additions & 2 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ void FiniteDifferenceSolver::EvolveBPML (
WARPX_ABORT_WITH_MESSAGE(
"PML are not implemented in cylindrical geometry.");
#else
const ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ?
ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ?
fields.get_alldirs("pml_B_fp", level) : fields.get_alldirs("pml_B_cp", level);
const ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ?
ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ?
fields.get_alldirs("pml_E_fp", level) : fields.get_alldirs("pml_E_cp", level);

if (m_grid_type == ablastr::utils::enums::GridType::Collocated) {
Expand Down
20 changes: 12 additions & 8 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ void FiniteDifferenceSolver::EvolveE (
)
{
using ablastr::fields::Direction;
const ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ?
ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ?
fields.get_alldirs("Bfield_fp", lev) : fields.get_alldirs("Bfield_cp", lev);
const ablastr::fields::VectorField Jfield = patch_type == PatchType::fine ?
ablastr::fields::VectorField Jfield = patch_type == PatchType::fine ?
fields.get_alldirs("current_fp", lev) : fields.get_alldirs("current_cp", lev);

amrex::MultiFab* Ffield = nullptr;
Expand All @@ -71,19 +71,23 @@ void FiniteDifferenceSolver::EvolveE (

ablastr::fields::VectorField edge_lengths;
if (fields.has("edge_lengths", Direction{0}, lev)) {
edge_lengths = fields.get_alldirs("edge_lengths", lev);
edge_lengths = patch_type == PatchType::fine ?
fields.get_alldirs("edge_lengths", lev) : fields.get_alldirs("edge_lengths", lev);
}
ablastr::fields::VectorField face_areas;
if (fields.has("face_areas", Direction{0}, lev)) {
face_areas = fields.get_alldirs("face_areas", lev);
face_areas = patch_type == PatchType::fine ?
fields.get_alldirs("face_areas", lev) : fields.get_alldirs("face_areas", lev);
}
ablastr::fields::VectorField area_mod;
if (fields.has("area_mod", Direction{0}, lev)) {
area_mod = fields.get_alldirs("area_mod", lev);
if (fields.has("face_areas", Direction{0}, lev)) {
area_mod = patch_type == PatchType::fine ?
fields.get_alldirs("area_mod", lev) : fields.get_alldirs("area_mod", lev);
}
ablastr::fields::VectorField ECTRhofield;
if (fields.has("ECTRhofield", Direction{0}, lev)) {
ECTRhofield = fields.get_alldirs("ECTRhofield", lev);
ECTRhofield = patch_type == PatchType::fine ?
fields.get_alldirs("ECTRhofield", lev) : fields.get_alldirs("ECTRhofield", lev);
}

// Select algorithm (The choice of algorithm is a runtime option,
Expand Down Expand Up @@ -217,7 +221,7 @@ void FiniteDifferenceSolver::EvolveECartesian (
if (Ffield) {

// Extract field data for this grid/tile
const Array4<Real const> F = Ffield->array(mfi);
Array4<Real const> F = Ffield->array(mfi);

// Loop over the cells and update the fields
amrex::ParallelFor(tex, tey, tez,
Expand Down
6 changes: 3 additions & 3 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ void FiniteDifferenceSolver::EvolveEPML (
"PML are not implemented in cylindrical geometry.");
#else
using ablastr::fields::Direction;
const ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ?
ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ?
fields.get_alldirs("pml_E_fp", level) : fields.get_alldirs("pml_E_cp", level);
const ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ?
ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ?
fields.get_alldirs("pml_B_fp", level) : fields.get_alldirs("pml_B_cp", level);
const ablastr::fields::VectorField Jfield = (patch_type == PatchType::fine) ?
ablastr::fields::VectorField Jfield = (patch_type == PatchType::fine) ?
fields.get_alldirs("pml_j_fp", level) : fields.get_alldirs("pml_j_cp", level);
ablastr::fields::VectorField edge_lengths;
if (fields.has("pml_edge_lengths", Direction{0}, level)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class FiniteDifferenceSolver
void EvolveFCylindrical (
amrex::MultiFab* Ffield,
ablastr::fields::VectorField const & Efield,
amrex::MultiFab* rhofield,
amrex::MultiFab* const rhofield,
int rhocomp,
amrex::Real dt );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ void HybridPICModel::HybridPICSolveE (
auto& warpx = WarpX::GetInstance();

ablastr::fields::VectorField current_fp_ampere = warpx.m_fields.get_alldirs("hybrid_current_fp_ampere", lev);
const ablastr::fields::VectorField current_fp_external = warpx.m_fields.get_alldirs("hybrid_current_fp_external", lev);
const ablastr::fields::ScalarField electron_pressure_fp = warpx.m_fields.get("hybrid_electron_pressure_fp", lev);
ablastr::fields::VectorField current_fp_external = warpx.m_fields.get_alldirs("hybrid_current_fp_external", lev);
ablastr::fields::ScalarField electron_pressure_fp = warpx.m_fields.get("hybrid_electron_pressure_fp", lev);

// Solve E field in regular cells
warpx.get_pointer_fdtd_solver_fp(lev)->HybridPICSolveE(
Expand Down
4 changes: 2 additions & 2 deletions Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public:
[[nodiscard]] inline bool IsDefined () const { return m_is_defined; }

void Define ( WarpX* a_WarpX,
const std::string& a_vector_type_name,
const std::string& a_scalar_type_name = "none" );
std::string a_vector_type_name,
std::string a_scalar_type_name = "none" );

inline
void Define ( const WarpXSolverVec& a_solver_vec )
Expand Down
6 changes: 3 additions & 3 deletions Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ WarpXSolverVec::~WarpXSolverVec ()
}

void WarpXSolverVec::Define ( WarpX* a_WarpX,
const std::string& a_vector_type_name,
const std::string& a_scalar_type_name )
std::string a_vector_type_name,
std::string a_scalar_type_name )
{
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
!IsDefined(),
Expand All @@ -41,7 +41,7 @@ void WarpXSolverVec::Define ( WarpX* a_WarpX,
m_array_type = FieldType::Efield_fp;
}
else if (m_vector_type_name=="Bfield_fp") {
m_array_type = FieldType::Bfield_fp;
m_array_type = FieldType::Efield_fp;
}
else if (m_vector_type_name=="vector_potential_fp_nodal") {
m_array_type = FieldType::vector_potential_fp;
Expand Down
10 changes: 5 additions & 5 deletions Source/FieldSolver/WarpXPushFieldsEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,11 @@ WarpX::PushPSATD ()

const int rho_old = spectral_solver_fp[0]->m_spectral_index.rho_old;
const int rho_new = spectral_solver_fp[0]->m_spectral_index.rho_new;
const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level);
const ablastr::fields::MultiLevelVectorField current_fp = m_fields.get_mr_levels_alldirs("current_fp", finest_level);
const ablastr::fields::MultiLevelVectorField current_cp = m_fields.get_mr_levels_alldirs("current_cp", finest_level);
const ablastr::fields::MultiLevelVectorField current_buf = m_fields.get_mr_levels_alldirs("current_buf", finest_level);
ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level);
ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level);
ablastr::fields::MultiLevelVectorField current_fp = m_fields.get_mr_levels_alldirs("current_fp", finest_level);
ablastr::fields::MultiLevelVectorField current_cp = m_fields.get_mr_levels_alldirs("current_cp", finest_level);
ablastr::fields::MultiLevelVectorField current_buf = m_fields.get_mr_levels_alldirs("current_buf", finest_level);

if (fft_periodic_single_box)
{
Expand Down
12 changes: 0 additions & 12 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,15 +2530,9 @@ 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 @@ -2559,15 +2553,9 @@ 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
4 changes: 2 additions & 2 deletions Source/ablastr/fields/MultiFabRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ namespace ablastr::fields
const amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > >& old_vector_on_levels
)
{
auto const finest_level = static_cast<int>(old_vector_on_levels.size() - 1u);
int const finest_level = old_vector_on_levels.size() - 1u;

MultiLevelVectorField field_on_level;
field_on_level.reserve(finest_level+1);
Expand All @@ -654,7 +654,7 @@ namespace ablastr::fields
const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& old_scalar_on_levels
)
{
auto const finest_level = static_cast<int>(old_scalar_on_levels.size() - 1u);
int const finest_level = old_scalar_on_levels.size() - 1u;

MultiLevelScalarField field_on_level;
field_on_level.reserve(finest_level+1);
Expand Down

0 comments on commit a20f7dd

Please sign in to comment.