Skip to content

Commit 1f7ac42

Browse files
yrrepypaulromano
andauthored
Clip negative atom densities that result from CRAM (#3879)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
1 parent a1df584 commit 1f7ac42

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

openmc/deplete/abc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,11 @@ def _timed_deplete(self, n, rates, dt, i=None, matrix_func=None):
738738
results = deplete(
739739
self._solver, self.chain, n, rates, dt, i, matrix_func,
740740
self.transfer_rates, self.external_source_rates)
741+
742+
# Clip unphysical negative number densities
743+
for r in results:
744+
r.clip(min=0.0, out=r)
745+
741746
return time.time() - start, results
742747

743748
@abstractmethod

tests/dummy_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
predictor_solution = DepletionSolutionTuple(
2626
PredictorIntegrator, np.array([1.0, 2.46847546272295, 4.11525874568034]),
27-
np.array([1.0, 0.986431226850467, -0.0581692232513460]))
27+
np.array([1.0, 0.986431226850467, 0.0]))
2828

2929

3030
cecm_solution = DepletionSolutionTuple(

0 commit comments

Comments
 (0)