Engineering Papers⌕ Search

SEARCH · Engineering Papers

Results for “Python codes”

Search indexed NASA NTRS and DOE OSTI research on propulsion, heat transfer, battery materials and energy systems. Follow report and document links to the original sources.

Quote a phrase for an exact phrase match. Source license links do not imply unrestricted reuse.

At least 235 records · Page 13

Integration of the Kromek D3S Detector and Spot Robot For Secondary Inspections

Inspecting vehicles and containers for the presence of nuclear material is a challenging task for border control and security. When performed manually by inspectors, this task also has an associated risk of exposing the inspectors to unknown radiation. With the advent of agile, easy-to-program, quadruped robots like the Boston Dynamics Spot, automation of secondary inspection can improve the efficiency of the inspection process and alleviates the radiation risks to inspectors. In this project, Brookhaven National Laboratory and the University of Massachussetts at Lowell explored how to automate a simple secondary inspection mission. The Spot robot comes with its own software development kit (SDK) that allows clients/users to write custom code in the Python programming language to control the robot. Spot also has a payload computer called Spot-CORE, which runs the Ubuntu Linux operating system and allows users to integrate external sensors, such as a radiation detector, with Spot. In this study, the Kromek D3S detector has been integrated with Spot via the Spot-CORE, allowing Spot to capture gamma spectra and neutron counts for a specified acquisition period. Two custom routines, search and confirmation, have been developed and executed in this specified order. The search routine directs Spot to go around the nearest obstacle, e.g., vehicle and container, in a preset distance and step to collect gamma and neutron gross counts with the D3S detector. The radiation data and the robot location corresponding to each step are stored and fed to the confirmation routine at the end of the search. The confirmation routine then navigates Spot to the locations of the highest gamma or neutron counts to perform a long, e.g., one minute, measurement, and gives the operators the signature gamma spectra and neutron counts at the hotspots. This paper presents a detailed description of this automated system along with results of the preliminary tests in identifying the location and signature of a 137Cs radiation source in a vehicle.

98 NUCLEAR DISARMAMENT, SAFEGUARDS, AND PHYSICAL P↗

JSPEC: A Program for IBS and Electron Cooling Simulation

JSPEC (JLab Simulation Package on Electron Cooling) is an open-source C++ program developed at Jefferson Lab to simulate the evolution of the ion beam under the intrabeam scattering effect and/or the electron cooling effect. JSPEC includes various models of the ion beam, the electron beam, and the friction force, aiming to reflect the latest advances in the field and to provide a useful tool to the community. JSPEC has been benchmarked against other cooling simulation codes and experimental data. It has been used to support the cooler design for JLEIC, an earlier JLab design for the Electron-Ion Collider. A Python wrapper of the C++ code, pyJSPEC, for Python 3.x environment has also been developed and released. It allows users to run JSPEC simulations in a Python environment and makes it possible for JSPEC to collaborate with other accelerator and beam modeling programs, as well as plentiful Python tools in data visualization, optimization, machine learning, etc. In this report, we introduce the features of JSPEC, with a focus on the latest development, and demonstrate how to use JSPEC and pyJSPEC with sample codes and numerical examples.

Accelerator Physics↗

ThunderBoltz API

The ThunderBoltz application programming interface (API) code is written in Python and is comprised of a set of tools to facilitate compilation of the ThunderBoltz code, as well as fast assembly and formatting of input files for the ThunderBoltz code, post-processing tools of ThunderBoltz results, plotting tools, and runs/schedules the ThunderBoltz code executable for calculations. The ThunderBoltz API code is utilized for importing and manipulating input cross section sets, input conditions, and any other simulation settings made available within the ThunderBoltz input deck via user-defined settings or via automatic generation. The API comes with a set of plotting capabilities of input cross sections, results from ThunderBoltz, and post-processed results carried out with the API.

Park, Ryan↗

