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 271 records · Page 15

Statistical Mechanics on Lattices (smol) v0.0.1

smol is a Python implementation of the Cluster Expansion Method and extensions of this methodology; which is used to fit applied lattice models from first principle calculations for subsequent use in Monte Carlo simulations for computing thermodynamic and statistical properties of atomic configuration. smol has a several notable advantages over other similar software packages. The first being its Python implementation which makes it easy to use even for users with little software and coding skills. Despite being implemented in Python, essential Monte Carlo routines are implemented in Cython such that performance is not compromised and is competitive even to similar software implemented in C/C++. Furthermore, the package has specific functionality for handling complex ionic materials (such as cathodes and electrolytes) that is not readily available in other packages. Lastly, the software has a flexible and modular design with the intention of making it fast and efficient to develop and extend the methodology.

Barroso-Luque, Luis↗

Closed Loop Geothermal Working Group: GeoCLUSTER App, Subsurface Simulation Results, and Publications

To better understand the heat production, electricity generation performance, and economic viability of closed-loop geothermal systems in hot-dry rock, the Closed-Loop Geothermal Working Group -- a consortium of several national labs and academic institutions has tabulated time-dependent numerical solutions and levelized cost results of two popular closed-loop heat exchanger designs (u-tube and co-axial). The heat exchanger designs were evaluated for two working fluids (water and supercritical CO2) while varying seven continuous independent parameters of interest (mass flow rate, vertical depth, horizontal extent, borehole diameter, formation gradient, formation conductivity, and injection temperature). The corresponding numerical solutions (approximately 1.2 million per heat exchanger design) are stored as multi-dimensional HDF5 datasets and can be queried at off-grid points using multi-dimensional linear interpolation. A Python script was developed to query this database and estimate time-dependent electricity generation using an organic Rankine cycle (for water) or direct turbine expansion cycle (for CO2) and perform a cost assessment. This document aims to give an overview of the HDF5 database file and highlights how to read, visualize, and query quantities of interest (e.g., levelized cost of electricity, levelized cost of heat) using the accompanying Python scripts. Details regarding the capital, operation, and maintenance and levelized cost calculation using the techno-economic analysis script are provided. This data submission will contain results from the Closed Loop Geothermal Working Group study that are within the public domain, including publications, simulation results, databases, and computer codes. GeoCLUSTER is a Python-based web application created using Dash, an open-source framework built on top of Flask that streamlines the building of data dashboards. GeoCLUSTER provides users with a collection of interactive methods for streamlining the exploration and visualization of an HDF5 dataset. The GeoCluster app and database are contained in the compressed file geocluster_vx.zip, where the "x" refers to the version number. For example, geocluster_v1.zip is Version 1 of the app. This zip file also contains installation instructions. **To use the GeoCLUSTER app in the cloud, click the link to "GeoCLUSTER on AWS" in the Resources section below. To use the GeoCLUSTER app locally, download the geocluster_vx.zip to your computer and uncompress this file. When uncompressed this file comprises two directories and the geocluster_installation.pdf file. The geo-data app contains the HDF5 database in condensed format, and the GeoCLUSTER directory contains the GeoCLUSTER app in the subdirectory dash_app, as app.py. The geocluster_installation.pdf file provides instructions on installing Python, the needed Python modules, and then executing the app.

15 GEOTHERMAL ENERGY↗

Do Programmers Prefer Predictable Expressions in Code?

