Skip to content

Commit

Permalink
Merge pull request #68 from fusion-energy/single_env
Browse files Browse the repository at this point in the history
Single environment with openmc and cadquery
  • Loading branch information
shimwell authored Mar 18, 2024
2 parents 90456d0 + 4533607 commit 925382f
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 694 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci_with_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" moab>=5.3.0 gmsh python-gmsh
python -m pip install --upgrade pip
python -m pip install .
python -m pip install cadquery-ocp==7.7.2
python -m pip install cadquery==2.4.0
python -m pip install openmc_data_downloader
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/ci_with_install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# This CI does includes particle transport tests as openmc is installed

name: CI with install

on:
Expand Down Expand Up @@ -37,15 +39,12 @@ jobs:
mamba activate
mamba create -y --name cad_to_dagmc python=3.10
mamba activate cad_to_dagmc
mamba install -y -c conda-forge moab>=5.3.0 gmsh python-gmsh ocp=7.7.2.0 cadquery=2.4.0
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" gmsh python-gmsh
python -m pip install --upgrade pip
python -m pip install .
python -c "import cad_to_dagmc"
python -m pip install .[tests]
pytest -v tests/test_file_creation.py
pytest -v tests/test_loading_from_file_vs_shape_object.py
pytest -v tests/test_python_api.py
pytest -v tests/test_version.py
pytest -v tests
python examples/surface_mesh/create_stp_files_for_examples.py
python examples/surface_mesh/cadquery_assembly.py
python examples/surface_mesh/cadquery_compound.py
Expand All @@ -58,13 +57,4 @@ jobs:
python examples/surface_mesh/single_cadquery_object.py
python examples/surface_mesh/single_stp_file.py
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
pytest -v tests/test_model_creation_for_transport.py
mamba activate base
mamba create -y --name openmc python=3.10
mamba activate openmc
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*"
python -m pip install pytest
python -m pip install vtk
pytest -v tests/test_h5m_in_simulation.py
pytest -v tests/test_h5m_in_transport.py
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
20 changes: 15 additions & 5 deletions .github/workflows/ci_with_pip_install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# This CI does not currently include particle transport tests as openmc is not installed

name: CI with pip install

on:
Expand Down Expand Up @@ -32,16 +34,24 @@ jobs:
apt-get update -y
apt-get upgrade -y
apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0 libxcursor-dev libxft2 libxinerama-dev
apt-get install -y make cmake
apt install python3
apt install python3-pip
python -m pip install --upgrade pip
python -m pip install gmsh
python -m pip install cadquery-ocp==7.7.2
python -m pip install cadquery==2.4.0
python -m pip install --upgrade pip
mkdir MOAB
cd MOAB
git clone --single-branch -b 5.5.1 --depth 1 https://bitbucket.org/fathomteam/moab/
mkdir build
cd build
apt-get install -y libeigen3-dev
cmake ../moab -DENABLE_PYMOAB=ON -DENABLE_HDF5=ON -DENABLE_BLASLAPACK=OFF -DENABLE_FORTRAN=OFF
make -j2
make install
cd ../..
python -m pip install .
python -c "import cad_to_dagmc"
python -m pip install .[tests]
pytest tests -v
pytest -v tests
cd examples
python create_stp_files_for_examples.py
python cadquery_assembly.py
Expand Down
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ Also checkout these other software projects that also create DAGMC geometry [CAD

# Installation options

- Install using Mamba and minimal pip
- Install using Conda and minimal pip
- Install using Mamba and pip
- Install using Conda and pip
- Install using pip and source compilations
- Install using Conda and maximum pip TODO
- Install using Mamba and maximum pip TODO


## Install using Mamba and pip
Expand All @@ -59,25 +57,14 @@ mamba activate new_env

Install the dependencies
```bash
mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
```

Then you can install the cad_to_dagmc package with ```pip```
```bash
pip install cad_to_dagmc
```

You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).

To install OpenMC You can run ```mamba install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
```bash
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
```

It might not be possible to install OpenMC and cad-to-dagmc in the same conda/mamba python environment so you may have to create a new conda/mamba environment and install OpenMC there.

Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.


## Install using Conda and pip

Expand All @@ -100,7 +87,7 @@ conda activate new_env

Install the dependencies
```bash
conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
```

Then you can install the cad_to_dagmc package with ```pip```
Expand All @@ -110,23 +97,40 @@ pip install cad_to_dagmc

## Install using pip and source compilations

It is possible to avoid the use of conda and installing using pip and compiling from source.
It should possible to avoid the use of conda and installing using pip and compiling from source.

First compile MOAB (and install Pymoab) from source

Then install cadquery and ocp using pip
Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)

Then you can install the cad_to_dagmc package with ```pip```

```bash
pip install cadquery-ocp==7.7.2
pip install cadquery==2.4.0
pip install cad_to_dagmc
```

Then you can install the cad_to_dagmc package with ```pip```
## Install with transport code (e.g OpenMC)

You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).

To install OpenMC you can run ```mamba install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
```bash
pip install cad_to_dagmc
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
```

It might not be possible to install OpenMC and cad-to-dagmc in the same conda/mamba python environment so you may have to create a new conda/mamba environment and install OpenMC there.

Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.



# Known incompatibilities

The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.

The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with ```python -m pip install --upgrade pip```

Installing one of the package dependancies (gmsh) with pip appears to result in occational errors when passing cad objects between cadquery / ocp and gmsh. The conda install gmsh appears to work fine.

# Usage - with OpenMC

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ classifiers = [
dependencies = [
"trimesh",
"networkx",
"cadquery-ocp>=7.7.2",
"cadquery>=2.4.0",
]
dynamic = ["version"]

Expand Down
137 changes: 0 additions & 137 deletions tests/test_h5m_in_simulation.py

This file was deleted.

Loading

0 comments on commit 925382f

Please sign in to comment.