The Deep Lynx MOOSE Adapter connects the Deep Lynx data warehouse with any MOOSE executable. A template input file is used to generate a configuration file that specifies the parameters that can be changed in an input file. The Adapter receives events from Deep Lynx, verifies the incoming data with a configuration file, and modifies a template input file for the MOOSE executable. Returns from the MOOSE run are sent back to Deep Lynx for use by other applications.
The purpose of the Template Parser
file is to creates a configuration file that specifies...
- The variables that can be changed in the input file
- Expected datatype for the variable
The Template Parser
can generate a configuration file via the command line or environment variables (.env file).
- Create template input file
- Add
# {{config}}
tag to each parameter to change in the MOOSE input file
- Add
- Run script
- Environment variables
- Specify the path to
TEMPLATE_INPUT_FILE_NAME
- Specify the path to the
CONFIG_FILE_NAME
that will be generated by theTemplate Parser
- Specify the path to
- Command Line Interface
# Sample command python adapter/template_parser.py -i data/example/config_input_file.i Options: -i <input_file> Specify a MOOSE input file -h, --help Displays CLI usage statement
- Environment variables
- Produces a configuration file (.cfg)
- Node path in the brackets
- List the parameter and its datatype for each node
[root]
xmax = int
[/Mesh/gen]
dim = int
nx = int
xmax = int
The purpose of the Edit Input File
file is to create the input file to run in MOOSE. The template input file is updated using new incoming data from Deep Lynx.
- Create a configuration file via the
Template Parser
- Verify the parameters in the input file can be changed through the configuration file
- Updates the parameter value of a node and adds a comment documenting the change
- Remove the
{{config}}
comments from the parameters of a node from the template input file - Writes a new input file with the incorporated changes to
RUN_FILE_NAME
The purpose of the MOOSE Adapter
file is to run an input file in MOOSE.
- Receive new data from Deep Lynx
- Edit the input file via
Edit Input File
file
- Edit the input file via
- Run the input file in MOOSE
- Inputs: data file and input file
- Outputs: results file
- Imports the results into Deep Lynx
To run this code, first copy the .env_sample
file and rename it to .env
. Several parameters must be present:
- DEEP_LYNX_URL: The base URL at which calls to Deep Lynx should be sent
- CONTAINER_NAME: The container name within Deep Lynx
- DATA_SOURCE_NAME: A name for this data source to be registered with Deep Lynx
- DATA_SOURCES: A list of Deep Lynx data source names which listens for events
- TEMPLATE_INPUT_FILE_NAME: The
.i
template input file name to look for - CONFIG_FILE_NAME: The
.cfg
configuration file name to look for - RUN_FILE_NAME: The
.i
input file name to run in MOOSE - QUEUE_FILE_NAME: The name of the queue file that is updated with new data via the Deep Lynx event system
- QUEUE_LENGTH: The maximum length of the queue which updates data in First-In-First-Out (FIFO) data structure
- METADATA_FILE_NAME: The Deep Lynx metadata file name used in the typemapping system of Deep Lynx
- PYTHONPATH: The path to the local MOOSE python folder
- MOOSE_OPT_PATH: The path to the local MOOSE executable
- IMPORT_FILE_WAIT_SECONDS: the number of seconds to wait between attempts to find the MOOSE output file to import into Deep Lynx
- REGISTER_WAIT_SECONDS: the number of seconds to wait between attempts to register for events
Logs will be written to a logfile, stored in the root directory of the project. The log file name is set in main()
of moose_adapter.py
.
- Complete the Poetry installation
- All following commands are run in the root directory of the project:
- Run
poetry update
to install the defined dependencies for the project. - Run
poetry shell
to spawns a shell. - Finally, run the project with the command
flask run
- Run
Logs will be written to a log file, stored in the root directory of the project. The log filename is set in adapter/__init__.py
and is called MOOSEAdapter.log
.
- Complete the MOOSE installation
- Complete the setup for the MOOSE Python Tools
- Add
export PYTHONPATH=$PYTHONPATH:~/projects/moose/python
to your bash environment
- Add
The MOOSE Adapter uses the pyhit
and moosetree
modules within MOOSE. For more information, visit the Helpful Links
section.
This project uses yapf for formatting. Please install it and apply formatting before submitting changes.
poetry shell
yapf --in-place --recursive . --style={column_limit:120}
)
- MOOSE Code
- User Guides
- pyhit tutorial
- moosetree package
- input file syntax shows the use of global variables in input file
Idaho National Laboratory is a cutting edge research facility which is a constantly producing high quality research and software. Feel free to take a look at our other software and scientific offerings at:
Primary Technology Offerings Page
Supported Open Source Software
Raw Experiment Open Source Software
Unsupported Open Source Software
Copyright 2021 Battelle Energy Alliance, LLC
Licensed under the LICENSE TYPE (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
By contributing to this software project, you are agreeing to the following terms and conditions for your contributions:
You agree your contributions are submitted under the MIT license. You represent you are authorized to make the contributions and grant the license. If your employer has rights to intellectual property that includes your contributions, you represent that you have received permission to make contributions and grant the required license on behalf of that employer.