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 19 records

Python codes for the paper - "Trade-offs in the latent representation of microstructure evolution"

SAND2024-00946O Python codes used in "Trade-offs in the latent representation of microstructure evolution," a manuscript accepted for publication in Acta Materialia, are part of a repository. The code was developed to perform analysis of microstructure evolution. The repository consists of two main directories: models, which train and test models such as autoencoders and diffusion maps, and analysis, which analyzes microstructures. Source code is used to perform dimensionality reduction of microstructure data for analysis of its evolution in time. Sandia National Laboratories is a multimission laboratory managed and operated by National Technology & Engineering Solutions of Sandia, LLC, a wholly owned subsidiary of Honeywell International Inc., for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-NA0003525.

Dingreville, Remi↗

MLtool Python Code

Machine Learning (ML) is a subfield of Artificial Intelligence that gives computers the ability to learn from past data without being explicitly programmed. The predictive capabilities of ML models have already been used to facilitate several scientific breakthroughs. However, the practical application of ML is often limited due to the gaps in technical knowledge of its users. The common issue faced by many scientific researchers is the inability to choose the appropriate ML pipelines that are needed to treat real-world data, which is often sparse and noisy. To solve this problem, we have developed an automated Machine Learning tool (MLtool) that includes a set of ML algorithms and approaches to aid scientific researchers. The current version of MLtool is implemented as an object-oriented Python code that is easily extensible. It includes 44 different regression algorithms used to model data. MLtool helps users select the best model for their data, based on the scoring metrics used. Besides regression algorithms, MLtool also includes a suite of pre- and post-processing techniques such as missing value imputation, categorical variable encoding, input feature normalization, uncertainty quantification, exploratory data analysis (EDA), etc. MLtool was tested on several publicly available multi-dimensional data sets and was found capable of making accurate predictions.

Machine Learning↗

Identification of Novel Microcystins Using High-Resolution MS and MS n with Python Code

Cyanotoxins called microcystins (MCs) are highly toxic and can be present in drinking water sources. Determining the structure of MCs is paramount because of its effect on toxicity. Though over 300 MC congeners have been discovered, many remain unidentified. In this work, a method is described for the putative identification of MCs using liquid chromatography (LC) coupled with high-resolution (HR) Orbitrap mass spectrometry (MS) and a new bottom-up sequencing strategy. Maumee River water samples were collected during a harmful algal bloom and analyzed by LC–MS with simultaneous HRMS and MS/MS. Unidentified ions with characteristic MC fragments (135 and 213 m/z) were recognized as possible novel MC congeners. An innovative workflow was developed for the putative identification of these ions. Python code was written to generate the potential structures of unidentified MCs and to assign ions after the fragmentation for structural confirmation. The workflow enabled the putative identification of eight previously reported MCs for which standards are not available and two newly discovered congeners, MC-HarR and MC-E(OMe)R.

54 ENVIRONMENTAL SCIENCES↗

Improving the Estimation of the Atmospheric Water Vapor Pressure Using Interpretable Long Short-Term Memory Networks: Dataset, Python code, and trained models

Atmospheric water vapor pressure is an essential meteorological control on land surface and hydrologic processes. It is not as frequently observed as other meteorologic conditions, but often inferred through the August–Roche–Magnus formula by simply assuming dew point and daily minimum temperatures are equivalent or by empirically correlating the two temperatures using an aridity correction. The performance of both methods varies considerably across different regions and during different time periods; obtaining consistently accurate estimates across space and time remains a great challenge. We applied an interpretable Long Short-Term Memory (iLSTM) network conditioned on static, location specific attributes to estimate daily vapor pressure for 83 FLUXNET sites in the United States and Canada. This data package includes all raw data of the 83 FLUXNET sites, input data for model training/validation/test, trained models and results, and python codes for the manuscript "Improving the Estimation of the Atmospheric Water Vapor Pressure Using an Interpretable Long Short-term Memory Network". Specifically, it consists of five parts. - First, "1_Daymet_data_83sites.zip" includes raw data downloaded from Daymet for the 83 sites used in the paper according to their longitude and latitude, in which vapor pressure is used. It also includes a pre-processed CSV data file combining all data from the 83 sites which is specifically used for the paper. - Second, "2_Fluxnet2015_data_83sites.zip" includes raw half hourly data of the 83 sites downloaded from FLUXNET2015 data portal, pre-processed daily data of the 83 sites, a CSV file including combined pre-processed daily data of the 83 sites, and a CSV file including the information (site ID, site name, latitude, longitude, data available period) of the 83 sites. - Third, "3_MODIS_LAI_data_83sites_raw.zip" includes raw leaf area index (LAI) data downloaded from the AppEEARs data portal. - Fourth, "4_Scripts.zip" includes all scripts related to model training and post-processing of a trained model, and a jupyter notebook showing an example for model post-processing. Two typo errors in files titled "run2get_args.py" and "postprocess.py" were corrected on March 27, 2024 to avoid confusions. - Finally, "Trained_models_and_results.zip" includes three folders and three files with suffix ".npy", and each folder corresponds to one file with suffix ".npy" with the same title. Each of the three folders include all trained models associated with one iLSTM model configuration (35 models for each configuration, details are described in the paper). Each file with suffix ".npy" includes the post-processed results of the corresponding 35 models under one iLSTM model configuration.