Source code is a form of human communication, albeit one where the information shared between the programmers reading and writing the code is constrained by the requirement that the code executes correctly. Programming languages are more syntactically constrained than natural languages, but they are also very expressive, allowing a great many different ways to express even very simple computations. Still, code written by developers is highly predictable, and many programming tools have taken advantage of this phenomenon, relying on language model surprisal as a guiding mechanism. Additionally, while surprisal has been validated as a measure of cognitive load in natural language, its relation to human cognitive processes in code is still poorly understood. In this paper, we explore the relationship between surprisal and programmer preference at a small granularity—do programmers prefer more predictable expressions in code? Using meaning-preserving transformations, we produce equivalent alternatives to developer-written code expressions and run a corpus study on Java and Python projects. In general, language models rate the code expressions developers choose to write as more predictable than these transformed alternatives. Then, we perform two human subject studies asking participants to choose between two equivalent snippets of Java code with different surprisal scores (one original and transformed). We find that programmers do prefer more predictable variants, and that stronger language models like the transformer align more often and more consistently with these preferences.

97 MATHEMATICS AND COMPUTING↗

The InSAR Scientific Computing Environment 3.0: A Flexible Framework for NISAR Operational and User-Led Science Processing

The InSAR Scientific Computing Environment (ISCE) was first developed under the NASA Advanced Information Systems Technology as a flexible, extensible object-oriented framework for Interferometric Synthetic Aperture Radar (InSAR) processing. The ISCE framework uses Python 3 at the workflow level, controlling modules of compiled code for functional processing, and managing inputs, outputs, and other flow control services. The currently released version, called ISCE 2.1, is distributed to the research community through the Western North America InSAR Consortium under a research license. The ISCE team is working on the next generation of the code in order to prepare for the NASAISRO SAR (NISAR) mission operational processing. Innovations in this code include augmentation or conversion of the custom Python framework elements in ISCE with the Pyre framework, new workflows for interferometric and polarimetric stack processing, a more intuitive and graphically based user interface, and flow control for hybrid computing environments including CPU/GPU clusters, logging and error tracking facilities, and new more efficient computational modules that exploit graphical processor units (GPUs) when available. The ISCE 3.0 framework is designed to work in an operational environment as well as on a single user’s laptop or compute cluster, with services to discover capabilities and scale computations accordingly.

Buckley, Sean M.↗

Vistransformers Explained

The Vistransformers Explained library is a collection of python notebooks that demonstrate the internal mechanics and uses of visual-transformer (ViT) machine learning models. The code implements, with mild modifications, ViT models that have been made publicly available through publication and GitHub code. The value added by this code is in-depth explanations of the mathematics behind the sub-modules of the ViT models, including original figures. Additionally, the library contains the code necessary to implement and train the ViT models. The library does not include example training data for the models; instead, it would rely on users generating their own datasets. The code is based on the PyTorch python library. It does not include any files other than python scripts, modules, or notebooks.

Callis, Skylar↗

Kamodo – An Adaptable Tool to Obtain and Compare Observations and Modeling Results

What is Kamodo? -Official NASA open-source project written in Python. -Building upon the functionalization of datasets. -It is a CCMC developed and maintained software tool for access, interpolation, and visualization of space weather models and data. -It allows model developers to represent simulation results as mathematical functions which may be manipulated directly by end users. -It handles unit conversion transparency and supports interactive science discovery through jupyter notebooks with minimal coding. -All Kamodo tools are accessible through Python, and all source code is publicly available on the Kamodo NASA GitHub repositories. -Kamodo does not generate model outputs. Users need to acquire the desired model outputs before they can be functionalized by Kamodo.

Kamodo↗

QuDPy: A Python-based tool for computing ultrafast non-linear optical responses

Nonlinear Optical Spectroscopy is a well-developed field with theoretical and experimental advances that have benefited multiple disciplines, including chemistry, biology, and physics. However, for the accurate interpretation of the corresponding multi-dimensional spectra, there is a need for precise quantum dynamical simulations based on model Hamiltonians. In this article, we present the initial release of our code, QuDPy (Quantum Dynamics in Python), which provides a robust numerical platform for performing quantum dynamics simulations based on model systems, including open quantum systems. Furthermore, a distinguishing feature of our approach is the ability to specify various high-order optical response pathways in the form of double-sided Feynman diagrams through a straightforward input syntax. This syntax outlines the time-ordering of ket-sided or bra-sided optical interactions acting on the time-evolving density matrix of the system. We utilize the quantum dynamics capabilities of QuTip to simulate the spectral response of complex systems, allowing us to compute virtually any $n$-th order optical response of the model system. To illustrate the utility of our approach, we provide a series of example calculations.

