Skip to content

Instantly share code, notes, and snippets.

@gridley
gridley / fortranprint.py
Created September 10, 2018 13:10
print numpy array as rounded fortran array
def mag(x):
return int(np.log10(np.abs(x)))
def fortranPrint(array, unc)
"""
Prints a numpy array in format for F90 hard-coding.
array - a numpy array
unc - fractional uncertainty in entries, for rounding.
"""
shap = np.shape(array)
@gridley
gridley / assem.serp
Created May 21, 2018 19:28
A Serpent 2 model of a 17x17 PWR assembly with guide tubes
set title "OpenMC comparison"
mat fuel -10.29769
92234.06c 4.4843e-6
92235.06c 5.5815e-4
92238.06c 2.2408e-2
8016.06c 4.5829e-2
mat clad -6.55
40090.06c 2.1827e-2
@gridley
gridley / pwrWithGuides.py
Created May 21, 2018 19:26
An OpenMC model of a 17x17 PWR assembly with guide tubes.
import openmc
import numpy as np
def pwr_assembly():
"""Create a PWR assembly model.
This model is a reflected 17x17 fuel assembly from the the `BEAVRS
<http://crpg.mit.edu/research/beavrs>`_ benchmark. The fuel is 2.4 w/o
enriched UO2 corresponding to a beginning-of-cycle condition. Note that the
number of particles/batches is initially set very low for testing purposes.