54 ENVIRONMENTAL SCIENCES↗

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↗

Cryogenics Python Coding Calculations for Nitrogen & Helium Loss

Helium and Nitrogen are two significant chemical elements that are used to advance cryogenic scientific breakthroughs. Helium is a colorless, odorless, and tasteless gas that becomes liquid at (−452 °F). Nitrogen is a gas at its standard conditions; It becomes solid once temperatures reach below (-346 °F), and it boils and becomes a gas once temperatures reach above (-320 °F). During this research project I used a web-based interactive computing platform called Jupyter Lab to modify various python programs that calculate, and display helium and nitrogen inventory lost from three cryo plants

72 PHYSICS OF ELEMENTARY PARTICLES AND FIELDS↗

Ectomycorrhizal effects on decomposition are highly dependent on fungal traits, climate, and litter properties: A model-based assessment. Dataset.

To simulate the effects of mycorrhizal fungi on soil organic matter cycling, we incorporated mycorrhizal processes into the Carbon, Organisms, Rhizosphere, and Protection in the Soil Environment (CORPSE) model to develop a new soil model Myco-CORPSE. The new model was calibrated and evaluated against soil measurements taken at temperate forests in New Hampshire (NH) and Georgia (GA). A series of scenario analysis were also conducted to explore the conditions under which ectomycorrhizal (ECM) N acquisition processes can induce different soil C accumulation in ECM systems compared to arbuscular (AM) systems.In this data package, we included:-The Python codes of the standard Myco-CORPSE model we developed: "Standard Myco_CORPSE python codes.zip". The main program is the "gradient_sim.py" which calculates the bulk soil microbes and CN content along a user defined gradient of clay, soil temperature, soil moisture and mycorrhizal dominance, and relies on two subprograms "CORPSE_deriv.py" and "CORPSE_integrate.py". "CORPSE_deriv.py" calculated the changes in all simulated soil stock within every time step and "CORPSE_integrate.py" integrate the changes in all simulated soil stock within simulated time period. The program "Plot.py" is used to plot the major outputs produced by the main program "gradient_sim.py".-The modified Python codes of Myco-CORPSE models with site-level environmental inputs (in NH and GA) used to conduct simulations in NH and GA sites: "NH_GA model simulations.zip". -The Python codes used to evaluate the Myco-CORPSE simulation outputs in NH and GA sites against site-level measurements: "Plot NH_GA simulation against measurements.zip". It includes both the evaluation Python code, the model outputs on NH and GA sites, and the measured soil properties in both sites.-The modified Python codes of Myco-CORPSE models "Scenario analysis_model simulations.zip" that is used to conduct scenario analysis of how different litter properties, mycorrhizal fungal traits, climate, and seasonal variation in temperature and vegetation phenology impact the mycorrhizal effects on soil CN properties. The sub file folder "Scenario analysis_litter traits" contains the codes for scenario analysis of different litter properties; The sub file folder "Scenario analysis_ECM types" contains the codes for scenario analysis of different ECM fungal traits; The sub file folder "Scenario analysis_climate&seasonality" contains the codes for scenario analysis of different climate and seasonalities;-"Scenario analysis_model results and plotting codes.zip" contains all the output files from the the scenario analysis of Myco-CORPSE model as described above and the plotting codes used to the generate the heatmaps and scatterplots shown in the manuscript "Ectomycorrhizal effects on decomposition are highly dependent on fungal traits, climate, and litter properties: A model-based assessment"The majority of the model outputs did not have specific geographic information or temporal coverage because the analysis we conducted are mainly hypothetical model simulations. We only provided geographic description, coordinates and temporal coverage for those soil measurements which we used for model evaluations (included in the "Plot NH_GA simulation against measurements.zip").

54 ENVIRONMENTAL SCIENCES↗

Taylor wave solution for a general equation of state

