diff options
Diffstat (limited to 'Source')
35 files changed, 185 insertions, 185 deletions
diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 76dbd3fde..5ba9ac2cd 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -598,7 +598,7 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri IntVect nge = IntVect(AMREX_D_DECL(2, 2, 2)); IntVect ngb = IntVect(AMREX_D_DECL(2, 2, 2)); int ngf_int = 0; - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC) ngf_int = std::max( ngf_int, 1 ); + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC) ngf_int = std::max( ngf_int, 1 ); IntVect ngf = IntVect(AMREX_D_DECL(ngf_int, ngf_int, ngf_int)); if (do_moving_window) { @@ -610,7 +610,7 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri ngf[WarpX::moving_window_dir] = std::max(ngf[WarpX::moving_window_dir], rr); } - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Increase the number of guard cells, in order to fit the extent // of the stencil for the spectral solver int ngFFt_x = do_nodal ? nox_fft : nox_fft/2; @@ -701,9 +701,9 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri pml_edge_lengths[2] = std::make_unique<MultiFab>(amrex::convert( ba, WarpX::GetInstance().getEfield_fp(0,2).ixType().toIntVect() ), dm, WarpX::ncomps, max_guard_EB ); - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee || + WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC || + WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { auto const eb_fact = fieldEBFactory(); @@ -736,7 +736,7 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri sigba_fp = std::make_unique<MultiSigmaBox>(ba, dm, grid_ba_reduced, geom->CellSize(), IntVect(ncell), IntVect(delta), single_domain_box, v_sigma_sb); - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { #ifndef WARPX_USE_PSATD amrex::ignore_unused(lev, dt, J_in_time, rho_in_time); # if(AMREX_SPACEDIM!=3) @@ -765,7 +765,7 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri if (cgeom) { - if (WarpX::maxwell_solver_id != MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { nge = IntVect(AMREX_D_DECL(1, 1, 1)); ngb = IntVect(AMREX_D_DECL(1, 1, 1)); } @@ -858,7 +858,7 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri sigba_cp = std::make_unique<MultiSigmaBox>(cba, cdm, grid_cba_reduced, cgeom->CellSize(), cncells, cdelta, single_domain_box, v_sigma_sb); - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { #ifndef WARPX_USE_PSATD amrex::ignore_unused(dt); WARPX_ALWAYS_ASSERT_WITH_MESSAGE(false, diff --git a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp index 2ec21308a..3859b859c 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp @@ -34,7 +34,7 @@ DivEFunctor::operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_ amrex::IntVect cell_type = amrex::IntVect::TheNodeVector(); #ifdef WARPX_DIM_RZ // For RZ spectral, all quantities are cell centered. - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) cell_type = amrex::IntVect::TheCellVector(); #endif const amrex::BoxArray& ba = amrex::convert(warpx.boxArray(m_lev), cell_type); diff --git a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp index fab362e03..de9257722 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/RhoFunctor.cpp @@ -56,7 +56,7 @@ RhoFunctor::operator() ( amrex::MultiFab& mf_dst, const int dcomp, const int /*i #if (defined WARPX_DIM_RZ) && (defined WARPX_USE_PSATD) // Apply k-space filtering when using the PSATD solver - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { if (WarpX::use_kspace_filter) { auto & solver = warpx.get_spectral_solver_fp(m_lev); diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp index 236985de4..78d82e4e1 100644 --- a/Source/Diagnostics/Diagnostics.cpp +++ b/Source/Diagnostics/Diagnostics.cpp @@ -75,7 +75,7 @@ Diagnostics::BaseReadParameters () // Sanity check if user requests to plot phi if (utils::algorithms::is_in(m_varnames_fields, "phi")){ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - warpx.do_electrostatic==ElectrostaticSolverAlgo::LabFrame, + warpx.electrostatic_solver_id==ElectrostaticSolverAlgo::LabFrame, "plot phi only works if do_electrostatic = labframe"); } diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp index 4320bc7ae..c5fdcc205 100644 --- a/Source/Diagnostics/WarpXOpenPMD.cpp +++ b/Source/Diagnostics/WarpXOpenPMD.cpp @@ -1131,12 +1131,12 @@ WarpXOpenPMDPlot::SetupFields ( openPMD::Container< openPMD::Mesh >& meshes, } meshes.setAttribute("fieldSolver", []() { - switch (WarpX::maxwell_solver_id) { - case MaxwellSolverAlgo::Yee : + switch (WarpX::electromagnetic_solver_id) { + case ElectromagneticSolverAlgo::Yee : return "Yee"; - case MaxwellSolverAlgo::CKC : + case ElectromagneticSolverAlgo::CKC : return "CK"; - case MaxwellSolverAlgo::PSATD : + case ElectromagneticSolverAlgo::PSATD : return "PSATD"; default: return "other"; diff --git a/Source/Evolve/WarpXComputeDt.cpp b/Source/Evolve/WarpXComputeDt.cpp index 99cc307e6..b68dfba4e 100644 --- a/Source/Evolve/WarpXComputeDt.cpp +++ b/Source/Evolve/WarpXComputeDt.cpp @@ -32,11 +32,19 @@ void WarpX::ComputeDt () { - // Determine + // Handle cases where the timestep is not limited by the speed of light + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::None) { + for (int lev=0; lev<=max_level; lev++) { + dt[lev] = const_dt; + } + return; + } + + // Determine the appropriate timestep as limited by the speed of light const amrex::Real* dx = geom[max_level].CellSize(); amrex::Real deltat = 0.; - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Computation of dt for spectral algorithm // (determined by the minimum cell size in all directions) #if defined(WARPX_DIM_1D_Z) @@ -50,21 +58,20 @@ WarpX::ComputeDt () // Computation of dt for FDTD algorithm #ifdef WARPX_DIM_RZ // - In RZ geometry - if (maxwell_solver_id == MaxwellSolverAlgo::Yee) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee) { deltat = cfl * CylindricalYeeAlgorithm::ComputeMaxDt(dx, n_rz_azimuthal_modes); #else // - In Cartesian geometry if (do_nodal) { deltat = cfl * CartesianNodalAlgorithm::ComputeMaxDt(dx); - } else if (maxwell_solver_id == MaxwellSolverAlgo::Yee - || maxwell_solver_id == MaxwellSolverAlgo::ECT) { + } else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee + || electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { deltat = cfl * CartesianYeeAlgorithm::ComputeMaxDt(dx); - } else if (maxwell_solver_id == MaxwellSolverAlgo::CKC) { + } else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC) { deltat = cfl * CartesianCKCAlgorithm::ComputeMaxDt(dx); #endif } else { - amrex::Abort(Utils::TextMsg::Err( - "ComputeDt: Unknown algorithm")); + amrex::Abort(Utils::TextMsg::Err("ComputeDt: Unknown algorithm")); } } @@ -76,12 +83,6 @@ WarpX::ComputeDt () dt[lev] = dt[lev+1] * refRatio(lev)[0]; } } - - if (do_electrostatic != ElectrostaticSolverAlgo::None) { - for (int lev=0; lev<=max_level; lev++) { - dt[lev] = const_dt; - } - } } void diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index 2c87d1efa..6e04adc3b 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -122,7 +122,7 @@ WarpX::Evolve (int numsteps) // Particles have p^{n} and x^{n}. // is_synchronized is true. if (is_synchronized) { - if (do_electrostatic == ElectrostaticSolverAlgo::None) { + if (electrostatic_solver_id == ElectrostaticSolverAlgo::None) { // Not called at each iteration, so exchange all guard cells FillBoundaryE(guard_cells.ng_alloc_EB); FillBoundaryB(guard_cells.ng_alloc_EB); @@ -138,7 +138,7 @@ WarpX::Evolve (int numsteps) } is_synchronized = false; } else { - if (do_electrostatic == ElectrostaticSolverAlgo::None) { + if (electrostatic_solver_id == ElectrostaticSolverAlgo::None) { // Beyond one step, we have E^{n} and B^{n}. // Particles have p^{n-1/2} and x^{n}. @@ -153,7 +153,7 @@ WarpX::Evolve (int numsteps) FillBoundaryB_avg(guard_cells.ng_FieldGather); } // TODO Remove call to FillBoundaryAux before UpdateAuxilaryData? - if (WarpX::maxwell_solver_id != MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) FillBoundaryAux(guard_cells.ng_UpdateAux); UpdateAuxilaryData(); FillBoundaryAux(guard_cells.ng_UpdateAux); @@ -177,7 +177,7 @@ WarpX::Evolve (int numsteps) ExecutePythonCallback("particleinjection"); // Electrostatic case: only gather fields and push particles, // deposition and calculation of fields done further below - if (do_electrostatic != ElectrostaticSolverAlgo::None) + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::None) { const bool skip_deposition = true; PushParticlesandDepose(cur_time, skip_deposition); @@ -278,8 +278,8 @@ WarpX::Evolve (int numsteps) m_particle_boundary_buffer->gatherParticles(*mypc, amrex::GetVecOfConstPtrs(m_distance_to_eb)); - // Electrostatic solver: particles can move by an arbitrary number of cells - if( do_electrostatic != ElectrostaticSolverAlgo::None ) + // Non-Maxwell solver: particles can move by an arbitrary number of cells + if( electromagnetic_solver_id == ElectromagneticSolverAlgo::None ) { mypc->Redistribute(); } else @@ -309,7 +309,7 @@ WarpX::Evolve (int numsteps) mypc->SortParticlesByBin(sort_bin_size); } - if( do_electrostatic != ElectrostaticSolverAlgo::None ) { + if( electrostatic_solver_id != ElectrostaticSolverAlgo::None ) { ExecutePythonCallback("beforeEsolve"); // Electrostatic solver: // For each species: deposit charge and add the associated space-charge @@ -413,7 +413,7 @@ WarpX::OneStep_nosub (Real cur_time) // Push E and B from {n} to {n+1} // (And update guard cells immediately afterwards) - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { if (use_hybrid_QED) { WarpX::Hybrid_QED_Push(dt); @@ -486,7 +486,7 @@ WarpX::OneStep_nosub (Real cur_time) void WarpX::SyncCurrentAndRho () { - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { if (fft_periodic_single_box) { @@ -530,7 +530,7 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) #ifdef WARPX_USE_PSATD WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD, + WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD, "multi-J algorithm not implemented for FDTD" ); @@ -712,7 +712,7 @@ void WarpX::OneStep_sub1 (Real curtime) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - do_electrostatic == ElectrostaticSolverAlgo::None, + electrostatic_solver_id == ElectrostaticSolverAlgo::None, "Electrostatic solver cannot be used with sub-cycling." ); diff --git a/Source/FieldSolver/ElectrostaticSolver.cpp b/Source/FieldSolver/ElectrostaticSolver.cpp index 103fff131..c227506f6 100644 --- a/Source/FieldSolver/ElectrostaticSolver.cpp +++ b/Source/FieldSolver/ElectrostaticSolver.cpp @@ -69,7 +69,7 @@ WarpX::ComputeSpaceChargeField (bool const reset_fields) } } - if (do_electrostatic == ElectrostaticSolverAlgo::LabFrame) { + if (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame) { AddSpaceChargeFieldLabFrame(); } else { @@ -79,13 +79,13 @@ WarpX::ComputeSpaceChargeField (bool const reset_fields) for (int ispecies=0; ispecies<mypc->nSpecies(); ispecies++){ WarpXParticleContainer& species = mypc->GetParticleContainer(ispecies); if (species.initialize_self_fields || - (do_electrostatic == ElectrostaticSolverAlgo::Relativistic)) { + (electrostatic_solver_id == ElectrostaticSolverAlgo::Relativistic)) { AddSpaceChargeField(species); } } // Add the field due to the boundary potentials - if (do_electrostatic == ElectrostaticSolverAlgo::Relativistic){ + if (electrostatic_solver_id == ElectrostaticSolverAlgo::Relativistic){ AddBoundaryField(); } } @@ -311,7 +311,7 @@ WarpX::computePhi (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, #if defined(AMREX_USE_EB) // EB: use AMReX to directly calculate the electric field since with EB's the // simple finite difference scheme in WarpX::computeE sometimes fails - if (do_electrostatic == ElectrostaticSolverAlgo::LabFrame) + if (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame) { // TODO: maybe make this a helper function or pass Efield_fp directly amrex::Vector< diff --git a/Source/FieldSolver/FiniteDifferenceSolver/ApplySilverMuellerBoundary.cpp b/Source/FieldSolver/FiniteDifferenceSolver/ApplySilverMuellerBoundary.cpp index 01ae22a09..d6ac45a98 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/ApplySilverMuellerBoundary.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/ApplySilverMuellerBoundary.cpp @@ -44,7 +44,7 @@ void FiniteDifferenceSolver::ApplySilverMuellerBoundary ( // Ensure that we are using the Yee solver WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - m_fdtd_algo == MaxwellSolverAlgo::Yee, + m_fdtd_algo == ElectromagneticSolverAlgo::Yee, "The Silver-Mueller boundary conditions can only be used with the Yee solver." ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp index f9e434699..9ac32a19d 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp @@ -46,7 +46,7 @@ void FiniteDifferenceSolver::ComputeDivE ( // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ - if (m_fdtd_algo == MaxwellSolverAlgo::Yee){ + if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee){ ComputeDivECylindrical <CylindricalYeeAlgorithm> ( Efield, divEfield ); @@ -55,11 +55,11 @@ void FiniteDifferenceSolver::ComputeDivE ( ComputeDivECartesian <CartesianNodalAlgorithm> ( Efield, divEfield ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { ComputeDivECartesian <CartesianYeeAlgorithm> ( Efield, divEfield ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { ComputeDivECartesian <CartesianCKCAlgorithm> ( Efield, divEfield ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index 02cd6fc42..0e6515a73 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -66,11 +66,11 @@ void FiniteDifferenceSolver::EvolveB ( // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ - if (m_fdtd_algo == MaxwellSolverAlgo::Yee){ + if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee){ ignore_unused(Gfield, face_areas); EvolveBCylindrical <CylindricalYeeAlgorithm> ( Bfield, Efield, lev, dt ); #else - if(m_do_nodal or m_fdtd_algo != MaxwellSolverAlgo::ECT){ + if(m_do_nodal or m_fdtd_algo != ElectromagneticSolverAlgo::ECT){ amrex::ignore_unused(face_areas); } @@ -78,15 +78,15 @@ void FiniteDifferenceSolver::EvolveB ( EvolveBCartesian <CartesianNodalAlgorithm> ( Bfield, Efield, Gfield, lev, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { EvolveBCartesian <CartesianYeeAlgorithm> ( Bfield, Efield, Gfield, lev, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveBCartesian <CartesianCKCAlgorithm> ( Bfield, Efield, Gfield, lev, dt ); #ifdef AMREX_USE_EB - } else if (m_fdtd_algo == MaxwellSolverAlgo::ECT) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::ECT) { EvolveBCartesianECT(Bfield, face_areas, area_mod, ECTRhofield, Venl, flag_info_cell, borrowing, lev, dt); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp index aad66d3d4..2907e3fdf 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp @@ -57,11 +57,11 @@ void FiniteDifferenceSolver::EvolveBPML ( EvolveBPMLCartesian <CartesianNodalAlgorithm> (Bfield, Efield, dt, dive_cleaning); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee || m_fdtd_algo == MaxwellSolverAlgo::ECT) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee || m_fdtd_algo == ElectromagneticSolverAlgo::ECT) { EvolveBPMLCartesian <CartesianYeeAlgorithm> (Bfield, Efield, dt, dive_cleaning); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveBPMLCartesian <CartesianCKCAlgorithm> (Bfield, Efield, dt, dive_cleaning); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp index da91eb73d..fe6181aca 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp @@ -56,7 +56,7 @@ void FiniteDifferenceSolver::EvolveE ( int lev, amrex::Real const dt ) { #ifdef AMREX_USE_EB - if (m_fdtd_algo != MaxwellSolverAlgo::ECT) { + if (m_fdtd_algo != ElectromagneticSolverAlgo::ECT) { amrex::ignore_unused(face_areas, ECTRhofield); } #else @@ -66,7 +66,7 @@ void FiniteDifferenceSolver::EvolveE ( // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ - if (m_fdtd_algo == MaxwellSolverAlgo::Yee){ + if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee){ ignore_unused(edge_lengths); EvolveECylindrical <CylindricalYeeAlgorithm> ( Efield, Bfield, Jfield, Ffield, lev, dt ); #else @@ -74,11 +74,11 @@ void FiniteDifferenceSolver::EvolveE ( EvolveECartesian <CartesianNodalAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, lev, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee || m_fdtd_algo == MaxwellSolverAlgo::ECT) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee || m_fdtd_algo == ElectromagneticSolverAlgo::ECT) { EvolveECartesian <CartesianYeeAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, lev, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveECartesian <CartesianCKCAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, lev, dt ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp index 59a247921..0ef5571a1 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp @@ -54,7 +54,7 @@ void FiniteDifferenceSolver::EvolveECTRho ( const int lev) { #if !defined(WARPX_DIM_RZ) and defined(AMREX_USE_EB) - if (m_fdtd_algo == MaxwellSolverAlgo::ECT) { + if (m_fdtd_algo == ElectromagneticSolverAlgo::ECT) { EvolveRhoCartesianECT(Efield, edge_lengths, face_areas, ECTRhofield, lev); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp index e01d813ff..8232d2d0d 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp @@ -64,12 +64,12 @@ void FiniteDifferenceSolver::EvolveEPML ( EvolveEPMLCartesian <CartesianNodalAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, sigba, dt, pml_has_particles ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee || m_fdtd_algo == MaxwellSolverAlgo::ECT) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee || m_fdtd_algo == ElectromagneticSolverAlgo::ECT) { EvolveEPMLCartesian <CartesianYeeAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, sigba, dt, pml_has_particles ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveEPMLCartesian <CartesianCKCAlgorithm> ( Efield, Bfield, Jfield, edge_lengths, Ffield, sigba, dt, pml_has_particles ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp index ae5600dae..c29c0cdb6 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp @@ -53,7 +53,7 @@ void FiniteDifferenceSolver::EvolveF ( // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ - if (m_fdtd_algo == MaxwellSolverAlgo::Yee){ + if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee){ EvolveFCylindrical <CylindricalYeeAlgorithm> ( Ffield, Efield, rhofield, rhocomp, dt ); @@ -62,11 +62,11 @@ void FiniteDifferenceSolver::EvolveF ( EvolveFCartesian <CartesianNodalAlgorithm> ( Ffield, Efield, rhofield, rhocomp, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { EvolveFCartesian <CartesianYeeAlgorithm> ( Ffield, Efield, rhofield, rhocomp, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveFCartesian <CartesianCKCAlgorithm> ( Ffield, Efield, rhofield, rhocomp, dt ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp index c1d88282e..6a94d205a 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp @@ -55,11 +55,11 @@ void FiniteDifferenceSolver::EvolveFPML ( EvolveFPMLCartesian <CartesianNodalAlgorithm> ( Ffield, Efield, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { EvolveFPMLCartesian <CartesianYeeAlgorithm> ( Ffield, Efield, dt ); - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveFPMLCartesian <CartesianCKCAlgorithm> ( Ffield, Efield, dt ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp index 3a705698b..0c971d577 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp @@ -51,11 +51,11 @@ void FiniteDifferenceSolver::EvolveG ( { EvolveGCartesian<CartesianNodalAlgorithm>(Gfield, Bfield, dt); } - else if (m_fdtd_algo == MaxwellSolverAlgo::Yee) + else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { EvolveGCartesian<CartesianYeeAlgorithm>(Gfield, Bfield, dt); } - else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) + else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveGCartesian<CartesianCKCAlgorithm>(Gfield, Bfield, dt); } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp index f63028f50..e8529ef15 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp @@ -37,7 +37,7 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( m_do_nodal = do_nodal; // return if not FDTD - if (fdtd_algo == MaxwellSolverAlgo::PSATD) + if (fdtd_algo == ElectromagneticSolverAlgo::None || fdtd_algo == ElectromagneticSolverAlgo::PSATD) return; // Calculate coefficients of finite-difference stencil @@ -45,7 +45,7 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( m_dr = cell_size[0]; m_nmodes = WarpX::GetInstance().n_rz_azimuthal_modes; m_rmin = WarpX::GetInstance().Geom(0).ProbLo(0); - if (fdtd_algo == MaxwellSolverAlgo::Yee) { + if (fdtd_algo == ElectromagneticSolverAlgo::Yee) { CylindricalYeeAlgorithm::InitializeStencilCoefficients( cell_size, m_h_stencil_coefs_r, m_h_stencil_coefs_z ); m_stencil_coefs_r.resize(m_h_stencil_coefs_r.size()); @@ -67,12 +67,12 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( CartesianNodalAlgorithm::InitializeStencilCoefficients( cell_size, m_h_stencil_coefs_x, m_h_stencil_coefs_y, m_h_stencil_coefs_z ); - } else if (fdtd_algo == MaxwellSolverAlgo::Yee || fdtd_algo == MaxwellSolverAlgo::ECT) { + } else if (fdtd_algo == ElectromagneticSolverAlgo::Yee || fdtd_algo == ElectromagneticSolverAlgo::ECT) { CartesianYeeAlgorithm::InitializeStencilCoefficients( cell_size, m_h_stencil_coefs_x, m_h_stencil_coefs_y, m_h_stencil_coefs_z ); - } else if (fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (fdtd_algo == ElectromagneticSolverAlgo::CKC) { CartesianCKCAlgorithm::InitializeStencilCoefficients( cell_size, m_h_stencil_coefs_x, m_h_stencil_coefs_y, m_h_stencil_coefs_z ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp index d6bc9be9e..ab2e25014 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp @@ -53,7 +53,7 @@ void FiniteDifferenceSolver::MacroscopicEvolveE ( !m_do_nodal, "macro E-push does not work for nodal"); - if (m_fdtd_algo == MaxwellSolverAlgo::Yee) { + if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { if (WarpX::macroscopic_solver_algo == MacroscopicSolverAlgo::LaxWendroff) { @@ -68,7 +68,7 @@ void FiniteDifferenceSolver::MacroscopicEvolveE ( } - } else if (m_fdtd_algo == MaxwellSolverAlgo::CKC) { + } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { // Note : EvolveE is the same for CKC and Yee. // In the templated Yee and CKC calls, the core operations for EvolveE is the same. diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index e8f20661a..a3a882962 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -880,7 +880,7 @@ WarpX::EvolveE (int lev, PatchType patch_type, amrex::Real a_dt) // ECTRhofield must be recomputed at the very end of the Efield update to ensure // that ECTRhofield is consistent with Efield #ifdef AMREX_USE_EB - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { if (patch_type == PatchType::fine) { m_fdtd_solver_fp[lev]->EvolveECTRho(Efield_fp[lev], m_edge_lengths[lev], m_face_areas[lev], ECTRhofield[lev], lev); diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 4865cfa65..987bab9d4 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -157,15 +157,15 @@ WarpX::PrintMainPICparameters () WarpX::n_rz_azimuthal_modes << "\n"; #endif // WARPX_USE_RZ //Print solver's operation mode (e.g., EM or electrostatic) - if (do_electrostatic == ElectrostaticSolverAlgo::LabFrame) { + if (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame) { amrex::Print() << "Operation mode: | Electrostatic" << "\n"; amrex::Print() << " | - laboratory frame" << "\n"; } - else if (do_electrostatic == ElectrostaticSolverAlgo::Relativistic){ + else if (electrostatic_solver_id == ElectrostaticSolverAlgo::Relativistic){ amrex::Print() << "Operation mode: | Electrostatic" << "\n"; amrex::Print() << " | - relativistic" << "\n"; } - else{ + else if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::None) { amrex::Print() << "Operation mode: | Electromagnetic" << "\n"; } if (em_solver_medium == MediumForEM::Vacuum ){ @@ -218,18 +218,18 @@ WarpX::PrintMainPICparameters () amrex::Print() << "Particle Shape Factor:| " << WarpX::nox << "\n"; amrex::Print() << "-------------------------------------------------------------------------------\n"; // Print solver's type: Yee, CKC, ECT - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee){ + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee){ amrex::Print() << "Maxwell Solver: | Yee \n"; - } - else if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC){ + } + else if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC){ amrex::Print() << "Maxwell Solver: | CKC \n"; } - else if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT){ + else if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT){ amrex::Print() << "Maxwell Solver: | ECT \n"; } #ifdef WARPX_USE_PSATD // Print PSATD solver's configuration - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD){ + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD){ amrex::Print() << "Maxwell Solver: | PSATD \n"; } if ((m_v_galilean[0]!=0) or (m_v_galilean[1]!=0) or (m_v_galilean[2]!=0)) { @@ -295,7 +295,7 @@ WarpX::PrintMainPICparameters () amrex::Print() << " | - use_hybrid_QED = true \n"; } - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD){ + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD){ // Print solver's order std::string psatd_nox_fft, psatd_noy_fft, psatd_noz_fft; psatd_nox_fft = (nox_fft == -1) ? "inf" : std::to_string(nox_fft); @@ -307,11 +307,11 @@ WarpX::PrintMainPICparameters () amrex::Print() << " | - psatd.noy = " << psatd_noy_fft << "\n"; amrex::Print() << " | - psatd.noz = " << psatd_noz_fft << "\n"; } - else if (dims=="2" and WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD){ + else if (dims=="2" and WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD){ amrex::Print() << "Spectral order: | - psatd.nox = " << psatd_nox_fft << "\n"; amrex::Print() << " | - psatd.noz = " << psatd_noz_fft << "\n"; } - else if (dims=="1" and WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD){ + else if (dims=="1" and WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD){ amrex::Print() << "Spectral order: | - psatd.noz = " << psatd_noz_fft << "\n"; } } @@ -867,7 +867,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) #ifdef AMREX_USE_EB // We initialize ECTRhofield consistently with the Efield - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { m_fdtd_solver_fp[lev]->EvolveECTRho(Efield_fp[lev], m_edge_lengths[lev], m_face_areas[lev], ECTRhofield[lev], lev); @@ -897,7 +897,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) 'E', lev); #ifdef AMREX_USE_EB - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { // We initialize ECTRhofield consistently with the Efield m_fdtd_solver_cp[lev]->EvolveECTRho(Efield_cp[lev], m_edge_lengths[lev], m_face_areas[lev], ECTRhofield[lev], lev); @@ -1240,9 +1240,7 @@ void WarpX::InitializeEBGridData (int lev) "particles are close to embedded boundaries"); } - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD ) { auto const eb_fact = fieldEBFactory(lev); @@ -1251,7 +1249,7 @@ void WarpX::InitializeEBGridData (int lev) ComputeFaceAreas(m_face_areas[lev], eb_fact); ScaleAreas(m_face_areas[lev], CellSize(lev)); - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { MarkCells(); ComputeFaceExtensions(); } @@ -1267,7 +1265,7 @@ void WarpX::InitializeEBGridData (int lev) void WarpX::CheckKnownIssues() { - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD && + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD && (std::any_of(do_pml_Lo[0].begin(),do_pml_Lo[0].end(),[](const auto& ee){return ee;}) || std::any_of(do_pml_Hi[0].begin(),do_pml_Hi[0].end(),[](const auto& ee){return ee;})) ) { diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H index c122aaa96..248a3dabf 100644 --- a/Source/Parallelization/GuardCellManager.H +++ b/Source/Parallelization/GuardCellManager.H @@ -36,12 +36,11 @@ public: * \param noy_fft order of PSATD in y direction * \param noz_fft order of PSATD in z direction * \param nci_corr_stencil stencil of NCI corrector - * \param maxwell_solver_id if of Maxwell solver + * \param electromagnetic_solver_id Integer corresponding to the type of Maxwell solver * \param max_level max level of the simulation * \param v_galilean Velocity used in the Galilean PSATD scheme * \param v_comoving Velocity used in the comoving PSATD scheme * \param safe_guard_cells Run in safe mode, exchanging more guard cells, and more often in the PIC loop (for debugging). - * \param do_electrostatic Whether to run in electrostatic mode i.e. solving the Poisson equation instead of the Maxwell equations. * \param do_multi_J Whether to use the multi-J PSATD scheme * \param fft_do_time_averaging Whether to average the E and B field in time (with PSATD) before interpolating them onto the macro-particles * \param do_pml whether pml is turned on (only used by RZ PSATD) @@ -60,12 +59,11 @@ public: const int nox, const int nox_fft, const int noy_fft, const int noz_fft, const int nci_corr_stencil, - const int maxwell_solver_id, + const int electromagnetic_solver_id, const int max_level, const amrex::Vector<amrex::Real> v_galilean, const amrex::Vector<amrex::Real> v_comoving, const bool safe_guard_cells, - const int do_electrostatic, const int do_multi_J, const bool fft_do_time_averaging, const bool do_pml, diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp index d01230e4b..aa9d9f448 100644 --- a/Source/Parallelization/GuardCellManager.cpp +++ b/Source/Parallelization/GuardCellManager.cpp @@ -42,12 +42,11 @@ guardCellManager::Init ( const int nox, const int nox_fft, const int noy_fft, const int noz_fft, const int nci_corr_stencil, - const int maxwell_solver_id, + const int electromagnetic_solver_id, const int max_level, const amrex::Vector<amrex::Real> v_galilean, const amrex::Vector<amrex::Real> v_comoving, const bool safe_guard_cells, - const int do_electrostatic, const int do_multi_J, const bool fft_do_time_averaging, const bool do_pml, @@ -135,7 +134,7 @@ guardCellManager::Init ( // Electromagnetic simulations: account for change in particle positions within half a time step // for current deposition and within one time step for charge deposition (since rho is needed // both at the beginning and at the end of the PIC iteration) - if (do_electrostatic == ElectrostaticSolverAlgo::None) + if (electromagnetic_solver_id != ElectromagneticSolverAlgo::None) { for (int i = 0; i < AMREX_SPACEDIM; i++) { @@ -170,7 +169,7 @@ guardCellManager::Init ( // After pushing particle int ng_alloc_F_int = (do_moving_window) ? 2 : 0; // CKC solver requires one additional guard cell - if (maxwell_solver_id == MaxwellSolverAlgo::CKC) ng_alloc_F_int = std::max( ng_alloc_F_int, 1 ); + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC) ng_alloc_F_int = std::max( ng_alloc_F_int, 1 ); ng_alloc_F = IntVect(AMREX_D_DECL(ng_alloc_F_int, ng_alloc_F_int, ng_alloc_F_int)); // Used if warpx.do_divb_cleaning = 1 @@ -178,7 +177,7 @@ guardCellManager::Init ( // TODO Does the CKC solver require one additional guard cell (as for F)? ng_alloc_G = IntVect(AMREX_D_DECL(ng_alloc_G_int, ng_alloc_G_int, ng_alloc_G_int)); - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // The number of guard cells should be enough to contain the stencil of the FFT solver. // @@ -245,13 +244,14 @@ guardCellManager::Init ( } // Compute number of cells required for Field Solver - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { ng_FieldSolver = ng_alloc_EB; ng_FieldSolverF = ng_alloc_EB; ng_FieldSolverG = ng_alloc_EB; } #ifdef WARPX_DIM_RZ - else if (maxwell_solver_id == MaxwellSolverAlgo::Yee) { + else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::None || + electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee) { ng_FieldSolver = CylindricalYeeAlgorithm::GetMaxGuardCell(); ng_FieldSolverF = CylindricalYeeAlgorithm::GetMaxGuardCell(); ng_FieldSolverG = CylindricalYeeAlgorithm::GetMaxGuardCell(); @@ -262,12 +262,13 @@ guardCellManager::Init ( ng_FieldSolver = CartesianNodalAlgorithm::GetMaxGuardCell(); ng_FieldSolverF = CartesianNodalAlgorithm::GetMaxGuardCell(); ng_FieldSolverG = CartesianNodalAlgorithm::GetMaxGuardCell(); - } else if (maxwell_solver_id == MaxwellSolverAlgo::Yee - || maxwell_solver_id == MaxwellSolverAlgo::ECT) { + } else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::None || + electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee || + electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { ng_FieldSolver = CartesianYeeAlgorithm::GetMaxGuardCell(); ng_FieldSolverF = CartesianYeeAlgorithm::GetMaxGuardCell(); ng_FieldSolverG = CartesianYeeAlgorithm::GetMaxGuardCell(); - } else if (maxwell_solver_id == MaxwellSolverAlgo::CKC) { + } else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC) { ng_FieldSolver = CartesianCKCAlgorithm::GetMaxGuardCell(); ng_FieldSolverF = CartesianCKCAlgorithm::GetMaxGuardCell(); ng_FieldSolverG = CartesianCKCAlgorithm::GetMaxGuardCell(); @@ -281,7 +282,7 @@ guardCellManager::Init ( ng_alloc_F.max( ng_FieldSolverF ); ng_alloc_G.max( ng_FieldSolverG ); - if (do_moving_window && maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (do_moving_window && electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { ng_afterPushPSATD = ng_alloc_EB; } diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index 396b0f24b..fed81f2fc 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -65,7 +65,7 @@ void WarpX::UpdateAuxilaryDataStagToNodal () { #ifndef WARPX_USE_PSATD - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( false, "WarpX::UpdateAuxilaryDataStagToNodal: PSATD solver requires " "WarpX build with spectral solver support."); diff --git a/Source/Parallelization/WarpXRegrid.cpp b/Source/Parallelization/WarpXRegrid.cpp index 794a48a5b..99885f619 100644 --- a/Source/Parallelization/WarpXRegrid.cpp +++ b/Source/Parallelization/WarpXRegrid.cpp @@ -181,12 +181,10 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi RemakeMultiFab(Bfield_avg_fp[lev][idim], dm, true); } #ifdef AMREX_USE_EB - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT || - WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC){ + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { RemakeMultiFab(m_edge_lengths[lev][idim], dm, false); RemakeMultiFab(m_face_areas[lev][idim], dm, false); - if(WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT){ + if(WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT){ RemakeMultiFab(Venl[lev][idim], dm, false); RemakeMultiFab(m_flag_info_face[lev][idim], dm, false); RemakeMultiFab(m_flag_ext_face[lev][idim], dm, false); @@ -218,7 +216,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi #endif #ifdef WARPX_USE_PSATD - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { if (spectral_solver_fp[lev] != nullptr) { // Get the cell-centered box BoxArray realspace_ba = ba; // Copy box @@ -282,7 +280,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi RemakeMultiFab(rho_cp[lev], dm, false); #ifdef WARPX_USE_PSATD - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { if (spectral_solver_cp[lev] != nullptr) { BoxArray cba = ba; cba.coarsen(refRatio(lev-1)); diff --git a/Source/Parallelization/WarpXSumGuardCells.H b/Source/Parallelization/WarpXSumGuardCells.H index 1bfbf5162..425ce3208 100644 --- a/Source/Parallelization/WarpXSumGuardCells.H +++ b/Source/Parallelization/WarpXSumGuardCells.H @@ -34,7 +34,7 @@ WarpXSumGuardCells(amrex::MultiFab& mf, const amrex::Periodicity& period, amrex::IntVect n_updated_guards; // Update both valid cells and guard cells - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) n_updated_guards = mf.nGrowVect(); else // Update only the valid cells n_updated_guards = amrex::IntVect::TheZeroVector(); @@ -65,7 +65,7 @@ WarpXSumGuardCells(amrex::MultiFab& dst, amrex::MultiFab& src, amrex::IntVect n_updated_guards; // Update both valid cells and guard cells - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) n_updated_guards = dst.nGrowVect(); else // Update only the valid cells n_updated_guards = amrex::IntVect::TheZeroVector(); diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 9c7563a3f..7200df69a 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -536,7 +536,7 @@ MultiParticleContainer::GetZeroChargeDensity (const int lev) bool is_PSATD_RZ = false; #ifdef WARPX_DIM_RZ - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) is_PSATD_RZ = true; #endif if( !is_PSATD_RZ ) diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 7e04d6902..e79d526f1 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -2043,13 +2043,13 @@ PhysicalParticleContainer::Evolve (int lev, np_current, np-np_current, thread_num, lev, lev-1, dt, relative_time); } - } // end of "if do_electrostatic == ElectrostaticSolverAlgo::None" + } // end of "if electrostatic_solver_id == ElectrostaticSolverAlgo::None" } // end of "if do_not_push" if (rho && ! skip_deposition && ! do_not_deposit) { // Deposit charge after particle push, in component 1 of MultiFab rho. // (Skipped for electrostatic solver, as this may lead to out-of-bounds) - if (WarpX::do_electrostatic == ElectrostaticSolverAlgo::None) { + if (WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::None) { int* AMREX_RESTRICT ion_lev; if (do_field_ionization){ ion_lev = pti.GetiAttribs(particle_icomps["ionizationLevel"]).dataPtr(); diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 3f0e0bcba..34e25d1a2 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -735,7 +735,7 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local) bool is_PSATD_RZ = false; #ifdef WARPX_DIM_RZ - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) is_PSATD_RZ = true; #endif if( !is_PSATD_RZ ) diff --git a/Source/Utils/WarpXAlgorithmSelection.H b/Source/Utils/WarpXAlgorithmSelection.H index 9346159ab..c3160cfad 100644 --- a/Source/Utils/WarpXAlgorithmSelection.H +++ b/Source/Utils/WarpXAlgorithmSelection.H @@ -36,12 +36,13 @@ struct MacroscopicSolverAlgo { }; }; -struct MaxwellSolverAlgo { +struct ElectromagneticSolverAlgo { enum { - Yee = 0, - CKC = 1, - PSATD = 2, - ECT = 3 + None = 0, + Yee = 1, + CKC = 2, + PSATD = 3, + ECT = 4 }; }; diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp index 1272c146a..b99459b46 100644 --- a/Source/Utils/WarpXAlgorithmSelection.cpp +++ b/Source/Utils/WarpXAlgorithmSelection.cpp @@ -22,12 +22,13 @@ // Define dictionary with correspondance between user-input strings, // and corresponding integer for use inside the code -const std::map<std::string, int> maxwell_solver_algo_to_int = { - {"yee", MaxwellSolverAlgo::Yee }, - {"ckc", MaxwellSolverAlgo::CKC }, - {"psatd", MaxwellSolverAlgo::PSATD }, - {"ect", MaxwellSolverAlgo::ECT }, - {"default", MaxwellSolverAlgo::Yee } +const std::map<std::string, int> electromagnetic_solver_algo_to_int = { + {"none", ElectromagneticSolverAlgo::None }, + {"yee", ElectromagneticSolverAlgo::Yee }, + {"ckc", ElectromagneticSolverAlgo::CKC }, + {"psatd", ElectromagneticSolverAlgo::PSATD }, + {"ect", ElectromagneticSolverAlgo::ECT }, + {"default", ElectromagneticSolverAlgo::Yee } }; const std::map<std::string, int> electrostatic_solver_algo_to_int = { @@ -131,14 +132,14 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){ // Pick the right dictionary std::map<std::string, int> algo_to_int; if (0 == std::strcmp(pp_search_key, "maxwell_solver")) { - algo_to_int = maxwell_solver_algo_to_int; + algo_to_int = electromagnetic_solver_algo_to_int; } else if (0 == std::strcmp(pp_search_key, "do_electrostatic")) { algo_to_int = electrostatic_solver_algo_to_int; } else if (0 == std::strcmp(pp_search_key, "particle_pusher")) { algo_to_int = particle_pusher_algo_to_int; } else if (0 == std::strcmp(pp_search_key, "current_deposition")) { algo_to_int = current_deposition_algo_to_int; - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) algo_to_int["default"] = CurrentDepositionAlgo::Direct; } else if (0 == std::strcmp(pp_search_key, "charge_deposition")) { algo_to_int = charge_deposition_algo_to_int; diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index a36d31e93..42b2308b9 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -74,8 +74,8 @@ void ParseGeometryInput() #ifdef WARPX_DIM_RZ ParmParse pp_algo("algo"); - int maxwell_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) + int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE(prob_lo[0] == 0., "Lower bound of radial coordinate (prob_lo[0]) with RZ PSATD solver must be zero"); @@ -302,10 +302,10 @@ void CheckGriddingForRZSpectral () CheckDims(); ParmParse pp_algo("algo"); - int maxwell_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); // only check for PSATD in RZ - if (maxwell_solver_id != MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) return; int max_level; @@ -393,7 +393,7 @@ void ReadBCParams () ParmParse pp_geometry("geometry"); ParmParse pp_warpx("warpx"); ParmParse pp_algo("algo"); - int maxwell_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + int electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); WARPX_ALWAYS_ASSERT_WITH_MESSAGE( !pp_geometry.queryarr("is_periodic", geom_periodicity), @@ -448,7 +448,7 @@ void ReadBCParams () } WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - (maxwell_solver_id != MaxwellSolverAlgo::PSATD) || + (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) || ( WarpX::field_boundary_lo[idim] != FieldBoundaryType::PEC && WarpX::field_boundary_hi[idim] != FieldBoundaryType::PEC diff --git a/Source/WarpX.H b/Source/WarpX.H index 402b4ee66..1cad22d40 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -155,7 +155,7 @@ public: //! Integer that corresponds to the particle push algorithm (Boris, Vay, Higuera-Cary) static short particle_pusher_algo; //! Integer that corresponds to the type of Maxwell solver (Yee, CKC, PSATD, ECT) - static short maxwell_solver_id; + static short electromagnetic_solver_id; /** Records a number corresponding to the load balance cost update strategy * being used (0, 1, 2 corresponding to timers, heuristic, or gpuclock). */ @@ -733,7 +733,7 @@ public: static const amrex::iMultiFab* CurrentBufferMasks (int lev); static const amrex::iMultiFab* GatherBufferMasks (int lev); - static int do_electrostatic; + static int electrostatic_solver_id; // Parameters for lab frame electrostatic static amrex::Real self_fields_required_precision; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 7f697f668..2e0fe7c3e 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -120,7 +120,7 @@ short WarpX::current_deposition_algo; short WarpX::charge_deposition_algo; short WarpX::field_gathering_algo; short WarpX::particle_pusher_algo; -short WarpX::maxwell_solver_id; +short WarpX::electromagnetic_solver_id; short WarpX::J_in_time; short WarpX::rho_in_time; short WarpX::load_balance_costs_update_algo; @@ -182,7 +182,7 @@ Real WarpX::particle_slice_width_lab = 0.0_rt; bool WarpX::do_dynamic_scheduling = true; -int WarpX::do_electrostatic; +int WarpX::electrostatic_solver_id; Real WarpX::self_fields_required_precision = 1.e-11_rt; Real WarpX::self_fields_absolute_tolerance = 0.0_rt; int WarpX::self_fields_max_iters = 200; @@ -367,7 +367,7 @@ WarpX::WarpX () && WarpX::load_balance_costs_update_algo==LoadBalanceCostsUpdateAlgo::Heuristic) { #ifdef AMREX_USE_GPU - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { switch (WarpX::nox) { case 1: @@ -408,12 +408,12 @@ WarpX::WarpX () // Allocate field solver objects #ifdef WARPX_USE_PSATD - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { spectral_solver_fp.resize(nlevs_max); spectral_solver_cp.resize(nlevs_max); } #endif - if (WarpX::maxwell_solver_id != MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { m_fdtd_solver_fp.resize(nlevs_max); m_fdtd_solver_cp.resize(nlevs_max); } @@ -426,7 +426,7 @@ WarpX::WarpX () // Sanity checks. Must be done after calling the MultiParticleContainer // constructor, as it reads additional parameters // (e.g., use_fdtd_nci_corr) - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { AMREX_ALWAYS_ASSERT(use_fdtd_nci_corr == 0); AMREX_ALWAYS_ASSERT(do_subcycling == 0); } @@ -467,7 +467,7 @@ WarpX::ReadParameters () { ParmParse pp_algo("algo"); - maxwell_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); + electromagnetic_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); } { @@ -687,14 +687,19 @@ WarpX::ReadParameters () "The boosted frame diagnostic currently only works if the moving window is in the z direction."); } - do_electrostatic = GetAlgorithmInteger(pp_warpx, "do_electrostatic"); + electrostatic_solver_id = GetAlgorithmInteger(pp_warpx, "do_electrostatic"); + // if an electrostatic solver is used, set the Maxwell solver to None + if (electrostatic_solver_id != ElectrostaticSolverAlgo::None) { + electromagnetic_solver_id = ElectromagneticSolverAlgo::None; + } #if defined(AMREX_USE_EB) && defined(WARPX_DIM_RZ) - WARPX_ALWAYS_ASSERT_WITH_MESSAGE(do_electrostatic!=ElectrostaticSolverAlgo::None, - "Currently, the embedded boundary in RZ only works for electrostatic solvers."); + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( + electromagnetic_solver_id==ElectromagneticSolverAlgo::None, + "Currently, the embedded boundary in RZ only works for electrostatic solvers (or no solver)."); #endif - if (do_electrostatic == ElectrostaticSolverAlgo::LabFrame) { + if (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame) { // Note that with the relativistic version, these parameters would be // input for each species. utils::parser::queryWithParser( @@ -721,7 +726,7 @@ WarpX::ReadParameters () // Filter currently not working with FDTD solver in RZ geometry: turn OFF by default // (see https://github.com/ECP-WarpX/WarpX/issues/1943) #ifdef WARPX_DIM_RZ - if (WarpX::maxwell_solver_id != MaxwellSolverAlgo::PSATD) WarpX::use_filter = false; + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) WarpX::use_filter = false; #endif // Read filter and fill IntVect filter_npass_each_dir with @@ -742,7 +747,7 @@ WarpX::ReadParameters () // TODO When k-space filtering will be implemented also for Cartesian geometries, // this code block will have to be applied in all cases (remove #ifdef condition) #ifdef WARPX_DIM_RZ - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // With RZ spectral, only use k-space filtering use_kspace_filter = use_filter; use_filter = false; @@ -814,7 +819,7 @@ WarpX::ReadParameters () { // SilverMueller is implemented for Yee WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - maxwell_solver_id == MaxwellSolverAlgo::Yee, + electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee, "The Silver-Mueller boundary condition can only be used with the Yee solver."); } } @@ -835,7 +840,7 @@ WarpX::ReadParameters () // Default values of WarpX::do_pml_dive_cleaning and WarpX::do_pml_divb_cleaning: // false for FDTD solver, true for PSATD solver. - if (maxwell_solver_id != MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { do_pml_dive_cleaning = false; do_pml_divb_cleaning = false; @@ -853,14 +858,14 @@ WarpX::ReadParameters () // If WarpX::do_divb_cleaning = true, set also WarpX::do_pml_divb_cleaning = true // (possibly overwritten by users in the input file, see query below) // TODO Implement div(B) cleaning in PML with FDTD and remove second if condition - if (do_divb_cleaning && maxwell_solver_id == MaxwellSolverAlgo::PSATD) do_pml_divb_cleaning = true; + if (do_divb_cleaning && electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) do_pml_divb_cleaning = true; // Query input parameters to use div(E) and div(B) cleaning in PMLs pp_warpx.query("do_pml_dive_cleaning", do_pml_dive_cleaning); pp_warpx.query("do_pml_divb_cleaning", do_pml_divb_cleaning); // TODO Implement div(B) cleaning in PML with FDTD and remove ASSERT - if (maxwell_solver_id != MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( do_pml_divb_cleaning == false, @@ -869,7 +874,7 @@ WarpX::ReadParameters () // Divergence cleaning in PMLs for PSATD solver implemented only // for both div(E) and div(B) cleaning - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( do_pml_dive_cleaning == do_pml_divb_cleaning, @@ -883,7 +888,7 @@ WarpX::ReadParameters () } #ifdef WARPX_DIM_RZ - WARPX_ALWAYS_ASSERT_WITH_MESSAGE( isAnyBoundaryPML() == false || maxwell_solver_id == MaxwellSolverAlgo::PSATD, + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( isAnyBoundaryPML() == false || electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD, "PML are not implemented in RZ geometry with FDTD; please set a different boundary condition using boundary.field_lo and boundary.field_hi."); WARPX_ALWAYS_ASSERT_WITH_MESSAGE( field_boundary_lo[1] != FieldBoundaryType::PML && field_boundary_hi[1] != FieldBoundaryType::PML, "PML are not implemented in RZ geometry along z; please set a different boundary condition using boundary.field_lo and boundary.field_hi."); @@ -956,11 +961,11 @@ WarpX::ReadParameters () { ParmParse pp_algo("algo"); #ifdef WARPX_DIM_RZ - WARPX_ALWAYS_ASSERT_WITH_MESSAGE( maxwell_solver_id != MaxwellSolverAlgo::CKC, + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( electromagnetic_solver_id != ElectromagneticSolverAlgo::CKC, "algo.maxwell_solver = ckc is not (yet) available for RZ geometry"); #endif #ifndef WARPX_USE_PSATD - WARPX_ALWAYS_ASSERT_WITH_MESSAGE( maxwell_solver_id != MaxwellSolverAlgo::PSATD, + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD, "algo.maxwell_solver = psatd is not supported because WarpX was built without spectral solvers"); #endif @@ -975,7 +980,7 @@ WarpX::ReadParameters () "Error : Field boundary at r=0 must be ``none``. \n"); } - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Force do_nodal=true (that is, not staggered) and // use same shape factors in all directions, for gathering do_nodal = true; @@ -1155,7 +1160,7 @@ WarpX::ReadParameters () } } - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { ParmParse pp_psatd("psatd"); pp_psatd.query("periodic_single_box_fft", fft_periodic_single_box); @@ -1408,7 +1413,7 @@ WarpX::ReadParameters () } } - if (maxwell_solver_id != MaxwellSolverAlgo::PSATD ) { + if (electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD ) { for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( (WarpX::field_boundary_lo[idim] != FieldBoundaryType::Damped) && @@ -1670,7 +1675,7 @@ WarpX::ClearLevel (int lev) rho_cp[lev].reset(); #ifdef WARPX_USE_PSATD - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { spectral_solver_fp[lev].reset(); spectral_solver_cp[lev].reset(); } @@ -1711,12 +1716,11 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d WarpX::nox, nox_fft, noy_fft, noz_fft, NCIGodfreyFilter::m_stencil_width, - maxwell_solver_id, + electromagnetic_solver_id, maxLevel(), WarpX::m_v_galilean, WarpX::m_v_comoving, safe_guard_cells, - WarpX::do_electrostatic, WarpX::do_multi_J, WarpX::fft_do_time_averaging, WarpX::isAnyBoundaryPML(), @@ -1824,7 +1828,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm G_nodal_flag = amrex::IntVect::TheNodeVector(); } #ifdef WARPX_DIM_RZ - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Force cell-centered IndexType in r and z Ex_nodal_flag = IntVect::TheCellVector(); Ey_nodal_flag = IntVect::TheCellVector(); @@ -1911,9 +1915,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm // EB info are needed only at the finest level if (lev == maxLevel()) { - if(WarpX::maxwell_solver_id == MaxwellSolverAlgo::Yee - || WarpX::maxwell_solver_id == MaxwellSolverAlgo::CKC - || WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if (WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::PSATD) { m_edge_lengths[lev][0] = std::make_unique<MultiFab>(amrex::convert(ba, Ex_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[x]")); m_edge_lengths[lev][1] = std::make_unique<MultiFab>(amrex::convert(ba, Ey_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[y]")); m_edge_lengths[lev][2] = std::make_unique<MultiFab>(amrex::convert(ba, Ez_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[z]")); @@ -1921,7 +1923,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm m_face_areas[lev][1] = std::make_unique<MultiFab>(amrex::convert(ba, By_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_face_areas[y]")); m_face_areas[lev][2] = std::make_unique<MultiFab>(amrex::convert(ba, Bz_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_face_areas[z]")); } - if(WarpX::maxwell_solver_id == MaxwellSolverAlgo::ECT) { + if(WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { m_edge_lengths[lev][0] = std::make_unique<MultiFab>(amrex::convert(ba, Ex_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[x]")); m_edge_lengths[lev][1] = std::make_unique<MultiFab>(amrex::convert(ba, Ey_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[y]")); m_edge_lengths[lev][2] = std::make_unique<MultiFab>(amrex::convert(ba, Ez_nodal_flag), dm, ncomps, guard_cells.ng_FieldSolver, tag("m_edge_lengths[z]")); @@ -1954,8 +1956,8 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm } #endif - bool deposit_charge = do_dive_cleaning || (do_electrostatic == ElectrostaticSolverAlgo::LabFrame); - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) { + bool deposit_charge = do_dive_cleaning || (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame); + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { deposit_charge = do_dive_cleaning || update_with_rho || current_correction; } if (deposit_charge) @@ -1965,7 +1967,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm rho_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba,rho_nodal_flag),dm,rho_ncomps,ngRho,tag("rho_fp")); } - if (do_electrostatic == ElectrostaticSolverAlgo::LabFrame) + if (electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame) { IntVect ngPhi = IntVect( AMREX_D_DECL(1,1,1) ); phi_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba,phi_nodal_flag),dm,ncomps,ngPhi,tag("phi_fp")); @@ -1989,7 +1991,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm G_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba, G_nodal_flag), dm, ncomps, ngG, tag("G_fp")); } - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Allocate and initialize the spectral solver #ifndef WARPX_USE_PSATD @@ -2042,9 +2044,9 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm pml_flag_false); # endif #endif - } // MaxwellSolverAlgo::PSATD + } // ElectromagneticSolverAlgo::PSATD else { - m_fdtd_solver_fp[lev] = std::make_unique<FiniteDifferenceSolver>(maxwell_solver_id, dx, do_nodal); + m_fdtd_solver_fp[lev] = std::make_unique<FiniteDifferenceSolver>(electromagnetic_solver_id, dx, do_nodal); } // @@ -2151,7 +2153,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm } } - if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD) + if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) { // Allocate and initialize the spectral solver #ifndef WARPX_USE_PSATD @@ -2186,9 +2188,9 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm pml_flag_false); # endif #endif - } // MaxwellSolverAlgo::PSATD + } // ElectromagneticSolverAlgo::PSATD else { - m_fdtd_solver_cp[lev] = std::make_unique<FiniteDifferenceSolver>(maxwell_solver_id, cdx, + m_fdtd_solver_cp[lev] = std::make_unique<FiniteDifferenceSolver>(electromagnetic_solver_id, cdx, do_nodal); } } @@ -2505,7 +2507,7 @@ WarpX::ComputeDivB (amrex::MultiFab& divB, int const dcomp, void WarpX::ComputeDivE(amrex::MultiFab& divE, const int lev) { - if ( WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD ) { + if ( WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD ) { #ifdef WARPX_USE_PSATD spectral_solver_fp[lev]->ComputeSpectralDivE( lev, Efield_aux[lev], divE ); #else |