From 7865121b6a5a7b27bf90c32b4c58ae939698c3cd Mon Sep 17 00:00:00 2001 From: ZamanLantra Date: Fri, 26 Jul 2024 12:34:10 +0100 Subject: [PATCH] Cabana Changes for lateral part movement --- app_cabanapic/cabana_defs.h | 8 ++++++-- app_cabanapic/cabana_misc.h | 18 ++++++++++++------ app_cabanapic/configs/cabana.param | 8 +++++++- scripts/batch/cabana/lumi/cabana.param | 9 ++++++++- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app_cabanapic/cabana_defs.h b/app_cabanapic/cabana_defs.h index 53b5206..fad6cd4 100644 --- a/app_cabanapic/cabana_defs.h +++ b/app_cabanapic/cabana_defs.h @@ -341,11 +341,15 @@ class Deck { qsp = param.get("qsp"); me = param.get("me"); + const OPP_INT domain_expansion = param.get("domain_expansion"); const OPP_REAL gam = 1.0 / sqrt(1.0 - v0 * v0); const OPP_REAL default_grid_len = param.get("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; @@ -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("eps"); diff --git a/app_cabanapic/cabana_misc.h b/app_cabanapic/cabana_misc.h index 83828ad..a641da0 100644 --- a/app_cabanapic/cabana_misc.h +++ b/app_cabanapic/cabana_misc.h @@ -174,8 +174,6 @@ 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; @@ -183,6 +181,13 @@ void enrich_particles_two_stream(const Deck& deck, const OPP_INT cell_count, const OPP_INT ny = deck.ny; const OPP_REAL dxp = (2.0 / npart_per_cell); + const OPP_REAL velX_mult_const = opp_params->get("velX_mult_const"); + const OPP_REAL velY_mult_const = opp_params->get("velY_mult_const"); + const OPP_REAL velZ_mult_const = opp_params->get("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++) { @@ -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; diff --git a/app_cabanapic/configs/cabana.param b/app_cabanapic/configs/cabana.param index 5ead854..6739ffe 100644 --- a/app_cabanapic/configs/cabana.param +++ b/app_cabanapic/configs/cabana.param @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/scripts/batch/cabana/lumi/cabana.param b/scripts/batch/cabana/lumi/cabana.param index b6147dd..d29ae90 100644 --- a/scripts/batch/cabana/lumi/cabana.param +++ b/scripts/batch/cabana/lumi/cabana.param @@ -28,4 +28,11 @@ STRING opp_fill = HoleFill_All INT opp_fill_period = 4 BOOL opp_global_move = false -BOOL use_reg_red = false \ No newline at end of file +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 \ No newline at end of file