| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
openmc2dolfinx is a lightweight tool for converting OpenMC output data (in .vtk format) into dolfinx-compatible fem.Function objects. It is primarily designed to facilitate multiphysics coupling between OpenMC and finite element simulations (e.g. thermal, diffusion, or tritium transport analyses).
Using conda:
conda create -n openmc2dolfinx-env
conda activate openmc2dolfinx-env
conda install -c conda-forge fenics-dolfinx=0.9.0 mpich pyvistaOnce in the created in environment:
python -m pip install openmc2dolfinxfrom openmc2dolfinx import StructuredGridReader, UnstructuredMeshReader
import pyvista as pv
import numpy as np
import dolfinx
from mpi4py import MPI
# download an example tetmesh
filename = pv.examples.download_tetrahedron(load=False)
grid = pv.read(filename)
# assign random cell data
grid.cell_data["mean"] = np.arange(grid.n_cells)
grid.save("out.vtk")
# read the vtk file
reader = UnstructuredMeshReader("out.vtk")
# make a dolfinx function
u = reader.create_dolfinx_function("mean")
# export to vtk for visualisation
writer = dolfinx.io.VTXWriter(MPI.COMM_WORLD, "out.bp", u, "BP5")
writer.write(t=0)| Back | FazBrowse Home | New Git URL |