Skip to content

Commit

Permalink
Merge pull request sirocco-rt#1081 from jhmatthews/fix_pack_definitions
Browse files Browse the repository at this point in the history
Fix pack definitions to use define statements and make consistent
  • Loading branch information
jhmatthews authored May 30, 2024
2 parents 51afa82 + 27429ad commit bbf6af5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 51 deletions.
91 changes: 53 additions & 38 deletions source/communicate_plasma.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ broadcast_plasma_grid (const int n_start, const int n_stop, const int n_cells_ra
const int n_cells_max = get_max_cells_per_rank (NPLASMA);
const int comm_buffer_size = calculate_comm_buffer_size (1 + n_cells_max * (1 + 20 + nphot_total + nions + NXBANDS + 2 * N_PHOT_PROC),
n_cells_max * (71 + 11 * nions + nlte_levels + 2 * nphot_total + n_inner_tot +
11 * NXBANDS + NBINS_IN_CELL_SPEC + 6 * 4 + 6 * NFLUX_ANGLES +
NUM_RAD_FORCE_DIRECTIONS + 6 * NFORCE_DIRECTIONS));
11 * NXBANDS + NBINS_IN_CELL_SPEC + 6 * NFLUX_ANGLES +
N_DMO_DT_DIRECTIONS + 12 * NFORCE_DIRECTIONS));
char *comm_buffer = malloc (comm_buffer_size);
for (current_rank = 0; current_rank < np_mpi_global; current_rank++)
{
Expand Down Expand Up @@ -137,12 +137,12 @@ broadcast_plasma_grid (const int n_start, const int n_stop, const int n_cells_ra
MPI_Pack (cell->exp_temp, NXBANDS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->exp_w, NXBANDS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->cell_spec_flux, NBINS_IN_CELL_SPEC, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_vis, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_Xray, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_vis_persistent, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV_persistent, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_Xray_persistent, 4, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_vis, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_Xray, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_vis_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_Xray_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV_ang_theta, NFLUX_ANGLES, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV_ang_phi, NFLUX_ANGLES, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->F_UV_ang_r, NFLUX_ANGLES, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
Expand Down Expand Up @@ -184,7 +184,7 @@ broadcast_plasma_grid (const int n_start, const int n_stop, const int n_cells_ra
MPI_Pack (cell->n_bf_in, N_PHOT_PROC, MPI_INT, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->n_bf_out, N_PHOT_PROC, MPI_INT, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (&cell->comp_nujnu, 1, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->dmo_dt, NUM_RAD_FORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->dmo_dt, N_DMO_DT_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->rad_force_es, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->rad_force_ff, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
MPI_Pack (cell->rad_force_bf, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, comm_buffer_size, &position, MPI_COMM_WORLD);
Expand Down Expand Up @@ -292,12 +292,12 @@ broadcast_plasma_grid (const int n_start, const int n_stop, const int n_cells_ra
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->exp_temp, NXBANDS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->exp_w, NXBANDS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->cell_spec_flux, NBINS_IN_CELL_SPEC, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_vis, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_Xray, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_vis_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_Xray_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_vis, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_Xray, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_vis_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_Xray_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV_ang_theta, NFLUX_ANGLES, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV_ang_phi, NFLUX_ANGLES, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->F_UV_ang_r, NFLUX_ANGLES, MPI_DOUBLE, MPI_COMM_WORLD);
Expand Down Expand Up @@ -339,7 +339,7 @@ broadcast_plasma_grid (const int n_start, const int n_stop, const int n_cells_ra
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->n_bf_in, N_PHOT_PROC, MPI_INT, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->n_bf_out, N_PHOT_PROC, MPI_INT, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, &cell->comp_nujnu, 1, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->dmo_dt, NUM_RAD_FORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->dmo_dt, N_DMO_DT_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->rad_force_es, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->rad_force_ff, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, comm_buffer_size, &position, cell->rad_force_bf, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
Expand Down Expand Up @@ -572,8 +572,8 @@ broadcast_updated_plasma_properties (const int n_start_rank, const int n_stop_ra
const int n_cells_max = get_max_cells_per_rank (NPLASMA);
const int num_ints = 1 + n_cells_max * (20 + nphot_total + 2 * NXBANDS + 2 * N_PHOT_PROC + nions);
const int num_doubles =
n_cells_max * (71 + 1 * 3 + 9 * 4 + 6 * NFLUX_ANGLES + 3 * NFORCE_DIRECTIONS + 9 * nions + 1 * nlte_levels + 3 * nphot_total +
1 * n_inner_tot + 9 * NXBANDS + 1 * NBINS_IN_CELL_SPEC);
n_cells_max * (71 + 1 * 3 + 6 * NFLUX_ANGLES + 12 * NFORCE_DIRECTIONS + 9 * nions + 1 * nlte_levels + 3 * nphot_total +

const int size_of_comm_buffer = calculate_comm_buffer_size (num_ints, num_doubles);
char *const comm_buffer = malloc (size_of_comm_buffer);

Expand Down Expand Up @@ -662,12 +662,15 @@ broadcast_updated_plasma_properties (const int n_start_rank, const int n_stop_ra
MPI_Pack (plasmamain[n_plasma].exp_w, NXBANDS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].cell_spec_flux, NBINS_IN_CELL_SPEC, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_vis, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_Xray, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_vis_persistent, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV_persistent, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_Xray_persistent, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_vis, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_Xray, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_vis_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_Xray_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV_ang_theta, NFLUX_ANGLES, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].F_UV_ang_phi, NFLUX_ANGLES, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
Expand Down Expand Up @@ -713,10 +716,14 @@ broadcast_updated_plasma_properties (const int n_start_rank, const int n_stop_ra
MPI_Pack (&plasmamain[n_plasma].n_bf_in, N_PHOT_PROC, MPI_INT, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (&plasmamain[n_plasma].n_bf_out, N_PHOT_PROC, MPI_INT, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (&plasmamain[n_plasma].comp_nujnu, 1, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].dmo_dt, 3, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_es, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_ff, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_bf, 4, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position, MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].dmo_dt, N_DMO_DT_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_es, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_ff, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_bf, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_es_persist, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
MPI_COMM_WORLD);
MPI_Pack (plasmamain[n_plasma].rad_force_ff_persist, NFORCE_DIRECTIONS, MPI_DOUBLE, comm_buffer, size_of_comm_buffer, &position,
Expand Down Expand Up @@ -823,12 +830,16 @@ broadcast_updated_plasma_properties (const int n_start_rank, const int n_stop_ra
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].exp_w, NXBANDS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].cell_spec_flux, NBINS_IN_CELL_SPEC, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_vis, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_Xray, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_vis_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_Xray_persistent, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_vis, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV, NFORCE_DIRECTIONS, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_Xray, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_vis_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_Xray_persistent, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV_ang_theta, NFLUX_ANGLES, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].F_UV_ang_phi, NFLUX_ANGLES, MPI_DOUBLE,
Expand Down Expand Up @@ -876,10 +887,14 @@ broadcast_updated_plasma_properties (const int n_start_rank, const int n_stop_ra
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, &plasmamain[n_plasma].n_bf_in, N_PHOT_PROC, MPI_INT, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, &plasmamain[n_plasma].n_bf_out, N_PHOT_PROC, MPI_INT, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, &plasmamain[n_plasma].comp_nujnu, 1, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].dmo_dt, 3, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_es, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_ff, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_bf, 4, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].dmo_dt, N_DMO_DT_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_es, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_ff, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_bf, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_es_persist, NFORCE_DIRECTIONS, MPI_DOUBLE,
MPI_COMM_WORLD);
MPI_Unpack (comm_buffer, size_of_comm_buffer, &position, plasmamain[n_plasma].rad_force_ff_persist, NFORCE_DIRECTIONS, MPI_DOUBLE,
Expand Down
2 changes: 1 addition & 1 deletion source/estimators_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ normalise_simple_estimators (xplasma)
electron_density_obs = xplasma->ne * wmain[nwind].xgamma_cen; // Mihalas & Mihalas p146
volume_obs = wmain[nwind].vol / wmain[nwind].xgamma_cen;

for (i = 0; i < 4; i++)
for (i = 0; i < NFORCE_DIRECTIONS; i++)
{
xplasma->rad_force_es[i] *= (volume_obs * electron_density_obs) / (volume_obs * VLIGHT);
xplasma->F_vis[i] /= volume_obs;
Expand Down
21 changes: 10 additions & 11 deletions source/python.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,15 +991,6 @@ typedef struct plasma

double cell_spec_flux[NBINS_IN_CELL_SPEC]; /**< The array where the cell spectra are accumulated. */

/* directional fluxes (in observer frame) in 3 wavebands. - last element contains the magnitude of flux) */
double F_vis[4];
double F_UV[4];
double F_Xray[4];

double F_vis_persistent[4];
double F_UV_persistent[4];
double F_Xray_persistent[4];

#define NFLUX_ANGLES 36 /**< The number of bins into which the directional flux is calculated */


Expand Down Expand Up @@ -1057,10 +1048,18 @@ typedef struct plasma
compute compton cooling- only needs computing once per cycle
*/

#define NUM_RAD_FORCE_DIRECTIONS 3
#define N_DMO_DT_DIRECTIONS 3
#define NFORCE_DIRECTIONS 4
/* directional fluxes (in observer frame) in 3 wavebands. - last element contains the magnitude of flux) */
double F_vis[NFORCE_DIRECTIONS];
double F_UV[NFORCE_DIRECTIONS];
double F_Xray[NFORCE_DIRECTIONS];

double F_vis_persistent[NFORCE_DIRECTIONS];
double F_UV_persistent[NFORCE_DIRECTIONS];
double F_Xray_persistent[NFORCE_DIRECTIONS];

double dmo_dt[NUM_RAD_FORCE_DIRECTIONS]; /**< Radiative force of wind */
double dmo_dt[N_DMO_DT_DIRECTIONS]; /**< Radiative force of wind */
double rad_force_es[NFORCE_DIRECTIONS]; /**< Radiative force of wind - 4th element is sum of magnitudes */
double rad_force_ff[NFORCE_DIRECTIONS]; /**< Radiative force of wind - 4th element is sum of magnitudes */
double rad_force_bf[NFORCE_DIRECTIONS]; /**< Radiative force of wind - 4th element is sum of magnitudes */
Expand Down
2 changes: 1 addition & 1 deletion source/wind_updates2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ init_plasma_rad_properties (void)
plasmamain[i].bf_simple_ionpool_out = 0.0;
plasmamain[i].bf_simple_ionpool_in = 0.0;

for (j = 0; j < NUM_RAD_FORCE_DIRECTIONS; j++)
for (j = 0; j < N_DMO_DT_DIRECTIONS; j++)
{
plasmamain[i].dmo_dt[j] = 0.0;
}
Expand Down

0 comments on commit bbf6af5

Please sign in to comment.