From 666e542cba8e6989126c65037dfc2bc5810296d0 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Fri, 22 Mar 2024 15:33:59 -0700 Subject: [PATCH 01/28] adding plt.show --- examples/eigenvalue/slab_kornreich_iqmc/process.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/eigenvalue/slab_kornreich_iqmc/process.py b/examples/eigenvalue/slab_kornreich_iqmc/process.py index 708587eb..46afcba1 100644 --- a/examples/eigenvalue/slab_kornreich_iqmc/process.py +++ b/examples/eigenvalue/slab_kornreich_iqmc/process.py @@ -95,3 +95,4 @@ plt.xlabel(r"$x$") plt.grid() plt.legend() +plt.show() \ No newline at end of file From eb780227a974fefae58f6788e5c1680998f7e131 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Fri, 22 Mar 2024 15:34:28 -0700 Subject: [PATCH 02/28] adding plt.show --- examples/fixed_source/slab_reed_iqmc/process.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/fixed_source/slab_reed_iqmc/process.py b/examples/fixed_source/slab_reed_iqmc/process.py index f393b0c1..69c60ca7 100644 --- a/examples/fixed_source/slab_reed_iqmc/process.py +++ b/examples/fixed_source/slab_reed_iqmc/process.py @@ -132,3 +132,4 @@ def f_phi(x1, x2): plt.xlabel(r"$x$") plt.grid() plt.legend() +plt.show() \ No newline at end of file From 0be511c3bf1d3f6e674b61ae0756e65e4649270f Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Fri, 22 Mar 2024 15:35:12 -0700 Subject: [PATCH 03/28] adding error message for uncondifgured cont eng xsec data lib --- mcdc/input_.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mcdc/input_.py b/mcdc/input_.py index 0ec2022f..70488d4b 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -323,6 +323,8 @@ def material( nuc_card["ID"] = nuc_ID dir_name = os.getenv("MCDC_XSLIB") + if (dir_name == None): + print_error("Continuous energy data directory not configured \n see https://cement-psaapgithubio.readthedocs.io/en/latest/install.html#configuring-continuous-energy-library \n") with h5py.File(dir_name + "/" + nuc_name + ".h5", "r") as f: if max(f["fission"][:]) > 0.0: nuc_card["fissionable"] = True From b594a4df1dd9e767f8a1860df9a604274e0672f1 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Fri, 22 Mar 2024 15:38:50 -0700 Subject: [PATCH 04/28] back in black --- examples/eigenvalue/slab_kornreich_iqmc/process.py | 2 +- examples/fixed_source/slab_reed_iqmc/process.py | 2 +- mcdc/input_.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/eigenvalue/slab_kornreich_iqmc/process.py b/examples/eigenvalue/slab_kornreich_iqmc/process.py index 46afcba1..41d410cd 100644 --- a/examples/eigenvalue/slab_kornreich_iqmc/process.py +++ b/examples/eigenvalue/slab_kornreich_iqmc/process.py @@ -95,4 +95,4 @@ plt.xlabel(r"$x$") plt.grid() plt.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/fixed_source/slab_reed_iqmc/process.py b/examples/fixed_source/slab_reed_iqmc/process.py index 69c60ca7..5bb0d094 100644 --- a/examples/fixed_source/slab_reed_iqmc/process.py +++ b/examples/fixed_source/slab_reed_iqmc/process.py @@ -132,4 +132,4 @@ def f_phi(x1, x2): plt.xlabel(r"$x$") plt.grid() plt.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/mcdc/input_.py b/mcdc/input_.py index 70488d4b..36ed3caa 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -323,8 +323,10 @@ def material( nuc_card["ID"] = nuc_ID dir_name = os.getenv("MCDC_XSLIB") - if (dir_name == None): - print_error("Continuous energy data directory not configured \n see https://cement-psaapgithubio.readthedocs.io/en/latest/install.html#configuring-continuous-energy-library \n") + if dir_name == None: + print_error( + "Continuous energy data directory not configured \n see https://cement-psaapgithubio.readthedocs.io/en/latest/install.html#configuring-continuous-energy-library \n" + ) with h5py.File(dir_name + "/" + nuc_name + ".h5", "r") as f: if max(f["fission"][:]) > 0.0: nuc_card["fissionable"] = True From 80c41bfa1113cbf6a153bb5fd10990951a845540 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Sat, 23 Mar 2024 12:20:06 -0700 Subject: [PATCH 05/28] adding doc strings to all input functions --- mcdc/input_.py | 287 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 283 insertions(+), 4 deletions(-) diff --git a/mcdc/input_.py b/mcdc/input_.py index 36ed3caa..f3f4b103 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -1,6 +1,7 @@ """ This module contains functions for setting MC/DC input deck. The input deck class is defined in `card.py` and instantiated in `global_.py`. +Note docstring are numpy typed """ import h5py, math, mpi4py, os @@ -656,6 +657,21 @@ def _set_J(x, t, card): def cell(surfaces_flags, fill, lattice_center=None): + """_summary_ + + Parameters + ---------- + surfaces_flags : bool + list of surface cards + fill : bool + fill the cells + lattice_center : _type_, optional + _description_, by default None + + Returns + ------- + cell card : dictionary + """ N_surface = len(surfaces_flags) # Make cell card @@ -685,6 +701,20 @@ def cell(surfaces_flags, fill, lattice_center=None): def universe(cells, root=False): + """_summary_ + + Parameters + ---------- + cells : dictionary + cell card dexcriptions + root : bool, optional + by default False + + Returns + ------- + dictionary + universe + """ N_cell = len(cells) # Set default card values (c.f. type_.py) @@ -708,6 +738,25 @@ def universe(cells, root=False): def lattice(x=None, y=None, z=None, universes=None): + """ + Create a lattice card + + Parameters + ---------- + x : array like, optional + x[float], by default None + y : array like, optional + y[float], by default None + z : array like, optional + z[float], by default None + universes : dictionary, optional + d, by default None + + Returns + ------- + dictionary + lattice card + """ # Make lattice card card = make_card_lattice() card["ID"] = len(mcdc.input_deck.lattices) @@ -899,6 +948,35 @@ def tally( g=np.array([-INF, INF]), E=np.array([0.0, INF]), ): + """_summary_ + + Parameters + ---------- + scores : _type_ + _description_ + x : _type_, optional + _description_, by default np.array([-INF, INF]) + y : _type_, optional + _description_, by default np.array([-INF, INF]) + z : _type_, optional + _description_, by default np.array([-INF, INF]) + t : _type_, optional + _description_, by default np.array([-INF, INF]) + mu : _type_, optional + _description_, by default np.array([-1.0, 1.0]) + azi : _type_, optional + _description_, by default np.array([-PI, PI]) + g : _type_, optional + _description_, by default np.array([-INF, INF]) + E : _type_, optional + _description_, by default np.array([0.0, INF]) + + Returns + ------- + _type_ + _description_ + """ + # Get tally card card = mcdc.input_deck.tally @@ -940,6 +1018,44 @@ def tally( def setting(**kw): + """ + Create a setting card. + + Other Parameters + ---------------- + N_particle : int + Number of MC particle histories to run (for k-eigen and iQMC its /iteration) + N_batch : int + Number of batches to run + rng_seed : int + Random number seed + time_boundary : float + the time edge of the problem after which all particles will be killed + progress_bar : bool + display the progress bar (disable when running MC/DC in a loop) + output_name : str + Name of the output file MC/DC should save data in, default is output.h5 + save_input_deck : bool + toggle to save the input deck + particle_tracker : bool + true will track the paths of all individual particle histories, memory issues abound + k_eff : str + toggle true to run a k-eigen problem + source_file : str + specify a source file path and name + IC_file : str + path to a file containing a description of an initial condition as a file + active_bank_buff : int + size of the activate particle bank buffer, for MPI runs + census_bank_buff : int + sets size of the census buffer particle bank + + Returns + ------- + dictionary + A setting card + """ + # Check the suplied keyword arguments for key in kw.keys(): check_support( @@ -1056,6 +1172,28 @@ def setting(**kw): def eigenmode( N_inactive=0, N_active=0, k_init=1.0, gyration_radius=None, save_particle=False ): + """ + Creates an eigenmode card + + Parameters + ---------- + N_inactive : int + Number of inactive cycles to settle k + N_active : int + Number of active cycles to collect statistics and inform the value of k + k_init : float + an initial k value + gyration_radius : float + specify a gyration radius + save_particle : bool + toggle to save particle track outputs in a tally mesh + + Returns + ------- + dictionary + A eigen mode card + """ + # Update setting card card = mcdc.input_deck.setting card["N_inactive"] = N_inactive @@ -1096,17 +1234,35 @@ def eigenmode( def implicit_capture(): + """sets implicit capture""" card = mcdc.input_deck.technique card["implicit_capture"] = True card["weighted_emission"] = False def weighted_emission(flag): + """ + sets weighted emission + + Parameters + ---------- + flag : bool + toggle weighted emission on or off + """ + card = mcdc.input_deck.technique card["weighted_emission"] = flag def population_control(pct="combing"): + """sets population control techniques + + Parameters + ---------- + pct : str, optional + population control method, by default "combing" + """ + card = mcdc.input_deck.technique card["population_control"] = True card["weighted_emission"] = False @@ -1119,12 +1275,28 @@ def population_control(pct="combing"): def branchless_collision(): + """ + sets branchless collision + """ card = mcdc.input_deck.technique card["branchless_collision"] = True card["weighted_emission"] = False def time_census(t): + """ + Sets a time + + Parameters + ---------- + t : array like [float] + set the time census boundaries + + Returns + ------- + Card alterations. + """ + # Remove census beyond the final tally time grid point while True: if t[-1] >= mcdc.input_deck.tally["mesh"]["t"][-1]: @@ -1142,6 +1314,28 @@ def time_census(t): def weight_window(x=None, y=None, z=None, t=None, window=None, width=None): + """adds weight windows for a combing function + + Parameters + ---------- + x : array like[float], optional + location of the weight window in x, by default None + y : array like[float], optional + location of the weight window in y, by default None + z : array like[float], optional + location of the weight window in z, by default None + t : array like[float], optional + location of the weight window in t, by default None + window : array like[float], optional + bound of the statistic weight of the window, by default None + width : array like[float], optional + statistical width the window will apply, by default None + + Returns + ------- + Card alterations. + + """ card = mcdc.input_deck.technique card["weight_window"] = True @@ -1206,6 +1400,68 @@ def iQMC( eigenmode_solver="power_iteration", score=[], ): + """Sets iqmc settings + + Parameters + ---------- + g : _type_, optional + _description_, by default None + t : _type_, optional + _description_, by default None + x : _type_, optional + _description_, by default None + y : _type_, optional + _description_, by default None + z : _type_, optional + _description_, by default None + phi0 : _type_, optional + _description_, by default None + source0 : _type_, optional + _description_, by default None + source_x0 : _type_, optional + _description_, by default None + source_y0 : _type_, optional + _description_, by default None + source_z0 : _type_, optional + _description_, by default None + source_xy0 : _type_, optional + _description_, by default None + source_xz0 : _type_, optional + _description_, by default None + source_yz0 : _type_, optional + _description_, by default None + source_xyz0 : _type_, optional + _description_, by default None + fission_source0 : _type_, optional + _description_, by default None + krylov_restart : _type_, optional + _description_, by default None + fixed_source : _type_, optional + _description_, by default None + scramble : bool, optional + _description_, by default False + maxitt : int, optional + _description_, by default 25 + tol : _type_, optional + _description_, by default 1e-6 + N_dim : int, optional + _description_, by default 6 + seed : int, optional + _description_, by default 12345 + preconditioner_sweeps : int, optional + _description_, by default 5 + generator : str, optional + _description_, by default "halton" + fixed_source_solver : str, optional + _description_, by default "source_iteration" + eigenmode_solver : str, optional + _description_, by default "power_iteration" + score : list, optional + _description_, by default [] + + + """ + card = mcdc.input_deck.technique card["iQMC"] = True card["iqmc"]["tol"] = tol @@ -1308,7 +1564,7 @@ def iQMC( def weight_roulette(w_threshold=0.2, w_survive=1.0): """ - If neutron weight is below `w_threshold`, then enter weight rouelette + If neutron weight is below `w_threshold`, then enter weight roulette technique with survival weight `w_survive`. Parameters @@ -1319,7 +1575,7 @@ def weight_roulette(w_threshold=0.2, w_survive=1.0): Returns ------- - None. + Card alterations. """ card = mcdc.input_deck.technique @@ -1347,9 +1603,9 @@ def IC_generator( N_neutron : int Neutron target size N_precursor : int - Delayed neutron precursot target size + Delayed neutron precursor target size cycle_stretch : float - Factor to strethch number of cycles. Higher cycle stretch reduces inter-cycle + Factor to stretch number of cycles. Higher cycle stretch reduces inter-cycle correlation. neutron_density, max_neutron_density : float Total and maximum neutron density, required if `N_neutron` > 0. @@ -1402,6 +1658,15 @@ def IC_generator( def dsm(order=1): + """ + direct sensitivity analysis + + Parameters + ---------- + order : int, optional + order of the sensitivity to probe, by default 1 + """ + card = mcdc.input_deck.technique if order > 2: print_error("DSM currently only supports up to second-order sensitivities") @@ -1409,6 +1674,20 @@ def dsm(order=1): def uq(**kw): + """ + uncertainty quantification set + + Other Parameters + ---------------- + w_threshold : weight_roulette() is called on a particle if + P['w'] <= wr_threshold + w_survive : survival weight + + Returns + ------- + Card alterations. + """ + def append_card(delta_card, global_tag): delta_card["distribution"] = dist delta_card["flags"] = [] From 31ea5d1428a3db65c5a4af3efaa09d9989df02b3 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Sat, 23 Mar 2024 12:55:41 -0700 Subject: [PATCH 06/28] eiding input docstinrgs and some documentaiton fixes --- docs/source/user.rst | 11 +++--- mcdc/input_.py | 83 ++++++++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/docs/source/user.rst b/docs/source/user.rst index 452c0ac6..555bad2a 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -226,13 +226,14 @@ Using MPI MC/DC can be executed using MPI with or without Numba acceleration. If ``numba-mode`` is enabled the ``jit`` compilation, which is executed on all threads, can take between 30s-2min. For smaller problems, Numba compilation time could exceed runtime, and pure python mode could be preferable. -Below, ``--mode`` can equal python or numba. +Below, ``--mode`` can equal python or numba. MC/DC gets MPI functinoality via `mpi4py `_. +As an example, to run on 36 processes in Numba mode with `SLURM `_: .. code-block:: python3 - srun python input.py --mode= - + srun -n 36 python input.py --mode= +For systems that do not use SLURM (i.e., a local system) try ``mpiexec`` or ``mpirun`` in its stead. Postprocessing Results ---------------------- @@ -291,7 +292,7 @@ A tool like ``matplotlib`` will work great for plotting results. For more complex simulations, open source professional visualization software like `Paraview `_ or `Visit `_ are available. -As the problem we ran above is pretty simple and has no scattering or fission, we have an analytic solution we can import: +As the problem we ran above is pretty simple and has no scattering or fission, we have an `analytic solution we can import `_: .. code-block:: python3 @@ -300,7 +301,7 @@ As the problem we ran above is pretty simple and has no scattering or fission, w In the script below, we plot the space-averaged flux and space-averaged current, including their statistical noise. We also use the space-averaged flux and current to compute a new quantity, the space-averaged angular flux, and plot it over space and angle in a heat map. -Remember that when reporting results from a Monte Carlo solver, you should **always include the statical error!** +Remember that when reporting results from a Monte Carlo solver, you should **always include the statistical error!** .. code-block:: python3 diff --git a/mcdc/input_.py b/mcdc/input_.py index f3f4b103..6a2024c7 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -657,7 +657,8 @@ def _set_J(x, t, card): def cell(surfaces_flags, fill, lattice_center=None): - """_summary_ + """ + Defines a cell as a building block of geometry Parameters ---------- @@ -665,8 +666,8 @@ def cell(surfaces_flags, fill, lattice_center=None): list of surface cards fill : bool fill the cells - lattice_center : _type_, optional - _description_, by default None + lattice_center : array like[float], optional + defines the center of the lattice, by default None Returns ------- @@ -701,12 +702,13 @@ def cell(surfaces_flags, fill, lattice_center=None): def universe(cells, root=False): - """_summary_ + """ + Defines the region where particles will be tracked Parameters ---------- cells : dictionary - cell card dexcriptions + cell card descriptions root : bool, optional by default False @@ -799,7 +801,7 @@ def lattice(x=None, y=None, z=None, universes=None): def source(**kw): """ - Create a source card. + Create a source card Other Parameters ---------------- @@ -948,33 +950,33 @@ def tally( g=np.array([-INF, INF]), E=np.array([0.0, INF]), ): - """_summary_ + """ + Creates a tally card to collect MC solutions Parameters ---------- - scores : _type_ - _description_ - x : _type_, optional - _description_, by default np.array([-INF, INF]) - y : _type_, optional - _description_, by default np.array([-INF, INF]) - z : _type_, optional - _description_, by default np.array([-INF, INF]) - t : _type_, optional - _description_, by default np.array([-INF, INF]) - mu : _type_, optional - _description_, by default np.array([-1.0, 1.0]) - azi : _type_, optional - _description_, by default np.array([-PI, PI]) - g : _type_, optional - _description_, by default np.array([-INF, INF]) - E : _type_, optional + scores : str + set tally type, default to tracklength + x : array like [float], optional + define x-spatial tally bins, by default np.array([-INF, INF]) + y : array like [float], optional + define y-spatial tally bins, by default np.array([-INF, INF]) + z : array like [float], optional + define z-spatial tally bins, by default np.array([-INF, INF]) + t : array like [float], optional + define time tally bins, by default np.array([-INF, INF]) + mu : array like [float], optional + define axial angular tally bins, by default np.array([-1.0, 1.0]) + azi : array like [float], optional + define azimuthal angle tally bins, by default np.array([-PI, PI]) + g : array like [float], optional + tally group, define an energy band to tally in, by default np.array([-INF, INF]) + E : array like [float], optional _description_, by default np.array([0.0, INF]) Returns ------- - _type_ - _description_ + tally card : dictionary """ # Get tally card @@ -1234,7 +1236,9 @@ def eigenmode( def implicit_capture(): - """sets implicit capture""" + """ + Sets implicit capture + """ card = mcdc.input_deck.technique card["implicit_capture"] = True card["weighted_emission"] = False @@ -1242,7 +1246,7 @@ def implicit_capture(): def weighted_emission(flag): """ - sets weighted emission + Sets weighted emission variance reduction Parameters ---------- @@ -1255,7 +1259,8 @@ def weighted_emission(flag): def population_control(pct="combing"): - """sets population control techniques + """ + Sets population control techniques Parameters ---------- @@ -1276,7 +1281,7 @@ def population_control(pct="combing"): def branchless_collision(): """ - sets branchless collision + Sets branchless collision variance reduction technique """ card = mcdc.input_deck.technique card["branchless_collision"] = True @@ -1314,7 +1319,8 @@ def time_census(t): def weight_window(x=None, y=None, z=None, t=None, window=None, width=None): - """adds weight windows for a combing function + """ + Adds weight window variance reduction technique Parameters ---------- @@ -1400,14 +1406,15 @@ def iQMC( eigenmode_solver="power_iteration", score=[], ): - """Sets iqmc settings + """ + Sets iQMC settings Parameters ---------- g : _type_, optional - _description_, by default None + group, by default None t : _type_, optional - _description_, by default None + time, by default None x : _type_, optional _description_, by default None y : _type_, optional @@ -1459,7 +1466,9 @@ def iQMC( score : list, optional _description_, by default [] - + Returns + ------- + iqmc card : dictionary """ card = mcdc.input_deck.technique @@ -1659,7 +1668,7 @@ def IC_generator( def dsm(order=1): """ - direct sensitivity analysis + Direct sensitivity method Parameters ---------- @@ -1675,7 +1684,7 @@ def dsm(order=1): def uq(**kw): """ - uncertainty quantification set + Set uncertainty quantification Other Parameters ---------------- From 4ce16bd1fa702531edec1641c092d0fb83b41c6e Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Sat, 23 Mar 2024 14:22:37 -0700 Subject: [PATCH 07/28] fixing the number of particles in the buff bank --- examples/eigenvalue/smrg7/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/eigenvalue/smrg7/input.py b/examples/eigenvalue/smrg7/input.py index 56a42325..359da073 100644 --- a/examples/eigenvalue/smrg7/input.py +++ b/examples/eigenvalue/smrg7/input.py @@ -382,7 +382,7 @@ def set_mat(mat): mcdc.tally(scores=["flux", "fission"], x=x_grid, y=y_grid, z=z_grid, g="all") # Setting -mcdc.setting(N_particle=1e2) +mcdc.setting(N_particle=1e2, census_bank_buff=100) mcdc.eigenmode(N_inactive=10, N_active=30, gyration_radius="all") mcdc.population_control() From 52e316a78119c34025f63542b4ca593cf0f20a9e Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Sat, 23 Mar 2024 19:50:54 -0700 Subject: [PATCH 08/28] back in black --- mcdc/input_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcdc/input_.py b/mcdc/input_.py index 6a2024c7..4752633e 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -1468,7 +1468,7 @@ def iQMC( Returns ------- - iqmc card : dictionary + iqmc card : dictionary """ card = mcdc.input_deck.technique From 8ef7f2e17a165b94517ff8071f3adc4e7c09e610 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 26 Mar 2024 14:16:31 -0700 Subject: [PATCH 09/28] updating paper --- docs/paper.bib | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/paper.md | 8 +++-- 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/docs/paper.bib b/docs/paper.bib index 25435ba8..4f6d0851 100644 --- a/docs/paper.bib +++ b/docs/paper.bib @@ -116,3 +116,84 @@ @book{lewis_computational_1984 } +#shift +@article{shift, + title = {Continuous-energy {Monte} {Carlo} neutron transport on {GPUs} in the {Shift} code}, + volume = {128}, + issn = {03064549}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S0306454919300167}, + doi = {10.1016/j.anucene.2019.01.012}, + abstract = {A continuous-energy Monte Carlo neutron transport solver executing on GPUs has been developed within the Shift code. Several algorithmic approaches are considered, including both history-based and event-based implementations. Unlike in previous work involving multigroup Monte Carlo transport, it is demonstrated that event-based algorithms significantly outperform a historybased approach for continuous-energy transport as a result of increased device occupancy and reduced thread divergence. Numerical results are presented for detailed full-core models of a small modular reactor (SMR), including a model containing depleted fuel materials. These results demonstrate the substantial gains in performance that are possible with the latest-generation of GPUs. On the depleted SMR core configuration, an NVIDIA P100 GPU with 56 streaming multiprocessors provides performance equivalent to 90 CPU cores, and the latest V100 GPU with 80 multiprocessors offers the performance of more than 150 CPU cores.}, + language = {en}, + urldate = {2023-11-03}, + journal = {Annals of Nuclear Energy}, + author = {Hamilton, Steven P. and Evans, Thomas M.}, + month = jun, + year = {2019}, + pages = {236--247}, + file = {1-s2.0-S0306454919300167-am.pdf:/Users/jonesy/Documents/PapersLibrary/1-s2.0-S0306454919300167-am.pdf:application/pdf}, +} + + +#mcatk +@article{mcatk, + title = {Monte {Carlo} {Application} {ToolKit} ({MCATK})}, + volume = {82}, + issn = {0306-4549}, + url = {https://www.sciencedirect.com/science/article/pii/S0306454914004472}, + doi = {https://doi.org/10.1016/j.anucene.2014.08.047}, + abstract = {The Monte Carlo Application ToolKit (MCATK) is a component-based software library designed to build specialized applications and to provide new functionality for existing general purpose Monte Carlo radiation transport codes. We will describe MCATK and its capabilities along with presenting some verification and validations results.}, + journal = {Annals of Nuclear Energy}, + author = {Adams, Terry and Nolen, Steve and Sweezy, Jeremy and Zukaitis, Anthony and Campbell, Joann and Goorley, Tim and Greene, Simon and Aulwes, Rob}, + year = {2015}, + keywords = {Agile development, Component software, Monte Carlo particle transport, Parallel computing, Population control, Time-dependent}, + pages = {41--47}, + annote = {Joint International Conference on Supercomputing in Nuclear Applications and Monte Carlo 2013, SNA + MC 2013. Pluri- and Trans-disciplinarity, Towards New Modeling and Numerical Simulation Paradigms}, +} + + +# mcnp +@techreport{mcnp, + address = {Los Alamos, NM, USA}, + author = {Rising, Michael Evan and Armstrong, Jerawan Chudoung and Bolding, Simon R. and Brown, Forrest Brooks and Bull, Jeffrey S. and Burke, Timothy Patrick and Clark, Alexander Rich and Dixon, David A. and Forster, III, Robert Arthur and Giron, Jesse Frank and Grieve, Tristan Sumner and Hughes, III, Henry Grady and Josey, Colin James and Kulesza, Joel Aaron and Martz, Roger Lee and McCartney, Austin P. and McKinney, Gregg Walter and Mosher, Scott William and Pearson, Eric John and Solomon, Jr., Clell Jeffrey and Swaminarayan, Sriram and Sweezy, Jeremy Ed and Wilson, Stephen Christian and Zukaitis, Anthony J.}, + doi = {10.2172/1909545}, + institution = {Los Alamos National Laboratory}, + month = {January}, + number = {LA-UR-22-33103, Rev.~1}, + title = {{MCNP\textsuperscript{\textregistered} Code Version 6.3.0 Release Notes}}, + url = {https://www.osti.gov/biblio/1909545}, + year = {2023} +} + +# openmc +@article{openmc, + author = {Romano, Paul K. and Forget, Benoit}, + address = {United States}, + copyright = {2012 Elsevier Ltd}, + issn = {0306-4549}, + journal = {Annals of nuclear energy}, + keywords = {Code (cryptography) ; Computational science ; Computer science ; Criticality ; High performance computing ; Monte Carlo ; Monte carlo code ; Monte Carlo method ; Neutron transport ; Nuclear Science \& Technology ; Open source ; Particle transport ; Software design ; Supercomputer ; Theoretical computer science}, + language = {eng}, + number = {C}, + organization = {UT-Battelle LLC/ORNL, Oak Ridge, TN (Unted States)}, + pages = {274-281}, + publisher = {Elsevier Ltd}, + title = {The OpenMC Monte Carlo particle transport code}, + volume = {51}, + year = {2013}, +} + + +# geant4 +@article{geant4, + title = {Geant4—a simulation toolkit}, + journal = {Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment}, + volume = {506}, + number = {3}, + pages = {250-303}, + year = {2003}, + issn = {0168-9002}, + doi = {10.1016/S0168-9002(03)01368-8}, + url = {https://www.sciencedirect.com/science/article/pii/S0168900203013688}, + author = {S. Agostinelli and J. Allison and K. Amako and J. Apostolakis and H. Araujo and P. Arce and M. Asai and D. Axen and S. Banerjee and G. Barrand and F. Behner and L. Bellagamba and J. Boudreau and L. Broglia and A. Brunengo and H. Burkhardt and S. Chauvie and J. Chuma and R. Chytracek and G. Cooperman and G. Cosmo and P. Degtyarenko and A. Dell'Acqua and G. Depaola and D. Dietrich and R. Enami and A. Feliciello and C. Ferguson and H. Fesefeldt and G. Folger and F. Foppiano and A. Forti and S. Garelli and S. Giani and R. Giannitrapani and D. Gibin and J.J. {Gómez Cadenas} and I. González and G. {Gracia Abril} and G. Greeniaus and W. Greiner and V. Grichine and A. Grossheim and S. Guatelli and P. Gumplinger and R. Hamatsu and K. Hashimoto and H. Hasui and A. Heikkinen and A. Howard and V. Ivanchenko and A. Johnson and F.W. Jones and J. Kallenbach and N. Kanaya and M. Kawabata and Y. Kawabata and M. Kawaguti and S. Kelner and P. Kent and A. Kimura and T. Kodama and R. Kokoulin and M. Kossov and H. Kurashige and E. Lamanna and T. Lampén and V. Lara and V. Lefebure and F. Lei and M. Liendl and W. Lockman and F. Longo and S. Magni and M. Maire and E. Medernach and K. Minamimoto and P. {Mora de Freitas} and Y. Morita and K. Murakami and M. Nagamatu and R. Nartallo and P. Nieminen and T. Nishimura and K. Ohtsubo and M. Okamura and S. O'Neale and Y. Oohata and K. Paech and J. Perl and A. Pfeiffer and M.G. Pia and F. Ranjard and A. Rybin and S. Sadilov and E. {Di Salvo} and G. Santin and T. Sasaki and N. Savvas and Y. Sawada and S. Scherer and S. Sei and V. Sirotenko and D. Smith and N. Starkov and H. Stoecker and J. Sulkimo and M. Takahata and S. Tanaka and E. Tcherniaev and E. {Safai Tehrani} and M. Tropeano and P. Truscott and H. Uno and L. Urban and P. Urban and M. Verderi and A. Walkden and W. Wander and H. Weber and J.P. Wellisch and T. Wenaus and D.C. Williams and D. Wright and T. Yamada and H. Yoshida and D. Zschiesche}, +} \ No newline at end of file diff --git a/docs/paper.md b/docs/paper.md index ee941fd2..33d7e72e 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -109,16 +109,18 @@ It uses the Numba compiler for Python to compile compute kernels to a desired ha These acceleration and abstraction techniques allow `MC/DC` developers to remain in a pure Python development environment without needing to support compiled or domain-specific languages. This has allowed `MC/DC` to grow from its initialization less than two years ago into a codebase that supports full performant neutron transport and investigation of novel transport algorithms, with development mostly from relative novices. -Many of the traditionally developed neutron-transport codes are export-controlled (i.e., are not open source and difficult to access) and notoriously difficult to install, use, and develop in. -Because `MC/DC` is an open-source and easily installable Python package (with a `pip`-installable distribution), it is ideal for use in an academic environment for both research and education. +Many traditionally developed neutron-transport codes (e.g. `MCNP` [@mcnp], `Shift` [@shift], and `MCATK` [@mcatk]) are export-controlled and notoriously difficult to install, use, and develop in. +`MC/DC` is comparable to other open source Monte Carlo neutron-transport apps (e.g. `OpenMC` [@openmc]), however `MC/DC` is an easily installable Python package (with a `pip` distribution) with it's own novel transport methods and features tailored to tackle dynamic transport. +This all together makes `MC/DC` ideal for use in an academic environment for both research and education. This is further assisted by the test suite we have developed for unit, regression, verification, and performance tests, which are mostly run using continuous integration via GitHub Actions. +In a code-to-code performance comparison `MC/DC` was found to run about 2.5 times slower then the Shift Monte Carlo code, and showed similar scaling on some systems [@variansyah_mc23_mcdc]. `MC/DC` has support for continuous energy and multi-group treatments of the neutron distribution in energy. It can solve k-eigenvalue problems (used to determine neutron population growth rates in reactors) as well as fully dynamic simulations. It has a novel continuous geometry movement function that models transient elements (e.g., control rods or pulsed neutron experiments) more accurately than the step functions used by other codes. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. -`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:variansyah_physor22_pct], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmc; @mcdc:qmcabs], transient population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation, uncertainty and global sensitivity analysis [@mcdc:clements_mc23], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. +`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:variansyah_physor22_pct], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmc; @mcdc:qmcabs], transient population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation, uncertainty and global sensitivity analysis [@mcdc:clements_mc23; mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. # Future Work From 50503b431371d9b5bb4195bb5dd5911f1f9e4855 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 26 Mar 2024 14:50:44 -0700 Subject: [PATCH 10/28] adding citation to paper and notes to examples --- docs/paper.bib | 26 ++++++++++++++++++++++++++ docs/paper.md | 2 +- examples/c5g7/3d/TDX/input.py | 4 ++++ examples/c5g7/3d/k-eigenvalue/input.py | 1 + examples/eigenvalue/2d_c5g7/input.py | 1 + 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/paper.bib b/docs/paper.bib index 4f6d0851..c596e014 100644 --- a/docs/paper.bib +++ b/docs/paper.bib @@ -82,6 +82,21 @@ @article{mcdc:variansyah_nse22_pct doi = {10.1080/00295639.2022.2091906} } +@article{mcdc:clements_variance_2024, + title = {A variance deconvolution estimator for efficient uncertainty quantification in {Monte} {Carlo} radiation transport applications}, + volume = {319}, + issn = {0022-4073}, + url = {https://www.sciencedirect.com/science/article/pii/S0022407324000657}, + doi = {https://doi.org/10.1016/j.jqsrt.2024.108958}, + abstract = {Monte Carlo simulations are at the heart of many high-fidelity simulations and analyses for radiation transport systems. As is the case with any complex computational model, it is important to propagate sources of input uncertainty and characterize how they affect model output. Unfortunately, uncertainty quantification (UQ) is made difficult by the stochastic variability that Monte Carlo transport solvers introduce. The standard method to avoid corrupting the UQ statistics with the transport solver noise is to increase the number of particle histories, resulting in very high computational costs. In this contribution, we propose and analyze a sampling estimator based on the law of total variance to compute UQ variance even in the presence of residual noise from Monte Carlo transport calculations. We rigorously derive the statistical properties of the new variance estimator, compare its performance to that of the standard method, and demonstrate its use on neutral particle transport model problems involving both attenuation and scattering physics. We illustrate, both analytically and numerically, the estimator’s statistical performance as a function of available computational budget and the distribution of that budget between UQ samples and particle histories. We show analytically and corroborate numerically that the new estimator is unbiased, unlike the standard approach, and is more accurate and precise than the standard estimator for the same computational budget.}, + journal = {Journal of Quantitative Spectroscopy and Radiative Transfer}, + author = {Clements, Kayla B. and Geraci, Gianluca and Olson, Aaron J. and Palmer, Todd S.}, + year = {2024}, + keywords = {Monte Carlo radiation transport, Stochastic solvers, Uncertainty quantification}, + pages = {108958}, +} +} + @inproceedings{variansyah_mc23_mcdc, Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, title = {Development of {MC/DC}: a performant, scalable, and portable {P}ython-based {M}onte {C}arlo neutron transport code}, @@ -196,4 +211,15 @@ @article{geant4 doi = {10.1016/S0168-9002(03)01368-8}, url = {https://www.sciencedirect.com/science/article/pii/S0168900203013688}, author = {S. Agostinelli and J. Allison and K. Amako and J. Apostolakis and H. Araujo and P. Arce and M. Asai and D. Axen and S. Banerjee and G. Barrand and F. Behner and L. Bellagamba and J. Boudreau and L. Broglia and A. Brunengo and H. Burkhardt and S. Chauvie and J. Chuma and R. Chytracek and G. Cooperman and G. Cosmo and P. Degtyarenko and A. Dell'Acqua and G. Depaola and D. Dietrich and R. Enami and A. Feliciello and C. Ferguson and H. Fesefeldt and G. Folger and F. Foppiano and A. Forti and S. Garelli and S. Giani and R. Giannitrapani and D. Gibin and J.J. {Gómez Cadenas} and I. González and G. {Gracia Abril} and G. Greeniaus and W. Greiner and V. Grichine and A. Grossheim and S. Guatelli and P. Gumplinger and R. Hamatsu and K. Hashimoto and H. Hasui and A. Heikkinen and A. Howard and V. Ivanchenko and A. Johnson and F.W. Jones and J. Kallenbach and N. Kanaya and M. Kawabata and Y. Kawabata and M. Kawaguti and S. Kelner and P. Kent and A. Kimura and T. Kodama and R. Kokoulin and M. Kossov and H. Kurashige and E. Lamanna and T. Lampén and V. Lara and V. Lefebure and F. Lei and M. Liendl and W. Lockman and F. Longo and S. Magni and M. Maire and E. Medernach and K. Minamimoto and P. {Mora de Freitas} and Y. Morita and K. Murakami and M. Nagamatu and R. Nartallo and P. Nieminen and T. Nishimura and K. Ohtsubo and M. Okamura and S. O'Neale and Y. Oohata and K. Paech and J. Perl and A. Pfeiffer and M.G. Pia and F. Ranjard and A. Rybin and S. Sadilov and E. {Di Salvo} and G. Santin and T. Sasaki and N. Savvas and Y. Sawada and S. Scherer and S. Sei and V. Sirotenko and D. Smith and N. Starkov and H. Stoecker and J. Sulkimo and M. Takahata and S. Tanaka and E. Tcherniaev and E. {Safai Tehrani} and M. Tropeano and P. Truscott and H. Uno and L. Urban and P. Urban and M. Verderi and A. Walkden and W. Wander and H. Weber and J.P. Wellisch and T. Wenaus and D.C. Williams and D. Wright and T. Yamada and H. Yoshida and D. Zschiesche}, +} + +@confrence{mcdc:cuneo2024alternative, + title={An Alternative to Stride-Based RNG for Monte Carlo Transport}, + author={Braxton S. Cuneo and Ilham Variansyah}, + year={2024}, + doi = {10.48550/arXiv.2403.06362}, + journal = {Submitted to Transactions of the American Nuclear, Annual meeting 2024}, + eprint={2403.06362}, + archivePrefix={arXiv}, + primaryClass={physics.comp-ph} } \ No newline at end of file diff --git a/docs/paper.md b/docs/paper.md index 33d7e72e..3d6ce273 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -120,7 +120,7 @@ It can solve k-eigenvalue problems (used to determine neutron population growth It has a novel continuous geometry movement function that models transient elements (e.g., control rods or pulsed neutron experiments) more accurately than the step functions used by other codes. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. -`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:variansyah_physor22_pct], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmc; @mcdc:qmcabs], transient population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation, uncertainty and global sensitivity analysis [@mcdc:clements_mc23; mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. +`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:variansyah_physor22_pct], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmc; @mcdc:qmcabs], transient population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. # Future Work diff --git a/examples/c5g7/3d/TDX/input.py b/examples/c5g7/3d/TDX/input.py index 593f9126..93ab9f50 100644 --- a/examples/c5g7/3d/TDX/input.py +++ b/examples/c5g7/3d/TDX/input.py @@ -299,6 +299,10 @@ def set_mat(mat): # Setting mcdc.setting(N_particle=1e2, active_bank_buff=1000) +# small particle count, a more realistic number is 1e7 or higher which +# will require some acceleration to run at those high particle counts +# This is a very hard problem to solve and may also require multiple +# nodes depending on your systems # Run mcdc.run() diff --git a/examples/c5g7/3d/k-eigenvalue/input.py b/examples/c5g7/3d/k-eigenvalue/input.py index dca80622..d9c2cc64 100644 --- a/examples/c5g7/3d/k-eigenvalue/input.py +++ b/examples/c5g7/3d/k-eigenvalue/input.py @@ -297,6 +297,7 @@ def set_mat(mat): # Setting mcdc.setting(N_particle=1e3) + mcdc.eigenmode(N_inactive=50, N_active=150, gyration_radius="all") mcdc.population_control() diff --git a/examples/eigenvalue/2d_c5g7/input.py b/examples/eigenvalue/2d_c5g7/input.py index 078abab9..0abedd26 100644 --- a/examples/eigenvalue/2d_c5g7/input.py +++ b/examples/eigenvalue/2d_c5g7/input.py @@ -181,6 +181,7 @@ def set_mat(mat): # Setting mcdc.setting(N_particle=1e3) + mcdc.eigenmode(N_inactive=10, N_active=30, gyration_radius="infinite-z") mcdc.population_control() From 4d8688f5fa2f9312931d1118d7ae19c9b8dfb7f5 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 26 Mar 2024 15:18:41 -0700 Subject: [PATCH 11/28] fixing 2D plotting issues --- examples/eigenvalue/2d_c5g7/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/eigenvalue/2d_c5g7/input.py b/examples/eigenvalue/2d_c5g7/input.py index 0abedd26..b82a8683 100644 --- a/examples/eigenvalue/2d_c5g7/input.py +++ b/examples/eigenvalue/2d_c5g7/input.py @@ -177,7 +177,7 @@ def set_mat(mat): # Tally x_grid = np.linspace(0.0, pitch * 17 * 3, 17 * 3 + 1) y_grid = np.linspace(-pitch * 17 * 3, 0.0, 17 * 3 + 1) -mcdc.tally(scores=["flux"], x=x_grid, y=y_grid) +mcdc.tally(scores=["flux"], x=x_grid, y=y_grid, g='all') # Setting mcdc.setting(N_particle=1e3) From fd555266cee66048d3b735c9d9e5cd43ea6e39d5 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 26 Mar 2024 15:20:03 -0700 Subject: [PATCH 12/28] back in black --- examples/eigenvalue/2d_c5g7/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/eigenvalue/2d_c5g7/input.py b/examples/eigenvalue/2d_c5g7/input.py index b82a8683..19e5edd7 100644 --- a/examples/eigenvalue/2d_c5g7/input.py +++ b/examples/eigenvalue/2d_c5g7/input.py @@ -177,7 +177,7 @@ def set_mat(mat): # Tally x_grid = np.linspace(0.0, pitch * 17 * 3, 17 * 3 + 1) y_grid = np.linspace(-pitch * 17 * 3, 0.0, 17 * 3 + 1) -mcdc.tally(scores=["flux"], x=x_grid, y=y_grid, g='all') +mcdc.tally(scores=["flux"], x=x_grid, y=y_grid, g="all") # Setting mcdc.setting(N_particle=1e3) From c621ffa509fce634ab3e6f495fb6e6df2abae06c Mon Sep 17 00:00:00 2001 From: Ilham Variansyah Date: Wed, 27 Mar 2024 09:45:03 -0700 Subject: [PATCH 13/28] Update paper.md Fix citations --- docs/paper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/paper.md b/docs/paper.md index 3d6ce273..70498629 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -120,7 +120,7 @@ It can solve k-eigenvalue problems (used to determine neutron population growth It has a novel continuous geometry movement function that models transient elements (e.g., control rods or pulsed neutron experiments) more accurately than the step functions used by other codes. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. -`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:variansyah_physor22_pct], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmc; @mcdc:qmcabs], transient population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. +`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. # Future Work From 39f48fd6c1c2ccba22fd8743134af8a69b850972 Mon Sep 17 00:00:00 2001 From: Ilham Variansyah Date: Wed, 27 Mar 2024 10:20:38 -0700 Subject: [PATCH 14/28] Update paper.bib --- docs/paper.bib | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/paper.bib b/docs/paper.bib index c596e014..038708da 100644 --- a/docs/paper.bib +++ b/docs/paper.bib @@ -65,12 +65,29 @@ @inproceedings{mcdc:qmcabs @inproceedings{mcdc:variansyah_physor22_pct, Booktitle = {International Conference on Physics of Reactors}, - title = {An effective initial particle sampling technique for {M}onte {C}arlo reactor transient simulations}, + title = {Performance of Population Control Techniques in Monte Carlo Reactor Criticality Simulation}, year = {2022}, author = {Ilham Variansyah and Ryan G. McClarren}, address = {Pittsburgh, Pennsylvania, USA}, } +@inproceedings{variansyah_mc23_ic, + Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, + title = {An effective initial particle sampling technique for Monte Carlo reactor transient simulations}, + year = {2023}, + author = {Ilham Variansyah and Ryan G. McClarren}, + address = {Niagara Falls, Ontario, Canada}, + doi = {10.48550/arXiv.2305.07646} +} + +@inproceedings{variansyah_mc23_moving_object, + Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, + title = {High-fidelity treatment for object movement in time-dependent Monte Carlo transport simulations}, + year = {2023}, + author = {Ilham Variansyah and Ryan G. McClarren}, + address = {Niagara Falls, Ontario, Canada}, + doi = {10.48550/arXiv.2305.07641} +} @article{mcdc:variansyah_nse22_pct, author = {Ilham Variansyah and Ryan G McClarren}, @@ -95,13 +112,12 @@ @article{mcdc:clements_variance_2024 keywords = {Monte Carlo radiation transport, Stochastic solvers, Uncertainty quantification}, pages = {108958}, } -} @inproceedings{variansyah_mc23_mcdc, Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, title = {Development of {MC/DC}: a performant, scalable, and portable {P}ython-based {M}onte {C}arlo neutron transport code}, year = {2023}, - author = {Ilham Variansyah and Joanna Piper Morgan and Kyle E. Niemeyer and Ryan G. McClarren}, + author = {Ilham Variansyah and Joanna Piper Morgan and Jordan Northrop and Kyle E. Niemeyer and Ryan G. McClarren}, address = {Niagara Falls, Ontario, Canada}, doi = {10.48550/arXiv.2305.07636} } @@ -222,4 +238,4 @@ @confrence{mcdc:cuneo2024alternative eprint={2403.06362}, archivePrefix={arXiv}, primaryClass={physics.comp-ph} -} \ No newline at end of file +} From 830dede3ca98e201eaea66fa4dc2b70a1934452f Mon Sep 17 00:00:00 2001 From: Ilham Variansyah Date: Wed, 27 Mar 2024 10:31:22 -0700 Subject: [PATCH 15/28] Update citations --- docs/paper.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/paper.md b/docs/paper.md index 70498629..4df5ad79 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -113,14 +113,13 @@ Many traditionally developed neutron-transport codes (e.g. `MCNP` [@mcnp], `Shif `MC/DC` is comparable to other open source Monte Carlo neutron-transport apps (e.g. `OpenMC` [@openmc]), however `MC/DC` is an easily installable Python package (with a `pip` distribution) with it's own novel transport methods and features tailored to tackle dynamic transport. This all together makes `MC/DC` ideal for use in an academic environment for both research and education. This is further assisted by the test suite we have developed for unit, regression, verification, and performance tests, which are mostly run using continuous integration via GitHub Actions. -In a code-to-code performance comparison `MC/DC` was found to run about 2.5 times slower then the Shift Monte Carlo code, and showed similar scaling on some systems [@variansyah_mc23_mcdc]. +In an initial code-to-code performance comparison, `MC/DC` was found to run about 2.5 times slower than the Shift Monte Carlo code for a simple problem and showed similar scaling on some systems [@mcdc:variansyah_mc23_mcdc]. `MC/DC` has support for continuous energy and multi-group treatments of the neutron distribution in energy. It can solve k-eigenvalue problems (used to determine neutron population growth rates in reactors) as well as fully dynamic simulations. -It has a novel continuous geometry movement function that models transient elements (e.g., control rods or pulsed neutron experiments) more accurately than the step functions used by other codes. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. -`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. +`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct; @mcdc:variansyah_physor22_pct], continuous geometry movement techniques that model transient elements [@mcdc:variansyah_mc23_moving_object] (e.g., control rods or pulsed neutron experiments) more accurately than step functions typically used by other codes, initial condition sampling technique for typical reactor transients [@mcdc:variansyah_mc23_ic], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. # Future Work @@ -129,7 +128,7 @@ We currently have operability on Nvidia GPUs (supported via Numba), and work is On GPUs, `MC/DC` will use the `harmonize` asynchronous GPU scheduler to increase performance [@brax2023]. `harmonize` works by batching jobs during execution such that similar operations get executed simultaneously, reducing the divergence between parallel threads running on the GPU. -We will continue to explore novel methods for dynamic neutron transport and will keep pushing to make `MC/DC` not only a proven platform for rapidly exploring neutron-transport methods, but also a fully fledged simulation code for academic and industrial use. +We will continue to explore novel methods for dynamic neutron transport and will keep pushing to make `MC/DC` not only a proven platform for rapidly exploring neutron-transport methods, but also a fully-fledged simulation code for academic and industrial use. # Acknowledgements From d84074925a6d7714ee7ce5991e2b29b5a4fde5a3 Mon Sep 17 00:00:00 2001 From: Ilham Variansyah Date: Wed, 27 Mar 2024 11:04:55 -0700 Subject: [PATCH 16/28] Update paper.md --- docs/paper.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/paper.md b/docs/paper.md index 4df5ad79..68fb790d 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -109,15 +109,16 @@ It uses the Numba compiler for Python to compile compute kernels to a desired ha These acceleration and abstraction techniques allow `MC/DC` developers to remain in a pure Python development environment without needing to support compiled or domain-specific languages. This has allowed `MC/DC` to grow from its initialization less than two years ago into a codebase that supports full performant neutron transport and investigation of novel transport algorithms, with development mostly from relative novices. -Many traditionally developed neutron-transport codes (e.g. `MCNP` [@mcnp], `Shift` [@shift], and `MCATK` [@mcatk]) are export-controlled and notoriously difficult to install, use, and develop in. -`MC/DC` is comparable to other open source Monte Carlo neutron-transport apps (e.g. `OpenMC` [@openmc]), however `MC/DC` is an easily installable Python package (with a `pip` distribution) with it's own novel transport methods and features tailored to tackle dynamic transport. +Many traditionally developed neutron-transport codes are export-controlled (e.g. `MCNP` [@mcnp], `Shift` [@shift], and `MCATK` [@mcatk]) and some are known to be difficult to install, use, and develop in. +`MC/DC` is open-source, and thus, similar to other open-source Monte Carlo neutron-transport codes (e.g., `OpenMC` [@openmc]), it promotes knowledge sharing, collaboration, and inclusive, community-driven development. +What makes `MC/DC` unique is that its code base is exclusively written in Python, making it a good method exploration tool and an excellent entry point for students. +Furthermore, `MC/DC` is wrapped as a Python package that can be conveniently installed via the `pip` distribution, and its development is assisted by a suite of unit, regression, verification, and performance tests, which are mostly run using continuous integration via GitHub Actions. This all together makes `MC/DC` ideal for use in an academic environment for both research and education. -This is further assisted by the test suite we have developed for unit, regression, verification, and performance tests, which are mostly run using continuous integration via GitHub Actions. -In an initial code-to-code performance comparison, `MC/DC` was found to run about 2.5 times slower than the Shift Monte Carlo code for a simple problem and showed similar scaling on some systems [@mcdc:variansyah_mc23_mcdc]. -`MC/DC` has support for continuous energy and multi-group treatments of the neutron distribution in energy. +`MC/DC` has support for continuous and multi-group energy neutron transport physics with constructive solid geometry modeling. It can solve k-eigenvalue problems (used to determine neutron population growth rates in reactors) as well as fully dynamic simulations. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. +In an initial code-to-code performance comparison, `MC/DC` was found to run about 2.5 times slower than the Shift Monte Carlo code for a simple problem and showed similar scaling on some systems [@mcdc:variansyah_mc23_mcdc]. `MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct; @mcdc:variansyah_physor22_pct], continuous geometry movement techniques that model transient elements [@mcdc:variansyah_mc23_moving_object] (e.g., control rods or pulsed neutron experiments) more accurately than step functions typically used by other codes, initial condition sampling technique for typical reactor transients [@mcdc:variansyah_mc23_ic], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. From 2abcfdb779300b2c85b7567963c4425cb25b4e10 Mon Sep 17 00:00:00 2001 From: Kayla Clements Date: Wed, 27 Mar 2024 13:15:59 -0700 Subject: [PATCH 17/28] Edit input_.py for consistency --- mcdc/input_.py | 375 ++++++++++++++++++++++++++----------------------- 1 file changed, 198 insertions(+), 177 deletions(-) diff --git a/mcdc/input_.py b/mcdc/input_.py index 4752633e..ec409d61 100644 --- a/mcdc/input_.py +++ b/mcdc/input_.py @@ -1,7 +1,7 @@ """ This module contains functions for setting MC/DC input deck. The input deck class is defined in `card.py` and instantiated in `global_.py`. -Note docstring are numpy typed +Docstrings use NumPy formatting. """ import h5py, math, mpi4py, os @@ -62,7 +62,7 @@ def nuclide( Parameters ---------- capture : numpy.ndarray (1D), optional - Capture microscopic cross-section [barn] + Capture microscopic cross-section [barn]. scatter : numpy.ndarray (2D), optional Differential scattering microscopic cross-section [gout, gin] [barn]. fission : numpy.ndarray (1D), optional @@ -74,23 +74,23 @@ def nuclide( nu_d : numpy.ndarray (2D), optional Delayed neutron precursor yield [dg, gin]. chi_p : numpy.ndarray (2D), optional - Prompt fission spectrum [gout, gin] + Prompt fission spectrum [gout, gin]. chi_d : numpy.ndarray (2D), optional - Delayed neutron spectrum [gout, dg] + Delayed neutron spectrum [gout, dg]. speed : numpy.ndarray (1D), optional - Energy group speed [cm/s] + Energy group speed [cm/s]. decay : numpy.ndarray (1D), optional - Precursor group decay constant [/s] + Precursor group decay constant [/s]. sensitivity : bool, optional - Set to `True` to calculate sensitivities to the nuclide + Set to `True` to calculate sensitivities to the nuclide. dsm_Np : float Average number of derivative particles produced at each - sensitivity nuclide collision + sensitivity nuclide collision. Returns ------- dictionary - A nuclide card + A nuclide card. Notes ----- @@ -245,9 +245,9 @@ def material( Parameters ---------- nuclides : list of tuple of (dictionary, float), optional - List of pairs of nuclide card and its density [/barn-cm] + List of pairs of nuclide card and its density [/barn-cm]. capture : numpy.ndarray (1D), optional - Capture macroscopic cross-section [/cm] + Capture macroscopic cross-section [/cm]. scatter : numpy.ndarray (2D), optional Differential scattering macroscopic cross-section [gout, gin] [/cm]. fission : numpy.ndarray (1D), optional @@ -259,24 +259,24 @@ def material( nu_d : numpy.ndarray (2D), optional Delayed neutron precursor yield [dg, gin]. chi_p : numpy.ndarray (2D), optional - Prompt fission spectrum [gout, gin] + Prompt fission spectrum [gout, gin]. chi_d : numpy.ndarray (2D), optional - Delayed neutron spectrum [gout, dg] + Delayed neutron spectrum [gout, dg]. speed : numpy.ndarray (1D), optional - Energy group speed [cm/s] + Energy group speed [cm/s]. decay : numpy.ndarray (1D), optional - Precursor group decay constant [/s] + Precursor group decay constant [/s]. sensitivity : bool, optional Set to `True` to calculate sensitivities to the material - (only relevant for single-nuclide material) + (only relevant for single-nuclide material). dsm_Np : float Average number of derivative particles produced at each - sensitivity material collision (only relevant for single_nuclide material) + sensitivity material collision (only relevant for single_nuclide material). Returns ------- dictionary - A material card + A material card. See also -------- @@ -432,10 +432,10 @@ def surface(type_, bc="interface", sensitivity=False, dsm_Np=1.0, **kw): bc : {'interface', 'vacuum', 'reflective'} Surface boundary condition. sensitivity : bool, optional - Set to `True` to calculate sensitivities to the nuclide + Set to `True` to calculate sensitivities to the nuclide. dsm_Np : int Average number of derivative particles produced at each - sensitivity surface crossing + sensitivity surface crossing. Other Parameters ---------------- @@ -465,7 +465,7 @@ def surface(type_, bc="interface", sensitivity=False, dsm_Np=1.0, **kw): See also -------- - mcdc.cell : SurfaceHandle is used to define cell domain + mcdc.cell : SurfaceHandle is used to define cell domain. """ # Make surface card card = make_card_surface() @@ -658,20 +658,26 @@ def _set_J(x, t, card): def cell(surfaces_flags, fill, lattice_center=None): """ - Defines a cell as a building block of geometry + Define a cell as a building block of geometry. Parameters ---------- - surfaces_flags : bool - list of surface cards - fill : bool - fill the cells - lattice_center : array like[float], optional - defines the center of the lattice, by default None + surfaces_flags : list of SurfaceHandle + List of surfaces that contain the cell. + fill : dictionary + Material that fills the cell. + lattice_center : array_like[float], optional + Defines the center of the lattice (default None, implies no lattice). Returns ------- - cell card : dictionary + dictionary + A cell card. + + See also + -------- + mcdc.surface : Creates SurfaceHandle used to define cell domain. + mcdc.material : Defines material used to fill cell. """ N_surface = len(surfaces_flags) @@ -703,19 +709,23 @@ def cell(surfaces_flags, fill, lattice_center=None): def universe(cells, root=False): """ - Defines the region where particles will be tracked + Define the region where particles will be tracked. Parameters ---------- - cells : dictionary - cell card descriptions + cells : list of dictionary + List of cells that comprise the universe. root : bool, optional - by default False + Defines whether the universe is the root universe (default False). Returns ------- dictionary - universe + A universe card. + + See also + -------- + mcdc.cell : Creates cells used to define universe. """ N_cell = len(cells) @@ -741,23 +751,23 @@ def universe(cells, root=False): def lattice(x=None, y=None, z=None, universes=None): """ - Create a lattice card + Create a lattice card. Parameters ---------- - x : array like, optional - x[float], by default None - y : array like, optional - y[float], by default None - z : array like, optional - z[float], by default None - universes : dictionary, optional - d, by default None + x : array_like[float], optional + x-coordinates that define the lattice mesh (default None). + y : array_like[float], optional + y-coordinates that define the lattice mesh (default None). + z : array_like[float], optional + z-coordinates that define the lattice mesh (default None). + universes : list of (list of dictionary), optional + List of lists of universe cards that fill the lattice (default None). Returns ------- dictionary - lattice card + Lattice card. """ # Make lattice card card = make_card_lattice() @@ -801,7 +811,7 @@ def lattice(x=None, y=None, z=None, universes=None): def source(**kw): """ - Create a source card + Create a source card. Other Parameters ---------------- @@ -814,7 +824,7 @@ def source(**kw): z : array_like [z_min and z_max] for uniform source. isotropic : bool - Flag for isotropic source + Flag for whether source is isotropic. direction : array_like [ux, uy, uz] unit vector for parallel beam source. white_direction : array_like @@ -832,9 +842,9 @@ def source(**kw): Returns ------- dictionary - A source card + A source card. """ - # Check the suplied keyword arguments + # Check the supplied keyword arguments for key in kw.keys(): check_support( "source parameter", @@ -951,32 +961,33 @@ def tally( E=np.array([0.0, INF]), ): """ - Creates a tally card to collect MC solutions + Create a tally card to collect MC solutions. Parameters ---------- - scores : str - set tally type, default to tracklength - x : array like [float], optional - define x-spatial tally bins, by default np.array([-INF, INF]) - y : array like [float], optional - define y-spatial tally bins, by default np.array([-INF, INF]) - z : array like [float], optional - define z-spatial tally bins, by default np.array([-INF, INF]) - t : array like [float], optional - define time tally bins, by default np.array([-INF, INF]) - mu : array like [float], optional - define axial angular tally bins, by default np.array([-1.0, 1.0]) - azi : array like [float], optional - define azimuthal angle tally bins, by default np.array([-PI, PI]) - g : array like [float], optional - tally group, define an energy band to tally in, by default np.array([-INF, INF]) - E : array like [float], optional - _description_, by default np.array([0.0, INF]) + scores : list of str + List of tally types (default ["tracklength"]). + x : array_like[float], optional + x-coordinates that demarcate tally bins (default numpy.ndarray([-INF, INF])). + y : array_like[float], optional + y-coordinates that demarcate tally bins (default numpy.ndarray([-INF, INF])). + z : array_like[float], optional + z-coordinates that demarcate tally bins (default numpy.ndarray([-INF, INF])). + t : array_like[float], optional + Times that demarcate tally bins (default numpy.ndarray([-INF, INF])). + mu : array_like[float], optional + Angles that demarcate axial angular tally bins (default numpy.ndarray([-1.0, 1.0])). + azi : array_like[float], optional + Angles that demarcate azimuthal angular tally bins (default numpy.ndarray([-1.0, 1.0])). + g : array_like[float], optional + Energies that demarcate energy tally bins (default numpy.ndarray([-INF, INF])). + E : array_like[float], optional + Continuous energy functionality, (default numpy.ndarray([0.0, INF])). Returns ------- - tally card : dictionary + dictionary + A tally card. """ # Get tally card @@ -1026,39 +1037,39 @@ def setting(**kw): Other Parameters ---------------- N_particle : int - Number of MC particle histories to run (for k-eigen and iQMC its /iteration) + Number of MC particle histories to run (for k-eigen and iQMC its /iteration). N_batch : int - Number of batches to run + Number of batches to run. rng_seed : int - Random number seed + Random number seed. time_boundary : float - the time edge of the problem after which all particles will be killed + The time edge of the problem, after which all particles will be killed. progress_bar : bool - display the progress bar (disable when running MC/DC in a loop) + Whether to display the progress bar (default True; disable when running MC/DC in a loop). output_name : str - Name of the output file MC/DC should save data in, default is output.h5 + Name of the output file MC/DC should save data in (default "output.h5"). save_input_deck : bool - toggle to save the input deck + Whether to save the input deck information to the output file (default False). particle_tracker : bool - true will track the paths of all individual particle histories, memory issues abound + Whether to track paths of all individual particles histories, memory issues abound (default False). k_eff : str - toggle true to run a k-eigen problem + Whether to run a k-eigenvalue problem. source_file : str - specify a source file path and name + Source file path and name. IC_file : str - path to a file containing a description of an initial condition as a file + Path to a file containing a description of an initial condition. active_bank_buff : int - size of the activate particle bank buffer, for MPI runs + Size of the activate particle bank buffer, for MPI runs. census_bank_buff : int - sets size of the census buffer particle bank + Sets size of the census buffer particle bank. Returns ------- dictionary - A setting card + A setting card. """ - # Check the suplied keyword arguments + # Check the supplied keyword arguments for key in kw.keys(): check_support( "setting parameter", @@ -1175,25 +1186,25 @@ def eigenmode( N_inactive=0, N_active=0, k_init=1.0, gyration_radius=None, save_particle=False ): """ - Creates an eigenmode card + Create an eigenmode card. Parameters ---------- N_inactive : int - Number of inactive cycles to settle k + Number of cycles not included when averaging the k-eigenvalue (default 0). N_active : int - Number of active cycles to collect statistics and inform the value of k + Number of cycles to include for statistics of the k-eigenvalue (default 0). k_init : float - an initial k value - gyration_radius : float - specify a gyration radius + Initial k value to iterate on (default 1.0). + gyration_radius : float, optional + Specify a gyration radius (default None). save_particle : bool - toggle to save particle track outputs in a tally mesh + Whether particle track outputs in a tally mesh (default False). Returns ------- dictionary - A eigen mode card + A eigenmode card. """ # Update setting card @@ -1237,7 +1248,7 @@ def eigenmode( def implicit_capture(): """ - Sets implicit capture + Activate implicit capture (implies no weighted emission). """ card = mcdc.input_deck.technique card["implicit_capture"] = True @@ -1246,12 +1257,12 @@ def implicit_capture(): def weighted_emission(flag): """ - Sets weighted emission variance reduction + Activate weighted emission variance reduction technique. Parameters ---------- flag : bool - toggle weighted emission on or off + True to activate weighted emission. """ card = mcdc.input_deck.technique @@ -1260,12 +1271,12 @@ def weighted_emission(flag): def population_control(pct="combing"): """ - Sets population control techniques + Set population control techniques. Parameters ---------- pct : str, optional - population control method, by default "combing" + Population control method (default "combing"). """ card = mcdc.input_deck.technique @@ -1281,7 +1292,7 @@ def population_control(pct="combing"): def branchless_collision(): """ - Sets branchless collision variance reduction technique + Activate branchless collision variance reduction technique (implies no weighted emission). """ card = mcdc.input_deck.technique card["branchless_collision"] = True @@ -1290,16 +1301,16 @@ def branchless_collision(): def time_census(t): """ - Sets a time + Set time-census boundaries. Parameters ---------- - t : array like [float] - set the time census boundaries + t : array_like[float] + The time-census boundaries. Returns ------- - Card alterations. + None (in-place card alterations). """ # Remove census beyond the final tally time grid point @@ -1320,26 +1331,26 @@ def time_census(t): def weight_window(x=None, y=None, z=None, t=None, window=None, width=None): """ - Adds weight window variance reduction technique + Activate weight window variance reduction technique. Parameters ---------- - x : array like[float], optional - location of the weight window in x, by default None - y : array like[float], optional - location of the weight window in y, by default None - z : array like[float], optional - location of the weight window in z, by default None - t : array like[float], optional - location of the weight window in t, by default None - window : array like[float], optional - bound of the statistic weight of the window, by default None - width : array like[float], optional - statistical width the window will apply, by default None + x : array_like[float], optional + Location of the weight window in x (default None). + y : array_like[float], optional + Location of the weight window in y (default None). + z : array_like[float], optional + Location of the weight window in z (default None). + t : array_like[float], optional + Location of the weight window in t (default None). + window : array_like[float], optional + Bound of the statistic weight of the window (default None). + width : array_like[float], optional + Statistical width the window will apply (default None). Returns ------- - Card alterations. + A weight window card. """ card = mcdc.input_deck.technique @@ -1407,68 +1418,68 @@ def iQMC( score=[], ): """ - Sets iQMC settings + Set iQMC settings. Parameters ---------- - g : _type_, optional - group, by default None - t : _type_, optional - time, by default None - x : _type_, optional - _description_, by default None - y : _type_, optional - _description_, by default None - z : _type_, optional - _description_, by default None - phi0 : _type_, optional - _description_, by default None - source0 : _type_, optional - _description_, by default None - source_x0 : _type_, optional - _description_, by default None - source_y0 : _type_, optional - _description_, by default None - source_z0 : _type_, optional - _description_, by default None - source_xy0 : _type_, optional - _description_, by default None - source_xz0 : _type_, optional - _description_, by default None - source_yz0 : _type_, optional - _description_, by default None - source_xyz0 : _type_, optional - _description_, by default None - fission_source0 : _type_, optional - _description_, by default None - krylov_restart : _type_, optional - _description_, by default None - fixed_source : _type_, optional - _description_, by default None + g : array_like[float], optional + Energy values that define energy mesh (default None). + t : array_like[float], optional + Time values that define time mesh (default None). + x : array_like[float], optional + x-coordinates that define spacial mesh (default None). + y : array_like[float], optional + y-coordinates that define spacial mesh (default None). + z : array_like[float], optional + z-coordinates that define spacial mesh (default None). + phi0 : array_like[float], optional + Initial scalar flux (default None). + source0 : array_like[float], optional + Initial particle source (default None). + source_x0 : array_like[float], optional + Initial source for tilt-x (default None). + source_y0 : array_like[float], optional + Initial source for tilt-y (default None). + source_z0 : array_like[float], optional + Initial source for tilt-z (default None). + source_xy0 : array_like[float], optional + Initial source for tilt-xy (default None). + source_xz0 : array_like[float], optional + Initial source for tilt-xz (default None). + source_yz0 : array_like[float], optional + Initial source for tilt-yz (default None). + source_xyz0 : array_like[float], optional + Initial source for tilt-xyz (default None). + fission_source0 : array_like[float], optional + Initial fission source (default None). + krylov_restart : int, optional + Max number of iterations for Krylov iteration (default same as maxitt). + fixed_source : array_like[float], optional + Fixed source (default same as phi0). scramble : bool, optional - _description_, by default False + Whether to scramble (default False, implies over-easy). maxitt : int, optional - _description_, by default 25 - tol : _type_, optional - _description_, by default 1e-6 + Maximum number of iterations allowed before termination (default 25). + tol : float, optional + Convergence tolerance (default 1e-6). N_dim : int, optional - _description_, by default 6 + Problem dimensionality (default 6). seed : int, optional - _description_, by default 12345 + Random number seed (default 12345). preconditioner_sweeps : int, optional - _description_, by default 5 + Number of preconditioner sweeps (default 5). generator : str, optional - _description_, by default "halton" + Low-discrepancy sequence generator (default "halton"). fixed_source_solver : str, optional - _description_, by default "source_iteration" + Deterministic solver for fixed-source problem (default "source_iteration"). eigenmode_solver : str, optional - _description_, by default "power_iteration" - score : list, optional - _description_, by default [] + Solver for k-eigenvalue problem (default "power_iteration"). + score : list of str + List of tally types (default empty list). Returns ------- - iqmc card : dictionary + None (in-place card alterations). """ card = mcdc.input_deck.technique @@ -1573,19 +1584,21 @@ def iQMC( def weight_roulette(w_threshold=0.2, w_survive=1.0): """ + Activate weight roulette technique. + If neutron weight is below `w_threshold`, then enter weight roulette technique with survival weight `w_survive`. Parameters ---------- - w_threshold : weight_roulette() is called on a particle if - P['w'] <= wr_threshold - w_survive : survival weight + w_threshold : float + Weight_roulette() is called on a particle if P['w'] <= wr_threshold. + w_survive : float + Weight of surviving particle. Returns ------- - Card alterations. - + None (in-place card alterations). """ card = mcdc.input_deck.technique card["weight_roulette"] = True @@ -1603,16 +1616,17 @@ def IC_generator( max_precursor_density=None, ): """ - Turn on initial condition generator, which samples initial neutrons and precursors - during an eigenvalue simulation. + Activate initial condition generator. + The initial condition generator samples initial neutrons and precursors + during an eigenvalue simulation. Parameters ---------- N_neutron : int - Neutron target size + Neutron target size. N_precursor : int - Delayed neutron precursor target size + Delayed neutron precursor target size. cycle_stretch : float Factor to stretch number of cycles. Higher cycle stretch reduces inter-cycle correlation. @@ -1620,6 +1634,10 @@ def IC_generator( Total and maximum neutron density, required if `N_neutron` > 0. precursor_density, max_precursor_density : float Total and maximum precursor density, required if `N_precursor` > 0. + + Returns + ------- + None (in-place card alterations). """ # Turn on eigenmode and population control @@ -1684,17 +1702,20 @@ def dsm(order=1): def uq(**kw): """ - Set uncertainty quantification + Activate uncertainty quantification. Other Parameters ---------------- - w_threshold : weight_roulette() is called on a particle if - P['w'] <= wr_threshold - w_survive : survival weight + material : dictionary, optional + Material card of material with uncertain parameters. + nuclide : dictionary, optional + Nuclear card of nuclide with uncertain parameters. + distribution : {"uniform"} + Probability distribution of uncertain parameters. Returns ------- - Card alterations. + None (in-place card alterations). """ def append_card(delta_card, global_tag): From a4b0a75c7f40ae0a634eddab4640893f88c795af Mon Sep 17 00:00:00 2001 From: Kayla Clements Date: Wed, 27 Mar 2024 15:39:52 -0700 Subject: [PATCH 18/28] Update paper.bib --- docs/paper.bib | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/paper.bib b/docs/paper.bib index 038708da..7a046307 100644 --- a/docs/paper.bib +++ b/docs/paper.bib @@ -65,7 +65,7 @@ @inproceedings{mcdc:qmcabs @inproceedings{mcdc:variansyah_physor22_pct, Booktitle = {International Conference on Physics of Reactors}, - title = {Performance of Population Control Techniques in Monte Carlo Reactor Criticality Simulation}, + title = {Performance of Population Control Techniques in {M}onte {C}arlo Reactor Criticality Simulation}, year = {2022}, author = {Ilham Variansyah and Ryan G. McClarren}, address = {Pittsburgh, Pennsylvania, USA}, @@ -73,7 +73,7 @@ @inproceedings{mcdc:variansyah_physor22_pct @inproceedings{variansyah_mc23_ic, Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, - title = {An effective initial particle sampling technique for Monte Carlo reactor transient simulations}, + title = {An effective initial particle sampling technique for {M}onte {C}arlo reactor transient simulations}, year = {2023}, author = {Ilham Variansyah and Ryan G. McClarren}, address = {Niagara Falls, Ontario, Canada}, @@ -82,7 +82,7 @@ @inproceedings{variansyah_mc23_ic @inproceedings{variansyah_mc23_moving_object, Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, - title = {High-fidelity treatment for object movement in time-dependent Monte Carlo transport simulations}, + title = {High-fidelity treatment for object movement in time-dependent {M}onte {C}arlo transport simulations}, year = {2023}, author = {Ilham Variansyah and Ryan G. McClarren}, address = {Niagara Falls, Ontario, Canada}, @@ -124,7 +124,7 @@ @inproceedings{variansyah_mc23_mcdc @article{brax2023, author = {Cuneo, Braxton and Bailey, Mike}, - title = {Divergence Reduction in Monte Carlo Neutron Transport with On-GPU Asynchronous Scheduling}, + title = {Divergence Reduction in {M}onte {C}arlo Neutron Transport with On-{GPU} Asynchronous Scheduling}, year = {2023}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, @@ -209,7 +209,7 @@ @article{openmc organization = {UT-Battelle LLC/ORNL, Oak Ridge, TN (Unted States)}, pages = {274-281}, publisher = {Elsevier Ltd}, - title = {The OpenMC Monte Carlo particle transport code}, + title = {The {OpenMC} {M}onte {C}arlo particle transport code}, volume = {51}, year = {2013}, } @@ -230,7 +230,7 @@ @article{geant4 } @confrence{mcdc:cuneo2024alternative, - title={An Alternative to Stride-Based RNG for Monte Carlo Transport}, + title={An Alternative to Stride-Based RNG for {M}onte {C}arlo Transport}, author={Braxton S. Cuneo and Ilham Variansyah}, year={2024}, doi = {10.48550/arXiv.2403.06362}, From cbd9f553c1a9adee9dfd53b68ccf1b516bf41c0f Mon Sep 17 00:00:00 2001 From: Kayla Clements Date: Wed, 27 Mar 2024 15:44:28 -0700 Subject: [PATCH 19/28] Update user.rst --- docs/source/user.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/user.rst b/docs/source/user.rst index 555bad2a..bb25f7ac 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -226,7 +226,7 @@ Using MPI MC/DC can be executed using MPI with or without Numba acceleration. If ``numba-mode`` is enabled the ``jit`` compilation, which is executed on all threads, can take between 30s-2min. For smaller problems, Numba compilation time could exceed runtime, and pure python mode could be preferable. -Below, ``--mode`` can equal python or numba. MC/DC gets MPI functinoality via `mpi4py `_. +Below, ``--mode`` can equal python or numba. MC/DC gets MPI functionality via `mpi4py `_. As an example, to run on 36 processes in Numba mode with `SLURM `_: .. code-block:: python3 From 0eb666938fc466057d685858fa143bb5a6c19f84 Mon Sep 17 00:00:00 2001 From: Kayla Clements Date: Thu, 28 Mar 2024 13:33:00 -0700 Subject: [PATCH 20/28] Add colorama mock for Sphinx --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 69e46ca9..68308523 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ # On Read the Docs, need to mock any python packages that would require c from unittest.mock import MagicMock -MOCK_MODULES = ["mpi4py"] +MOCK_MODULES = ["mpi4py", "colorama"] sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES) From ca85739888f129566a1bd9b1e84d1627f8b7b4e3 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Fri, 5 Apr 2024 11:59:58 -0700 Subject: [PATCH 21/28] adding middle initils where relevent --- docs/paper.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/paper.md b/docs/paper.md index 68fb790d..60030b83 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -19,10 +19,10 @@ authors: # x=reviewed orcid: 0000-0003-3426-7160 affiliation: "1, 2" corresponding: true - - name: Samuel Pasmann + - name: Samuel L. Pasmann orcid: 0000-0003-1391-1471 affiliation: "1, 3" - - name: Kayla Beth Clements + - name: Kayla B. Clements orcid: 0000-0003-3358-5618 affiliation: "1, 2" - name: Braxton Cuneo @@ -35,7 +35,7 @@ authors: # x=reviewed affiliation: "1, 4" - name: Caleb Shaw affiliation: "1, 4" - - name: Jordan Northrop + - name: Jordan Northrop orcid: 0000-0003-0420-9699 affiliation: "1, 2" - name: Rohan Pankaj @@ -47,20 +47,20 @@ authors: # x=reviewed - name: Benjamin Whewell orcid: 0000-0001-7826-5525 affiliation: "1, 3" - - name: Ryan McClarren #advisors in order of authors except Niemeyer + - name: Ryan G. McClarren #advisors in order of authors except Niemeyer orcid: 0000-0002-8342-6132 affiliation: "1, 3" - - name: Todd Palmer + - name: Todd S. Palmer orcid: 0000-0003-3310-5258 affiliation: "1, 2" - name: Lizhong Chen orcid: 0000-0001-5890-7121 affiliation: "1, 2" - - name: Dmitriy Anistratov + - name: Dmitriy Y. Anistratov affiliation: "1, 4" - name: C. T. Kelley affiliation: "1, 4" - - name: Camille Palmer + - name: Camille J. Palmer orcid: 0000-0002-7573-4215 affiliation: "1, 2" - name: Kyle E. Niemeyer From cc8772b01c6e0d83669c025b42950cd8134ec2dc Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Mon, 8 Apr 2024 10:45:39 -0700 Subject: [PATCH 22/28] adding dois, fixing in text bib refs --- docs/paper.bib | 40 ++++++++++++++++++++++------------------ docs/paper.md | 4 ++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/docs/paper.bib b/docs/paper.bib index 7a046307..9956d449 100644 --- a/docs/paper.bib +++ b/docs/paper.bib @@ -50,6 +50,7 @@ @inproceedings{mcdc:clements_mc23 title = {Global Sensitivity Analysis in {M}onte {C}arlo Radiation Transport}, Month = {8}, year = {2023}, + doi = {10.48550/arXiv.2403.06106}, author = {Kayla Clements and Gianluca Geraci and Aaron J Olson and Todd Palmer}, address = {Niagara Falls, Ontario, Canada}, } @@ -59,6 +60,7 @@ @inproceedings{mcdc:qmcabs booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, title="{iQMC}: Iterative Quasi-{Monte Carlo} with {K}rylov Linear Solvers for k-Eigenvalue Neutron Transport Simulations", author="S. Pasmann and I. Variansyah and C. T. Kelley and R. McClarren", + doi = {10.48550/arXiv.2306.11600}, year=2023, address = {Niagara Falls, Ontario, Canada}, } @@ -67,6 +69,7 @@ @inproceedings{mcdc:variansyah_physor22_pct Booktitle = {International Conference on Physics of Reactors}, title = {Performance of Population Control Techniques in {M}onte {C}arlo Reactor Criticality Simulation}, year = {2022}, + doi = {10.13182/physor22-37871}, author = {Ilham Variansyah and Ryan G. McClarren}, address = {Pittsburgh, Pennsylvania, USA}, } @@ -104,7 +107,7 @@ @article{mcdc:clements_variance_2024 volume = {319}, issn = {0022-4073}, url = {https://www.sciencedirect.com/science/article/pii/S0022407324000657}, - doi = {https://doi.org/10.1016/j.jqsrt.2024.108958}, + doi = {10.1016/j.jqsrt.2024.108958}, abstract = {Monte Carlo simulations are at the heart of many high-fidelity simulations and analyses for radiation transport systems. As is the case with any complex computational model, it is important to propagate sources of input uncertainty and characterize how they affect model output. Unfortunately, uncertainty quantification (UQ) is made difficult by the stochastic variability that Monte Carlo transport solvers introduce. The standard method to avoid corrupting the UQ statistics with the transport solver noise is to increase the number of particle histories, resulting in very high computational costs. In this contribution, we propose and analyze a sampling estimator based on the law of total variance to compute UQ variance even in the presence of residual noise from Monte Carlo transport calculations. We rigorously derive the statistical properties of the new variance estimator, compare its performance to that of the standard method, and demonstrate its use on neutral particle transport model problems involving both attenuation and scattering physics. We illustrate, both analytically and numerically, the estimator’s statistical performance as a function of available computational budget and the distribution of that budget between UQ samples and particle histories. We show analytically and corroborate numerically that the new estimator is unbiased, unlike the standard approach, and is more accurate and precise than the standard estimator for the same computational budget.}, journal = {Journal of Quantitative Spectroscopy and Radiative Transfer}, author = {Clements, Kayla B. and Geraci, Gianluca and Olson, Aaron J. and Palmer, Todd S.}, @@ -131,7 +134,6 @@ @article{brax2023 issn = {1049-3301}, url = {10.1145/3626957}, doi = {10.1145/3626957}, - note = {Just Accepted}, journal = {ACM Trans. Model. Comput. Simul.}, month = {oct}, keywords = {asynchronous, divergence, scheduling, GPGPU, GPU} @@ -143,6 +145,7 @@ @book{lewis_computational_1984 title = {Computational methods of neutron transport}, publisher = {John Wiley and Sons, Inc.}, author = {Lewis, Elmer Eugene and Miller, Warren F}, + url = {https://www.osti.gov/biblio/5538794}, year = {1984}, } @@ -172,7 +175,7 @@ @article{mcatk volume = {82}, issn = {0306-4549}, url = {https://www.sciencedirect.com/science/article/pii/S0306454914004472}, - doi = {https://doi.org/10.1016/j.anucene.2014.08.047}, + doi = {10.1016/j.anucene.2014.08.047}, abstract = {The Monte Carlo Application ToolKit (MCATK) is a component-based software library designed to build specialized applications and to provide new functionality for existing general purpose Monte Carlo radiation transport codes. We will describe MCATK and its capabilities along with presenting some verification and validations results.}, journal = {Annals of Nuclear Energy}, author = {Adams, Terry and Nolen, Steve and Sweezy, Jeremy and Zukaitis, Anthony and Campbell, Joann and Goorley, Tim and Greene, Simon and Aulwes, Rob}, @@ -196,25 +199,26 @@ @techreport{mcnp year = {2023} } -# openmc + + @article{openmc, - author = {Romano, Paul K. and Forget, Benoit}, - address = {United States}, - copyright = {2012 Elsevier Ltd}, - issn = {0306-4549}, - journal = {Annals of nuclear energy}, - keywords = {Code (cryptography) ; Computational science ; Computer science ; Criticality ; High performance computing ; Monte Carlo ; Monte carlo code ; Monte Carlo method ; Neutron transport ; Nuclear Science \& Technology ; Open source ; Particle transport ; Software design ; Supercomputer ; Theoretical computer science}, - language = {eng}, - number = {C}, - organization = {UT-Battelle LLC/ORNL, Oak Ridge, TN (Unted States)}, - pages = {274-281}, - publisher = {Elsevier Ltd}, - title = {The {OpenMC} {M}onte {C}arlo particle transport code}, - volume = {51}, - year = {2013}, + title = {{OpenMC}: {A} state-of-the-art {Monte} {Carlo} code for research and development}, + volume = {82}, + issn = {0306-4549}, + url = {https://www.sciencedirect.com/science/article/pii/S030645491400379X}, + doi = {10.1016/j.anucene.2014.07.048}, + abstract = {This paper gives an overview of OpenMC, an open source Monte Carlo particle transport code recently developed at the Massachusetts Institute of Technology. OpenMC uses continuous-energy cross sections and a constructive solid geometry representation, enabling high-fidelity modeling of nuclear reactors and other systems. Modern, portable input/output file formats are used in OpenMC: XML for input, and HDF5 for output. High performance parallel algorithms in OpenMC have demonstrated near-linear scaling to over 100,000 processors on modern supercomputers. Other topics discussed in this paper include plotting, CMFD acceleration, variance reduction, eigenvalue calculations, and software development processes.}, + journal = {Annals of Nuclear Energy}, + author = {Romano, Paul K. and Horelik, Nicholas E. and Herman, Bryan R. and Nelson, Adam G. and Forget, Benoit and Smith, Kord}, + year = {2015}, + keywords = {HDF5, Monte Carlo, Neutron transport, OpenMC, Parallel, XML}, + pages = {90--97}, + annote = {Joint International Conference on Supercomputing in Nuclear Applications and Monte Carlo 2013, SNA + MC 2013. Pluri- and Trans-disciplinarity, Towards New Modeling and Numerical Simulation Paradigms}, } + + # geant4 @article{geant4, title = {Geant4—a simulation toolkit}, diff --git a/docs/paper.md b/docs/paper.md index 60030b83..c7c44e10 100644 --- a/docs/paper.md +++ b/docs/paper.md @@ -118,9 +118,9 @@ This all together makes `MC/DC` ideal for use in an academic environment for bot `MC/DC` has support for continuous and multi-group energy neutron transport physics with constructive solid geometry modeling. It can solve k-eigenvalue problems (used to determine neutron population growth rates in reactors) as well as fully dynamic simulations. It also supports some simple domain decomposition, with more complex algorithms currently being implemented. -In an initial code-to-code performance comparison, `MC/DC` was found to run about 2.5 times slower than the Shift Monte Carlo code for a simple problem and showed similar scaling on some systems [@mcdc:variansyah_mc23_mcdc]. +In an initial code-to-code performance comparison, `MC/DC` was found to run about 2.5 times slower than the Shift Monte Carlo code for a simple problem and showed similar scaling on some systems [@variansyah_mc23_mcdc]. -`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct; @mcdc:variansyah_physor22_pct], continuous geometry movement techniques that model transient elements [@mcdc:variansyah_mc23_moving_object] (e.g., control rods or pulsed neutron experiments) more accurately than step functions typically used by other codes, initial condition sampling technique for typical reactor transients [@mcdc:variansyah_mc23_ic], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. +`MC/DC`-enabled explorations into dynamic neutron transport algorithms have been successful, including quasi-Monte Carlo techniques [@mcdc:qmc], hybrid iterative techniques for k-eigenvalue simulations [@mcdc:qmcabs], population control techniques [@mcdc:variansyah_nse22_pct; @mcdc:variansyah_physor22_pct], continuous geometry movement techniques that model transient elements [@variansyah_mc23_moving_object] (e.g., control rods or pulsed neutron experiments) more accurately than step functions typically used by other codes, initial condition sampling technique for typical reactor transients [@variansyah_mc23_ic], hash-based random number generation [@mcdc:cuneo2024alternative], uncertainty and global sensitivity analysis [@mcdc:clements_mc23; @mcdc:clements_variance_2024], residual Monte Carlo methods, and machine learning techniques for dynamic node scheduling, among others. # Future Work From 42ab4a78038f850b70ad98ab75c92fe811c7dd9d Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Mon, 8 Apr 2024 11:15:41 -0700 Subject: [PATCH 23/28] updating pyproject for version release --- pyproject.toml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3ed6b3a1..11feae21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mcdc" -version = "0.9.0" +version = "0.9.1" authors = [ { name="Ilham Variansyah", email="variansi@oregonstate.edu" }, { name="Sam Pasmann", email="spasmann@nd.edu" }, @@ -14,8 +14,25 @@ authors = [ { name="Charles Goodman"}, { name="Caleb Shaw"}, { name="Rohan Pankaj"}, - { name="Jordan Northrop"}, + { name="Alexander Mote"}, + { name="Ethan Lame"}, + { name="Benjamin Whewell"}, + { name="Ryan G. McClarren"}, + { name="Todd S. Palmer"}, + { name="Lizhong Chen"}, + { name="Dmitriy Y. Anistratov"}, + { name="C. T. Kelley"}, + { name="Camille J. Palmer"}, + { name="Kyle E. Niemeyer"} ] + +maintainers = [ + "Ilham Variansyah ", + "Kayla Clements ", + "Joanna Piper Morgan ", + "Kyle E. Niemeyer ", +] + description = "Monte Carlo / Dynamic Code, a pure python high performance Monte Carlo neutronics package" readme = "README.md" requires-python = ">=3.9, <=3.11.8" From 4f442b58c2ebe1e9932e96563ca2e43da2ce7451 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Mon, 8 Apr 2024 11:20:06 -0700 Subject: [PATCH 24/28] fixing maintainers entry --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 11feae21..ae23d6fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,14 +23,14 @@ authors = [ { name="Dmitriy Y. Anistratov"}, { name="C. T. Kelley"}, { name="Camille J. Palmer"}, - { name="Kyle E. Niemeyer"} + { name="Kyle E. Niemeyer"}, ] maintainers = [ - "Ilham Variansyah ", - "Kayla Clements ", - "Joanna Piper Morgan ", - "Kyle E. Niemeyer ", + { name="Ilham Variansyah", email = "variansi@oregonstate.edu"}, + { name="Kayla Clements", email = "clemekay@oregonstate.edu"}, + { name="Joanna Piper Morgan", email = "morgajoa@oregonstate.edu"}, + { name="Kyle E. Niemeyer", email = "kyle.niemeyer@oregonstate.edu"}, ] description = "Monte Carlo / Dynamic Code, a pure python high performance Monte Carlo neutronics package" From 972786c87579f0bdba6aa917d968a58415630d8b Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Mon, 8 Apr 2024 12:31:28 -0700 Subject: [PATCH 25/28] adding a citation file and a manual publish workflow --- .github/workflows/manual_publish.yml | 46 +++++++++++ CITATION.cff | 110 +++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 .github/workflows/manual_publish.yml create mode 100644 CITATION.cff diff --git a/.github/workflows/manual_publish.yml b/.github/workflows/manual_publish.yml new file mode 100644 index 00000000..39384293 --- /dev/null +++ b/.github/workflows/manual_publish.yml @@ -0,0 +1,46 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# assumming this is being done in a repo with trusted publishing permissions in pypi + +name: Manually upload Python Package (if auto upload fails) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: '3.11' + - uses: mpi4py/setup-mpi@v1 + - name: Install dependencies + run: | + python --version + python -m pip install --upgrade pip + pip install . + pip install build + - name: Patch Numba + run : | + bash .github/workflows/patch.sh + - name: Build package + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + #with: + # user: __token__ + # password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..749dec70 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,110 @@ +# This CITATION.cff file was generated with cffinit. +# Visit https://bit.ly/cffinit to generate yours today! + +cff-version: 1.2.0 +title: 'MC/DC: Monte Carlo Dynamic Code' +message: >- + a pure python high performance Monte Carlo neutronics + package +type: software +authors: + - name: >- + Center for Exascale Monte Carlo Neutron Transport + (CEMeNT) + website: 'https://cement-psaap.github.io/' + - given-names: Ilham + family-names: 'Variansyah ' + email: variansi@oregonstate.edu + affiliation: Oregon State University + orcid: 'https://orcid.org/0000-0003-3426-7160' + - given-names: Joanna Piper + family-names: Morgan + email: morgajoa@oregonstate.edu + affiliation: Oregon State University + orcid: 'https://orcid.org/0000-0003-1379-5431' + - given-names: Samuel + family-names: Pasmann + orcid: 'https://orcid.org/0000-0003-1391-1471' + - given-names: Kayla + family-names: Clements + email: clemekay@oregonstate.edu + affiliation: Oregon State University + orcid: 'https://orcid.org/0000-0003-3358-5618' + - given-names: Braxton + family-names: Cuneo + email: bcuneo@seattleu.edu + affiliation: Seattle University + orcid: 'https://orcid.org/0000-0002-6493-0990' + - given-names: Alexander + family-names: Mote + email: motea@oregonstate.edu + orcid: 'https://orcid.org/0000-0001-5099-0223' + affiliation: Oregon State University + - given-names: Caleb + family-names: Shaw + email: cashaw4@ncsu.edu + affiliation: North Carolina State University + - given-names: Jordan + family-names: Northrop + email: northj@oregonstate.edu + affiliation: Oregon State Universtiy + orcid: 'https://orcid.org/0000-0003-0420-9699' + - given-names: Rohan + family-names: Pankaj + orcid: 'https://orcid.org/0009-0005-0445-9323' + - given-names: 'Ryan G. ' + family-names: McClarren + email: rmcclarr@nd.edu + affiliation: University of Notre Dame + orcid: 'https://orcid.org/0000-0002-8342-6132' + - given-names: Todd S. + family-names: Palmer + email: palmerts@oregonstate.edu + affiliation: Oregon State Univeristy + orcid: 'https://orcid.org/0000-0003-3310-5258' + - given-names: Lizhong + family-names: Chen + email: chenliz@oregonstate.edu + affiliation: Oregon State University + orcid: 'https://orcid.org/0000-0001-5890-7121' + - given-names: Dmitriy Y. + family-names: Anistratov + email: anistratov@ncsu.edu + affiliation: North Carolina State University + - given-names: C. T. + family-names: Kelley + email: ctk@ncsu.edu + affiliation: North Carolina State University + - given-names: 'Camille ' + family-names: Palmer + email: palmecam@oregonstate.edu + orcid: 'https://orcid.org/0000-0002-7573-4215' + affiliation: Oregon State University + - given-names: Kyle E. + family-names: Niemeyer + email: niemeyek@oregonstate.edu + orcid: 'https://orcid.org/0000-0003-4425-7097' + affiliation: Oregon State University +identifiers: + - type: doi + value: 10.5281/zenodo.10576604 + description: Zenodo Archive + - type: doi + value: 10.21105/joss.06415 + description: Paper description of MC/DC +repository-code: 'https://github.com/CEMeNT-PSAAP/MCDC' +url: 'https://cement-psaapgithubio.readthedocs.io/en/latest/' +abstract: >- + MC/DC is a performant, scalable, and machine-portable + Python-based Monte Carlo neutron transport software + currently developed in the Center for Exascale Monte Carlo + Neutron Transport (CEMeNT). +keywords: + - monte carlo + - numba + - gpu + - neutron transport + - radiation transport +license: BSD-3-Clause +version: 0.9.1 +date-released: '2024-04-08' From 71ab883978763b11b6d57db53aa79db03865d20e Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 9 Apr 2024 09:08:21 -0700 Subject: [PATCH 26/28] chaging docs to refelct joss paper --- .github/workflows/draft-pdf.yml | 3 ++- .github/workflows/manual_publish.yml | 5 +++- README.md | 22 ++++++++------- docs/source/index.rst | 40 +++++++++++++++++++++++----- 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml index cf517ff0..912eb870 100644 --- a/.github/workflows/draft-pdf.yml +++ b/.github/workflows/draft-pdf.yml @@ -1,4 +1,5 @@ -on: [push] +name: Build JOSS paper, only on dispatch +on: [workflow_dispatch] jobs: paper: diff --git a/.github/workflows/manual_publish.yml b/.github/workflows/manual_publish.yml index 39384293..c885d097 100644 --- a/.github/workflows/manual_publish.yml +++ b/.github/workflows/manual_publish.yml @@ -8,7 +8,10 @@ # assumming this is being done in a repo with trusted publishing permissions in pypi -name: Manually upload Python Package (if auto upload fails) +# There is an automated runner which should upload a new PyPi package but it often fails due to API BS. +# This is here so one doesn't have to republish everything + +name: manually publish pypi package (for touble shooting) on: workflow_dispatch diff --git a/README.md b/README.md index c92fac8d..0e6001d4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Build](https://github.com/CEMeNT-PSAAP/MCDC/actions/workflows/mpi_numba_reg.yml/badge.svg)](https://github.com/CEMeNT-PSAAP/MCDC/actions/workflows/mpi_numba_reg.yml) [![ReadTheDocs](https://readthedocs.org/projects/cement-psaapgithubio/badge/?version=latest&style=flat)](https://cement-psaapgithubio.readthedocs.org/en/latest/ ) +[![DOI](https://joss.theoj.org/papers/10.21105/joss.06415/status.svg)](https://doi.org/10.21105/joss.06415) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) @@ -108,18 +109,21 @@ You can find specifics on how to run these tests locally [here](https://github.c To provide proper attribution to MC/DC, please cite ``` -@inproceedings{var_mc23_mcdc, - Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, - title = {Development of {MC/DC}: a performant, scalable, and portable Python-based {M}onte {C}arlo neutron transport code}, - year = {2023}, - author = {Ilham Variansyah and Joanna Piper Morgan and Kyle E. Niemeyer and Ryan G. McClarren}, - address = {Niagara Falls, Ontario, Canada}, - doi={10.48550/arXiv.2305.07636}, -} + @article{morgan2024mcdc, + title = {Monte {Carlo} / {Dynamic} {Code} ({MC}/{DC}): {An} accelerated {Python} package for fully transient neutron transport and rapid methods development}, + author = {Morgan, Joanna Piper and Variansyah, Ilham and Pasmann, Samuel L. and Clements, Kayla B. and Cuneo, Braxton and Mote, Alexander and Goodman, Charles and Shaw, Caleb and Northrop, Jordan and Pankaj, Rohan and Lame, Ethan and Whewell, Benjamin and McClarren, Ryan G. and Palmer, Todd S. and Chen, Lizhong and Anistratov, Dmitriy Y. and Kelley, C. T. and Palmer, Camille J. and Niemeyer, Kyle E.}, + journal = {Journal of Open Source Software}, + volume = {9}, + number = {96}, + year = {2024}, + pages = {6415}, + url = {https://joss.theoj.org/papers/10.21105/joss.06415}, + doi = {10.21105/joss.06415}, + } ``` which should render something like this -Variansyah, Ilham, J. P. Morgan, K. E. Niemeyer, and R. G. McClarren. 2023. “Development of MC/DC: a performant, scalable, and portable Python-based Monte Carlo neutron transport code.” In *International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering*, Niagara Falls, Ontario, Canada. DOI. [10.48550/arXiv.2305.07636](https://doi.org/10.48550/arXiv.2305.07636) +Morgan et al. (2024). Monte Carlo / Dynamic Code (MC/DC): An accelerated Python package for fully transient neutron transport and rapid methods development. Journal of Open Source Software, 9(96), 6415. https://doi.org/10.21105/joss.06415. ## License diff --git a/docs/source/index.rst b/docs/source/index.rst index 4a423949..29f8da66 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -115,12 +115,38 @@ To Cite MC/DC If you use or devlope in MC/DC and would like to publish your results please cite our article in the Journal of Open Source software -.. code-block:: - +.. code-block:: bibtex + @article{morgan2024mcdc, - booktitle = {} - title = {}, - author = {}, - date = {}, - doi = {}, + title = {Monte {Carlo} / {Dynamic} {Code} ({MC}/{DC}): {An} accelerated + {Python} package for fully transient neutron transport and + rapid methods development}, + author = {Morgan, Joanna Piper and Variansyah, Ilham and Pasmann, Samuel L. and + Clements, Kayla B. and Cuneo, Braxton and Mote, Alexander and + Goodman, Charles and Shaw, Caleb and Northrop, Jordan and Pankaj, Rohan and + Lame, Ethan and Whewell, Benjamin and McClarren, Ryan G. and Palmer, Todd S. and + Chen, Lizhong and Anistratov, Dmitriy Y. and Kelley, C. T. and + Palmer, Camille J. and Niemeyer, Kyle E.}, + journal = {Journal of Open Source Software}, + volume = {9}, + number = {96}, + year = {2024}, + pages = {6415}, + url = {https://joss.theoj.org/papers/10.21105/joss.06415}, + doi = {10.21105/joss.06415}, + } + +To cite specific numerical methods within MC/DC please use our ANS M&C publications + +.. code-block:: bibtex + + @inproceedings{var_mc23_mcdc, + Booktitle = {International Conference on Mathematics and Computational Methods Applied to Nuclear Science and Engineering}, + title = {Development of {MC/DC}: a performant, scalable, and portable Python-based {M}onte {C}arlo neutron transport code}, + year = {2023}, + author = {Ilham Variansyah and Joanna Piper Morgan and Kyle E. Niemeyer and Ryan G. McClarren}, + address = {Niagara Falls, Ontario, Canada}, + doi={10.48550/arXiv.2305.07636}, } + +or for an individual specifc methods please browse through our `center's publiications `_ From fd33c476912d850acc3964cfc0c0c2b0add3a331 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 9 Apr 2024 09:22:50 -0700 Subject: [PATCH 27/28] chaning python version --- docs/source/contribution.rst | 11 +++++++++++ pyproject.toml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/source/contribution.rst b/docs/source/contribution.rst index 716f324f..6a200597 100644 --- a/docs/source/contribution.rst +++ b/docs/source/contribution.rst @@ -10,6 +10,15 @@ Whether you are here to make a single PR and never return, or want to become a m We have regular developers meetings for any and all who are interested to discuss contributions to this code base. This describes the processes of contributing to MC/DC for both internal (CEMeNT) and external developers. +We make contributions to the ``dev`` branch of MC/DC. +To get started making alterations in a cloned repo + +#. fork ``CEMeNT-PSAAP/MCDC`` to your github account +#. ``git clone git@github.com:/MCDC.git`` +#. ``git switch dev`` +#. run install script which will install MC/DC as an editedable package from this directory + +Push some particles around!!!! Please note our `code of conduct `_ which we take seriously @@ -164,6 +173,8 @@ Pull Requests MC/DC works off of a fork workflow in which contributors fork our repo, make alterations, and submit a pull requests. You should only submit a pull request once your code passes all tests, is properly linted, you have edited documentation (if necessary), and added any new tests (if needed). +Open a PR to the ``dev`` branch in Github. +MC/DC's main branch is only updated for version releases at which time a PR from dev to main is opened, taged, archived, and published automatically. Within your pull request documentation please list: diff --git a/pyproject.toml b/pyproject.toml index ae23d6fa..1e9000be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ maintainers = [ description = "Monte Carlo / Dynamic Code, a pure python high performance Monte Carlo neutronics package" readme = "README.md" -requires-python = ">=3.9, <=3.11.8" +requires-python = ">=3.9, <=3.11" license = {file = "LICENSE"} keywords = ["Monte Carlo", "Nuclear", "GPU", "numba", "mpi4py", "neutron transport", "neutronics", "HPC"] classifiers = [ From b3d523e5c8323c4aa15b199af928d477bb86f401 Mon Sep 17 00:00:00 2001 From: "Joanna Piper Morgan (jonsey)" Date: Tue, 9 Apr 2024 09:27:49 -0700 Subject: [PATCH 28/28] oh good lord --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1e9000be..33e053c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ maintainers = [ description = "Monte Carlo / Dynamic Code, a pure python high performance Monte Carlo neutronics package" readme = "README.md" -requires-python = ">=3.9, <=3.11" +requires-python = ">=3.9, <=3.11.10" license = {file = "LICENSE"} keywords = ["Monte Carlo", "Nuclear", "GPU", "numba", "mpi4py", "neutron transport", "neutronics", "HPC"] classifiers = [