Code Monkey home page Code Monkey logo

Comments (4)

shimwell avatar shimwell commented on June 12, 2024 1

openmc 0.13.0 doesn't write the initial_source.h5 for fixed source simulations despite their being an attribute
Related issue openmc-dev/openmc#1537

The source sampling feature in the next release of openmc (that FLF funded) will help obtain the information required without the need to write a initial_source file

from openmc_source_plotter.

shimwell avatar shimwell commented on June 12, 2024

Yep you currently need openmc 0.11for this to work, the readme has an example

from openmc_source_plotter.

RemDelaporteMathurin avatar RemDelaporteMathurin commented on June 12, 2024

Ok, is it because the current version doesn't write "initial_source.h5"? if so, why is the settings.write_initial_source attribute not deprecated?

from openmc_source_plotter.

RemDelaporteMathurin avatar RemDelaporteMathurin commented on June 12, 2024

Ok I see. I shall close this now :-)

For those who are interested, my workaround was:

import matplotlib.pyplot as plt
import numpy as np

E = my_source.energy
n_samples = 20000
std_dev = np.sqrt(4.*E.e0*E.kt/E.m_rat)
energy = np.random.normal(E.e0, std_dev, n_samples)
energy *= 

plt.hist(energy, bins="auto", alpha=0.8)
plt.savefig("out.png")

For a source with a Muir energy spectrum

from openmc_source_plotter.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.