Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
42c56d0
fields3d.inl; test*: mv begin/endStep
JamesMcClung May 6, 2026
41be1f0
output_fields: fix div by 0
JamesMcClung May 22, 2026
32bfb7d
push_particles_1vb: fix Grid_t type
JamesMcClung Aug 6, 2026
683dd34
psc: allow stats_every < 1
JamesMcClung May 13, 2026
c46c879
boundary_injector: take density
JamesMcClung Apr 22, 2026
ded9f60
boundary_injector: +inject_lo
JamesMcClung Apr 23, 2026
26f89bc
boundary_injector: -prts_per_unit_density_
JamesMcClung Apr 23, 2026
2e444d8
boundary_injector: -advance_
JamesMcClung Apr 23, 2026
00dbea0
boundary_injector; *: don't pass grid
JamesMcClung Aug 6, 2026
7c05e00
boundary_injector: public density, inject_lo
JamesMcClung Apr 23, 2026
e1a37e5
boundary_injector: set density after ctor
JamesMcClung Aug 6, 2026
9a02f91
boundary_injector: support upper inj
JamesMcClung Apr 23, 2026
93e00d2
injector_simple: +inject_local
JamesMcClung Apr 27, 2026
6b00edf
boundary_injector: default density of 1
JamesMcClung Apr 27, 2026
0c5beed
boundary_injector; *: fix u gen
JamesMcClung Aug 6, 2026
93e9c6a
boundary_injector: slight cleanup
JamesMcClung Apr 27, 2026
b2db157
psc_bnd_fields_impl; *: hacky upper background
JamesMcClung Aug 6, 2026
855de84
psc_shock: fix h_y
JamesMcClung Apr 10, 2026
cb9d6fb
psc_shock: fix shift_to_patch_local
JamesMcClung Aug 6, 2026
5ac7fa8
psc_shock: fix advection of nonuniform bg fields
JamesMcClung Aug 6, 2026
99e64ec
psc_shock: conditional set radiation
JamesMcClung Aug 6, 2026
a273d98
psc_shock: +checkpoint support for laminar case
JamesMcClung May 6, 2026
fa43eae
psc_shock: +stats_interval param
JamesMcClung May 6, 2026
a0fcca5
psc_shock: +cycle_turbulence
JamesMcClung May 6, 2026
37b8496
psc_shock: support checkpoint for turb case
JamesMcClung May 6, 2026
724a313
psc_shock: +shock_method
JamesMcClung May 12, 2026
ef363c6
psc_shock: +n_checkpoints
JamesMcClung May 21, 2026
81a3eb9
setup_particles: fix message
JamesMcClung May 13, 2026
7e9cc9b
setup_particles: +VelocityBooster
JamesMcClung Jun 2, 2026
ccd98fd
setup_particles: sample v, then boost
JamesMcClung Jun 2, 2026
3d9f38c
boundary_injector: use VelocityBooster
JamesMcClung Jun 2, 2026
df1f779
setup_particles: +boost()
JamesMcClung Jun 2, 2026
15c4f2a
setup_particles: don't have static booster
JamesMcClung Jun 3, 2026
a79e93a
setup_particles: -vel_to_4vel
JamesMcClung Jun 3, 2026
b263627
*: hack pretend v is u
JamesMcClung Jun 3, 2026
c65fd55
psc_shock: cleanup params
JamesMcClung Jun 5, 2026
64328b8
psc_shock: breaking changes to params
JamesMcClung Jun 12, 2026
8a27687
psc_shock: override downstream vals
JamesMcClung Jun 15, 2026
788b97a
boundary_injector: preacceleration v1
JamesMcClung Jun 16, 2026
87f474f
psc_shock: +none shock case
JamesMcClung Jun 30, 2026
b5ac08c
psc_shock: technically correct curl
JamesMcClung Jul 1, 2026
75252a0
psc_shock: fix curl for invar dims
JamesMcClung Jul 8, 2026
f2edf22
psc_shock: flip yp to make xp,yp,k right-handed
JamesMcClung Jul 8, 2026
21f8dd0
psc_shock: support dx etc
JamesMcClung Jul 8, 2026
4254541
+field_bc_base
JamesMcClung May 27, 2026
fe70e96
psc: +field_bcs_
JamesMcClung Jun 5, 2026
b35432a
+field_bc_util; psc_bnd_fields_impl: mv setters
JamesMcClung Jul 8, 2026
9a188c7
+psc_bnd_util
JamesMcClung Jul 8, 2026
e882df3
fields3d: using Real3
JamesMcClung Jul 9, 2026
7b6c933
psc: call field_bc
JamesMcClung Jul 9, 2026
f702e02
+axis
JamesMcClung Jul 9, 2026
6361948
+conducting_wall
JamesMcClung Jul 9, 2026
cc281ed
psc: automatically add conducting wall bc
JamesMcClung Jul 9, 2026
cff9b97
conducting_wall, psc_bnd_fields_impl: mv E impl
JamesMcClung Jul 9, 2026
a322bab
axis: +prev, next
JamesMcClung Jul 9, 2026
d607322
conducting_wall: generalize axes of E impl
JamesMcClung Jul 9, 2026
dd10c97
conducting_wall: add some comments
JamesMcClung Jul 9, 2026
059523b
conducting_wall: cleanup
JamesMcClung Jul 9, 2026
c346879
conducting_wall; psc_bnd_fields_impl: mv H impl
JamesMcClung Jul 9, 2026
ba8b7a3
conducting_wall: generalize H impl
JamesMcClung Jul 9, 2026
c8359f3
conducting_wall: +H comment
JamesMcClung Jul 9, 2026
8698b91
conducting_wall; psc_bnd_fields_impl: mv j impl
JamesMcClung Jul 10, 2026
90c7f74
conducting_wall: generalize j impl
JamesMcClung Jul 10, 2026
3cfedb7
conducting_wall: +j comment
JamesMcClung Jul 10, 2026
ff677be
conducting_wall: fix n ghosts for hi
JamesMcClung Jul 10, 2026
d1c984b
conducting_wall: cleanup
JamesMcClung Jul 10, 2026
cec3985
psc_bnd_fields_impl: add_ghosts_j is noop
JamesMcClung Jul 10, 2026
098e511
psc_shock: half width is ly/8
JamesMcClung Jul 10, 2026
a3bb77d
psc_shock: don't compress B_par
JamesMcClung Jul 10, 2026
daf06b1
psc_shock: interpolate v_thermal, not T
JamesMcClung Jul 10, 2026
f5f7aa3
+radiating
JamesMcClung Jul 10, 2026
a1d92be
radiating_bnd; *: ->tick
JamesMcClung Jul 10, 2026
9169349
radiating_bnd; psc_shock: +sample_exterior_field_\*
JamesMcClung Jul 10, 2026
6a8dbb0
radiating_bnd; *: -pulse lower
JamesMcClung Jul 10, 2026
3969c6c
radiating_bnd; *: -pulse upper
JamesMcClung Jul 10, 2026
3ef9137
psc_bnd_fields_impl; psc_shock: include background in sample
JamesMcClung Jul 10, 2026
32e9c39
psc_bnd_fields_impl: don't set E for open bcs
JamesMcClung Jul 10, 2026
aea7d06
psc_bnd_fields_impl; *: -background flds
JamesMcClung Jul 10, 2026
8044e5f
psc_bnd_fields_impl: redefine s, p
JamesMcClung Jul 10, 2026
5359e2c
psc_bnd_fields_impl: fix sign on j
JamesMcClung Jul 10, 2026
224c039
radiating, psc_bnd_fields_impl; *: mv rad H impl
JamesMcClung Jul 10, 2026
bfb74fd
psc_bnd_fields_impl: rm E, H loops
JamesMcClung Jul 10, 2026
65e630b
radiating: cleanup
JamesMcClung Jul 10, 2026
9eb7d6f
radiating: reindex, more hats
JamesMcClung Jul 10, 2026
464fc62
radiating: more cleanup
JamesMcClung Jul 10, 2026
72c20f8
radiating_bnd; *: combine samples
JamesMcClung Jul 10, 2026
04d3f9c
-radiating_bnd, radiating; *: ->PulseBase
JamesMcClung Jul 10, 2026
ba7bb6d
radiating: +ConstantPulse
JamesMcClung Jul 14, 2026
2099d06
psc_shock: use ConstantPulse
JamesMcClung Jul 14, 2026
54f3d7d
Vec3: +with_component
JamesMcClung Jul 22, 2026
c2ed0cb
radiating: +comments
JamesMcClung Jul 14, 2026
bd0f25f
radiating: set normal E to 0
JamesMcClung Jul 22, 2026
3a8c0d8
radiating: sample ghost E
JamesMcClung Aug 6, 2026
2102c8a
boundary_injector: fix Real3
JamesMcClung Aug 6, 2026
15b9bac
boundary_injector: preacceleration v2, energy-based
JamesMcClung Aug 6, 2026
026a472
boundary_injector: screw it, just kick them
JamesMcClung Aug 6, 2026
e3ac856
boundary_injector: hi matches lo
JamesMcClung Aug 6, 2026
ce5d22b
boundary_injector; *: template by LOHI
JamesMcClung Aug 6, 2026
f386936
boundary_injector: take density as optional ctor arg
JamesMcClung Aug 6, 2026
c1f5f90
boundary_injector: get E from edge
JamesMcClung Jul 28, 2026
be8e594
boundary_injector: drop gamma factor
JamesMcClung Aug 5, 2026
ea388f3
->psc_particle_injectors/...; *
JamesMcClung Jul 28, 2026
e1a7b52
test_boundary_injector: fix u/v mixup
JamesMcClung Jun 30, 2026
6a2e691
psc_shock: print time when cycle turb
JamesMcClung Jul 23, 2026
34002aa
psc_shock: density in ctor
JamesMcClung Aug 6, 2026
30ad677
psc: don't add conducting BC to CUDA mfields
JamesMcClung Aug 6, 2026
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
168 changes: 0 additions & 168 deletions src/include/boundary_injector.hxx

