Network


Latest external collaboration on country level. Dive into details by clicking on the dots.

Hotspot


Dive into the research topics where Ryan G. McClarren is active.

Publication


Featured researches published by Ryan G. McClarren.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 6 – Testing and Debugging

Ryan G. McClarren

When writing codes in Python, or any language, mistakes can happen and cause the code to behave in undesired ways. These mistakes, called bugs, need to be found by the programmer, and we discuss this process of debugging to remove these errors. As part of debugging we demonstrate the necessity of designing tests to assure that a code performs the required task. A key tool in the process of debugging is the assert statement, and we show how to use it to find bugs in a code. Additionally, the concept of error handling is shown as a way to handle unexpected behavior inside the code, and to correct errors when possible.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

LU Factorization and Banded Matrices

Ryan G. McClarren

When solving a linear system of equations with a changing righthand side, the bulk of the work can be done by factoring the systems matrix into the product of an upper and lower triangular matrix. This factorization, called LU factorization, allows one to obtain the solution to the system through a forward and backward substitution. The work to obtain the LU factorization is the same as Gaussian elimination, and the need for pivoting is the same. Finally, we discuss the types of matrices that arise in engineering calculations and their common structures.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 13 – Open Root Finding Methods

Ryan G. McClarren

Using open root-finding methods we can find a zero of nonlinear function using a single initial guess. The most famous of these is Newtons method, which uses the functions derivative to where the tangent line to the root estimate crosses zero. Newtons method is rapidly convergent for many functions, though it does require knowledge of the derivative. The inexact Newton and secant methods are presented for cases where the derivative is not known. The secant method, however, is not self-starting and needs to use another method for the first iteration. Finally, we demonstrate how Newtons method can be used for systems by extending the notion of a derivative to define a Jacobian matrix.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 3 – Functions, Scoping, Recursion, and Other Miscellany

Ryan G. McClarren

To write useful, reusable code functions are essential. In this chapter we introduce the concept of functions and demonstrate how to write them in Python. The details of calling functions and returning data given. Writing comments that describe what the function does, its parameters, and return values in the form of docstrings is detailed, and the way to print these docstrings using the help function is shown. The concept of function scope is introduced and demonstrated through examples. Recursion, or functions calling themselves, is discussed and demonstrated through the calculation of the factorial. Finally, interacting with external files in Python is discussed, in particular, writing and calling functions in other files via modules and reading and writing text files.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 15 – Numerical Integration With Newton–Cotes Formulas

Ryan G. McClarren

This chapter presents Newton–Cotes quadrature formulas for approximating integrals by performing polynomial interpolation and integrating the polynomial exactly. In particular we discuss the midpoint, trapezoid, and Simpsons rules for numerical quadrature. The composite forms of these rules are shown where the range of integration is broken into several pieces and the quadrature rule is applied to each piece. Additionally, Richardson extrapolation is applied to integral estimates through a procedure called Romberg integration. The implement of Romberg integration uses the decimal module in Python to use higher precision floating point numbers.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 1 – Getting Started in Python

Ryan G. McClarren

This chapter introduces the reader to the basics of programming in Python version 3. Starting from a Hello World example, the concepts of comments, errors, and code indentation in Python are introduced. The manipulation of numerical values in Python is then demonstrated, including complex arithmetic. The concept of strings is used to introduce the notion of operator overloading. The reader is then shown how to accept keyboard input into a Python program. The chapter concludes with a discussion of branching and iteration in Python with examples.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 10 – Interpolation

Ryan G. McClarren

There are many cases where one knows the value of a function at discrete points and wants to estimate the functions value between those points. That is, one wants to interpolate the function between the known values. In this chapter we review properties of polynomials and their properties of uniqueness and approximation. Then we show how a polynomial interpolating function can be constructed using the Lagrange polynomial formula. Polynomial interpolants are easy to construct but suffer from the Runge phenomenon where high-degree polynomials have unacceptable oscillations in the reconstruction. To deal with the Runge phenomenon, we present cubic splines as a way to get accurate interpolating functions in a straightforward way. We use SciPys cubic spline functionality for this purpose.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 20 – Two-Group k-Eigenvalue Problems

Ryan G. McClarren

The two-group diffusion model for neutron transport in a light-water nuclear system is an adequate model for many analyses. In this chapter we formulate the neutron diffusion problem with two energy groups, and given an efficient implementation of the inverse power method for finding the effective multiplication factor for the system. The implementation requires the solution of two, one group problems; Python code for this implementation is provided. We use the twogroup model, and its solution to a reflected reactor problem, to demonstrate some principles of reactor theory.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 19 – One-Group k-Eigenvalue Problems

Ryan G. McClarren

The multiplication of neutrons in a nuclear system is typically quantified by an eigenvalue for the system that determines if the system supports sustaining chain reactions. Using neutron diffusion theory, this chapter presents a numerical method for solving these socalled k -eigenvalue problems. The equations are discretized in 1-D geometry and the inverse power iteration method is applied to the resulting generalized eigenvalue problem. A justification of the inverse power method is given in terms of the properties of matrices, and an implementation based on LU factorization with Python is given. The numerical solution is computed for several test problems and compared with analytic solutions where possible.


Computational Nuclear Engineering and Radiological Science Using Python | 2018

Chapter 14 – Finite Difference Derivative Approximations

Ryan G. McClarren

The estimation of derivatives using floating point numbers is usually accomplished using finite differences. In this chapter we present the finite difference approximation to the derivative as a finite version of the definition of a derivative. Using Taylor series we can show the accuracy of an approximation to the derivative and predict how the error behaves as the difference parameter goes to zero. We also discuss second-derivatives and the finite difference version of the diffusion operator. Richardson extrapolation is presented as a means to get highly accurate derivative estimates by manipulating the error terms in the Taylor series. Finally, we demonstrate that complex arithmetic enables highly-accurate derivative estimates without finite differences via the complex step approximation.

Collaboration


Dive into the Ryan G. McClarren's collaboration.

Researchain Logo
Decentralizing Knowledge