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

Make whitespace alignment more consistent #4440

Merged
merged 7 commits into from
Nov 23, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def write_file(fname, x, y, t, E):
file.write(E.tobytes())

def create_gaussian_2d():
T, X, Y = np.meshgrid(tcoords, xcoords, np.array([0.0]), indexing='ij')
E_t = gauss(T,X,Y,'2d')
write_file("gauss_2d", xcoords, np.array([0.0]), tcoords, E_t)
T, X, Y = np.meshgrid(tcoords, xcoords, np.array([0.0]), indexing='ij')
E_t = gauss(T,X,Y,'2d')
write_file("gauss_2d", xcoords, np.array([0.0]), tcoords, E_t)

def do_analysis(fname, compname, steps):
ds = yt.load(fname)
Expand Down
16 changes: 8 additions & 8 deletions Source/AcceleratorLattice/LatticeElements/HardEdged_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ amrex::ParticleReal hard_edged_fraction(const amrex::ParticleReal z,
amrex::ParticleReal const zl = std::min(z, zpvdt);
amrex::ParticleReal const zr = std::max(z, zpvdt);

// Calculate the residence correction
// frac will be 1 if the step is completely inside the lens, between 0 and 1
// when entering or leaving the lens, and otherwise 0.
// This accounts for the case when particles step over the element without landing in it.
// This assumes that vzp != 0.
amrex::ParticleReal const zl_bounded = std::min(std::max(zl, zs), ze);
amrex::ParticleReal const zr_bounded = std::min(std::max(zr, zs), ze);
const amrex::ParticleReal frac = (zr_bounded - zl_bounded)/(zr - zl);
// Calculate the residence correction
// frac will be 1 if the step is completely inside the lens, between 0 and 1
// when entering or leaving the lens, and otherwise 0.
// This accounts for the case when particles step over the element without landing in it.
// This assumes that vzp != 0.
amrex::ParticleReal const zl_bounded = std::min(std::max(zl, zs), ze);
amrex::ParticleReal const zr_bounded = std::min(std::max(zr, zs), ze);
const amrex::ParticleReal frac = (zr_bounded - zl_bounded)/(zr - zl);

return frac;
}
Expand Down
184 changes: 92 additions & 92 deletions Source/BoundaryConditions/WarpX_PML_kernels.H
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ void warpx_damp_pml_bx (int i, int j, int k, amrex::Array4<amrex::Real> const& B
}
}

// Bxz
if (sz == 0) {
Bx(i,j,k,PMLComp::xz) *= sigma_star_fac_z[j-zlo];
} else {
Bx(i,j,k,PMLComp::xz) *= sigma_fac_z[j-zlo];
}
// Bxz
if (sz == 0) {
Bx(i,j,k,PMLComp::xz) *= sigma_star_fac_z[j-zlo];
} else {
Bx(i,j,k,PMLComp::xz) *= sigma_fac_z[j-zlo];
}

#elif defined(WARPX_DIM_3D)

Expand All @@ -302,19 +302,19 @@ void warpx_damp_pml_bx (int i, int j, int k, amrex::Array4<amrex::Real> const& B
}
}

// Bxy
if (sy == 0) {
Bx(i,j,k,PMLComp::xy) *= sigma_star_fac_y[j-ylo];
} else {
Bx(i,j,k,PMLComp::xy) *= sigma_fac_y[j-ylo];
}
// Bxy
if (sy == 0) {
Bx(i,j,k,PMLComp::xy) *= sigma_star_fac_y[j-ylo];
} else {
Bx(i,j,k,PMLComp::xy) *= sigma_fac_y[j-ylo];
}

// Bxz
if (sz == 0) {
Bx(i,j,k,PMLComp::xz) *= sigma_star_fac_z[k-zlo];
} else {
Bx(i,j,k,PMLComp::xz) *= sigma_fac_z[k-zlo];
}
// Bxz
if (sz == 0) {
Bx(i,j,k,PMLComp::xz) *= sigma_star_fac_z[k-zlo];
} else {
Bx(i,j,k,PMLComp::xz) *= sigma_fac_z[k-zlo];
}

