WAVES-TUTORIAL API
abaqus
rectangle_geometry.py
- modsim_package.abaqus.rectangle_geometry.main(output_file, model_name, part_name, width, height)[source]
Create a simple rectangle geometry.
This script creates a simple Abaqus model with a single rectangle part.
- Parameters:
output_file (str) – The output file for the Abaqus model without extension. Will be appended with the required extension, e.g.
output_file
.caemodel_name (str) – The name of the Abaqus model
part_name (str) – The name of the Abaqus part
width (float) – The rectangle width
height (float) – The rectangle height
- Returns:
writes
output_file
.cae
rectangle_partition.py
- modsim_package.abaqus.rectangle_partition.main(input_file, output_file, model_name, part_name, width, height)[source]
Partition the simple rectangle geometry created by
rectangle_geometry.py
This script partitions a simple Abaqus model with a single rectangle part.
Feature labels:
bottom_left
- bottom left vertexbottom_right
- bottom right vertextop_right
- top right vertextop_left
- top left vertexleft
- left edgetop
- top edgeright
- right edgebottom
- bottom edge
- Parameters:
input_file (str) – The Abaqus model file created by
rectangle_geometry.py
without extension. Will be appended with the required extension, e.g.input_file
.caeoutput_file (str) – The output file for the Abaqus model without extension. Will be appended with the required extension, e.g.
output_file
.caemodel_name (str) – The name of the Abaqus model
part_name (str) – The name of the Abaqus part
width (float) – The rectangle width
height (float) – The rectangle height
- Returns:
writes
output_file
.cae
rectangle_mesh.py
- modsim_package.abaqus.rectangle_mesh.main(input_file, output_file, model_name, part_name, global_seed)[source]
Mesh the simple rectangle geometry partitioned by
rectangle_partition.py
This script meshes a simple Abaqus model with a single rectangle part.
Node sets:
ALLNODES
- all part nodes
Element sets:
ELEMENTS
- all part elements
- Parameters:
input_file (str) – The Abaqus model file created by
rectangle_geometry.py
without extension. Will be appended with the required extension, e.g.input_file
.caeoutput_file (str) – The output file for the Abaqus model without extension. Will be appended with the required extension, e.g.
output_file
.caemodel_name (str) – The name of the Abaqus model
part_name (str) – The name of the Abaqus part
global_seed (float) – The global mesh seed size
- Returns:
output_file
.cae,output_file
.inp
abaqus_utilities.py
- modsim_package.abaqus.abaqus_utilities.export_mesh(model_object, part_name, orphan_mesh_file)[source]
Export an orphan mesh for the specified part instance in an Abaqus model
Using an abaqus model object (
model_object = abaqus.mdb.models[model_name]
) with part(s) that are meshed and instanced in an assembly, get the*.inp
keyword blocks and save an orphan mesh file,orphan_mesh_file
.inp, for the specificpart_name
.- Parameters:
model_object (abaqus.mdb.models[model_name]) – Abaqus model object
part_name (str) – Part name to export as an orphan mesh
orphan_mesh_file (str) – File name to write for the orphan mesh without extension, e.g.
orphan_mesh_file
.inp
- Returns:
writes
orphan_mesh_file
.inp
cubit
rectangle_geometry.py
- modsim_package.cubit.rectangle_geometry.main(output_file, width, height)[source]
Create a simple rectangle geometry.
This script creates a simple Cubit model with a single rectangle part.
- Parameters:
output_file (str) – The output file for the Cubit model without extension. Will be appended with the required extension, e.g.
output_file
.cubwidth (float) – The rectangle width
height (float) – The rectangle height
- Returns:
writes
output_file
.cub
rectangle_partition.py
- modsim_package.cubit.rectangle_partition.main(input_file, output_file, width, height)[source]
Partition the simple rectangle geometry created by
rectangle_geometry.py
This script partitions a simple Cubit model with a single rectangle part.
Element sets:
top
- top edgebottom
- bottom edgeleft
- left edgeright
- right edge
- Parameters:
input_file (str) – The Cubit model file created by
rectangle_geometry.py
without extension. Will be appended with the required extension, e.g.input_file
.cuboutput_file (str) – The output file for the Cubit model without extension. Will be appended with the required extension, e.g.
output_file
.cubwidth (float) – The rectangle width
height (float) – The rectangle height
- Returns:
writes
output_file
.cub
rectangle_mesh.py
- modsim_package.cubit.rectangle_mesh.main(input_file, output_file, global_seed, element_type='QUAD', solver='abaqus')[source]
Mesh the simple rectangle geometry partitioned by
rectangle_partition.py
This script meshes a simple Cubit model with a single rectangle part.
Node sets:
bottom_left
- bottom left nodebottom_right
- bottom right nodetop_right
- top right nodetop_left
- top left nodetop
- top edge nodesbottom
- bottom edge nodesleft
- left edge nodesright
- right edge nodes
Element sets:
ELEMENTS
- all part elements
- Parameters:
input_file (str) – The Cubit model file created by
rectangle_geometry.py
without extension. Will be appended with the required extension, e.g.input_file
.cuboutput_file (str) – The output file for the Cubit model without extension. Will be appended with the required extension, e.g.
output_file
.cubglobal_seed (float) – The global mesh seed size
element_type (str) – The model element type. Must be a supported Cubit 4 node element type.
solver (str) – The solver type to use when exporting the mesh
- Returns:
writes
output_file
.cub andoutput_file
.inp
python
rectangle_compression_nominal.py
Parameter sets and schemas for the rectangle compression simulation
- modsim_package.python.rectangle_compression_nominal.parameter_schema(width=1.0, height=1.0, global_seed=1.0, displacement=-0.01)[source]
Return nominal simulation variables dictionary
- Parameters:
width (float) – The rectangle width
height (float) – The rectangle height
global_seed (float) – The global mesh seed size
displacement (float) – The rectangle top surface displacement
- Returns:
nominal simulation variables
- Return type:
dict
rectangle_compression_cartesian_product.py
Parameter sets and schemas for the rectangle compression simulation
- modsim_package.python.rectangle_compression_cartesian_product.parameter_schema(width=[1.0, 1.1], height=[1.0, 1.1], global_seed=[1.0], displacement=[-0.01])[source]
Return WAVES CartesianProduct parameter schema
- Parameters:
width (list) – The rectangle width
height (list) – The rectangle height
global_seed (list) – The global mesh seed size
displacement (list) – The rectangle top surface displacement
- Returns:
WAVES CartesianProduct parameter schema
- Return type:
dict
post_processing.py
Example of catenating WAVES parameter study results and definition
- modsim_package.python.post_processing.combine_data(input_files, group_path, concat_coord)[source]
Combine input data files into one dataset
- Parameters:
input_files (list) – list of path-like or file-like objects pointing to h5netcdf files containing Xarray Datasets
group_path (str) – The h5netcdf group path locating the Xarray Dataset in the input files.
concat_coord (str) – Name of dimension
- Returns:
Combined data
- Return type:
xarray.DataArray
- modsim_package.python.post_processing.csv_files_match(current_csv, expected_csv)[source]
Compare two pandas DataFrame objects and determine if they match.
- Parameters:
current_csv (pandas.DataFrame) – Current CSV data of generated plot.
expected_csv (pandas.DataFrame) – Expected CSV data.
- Returns:
True if the CSV files match, False otherwise.
- Return type:
bool
- modsim_package.python.post_processing.main(input_files, output_file, group_path, x_var, x_units, y_var, y_units, selection_dict, parameter_study_file=None, csv_regression_file=None)[source]
Catenate
input_files
datasets along theparameter_sets
dimension and plot selected data.Optionally merges the parameter study results datasets with the parameter study definition dataset, where the parameter study dataset file is assumed to be written by a WAVES parameter generator.
- Parameters:
input_files (list) – list of path-like or file-like objects pointing to h5netcdf files containing Xarray Datasets
output_file (str) – The plot file name. Relative or absolute path.
group_path (str) – The h5netcdf group path locating the Xarray Dataset in the input files.
x_var (str) – The independent (x-axis) variable key name for the Xarray Dataset “data variable”
x_units (str) – The independent (x-axis) units
y_var (str) – The dependent (y-axis) variable key name for the Xarray Dataset “data variable”
y_units (str) – The dependent (y-axis) units
selection_dict (dict) – Dictionary to define the down selection of data to be plotted. Dictionary
key: value
pairs must match the data variables and coordinates of the expected Xarray Dataset object.parameter_study_file (str) – path-like or file-like object containing the parameter study dataset. Assumes the h5netcdf file contains only a single dataset at the root group path, .e.g.
/
.csv_regression_file (str) – path-like or file-like object containing the CSV dataset to compare with the current plot data. If the data sets do not match a non-zero exit code is returned.
- modsim_package.python.post_processing.merge_parameter_study(parameter_study_file, combined_data)[source]
Merge parameter study to existing dataset
- Parameters:
parameter_study_file (str) – path-like or file-like object containing the parameter study dataset. Assumes the h5netcdf file contains only a single dataset at the root group path, .e.g.
/
.combined_data (xarray.DataArray) – XArray Dataset that will be merged.
- Returns:
Combined data
- Return type:
xarray.DataArray
- modsim_package.python.post_processing.save_plot(combined_data, x_var, y_var, selection_dict, concat_coord, output_file)[source]
Save scatter plot with given x and y labels
- Parameters:
combined_data (xarray.DataArray) – XArray Dataset that will be plotted.
x_var (str) – The independent (x-axis) variable key name for the Xarray Dataset “data variable”
y_var (str) – The dependent (y-axis) variable key name for the Xarray Dataset “data variable”
selection_dict (dict) – Dictionary to define the down selection of data to be plotted. Dictionary
key: value
pairs must match the data variables and coordinates of the expected Xarray Dataset object.concat_coord (str) – Name of dimension for which you want multiple lines plotted.
output_file (str) – The plot file name. Relative or absolute path.
- modsim_package.python.post_processing.save_table(combined_data, selection_dict, output_file)[source]
Save csv table
- Parameters:
combined_data (xarray.DataArray) – XArray Dataset to be written as a CSV.
selection_dict (dict) – Dictionary to define the down selection of data to be plotted. Dictionary
key: value
pairs must match the data variables and coordinates of the expected Xarray Dataset object.output_file (str) – The CSV file name. Relative or absolute path.
argparse_types.py
Python 2/3 compatible argparse types for input verification
- modsim_package.argparse_types.positive_float(argument)[source]
Type function for argparse - positive floats
Abaqus Python 2 and Python 3 compatible argparse type method: https://docs.python.org/3.8/library/argparse.html#type.
- Parameters:
argument (str) – string argument from argparse
- Returns:
argument
- Return type:
float