Skip to content

Commit

Permalink
Cabana Changes for lateral part movement
Browse files Browse the repository at this point in the history
  • Loading branch information
ZamanLantra committed Jul 26, 2024
1 parent 283873e commit 7865121
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
8 changes: 6 additions & 2 deletions app_cabanapic/cabana_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,15 @@ class Deck {
qsp = param.get<OPP_REAL>("qsp");
me = param.get<OPP_REAL>("me");

const OPP_INT domain_expansion = param.get<OPP_INT>("domain_expansion");
const OPP_REAL gam = 1.0 / sqrt(1.0 - v0 * v0);
const OPP_REAL default_grid_len = param.get<OPP_REAL>("default_grid_len");
len_x_global = default_grid_len;
len_y_global = 0.628318530717959 * (gam * sqrt(gam));
len_z_global = default_grid_len * OPP_comm_size; // Always expect to expand on z direction when weak scaling!
if (domain_expansion > 0) // Always expect to expand on z direction when weak scaling!
len_z_global = default_grid_len * domain_expansion;
else
len_z_global = default_grid_len * OPP_comm_size;
dx = len_x_global / nx;
dy = len_y_global / ny;
dz = len_z_global / nz;
Expand All @@ -354,7 +358,7 @@ class Deck {
dt = 0.99 * courant_length(len_x_global, len_y_global, len_z_global, nx, ny, nz) / c;

Npe = n0 * len_x_global * len_y_global * len_z_global;
Ne = nx * ny * nz * nppc;
Ne = (int64_t)nx * (int64_t)ny * (int64_t)nz * (int64_t)nppc;
we = Npe / Ne;
eps = param.get<OPP_REAL>("eps");

Expand Down
18 changes: 12 additions & 6 deletions app_cabanapic/cabana_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,20 @@ void enrich_particles_two_stream(const Deck& deck, const OPP_INT cell_count,
OPP_REAL* pos, OPP_REAL* vel, OPP_REAL* str_mid, OPP_INT* cid,
OPP_REAL* weight, const OPP_INT* global_cids, const OPP_INT* ghost) {

OPP_RUN_ON_ROOT() opp_printf("Setup", "enrich_particles_two_stream");

const OPP_INT npart_per_cell = deck.nppc;
const OPP_REAL const_weight = deck.we;
const OPP_REAL v0 = deck.v0;
const OPP_INT nx = deck.nx;
const OPP_INT ny = deck.ny;
const OPP_REAL dxp = (2.0 / npart_per_cell);

const OPP_REAL velX_mult_const = opp_params->get<OPP_REAL>("velX_mult_const");
const OPP_REAL velY_mult_const = opp_params->get<OPP_REAL>("velY_mult_const");
const OPP_REAL velZ_mult_const = opp_params->get<OPP_REAL>("velZ_mult_const");

OPP_RUN_ON_ROOT() opp_printf("Setup", "enrich_particles_two_stream Mult Constants %d %d %d",
velX_mult_const, velY_mult_const, velZ_mult_const);

// Populate the host space with particle data.
int part_idx = 0;
for (int cx = 0; cx < cell_count; cx++) {
Expand Down Expand Up @@ -218,10 +223,11 @@ void enrich_particles_two_stream(const Deck& deck, const OPP_INT cell_count,
pos[part_idx * DIM + Dim::y] = x;
pos[part_idx * DIM + Dim::z] = 0.0;

vel[part_idx * DIM + Dim::x] = sign * v0 * gam * (1.0 + na * sign);
vel[part_idx * DIM + Dim::y] = 0;
// vel[part_idx * DIM + Dim::y] = sign * 0.1 * v0 * gam * (1.0 + na * sign);
vel[part_idx * DIM + Dim::z] = 0;
const double v = sign * v0 * gam * (1.0 + na * sign);
// Original CabanaPIC config is when vel_mult_const = 1.0 0.0 0.0
vel[part_idx * DIM + Dim::x] = v * velX_mult_const;
vel[part_idx * DIM + Dim::y] = v * velY_mult_const;
vel[part_idx * DIM + Dim::z] = v * velZ_mult_const;

str_mid[part_idx * DIM + Dim::x] = 0.0;
str_mid[part_idx * DIM + Dim::y] = 0.0;
Expand Down
8 changes: 7 additions & 1 deletion app_cabanapic/configs/cabana.param
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ INT opp_fill_period = 4
BOOL opp_global_move = false
BOOL use_reg_red = false

STRING hdf_filename = /home/zl/phd/neso_test/OP-PIC_Configs/cabana/mesh_files/cab_48000.hdf5
STRING hdf_filename = /home/zl/phd/neso_test/OP-PIC_Configs/cabana/mesh_files/cab_48000.hdf5
INT domain_expansion = 1

# 1 0 0 is the CabanaPIC original configuration
REAL velX_mult_const = 1
REAL velY_mult_const = 0.01
REAL velZ_mult_const = 0.01
9 changes: 8 additions & 1 deletion scripts/batch/cabana/lumi/cabana.param
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ STRING opp_fill = HoleFill_All
INT opp_fill_period = 4

BOOL opp_global_move = false
BOOL use_reg_red = false
BOOL use_reg_red = false

INT domain_expansion = -1

# 1 0 0 is the CabanaPIC original configuration
REAL velX_mult_const = 1
REAL velY_mult_const = 0.01
REAL velZ_mult_const = 0.01

0 comments on commit 7865121

Please sign in to comment.