Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/Tests/circuits/Candice/inputs_inductor_on_cap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ algo.em_solver_medium = macroscopic
# laxwendroff or backwardeuler
algo.macroscopic_sigma_method = laxwendroff

algo.lumped_inductor = on
algo.use_lumped_inductor = 1

inductor.inductor_x_function(x,y,z) = "4.e-13 * (x > -460.e-6) * (x < -395.e-6) * (y > -ddy) * (y < ddy) * (z > h_si - ddz) * (z < h_si + ddz)"
inductor.inductor_y_function(x,y,z) = "0."
Expand Down
2 changes: 1 addition & 1 deletion Examples/Tests/circuits/Candice/inputs_inductor_on_cap_PEC
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ algo.em_solver_medium = macroscopic
# laxwendroff or backwardeuler
algo.macroscopic_sigma_method = laxwendroff

algo.lumped_inductor = on
algo.use_lumped_inductor = 1

inductor.inductor_x_function(x,y,z) = "4.e-13 * (x > -460.e-6) * (x < -395.e-6) * (y > -ddy) * (y < ddy) * (z > h_si - ddz) * (z < h_si + ddz)"
inductor.inductor_y_function(x,y,z) = "0."
Expand Down
2 changes: 1 addition & 1 deletion Examples/Tests/circuits/Candice/inputs_inductortest
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ algo.em_solver_medium = macroscopic
# laxwendroff or backwardeuler
algo.macroscopic_sigma_method = laxwendroff

algo.lumped_inductor = on
algo.use_lumped_inductor = 1

