Search NASASearch

SEARCH · Search NASA

Results for “Python”

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 55 records · Page 3

DRDMannTurb: A Python package for scalable, data-driven synthetic turbulence

Synthetic turbulence models (STMs) are used in wind engineering to generate realistic flow fields and are employed as inputs to industrial wind simulations. Examples include prescribing inlet conditions in large eddy simulations that model loads on wind turbines and tall buildings. We are interested in STMs capable of generating fluctuations based on prescribed second-moment statistics since such models can simulate environmental conditions that closely resemble on-site observations. To this end, the widely used Mann model (see Mann, 1994, 1998) is the inspiration for DRDMannTurb. The Mann model is described by three physical parameters: a magnitude parameter influencing the global variance of the wind field and corresponding to the Kolmogorov constant multiplied by the rate of viscous dissipation of the turbulent kinetic energy to the two-thirds, αϵ 2/3 , a turbulence length scale parameter L, and a nondimensional parameter Γ related to the lifetime of the eddies. A number of studies, as well as international standards (e.g., those by the International Electrotechnical Commission (IEC)), include recommended values for these three parameters with the goal of standardizing wind simulations according to observed energy spectra. Yet, having only three parameters, the Mann model faces limitations in accurately representing the diversity of observable spectra. This Python package enables users to extend the Mann model and more accurately fit field measurements through flexible neural network models of the eddy lifetime function. Following Keith et al. (2021), we refer to this class of models as Deep Rapid Distortion (DRD) models. DRDMannTurb also includes a general module implementing an efficient method for synthetic turbulence generation based on a domain decomposition technique. This technique is also described in Keith et al. (2021).

17 WIND ENERGY

popclass: A Python Package for Classifying Microlensing Events

popclass is a Python package that provides a flexible, probabilistic framework for classifying the lens of a gravitational microlensing event. Gravitational microlensing occurs when a massive foreground object (e.g., a star, white dwarf or black hole) passes in front of and lenses the light from a distant background source. This causes an apparent brightening, and shift in position, of the background source. In most cases, characteristics of the microlensing signal do not contain enough information to definitively identify the lens type. Different lens types lie in different but overlapping regions of the characteristics of the microlensing signal. For example, black holes tend to be more massive than stars and therefore cause microlensing signals that are longer. Current Galactic simulations enable us to predict where different lens types lie in the observational space and can therefore be used to classify events (e.g., Lam et al., 2020). popclass allows the user to match the characteristics of a microlensing signal with a simulation of the Galaxy to calculate lens type probabilities for the event (see Figure 1). Constraints on any microlensing signal properties and any Galactic model can be used. popclass comes with an interface to ArviZ (Kumar et al., 2019) and PyMultiNest (Buchner et al., 2014) for microlensing signal constraints, as well as pre-loaded Galactic models, plotting functionality, and methods to quantify the classification uncertainty. The probabilistic framework for popclass was developed in Perkins et al. (2024), used in Fardeen et al. (2024) and has been applied to classifying events in Kaczmarek et al. (2025).

97 MATHEMATICS AND COMPUTING

AutoUncertainties: A Python Package for Uncertainty Propagation

Propagation of uncertainties is of great utility in the experimental sciences. While the rules of (linear) uncertainty propagation are straightforward, managing many variables with uncertainty information can quickly become complicated in large scientific software stacks. Often, this requires programmers to keep track of many variables and implement custom error propagation rules for each mathematical operator and function. The Python package AutoUncertainties, described here, provides a solution to this problem.

97 MATHEMATICS AND COMPUTING

Virtual Engineering: Python framework for engineering process design

Virtual Engineering (VE) is a Python software framework designed to accelerate the research and development of engineering processes that are fundamentally defined by multiple unit operations executed in series. VE supports a wide variety of different multi-physics models and integrates them to simulate a complete end-to-end process. To automate the execution of this model sequence, VE provides (i) a robust method to communicate between models, (ii) a high-level, user-friendly interface to set model parameters and enable optimization, and (iii) an overall model-agnostic approach that allows new computational units to be swapped in and out of workflows. Although the VE framework was developed to support the biochemical conversion of biomass to fuel, we have designed each component to easily accommodate new domains and unit models.

09 BIOMASS FUELS

Pore2Chip: All-in-one python tool for soil microstructure analysis and micromodel design