71 CLASSICAL AND QUANTUM MECHANICS, GENERAL PHYSIC↗

i- flow: High-dimensional integration and sampling with normalizing flows

In many fields of science, high-dimensional integration is required. Numerical methods have been developed to evaluate these complex integrals. We introduce the code i-flow, a python package that performs high-dimensional numerical integration utilizing normalizing flows. Normalizing flows are machine-learned, bijective mappings between two distributions. i-flow can also be used to sample random points according to complicated distributions in high dimensions. We compare i-flow to other algorithms for high-dimensional numerical integration and show that i-flow outperforms them for high dimensional correlated integrals. The i-flow code is publicly available on gitlab at https://gitlab.com/i-flow/i-flow.

72 PHYSICS OF ELEMENTARY PARTICLES AND FIELDS↗

PETSc/TAO Users Manual (Rev. 3.19)

This manual describes the use of the Portable, Extensible Toolkit for Scientific Computation (PETSc) and the Toolkit for Advanced Optimization (TAO) for the numerical solution of partial differential equations and related problems on high-performance computers. PETSc/TAO is a suite of data structures and routines that provide the building blocks for the implementation of large-scale application codes on parallel (and serial) computers. PETSc uses the MPI standard for all distributed memory communication. PETSc/TAO includes a large suite of parallel linear solvers, nonlinear solvers, time integrators, and opti mization that may be used in application codes written in Fortran, C, C++, and Python (via petsc4py; see Getting Started). PETSc provides many of the mechanisms needed within parallel application codes, such as parallel matrix and vector assembly routines. The library is organized hierarchically, enabling users to employ the level of abstraction that is most appropriate for a particular problem. By using techniques of object-oriented programming, PETSc provides enormous flexibility for users. PETSc is a sophisticated set of software tools; as such, for some users it initially has a much steeper learning curve than packages such as MATLAB or a simple subroutine library. In particular, for individuals without some computer science background, experience programming in C, C++, python, or Fortran and experience using a debugger such as gdb or lldb, it may require a significant amount of time to take full advantage of the features that enable efficient software use. However, the power of the PETSc design and the algorithms it incorporates may make the efficient implementation of many application codes simpler than “rolling them” yourself. For many tasks a package such as MATLAB is often the best tool; PETSc is not intended for the classes of problems for which effective MATLAB code can be written. There are several packages, built on PETSc, that may satisfy your needs without requiring directly using PETSc. We recommend reviewing these packages functionality before starting to code directly with PETSc. PETSc can be used to provide a “MPI parallel linear solver” in an otherwise sequential, or OpenMP parallel code. This approach cannot provide extremely large improvements in the application time by utilizing large numbers of MPI processes but can still improve the performance. Certainly all parts of a previously sequential code need not be parallelized but the matrix generation portion must be parallelized to expect true scalability to large numbers of MPI processes. See PCMPI for details on how to utilize the PETSc MPI linear solver server. Since PETSc is under continued development, small changes in usage and calling sequences of routines will occur. PETSc has been supported for twenty-five years; see mailing list information on our website for information on contacting support.

97 MATHEMATICS AND COMPUTING↗

Julia Programming Language Benchmark Using a Flight Simulation

Julia is a relatively new computer language that aims to reduce the challenge for mathmodelers to develop fast computer tools and simulations. It potentially combines the ease-of-coding feature of scripting languages (like Python) with the performance of compiled languages (like C++). A key question for Julia application to the simulation domain is, “Can Julia, with its obvious coding simplicity, provide runtime speeds comparable to conventional compiled languages for flight simulation?” A unique combination of existing elements can be employed to address the previous question: Extensively documented object-oriented simulation architecture, Industry standard rocket flight simulation, Separate versions (C++, Java, and Python) already benchmarked.

