mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Updating DagMC s.t. their temperatures can be set using material temps. Also addressig a bug in closing an hdf5 dataset and adding tests.
This commit is contained in:
parent
71522fd310
commit
da152b9b0f
5 changed files with 33 additions and 2 deletions
|
|
@ -290,7 +290,7 @@ void load_dagmc_geometry()
|
|||
|
||||
if (c->material_[0] == MATERIAL_VOID) { continue; }
|
||||
|
||||
auto& mat = model::materials[c->material_[0]];
|
||||
auto& mat = model::materials[model::material_map[c->material_[0]]];
|
||||
if (model::DAG->has_prop(vol_handle, "temp")) {
|
||||
rval = model::DAG->prop_value(vol_handle, "temp", temp_value);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ void write_geometry(hid_t file)
|
|||
#ifdef DAGMC
|
||||
if (settings::dagmc) {
|
||||
write_attribute(geom_group, "dagmc", 1);
|
||||
close_group(geom_group);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<material depletable="true" id="40" name="fuel">
|
||||
<material depletable="true" id="40" name="fuel" temperature="320">
|
||||
<density units="g/cc" value="11" />
|
||||
<nuclide ao="1.0" name="U235" />
|
||||
</material>
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
<parameters>-4 -4 -4 4 4 4</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<verbosity>7</verbosity>
|
||||
<temperature_tolerance>50.0</temperature_tolerance>
|
||||
<dagmc>true</dagmc>
|
||||
</settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,19 @@ from openmc.stats import Box
|
|||
import pytest
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
import numpy as np
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
not openmc.capi._dagmc_enabled(),
|
||||
reason="DAGMC CAD geometry is not enabled.")
|
||||
|
||||
|
||||
class DAGMCPyAPITestHarness(PyAPITestHarness):
|
||||
|
||||
def _compare_inputs(self):
|
||||
super()._compare_inputs()
|
||||
|
||||
|
||||
def test_dagmc():
|
||||
model = openmc.model.Model()
|
||||
|
||||
|
|
@ -16,6 +25,7 @@ def test_dagmc():
|
|||
model.settings.batches = 5
|
||||
model.settings.inactive = 0
|
||||
model.settings.particles = 100
|
||||
model.settings.temperature = {'tolerance': 50.0}
|
||||
|
||||
source = openmc.Source(space=Box([-4, -4, -4],
|
||||
[ 4, 4, 4]))
|
||||
|
|
@ -34,6 +44,7 @@ def test_dagmc():
|
|||
u235.add_nuclide('U235', 1.0, 'ao')
|
||||
u235.set_density('g/cc', 11)
|
||||
u235.id = 40
|
||||
u235.temperature = 320
|
||||
|
||||
water = openmc.Material(name="water")
|
||||
water.add_nuclide('H1', 2.0, 'ao')
|
||||
|
|
@ -46,4 +57,21 @@ def test_dagmc():
|
|||
model.materials = mats
|
||||
|
||||
harness = PyAPITestHarness('statepoint.5.h5', model=model)
|
||||
model.settings.verbosity = 1
|
||||
harness._build_inputs()
|
||||
|
||||
# check cell temps as well here
|
||||
openmc.capi.init([])
|
||||
|
||||
expected_temps = { 1 : 320.0, # assigned by material
|
||||
2 : 300.0, # assigned in dagmc file
|
||||
3 : 293.6 } # assigned by default
|
||||
|
||||
for cell_id, temp in expected_temps.items():
|
||||
capi_cell = openmc.capi.cells[cell_id]
|
||||
assert np.isclose(capi_cell.get_temperature(), temp)
|
||||
|
||||
openmc.capi.finalize()
|
||||
|
||||
model.settings.verbosity = 7
|
||||
harness.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue