@@ -562,6 +562,7 @@ PML::PML (const int lev, const BoxArray& grid_ba,
562
562
const amrex::IntVect& fill_guards_current,
563
563
bool eb_enabled,
564
564
int max_guard_EB, const amrex::Real v_sigma_sb,
565
+ ablastr::fields::MultiFabRegister& fields,
565
566
const amrex::IntVect do_pml_Lo, const amrex::IntVect do_pml_Hi)
566
567
: m_dive_cleaning(do_pml_dive_cleaning),
567
568
m_divb_cleaning(do_pml_divb_cleaning),
@@ -703,44 +704,43 @@ PML::PML (const int lev, const BoxArray& grid_ba,
703
704
const int ncompe = (m_dive_cleaning) ? 3 : 2 ;
704
705
const int ncompb = (m_divb_cleaning) ? 3 : 2 ;
705
706
706
- auto & warpx = WarpX::GetInstance ();
707
707
using ablastr::fields::Direction;
708
708
709
- const amrex::BoxArray ba_Ex = amrex::convert (ba, warpx. m_fields .get (FieldType::Efield_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
710
- const amrex::BoxArray ba_Ey = amrex::convert (ba, warpx. m_fields .get (FieldType::Efield_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
711
- const amrex::BoxArray ba_Ez = amrex::convert (ba, warpx. m_fields .get (FieldType::Efield_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
712
- warpx. m_fields .alloc_init (FieldType::pml_E_fp, Direction{0 }, lev, ba_Ex, dm, ncompe, nge, 0 .0_rt, false , false );
713
- warpx. m_fields .alloc_init (FieldType::pml_E_fp, Direction{1 }, lev, ba_Ey, dm, ncompe, nge, 0 .0_rt, false , false );
714
- warpx. m_fields .alloc_init (FieldType::pml_E_fp, Direction{2 }, lev, ba_Ez, dm, ncompe, nge, 0 .0_rt, false , false );
715
-
716
- const amrex::BoxArray ba_Bx = amrex::convert (ba, warpx. m_fields .get (FieldType::Bfield_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
717
- const amrex::BoxArray ba_By = amrex::convert (ba, warpx. m_fields .get (FieldType::Bfield_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
718
- const amrex::BoxArray ba_Bz = amrex::convert (ba, warpx. m_fields .get (FieldType::Bfield_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
719
- warpx. m_fields .alloc_init (FieldType::pml_B_fp, Direction{0 }, lev, ba_Bx, dm, ncompb, ngb, 0 .0_rt, false , false );
720
- warpx. m_fields .alloc_init (FieldType::pml_B_fp, Direction{1 }, lev, ba_By, dm, ncompb, ngb, 0 .0_rt, false , false );
721
- warpx. m_fields .alloc_init (FieldType::pml_B_fp, Direction{2 }, lev, ba_Bz, dm, ncompb, ngb, 0 .0_rt, false , false );
722
-
723
- const amrex::BoxArray ba_jx = amrex::convert (ba, WarpX::GetInstance (). m_fields .get (FieldType::current_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
724
- const amrex::BoxArray ba_jy = amrex::convert (ba, WarpX::GetInstance (). m_fields .get (FieldType::current_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
725
- const amrex::BoxArray ba_jz = amrex::convert (ba, WarpX::GetInstance (). m_fields .get (FieldType::current_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
726
- warpx. m_fields .alloc_init (FieldType::pml_j_fp, Direction{0 }, lev, ba_jx, dm, 1 , ngb, 0 .0_rt, false , false );
727
- warpx. m_fields .alloc_init (FieldType::pml_j_fp, Direction{1 }, lev, ba_jy, dm, 1 , ngb, 0 .0_rt, false , false );
728
- warpx. m_fields .alloc_init (FieldType::pml_j_fp, Direction{2 }, lev, ba_jz, dm, 1 , ngb, 0 .0_rt, false , false );
709
+ const amrex::BoxArray ba_Ex = amrex::convert (ba, fields .get (FieldType::Efield_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
710
+ const amrex::BoxArray ba_Ey = amrex::convert (ba, fields .get (FieldType::Efield_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
711
+ const amrex::BoxArray ba_Ez = amrex::convert (ba, fields .get (FieldType::Efield_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
712
+ fields .alloc_init (FieldType::pml_E_fp, Direction{0 }, lev, ba_Ex, dm, ncompe, nge, 0 .0_rt, false , false );
713
+ fields .alloc_init (FieldType::pml_E_fp, Direction{1 }, lev, ba_Ey, dm, ncompe, nge, 0 .0_rt, false , false );
714
+ fields .alloc_init (FieldType::pml_E_fp, Direction{2 }, lev, ba_Ez, dm, ncompe, nge, 0 .0_rt, false , false );
715
+
716
+ const amrex::BoxArray ba_Bx = amrex::convert (ba, fields .get (FieldType::Bfield_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
717
+ const amrex::BoxArray ba_By = amrex::convert (ba, fields .get (FieldType::Bfield_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
718
+ const amrex::BoxArray ba_Bz = amrex::convert (ba, fields .get (FieldType::Bfield_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
719
+ fields .alloc_init (FieldType::pml_B_fp, Direction{0 }, lev, ba_Bx, dm, ncompb, ngb, 0 .0_rt, false , false );
720
+ fields .alloc_init (FieldType::pml_B_fp, Direction{1 }, lev, ba_By, dm, ncompb, ngb, 0 .0_rt, false , false );
721
+ fields .alloc_init (FieldType::pml_B_fp, Direction{2 }, lev, ba_Bz, dm, ncompb, ngb, 0 .0_rt, false , false );
722
+
723
+ const amrex::BoxArray ba_jx = amrex::convert (ba, fields .get (FieldType::current_fp, Direction{0 }, 0 )->ixType ().toIntVect ());
724
+ const amrex::BoxArray ba_jy = amrex::convert (ba, fields .get (FieldType::current_fp, Direction{1 }, 0 )->ixType ().toIntVect ());
725
+ const amrex::BoxArray ba_jz = amrex::convert (ba, fields .get (FieldType::current_fp, Direction{2 }, 0 )->ixType ().toIntVect ());
726
+ fields .alloc_init (FieldType::pml_j_fp, Direction{0 }, lev, ba_jx, dm, 1 , ngb, 0 .0_rt, false , false );
727
+ fields .alloc_init (FieldType::pml_j_fp, Direction{1 }, lev, ba_jy, dm, 1 , ngb, 0 .0_rt, false , false );
728
+ fields .alloc_init (FieldType::pml_j_fp, Direction{2 }, lev, ba_jz, dm, 1 , ngb, 0 .0_rt, false , false );
729
729
730
730
#ifdef AMREX_USE_EB
731
731
if (eb_enabled) {
732
732
const amrex::IntVect max_guard_EB_vect = amrex::IntVect (max_guard_EB);
733
- warpx. m_fields .alloc_init (FieldType::pml_edge_lengths, Direction{0 }, lev, ba_Ex, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
734
- warpx. m_fields .alloc_init (FieldType::pml_edge_lengths, Direction{1 }, lev, ba_Ey, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
735
- warpx. m_fields .alloc_init (FieldType::pml_edge_lengths, Direction{2 }, lev, ba_Ez, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
733
+ fields .alloc_init (FieldType::pml_edge_lengths, Direction{0 }, lev, ba_Ex, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
734
+ fields .alloc_init (FieldType::pml_edge_lengths, Direction{1 }, lev, ba_Ey, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
735
+ fields .alloc_init (FieldType::pml_edge_lengths, Direction{2 }, lev, ba_Ez, dm, WarpX::ncomps, max_guard_EB_vect, 0 .0_rt, false , false );
736
736
737
737
if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee ||
738
738
WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC ||
739
739
WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) {
740
740
741
741
auto const eb_fact = fieldEBFactory ();
742
742
743
- ablastr::fields::VectorField t_pml_edge_lengths = warpx. m_fields .get_alldirs (FieldType::pml_edge_lengths, lev);
743
+ ablastr::fields::VectorField t_pml_edge_lengths = fields .get_alldirs (FieldType::pml_edge_lengths, lev);
744
744
warpx::embedded_boundary::ComputeEdgeLengths (t_pml_edge_lengths, eb_fact);
745
745
warpx::embedded_boundary::ScaleEdges (t_pml_edge_lengths, WarpX::CellSize (lev));
746
746
@@ -752,7 +752,7 @@ PML::PML (const int lev, const BoxArray& grid_ba,
752
752
if (m_dive_cleaning)
753
753
{
754
754
const amrex::BoxArray ba_F_nodal = amrex::convert (ba, amrex::IntVect::TheNodeVector ());
755
- warpx. m_fields .alloc_init (FieldType::pml_F_fp, lev, ba_F_nodal, dm, 3 , ngf, 0 .0_rt, false , false );
755
+ fields .alloc_init (FieldType::pml_F_fp, lev, ba_F_nodal, dm, 3 , ngf, 0 .0_rt, false , false );
756
756
}
757
757
758
758
if (m_divb_cleaning)
@@ -762,7 +762,7 @@ PML::PML (const int lev, const BoxArray& grid_ba,
762
762
(grid_type == GridType::Collocated) ? amrex::IntVect::TheNodeVector ()
763
763
: amrex::IntVect::TheCellVector ();
764
764
const amrex::BoxArray ba_G_nodal = amrex::convert (ba, G_nodal_flag);
765
- warpx. m_fields .alloc_init (FieldType::pml_G_fp, lev, ba_G_nodal, dm, 3 , ngf, 0 .0_rt, false , false );
765
+ fields .alloc_init (FieldType::pml_G_fp, lev, ba_G_nodal, dm, 3 , ngf, 0 .0_rt, false , false );
766
766
}
767
767
768
768
Box single_domain_box = is_single_box_domain ? domain0 : Box ();
@@ -844,24 +844,24 @@ PML::PML (const int lev, const BoxArray& grid_ba,
844
844
cdm.define (cba);
845
845
}
846
846
847
- const amrex::BoxArray cba_Ex = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Efield_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
848
- const amrex::BoxArray cba_Ey = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Efield_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
849
- const amrex::BoxArray cba_Ez = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Efield_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
850
- warpx. m_fields .alloc_init (FieldType::pml_E_cp, Direction{0 }, lev, cba_Ex, cdm, ncompe, nge, 0 .0_rt, false , false );
851
- warpx. m_fields .alloc_init (FieldType::pml_E_cp, Direction{1 }, lev, cba_Ey, cdm, ncompe, nge, 0 .0_rt, false , false );
852
- warpx. m_fields .alloc_init (FieldType::pml_E_cp, Direction{2 }, lev, cba_Ez, cdm, ncompe, nge, 0 .0_rt, false , false );
847
+ const amrex::BoxArray cba_Ex = amrex::convert (cba, fields .get (FieldType::Efield_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
848
+ const amrex::BoxArray cba_Ey = amrex::convert (cba, fields .get (FieldType::Efield_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
849
+ const amrex::BoxArray cba_Ez = amrex::convert (cba, fields .get (FieldType::Efield_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
850
+ fields .alloc_init (FieldType::pml_E_cp, Direction{0 }, lev, cba_Ex, cdm, ncompe, nge, 0 .0_rt, false , false );
851
+ fields .alloc_init (FieldType::pml_E_cp, Direction{1 }, lev, cba_Ey, cdm, ncompe, nge, 0 .0_rt, false , false );
852
+ fields .alloc_init (FieldType::pml_E_cp, Direction{2 }, lev, cba_Ez, cdm, ncompe, nge, 0 .0_rt, false , false );
853
853
854
- const amrex::BoxArray cba_Bx = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Bfield_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
855
- const amrex::BoxArray cba_By = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Bfield_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
856
- const amrex::BoxArray cba_Bz = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::Bfield_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
857
- warpx. m_fields .alloc_init (FieldType::pml_B_cp, Direction{0 }, lev, cba_Bx, cdm, ncompb, ngb, 0 .0_rt, false , false );
858
- warpx. m_fields .alloc_init (FieldType::pml_B_cp, Direction{1 }, lev, cba_By, cdm, ncompb, ngb, 0 .0_rt, false , false );
859
- warpx. m_fields .alloc_init (FieldType::pml_B_cp, Direction{2 }, lev, cba_Bz, cdm, ncompb, ngb, 0 .0_rt, false , false );
854
+ const amrex::BoxArray cba_Bx = amrex::convert (cba, fields .get (FieldType::Bfield_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
855
+ const amrex::BoxArray cba_By = amrex::convert (cba, fields .get (FieldType::Bfield_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
856
+ const amrex::BoxArray cba_Bz = amrex::convert (cba, fields .get (FieldType::Bfield_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
857
+ fields .alloc_init (FieldType::pml_B_cp, Direction{0 }, lev, cba_Bx, cdm, ncompb, ngb, 0 .0_rt, false , false );
858
+ fields .alloc_init (FieldType::pml_B_cp, Direction{1 }, lev, cba_By, cdm, ncompb, ngb, 0 .0_rt, false , false );
859
+ fields .alloc_init (FieldType::pml_B_cp, Direction{2 }, lev, cba_Bz, cdm, ncompb, ngb, 0 .0_rt, false , false );
860
860
861
861
if (m_dive_cleaning)
862
862
{
863
863
const amrex::BoxArray cba_F_nodal = amrex::convert (cba, amrex::IntVect::TheNodeVector ());
864
- warpx. m_fields .alloc_init (FieldType::pml_F_cp, lev, cba_F_nodal, cdm, 3 , ngf, 0 .0_rt, false , false );
864
+ fields .alloc_init (FieldType::pml_F_cp, lev, cba_F_nodal, cdm, 3 , ngf, 0 .0_rt, false , false );
865
865
}
866
866
867
867
if (m_divb_cleaning)
@@ -871,15 +871,15 @@ PML::PML (const int lev, const BoxArray& grid_ba,
871
871
(grid_type == GridType::Collocated) ? amrex::IntVect::TheNodeVector ()
872
872
: amrex::IntVect::TheCellVector ();
873
873
const amrex::BoxArray cba_G_nodal = amrex::convert (cba, G_nodal_flag);
874
- warpx. m_fields .alloc_init (FieldType::pml_G_cp, lev, cba_G_nodal, cdm, 3 , ngf, 0 .0_rt, false , false );
874
+ fields .alloc_init (FieldType::pml_G_cp, lev, cba_G_nodal, cdm, 3 , ngf, 0 .0_rt, false , false );
875
875
}
876
876
877
- const amrex::BoxArray cba_jx = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::current_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
878
- const amrex::BoxArray cba_jy = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::current_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
879
- const amrex::BoxArray cba_jz = amrex::convert (cba, WarpX::GetInstance (). m_fields .get (FieldType::current_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
880
- warpx. m_fields .alloc_init (FieldType::pml_j_cp, Direction{0 }, lev, cba_jx, cdm, 1 , ngb, 0 .0_rt, false , false );
881
- warpx. m_fields .alloc_init (FieldType::pml_j_cp, Direction{1 }, lev, cba_jy, cdm, 1 , ngb, 0 .0_rt, false , false );
882
- warpx. m_fields .alloc_init (FieldType::pml_j_cp, Direction{2 }, lev, cba_jz, cdm, 1 , ngb, 0 .0_rt, false , false );
877
+ const amrex::BoxArray cba_jx = amrex::convert (cba, fields .get (FieldType::current_cp, Direction{0 }, 1 )->ixType ().toIntVect ());
878
+ const amrex::BoxArray cba_jy = amrex::convert (cba, fields .get (FieldType::current_cp, Direction{1 }, 1 )->ixType ().toIntVect ());
879
+ const amrex::BoxArray cba_jz = amrex::convert (cba, fields .get (FieldType::current_cp, Direction{2 }, 1 )->ixType ().toIntVect ());
880
+ fields .alloc_init (FieldType::pml_j_cp, Direction{0 }, lev, cba_jx, cdm, 1 , ngb, 0 .0_rt, false , false );
881
+ fields .alloc_init (FieldType::pml_j_cp, Direction{1 }, lev, cba_jy, cdm, 1 , ngb, 0 .0_rt, false , false );
882
+ fields .alloc_init (FieldType::pml_j_cp, Direction{2 }, lev, cba_jz, cdm, 1 , ngb, 0 .0_rt, false , false );
883
883
884
884
single_domain_box = is_single_box_domain ? cdomain : Box ();
885
885
sigba_cp = std::make_unique<MultiSigmaBox>(cba, cdm, &grid_cba_reduced, cgeom->CellSize (),
0 commit comments