Skip to content

Commit

Permalink
more code agnoistic layout
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Dec 16, 2023
1 parent 12cb993 commit 944b8a4
Show file tree
Hide file tree
Showing 23 changed files with 242 additions and 136 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/ci_nestedsphere.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/ci_sphere.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/ci_two_touching_cuboids.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/circular_torus_cad_to_dagmc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: circular torus - cad to dagmc

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_cad_to_dagmc/test_csg_cad_circulartorus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: nested cylinder
name: cuboid - cad to dagmc

on:
pull_request:
Expand Down Expand Up @@ -26,4 +26,4 @@ jobs:
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_csg_cad_nestedcylinder.py
pytest tests/test_cad_to_dagmc/test_csg_cad_sphere.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

name: cylinder
name: cylinder - cad to dagmc

on:
pull_request:
Expand Down Expand Up @@ -27,4 +26,4 @@ jobs:
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_csg_cad_cylinder.py
pytest tests/test_cad_to_dagmc/test_csg_cad_cylinder.py
29 changes: 29 additions & 0 deletions .github/workflows/elliptical_torus_cad_to_dagmc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: elliptical torus - cad to dagmc

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_cad_to_dagmc/test_csg_cad_ellipticaltorus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: elliptical torus
name: nested cylinder - cad to dagmc

on:
pull_request:
Expand Down Expand Up @@ -26,4 +26,4 @@ jobs:
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_csg_cad_ellipticaltorus.py
pytest tests/test_cad_to_dagmc/test_csg_cad_nestedcylinder.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: circulartorus

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_csg_cad_circulartorus.py
name: nested sphere - cad to dagmc

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_cad_to_dagmc/test_csg_cad_nestedsphere.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: cuboid
name: sphere - cad to dagmc

on:
pull_request:
Expand Down Expand Up @@ -26,4 +26,4 @@ jobs:
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_csg_cad_sphere.py
pytest tests/test_cad_to_dagmc/test_csg_cad_sphere.py
29 changes: 29 additions & 0 deletions .github/workflows/two_touching_cuboids_cad_to_dagmc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: two touching cuboids - cad to dagmc

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_cad_to_dagmc/test_csg_cad_two_touching_cuboids.py
29 changes: 29 additions & 0 deletions .github/workflows/two_touching_cuboids_cad_to_openmc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: two touching cuboids - cad to dagmc

on:
pull_request:
branches:
- develop
- main
push:
- main

jobs:
testing:
runs-on: ubuntu-latest
steps:

- name: checkout actions
uses: actions/checkout@v4

- name: use upstream test composite action
uses: ./.github/actions/dependencies

- shell: bash
env:
OPENMC_CROSS_SECTIONS: /home/runner/work/model_benchmark_zoo/model_benchmark_zoo/cross_sections.xml
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
mamba activate
pytest tests/test_cad_to_openmc/test_csg_cad_two_touching_cuboids.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ dmypy.json
*.pkl
*.ipynb
*.zip

**/_version.py
23 changes: 14 additions & 9 deletions src/model_benchmark_zoo/two_touching_cuboids.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path

# *----------*
# | |
Expand Down Expand Up @@ -49,7 +50,7 @@ def cadquery_assembly(self):
def export_stp_file(self, filename="TwoTouchingCuboids.step"):
self.cadquery_assembly().save(filename, "STEP")

def dagmc_model(self, filename="TwoTouchingCuboids.h5m", min_mesh_size=0.1, max_mesh_size=100.0):
def dagmc_model_with_cad_to_dagmc(self, filename="TwoTouchingCuboids.h5m", min_mesh_size=0.1, max_mesh_size=100.0):
from cad_to_dagmc import CadToDagmc
import openmc

Expand All @@ -69,20 +70,24 @@ def dagmc_model(self, filename="TwoTouchingCuboids.h5m", min_mesh_size=0.1, max_
model = openmc.Model(geometry=geometry)
return model

def c2omc_model(self, filename="TwoTouchingCuboids.h5m"):
def dagmc_model_with_cad_to_openmc(self, filename="TwoTouchingCuboids.h5m"):
from CAD_to_OpenMC import assembly
from pathlib import Path
import openmc
stepfn=str(Path(filename).with_suffix('.stp'))

#mesh/triangulate
a=assembly.Assembly([stepfn])
self.export_stp_file()

a=assembly.Assembly(["TwoTouchingCuboids.step"])
a.verbose=2
assembly.mesher_config['threads']=1
material_tags = [self.materials[0].name, self.materials[1].name]
a.run(backend='stl2',merge=True,h5m_filename=filename, sequential_tags=material_tags, scale=1.0)
a.run(
backend='stl2',
merge=True,
h5m_filename=filename,
sequential_tags=[self.materials[0].name, self.materials[1].name],
scale=1.0
)

universe = openmc.DAGMCUniverse(filename ,auto_geom_ids=True).bounded_universe()
universe = openmc.DAGMCUniverse(filename, auto_geom_ids=True).bounded_universe()
geometry = openmc.Geometry(universe)
model = openmc.Model(geometry=geometry)
return model
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 944b8a4

Please sign in to comment.