Sells, Ray↗

Orbit-averaging and deposition accuracy for runaway electron beams in hybrid kinetic-MHD simulations of the runaway plateau

We develop a new procedure that combines the kinetic orbit runaway electron code (KORC) and the NIMROD extended-magnetohydrodynamic code to simulate runaway electrons (REs) in the post-disruption plateau. KORC integrates guiding-center orbits, with a barycentric-based binary search strategy providing initial guesses for the Newton–Raphson logical-to-physical coordinate inversion, ensuring reliable particle-to-mesh mapping in NIMROD, whose fields remain static for the present study. Samples are drawn in accord with experimental parallel current profiles of RE beams during the plateau phase. Deposition in NIMROD is verified through comparison with a Python-based finite-element code that ensures periodicity in the poloidal direction and continuity at the magnetic axis. Accurate representation of near-axis fields requires finer mesh resolution to prevent under- and overshoots in current density from orbit inaccuracies. Yet, at a fixed particle count, increasing mesh resolution amplifies statistical noise in the deposited fields. An orbit-averaging method accumulates partial current deposits over multiple kinetic steps and reduces the statistical noise with little added computational cost. By coupling kinetic routines from KORC directly into the NIMROD codebase, these developments lay essential groundwork for future self-consistent KORC–NIMROD coupling.

Algorithms and data structure↗

Modeling, Performance Assessment, and Nodal Data Analysis of TRISO-Fueled Systems with Shift

This technical report documents several enhancements to the Shift Monte Carlo (MC) code under the US Department of Energy (DOE) Nuclear Energy Advanced Modeling and Simulation (NEAMS) program in fiscal year (FY) 2022. Performance enhancements were added to Shift specifically for tristructural isotropic (TRISO)–fueled reactor systems and guided based on performance analysis in FY 2021. For the pebble performance model developed in previous studies, the runtime improved by ~ 91× compared to the original model and ~ 2× compared to the user-optimized model. Compared to Serpent, Shift is ~ 3× slower if Serpent delta-tracking is enabled but ~ 2× faster when delta-tracking is disabled. The multigroup cross section generation was improved through simplifying tally input definitions, porting several post-processing tally operations from Python scripts into the Shift code base, and accounting for production reactions in the scattering multiplicity. Progress was also made on two emerging capabilities: (1) the development of Titan (a Shift reactor physics user interface) and (2) initial investigation into path-length tallies for computing multigroup scattering matrices.

11 NUCLEAR FUEL CYCLE AND FUEL MATERIALS↗

Convective Parameters Derived from Radiosonde Data (SONDEPARAM) Value-Added Product Report

Radiosondes provide fundamental observations of the vertical profile of atmospheric state (pressure, temperature, humidity, and winds), with important implications for subsequent studies on environmental controls on cloud conditions. Within convective cloud environments, there is an increasing demand for additional value-added products (VAPs) to facilitate the use of U.S. Department of Energy Atmospheric Radiation Measurement (ARM) user facility radiosonde data sets. Such VAPs should provide quick and reliable estimates for several standard radiosonde parameters or quantities of interest using common assumptions, as well as open, flexible code for visualization and user interaction. The Convective Parameters Derived from Radiosonde Data (SONDEPARAM) VAP will apply several robust algorithms used in Wang et al. (2020) for the calculation of useful radiosonde convective cloud parameters, including the convective available potential energy (CAPE), convective inhibition (CIN), and other convective parameters, for several different assumptions regarding the initial parcel characteristics (i.e., surface-based, most unstable, mixed layer). These ARM VAP codes are developed in open, flexible Python formats, with the intention that these parameters/calculations will be incorporated into traditional ARM quick-look radiosonde plotting, yet associated with user-available codes for ease in user reproduction and assumption modification.

54 ENVIRONMENTAL SCIENCES↗

Evaluation of a collisional radiative model for electron temperature determination in hydrogen plasma

