mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Write surface source only at the last batch, hard-code number of surfaces for surface_source.h5 sizing
This commit is contained in:
parent
109dfd20f5
commit
c362ba5ef4
3 changed files with 5 additions and 4 deletions
|
|
@ -413,7 +413,7 @@ Particle::cross_surface()
|
|||
write_message(1, " Crossing surface {}", surf->id_);
|
||||
}
|
||||
|
||||
if (surf->surf_src_) {
|
||||
if (surf->surf_src_ && simulation::current_batch == settings::n_batches) {
|
||||
Particle::Bank site;
|
||||
site.r = this->r();
|
||||
site.u = this->u();
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ void finalize_batch()
|
|||
}
|
||||
|
||||
// Write out surface source if requested.
|
||||
if (settings::surface_source) {
|
||||
if (settings::surface_source && simulation::current_batch == settings::n_batches) {
|
||||
auto filename = settings::path_output + "surface_source.h5";
|
||||
write_surf_src_point(filename.c_str()); //!!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -676,15 +676,16 @@ write_surf_src_bank(hid_t group_id)
|
|||
|
||||
if (mpi::master) {
|
||||
// Create dataset big enough to hold all source sites
|
||||
hsize_t dims[] {static_cast<hsize_t>(settings::n_particles)};
|
||||
hsize_t dims[] {static_cast<hsize_t>(settings::n_particles)*2}; // 2 being hard-coded number of surfaces.
|
||||
hid_t dspace = H5Screate_simple(1, dims, nullptr);
|
||||
hid_t dset = H5Dcreate(group_id, "source_bank", banktype, dspace,
|
||||
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
for (int i = 0; i < mpi::n_procs; ++i) {
|
||||
|
||||
// Create memory space
|
||||
hsize_t count[] {static_cast<hsize_t>(simulation::work_index[i+1] -
|
||||
simulation::work_index[i])};
|
||||
simulation::work_index[i])*2}; // 2 being hard-coded number of surfaces.
|
||||
hid_t memspace = H5Screate_simple(1, count, nullptr);
|
||||
|
||||
// Select hyperslab for this dataspace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue