diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp index 1ff8f7f60..cb82d1414 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp @@ -133,8 +133,36 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( amrex::ignore_unused(edge_lengths); #endif + auto &warpx = WarpX::GetInstance(); + + const int lev = 0; + const amrex::GpuArray dx = warpx.Geom(lev).CellSizeArray(); + + int use_lumped_resistor = warpx.use_lumped_resistor; + int use_lumped_capacitor = warpx.use_lumped_capacitor; + amrex::MultiFab& sigma_mf = macroscopic_properties->getsigma_mf(); amrex::MultiFab& epsilon_mf = macroscopic_properties->getepsilon_mf(); + + amrex::MultiFab* lumped_resistor_x_mf = nullptr; + amrex::MultiFab* lumped_resistor_y_mf = nullptr; + amrex::MultiFab* lumped_resistor_z_mf = nullptr; + amrex::MultiFab* lumped_capacitor_x_mf = nullptr; + amrex::MultiFab* lumped_capacitor_y_mf = nullptr; + amrex::MultiFab* lumped_capacitor_z_mf = nullptr; + + if (use_lumped_resistor){ + lumped_resistor_x_mf = ¯oscopic_properties->getlumped_resistor_x_mf(); + lumped_resistor_y_mf = ¯oscopic_properties->getlumped_resistor_y_mf(); + lumped_resistor_z_mf = ¯oscopic_properties->getlumped_resistor_z_mf(); + } + + if (use_lumped_capacitor){ + lumped_capacitor_x_mf = ¯oscopic_properties->getlumped_capacitor_x_mf(); + lumped_capacitor_y_mf = ¯oscopic_properties->getlumped_capacitor_y_mf(); + lumped_capacitor_z_mf = ¯oscopic_properties->getlumped_capacitor_z_mf(); + } + #ifndef WARPX_MAG_LLG amrex::MultiFab& mu_mf = macroscopic_properties->getmu_mf(); #endif @@ -144,6 +172,19 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( amrex::GpuArray const& sigma_stag = macroscopic_properties->sigma_IndexType; amrex::GpuArray const& epsilon_stag = macroscopic_properties->epsilon_IndexType; amrex::GpuArray const& macro_cr = macroscopic_properties->macro_cr_ratio; + + if (use_lumped_resistor){ + amrex::GpuArray const& lumped_resistor_x_stag = macroscopic_properties->lumped_resistor_x_IndexType; + amrex::GpuArray const& lumped_resistor_y_stag = macroscopic_properties->lumped_resistor_y_IndexType; + amrex::GpuArray const& lumped_resistor_z_stag = macroscopic_properties->lumped_resistor_z_IndexType; + } + + if (use_lumped_capacitor){ + amrex::GpuArray const& lumped_capacitor_x_stag = macroscopic_properties->lumped_capacitor_x_IndexType; + amrex::GpuArray const& lumped_capacitor_y_stag = macroscopic_properties->lumped_capacitor_y_IndexType; + amrex::GpuArray const& lumped_capacitor_z_stag = macroscopic_properties->lumped_capacitor_z_IndexType; + } + amrex::GpuArray const& Ex_stag = macroscopic_properties->Ex_IndexType; amrex::GpuArray const& Ey_stag = macroscopic_properties->Ey_IndexType; amrex::GpuArray const& Ez_stag = macroscopic_properties->Ez_IndexType; @@ -176,6 +217,24 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( // material prop // amrex::Array4 const& sigma_arr = sigma_mf.array(mfi); amrex::Array4 const& eps_arr = epsilon_mf.array(mfi); + + // Lumped element arrays (default-constructed; set only if feature enabled) + amrex::Array4 resistor_x_arr, resistor_y_arr, resistor_z_arr; + amrex::Array4 capacitor_x_arr, capacitor_y_arr, capacitor_z_arr; + + if (use_lumped_resistor) { + // These produce lightweight views; safe to copy and capture by value + resistor_x_arr = lumped_resistor_x_mf->array(mfi); + resistor_y_arr = lumped_resistor_y_mf->array(mfi); + resistor_z_arr = lumped_resistor_z_mf->array(mfi); + } + if (use_lumped_capacitor) { + capacitor_x_arr = lumped_capacitor_x_mf->array(mfi); + capacitor_y_arr = lumped_capacitor_y_mf->array(mfi); + capacitor_z_arr = lumped_capacitor_z_mf->array(mfi); + } + + #ifndef WARPX_MAG_LLG amrex::Array4 const& mu_arr = mu_mf.array(mfi); #endif @@ -220,12 +279,25 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( // Interpolated permittivity, epsilon, to Ex position on the grid amrex::Real const epsilon_interp = ablastr::coarsen::sample::Interp(eps_arr, epsilon_stag, Ex_stag, macro_cr, i, j, k, scomp); - amrex::Real alpha = T_MacroAlgo::alpha( sigma_interp, epsilon_interp, dt); - amrex::Real beta = T_MacroAlgo::beta( sigma_interp, epsilon_interp, dt); - Ex(i, j, k) = alpha * Ex(i, j, k) - + beta * ( - T_Algo::DownwardDz(Hy, coefs_z, n_coefs_z, i, j, k,0) - + T_Algo::DownwardDy(Hz, coefs_y, n_coefs_y, i, j, k,0) - ) - beta * jx(i, j, k); + + // Extra conductance term from a lumped resistor on Ex edges + amrex::Real const fac1 = (dt/epsilon_interp) * + ( sigma_interp + ((use_lumped_resistor && resistor_x_arr(i,j,k)!=0._rt) + ? dx[0] / (dx[1]*dx[2]*resistor_x_arr(i,j,k)) + : 0._rt) ); + + // Extra term from a lumped capacitor on Ex edges + amrex::Real const fac2 = (use_lumped_capacitor && capacitor_x_arr(i,j,k)!=0._rt) + ? capacitor_x_arr(i,j,k) * dx[0] / (dx[1]*dx[2]*epsilon_interp) + : 0._rt; + + amrex::Real alpha_compact = T_MacroAlgo::alpha_compact(fac1, fac2); + amrex::Real beta_compact = T_MacroAlgo::beta_compact(fac1, fac2); + + Ex(i, j, k) = alpha_compact * Ex(i, j, k) + + dt/epsilon_interp * beta_compact * ( - T_Algo::DownwardDz(Hy, coefs_z, n_coefs_z, i, j, k,0) + + T_Algo::DownwardDy(Hz, coefs_y, n_coefs_y, i, j, k,0)) + - dt/epsilon_interp * beta_compact * jx(i, j, k); }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ @@ -244,12 +316,28 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( // Interpolated permittivity, epsilon, to Ey position on the grid amrex::Real const epsilon_interp = ablastr::coarsen::sample::Interp(eps_arr, epsilon_stag, Ey_stag, macro_cr, i, j, k, scomp); - amrex::Real alpha = T_MacroAlgo::alpha( sigma_interp, epsilon_interp, dt); - amrex::Real beta = T_MacroAlgo::beta( sigma_interp, epsilon_interp, dt); - Ey(i, j, k) = alpha * Ey(i, j, k) - + beta * ( - T_Algo::DownwardDx(Hz, coefs_x, n_coefs_x, i, j, k,0) - + T_Algo::DownwardDz(Hx, coefs_z, n_coefs_z, i, j, k,0) - ) - beta * jy(i, j, k); + + // Extra conductance term from a lumped resistor on Ey edges + amrex::Real const fac1 = (dt/epsilon_interp) * + ( sigma_interp + ((use_lumped_resistor && resistor_y_arr(i,j,k)!=0._rt) + ? dx[1] / (dx[0]*dx[2]*resistor_y_arr(i,j,k)) + : 0._rt) ); + // if (use_lumped_resistor && resistor_y_arr(i,j,k)!=0._rt){ + // printf("fac1=%f\n", fac1); + // } + + // Extra term from a lumped capacitor on Ey edges + amrex::Real const fac2 = (use_lumped_capacitor && capacitor_y_arr(i,j,k)!=0._rt) + ? capacitor_y_arr(i,j,k) * dx[1] / (dx[0]*dx[2]*epsilon_interp) + : 0._rt; + + amrex::Real alpha_compact = T_MacroAlgo::alpha_compact(fac1, fac2); + amrex::Real beta_compact = T_MacroAlgo::beta_compact(fac1, fac2); + + Ey(i, j, k) = alpha_compact * Ey(i, j, k) + + dt/epsilon_interp * beta_compact * ( - T_Algo::DownwardDx(Hz, coefs_x, n_coefs_x, i, j, k,0) + + T_Algo::DownwardDz(Hx, coefs_z, n_coefs_z, i, j, k,0)) + - dt/epsilon_interp * beta_compact * jy(i, j, k); }, [=] AMREX_GPU_DEVICE (int i, int j, int k){ @@ -263,12 +351,25 @@ void FiniteDifferenceSolver::MacroscopicEvolveECartesian ( // Interpolated permittivity, epsilon, to Ez position on the grid amrex::Real const epsilon_interp = ablastr::coarsen::sample::Interp(eps_arr, epsilon_stag, Ez_stag, macro_cr, i, j, k, scomp); - amrex::Real alpha = T_MacroAlgo::alpha( sigma_interp, epsilon_interp, dt); - amrex::Real beta = T_MacroAlgo::beta( sigma_interp, epsilon_interp, dt); - Ez(i, j, k) = alpha * Ez(i, j, k) - + beta * ( - T_Algo::DownwardDy(Hx, coefs_y, n_coefs_y, i, j, k,0) - + T_Algo::DownwardDx(Hy, coefs_x, n_coefs_x, i, j, k,0) - ) - beta * jz(i, j, k); + + // Extra conductance term from a lumped resistor on Ez edges + amrex::Real const fac1 = (dt/epsilon_interp) * + ( sigma_interp + ((use_lumped_resistor && resistor_z_arr(i,j,k)!=0._rt) + ? dx[2] / (dx[0]*dx[1]*resistor_z_arr(i,j,k)) + : 0._rt) ); + + // Extra term from a lumped capacitor on Ez edges + amrex::Real const fac2 = (use_lumped_capacitor && capacitor_z_arr(i,j,k)!=0._rt) + ? capacitor_z_arr(i,j,k) * dx[2] / (dx[0]*dx[1]*epsilon_interp) + : 0._rt; + + amrex::Real alpha_compact = T_MacroAlgo::alpha_compact(fac1, fac2); + amrex::Real beta_compact = T_MacroAlgo::beta_compact(fac1, fac2); + + Ez(i, j, k) = alpha_compact * Ez(i, j, k) + + dt/epsilon_interp * beta_compact * ( - T_Algo::DownwardDy(Hx, coefs_y, n_coefs_y, i, j, k,0) + + T_Algo::DownwardDx(Hy, coefs_x, n_coefs_x, i, j, k,0)) + - dt/epsilon_interp * beta_compact * jz(i, j, k); } ); } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H index 325c995e7..b49d01dc7 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H @@ -47,6 +47,20 @@ public: amrex::MultiFab& getmu_mf () {return (*m_mu_mf);} amrex::MultiFab * get_pointer_mu () {return m_mu_mf.get();} + amrex::MultiFab& getlumped_resistor_x_mf () {return (*m_lumped_resistor_x_mf);} + amrex::MultiFab * get_pointer_lumped_resistor_x () {return m_lumped_resistor_x_mf.get();} + amrex::MultiFab& getlumped_resistor_y_mf () {return (*m_lumped_resistor_y_mf);} + amrex::MultiFab * get_pointer_lumped_resistor_y () {return m_lumped_resistor_y_mf.get();} + amrex::MultiFab& getlumped_resistor_z_mf () {return (*m_lumped_resistor_z_mf);} + amrex::MultiFab * get_pointer_lumped_resistor_z () {return m_lumped_resistor_z_mf.get();} + + amrex::MultiFab& getlumped_capacitor_x_mf () {return (*m_lumped_capacitor_x_mf);} + amrex::MultiFab * get_pointer_lumped_capacitor_x () {return m_lumped_capacitor_x_mf.get();} + amrex::MultiFab& getlumped_capacitor_y_mf () {return (*m_lumped_capacitor_y_mf);} + amrex::MultiFab * get_pointer_lumped_capacitor_y () {return m_lumped_capacitor_y_mf.get();} + amrex::MultiFab& getlumped_capacitor_z_mf () {return (*m_lumped_capacitor_z_mf);} + amrex::MultiFab * get_pointer_lumped_capacitor_z () {return m_lumped_capacitor_z_mf.get();} + /** Gpu Vector with index type of coarsening ratio with default value (1,1,1) */ amrex::GpuArray macro_cr_ratio; /** Initializes the Multifabs storing macroscopic properties @@ -73,6 +87,17 @@ public: amrex::GpuArray epsilon_IndexType; /** Gpu Vector with index type of the permeability multifab */ amrex::GpuArray mu_IndexType; + + /** Gpu Vector with index type of the lumped resistor multifab */ + amrex::GpuArray lumped_resistor_x_IndexType; + amrex::GpuArray lumped_resistor_y_IndexType; + amrex::GpuArray lumped_resistor_z_IndexType; + + /** Gpu Vector with index type of the lumped capacitor multifab */ + amrex::GpuArray lumped_capacitor_x_IndexType; + amrex::GpuArray lumped_capacitor_y_IndexType; + amrex::GpuArray lumped_capacitor_z_IndexType; + /** Gpu Vector with index type of the Ex multifab */ amrex::GpuArray Ex_IndexType; /** Gpu Vector with index type of the Ey multifab */ @@ -85,6 +110,12 @@ public: amrex::GpuArray By_IndexType; /** Gpu Vector with index type of the Bz multifab */ amrex::GpuArray Bz_IndexType; + /** Gpu Vector with index type of the jx multifab */ + amrex::GpuArray jx_IndexType; + /** Gpu Vector with index type of the jy multifab */ + amrex::GpuArray jy_IndexType; + /** Gpu Vector with index type of the jz multifab */ + amrex::GpuArray jz_IndexType; /** Stores initialization type for conductivity : constant or parser */ std::string m_sigma_s = "constant"; @@ -117,6 +148,15 @@ public: std::unique_ptr m_epsilon_parser; std::unique_ptr m_mu_parser; + std::unique_ptr m_lumped_resistor_x_parser; + std::unique_ptr m_lumped_resistor_y_parser; + std::unique_ptr m_lumped_resistor_z_parser; + + std::unique_ptr m_lumped_capacitor_x_parser; + std::unique_ptr m_lumped_capacitor_y_parser; + std::unique_ptr m_lumped_capacitor_z_parser; + + #ifdef WARPX_MAG_LLG /** Gpu Vector with index type of the Hx multifab */ amrex::GpuArray Hx_IndexType; @@ -324,7 +364,24 @@ private: /** Multifab for m_mu */ std::unique_ptr m_mu_mf; - + /** Multifab for lumped resistor */ + std::unique_ptr m_lumped_resistor_x_mf; + std::unique_ptr m_lumped_resistor_y_mf; + std::unique_ptr m_lumped_resistor_z_mf; + /** string for storing parser function */ + std::string m_str_lumped_resistor_x_function; + std::string m_str_lumped_resistor_y_function; + std::string m_str_lumped_resistor_z_function; + + /** Multifab for lumped capacitor */ + std::unique_ptr m_lumped_capacitor_x_mf; + std::unique_ptr m_lumped_capacitor_y_mf; + std::unique_ptr m_lumped_capacitor_z_mf; + /** string for storing parser function */ + std::string m_str_lumped_capacitor_x_function; + std::string m_str_lumped_capacitor_y_function; + std::string m_str_lumped_capacitor_z_function; + /** string for storing parser function */ std::string m_str_sigma_function; std::string m_str_epsilon_function; @@ -362,6 +419,22 @@ struct LaxWendroffAlgo { return beta; } + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real alpha_compact (amrex::Real const fac1, + amrex::Real const fac2) { + using namespace amrex; + amrex::Real alpha_compact = (1._rt - 0.5_rt * fac1 + fac2)/(1._rt + 0.5_rt * fac1 + fac2); + return alpha_compact; + } + + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real beta_compact (amrex::Real const fac1, + amrex::Real const fac2) { + using namespace amrex; + amrex::Real beta_compact = 1._rt / (1._rt + 0.5_rt * fac1 + fac2); + return beta_compact; + } + }; /** @@ -394,6 +467,22 @@ struct BackwardEulerAlgo { return beta; } + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real alpha_compact (amrex::Real const fac1, + amrex::Real const fac2) { + using namespace amrex; + amrex::Real alpha_compact = (1._rt + fac2)/(1._rt + fac1 + fac2); + return alpha_compact; + } + + AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::Real beta_compact (amrex::Real const fac1, + amrex::Real const fac2) { + using namespace amrex; + amrex::Real beta_compact = 1._rt / (1._rt + fac1 + fac2); + return beta_compact; + } + }; -#endif // WARPX_MACROSCOPIC_PROPERTIES_H_ +#endif // WARPX_MACROSCOPIC_PROPERTIES_H_ \ No newline at end of file diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp index 624101ae9..0bee1299a 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp @@ -36,6 +36,7 @@ MacroscopicProperties::MacroscopicProperties () void MacroscopicProperties::ReadParameters () { + auto &warpx = WarpX::GetInstance(); ParmParse pp_macroscopic("macroscopic"); // Since macroscopic maxwell solve is turned on, // user-defined sigma, mu, and epsilon are queried. @@ -164,8 +165,37 @@ MacroscopicProperties::ReadParameters () utils::parser::makeParser(m_str_mu_function,{"x","y","z"})); } + + if (warpx.use_lumped_resistor == 1){ + utils::parser::Store_parserString(pp_macroscopic, "lumped_resistor_x_function(x,y,z)", m_str_lumped_resistor_x_function); + m_lumped_resistor_x_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_resistor_x_function,{"x","y","z"})); + + utils::parser::Store_parserString(pp_macroscopic, "lumped_resistor_y_function(x,y,z)", m_str_lumped_resistor_y_function); + m_lumped_resistor_y_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_resistor_y_function,{"x","y","z"})); + + utils::parser::Store_parserString(pp_macroscopic, "lumped_resistor_z_function(x,y,z)", m_str_lumped_resistor_z_function); + m_lumped_resistor_z_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_resistor_z_function,{"x","y","z"})); + } + + if (warpx.use_lumped_capacitor == 1){ + utils::parser::Store_parserString(pp_macroscopic, "lumped_capacitor_x_function(x,y,z)", m_str_lumped_capacitor_x_function); + m_lumped_capacitor_x_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_capacitor_x_function,{"x","y","z"})); + + utils::parser::Store_parserString(pp_macroscopic, "lumped_capacitor_y_function(x,y,z)", m_str_lumped_capacitor_y_function); + m_lumped_capacitor_y_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_capacitor_y_function,{"x","y","z"})); + + utils::parser::Store_parserString(pp_macroscopic, "lumped_capacitor_z_function(x,y,z)", m_str_lumped_capacitor_z_function); + m_lumped_capacitor_z_parser = std::make_unique( + utils::parser::makeParser(m_str_lumped_capacitor_z_function,{"x","y","z"})); + } + #ifdef WARPX_MAG_LLG - auto &warpx = WarpX::GetInstance(); + // auto &warpx = WarpX::GetInstance(); pp_macroscopic.get("mag_Ms_init_style", m_mag_Ms_s); if (m_mag_Ms_s == "constant") pp_macroscopic.get("mag_Ms", m_mag_Ms); // _mag_ such that it's clear the Ms variable is only meaningful for magnetic materials @@ -251,6 +281,19 @@ MacroscopicProperties::InitData () amrex::BoxArray ba = warpx.boxArray(lev); amrex::DistributionMapping dmap = warpx.DistributionMap(lev); const amrex::IntVect ng_EB_alloc = warpx.getngEB(); + + // lumped elements are defined on edges, so we get the index type of the current + // which is defined on edges + amrex::IntVect jx_stag = warpx.get_pointer_current_fp(lev,0)->ixType().toIntVect(); + amrex::IntVect jy_stag = warpx.get_pointer_current_fp(lev,1)->ixType().toIntVect(); + amrex::IntVect jz_stag = warpx.get_pointer_current_fp(lev,2)->ixType().toIntVect(); + + for ( int idim = 0; idim < AMREX_SPACEDIM; ++idim) { + jx_IndexType[idim] = jx_stag[idim]; + jy_IndexType[idim] = jy_stag[idim]; + jz_IndexType[idim] = jz_stag[idim]; + } + // Define material property multifabs using ba and dmap from WarpX instance // sigma is cell-centered MultiFab m_sigma_mf = std::make_unique(ba, dmap, 1, ng_EB_alloc); @@ -337,6 +380,26 @@ MacroscopicProperties::InitData () } } + if (warpx.use_lumped_resistor == 1){ + m_lumped_resistor_x_mf = std::make_unique(amrex::convert(ba,jx_stag), dmap, 1, ng_EB_alloc); + m_lumped_resistor_y_mf = std::make_unique(amrex::convert(ba,jy_stag), dmap, 1, ng_EB_alloc); + m_lumped_resistor_z_mf = std::make_unique(amrex::convert(ba,jz_stag), dmap, 1, ng_EB_alloc); + + InitializeMacroMultiFabUsingParser(m_lumped_resistor_x_mf.get(), m_lumped_resistor_x_parser->compile<3>(), lev); + InitializeMacroMultiFabUsingParser(m_lumped_resistor_y_mf.get(), m_lumped_resistor_y_parser->compile<3>(), lev); + InitializeMacroMultiFabUsingParser(m_lumped_resistor_z_mf.get(), m_lumped_resistor_z_parser->compile<3>(), lev); + } + + if (warpx.use_lumped_capacitor == 1){ + m_lumped_capacitor_x_mf = std::make_unique(amrex::convert(ba,jx_stag), dmap, 1, ng_EB_alloc); + m_lumped_capacitor_y_mf = std::make_unique(amrex::convert(ba,jy_stag), dmap, 1, ng_EB_alloc); + m_lumped_capacitor_z_mf = std::make_unique(amrex::convert(ba,jz_stag), dmap, 1, ng_EB_alloc); + + InitializeMacroMultiFabUsingParser(m_lumped_capacitor_x_mf.get(), m_lumped_capacitor_x_parser->compile<3>(), lev); + InitializeMacroMultiFabUsingParser(m_lumped_capacitor_y_mf.get(), m_lumped_capacitor_y_parser->compile<3>(), lev); + InitializeMacroMultiFabUsingParser(m_lumped_capacitor_z_mf.get(), m_lumped_capacitor_z_parser->compile<3>(), lev); + } + #ifdef WARPX_MAG_LLG // all magnetic macroparameters are stored on faces diff --git a/Source/FieldSolver/LumpedElement/Inductor.cpp b/Source/FieldSolver/LumpedElement/Inductor.cpp index 92ce72eae..20ddcd5bd 100644 --- a/Source/FieldSolver/LumpedElement/Inductor.cpp +++ b/Source/FieldSolver/LumpedElement/Inductor.cpp @@ -54,7 +54,7 @@ Inductor::InitData() amrex::DistributionMapping dmap = warpx.DistributionMap(lev); // number of guard cells used in EB solver const amrex::IntVect ng_EB_alloc = warpx.getngEB(); - // Define a nodal multifab to store if region is on super conductor (1) or not (0) + // Define a nodal multifab to store if region has inductor (1) or not (0) amrex::IntVect jx_stag = warpx.get_pointer_current_fp(lev,0)->ixType().toIntVect(); amrex::IntVect jy_stag = warpx.get_pointer_current_fp(lev,1)->ixType().toIntVect(); diff --git a/Source/WarpX.H b/Source/WarpX.H index 870c7eeb5..67ab08536 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -320,7 +320,9 @@ public: static int use_PEC_mask; static int use_lumped_inductor; - + static int use_lumped_resistor; + static int use_lumped_capacitor; + //! Integer that corresponds to the order of the PSATD solution //! (whether the PSATD equations are derived from first-order or //! second-order solution) diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 46d425e94..0af9996d2 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -225,6 +225,8 @@ amrex::Vector WarpX::particle_boundary_hi(AMREX_SPACEDIM,P int WarpX::yee_coupled_solver_algo; int WarpX::use_PEC_mask = 0; int WarpX::use_lumped_inductor = 0; +int WarpX::use_lumped_resistor = 0; +int WarpX::use_lumped_capacitor = 0; bool WarpX::do_current_centering = false; @@ -1033,6 +1035,9 @@ WarpX::ReadParameters () ); } + pp_warpx.query("use_lumped_resistor", use_lumped_resistor); + pp_warpx.query("use_lumped_capacitor", use_lumped_capacitor); + #ifdef WARPX_MAG_LLG // Read the value of the time advancement scheme of M field pp_warpx.query("mag_time_scheme_order", mag_time_scheme_order);