This document describes a solution procedure for calculating the Taylor wave behind an unsupported Chapman–Jouguet (CJ) detonation in planar, cylindrical, and spherical geometries given a general equation of state. The resulting semi-analytic solution can be utilized to examine new equation of state models for detonation products and during the verification of hydrodynamic codes. The governing partial differential equations are reduced to ordinary differential equations in both characteristic and self-similar forms. The first-order systems corresponding to each geometry are amenable to solution numerically using commonly available methods. A difficulty arises at the CJ point in radial coordinates where the similarity equations become singular. Two separate strategies are proposed to integrate the first-order system. The first one uses an asymptotic approximation near the CJ point that can be used to perturb the boundary conditions. The second one applies a change of variables which removes the singularity at the expense of an additional equation to be integrated. A test problem is provided for the Davis products equation of state to illustrate the qualitative features of the Taylor wave in each geometric configuration and compared with a Lagrangian hydrodynamics research code. A Python code listing gives an implementation using the SciPy library to assists users in generating the results.

97 MATHEMATICS AND COMPUTING↗

CTT: Tools for Fine Alignment of Flash X-ray Systems

The CTT code is a compilation of the python code that was prototyped in the interest of making a method for fine alignment of Flash X-ray Systems at the lab. It contains python code for interacting with LTT and running optimization loops using LTT simulations or ray tracing with RaySpace. It Includes classes for creating phantom objects and modular geometry objects in the simulations. It allows one to generate a random phantom that has been optimized to stay with a certain cubic volume and maximize the minimum distance between any two ball phantom centers in all projections. It was primarily made to work on ball phantoms which were simulated as Teflon spheres. It allows the alignment from some nominal position to some displaced position to simulate recovery of a real geometry from the nominal geometry of the system. Fine alignment can be done with the projections in LTT while a rough alignment is faster using rayspace. If rayspace works well for the use case it should be preferred since it is considerably faster and less resource intensive in general. Some Notes about using this code is that one will have to edit the imports for the files to get to the correct LTT path, LTT GUI path and to the CTT path when importing. This was made by using anaconda with python 3 on windows 10. The LTT code was stored in a anaconda environment which seemed to help the python find the LTT although it shouldn’t be necessary if you append the path in your code using sys.path.append(r'add the path you want here’). The sys.path.append method is a quick way to give your python code access to a given folder when running it (such as LTT or CTT). Note that since the code was originally made with paths for a specific machine that a new user will have to edit those paths to make it work in all the files that use the old paths. This is somewhat tedious but will be required to run the code on a new machine. The methodology used to run and make these notebooks starts with opening a command prompt as administrator in windows 10. After this one would activate the anaconda environment in the appropriate directory using “conda activate myenv” in the command prompt. After this open a jupyter-notebook using the keyword “jupyter-notebook". After that a notebook should open in a browser. Note that some libraries used may not come with anaconda so those may have to be installed. There shouldn’t be much though since the main things used are scipy, numpy, matplotlib, and LTT. LTTQuicksetup also requires some paths that will be specific to the computer so that should be changed as well.

42 ENGINEERING↗

Adapter Python IO (Adapter) v1.0

The Adapter Python IO software, in short Adapter or the Adapter software, encapsulates certain Python IO capabilities used for loading in and writing out data when performing analytical Python code runs. More specificcally, it provides a Python API to load data tables from various formats such as XLSX (MS Excel), CSV, and database, into Python code as Pandas DataFrames, as well as to write out tables into a database or CSV files. The Adapter software standardizes a way to point the code to one or multiple input files of one or multiple formats. Therefore, its main feature is the ability to convert data tables identified in one main and, optionally, one or more additional input files, into database tables and Pandas DataFrames for downstream usage in any compatible software. In addition to the loading capability, an instance of the Adapter IO object has the capability to write data out. If the write capability is invoked, all loaded tables are written as either a single database or a set of CSV files, or both, to a location specified in the dedicated input table.

Grahovac, Milica↗

Model simulations of Plum Island Ecosystems LTER low marsh site using ELM-PFLOTRAN

Model simulations using the E3SM Land Model (ELM) coupled to the PFLOTRAN reactive transport model via the Alquimia interface. The simulations were conducted for a tidal salt marsh at the Plum Island Ecosystems LTER near Rowley, Massachusetts, USA. Model simulations were forced using site-specific tidal cycles and salinity, and the simulations used a biogeochemical reaction network including aerobic decomposition, sulfate reduction, iron reduction, and methanogenesis. Model outputs include simulated carbon stocks, carbon dioxide and methane fluxes, and porewater concentrations of key solutes related to sulfur, iron, and carbon cycling. The model simulations included a saline simulation (with tidal sulfate inputs), a fresh simulation (with low salinity and low sulfate inputs), and a saline simulation with lower vegetation productivity to represent the effect of salinity on vegetation. These simulations were conducted to demonstrate that a new model framework incorporating subsurface redox and biogeochemical interactions into a land surface model could reproduce measured surface greenhouse gas fluxes and biogeochemical dynamics in tidal marsh ecosystems, and to test whether including redox interactions in a land surface model would allow the model to resolve contrasts in biogeochemical cycling and greenhouse gas production between saline and freshwater wetlands.The data package includes gzipped tar archives (which can be expanded using standard tar and gzip utilities) of model outputs from three model configurations: saline subsurface and reduced vegetation productivity related to salinity; saline subsurface with vegetation productivity not reduced; and freshwater. Also included are code for the modified E3SM model, Alquimia interface, and PFLOTRAN reactive transport simulator in gzipped tar format; plain text parameter and configuration files; python code files for visualizing model output and defining model configurations; and model output, tide and salinity forcing, and configuration files in netCDF format. See the README.md file in the data package for a detailed description of all files contained in the package. All files are in netCDF (.nc), gzipped tar archive (.tar.gz or .tgz), or text (all other files).Updated: May 13, 2024. Model output, E3SM code, PFLOTRAN input files, and python codes for visualizing results were updated to reflect changes made for the manuscript revision. The updated archive reflects the code and model output from the final accepted manuscript. Changes included updated reaction parameters reflecting improved parameterization and additional comparisons with field measurements. E3SM code changes included better support for multiple grid cells and improved flow and transport parameterization.

54 ENVIRONMENTAL SCIENCES↗

Fantastic Fits with fantasy of Active Galactic Nuclei Spectra: Exploring the Fe II Emission near the Hα Line

In this study, a refined approach for multicomponent fitting of active galactic nuclei (AGNs) spectra is presented utilizing the newly developed Python code Fully Automated pythoN Tool for AGN Spectra analYsis (fantasy). AGN spectra are modeled by simultaneously considering the underlying broken power-law continuum, predefined emission line lists, and an Fe II model, which is here extended to cover the wavelength range 3700–11000 Å. The Fe II model, founded solely on atomic data, effectively describes the extensive emission of the complex iron ion in the vicinity of the Hγ and Hβ lines, as well as near the Hα line, which was previously rarely studied. The proposed spectral fitting approach is tested on a sample of high-quality AGN spectra from the Sloan Digital Sky Survey Data Release 17. The results indicate that when Fe II emission is present near Hβ, it is also detected redward from Hα, potentially contaminating the broad Hα line wings and thus affecting the measurements of its flux and width. The production of Fe II emission is found to be strongly correlated with Eddington luminosity and appears to be controlled by a similar mechanism as the hydrogen Balmer lines. The study highlights the benefits of fitting type 1 AGN spectra with the fantasy code, pointing that it may be used as a robust tool for analyzing a large number of AGN spectra in the coming spectral surveys.

79 ASTRONOMY AND ASTROPHYSICS↗

Framework for X-ray mirror surface shape fitting

For accurate characterization of grazing-incidence X-ray mirrors, we present a comprehensive framework to fit measured surface shapes (either slope or height) of X-ray mirrors used in synchrotron radiation and free-electron laser facilities. We summarize the closed-form expressions of some typical surface shapes of X-ray mirrors including elliptic cylinders, hyperbolic cylinders, ellipsoids, hyperboloids, and diaboloids. This framework is composed of four layers: definition of standard shapes with closed-form expressions, generation of theoretical surface with pose parameters (six degrees of freedom defining an object's position and orientation relative to a coordinate system), parameter optimization with the ability to select which parameters are fit and which are held constant, and the development of user-friendly fitting function wrappers for particular fitting tasks. A few practical fitting examples are demonstrated to verify the effectiveness of the proposed fitting framework. We discuss the physical meanings of the fitting parameters, and provide several examples using the elliptic cylinder and ellipsoid shapes to highlight some features of the framework. Moreover, we provide the presented framework as open-source codes (MATLAB and Python codes available at https://github.com/nsls2omf/xmf) to the community to encourage academic collaboration and further improvements.

36 MATERIALS SCIENCE↗

Generating MCNP Input Files for Unstructured Mesh Geometries

The Los Alamos National Laboratory’s (LANL) Monte Carlo N-Particle (MCNP)1 transport code version 6.3 (also known as MCNP6.3) has the capability for tracking particles on unstructured mesh (UM) geometry models embedded into constructive solid geometry (CSG) cells. This feature has been developed for performing calculations of complex geometry models because manually creating CSG models is time-consuming and error-prone as the complexities of geometries increase. A UM geometry model is a collection of finite elements representing a solid geometry. The first step of the MCNP UM calculation is using other software packages to create a finite element mesh representation of a solid 3D geometry because the MCNP code cannot be used to generate a UM model. Computer-aided design (CAD) software is typically used to create a solid geometry model, which is later imported into mesh generation software to create a UM model. Some mesh generation software packages may also be used to create solid geometries and thus CAD files are not needed. The MCNP UM feature was originally designed for models generated by the Abaqus/CAE software suite. The MCNP code version 6.0 and later can process UM models formatted as Abaqus input files. Starting with a 6.3 version, the MCNP code can process HDF5 mesh input files. We only focus on the UM models formatted as Abaqus input files in this report since currently no external software can be used to generate HDF5 mesh input files for MCNP UM calculations. The MCNP code version 6.3 can be used to convert the Abaqus mesh input files into the HDF5 mesh input files, but this option is typically used by the MCNP code development team to test the HDF5 mesh input file feature. Several software packages (such as Abaqus, Attila4MC, or Cubit) can be used to create the Abaqus input files for MCNP UM calculations. An MCNP UM calculation using an Abaqus model requires two input file types: MCNP and Abaqus input files. The Abaqus input files needed for MCNP UM calcu lations must have the correct Abaqus syntax and meet the additional requirements by the MCNP code. The MCNP code can process only Abaqus input files that make use of part and assembly definitions, where elements in each part must be grouped into one or more element sets (i.e., elset) using *Elset keyword lines with specified naming formats. The MCNP and Abaqus input files required for MCNP UM simulations must be related; pseudo-cells in an MCNP input file must be constructed from mesh model data from an Abaqus input file. For large complex UM models, it is tedious to manually create MCNP UM input files. The um pre op (unstructured mesh pre operations) program with the -m option can be used to create a skeleton MCNP input file from an Abaqus input file [6]. Since the um pre op program was written in Fortran and was not written for optimized performance, this program is a deprecated feature in the MCNP code version 6.3 and may be removed in the next release of the code. To improve calculation flow of multiphysics calculations, a Python3 code called write mcnp um input has been developed to generate an MCNP input file instead of using the um_pre_op -m option. This Python code was initially released to the public in 2020. We have updated this Python code for MCNP6.3 and it was used to generate the MCNP input files used to verify the MCNP6.3 code. The write_mcnp_um_input code is included with the MCNP6.3 code package which will be released to the public through the Radiation Safety Information Computational Center (RSICC) at Oak Ridge National Laboratory. This report is a revision of LA-UR-20-27139 report.

73 NUCLEAR PHYSICS AND RADIATION PHYSICS↗

Multi-Physics Investigation of a Natural Circulation Molten Salt Micro-Reactor that Utilizes an Experimental In-Pile Device to Improve Core Physics and System Thermal-Hydraulic Performance.

INL employee PhD Dissertation - The Molten Salt Reactor (MSR) concept is a rapidly evolving Generation IV design that has recently attracted favorable attention due to the potential for reducing waste generation, realizing passive safety features, and seizing on the opportunity for cost effective economics. This thesis investigates the performance benefit of a new device invented by the doctoral candidate. The device is referred to as a Wrapped Helix around an Inclined Plane or WHIP. The WHIP is protected under a provisional patent filed with the USA Patent Office on 28 September 2021 under application number 63/261,776, BEA docket number BA-1254. The WHIP device can be located in-core or near-core to promoted enhanced thermal-hydraulics and neutronics performance. While the WHIP can be employed in a variety of solid or liquid fuel designs, this thesis investigates the device’s benefit in the application of a natural-circulation, micro-molten salt nuclear battery concept (MsNB). This thesis will specifically investigate the temperature coefficient of the MsNB fuel (FLiNaK) using novel temperature sensitivity techniques unique to Serpent particle transport code, evaluate the WHIP’s thermal-hydraulic and neutronic performance effects using both established (STAR-CCM+) and novel (Python code developed to estimate the circulation effective delayed neutron fraction, ßef f ) analytical and numerical methods, evaluate the neutron noise behavior of the MsNB and how the WHIP may alter the character of the MsNB’s transfer function, and how the WHIP affects the autonomous, load-following performance under transient power conditions using Python code developed by the candidate. The sum body of this work, in part, has been published in three journal articles as the timing of the provisional patent process has allowed. Results show that creative utilization of WHIP engineering design and function reduces reactor system volume, fuel loading, control/stability in the buoyant regime

buoyant flow↗