mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Release resources properly from Operator class
This commit is contained in:
parent
592fae536f
commit
2e358a2ca4
5 changed files with 14 additions and 4 deletions
|
|
@ -131,3 +131,6 @@ def cecm(operator, print_out=True):
|
|||
|
||||
# Return to origin
|
||||
os.chdir(dir_home)
|
||||
|
||||
# Release resources
|
||||
operator.finalize()
|
||||
|
|
|
|||
|
|
@ -98,3 +98,6 @@ def predictor(operator, print_out=True):
|
|||
|
||||
# Return to origin
|
||||
os.chdir(dir_home)
|
||||
|
||||
# Release resources
|
||||
operator.finalize()
|
||||
|
|
|
|||
|
|
@ -219,9 +219,6 @@ class OpenMCOperator(Operator):
|
|||
# Create reaction rate tables
|
||||
self.initialize_reaction_rates()
|
||||
|
||||
def __del__(self):
|
||||
openmc.capi.finalize()
|
||||
|
||||
def extract_mat_ids(self):
|
||||
"""Extracts materials and assigns them to processes.
|
||||
|
||||
|
|
@ -475,6 +472,10 @@ class OpenMCOperator(Operator):
|
|||
# Return number density vector
|
||||
return self.total_density_list()
|
||||
|
||||
def finalize(self):
|
||||
"""Finalize a depletion simulation and release resources."""
|
||||
openmc.capi.finalize()
|
||||
|
||||
def _update_materials(self):
|
||||
"""Updates material compositions in OpenMC on all processes."""
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class DummyGeometry(Operator):
|
|||
def __init__(self, settings):
|
||||
super().__init__(settings)
|
||||
|
||||
def finalize(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def chain(self):
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from collections import Mapping
|
||||
from collections.abc import Mapping
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue