Download data/scripts/example_salome_export.py from introvoyz042/OpenPNM: direct link, hf CLI and curl.
- Browser
- Download file 744 Bytes
-
https://huggingface.co/datasets/introvoyz042/OpenPNM/resolve/main/data/scripts/example_salome_export.py
- Command line
-
hf download hf://datasets/introvoyz042/OpenPNM/data/scripts/example_salome_export.py
-
curl -L -o example_salome_export.py https://huggingface.co/datasets/introvoyz042/OpenPNM/resolve/main/data/scripts/example_salome_export.py
744 Bytes
| r""" | |
| In the example script a generic network is created then exported as a | |
| Salome Python script. The script should be executed from Salome with | |
| "load script". The geometry is then built. The geometry generation on | |
| Salome may take some time depending on the number of pores. | |
| """ | |
| import numpy as np | |
| import openpnm as op | |
| # Workspace and project | |
| ws = op.Workspace() | |
| proj = ws.new_project() | |
| export = False | |
| # Network | |
| np.random.seed(7) | |
| net = op.network.Cubic(shape=[4, 3, 3], spacing=1e-4, project=proj) | |
| # Geometry | |
| geo = op.geometry.SpheresAndCylinders(network=net, pores=net.Ps, throats=net.Ts) | |
| # Phase | |
| phase = op.phase.Water(network=net) | |
| # Export the network | |
| if export: | |
| proj.export_data(phases=[phase], filename='out', filetype='Salome') | |