Bank surface source particles in all active cycles (#2592)

Co-authored-by: Jose Ignacio Marquez Damian <22483345+marquezj@users.noreply.github.com>
This commit is contained in:
Paul Romano 2023-07-14 13:43:47 -05:00 committed by GitHub
parent 0666e3a4f6
commit c5f551103f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View file

@ -107,6 +107,9 @@ public:
//! \param size The new size of the container
void resize(int64_t size) { size_ = size; }
//! Return whether the array is full
bool full() const { return size_ == capacity_; }
//! Return the number of elements that the container has currently allocated
//! space for.
int64_t capacity() { return capacity_; }

View file

@ -468,7 +468,8 @@ void Particle::cross_surface()
write_message(1, " Crossing surface {}", surf->id_);
}
if (surf->surf_source_ && simulation::current_batch == settings::n_batches) {
if (surf->surf_source_ && simulation::current_batch > settings::n_inactive &&
!simulation::surf_source_bank.full()) {
SourceSite site;
site.r = r();
site.u = u();

View file

@ -7,6 +7,7 @@ import pytest
import openmc
from tests.testing_harness import PyAPITestHarness
from tests.regression_tests import config
@pytest.fixture
@ -118,10 +119,14 @@ class SurfaceSourceTestHarness(PyAPITestHarness):
@pytest.mark.surf_source_op('write')
def test_surface_source_write(model):
# Test result is based on 1 MPI process
np = config['mpi_np']
config['mpi_np'] = '1'
harness = SurfaceSourceTestHarness('statepoint.10.h5',
model,
'inputs_true_write.dat')
harness.main()
config['mpi_np'] = np
@pytest.mark.surf_source_op('read')