#endif
}
Expand Down Expand Up @@ -345,19 +345,19 @@ void warpx_damp_pml_by (int i, int j, int k, amrex::Array4<amrex::Real> const& B
const int sx = By_stag[0];
const int sz = By_stag[1];

// Byx
if (sx == 0) {
By(i,j,k,PMLComp::yx) *= sigma_star_fac_x[i-xlo];
} else {
By(i,j,k,PMLComp::yx) *= sigma_fac_x[i-xlo];
}
// Byx
if (sx == 0) {
By(i,j,k,PMLComp::yx) *= sigma_star_fac_x[i-xlo];
} else {
By(i,j,k,PMLComp::yx) *= sigma_fac_x[i-xlo];
}

// Byz
if (sz == 0) {
By(i,j,k,PMLComp::yz) *= sigma_star_fac_z[j-zlo];
} else {
By(i,j,k,PMLComp::yz) *= sigma_fac_z[j-zlo];
}
// Byz
if (sz == 0) {
By(i,j,k,PMLComp::yz) *= sigma_star_fac_z[j-zlo];
} else {
By(i,j,k,PMLComp::yz) *= sigma_fac_z[j-zlo];
}

#elif defined(WARPX_DIM_3D)

Expand All @@ -366,12 +366,12 @@ void warpx_damp_pml_by (int i, int j, int k, amrex::Array4<amrex::Real> const& B
const int sy = By_stag[1];
const int sz = By_stag[2];

// Byx
if (sx == 0) {
By(i,j,k,PMLComp::yx) *= sigma_star_fac_x[i-xlo];
} else {
By(i,j,k,PMLComp::yx) *= sigma_fac_x[i-xlo];
}
// Byx
if (sx == 0) {
By(i,j,k,PMLComp::yx) *= sigma_star_fac_x[i-xlo];
} else {
By(i,j,k,PMLComp::yx) *= sigma_fac_x[i-xlo];
}

if (divb_cleaning)
{
Expand All @@ -383,12 +383,12 @@ void warpx_damp_pml_by (int i, int j, int k, amrex::Array4<amrex::Real> const& B
}
}

// Byz
if (sz == 0) {
By(i,j,k,PMLComp::yz) *= sigma_star_fac_z[k-zlo];
} else {
By(i,j,k,PMLComp::yz) *= sigma_fac_z[k-zlo];
}
// Byz
if (sz == 0) {
By(i,j,k,PMLComp::yz) *= sigma_star_fac_z[k-zlo];
} else {
By(i,j,k,PMLComp::yz) *= sigma_fac_z[k-zlo];
}

#endif
}
Expand Down Expand Up @@ -419,12 +419,12 @@ void warpx_damp_pml_bz (int i, int j, int k, amrex::Array4<amrex::Real> const& B
const int sx = Bz_stag[0];
const int sz = Bz_stag[1];

// Bzx
if (sx == 0) {
Bz(i,j,k,PMLComp::zx) *= sigma_star_fac_x[i-xlo];
} else {
Bz(i,j,k,PMLComp::zx) *= sigma_fac_x[i-xlo];
}
// Bzx
if (sx == 0) {
Bz(i,j,k,PMLComp::zx) *= sigma_star_fac_x[i-xlo];
} else {
Bz(i,j,k,PMLComp::zx) *= sigma_fac_x[i-xlo];
}

if (divb_cleaning)
{
Expand All @@ -443,19 +443,19 @@ void warpx_damp_pml_bz (int i, int j, int k, amrex::Array4<amrex::Real> const& B
const int sy = Bz_stag[1];
const int sz = Bz_stag[2];

// Bzx
if (sx == 0) {
Bz(i,j,k,PMLComp::zx) *= sigma_star_fac_x[i-xlo];
} else {
Bz(i,j,k,PMLComp::zx) *= sigma_fac_x[i-xlo];
}
// Bzx
if (sx == 0) {
Bz(i,j,k,PMLComp::zx) *= sigma_star_fac_x[i-xlo];
} else {
Bz(i,j,k,PMLComp::zx) *= sigma_fac_x[i-xlo];
}

// Bzy
if (sy == 0) {
Bz(i,j,k,PMLComp::zy) *= sigma_star_fac_y[j-ylo];
} else {
Bz(i,j,k,PMLComp::zy) *= sigma_fac_y[j-ylo];
}
// Bzy
if (sy == 0) {
Bz(i,j,k,PMLComp::zy) *= sigma_star_fac_y[j-ylo];
} else {
Bz(i,j,k,PMLComp::zy) *= sigma_fac_y[j-ylo];
}

if (divb_cleaning)
{
Expand Down Expand Up @@ -495,19 +495,19 @@ void warpx_damp_pml_scalar (int i, int j, int k, amrex::Array4<amrex::Real> cons
const int sx = arr_stag[0];
const int sz = arr_stag[1];

// Component along x
if (sx == 0) {
arr(i,j,k,PMLComp::x) *= sigma_star_fac_x[i-xlo];
} else {
arr(i,j,k,PMLComp::x) *= sigma_fac_x[i-xlo];
}
// Component along x
if (sx == 0) {
arr(i,j,k,PMLComp::x) *= sigma_star_fac_x[i-xlo];
} else {
arr(i,j,k,PMLComp::x) *= sigma_fac_x[i-xlo];
}

// Component along z
if (sz == 0) {
arr(i,j,k,PMLComp::z) *= sigma_star_fac_z[j-zlo];
} else {
arr(i,j,k,PMLComp::z) *= sigma_fac_z[j-zlo];
}
// Component along z
if (sz == 0) {
arr(i,j,k,PMLComp::z) *= sigma_star_fac_z[j-zlo];
} else {
arr(i,j,k,PMLComp::z) *= sigma_fac_z[j-zlo];
}

#elif defined(WARPX_DIM_3D)

Expand All @@ -516,26 +516,26 @@ void warpx_damp_pml_scalar (int i, int j, int k, amrex::Array4<amrex::Real> cons
const int sy = arr_stag[1];
const int sz = arr_stag[2];

// Component along x
if (sx == 0) {
arr(i,j,k,PMLComp::x) *= sigma_star_fac_x[i-xlo];
} else {
arr(i,j,k,PMLComp::x) *= sigma_fac_x[i-xlo];
}

// Component along y
if (sy == 0) {
arr(i,j,k,PMLComp::y) *= sigma_star_fac_y[j-ylo];
} else {
arr(i,j,k,PMLComp::y) *= sigma_fac_y[j-ylo];
}

// Component along z
if (sz == 0) {
arr(i,j,k,PMLComp::z) *= sigma_star_fac_z[k-zlo];
} else {
arr(i,j,k,PMLComp::z) *= sigma_fac_z[k-zlo];
}
// Component along x
if (sx == 0) {
arr(i,j,k,PMLComp::x) *= sigma_star_fac_x[i-xlo];
} else {
arr(i,j,k,PMLComp::x) *= sigma_fac_x[i-xlo];
}

// Component along y
if (sy == 0) {
arr(i,j,k,PMLComp::y) *= sigma_star_fac_y[j-ylo];
} else {
arr(i,j,k,PMLComp::y) *= sigma_fac_y[j-ylo];
}

// Component along z
if (sz == 0) {
arr(i,j,k,PMLComp::z) *= sigma_star_fac_z[k-zlo];
} else {
arr(i,j,k,PMLComp::z) *= sigma_fac_z[k-zlo];
}

#endif
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,10 +884,10 @@ BTDiagnostics::k_index_zlab (int i_buffer, int lev)
void
BTDiagnostics::SetSnapshotFullStatus (const int i_buffer)
{
if (m_snapshot_full[i_buffer] == 1) return;
// if the last valid z-index of the snapshot, which is 0, is filled, then
// set the snapshot full integer to 1
if (m_lastValidZSlice[i_buffer] == 1) m_snapshot_full[i_buffer] = 1;
if (m_snapshot_full[i_buffer] == 1) return;
// if the last valid z-index of the snapshot, which is 0, is filled, then
// set the snapshot full integer to 1
if (m_lastValidZSlice[i_buffer] == 1) m_snapshot_full[i_buffer] = 1;

}

Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/BoundaryScrapingDiagnostics.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private:
*
* This is not used for BoundaryScrapingDiagnostics: no field to output
*/
void InitializeBufferData (int i_buffer, int lev, bool restart=false) override;
void InitializeBufferData (int i_buffer, int lev, bool restart=false) override;
/** Initialize functors that point to the fields requested by the user.
*
* This is not used for BoundaryScrapingDiagnostics: no field to output
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Diagnostics::InitDataAfterRestart ()
InitializeParticleBuffer();
InitializeParticleFunctors();
}
if (write_species == 0) {
if (write_species == 0) {
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
m_format != "checkpoint",
"For checkpoint format, write_species flag must be 1."
Expand Down
Loading
Loading