I have no experience in python or any computer program. I have installed OpenMC and the OpenMC python API with conda (from what I understand installing OpenMC with conda installs the OpenMC python API).
The problem is that when I use the code for the OpenMC examples in pycharm (a python interpreter), I just get a bunch of error messages. I want to create the xml files and I am using the export_to_xml() method, but I must not have the correct setup because I just get error messages. This is a really elementary question, but how do I use the python API to generate the required xml files? It would be really useful if there was a quick tutorial on how to use the OpenMC python API to generate the xml files, for someone that has no python experience.
Hi angerbought,
Welcome to the community. Can you share what message that you got?
OpenMC developers had put together a collections of OpenMC examples here. They are very easy to follow, and show you how to create .xml files needed for simulation.
Thanks for your help. The error was that python did not recognize matplotlib. I took that line out of the code and was able to generate the xml files and also run openmc.
Make sure you set up a Python environment that has all of the dependencies. Conda is an easy way to do this, and PyCharm even includes some tools to help you manage your Conda environments.
Time invested in learning Python will give great returns in productivity, both in using OpenMC and in science and engineering work in general!
I was able to do that with PyCharm and get openmc to run an aexample. How do I do it with visual studio? I am learning python through Paul McWhorter’s youtube videos, but I only know simple things. I have the cross sections xml file in my working directory, but I have no idea what “setting up a Python environment that has all of the dependencies” even means (although I somehow did it when using PyCharm), as I am sure no beginner does.
Right now python does not know what openmc is when I input “import openmc” in a .py file that I am interpreting with visual studio. How can I work in an open-mc environment in visual studio? It would be nice if there was a quick start guide for the people like me who have no understanding of programming? I installed opnemc with conda.