This file was deleted.

1 change: 1 addition & 0 deletions src/include/fields3d.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ struct MfieldsStateFromMfields : MfieldsStateBase
{
using fields_view_t = typename Mfields::fields_view_t;
using real_t = typename Mfields::real_t;
using Real3 = Vec3<real_t>;
using Real = typename Mfields::Real;
using Storage = typename Mfields::Storage;
using space = gt::space::host;
Expand Down
3 changes: 0 additions & 3 deletions src/include/fields3d.inl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public:
// FIXME, should just check for consistency? (# ghosts might differ, too)
// reader.get("ib", mflds.ib, launch);
// reader.get("im", mflds.im, launch);
reader.beginStep(kg::io::StepMode::Read);

auto n_comps = mflds.n_comps();
auto shape = makeDims(n_comps, mflds.gdims());
assert(reader.variableShape<DataType>() == shape);
Expand All @@ -55,7 +53,6 @@ public:
{}); //{ib, im});
}
reader.performGets();
reader.endStep();

for (int p = 0; p < mflds.n_patches(); p++) {
auto h_flds = make_Fields3d<dim_xyz>(h_mflds[p]);
Expand Down
12 changes: 12 additions & 0 deletions src/include/injector_simple.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ struct InjectorSimple
mprts_.push_back(p_, prt);
}