The Pore2Chip Python package is designed to create 2D micromodels using extracted data from 3D X-ray computed tomography (XCT) images. This package helps analyze soil structure and function, allowing for the investigation of hydro-biogeochemical processes that impact mineral extraction and reactivity, oxygen concentrations, and nutrient availability in disturbed or managed soils. Key metrics encompass pore size distributions, pore throat size distributions, and connectivity (pore coordination numbers). The final output is a 2D scalable SVG design representing a core or aggregate. Designs can be fabricated with methods such as laser etching, 3D printing, and photolithography.

lab-on-chip

pyTCR: A tropical cyclone rainfall model for python

pyTCR is a climatology software package developed in the Python programming language. It integrates the capabilities of several legacy physical models and increases computational efficiency to allow rapid estimation of tropical cyclone (TC) rainfall consistent with the large-scale environment. Specifically, pyTCR implements a horizontally distributed and vertically integrated model [Zhu et al., 2013] for simulating rainfall driven by TCs. Along storm tracks, rainfall is estimated by computing the cross-boundary-layer, upward water vapor transport caused by different mechanisms including frictional convergence, vortex stretching, large-scale baroclinic effect (i.e., wind shear), topographic forcing, and radiative cooling [Lu et al., 2018]. The package provides essential functionalities for modeling and interpreting spatio-temporal TC rainfall data. pyTCR requires a limited number of model input parameters, making it a convenient and useful tool for analyzing rainfall mechanisms driven by TCs. To sample rare (most intense) rainfall events that are often of great societal interest, pyTCR adapts and leverages outputs from a statistical-dynamical TC downscaling model [Lin et al., 2023] capable of rapidly generating a large number of synthetic TCs given a certain climate. As a result, pyTCR significantly reduces computational effort and improves the efficiency in capturing extreme TC rainfall events at the tail of the distributions from limited datasets. Furthermore, the TC downscaling model is forced entirely by large-scale environmental conditions from reanalysis data or coupled General Circulation Models (GCMs), simplifying the projection of TC-induced rainfall and wind speed under future climate using pyTCR. Finally, pyTCR can be coupled with hydrological and wind models to assess risks associated with independent and compound events (e.g., storm surges and freshwater flooding).

54 ENVIRONMENTAL SCIENCES

solposx: A Python package for determining solar position and atmospheric refraction

solposx is a Python package of reference algorithms for calculating the sun’s position and atmospheric refraction. The package includes 11 solar position algorithms and 6 refraction models from the past 50 years. All functions follow a standardized design pattern, making it easy to compare different algorithms. The provided algorithm implementations have been thoroughly vetted, making the package a valuable research tool and a reliable reference for implementing solar position algorithms in other programming languages or applications.

