Skip to content

Commit

Permalink
Add flag for B
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Jan 10, 2025
1 parent 28d43a1 commit 0214769
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,11 @@ void WarpX::InitializeEBGridData (int lev)
m_eb_update_E[lev],
m_fields.get_alldirs(FieldType::Efield_fp, lev),
eb_fact );
// Mark on which grid points B should be updated
MarkUpdateCells(
m_eb_update_B[lev],
m_fields.get_alldirs(FieldType::Bfield_fp, lev),
eb_fact );

// TODO: move inside if condition for ECT
auto edge_lengths_lev = m_fields.get_alldirs(FieldType::edge_lengths, lev);
Expand Down
5 changes: 3 additions & 2 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1413,10 +1413,11 @@ private:
mutable amrex::Vector<std::array< std::unique_ptr<amrex::iMultiFab>,3 > > Afield_dotMask;
mutable amrex::Vector< std::unique_ptr<amrex::iMultiFab> > phi_dotMask;

/** EB: Flag to indicate whether the E location is inside the EB and therefore E should not be updated.
* (One array per level and per direction, due to staggering)
/** EB: Flag to indicate whether a gridpoint is inside the embedded boundary and therefore
* whether the E or B should not be updated. (One array per level and per direction, due to staggering)
*/
amrex::Vector<std::array< std::unique_ptr<amrex::iMultiFab>,3 > > m_eb_update_E;
amrex::Vector<std::array< std::unique_ptr<amrex::iMultiFab>,3 > > m_eb_update_B;

/** EB: for every mesh face flag_info_face contains a:
* * 0 if the face needs to be extended
Expand Down
8 changes: 8 additions & 0 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ WarpX::WarpX ()
phi_dotMask.resize(nlevs_max);

m_eb_update_E.resize(nlevs_max);
m_eb_update_B.resize(nlevs_max);
m_flag_info_face.resize(nlevs_max);
m_flag_ext_face.resize(nlevs_max);
m_borrowing.resize(nlevs_max);
Expand Down Expand Up @@ -2310,6 +2311,13 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
AllocInitMultiFab(m_eb_update_E[lev][2], amrex::convert(ba, Ez_nodal_flag), dm, ncomps,
guard_cells.ng_FieldSolver, lev, "m_eb_update_E[z]");

AllocInitMultiFab(m_eb_update_B[lev][0], amrex::convert(ba, Bx_nodal_flag), dm, ncomps,
guard_cells.ng_FieldSolver, lev, "m_eb_update_B[x]");
AllocInitMultiFab(m_eb_update_B[lev][1], amrex::convert(ba, By_nodal_flag), dm, ncomps,
guard_cells.ng_FieldSolver, lev, "m_eb_update_B[y]");
AllocInitMultiFab(m_eb_update_B[lev][2], amrex::convert(ba, Bz_nodal_flag), dm, ncomps,
guard_cells.ng_FieldSolver, lev, "m_eb_update_B[z]");

// TODO: do not allocate these arrays anymore with the Yee solver
//! EB: Lengths of the mesh edges
m_fields.alloc_init(FieldType::edge_lengths, Direction{0}, lev, amrex::convert(ba, Ex_nodal_flag),
Expand Down

0 comments on commit 0214769

Please sign in to comment.