A collisional-radiative (CR) model that extracts the electron temperature, T e , of hydrogen plasmas from Balmer-line-ratio measurements is examined for the plasma electron density, n e , and T e ranges of 10 10 –10 15 cm –3 and 5–500 eV, respectively. The CR code, developed and implemented in Python, has a forward component that computes the densities of excited states up to n = 15 as functions of T e , n e , and the molecular-to-atomic neutral ratio r(H 2 /H). The backward component provides ne and r(H 2 /H) as functions of the Balmer ratios to predict the T e . The model assumes Maxwellian electrons. Furthermore, the density profiles of the electrons and of the molecular and atomic hydrogen neutrals are shown to be of great importance, as is the accuracy of the line-ratio measurement method.

70 PLASMA PHYSICS AND FUSION TECHNOLOGY↗

labquake_future_prediction

The labquake_future_prediction code is a collection of python modules and scripts that serves as supporting information for the article “Predicting future laboratory fault friction through deep learning” for publication in the journal of “Geophysical Research Letters”. It is designed to predict laboratory fault slips in the immediate future by scanning continuous acoustic emission (AE) waveforms recorded in laboratory biaxial shear experiments. The predictions are made with a deep learning model based on convolutional encoder-decoder (CED) models and the Transformer model primarily developed for Natural Language Processing (NLP). The deep learning model is trained with the tensorflow package using publicly available laboratory data sets in standard binary file format in numpy. The utility functions for reading data files, configuring model hyperparameters, constructing the CED and Transformer models, training and testing of the models are defined in python module files. The workflow of training the models for labquake future predictions and the multiple GPU’s rapid model hyperparameter optimization as described in the journal article, are demonstrated in accompanying python script files and Jupyter notebooks.

Wang, Kun↗

Control And Optimization Modular Modeling Application For Nuclear Deployment