inductor.inductor_x_function(x,y,z) = "10.e-12 * (x > -800.e-6) * (x < -797.5e-6) * (y > -25.e-6 - ddy) * (y < -25.e-6 + ddy) * (z > h_si - ddz) * (z < h_si + ddz)"
inductor.inductor_y_function(x,y,z) = "0."
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ FlushFormatCheckpoint::WriteToFile (

if (warpx.getis_synchronized()
|| WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon
|| WarpX::lumped_inductor_algo == LumpedInductor::On) {
|| warpx.use_lumped_inductor == 1) {
// Need to save j if synchronized because after restart we need j to evolve E by dt/2.
VisMF::Write(warpx.getcurrent_fp(lev, 0),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jx_fp"));
Expand Down Expand Up @@ -180,7 +180,7 @@ FlushFormatCheckpoint::WriteToFile (

if (warpx.getis_synchronized()
|| WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon
|| WarpX::lumped_inductor_algo == LumpedInductor::On) {
|| warpx.use_lumped_inductor == 1) {
// Need to save j if synchronized because after restart we need j to evolve E by dt/2.
VisMF::Write(warpx.getcurrent_cp(lev, 0),
amrex::MultiFabFileFullPrefix(lev, checkpointname, default_level_prefix, "jx_cp"));
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/WarpXIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ WarpX::InitFromCheckpoint ()

if (is_synchronized
|| WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon
|| WarpX::lumped_inductor_algo == LumpedInductor::On)
|| use_lumped_inductor == 1)
{
VisMF::Read(*current_fp[lev][0],
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "jx_fp"));
Expand Down Expand Up @@ -426,7 +426,7 @@ WarpX::InitFromCheckpoint ()

if (is_synchronized
|| WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon
|| WarpX::lumped_inductor_algo == LumpedInductor::On) {
|| use_lumped_inductor == 1) {
VisMF::Read(*current_cp[lev][0],
amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "jx_cp"));
VisMF::Read(*current_cp[lev][1],
Expand Down
23 changes: 3 additions & 20 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ WarpX::Evolve (int numsteps)
m_london->EvolveLondonJ(-0.5_rt*dt[0]); // J^(n) to J^(n-1/2) using E^(n)
FillBoundaryJ(guard_cells.ng_alloc_EB);
}
if (WarpX::lumped_inductor_algo == LumpedInductor::On) {
if (use_lumped_inductor) {
m_inductor->EvolveInductorJ(-0.5_rt*dt[0]); // J^(n) to J^(n-1/2) using E^(n)
FillBoundaryJ(guard_cells.ng_alloc_EB);
}
Expand Down Expand Up @@ -198,19 +198,8 @@ WarpX::Evolve (int numsteps)
// Main PIC operation:
// gather fields, push particles, deposit sources, update fields

ExecutePythonCallback("particleinjection");
// Electrostatic case: only gather fields and push particles,
// deposition and calculation of fields done further below
if (electromagnetic_solver_id == ElectromagneticSolverAlgo::None)
{
const bool skip_deposition = true;
if (WarpX::yee_coupled_solver_algo != CoupledYeeSolver::MaxwellLondon &&
WarpX::lumped_inductor_algo != LumpedInductor::On) {
PushParticlesandDepose(cur_time, skip_deposition);
}
}
// Electromagnetic case: multi-J algorithm
else if (do_multi_J)
if (do_multi_J)
{
OneStep_multiJ(cur_time);
}
Expand Down Expand Up @@ -429,12 +418,6 @@ WarpX::OneStep_nosub (Real cur_time)
// Deposit current j^{n+1/2}
// Deposit charge density rho^{n}

ExecutePythonCallback("particlescraper");
ExecutePythonCallback("beforedeposition");
if (WarpX::yee_coupled_solver_algo != CoupledYeeSolver::MaxwellLondon &&
WarpX::lumped_inductor_algo != LumpedInductor::On) {
PushParticlesandDepose(cur_time);
}
#ifndef WARPX_MAG_LLG
if (WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon) {
amrex::Print() << " in evolve london j\n";
Expand All @@ -444,7 +427,7 @@ WarpX::OneStep_nosub (Real cur_time)
// fill boundary here
}
#endif
if (WarpX::lumped_inductor_algo == LumpedInductor::On) {
if (use_lumped_inductor == 1) {
m_inductor->EvolveInductorJ(dt[0]); // J^(n-1/2) to J^(n+1/2) using E^(n)
FillBoundaryJ(guard_cells.ng_alloc_EB);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ WarpX::InitData ()
m_london->InitData();
}

if (WarpX::lumped_inductor_algo == LumpedInductor::On) {
if (use_lumped_inductor) {
amrex::Print() << " calling inductor \n";
m_inductor->InitData();
}
Expand Down
8 changes: 0 additions & 8 deletions Source/Utils/WarpXAlgorithmSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ const std::map<std::string, int> CoupledYeeSolver_algo_to_int = {
{"default", CoupledYeeSolver::None}
};

const std::map<std::string, int> LumpedInductor_algo_to_int = {
{"on", LumpedInductor::On},
{"off", LumpedInductor::Off},
{"default",LumpedInductor::Off}
};

int
GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){

Expand Down Expand Up @@ -196,8 +190,6 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){
algo_to_int = IntegrationType_algo_to_int;
} else if (0 == std::strcmp(pp_search_key, "yee_coupled_solver")) {
algo_to_int = CoupledYeeSolver_algo_to_int;
} else if (0 == std::strcmp(pp_search_key, "lumped_inductor")) {
algo_to_int = LumpedInductor_algo_to_int;
} else {
std::string pp_search_string = pp_search_key;
amrex::Abort("Unknown algorithm type: " + pp_search_string);
Expand Down
2 changes: 1 addition & 1 deletion Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ public:
*/
static amrex::Vector<ParticleBoundaryType> particle_boundary_hi;
static int yee_coupled_solver_algo;
static int lumped_inductor_algo;

static int use_PEC_mask;
static int use_lumped_inductor;

//! Integer that corresponds to the order of the PSATD solution
//! (whether the PSATD equations are derived from first-order or
Expand Down
6 changes: 3 additions & 3 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ amrex::Vector<ParticleBoundaryType> WarpX::particle_boundary_lo(AMREX_SPACEDIM,P
amrex::Vector<ParticleBoundaryType> WarpX::particle_boundary_hi(AMREX_SPACEDIM,ParticleBoundaryType::Absorbing);
int WarpX::yee_coupled_solver_algo;
int WarpX::use_PEC_mask = 0;
int WarpX::lumped_inductor_algo;
int WarpX::use_lumped_inductor = 0;

bool WarpX::do_current_centering = false;

Expand Down Expand Up @@ -491,7 +491,7 @@ WarpX::WarpX ()
}

// Lumped inductor
if (lumped_inductor_algo == LumpedInductor::On) {
if (use_lumped_inductor) {
m_inductor = std::make_unique<Inductor>();
}

Expand Down Expand Up @@ -1266,7 +1266,7 @@ WarpX::ReadParameters ()
yee_coupled_solver_algo = GetAlgorithmInteger(pp_algo, "yee_coupled_solver");

pp_algo.query("use_PEC_mask",use_PEC_mask);
lumped_inductor_algo = GetAlgorithmInteger(pp_algo, "lumped_inductor");
pp_algo.query("use_lumped_inductor",use_lumped_inductor);

// Load balancing parameters
std::vector<std::string> load_balance_intervals_string_vec = {"0"};
Expand Down
Loading