Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rhomjz_beam field #1171

Merged
Merged
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
12 changes: 12 additions & 0 deletions src/fields/Fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ Fields::AllocData (
Comps[isl].multi_emplace(N_Comps, "rho_" + plasma_name);
}
}
if (Hipace::m_do_beam_jz_minus_rho) {
Comps[isl].multi_emplace(N_Comps, "rhomjz_beam");
}

isl = WhichSlice::Previous;
Comps[isl].multi_emplace(N_Comps, "jx_beam", "jy_beam");
Expand Down Expand Up @@ -552,6 +555,9 @@ Fields::InitializeSlices (int lev, int islice, const amrex::Vector<amrex::Geomet
// with jx and jy initially set to jx_beam and jy_beam
setVal(0., lev, WhichSlice::This, "chi", "Sy", "Sx", "ExmBy", "EypBx", "jz_beam", "rhomjz");
setVal(0., lev, WhichSlice::Next, "jx_beam", "jy_beam");
if (Hipace::m_do_beam_jz_minus_rho) {
setVal(0., lev, WhichSlice::This, "rhomjz_beam");
}
} else {
if (lev != 0 && islice == geom[lev].Domain().bigEnd(Direction::z)) {
// first slice of lev (islice goes backwards)
Expand Down Expand Up @@ -844,6 +850,12 @@ Fields::SolvePoissonPsiExmByEypBxEzBz (amrex::Vector<amrex::Geometry> const& geo

PhysConst phys_const = get_phys_const();

if (m_explicit && Hipace::m_do_beam_jz_minus_rho) {
for (int lev=0; lev<current_N_level; ++lev) {
add(lev, WhichSlice::This, {"rhomjz"}, WhichSlice::This, {"rhomjz_beam"});
}
}

EnforcePeriodic(true, {Comps[WhichSlice::This]["jx"],
Comps[WhichSlice::This]["jy"],
Comps[WhichSlice::This]["rhomjz"]});
Expand Down
Loading