void inject_local(const psc::particle::Inject& new_prt)
{
auto prt =
Particle{Real3(new_prt.x),
Real3(new_prt.u),
real_t(new_prt.w * mprts_.grid().kinds[new_prt.kind].q),
new_prt.kind,
mprts_.uid_gen(),
new_prt.tag};
mprts_.push_back(p_, prt);
}

void reweight(const psc::particle::Inject& new_prt)
{
auto& grid = mprts_.grid();
Expand Down
6 changes: 5 additions & 1 deletion src/include/output_fields.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ struct OutputTfieldItemParams : BaseOutputFieldItemParams
// Returns whether to accumulate on this timestep.
bool do_accum(int timestep)
{
if (!enabled()) {
return false;
}

// next_out could be this timestep
int n_intervals_elapsed = (timestep - 1) / out_interval;
int next_out = out_interval * (n_intervals_elapsed + 1);

bool in_averaging_range = next_out - timestep < average_length;
bool on_averaging_step = (next_out - timestep) % sample_interval == 0;
return enabled() && in_averaging_range && on_averaging_step;
return in_averaging_range && on_averaging_step;
}
};

Expand Down
47 changes: 45 additions & 2 deletions src/include/psc.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
#include <particles.hxx>
#include <setup_particles.hxx>

#include "../libpsc/psc_bnd_fields/field_bc_base.hxx"
#include "../libpsc/psc_bnd_fields/conducting_wall.hxx"
#include "../libpsc/psc_particle_injectors/injector_base.hxx"
#include "gauss_corrector_base.hxx"
#include "diagnostic_base.hxx"
#include "injector_base.hxx"
#include "external_current_base.hxx"
#include <checks_params.hxx>
#include <output_particles.hxx>
Expand Down Expand Up @@ -117,6 +119,7 @@ struct Psc
using BndFields = typename PscConfig::BndFields;
using BndParticles = typename PscConfig::BndParticles;
using Dim = typename PscConfig::Dim;
using FieldBcBaseT = FieldBcBase<MfieldsState>;
using GaussCorrectorBaseT = GaussCorrectorBase<MfieldsState, Mparticles>;
using DiagnosticBaseT = DiagnosticBase<Mparticles, MfieldsState>;
using InjectorBaseT = InjectorBase<Mparticles, MfieldsState>;
Expand Down Expand Up @@ -146,6 +149,20 @@ struct Psc
}
}

