From 8a41a6d27a6eec4fe2c301361d92845160644ae8 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 25 Mar 2024 16:38:58 +0100 Subject: [PATCH 01/20] check for degenrate toroids in step issue warning if found --- src/CAD_to_OpenMC/assembly.py | 10 +++++--- src/CAD_to_OpenMC/check_step.py | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/CAD_to_OpenMC/check_step.py diff --git a/src/CAD_to_OpenMC/assembly.py b/src/CAD_to_OpenMC/assembly.py index 9dbc7ca..d473d12 100644 --- a/src/CAD_to_OpenMC/assembly.py +++ b/src/CAD_to_OpenMC/assembly.py @@ -11,15 +11,15 @@ import re import os import math +import sys + from datetime import datetime from pymoab import core, types import CAD_to_OpenMC.assemblymesher as am from CAD_to_OpenMC.datadirectory import mesher_datadir - -import pdb -#pdb.set_trace() +from CAD_to_OpenMC.check_step import has_degenerate_toroids try: import gmsh @@ -273,6 +273,10 @@ def import_stp_files( translate: Translation vector to apply to all parts in the step-file. rotate: Rotation angles to apply to the parts in the step-file. """ + for stp in self.stp_files: + warn, ct = has_degenerate_toroids(stp,True) + if warn: + print(f'WARNING: Step file {stp} has {ct} degenerate toroid surfaces. These are known to cause problems in some cases',file=sys.stderr) tags_set = 0 # clear list to avoid double-import diff --git a/src/CAD_to_OpenMC/check_step.py b/src/CAD_to_OpenMC/check_step.py new file mode 100644 index 0000000..5595649 --- /dev/null +++ b/src/CAD_to_OpenMC/check_step.py @@ -0,0 +1,43 @@ +#a set of function to report on input step-files +import re + +def assemble_cmd(line,file): + line=line.strip() + while not line.endswith(';'): + line=line+file.readline().strip() + return line + +def parse_command(command): + pattern='(#[0-9]+)\s*=\s*(\w+)\s*\((.*)\);' + multipattern='(#[0-9]+)\s*=\s*\(((\w+)\s*\((.*)\))+\);' + m=re.match(pattern,command) + if(not m): + m=re.match(multipattern,command) + if (not m): + return None + return m.groups() + +degen_pattern=r'(#\d+)=DEGENERATE_TOROIDAL_SURFACE\(\'.*\',(#\d+),([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?),([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?),\.([TFtf])\.' + +def has_degenerate_toroids(infile='geometry.step', only_known_fail=False): + dtors=[] + with open(infile,'r') as f: + for line in f: + m=re.search(degen_pattern,line) + if m: + dtors.append(m.groups()) + + if only_known_fail: + #remove those toroids which we know work - i.e. those where select outer is true + for tor in dtors: + r_maj, r_min = tor[2:4] + if tor[4] in ['F','f']: + outer=False + else: + outer=True + if r_maj > 2*r_min or not outer: + dtors.remove(tor) + if len(dtors)>0: + return True, len(dtors) + else: + return False, 0 From 5c7a6fcacda2f574a9397dad18627404e914b8d1 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 25 Mar 2024 16:40:04 +0100 Subject: [PATCH 02/20] add a big set of colors --- scripts/c2omc_crashtest.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/c2omc_crashtest.py b/scripts/c2omc_crashtest.py index 6ca8f18..3387266 100755 --- a/scripts/c2omc_crashtest.py +++ b/scripts/c2omc_crashtest.py @@ -4,7 +4,8 @@ import sys import h5py import numpy as np - +import matplotlib.colors as mcolors +import itertools as it import openmc class h5mF(h5py.File): @@ -17,7 +18,7 @@ def __init(self,*args,**kwargs): cat_ids=taggroup['CATEGORY']['id_list'] class MeshPlot(): - def __init__(self,stepf='cad.step', init_openmc=True, pxl=2048, cyl=False, vol=False, origin=[0.0,0.0,0.0], width=[0.0,0.0,0.0], particles=100000, **kwargs): + def __init__(self,stepf='cad.step', init_openmc=True, pxl=2048, cyl=False, vol=False, origin=[0.0,0.0,0.0], width=[0.0,0.0,0.0], particles=100000, verbose=False,**kwargs): self.stepf=stepf self.h5mf=pl.Path(stepf).with_suffix('.h5m') self.pixels=pxl @@ -26,6 +27,7 @@ def __init__(self,stepf='cad.step', init_openmc=True, pxl=2048, cyl=False, vol=F self.origin=np.array(origin) self.width=np.array(width) self.particles=int(float(particles)) + self.verbose=verbose if (init_openmc): self.init_openmc() @@ -108,7 +110,7 @@ def bld_mats(self): matlist=openmc.Materials() for matraw in mats: - mat=matraw.replace("mat:","") + mat=matraw.replace("mat:","").lower() if mat.endswith('_comp'): mat=mat.replace('_comp','') if mat in [n.name for n in matlist]: @@ -120,8 +122,11 @@ def bld_mats(self): self.matlist=matlist def bld_plots(self): - colors=['blue','green','magenta','red','cyan','steelblue'] - colordict={m:c for m,c in zip(self.matlist,colors)} + colordict={m:c for m,c in zip(self.matlist,it.cycle(mcolors.CSS4_COLORS.keys()))} + if (self.verbose): + for k,v in colordict.items(): + print(k.name,v) + bb=self.bb p1=openmc.Plot().from_geometry(self.geometry) p1.basis='xy' @@ -153,8 +158,7 @@ def bld_plots(self): plts.export_to_xml() def bld_plot3d(self): - colors=['blue','green','magenta','red','cyan','steelblue'] - colordict={m:c for m,c in zip(self.matlist,colors)} + colordict={m:c for m,c in zip(self.matlist,it.cycle(mcolors.CSS4_COLORS.keys()))} pp=openmc.Plot().from_geometry(self.geometry) pp.type='voxel' pp.width=self.width @@ -193,6 +197,7 @@ def bld_source(self): prs.add_argument('--vol', action='store_true') prs.add_argument('--origin',nargs=3,type=float, default=[0.0,0.0,0.0]) prs.add_argument('--width',nargs=3,type=float, default=[0.0,0.0,0.0]) + prs.add_argument('--verbose','-v',action='store_true') args=prs.parse_args() try: mp=MeshPlot(args.stepfile, True, **vars(args)) From 87191965ccfc070fad5fa08c715b38d03c7523d5 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 25 Mar 2024 16:40:37 +0100 Subject: [PATCH 03/20] openmc tests are now conditional --- tests/test_OMC_DAGMC.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_OMC_DAGMC.py b/tests/test_OMC_DAGMC.py index 77aeaa1..68af312 100644 --- a/tests/test_OMC_DAGMC.py +++ b/tests/test_OMC_DAGMC.py @@ -1,9 +1,10 @@ import pathlib import os -import openmc import math import sys import pytest +#if openmc cannot be imported - skip these tests +openmc = pytest.importorskip("openmc") import CAD_to_OpenMC.assembly as ab From a957396d16a7bf0e45c45991a9685990269f892d Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 25 Mar 2024 16:41:13 +0100 Subject: [PATCH 04/20] release candidate version --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d15d2b9..3303dc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name="CAD_to_OpenMC" -version="0.3.2" +version="0.3.3a0" authors = [ { name="Erik B Knudsen", email="erik.knudsen@copenhagenatomics.com" }, ] @@ -20,10 +20,7 @@ dependencies=[ 'cadquery>=2', 'cadquery-ocp>=7', 'numpy', - 'meshio', 'trimesh', - 'networkx', - 'Cython' ] [project.urls] From ee7d3a2f3e847d4f4b45ecb7c95a7d82b17bc875 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 25 Mar 2024 16:41:51 +0100 Subject: [PATCH 05/20] testing to remove reqs-file --- requirements.txt | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 61ea2c2..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -gmsh -pyparsing>=2.4 -cadquery>=2.2.0 -cadquery-ocp>=7.7.0 -numpy -OCP -meshio -trimesh -networkx -Cython>=0.29.32 From b640575a00d1f9c16c29d519a6bb7b4dfb8c4170 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Tue, 26 Mar 2024 16:49:05 +0100 Subject: [PATCH 06/20] don't use a symlink here it creates problems for conda --- tests/examples | 1 - tests/harnessRun.py | 2 +- tests/test_OMC_DAGMC.py | 10 +++++----- tests/test_transform.py | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) delete mode 120000 tests/examples diff --git a/tests/examples b/tests/examples deleted file mode 120000 index 785887f..0000000 --- a/tests/examples +++ /dev/null @@ -1 +0,0 @@ -../examples/ \ No newline at end of file diff --git a/tests/harnessRun.py b/tests/harnessRun.py index d0d8a91..ab0d6da 100644 --- a/tests/harnessRun.py +++ b/tests/harnessRun.py @@ -4,7 +4,7 @@ class HarnessRun: def __init__(self): - infile = 'examples/7pin.step' + infile = '../examples/7pin.step' self.a = ab.Assembly(verbose=2) self.a.stp_files = [infile] self.a.import_stp_files() diff --git a/tests/test_OMC_DAGMC.py b/tests/test_OMC_DAGMC.py index 68af312..babd2ae 100644 --- a/tests/test_OMC_DAGMC.py +++ b/tests/test_OMC_DAGMC.py @@ -29,21 +29,21 @@ def run(self): @pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_p1(): - o = OMC_DAGMC_harness('examples/step_files/pincell1.step') + o = OMC_DAGMC_harness('../examples/step_files/pincell1.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07944,0.00070)} o.run() @pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_p2(): - o = OMC_DAGMC_harness('examples/step_files/pincell2.step') + o = OMC_DAGMC_harness('../examples/step_files/pincell2.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07786,0.0008)} o.run() @pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_tors(): - o = OMC_DAGMC_harness('examples/step_files/toroids.step') + o = OMC_DAGMC_harness('../examples/step_files/toroids.step') # override source spatial distribution o.tt.settings.source.space=openmc.stats.CylindricalIndependent( openmc.stats.Discrete([100,85,77.5],[1.0/3.0,1.0/3.0, 1.0/3.0]), openmc.stats.Uniform(0.0,2.0*math.pi), openmc.stats.Discrete([0.0],[1.0]) @@ -54,14 +54,14 @@ def test_h5m_neutronics_tors(): @pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_spheroids(): - o = OMC_DAGMC_harness('examples/step_files/spheroids.step') + o = OMC_DAGMC_harness('../examples/step_files/spheroids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.39082,0.01622)} o.run() @pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_ellipsoids(): - o = OMC_DAGMC_harness('examples/step_files/oblate_ellipsoids.step') + o = OMC_DAGMC_harness('../examples/step_files/oblate_ellipsoids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.05396,0.01514)} o.run() diff --git a/tests/test_transform.py b/tests/test_transform.py index 8a21f65..82fe5ec 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -5,7 +5,7 @@ class HarnessTrans(HarnessRun): def __init__(self): - self.infile = 'examples/7pin.step' + self.infile = '../examples/7pin.step' self.a = ab.Assembly(verbose=2) def run(self,merge=False, **kwargs): From 554d981ed6493cadd126cd682976d43ac9bb1aba Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Wed, 27 Mar 2024 15:17:41 +0100 Subject: [PATCH 07/20] move 7pin to the test directory to help with conda install --- {examples => tests}/7pin.step | 0 tests/harnessRun.py | 2 +- tests/test_transform.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {examples => tests}/7pin.step (100%) diff --git a/examples/7pin.step b/tests/7pin.step similarity index 100% rename from examples/7pin.step rename to tests/7pin.step diff --git a/tests/harnessRun.py b/tests/harnessRun.py index ab0d6da..ac3c67b 100644 --- a/tests/harnessRun.py +++ b/tests/harnessRun.py @@ -4,7 +4,7 @@ class HarnessRun: def __init__(self): - infile = '../examples/7pin.step' + infile = '7pin.step' self.a = ab.Assembly(verbose=2) self.a.stp_files = [infile] self.a.import_stp_files() diff --git a/tests/test_transform.py b/tests/test_transform.py index 82fe5ec..4e7f550 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -5,7 +5,7 @@ class HarnessTrans(HarnessRun): def __init__(self): - self.infile = '../examples/7pin.step' + self.infile = '7pin.step' self.a = ab.Assembly(verbose=2) def run(self,merge=False, **kwargs): From 90a2fc032650d97123fd23a16ea16088e0565b31 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:04:01 +0200 Subject: [PATCH 08/20] Revert "testing to remove reqs-file" This reverts commit ee7d3a2f3e847d4f4b45ecb7c95a7d82b17bc875. --- requirements.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..61ea2c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +gmsh +pyparsing>=2.4 +cadquery>=2.2.0 +cadquery-ocp>=7.7.0 +numpy +OCP +meshio +trimesh +networkx +Cython>=0.29.32 From 5a880d122ee2b92cd5c44b348d9be9e7b094d374 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:05:20 +0200 Subject: [PATCH 09/20] remove unused deps --- requirements.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 61ea2c2..dc5fe49 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,8 @@ gmsh -pyparsing>=2.4 +pyparsing cadquery>=2.2.0 cadquery-ocp>=7.7.0 numpy -OCP -meshio trimesh networkx -Cython>=0.29.32 +Cython From 8dfa70fa221a9ef7a0503806b3b2d0eb12d3ed98 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:08:04 +0200 Subject: [PATCH 10/20] potential fix for #82 --- src/CAD_to_OpenMC/assembly.py | 46 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/CAD_to_OpenMC/assembly.py b/src/CAD_to_OpenMC/assembly.py index d473d12..b022e7b 100644 --- a/src/CAD_to_OpenMC/assembly.py +++ b/src/CAD_to_OpenMC/assembly.py @@ -23,7 +23,6 @@ try: import gmsh - nogmsh = False except ImportError as e: print(f"Warning: import gmsh failed ({e})- material tag-list, must be supplied.") @@ -325,36 +324,35 @@ def import_stp_files( e.tag = tag tags_set = tags_set + 1 gmsh.finalize() - elif tags: + + if tags: # tag objects according to the tags dictionary. gmsh.initialize() vols = gmsh.model.occ.importShapes(stp) gmsh.model.occ.synchronize() for e, v in zip(ents, vols): vid = v[1] - try: - s = gmsh.model.getEntityName(3, vid) - part = s.split("/")[-1] - tag = None - for k in tags.keys(): - if match_anywhere: - g = re.search(k, part) - else: - g = re.match(k, part) - if g: - tag = tags[k] - break - if tag is None: - tag = self.default_tag + s = gmsh.model.getEntityName(3, vid) + part = s.split("/")[-1] + tag = None + for k in tags.keys(): + if match_anywhere: + g = re.search(k, part) else: - tags_set = tags_set + 1 - if self.verbose > 1: - print( - f"INFO: Tagging volume #{vid} label:{s} with material {tag}" - ) - except Exception as _e: - tag = default_tag - e.tag = tag + g = re.match(k, part) + if g is not None: + tag = tags[k] + break + #if tag is still not set at this point we will either leave it or set it to the default. + if tag is None: + if e.tag is None or self.noextract_tags: + tag = self.default_tag + else: + tag = tag + if self.verbose > 1: + print( + f"INFO: Tagging volume #{vid} label:{s} with material {tag}" + ) gmsh.finalize() elif sequential_tags: for e, t in zip_longest( From 3c0f400a094610fb0849e2033447e436e3aa2a5d Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:26:37 +0200 Subject: [PATCH 11/20] appears that build now uses only diminutive letters --- .github/workflows/python-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 0f7d5b0..3461515 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -66,8 +66,8 @@ jobs: shell: micromamba-shell {0} - name: Build, pip-install, and test-import CAD_to_OpenMC with dependencies. run: | - python -m build - pip install dist/CAD_to_OpenMC*.tar.gz + python -m build --sdist . + pip install dist/cad_to_openmc*.tar.gz python -c 'import CAD_to_OpenMC.assembly' shell: micromamba-shell {0} - name: Run Tests From 955d620e32033fbcc04a963efd0db4601ff6faab Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:58:13 +0200 Subject: [PATCH 12/20] this is a test --- .github/workflows/python-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3461515..c0ccf46 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -72,5 +72,6 @@ jobs: shell: micromamba-shell {0} - name: Run Tests run: | + pwd pytest -v --debug=debuglog.log tests shell: micromamba-shell {0} From 23ffab98a623156d4528a47995422245d765f5aa Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 13:58:13 +0200 Subject: [PATCH 13/20] trying out a few things --- tests/test_gmsh.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_gmsh.py b/tests/test_gmsh.py index 5ba1d3d..eb7392a 100644 --- a/tests/test_gmsh.py +++ b/tests/test_gmsh.py @@ -3,6 +3,9 @@ from tests.harnessRun import HarnessRun import pathlib as pl +print("here I am") +print(pl.Path('.').resolve()) + class HarnessGmsh(HarnessRun): def __init__(self): super().__init__() From c30677fc050e695461c5700ad30728f8604af08d Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 14:15:48 +0200 Subject: [PATCH 14/20] trying to figure out paths --- tests/test_gmsh.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_gmsh.py b/tests/test_gmsh.py index eb7392a..f31f89d 100644 --- a/tests/test_gmsh.py +++ b/tests/test_gmsh.py @@ -3,9 +3,6 @@ from tests.harnessRun import HarnessRun import pathlib as pl -print("here I am") -print(pl.Path('.').resolve()) - class HarnessGmsh(HarnessRun): def __init__(self): super().__init__() @@ -21,5 +18,8 @@ def run(self): #self.cleanup() def testgmsh(): + print("here I am") + print(pl.Path('.').resolve()) + t = HarnessGmsh() t.run() From d97f7adb61d86ef265fac4deaac362a19ea69b92 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 14:24:45 +0200 Subject: [PATCH 15/20] explicitly state the tests directory --- tests/harnessRun.py | 2 +- tests/test_gmsh.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/harnessRun.py b/tests/harnessRun.py index ac3c67b..5bbc79f 100644 --- a/tests/harnessRun.py +++ b/tests/harnessRun.py @@ -4,7 +4,7 @@ class HarnessRun: def __init__(self): - infile = '7pin.step' + infile = 'tests/7pin.step' self.a = ab.Assembly(verbose=2) self.a.stp_files = [infile] self.a.import_stp_files() diff --git a/tests/test_gmsh.py b/tests/test_gmsh.py index f31f89d..5ba1d3d 100644 --- a/tests/test_gmsh.py +++ b/tests/test_gmsh.py @@ -18,8 +18,5 @@ def run(self): #self.cleanup() def testgmsh(): - print("here I am") - print(pl.Path('.').resolve()) - t = HarnessGmsh() t.run() From 67d707987dc097764c73e615d0283df2bb6ee241 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 14:29:05 +0200 Subject: [PATCH 16/20] datafile in tests --- tests/test_transform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_transform.py b/tests/test_transform.py index 4e7f550..aab84e0 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -5,7 +5,7 @@ class HarnessTrans(HarnessRun): def __init__(self): - self.infile = '7pin.step' + self.infile = 'tests/7pin.step' self.a = ab.Assembly(verbose=2) def run(self,merge=False, **kwargs): From ac79ea8d696f517a66c10b716e8d3277cdcd90be Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 14:50:39 +0200 Subject: [PATCH 17/20] python version is >3.10 for 3.10.2 etc. --- tests/test_OMC_DAGMC.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_OMC_DAGMC.py b/tests/test_OMC_DAGMC.py index babd2ae..403b872 100644 --- a/tests/test_OMC_DAGMC.py +++ b/tests/test_OMC_DAGMC.py @@ -27,23 +27,23 @@ def run(self): self.tt.cleanup() self.cleanup() -@pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_p1(): - o = OMC_DAGMC_harness('../examples/step_files/pincell1.step') + o = OMC_DAGMC_harness('tests/examples/step_files/pincell1.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07944,0.00070)} o.run() -@pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_p2(): - o = OMC_DAGMC_harness('../examples/step_files/pincell2.step') + o = OMC_DAGMC_harness('tests/examples/step_files/pincell2.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07786,0.0008)} o.run() -@pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_tors(): - o = OMC_DAGMC_harness('../examples/step_files/toroids.step') + o = OMC_DAGMC_harness('tests/examples/step_files/toroids.step') # override source spatial distribution o.tt.settings.source.space=openmc.stats.CylindricalIndependent( openmc.stats.Discrete([100,85,77.5],[1.0/3.0,1.0/3.0, 1.0/3.0]), openmc.stats.Uniform(0.0,2.0*math.pi), openmc.stats.Discrete([0.0],[1.0]) @@ -52,16 +52,16 @@ def test_h5m_neutronics_tors(): o.tt.results={'keff':(1.61936,0.08562)} o.run() -@pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_spheroids(): - o = OMC_DAGMC_harness('../examples/step_files/spheroids.step') + o = OMC_DAGMC_harness('tests/examples/step_files/spheroids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.39082,0.01622)} o.run() -@pytest.mark.skipif(sys.version_info > (3, 10), reason="requires python3.10 or lower") +@pytest.mark.skipif(sys.version_info >= (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_ellipsoids(): - o = OMC_DAGMC_harness('../examples/step_files/oblate_ellipsoids.step') + o = OMC_DAGMC_harness('tests/examples/step_files/oblate_ellipsoids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.05396,0.01514)} o.run() From 6277085186e7edccb1afbd4c324224c551d534b7 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 14:57:48 +0200 Subject: [PATCH 18/20] get paths right --- tests/test_OMC_DAGMC.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_OMC_DAGMC.py b/tests/test_OMC_DAGMC.py index 403b872..6f82ed3 100644 --- a/tests/test_OMC_DAGMC.py +++ b/tests/test_OMC_DAGMC.py @@ -27,23 +27,23 @@ def run(self): self.tt.cleanup() self.cleanup() -@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") +#@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_p1(): - o = OMC_DAGMC_harness('tests/examples/step_files/pincell1.step') + o = OMC_DAGMC_harness('examples/step_files/pincell1.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07944,0.00070)} o.run() -@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") +#@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_p2(): - o = OMC_DAGMC_harness('tests/examples/step_files/pincell2.step') + o = OMC_DAGMC_harness('examples/step_files/pincell2.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(0.07786,0.0008)} o.run() -@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") +#@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_tors(): - o = OMC_DAGMC_harness('tests/examples/step_files/toroids.step') + o = OMC_DAGMC_harness('examples/step_files/toroids.step') # override source spatial distribution o.tt.settings.source.space=openmc.stats.CylindricalIndependent( openmc.stats.Discrete([100,85,77.5],[1.0/3.0,1.0/3.0, 1.0/3.0]), openmc.stats.Uniform(0.0,2.0*math.pi), openmc.stats.Discrete([0.0],[1.0]) @@ -52,16 +52,16 @@ def test_h5m_neutronics_tors(): o.tt.results={'keff':(1.61936,0.08562)} o.run() -@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") +#@pytest.mark.skipif(sys.version_info >= (3, 11), reason="requires python3.10 or lower") def test_h5m_neutronics_spheroids(): - o = OMC_DAGMC_harness('tests/examples/step_files/spheroids.step') + o = OMC_DAGMC_harness('examples/step_files/spheroids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.39082,0.01622)} o.run() -@pytest.mark.skipif(sys.version_info >= (3, 10), reason="requires python3.10 or lower") +#@pytest.mark.skipif(sys.version_info >= (3, 10), reason="requires python3.10 or lower") def test_h5m_neutronics_ellipsoids(): - o = OMC_DAGMC_harness('tests/examples/step_files/oblate_ellipsoids.step') + o = OMC_DAGMC_harness('examples/step_files/oblate_ellipsoids.step') openmc.config['cross_sections']=str(o.nuclear_lib) o.tt.results={'keff':(1.05396,0.01514)} o.run() From 07b9ca63ae456b31a6f777869504d8e29cce77a4 Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 15:03:31 +0200 Subject: [PATCH 19/20] networkx should be a requirement as it is required for gmsh --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3303dc7..30ce093 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dependencies=[ 'cadquery>=2', 'cadquery-ocp>=7', 'numpy', + 'networkx', 'trimesh', ] From 34037260619855983ec0a50ed1fe286ff928c19e Mon Sep 17 00:00:00 2001 From: Erik B Knudsen Date: Mon, 22 Apr 2024 16:09:05 +0200 Subject: [PATCH 20/20] default should be 1 thread since parallell has problems --- src/CAD_to_OpenMC/assembly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CAD_to_OpenMC/assembly.py b/src/CAD_to_OpenMC/assembly.py index b022e7b..c722b4d 100644 --- a/src/CAD_to_OpenMC/assembly.py +++ b/src/CAD_to_OpenMC/assembly.py @@ -40,7 +40,7 @@ "max_mesh_size": 10, "curve_samples": 20, "mesh_algorithm": 1, - "threads": 4, + "threads": 1, "radial_threshold": 0, "refine": 0, "verbose": 0,