An X-ray Intensity Operations Monitor (AXIOM) (Final LDRD Project Report)

The Saturn accelerator has historically lacked the capability to measure time-resolved spectra for its 3-ring bremsstrahlung x-ray source. This project aimed to create a spectrometer called AXIOM to provide this capability. The project had three major development pillars: hardware, simulation, and unfold code. The hardware consists of a ring of 24 detectors around an existing x-ray pinhole camera. The diagnostic was fielded on two shots at Saturn and over 100 shots at the TriMeV accelerator at Idaho Accelerator Center. A new Saturn x-ray environment simulation was created using measured data to validate. This simulation allows for timeresolved spectra computation to compare the experimental results. The AXIOM-Unfold code is a new parametric unfold code using modern global optimizers and uncertainty quantification. The code was written in Python, uses Gitlab version control and issue tracking, and has been developed with long term code support and maintenance in mind.

43 PARTICLE ACCELERATORS↗

Improved Verification and Validation Testing and Tools including Nuclear Criticality Safety Applications with the MCNP6.3® Code [Abstract]

A new Python-based framework has been developed to enable a more consistent layout with automatable setup, execution, and documentation of all verification and validation (V&V) test suites previously established for use with the MCNP code. In this paper, the new general framework for the V&V test suites is discussed, including information on all of the current capabilities and plans for future capabilities. For nuclear criticality safety applications, the existing V&V benchmark problems within the criticality, extended criticality, and analytic k-effective test suites have been ported into this new framework. In addition, the status and updates to the Rossi-alpha and subcritical multiplicationtest suites will be discussed. Some V&V results exercising new MCNP6.3 capabilities will be demonstrated.

97 MATHEMATICS AND COMPUTING↗

Stata Hybrids: Updates and Ideas

At last year's Stata conference I presented two projects for using Python with Stata: a plugin that embeds the Python programming language within Stata and code for using Stata data sets in Python. In this talk I will describe some small improvements being made to these projects, and I will present other ideas for combining tools with Stata. Some of these ideas use Python, some use JavaScript and a web browser.

Fieldler, James↗

Conducted Susceptibility Data Adaptation Tool

The purpose of this research project is to help NASA scientists increase effectivity in testing by reducing the amount of time required for data conversion from initial measurements to the analysis stage. This project resulted in a data conversion tool developed in python using the openpyxl library. When lab personnel perform the Conducted Susceptibility 101 (CS101) and Conducted Susceptibility 02 (CS02) tests in the Semi-anechoic Electromagnetic Compatibility Test Facility at NASA Langley Research Center, the driving code produces a text file under the .DAT extension.The data must be manually converted the .DAT file into an Excel file line by line for data analysis.The Conducted Susceptibility Data Adaptation Tool (CSDAT) uses python code to convert the .DAT files to spreadsheets automatically which saves lab personnel time which they could use for faster analysis as well as prevents possible human error such as leaving out a line of data in the manual conversion process.

Gabriel Johnson↗

User’s Manual for Seal_Flux: A Seal Barrier Reduced-Order Model (Update)

This report provides a brief description on the use of the Seal_Flux computer program developed as part of the effort to quantify the risk of geologic storage of carbon dioxide (CO 2 ) under the U.S. Department of Energy’s (DOE) National Risk Assessment Partnership (NRAP). The Seal_Flux code simulates the flow of CO 2 through a low permeability rock horizon or seal formation overlying the storage reservoir into which CO 2 is injected. A two-phase, relative permeability approach with Darcy’s law is used for one-dimensional (1D) flow computations of CO 2 through the horizon in the vertical direction. The code also allows the simulation of time-dependent processes that can influence such flow. However, as part of its design, Seal_Flux is what can be termed a “reduced-order model” (ROM) and is not intended as a full-functioning flow code. The theory and simulation in the code is streamlined and directed towards the implementation of Monte Carlo risk analyses of CO 2 transport or as termed in this context as “leakage.” While presented in this report as a stand-alone tool, the Seal_Flux code is intended to function in the future as one of several models as part of an integrated, systems-level model of CO 2 storage performance. Finally, the code is written in Python 3.10 to provide an open framework for further development by others and to assist in linking the code with other modules in an integrated assessment model.