The purpose of the COMMAND code is to provide a flexible, scalable tool for use in developing, integrating, and testing the technologies necessary for achieving autonomous operations of advanced nuclear reactors. The code enables users to efficiently implement custom simulations and experiments by combining key methods from different software modules. These modules are focused on: modeling and simulation tools, such as nuclear simulation tools used for high-fidelity modeling (e.g., Reactor Excursion and Leak Analysis Program [RELAP5-3D] and Monte Carlo N-Particle [MCNP]); machine learning and optimization tools (e.g., anomaly detection and data-driven modeling techniques); advanced control in its digital, high-performance, and supervisory control forms (e.g., proportional integral derivative (PID) control and model predictive control (MPC); and integration with hardware through industrial communication protocols. To ensure flexibility and scalability, COMMAND was designed to be both modular—the software “pieces” all inherit from generic building blocks and can be combined and connected to create complicated simulations—and high performing—designed for parallel processing, enabling simulations and experiments to take advantage of multi-core computers, servers, and nodes. The code is written in the Python programming language due to the language's popularity, active community, and open-source and cross-platform nature. Maintaining consistency with other simulation tools used within the nuclear energy community, users implement simulations and experiments through text input files, which define components, parameters, connections, etc., through lines of text. Given that COMMAND is written in Python, these input files are native Python scripts, and so use the standard Python structure and formatting. This also enables users to take advantage of Python's extensive package library to develop custom capabilities for their specific use cases.

Faber, Jacob [Idaho National Laboratory (INL), Ida↗

Emulsion droplets detection suite

The code is a set of Python libraries/scripts that leverage open source computer vision packages like YOLO and SAM2 to identify emulsion droplets in plate reader images and videos of microfluidic device flows.

Reddy, Tyler [LANL]↗

matsim-agents v1.0

matsim-agents is a multi-agent AI framework for atomistic materials simulation and discovery. It orchestrates large language models (LLMs), machine-learned interatomic potentials (MLIPs), and DFT codes into a single agentic loop running on laptops and DOE leadership-class supercomputers. MULTI-AGENT ORCHESTRATION A LangGraph state machine with three nodes: a Planner that converts a natural-language research objective into structured tasks; an Executor that dispatches atomistic tools and loops until the queue is empty; and an Analyst that summarizes results into a human-readable report. State is checkpointed after every step and human-in-the-loop gates can be inserted at any edge. HYPOTHESIS-DRIVEN DISCOVERY CHAT An interactive REPL (matsim-agents chat) that couples LLM dialogue with atomistic simulation. Chemical formulas are automatically detected in conversation turns and trigger a full crystal-phase exploration: structure generation → relaxation → stability scoring → result injection back into the conversation, creating a closed hypothesis-refinement loop. CRYSTAL PHASE ENUMERATION Given a composition, the phase explorer enumerates prototypes by stoichiometry: elemental (fcc/bcc/hcp/sc/diamond), binary 1:1 (rocksalt/CsCl/zincblende/ wurtzite/fluorite/rutile), ternary 1:1:3 (cubic perovskite), ternary 1:2:4 (perovskite + spinel), quaternary 1:1:2:6 (Fm-3m double perovskite). 2-D prototypes (graphene, h-BN, MoS2 2H/1T) and multilayer stacking are also supported via --include-2d and --num-layers. SUPERCELL GENERATION AND SITE DECORATION Auto-tiling to a minimum atom count (--min-atoms), explicit NxNxN tiling (--supercell), symmetry-distinct site decorations (--n-orderings), and isotropic lattice-scale sweeps (--lattice-scales) for volume bracketing. MLFF RELAXATION AND STABILITY SCORING HydraGNN (multi-headed GNN) drives structure relaxation via ASE with FIRE, BFGS, or BFGSLineSearch. Stability output: delta-E/atom ranking across phases and a max-residual-force dynamical-stability proxy. Other MLIPs (MACE, NequIP, Orb) can be plugged in through the same interface. DFT BACKENDS Quantum ESPRESSO pw.x and VASP 6.6 are first-class labellers. Both have validated GPU builds and SLURM/PBS launchers for three DOE platforms: Frontier (AMD MI250X, ROCm), Aurora (Intel PVC, oneAPI), Perlmutter (NVIDIA A100, CUDA). QE produces ~100 binaries (pw.x, ph.x, epw.x, ...). VASP supports scf, relax, vc-relax, and vc-relax-shape run types. ACTIVE-LEARNING LOOP matsim-agents al run CONFIG.yaml drives an iterative HydraGNN-DFT loop: MD generates candidates → ensemble/MC-dropout uncertainty selects the most informative → DFT labels them in parallel inside one allocation → dataset grows → HydraGNN retrains → repeat. DFT backend is a single YAML toggle (dft.backend: vasp | qe). LLM-generated seed structures are supported (no curated POSCAR library needed). Config uses ${VAR}, ${VAR:-default}, ${VAR:?msg} shell-style substitution for cross-user/cross-site portability. LLM BACKENDS Ollama (local, default), vLLM (HPC multi-GPU serving), OpenAI, Anthropic, HuggingFace Transformers+Accelerate. Selected at runtime via flag or env var with no code changes. HPC PORTABILITY Same Python entry points run on Frontier (ROCm 7.2), Aurora (oneAPI), and Perlmutter (CUDA 12). DFT and ML stacks are never co-loaded in the same shell; they couple through the scheduler and filesystem. Advanced multi-node launchers (serve, discovery-chat, single-relaxation, active-learning, QE warm-start) are provided for all three platforms. CODABENCH COMPETITION BUNDLE A self-contained benchmark: 159 atomistic test structures across 11 material classes, 5 tasks (formation energy, forces, ML relaxation, AI-DFT relaxation, phase stability ranking), public/private leaderboard split (30/70), and four ready-to-run baselines: MACE-MP-0, HydraGNN, UMA, AllScAIP.

Lupo Pasini, Massimiliano [Oak Ridge National Labo↗