Jensen, Adam R. [Technical University of Denmark,

PyDislocDyn: A Python code for calculating dislocation drag and other crystal properties

PyDislocDyn is a suite of python programs designed to perform various calculations for dislocation dynamics in the continuum limit. In particular, one of its main purposes is to calculate dislocation drag from phonon wind. Additional features include the averaging of elastic constants for polycrystals, the calculation of the dislocation field including its limiting velocities, and the calculation of dislocation self-energy and line tension.

36 MATERIALS SCIENCE

Raptor: A Python Library for Porosity Predictions in Additive Manufacturing

Raptor is an efficient Python library for simulating stochastic lack-of-fusion (sLoF) defects in additive manufacturing (AM) processes. These defects arise from stochastic variations in the melt pool boundary leading to undermelting from insufficient overlap between adjacent melt pools or successive layers (Grasso & Colosimo, 2017; Khairallah et al., 2016). Performance variability of AM parts is a pressing challenge in qualification and certification of AM parts; this is in part due to the poorly understood formation rate and statistics of sLoF defects. Raptor is designed to capture the explicit morphologies of sLoF defects and their statistics to accelerate qualification and certification efforts of AM parts in critical applications.

Subraveti, Vamsi [Vanderbilt University]

SULI Deliverables Using: Python-B1500 [Slides]

A new electrical setup for testing ECRAM devices is described in this presentation. This presentation details the background of ECRAM devices, how the B1500 is used to program ECRAM devices, and the python GUI that was created for controlling the B1500. ECRAM devices are a form of non-volatile memory. The stored data is the resistance between two of the terminals on the device. Using only the B1500, the ECRAM devices can be programmed and the state read out. This creates a simple, logical testing setup. The overall setup was successful, ECRAM devices could easily be programmed and measured. However, there is still room for improvement. Specifically, in the creation of an automated “Program” feature and a “Data Collection” feature. These features will require additional advances in the understanding of ECRAM devices but will greatly automate and improve the current data collection and application of ECRAM devices.

42 ENGINEERING

De-Risking Exploration for Geothermal Plays in Magmatic Environments Through Open-Source Tools: An Open-Source Python Framework for 2D and 3D Play Fairway Analysis

The De-Risking Exploration for Geothermal Plays in Magmatic Environments (DEEPEN) project seeks to accelerate superhot geothermal development by reducing exploration risk through advanced open-source modeling tools. This work presents a novel Python-based framework, geoPFA, for conducting 2D and 3D play fairway analysis (PFA) tailored to superhot geothermal systems. Building on previous methodologies, the framework integrates thermo-hydro-mechanical-chemical simulation outputs from TReactMech, resulting in improved representation of subsurface properties that are critical to superhot resource producibility. The workflow has been applied to the Nesjavellir field in Iceland, a candidate site for the third Iceland Deep Drilling Project's superhot production scenarios. This application demonstrates the value of modular, transparent, and extensible workflows for integrating geological, geophysical, and simulation-derived datasets in high-enthalpy environments. Preliminary results indicate favorable zones consistent with known hydrothermal activity and suggest possible upflow from the Hengill volcanic system. The geoPFA library is publicly available, offering a scalable and reproducible approach to geothermal exploration across varied geological contexts.

15 GEOTHERMAL ENERGY

geoPFA: A Python-Based Open-Source Software for 3D Geothermal PFA

This work presents a novel Python-based framework, geoPFA, for conducting 3D play fairway analysis (PFA) tailored to superhot geothermal systems. The workflow has been applied to the Nesjavellir field in Iceland, a candidate site for the third Iceland Deep Drilling Project's superhot production scenarios. This application demonstrates the value of modular, transparent, and extensible workflows for integrating geological, geophysical, and simulation-derived datasets in high-enthalpy environments. Preliminary results indicate favorable zones consistent with known hydrothermal activity. The geoPFA library will soon be publicly available, offering a scalable and reproducible approach to geothermal exploration across varied geological contexts.

15 GEOTHERMAL ENERGY

Mahakala: A Python-based Modular Ray-tracing and Radiative Transfer Algorithm for Curved Spacetimes

We introduce Mahakala, a Python-based, modular, radiative ray-tracing code for curved spacetimes. We employ Google's JAX framework for accelerated automatic differentiation, which can efficiently compute Christoffel symbols directly from the metric, allowing the user to easily and quickly simulate photon trajectories through non-Kerr spacetimes. JAX also enables Mahakala to run in parallel on both CPUs and GPUs. Mahakala natively uses the Cartesian Kerr–Schild coordinate system, which avoids numerical issues caused by the pole in spherical coordinate systems. We demonstrate Mahakala's capabilities by simulating 1.3 mm wavelength images (the wavelength of Event Horizon Telescope observations) of general relativistic magnetohydrodynamic simulations of low-accretion rate supermassive black holes. The modular nature of Mahakala allows us to quantitatively explore how different regions of the flow influence different image features. We show that most of the emission seen in 1.3 mm images originates close to the black hole and peaks near the photon orbit. We also quantify the relative contribution of the disk, forward jet, and counterjet to 1.3 mm images.

79 ASTRONOMY AND ASTROPHYSICS

Full-sky Models of Galactic Microwave Emission and Polarization at Subarcminute Scales for the Python Sky Model

Polarized foreground emission from the Galaxy is one of the biggest challenges facing current and upcoming cosmic microwave background (CMB) polarization experiments. We develop new models of polarized Galactic dust and synchrotron emission at CMB frequencies that draw on the latest observational constraints; that employ the “polarization fraction tensor” framework to couple intensity and polarization in a physically motivated way; and that allow for stochastic realizations of small-scale structure at subarcminute angular scales currently unconstrained by full-sky data. We implement these models into the publicly available Python Sky Model (PySM) software and additionally provide PySM interfaces to select models of dust and CO emission from the literature. We characterize the behavior of each model by quantitatively comparing it to observational constraints in both maps and power spectra, demonstrating an overall improvement over previous PySM models. Finally, we synthesize models of the various Galactic foreground components into a coherent suite of three plausible microwave skies that span a range of astrophysical complexity allowed by current data. Author contributions to this paper can be found at the end of this work.

Group, The Pan-Experiment Galactic Science

Smokescreen: A Python package for data vector blinding and encryption in cosmological analyses

Smokescreen is an open-source Python library for data-vector concealment (blinding) in cosmological analyses. Data-vector blinding works by applying cosmology-dependent shifts to the observed data vector, moving it away from the true cosmological signal without affecting its statistical properties, so that analysts cannot infer the true result until the analysis is frozen and the blinding is lifted. The package computes these shifts using Firecrown likelihoods applied to data vectors stored in the SACC format, ensuring that the theoretical model used for blinding is identical to that used for inference whilst remaining agnostic to the specific observable being blinded. To prevent accidental unblinding, the original SACC file, containing the true cosmology, is encrypted. Although developed for the Vera C. Rubin Observatory Legacy Survey of Space and Time (LSST), Smokescreen is applicable to any experiment using Firecrown likelihoods and the SACC data format.

Loureiro, Arthur [Stockholm U., OKC; Imperial Coll

PV Systems Modelling with Python

PVSC tutorial demonstrating how to download irradiance data and sun position for a specific location, determine the orientation of a single-axis tracker system, calculate Plane of Array irradiance, and estimate the power output of a PV system.

14 SOLAR ENERGY

MontePy: a Python library for reading, editing, and writing MCNP input files.

The Monte Carlo N-Particle (MCNP) radiation transport code is a highly capable and accurate code with a long legacy. MCNP uses the Monte Carlo simulation process to simulate the path of particles (e.g., neutrons, photons, charged particles, etc.), and their interaction with materials. It is widely used in nuclear engineering, high-energy physics, and other fields. Its origins in the mid-twentieth century predate many modern software conventions. MCNP users provide an input file to MCNP, which it then uses to create an internal representation of the simulation problem. These input files originally had to be stored as punchcard decks, and the user manual still uses the terminology of cards and decks, despite moving beyond punchcards. MCNP predates nearly all modern human readable markup or data serialization languages, such as the extensible Markup Language (XML), the Standard Generalized Markup Language (SGML), YAML (YAML Ain’t Markup Language), and Javascript Object Notation (JSON). Due to this, MCNP uses an entirely custom defined syntax language for its input, making off-the-shelf libraries for XML, YAML, and JSON impossible to use for scripting various operations on MCNP input files (Kulesza et al., 2022).

97 - MATHEMATICS AND COMPUTING

Integration of a grey-box refrigerated case model in EnergyPlus via Python plugin

Commercial buildings, in particular grocery stores (due mainly to their large refrigeration load), provide opportunities for energy cost reductions. Grocery stores could offer substantial load flexibility to the power grid through participation in demand response programs because of their usage patterns and relatively high energy intensity. This load flexibility could come from modifying the control of heating, ventilation, and air conditioning (HVAC) systems, refrigeration systems, or both. Although estimation of the HVAC system’s load flexibility potential is relatively targeted in the literature, estimating load flexibility of refrigeration systems is nascent and has been a challenge, in part because of the lack of proper simulation tools that capture the dynamics in the refrigeration cases. The existing refrigerated case model within EnergyPlus, a whole building energy simulation program, assumes a constant case temperature throughout the simulation period and does not explicitly model the cycling of the compressor serving the refrigerated case. In addition, it does not encompass modeling of temperatures of the product inside the refrigerated case. This difference between modeled and actual operation can be a barrier to the development of demand control algorithm and accurate analysis of load flexibility potential. In this paper, we present a grey-box model for modeling refrigerated cases in grocery stores, which include medium temperature and low temperature. Four cases are modeled; two are low-temperature closed cases and two are medium-temperature cases with one closed and one open. Data from an experimental facility are used to train and test the models. Results demonstrate the efficacy of the grey-box models in predicting the temperatures. This model is integrated into EnergyPlus to capture the dynamic effects of case temperature on the environment and enhance the calculation of sensible and latent heat exchange with the environment (case credits). These enhancements can be leveraged more broadly to model advanced refrigeration controls such as defrost, develop and test unique algorithms that could affect refrigeration interactions with HVAC, and refine store design for any commercial building with refrigeration.

29 ENERGY PLANNING, POLICY, AND ECONOMY