mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Fix CMFDMesh.grid setter
This commit is contained in:
parent
c0d5efc340
commit
9c646b3f32
2 changed files with 3 additions and 5 deletions
|
|
@ -246,7 +246,7 @@ class CMFDMesh:
|
|||
Real)
|
||||
check_greater_than('CMFD mesh {}-grid length'.format(dims[i]),
|
||||
len(grid[i]), 1)
|
||||
self._grid = np.array(grid)
|
||||
self._grid = [np.array(g) for g in grid]
|
||||
self._display_mesh_warning('rectilinear', 'CMFD mesh grid')
|
||||
|
||||
def _display_mesh_warning(self, mesh_type, variable_label):
|
||||
|
|
@ -1382,9 +1382,7 @@ class CMFDRun:
|
|||
|
||||
"""
|
||||
# Write each element in vector to file
|
||||
with open(base_filename+'.dat', 'w') as fh:
|
||||
for val in vector:
|
||||
fh.write('{:0.8f}\n'.format(val))
|
||||
np.savetxt(f'{base_filename}.dat', vector, fmt='%.8f')
|
||||
|
||||
# Save as numpy format
|
||||
np.save(base_filename, vector)
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ def test_cmfd_write_matrices():
|
|||
# Load flux vector from numpy output file
|
||||
flux_np = np.load('fluxvec.npy')
|
||||
# Load flux from data file
|
||||
flux_dat = np.loadtxt("fluxvec.dat", delimiter='\n')
|
||||
flux_dat = np.loadtxt("fluxvec.dat")
|
||||
|
||||
# Compare flux from numpy file, .dat file, and from simulation
|
||||
assert(np.all(np.isclose(flux_np, cmfd_run._phi)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue