Skip to content

Instantly share code, notes, and snippets.

@pshriwise
pshriwise / two_layer_sphere.jou
Created December 17, 2020 16:12
Trelis/Cubit Script for generation of a sphere hex mesh conforming to two sphere boundaries
reset
create sphere radius 1.4 inner radius 1.25
create sphere radius 1.25
merge all
webcut body all xplane
webcut body all yplane
webcut body all zplane
delete volume 3 4 5 6 7 8 9 10 11 12 13 14 15 16
merge all
@pshriwise
pshriwise / foam_set_procs.sh
Created November 15, 2020 21:04
Bash script for setting the number of subdomains in an OpenFOAM problem.
#!/bin/bash
# Script for modifying the number of processes in =
# an OpenFOAM case
# Usage:
# bash set_procs.sh <desired number of MPI processes> <options>
# Options:
@pshriwise
pshriwise / make_signal.py
Created October 23, 2020 20:06
Random sampling figure code.
#! /usr/bin/env python
from matplotlib import pyplot as plt
import numpy as np
plt.rcParams.update({'font.size': 22})
def create_peak(mu, dev):
xs = np.linspace(-10, 10, 500)
ys = 1/(dev * np.sqrt(2 * np.pi)) * \
@pshriwise
pshriwise / common.py
Last active October 14, 2020 00:59
Test files for using DAGMC universes via the OpenMC Python API.
from argparse import ArgumentParser
def argument_parser():
"""
Returns an argument parser with common arguments and options for the
DAGMC universe test scripts.
"""
ap = ArgumentParser()
ap.add_argument('-g','--geom', default='dagmc', choices=['dagmc', 'csg'],
help="Geometry type selection")
@pshriwise
pshriwise / stls_to_dagmc.py
Last active August 13, 2021 20:24
PyMOAB Script for compiling a non-overlapping set of STLs into a DAGMC model
#!/usr/bin/env python
# coding: utf-8
import glob
import json
import numpy as np
from pymoab import core, types
# skip graveyard volume for better viz
@pshriwise
pshriwise / chess_board.py
Created July 8, 2020 06:14
Unicode characters in a chess board
# pieces
w_king = "♔"
w_queen = "♕"
w_rook = "♖"
w_bishop = "♗"
w_knight = "♘"
w_pawn = "♙"
b_king = "♚"
@pshriwise
pshriwise / umesh_to_vtk.py
Created March 11, 2020 05:28
OpenMC Statepoint Unstructured Mesh to VTK
import openmc
import h5py
import numpy as np
import vtk
from vtk.util import numpy_support as npsup
import sys
statepoint = "statepoint.50.h5"
f = h5py.File(statepoint, 'r')
@pshriwise
pshriwise / make_box.py
Last active February 1, 2020 00:58
make_box - a PyMOAB scrpit for creating an axis-aligned box.
from argparse import ArgumentParser
from pymoab import core, types
from pymoab.rng import Range
import numpy as np
def make_box(mbi, x_min, x_max, y_min, y_max, z_min, z_max):
@pshriwise
pshriwise / openmc_triso_driver.c
Last active January 20, 2020 21:56
OpenMC Driver for Unstructured Mesh on Triso Particles.
int main(int argc, char** argv) {
openmc_init(argc, argv, NULL);
// add an unstructured mesh
int32_t mesh_id;
int err = openmc_add_umesh("sphere_tet_mesh.exo",
"libmesh",
&mesh_id);
openmc_check_err(err);
diff --git a/src/nuclide.cpp b/src/nuclide.cpp
index 3b092ddf4..030953de9 100644
--- a/src/nuclide.cpp
+++ b/src/nuclide.cpp
@@ -342,7 +342,7 @@ void Nuclide::create_derived()
int n = grid_[t].energy.size();
for (int i = 0; i < n; ++i) {
double E = grid_[t].energy[i];
- xs_[t](i, XS_NU_FISSION) = nu(E, EmissionMode::total)
+ xs_[t](i, XS_NU_FISSION) = nu(E, EmissionMode::prompt)