Example of Using the C/C++ API is really helpful with Multi physics field coupling. But I would like to call the openmc.lib in the process of depletion calculation(integrator.integrate()) to change a simulation after a fixed time step. For example, to change the temperature of a certain cell in “openmc_simulation_n3.h5”. Can this be done?![]()
I believe changing the cell temperature inside integrate() is not supported. When integrator.integrate() is called, OpenMC performs transport calculations to solve the depletion equations and internally iterates over the time steps.
I’m not sure what multiphysics framework you’re using. However, if you set up a Cardinal simulation, you can use export_properties = True in your OpenMCCellAverageProblem block. This will produce a properties.h5 file, which can be loaded into an OpenMC model object via openmc.model.Model.import_properties("properties.h5). If you’ve never used Cardinal or MOOSE, there are lots of tutorials that show you how to couple OpenMC to heat conduction and/or thermal hydraulics.
If you have a depletion model, which already requires XML, then you are part of the way to getting your Cardinal simulation going. Just need to build a MOOSE geometry that maps properly to your OpenMC model.
Alternatively, you might be able to set cell temperatures (specifically openmc.Cell.set_temperature) on your existing model object before setting your openmc.Geometry and passing that model to the depletion or you can use a temperature distributed instance list.
Thank you for your reply. I am trying to use COMSOL for multi physics field coupling, but I have not been successful yet. Let me try your method first to see if Moose can meet my requirements.
Thank you for your reply, I also couldn’t find an API that can change the cell temperature inside integrate().
BTW there’s a new feature that you can load a properties_file in openmc.Settings, see this PR.
If you want to change temperature with burnup, you’re going to need to develop on your own to do multiphysics with updated nuclides and then load new properties before each depletion. We are working on this for my thesis work, so when we get it all figured out, I’d be able to share more.