58 GEOSCIENCES↗

VESIcal Part I: An open-source thermodynamic model engine for mixed volatile (H2O-CO2) solubility in silicate melts

Thermodynamics has been fundamental to the interpretation of geologic data and modeling of geologic systems for decades. However, more recent advancements in computational capabilities and a marked increase in researchers’ accessibility to computing tools has outpaced the functionality and extensibility of currently available modeling tools. Here we present VESIcal (Volatile Equilibria and Saturation Identification calculator): the first comprehensive modeling tool for H 2 O, CO 2 , and mixed (H 2 O-CO 2 ) solubility in silicate melts that: a) allows users access to seven commonly used models, plus easy inter-comparison between models; b) provides universal functionality for all models (e.g., functions for calculating saturation pressures, degassing paths, etc.); c) can process large datasets (1,000’s of samples) automatically; d) can output computed data into an excel spreadsheet for simple post-modeling analysis; e) integrates advanced plotting capabilities directly within the tool; and f) provides all of these within the framework of a python library, making the tool extensible by the user and allowing any of the model functions to be incorporated into any other code capable of calling python. The tool is presented within this manuscript, which is a Jupyter notebook containing worked examples accessible to python users with a range of skill levels. The basic functions of VESIcal can also be access via a web app (https://vesical.anvil.app). The VESIcal python library is open-source and available for download at https://github.com/kaylai/VESIcal.

K. Iacovino↗

Large language model evaluation for high–performance computing software development

We apply AI-assisted large language model (LLM) capabilities of GPT-3 targeting high-performance computing (HPC) kernels for (i) code generation, and (ii) auto-parallelization of serial code in C ++, Fortran, Python and Julia. Our scope includes the following fundamental numerical kernels: AXPY, GEMV, GEMM, SpMV, Jacobi Stencil, and CG, and language/programming models: (1) C++ (e.g., OpenMP [including offload], OpenACC, Kokkos, SyCL, CUDA, and HIP), (2) Fortran (e.g., OpenMP [including offload] and OpenACC), (3) Python (e.g., numpy, Numba, cuPy, and pyCUDA), and (4) Julia (e.g., Threads, CUDA.jl, AMDGPU.jl, and KernelAbstractions.jl). Kernel implementations are generated using GitHub Copilot capabilities powered by the GPT-based OpenAI Codex available in Visual Studio Code given simple + + prompt variants. To quantify and compare the generated results, we propose a proficiency metric around the initial 10 suggestions given for each prompt. For auto-parallelization, we use ChatGPT interactively giving simple prompts as in a dialogue with another human including simple “prompt engineering” follow ups. Results suggest that correct outputs for C++ correlate with the adoption and maturity of programming models. For example, OpenMP and CUDA score really high, whereas HIP is still lacking. We found that prompts from either a targeted language such as Fortran or the more general-purpose Python can benefit from adding language keywords, while Julia prompts perform acceptably well for its Threads and CUDA.jl programming models. Finally, we expect to provide an initial quantifiable point of reference for code generation in each programming model using a state-of-the-art LLM. Overall, understanding the convergence of LLMs, AI, and HPC is crucial due to its rapidly evolving nature and how it is redefining human-computer interactions.

97 MATHEMATICS AND COMPUTING↗

ENDFtk: A robust tool for reading and writing ENDF-formatted nuclear data

ENDFtk is a recently developed C++ and Python interface to interact with ENDF-6 formatted nuclear data files. It provides a robust and complete interface, allowing the reading and writing of all formats currently part of the ENDF-6 formats manual, as well as some non-ENDF formats used by the NJOY processing code. It provides an interface that mimics the names in the ENDF-6 formats manual as well as an equivalent interface using human-readable attribute names. It is robust and powerful enogh for nuclear data experts to develop complex applications, while also simple enough to be used non-experts to retrieve and manipulate evaluated nuclear data. ENDFtk offers the ability to easily interrogate and manipulate data either in large-scale code projects or in simple Python scripts. Here, in this paper, a brief overview of the interface is given, as well as more substantial examples demonstrating plotting simple data, interacting with more complex data, and writing new data to files. ENDFtk is open source and available for download via GitHub (https://github.com/njoy/ENDFtk).

97 MATHEMATICS AND COMPUTING↗

Development of Physics-Based Transition Models for Unstructured-Mesh CFD Codes Using Deep Learning Models

Predicting transition locations over a vehicle surface is of fundamental importance for many engineering applications. With the transition information, the Reynolds-averaged Navier-Stokes (RANS) computations can turn on the turbulence model at the right locations so that drag, lift and other aerodynamic quantities can be accurately predicted. In contrast to the popularity of RANS-based transition modeling in which transition onset is governed by the turbulence equations, physics-based transition models that account for instability waves within the boundary layer, thus more compliant to flow physics, only gained more attention in recent years. This paper describes the development of a new physics-based transition model based on either the linear stability theory (LST) or parabolized stability equations (PSE). The model is designed to communicate with a structured or unstructured-mesh RANS solver back and forth in order to more accurately compute transition fronts over a three-dimensional body. In the developed model, the Python suite of interface codes in conjunction with the LASTRAC software can be executed autonomously to produce transition onset locations for a given laminar or RANS-computed transitional state. In addition, as a proof of concept, the tool set consists of a deep learning neural network model that has been designed and trained to predict instability wave evolutions inside the boundary layer for various instability wave mechanisms across a selected speed range. A machine-learned intelligent profile interpolation model has also been devised to enable reliable instability-wave spectra predictions with just a few points in the mean flow profiles.

Transition Modeling↗

Scientific Computational Imaging Code (SCICO)

Scientific Computational Imaging Code (SCICO) is a Python package for solving the inverse problems that arise in scientific imaging applications. Its primary focus is providing methods for solving ill-posed inverse problems by using an appropriate prior model of the reconstruction space. SCICO includes a growing suite of operators, cost functionals, regularizers, and optimization routines that may be combined to solve a wide range of problems, and is designed so that it is easy to add new building blocks. SCICO is built on top of JAX rather than NumPy, enabling GPU/TPU acceleration, just-in-time compilation, and automatic gradient functionality, which is used to automatically compute the adjoints of linear operators. An example of how to solve a multi-channel tomography problem with SCICO is shown in Figure 1. The SCICO source code is available from GitHub, and pre-built packages are available from PyPI. It has extensive online documentation, including API documentation and usage examples, which can be run online at Google Colab and binder.

97 MATHEMATICS AND COMPUTING↗

PyAlbany: A Python interface to the C++ multiphysics solver Albany

Albany is a parallel C++ finite element library for solving forward and inverse problems involving partial differential equations (PDEs). In this paper we introduce PyAlbany, a newly developed Python interface to the Albany library. PyAlbany can be used to effectively drive Albany enabling fast and easy analysis and post-processing of applications based on PDEs that are pre-implemented in Albany. PyAlbany relies on the library PyBind11 to bind Python with C++ Albany code. Here we detail the implementation of PyAlbany and showcase its capabilities through a number of examples targeting a heat-diffusion problem. In particular we consider the following: (1) the generation of samples for a Monte Carlo application, (2) a scalability study, (3) a study of parameters on the performance of a linear solver, and finally (4) a tool for performing eigenvalue decompositions of matrix-free operators for a Bayesian inference application.

97 MATHEMATICS AND COMPUTING↗

Inputs, Outputs and Plotting Scripts for paper Extending near-axis equilibria in DESC

Python scripts and outputs from the DESC and pyQSC/pyQIC codes used to create the results in the paper "Extending near-axis equilibria in DESC". The contained README file has the details of which scripts create which figures, as well as on what versions of the codes were used. The repo also contains python pickle (.p) files and .txt files with the data used to create each figure (which are used by the plotting scripts).

DESC↗

Calculation of machine precision second order derivatives using dual-complex numbers

It is well known that both complex and dual numbers can be employed to obtain machine precision first-order derivatives; however, neither, on their own, can compute machine precision 2nd order derivatives. To address this limitation, it is demonstrated in this paper that combined dual-complex numbers can be used to compute machine precision 1st and 2nd order derivatives. The dual-complex approach is simpler than utilizing multicomplex or hyper-dual numbers as existing dual libraries can be used as is or easily augmented to accept complex numbers, and the complexity of developing, integrating, and deploying multicomplex or hyper-dual libraries is avoided. The efficacy of this approach is demonstrated for both univariate and multivariate functions. Finally, source code examples using the Python, Julia, and Mathematica languages are provided as supplemental material.

97 MATHEMATICS AND COMPUTING↗

Design workflow of a symmetric traveling wave antenna for fast ion production on DD tokamaks

Initial computational plasma physics scoping and a finite element method antenna modeling design workflow for a symmetric center-fed high-field side high harmonic fast wave traveling wave array (TWA) antenna are reported here. The TWA is designed to generate a test population of fast deuterium ions in an existing D–D tokamak by heating neutral beam deuterium ions, accelerating them from 80 keV to several hundred keV. The resulting fast particles are tailored to mimic key reactor energetic particle parameters with regards to exciting Alfven eigenmode instabilities, allowing for a D–D tokamak like DIII-D or ASDEX-U to replicate reactor-relevant conditions experimentally. Initial scenario scoping for high single-pass absorption as well as good preferential fast ion damping relative to electron damping was completed using the ray-tracing/Fokker–Planck codes GENRAY and CQL3D. Python RF network analysis packages were used to create a custom TWA optimization tool to inform a COMSOL flat antenna design, and Petra-M was used to study cold plasma effects. The TWA produced by this workflow has several novel features when compared to previous TWA studies, including symmetric center feeding, and passive end straps for image current cancellation for reduced impurity production. We show here that the antenna design workflow can readily produce TWA antennas optimized for reflection coefficient, image current cancellation, and launched power spectrum shape; and that a population of fast ions can be generated in the correct region of parameter space, warranting future more detailed studies.

70 PLASMA PHYSICS AND FUSION TECHNOLOGY↗

CEGANN: CRYSTAL EDGE GRAPH ATTENTION NEURAL NETWORK

SF-22-156 Machine learning (ML) models and applications in materials design and discovery typically involve the use of feature representations or descriptors followed by a learning algorithm that maps them to user desired properties of interest. Most popular mathematical formulation-based descriptors are not unique across atomic environments and suffer from transferability issues across different application domains and/or material classes. The CEGANN code provides a unified interface to facilitate material characterization across materials across multiple scales (from atomic to mesoscale) and diverse classes of materials ranging from metals oxides, non-metals, and even hierarchical materials such as zeolites and semi ordered materials such as mesophases. CEGANN implements a Graph Attention Network (GAT) type convolution architecture. The details of network architecture can be found in the paper https://doi.org/10.48550/arXiv.2207.10168. The software comes with pretrained examples and dataset for the classification of the following representative systems: (1) Structure-level representation such as space group (2) Structural dimensionality (e.g., bulk, 2D, clusters etc.) (3) Grain boundary identification (4) Nucleation and growth of a zeolite polymorph (5) Characterization of binary mesophases and their phase transitions (6) Growth of ice. The code is written in python programming language.

CHAN, HENRYT↗