#ifndef USE_CUDA
for (int d = 0; d < 3; d++) {
using psc::bnd::LoHi;
using psc::bnd::field::ConductingWall;

if (grid.bc.fld_lo[d] == BND_FLD_CONDUCTING_WALL) {
add_field_bc(new ConductingWall<Dim, MfieldsState>{d, LoHi::Lo});
}
if (grid.bc.fld_hi[d] == BND_FLD_CONDUCTING_WALL) {
add_field_bc(new ConductingWall<Dim, MfieldsState>{d, LoHi::Hi});
}
}
#endif

int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
log_.open("mem-" + std::to_string(rank) + ".log");
Expand All @@ -162,6 +179,13 @@ struct Psc
// TODO: improve ownership model: we should own these objects (i.e., use
// unique_ptr), but don't want to burden the user with C++ boilerplate.

void add_field_bc(FieldBcBaseT* field_bc)
{
if (field_bc) {
field_bcs_.push_back(field_bc);
}
}

void add_gauss_corrector(GaussCorrectorBaseT* corrector)
{
if (corrector) {
Expand Down Expand Up @@ -219,11 +243,17 @@ struct Psc

void pre_first_step()
{
for (auto field_bc : field_bcs_) {
field_bc->apply_h_bcs(mflds_);
}
bndf.fill_ghosts_H(mflds_);
bnd_.fill_ghosts(mflds_, HX, HX + 3);

bnd_.fill_ghosts(mflds_, JXI, JXI + 3);

for (auto field_bc : field_bcs_) {
field_bc->apply_e_bcs(mflds_);
}
bndf.fill_ghosts_E(mflds_);
bnd_.fill_ghosts(mflds_, EX, EX + 3);

Expand Down Expand Up @@ -286,7 +316,7 @@ struct Psc

psc_stats_val[st_nr_particles] = mprts_.size();

if (grid().timestep() % p_.stats_every == 0) {
if (p_.stats_every > 0 && grid().timestep() % p_.stats_every == 0) {
print_status();
}

Expand Down Expand Up @@ -414,6 +444,9 @@ struct Psc

mpi_printf(comm, "***** Bnd fields J...\n");
prof_start(pr_bndf);
for (auto field_bc : field_bcs_) {
field_bc->apply_j_bcs(mflds_);
}
bndf.add_ghosts_J(mflds_);
bnd_.add_ghosts(mflds_, JXI, JXI + 3);
bnd_.fill_ghosts(mflds_, JXI, JXI + 3);
Expand All @@ -428,6 +461,9 @@ struct Psc

mpi_printf(comm, "***** Bnd fields B (1 of 2)...\n");
prof_restart(pr_bndf);
for (auto field_bc : field_bcs_) {
field_bc->apply_h_bcs(mflds_);
}
bndf.fill_ghosts_H(mflds_);
bnd_.fill_ghosts(mflds_, HX, HX + 3);
prof_stop(pr_bndf);
Expand All @@ -441,6 +477,9 @@ struct Psc

mpi_printf(comm, "***** Bnd fields E...\n");
prof_restart(pr_bndf);
for (auto field_bc : field_bcs_) {
field_bc->apply_e_bcs(mflds_);
}
bndf.fill_ghosts_E(mflds_);
bnd_.fill_ghosts(mflds_, EX, EX + 3);
prof_stop(pr_bndf);
Expand All @@ -463,6 +502,9 @@ struct Psc

mpi_printf(comm, "***** Bnd fields B (2 of 2)...\n");
prof_restart(pr_bndf);
for (auto field_bc : field_bcs_) {
field_bc->apply_h_bcs(mflds_);
}
bndf.fill_ghosts_H(mflds_);
bnd_.fill_ghosts(mflds_, HX, HX + 3);
prof_stop(pr_bndf);
Expand Down Expand Up @@ -555,6 +597,7 @@ protected:
Balance& balance_;
Collision& collision_;
Checks& checks_;
std::vector<FieldBcBaseT*> field_bcs_;
std::vector<GaussCorrectorBaseT*> gauss_correctors_;
std::vector<DiagnosticBaseT*> diagnostics_;
std::vector<InjectorBaseT*> injectors_;
Expand Down
Loading