TARDIGRADE-EXAMPLES API

Common

config_software.py

model_package.config_software.config_software(config_file)[source]

Configure software paths in a YAML file

Parameters:

config_file (str) – The YAML file to write software paths

Returns:

Writes or updates config_file

peta.py

model_package.peta.peta_copy(source_directory, output_directory)[source]

Copy DNS results from the CU Peta library to the output directory

Parameters:
  • source_directory (str) – The source directory of DNS simulation results

  • output_directory (str) – The output directory destination

model_package.peta.remove_block_by_name(parent, block_name_to_remove)[source]

Recursively search through an XML node to find and remove a specified block

Params xml_node parent:

The XML node to start search

Params string block_name_to_remove:

The name attribute of an XML block to remove

model_package.peta.transfer_GEOS_files(source_files_dict, source_directory, output_directory, split_key, username)[source]

Transfer GEOS DNS ascii VTK results and subdirectories a series of scp commands (multiple sources, multiple destinations)

Params dict source_files_dict:

The a dictionary containing lists of files GEOS ascii VTK results to copy

Params str source_directory:

The common CU Peta Library DNS results path

Params str output_directory:

The root destination directory of DNS files

Params str split_key:

a unique string to split the full Petalibrary path for copying

Params str username:

The user’s CU identikey

model_package.peta.transfer_GEOS_files_selective(source_files_dict, source_directory, output_directory, split_key, username)[source]

Transfer GEOS DNS ascii VTK results and subdirectories a series of scp commands (multiple sources, multiple destinations) for a specific selection of timesteps and modify associated XML data of PVD and VTM files

Params dict source_files_dict:

The a dictionary containing lists of files GEOS ascii VTK results to copy

Params str source_directory:

The common CU Peta Library DNS results path

Params str output_directory:

The root destination directory of DNS files

Params str split_key:

a unique string to split the full Petalibrary path for copying

Params str username:

The user’s CU identikey

model_package.peta.transfer_Ratel_files(source_files, source_directory, output_directory, username)[source]

Transfer all Ratel DNS binary VTK results files to the output_directory using a single scp command (multiple sources, single destination)

Params list source_files:

The source files to copy

Params str source_directory:

The common CU Peta Library DNS results path

Params str output_directory:

The destination directory of DNS files

Params str username:

The user’s CU identikey

xdmf_reader_tools.py

model_package.xdmf_reader_tools.collect_first_moment_of_momentum_measures(data, nqp, nel, dim=3)[source]

Collect body couples and micro-spin inertias

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for body couples and micro-spin inertias

model_package.xdmf_reader_tools.collect_stresses(data, nqp, nel, dim=3)[source]

Collect quadrature point data for Cauchy, symmetric micro-, and higher order stresses from Micromorphic Filter output (all in current configuration)

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for Cauchy, symmetric micro-, and higher order stresses

model_package.xdmf_reader_tools.compute_deformations(data, nqp, nel, dim=3)[source]

Compute quadrature point data for a variety of deformation measures

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for Green-Lagrange strain, Micro-Green-Lagrange strain, micro-deformation gradient, deformation gradient, micro-deformation tensor, gradient of micro-deformation tensor, Euler-Almansi strain, and Hencky strain

model_package.xdmf_reader_tools.construct_degrees_of_freedom(data, nqp, nel, dim=3)[source]

Collect quadrature point data for displacement, displacement gradient, micro-displacement, and micro-displacement gradient from Micromorphic Filter output

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for displacement, displacement gradient, micro-displacement, and micro-displacement gradient

model_package.xdmf_reader_tools.get_R_and_U(data, F, chi, nqp, nel, dim=3)[source]

Calculate stretch and rotation tensors for macro deformation and micro deformation tensors using polar decomposition

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • F (dict) – A dictionary containing macro deformation gradient information

  • chi (dict) – A dictionary containing micro deformation tensor informaiton

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

R, U, Rchi, and Uchi

model_package.xdmf_reader_tools.get_attribute_data(xml_node, path='.')[source]

Collect attribute data from xml formatted file

Parameters:
  • xml_node (node) – The xml child node containing path to attribute data

  • path (str) – a path for locating data within an HDF5 file, default=’.’

Returns:

value and keyname of attribute data

model_package.xdmf_reader_tools.get_current_configuration_stresses(PK2, SIGMA, grad_u, phi, dim=3)[source]

Convert Second Piola Kirchhoff and Symmetric micro- stresses to the current configuration

Parameters:
  • PK2 (dict) – A dictionary containing Second Piola Kirchhoff stress data

  • SIGMA (dict) – A dictionary containing Symmetric micro-stress data

  • grad_u (dict) – A dictionary containing displacement gradient data

  • phi (dict) – A dicionary containing micro displacement data

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for Cauchy and symmetric micro-stresses (all in current configuration)

model_package.xdmf_reader_tools.get_geometry(xml_node, path='.')[source]

Collect geometry data from xml formatted file

Parameters:
  • xml_node (node) – The xml child node containing path to geometry data

  • path (str) – a path for locating data within an HDF5 file, default=’.’

Returns:

value of geometry data

model_package.xdmf_reader_tools.get_reference_configuration_stresses(data, nqp, nel, dim=3)[source]

Map Cauchy, symmetric micro-, and higher order stresses to the reference configuraiton

Parameters:
  • data (dict) – The data dictionary containing output from Micromorphic Filter

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • dim (int) – The number of spatial dimensions, default=3

Returns:

dictionaries for Second Piola Kirchhoff, Symmetric micro-, and Higher order stresses (all in reference configuration)

model_package.xdmf_reader_tools.get_set(xml_node, path='.')[source]

Collect set data from xml formatted file

Parameters:
  • xml_node (node) – The xml child node containing path to attribute data

  • path (str) – a path for locating data within an HDF5 file, default=’.’

Returns:

value of set data

model_package.xdmf_reader_tools.get_topology(xml_node, path='.')[source]

Collect topology data from xml formatted file

Parameters:
  • xml_node (node) – The xml child node containing path to topology data

  • path (str) – a path for locating data within an HDF5 file, default=’.’

Returns:

value of topology data

model_package.xdmf_reader_tools.map_sim(stress, ninc, dim=3, third_order=False)[source]

Map a flattened stress tensor to index component notation. This function is used for converting output from micromorphic.evaluate_model to a convenient form for post-processing against Micromorphic Filter output data.

Parameters:
  • stress (dict) – The dictionary of flattened 2nd order stress tensor

  • ninc (int) – The number of time increments

  • dim (int) – The number of spatial dimensions, default=3

  • third_order (bool) – Boolean specifying if the tensor is third order, default=False

Returns:

dictionary with reshaped stress data

model_package.xdmf_reader_tools.parse_xdmf_output(input_file)[source]

Parse XDMF and HDF5 file contents into attributes, geometry, topology, and time

Parameters:

input_file (str) – The XDMF filename

Returns:

dictionaries for simulation data, geometry, and topology

model_package.xdmf_reader_tools.read_data(xml_node, path='.')[source]

Collect data from HDF5 file using path specified in xml formatted XDMF file

Parameters:
  • xml_node (node) – The xml child node containing path to data

  • path (str) – a path for locating data within an HDF5 file, default=’.’

Returns:

value of topology data

DNS_Abaqus

build_dynamic_elastic_cylinder.py

model_package.DNS_Abaqus.build_dynamic_elastic_cylinder.get_centroids(part, nodes)[source]

Utility function to calculate centroids of all elements for a given Abaqus part.

Parameters:
  • part (object) – the Abaqus model database (mdb) part to operate on.

  • nodes (dict) – Dictionary of nodes and nodal coordinates.

Returns:

dictionary of elements and element centroid coordinates.

model_package.DNS_Abaqus.build_dynamic_elastic_cylinder.get_nodes(part)[source]

Utility function to collect all nodes and nodal coordinates for a given Abaqus part.

Parameters:

part (object) – the Abaqus model database (mdb) part to operate on.

Returns:

dictionary of nodes and nodal coordinates.

model_package.DNS_Abaqus.build_dynamic_elastic_cylinder.get_sets(part, xMin, xMax, yMin, yMax, zMin, zMax, centroids, set_name)[source]
Utility function to generate element set for all elements with centroids

contained within a minimum and maximum range of x-, y-, and z-coordinates.

Parameters:
  • part (object) – the Abaqus model database (mdb) part to operate on.

  • xMin (float) – minimum coordinate in x-direction

  • xMax (float) – maximum coordinate in x-direction

  • yMin (float) – minimum coordinate in y-direction

  • yMax (float) – maximum coordinate in y-direction

  • zMin (float) – minimum coordinate in z-direction

  • zMax (float) – maximum coordinate in z-direction

  • centroids (dict) – dictionary of element IDs and associated coordinates of centroid

  • set_name (str) – name of output element set

Returns:

tuple of element labels to include in new set. Part level element set is generated.

model_package.DNS_Abaqus.build_dynamic_elastic_cylinder.main(model_name, diam, height, seed, material_E, material_nu, material_rho, total_force, duration, num_steps, fix_lateral_dofs=False, finite_rise=None)[source]

Creates, partitions, and meshes an Abaqus model. Material properties, boundary conditions, and loads are applied. The complete Abaqus job is written as an input file (.inp).

Parameters:
  • model_name (str) – The name of the Abaqus model

  • diam (float) – The diameter of the cylinder

  • height (float) – The height of the cylinder

  • seed (float) – The approximate global seed size for meshing

  • material_E (float) – The elastic modulus of the material

  • material_nu (float) – The Poisson ratio of the material

  • material_rho (float) – The density (g/cm^3) of the material. This value will be multiplied by 1.00e-9 to convert to units of tonne/mm^3

  • total_force (float) – The force applied to cylinder

  • duration (float) – The duration of the simulation

  • num_steps (int) – The number of fixed time increments

  • fix_lateral_dofs (bool) – Option to force all x- and y-displacements to be fixed

  • finite_rise (int) – Optional extra number of time steps over which to to ramp force

Returns:

write {model_name}.cae and {model_name}.inp

Node sets:

  • ALL NODES - all nodes of the meshed domain.

  • BOTTOM - nodes of the bottom z-face of the rectangular domain.

  • LOAD_HERE - fictious node kinematically coupled to the TOP nodeset used for load application and force summation.

  • TOP - nodes of the top z-face of the rectangular domain.

  • X-PLANE - nodes of central plane of rectangular domain with normal in the x-direction.

  • Y-PLANE - nodes of central plane of rectangular domain with normal in the y-direction.

  • material_SET - nodes associated with cylindrical region.

  • VOID_SET - nodes associated with outer void region.

Element sets:

  • ALL ELEMENTS - all elements of the meshed domain.

  • BOTTOM - elements of the bottom z-face of the rectangular domain.

  • TOP - elements of the top z-face of the rectangular domain.

  • X-PLANE - elements of central plane of rectangular domain with normal in the x-direction.

  • Y-PLANE - elements of central plane of rectangular domain with normal in the y-direction.

  • material_SET - elements associated with cylindrical region.

  • VOID_SET - elements associated with outer void region.

  • SET_1 - elements in first octant of rectangular domain. Micro-domain set #1.

  • SET_2 - elements in second octant of rectangular domain. Micro-domain set #2.

  • SET_3 - elements in third octant of rectangular domain. Micro-domain set #3.

  • SET_4 - elements in fourth octant of rectangular domain. Micro-domain set #4.

  • SET_5 - elements in fifth octant of rectangular domain. Micro-domain set #5.

  • SET_6 - elements in sixth octant of rectangular domain. Micro-domain set #6.

  • SET_7 - elements in seventh octant of rectangular domain. Micro-domain set #7.

  • SET_8 - elements in eighth octant of rectangular domain. Micro-domain set #8.

build_elastic_cylinder.py

model_package.DNS_Abaqus.build_elastic_cylinder.get_centroids(part, nodes)[source]

Calculate centroids of all elements for a given Abaqus part.

Parameters:
  • part (object) – the Abaqus model database (mdb) part to operate on.

  • nodes (dict) – Dictionary of nodes and nodal coordinates.

Returns:

dictionary of elements and element centroid coordinates.

model_package.DNS_Abaqus.build_elastic_cylinder.get_nodes(part)[source]

Collect all nodes and nodal coordinates for a given Abaqus part.

Parameters:

part (object) – the Abaqus model database (mdb) part to operate on.

Returns:

dictionary of nodes and nodal coordinates.

model_package.DNS_Abaqus.build_elastic_cylinder.get_sets(part, xMin, xMax, yMin, yMax, zMin, zMax, centroids, set_name)[source]

Generate element set for all elements with centroids contained within a minimum and maximum range of x-, y-, and z-coordinates.

Parameters:
  • part (object) – the Abaqus model database (mdb) part to operate on.

  • xMin (float) – minimum coordinate in x-direction

  • xMax (float) – maximum coordinate in x-direction

  • yMin (float) – minimum coordinate in y-direction

  • yMax (float) – maximum coordinate in y-direction

  • zMin (float) – minimum coordinate in z-direction

  • zMax (float) – maximum coordinate in z-direction

  • centroids (dict) – dictionary of element IDs and associated coordinates of centroid

  • set_name (str) – name of output element set

Returns:

tuple of element labels to include in new set. Part level element set is generated.

model_package.DNS_Abaqus.build_elastic_cylinder.main(model_name, diam, height, seed, material_E, material_nu, material_rho, disp_fact, num_steps, BCs)[source]

Creates, partitions, and meshes an Abaqus model of an elastic cylinder. Material properties, boundary conditions, and loads are applied. The complete Abaqus job is written as an input file (.inp).

Parameters:
  • model_name (str) – The name of the Abaqus model

  • diam (float) – The diameter of the cylinder

  • height (float) – The height of the cylinder

  • seed (float) – The approximate global seed size for meshing

  • material_E (float) – The elastic modulus of the material

  • material_nu (float) – The Poisson ratio of the material

  • material_rho (float) – The density (g/cm^3) of the material. This value will be multiplied by 1.00e-9 to convert to units of tonne/mm^3

  • disp_fact (float) – The multiplicative factor of the sample height by which the model will be compressed

  • num_steps (int) – The fixed number of steps to simulate

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

Returns:

write {model_name}.cae and {model_name}.inp

Node sets:

  • ALL NODES - all nodes of the meshed domain.

  • BOTTOM - nodes of the bottom z-face of the rectangular domain.

  • LOAD_HERE - fictious node kinematically coupled to the TOP nodeset used for load application and force summation.

  • TOP - nodes of the top z-face of the rectangular domain.

  • X-PLANE - nodes of central plane of rectangular domain with normal in the x-direction.

  • Y-PLANE - nodes of central plane of rectangular domain with normal in the y-direction.

  • BINDER_SET - nodes associated with cylindrical binder region.

  • VOID_SET - nodes associated with outer void region.

Element sets:

  • ALL ELEMENTS - all elements of the meshed domain.

  • BOTTOM - elements of the bottom z-face of the rectangular domain.

  • TOP - elements of the top z-face of the rectangular domain.

  • X-PLANE - elements of central plane of rectangular domain with normal in the x-direction.

  • Y-PLANE - elements of central plane of rectangular domain with normal in the y-direction.

  • BINDER_SET - elements associated with cylindrical binder region.

  • VOID_SET - elements associated with outer void region.

  • SET_1 - elements in first octant of rectangular domain. Micro-domain set #1.

  • SET_2 - elements in second octant of rectangular domain. Micro-domain set #2.

  • SET_3 - elements in third octant of rectangular domain. Micro-domain set #3.

  • SET_4 - elements in fourth octant of rectangular domain. Micro-domain set #4.

  • SET_5 - elements in fifth octant of rectangular domain. Micro-domain set #5.

  • SET_6 - elements in sixth octant of rectangular domain. Micro-domain set #6.

  • SET_7 - elements in seventh octant of rectangular domain. Micro-domain set #7.

  • SET_8 - elements in eighth octant of rectangular domain. Micro-domain set #8.

convert_tess.py

model_package.DNS_Abaqus.convert_tess.convert_tess(input_file, stl_file=None, mesh_file=None, seed_size=1.0)[source]

Convert a 2D tesselation file output by Neper to STL and create an Abaqus mesh

Params str input_file:

Input tesselation (.tess) file

Params str stl_file:

Optional filename to save STL geometry without extension

Params str mesh_file:

Optional filename to create an Abaqus mesh without extension

Params float seed_size:

The approximate mesh size

model_package.DNS_Abaqus.convert_tess.create_geometry(vertices, edges, faces, bounds, polyhedra, stl_file)[source]

Create geometry from Neper output

Params DataFrame vertices:

Pandas DataFrame containing rows of vertex coordinates

Params DataFrame edges:

Pandas DataFrame containing rows of edge-to-vertex connectivity

Params dict faces:

Dictionary containing ids of faces with lists of face-to-edge connectivity

Params dict polyhedra:

Dictionary containing ids of polyhedra with lists of polyhedra-to-face connectivity

Params str stl_file:

Optional filename to save STL geometry without extension

Returns:

Write {stl_file}.cub and {stl_file}.stl

model_package.DNS_Abaqus.convert_tess.create_mesh(stl_file, mesh_file, polyhedra, sidesets, seed_size)[source]

Create mesh from Neper output

Params str stl_file:

Optional filename to save STL geometry without extension

Params str mesh_file:

Optional filename to create an Abaqus mesh without extension

Params dict polyhedra:

Dictionary containing ids of polyhedra with lists of polyhedra-to-face connectivity

Params dict sidesets:

Dictionary containing names of surfaces and geometric search strings

Params float seed_size:

The approximate mesh size

Returns:

Write {mesh_file}.cub and {mesh_file}.inp

model_package.DNS_Abaqus.convert_tess.parse_contents(input_file)[source]

Parse content of Neper output

Params str input_file:

Input tesselation (.tess) file

Returns:

DataFrame containing rows of vertex coordinates, DataFrame containing rows of edge-to-vertex connectivity, dictionary containing ids of faces with lists of face-to-edge connectivity, and dictionary containing ids of polyhedra with lists of polyhedra-to-face connectivity

convert_tess_2d.py

model_package.DNS_Abaqus.convert_tess_2d.convert_tess(input_file, stl_file=None, mesh_file=None, seed_size=1.0)[source]

Convert a 2D tesselation file output by Neper to STL and create an Abaqus mesh

Params str input_file:

Input tesselation (.tess) file

Params str stl_file:

Optional filename to save STL geometry without extension

Params str mesh_file:

Optional filename to create an Abaqus mesh without extension

Params float seed_size:

The approximate mesh size

model_package.DNS_Abaqus.convert_tess_2d.create_geometry(vertices, edges, faces, stl_file)[source]

Create geometry from Neper output

Params DataFrame vertices:

Pandas DataFrame containing rows of vertex coordinates

Params DataFrame edges:

Pandas DataFrame containing rows of edge-to-vertex connectivity

Params dict faces:

Dictionary containing ids of faces with lists of face-to-edge connectivity

Params str stl_file:

Optional filename to save STL geometry without extension

Returns:

Write {stl_file}.cub

model_package.DNS_Abaqus.convert_tess_2d.create_mesh(stl_file, mesh_file, faces, sidesets, seed_size)[source]

Create mesh from Neper output

Params str stl_file:

Optional filename to save STL geometry without extension

Params str mesh_file:

Optional filename to create an Abaqus mesh without extension

Params dict sidesets:

Dictionary containing names of surfaces and geometric search strings

Params float seed_size:

The approximate mesh size

Returns:

Write {mesh_file}.cub and {mesh_file}.inp

model_package.DNS_Abaqus.convert_tess_2d.parse_contents(input_file)[source]

Parse content of Neper output

Params str input_file:

Input tesselation (.tess) file

Returns:

DataFrame containing rows of vertex coordinates, DataFrame containing rows of edge-to-vertex connectivity, and dictionary containing ids of faces with lists of face-to-edge connectivity

convert_tess_cylinder.py

model_package.DNS_Abaqus.convert_tess_cylinder.convert_tess(input_file, stl_file=None, mesh_file=None, seed_size=1.0)[source]

Convert a tesslation file output by Neper for a cylindrical geometry to STL and create Abaqus mesh

model_package.DNS_Abaqus.convert_tess_cylinder.create_geometry(vertices, edges, faces, bounds, polyhedra, stl_file)[source]

Create geometry from Neper output

model_package.DNS_Abaqus.convert_tess_cylinder.create_mesh(stl_file, mesh_file, polyhedra, sidesets)[source]

Create mesh from Neper output

model_package.DNS_Abaqus.convert_tess_cylinder.parse_contents(input_file)[source]

Parse content of Neper output

dynamic_analytical_comparison.py

model_package.DNS_Abaqus.dynamic_analytical_comparison.meirovitch(x, t, c, nmax, L)[source]

Calculate the analytical Meirovitch solution for the dynamic bar problem.

Parameters:
  • x (float) – The location on the bar to calculate the solution

  • t (linspace) – The discrete time points to calculate the solution

  • c (float) – The speed of sound of the bar

  • nmax (int) – The number of series expansion terms to calculat the solution

  • L (float) – The length of the bar

Returns:

A list of solutions at point x for times t

model_package.DNS_Abaqus.dynamic_analytical_comparison.plot(input_file, output_file, x_path, y_path, x_label, y_label, x_units, y_units, height, diam, material_E, material_rho, total_force, duration, num_steps, csv_file=None, series_plot=None)[source]

Extracts displacement and reaction force history from Abaqus results. Plots Abaqus results against an analytical solution. Optionally outputs csv_file containing results. Optionally outputs a plot of the converge of the analytical solution.

Parameters:
  • input_file (str) – The HDF5 dataset file containing Abaqus results

  • output_file (str) – The output file for plotting

  • x_path (str) – The HDF5 path to the x data

  • y_path (str) – The HDF5 path to the y data

  • x_label (str) – The label (without units) for the x data

  • y_label (str) – The label (without units) for the y data

  • x_units (str) – The independent (x-axis) units string

  • y_units (str) – The dependent (y-axis) units string

  • height (float) – The height (mm) of the cylinder. This values will be multiplied by 1.e-3 to convert to units of m

  • diam (float) – The diameter (mm) of the cylinder. This values will be multiplied by 1.e-3 to convert to units of m

  • material_E (float) – The elastic modulus (MPa) of the material. This value will be multiplied by 1.6 to convert to units of Pa

  • material_rho (float) – The density (g/cm^3) of the material. This value will be multiplied by 1.00e3 to convert to units of kg/m^3

  • total_force (float) – The force (N) applied to cylinder

  • duration (float) – The duration of the simulation

  • num_steps (int) – The number of fixed time increments

  • csv_file (str) – Name of output CSV file

  • series_plot (str) – Name of the output series convergence plot for summation terms

Returns:

output_file and optionally csv_file and series_plot

model_package.DNS_Abaqus.dynamic_analytical_comparison.plot_series_convergence(x, t, speed, L, output_name)[source]

Plot the convergence of the Meirovitch solution over a range of terms

Parameters:
  • x (float) – The location on the bar to calculate the solution

  • t (linspace) – The discrete time points to calculate the solution

  • speed (float) – The speed of sound of the bar

  • L (float) – The length of the bar

  • output_name (str) – Name of the output series convergence plot for summation terms

Returns:

output_name

extract_frames.py

model_package.DNS_Abaqus.extract_frames.extract_frames(input_file, output_file, field, viewVec, camVec, fram=None, refine_seq=None)[source]

Extracts 3D field output from a completed Abaqus simulation to save as 2D image

Parameters:
  • input_file (str) – Relative or absolute path to the output database (odb) to operate on.

  • output_file (str) – Relative or absolute path the output png file.

  • field (str) – Field output to collect (e.g. ‘S’ for stress)

  • viewVec (tuple) – tuple of vector components that define the camera view.

  • camVec (tuple) – tuple of vector components that define the vertical view orientation.

  • fram (int) – Simulation frame number to extract field output. Final frame will be plotted if nothing is specified.

  • refine_seq (tuple) – additional options required by some fields to further define what field quantity is extracted.

Returns:

output_file

extract_history.py

model_package.DNS_Abaqus.extract_history.plot(input_file, output_file, x_path, y_path, x_label, y_label, x_units, y_units, csv_file=None)[source]

Plot Abaqus history output for force versus displacement

Parameters:
  • input_file (str) – Relative or absolute path to h5netcdf file containing Xarray Datasets of Abaqus simulation results.

  • output_file (str) – The plot file name. Relative or absolute path.

  • x_path (str) – The HDF5 path to the x data

  • y_path (str) – The HDF5 path to the y data

  • x_label (str) – The label (without units) for the x data

  • y_label (str) – The label (without units) for the y data

  • x_units (str) – The independent (x-axis) units

  • y_units (str) – The dependent (y-axis) units

  • csv_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.

Returns:

output_file

modify_input.py

model_package.DNS_Abaqus.modify_input.modify_input(input_file, output_file)[source]

Modify Abaqus input file to output ‘COORD’ at integration points

Parameters:
  • input_file (str) – Relative or absolute path to Abaqus input (.inp) file.

  • output_file (str) – Relative or absolute path to modified Abaqus input (.inp) file.

ODBextract_to_XDMF.py

model_package.DNS_Abaqus.ODBextract_to_XDMF.ODBextract_to_XDMF(input_file, output_file, elem_path, node_path, mesh_path, collocation_option, ref_density, velocities=False, accelerations=False, specific_frames=None, dump_all_33_stresses=None)[source]

Convert Abaqus DNS results to XDMF format

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • output_file (str) – Name for XDMF file pair output for the Micromorphic Filter.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • ref_density (float) – The reference density of the material in g/cm^3

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

  • dump_all_33_stresses (str) – Optional filename to dump all 33 stresses from DNS

model_package.DNS_Abaqus.ODBextract_to_XDMF.interpolate_to_center_c3d8(node_array, mesh)[source]

Average a vector or tensor field from the nodes to the center of a trilinear hexahedral element (C3D8)

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF.interpolate_to_ip_c3d8(node_array, mesh)[source]

interpolate a vector field from the nodes to the integration points of a trilinear hexahedral element (C3D8)

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF.new_XDMF_writer(results, output_file, times, ref_density)[source]

Write XDMF file of collected ABaqus DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • times (list) – Time increments of DNS

  • ref_density (float) – The reference density of the material in g/cm^3 which is then converted to Mg/mm^3

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_Abaqus.ODBextract_to_XDMF.parse_input(input_file, elem_path, node_path, mesh_path, collocation_option, velocities=False, accelerations=False, specific_frames=None)[source]

Parse the HDF5 file output by ODBextract (WAVES tool)

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

Returns:

dictionary of results, list of frames, list of time increments

model_package.DNS_Abaqus.ODBextract_to_XDMF.str2bool(v)[source]

Function for converting string to Boolean. Borrowed from: https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

Parameters:

v (str/bool) – A string or boolean indicating a True or False value

Returns:

True or False

ODBextract_to_XDMF_neper.py

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.ODBextract_to_XDMF(input_file, output_file, elem_path, node_path, mesh_path, collocation_option, ref_density, element_type, velocities=False, accelerations=False, specific_frames=None, dump_all_33_stresses=None, init_ref=None, sets_file=None, num_steps=None)[source]

Convert Abaqus DNS results of 3D bonded grains to XDMF format

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • output_file (str) – Name for XDMF file pair output for the Micromorphic Filter.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

  • ref_density (float) – The reference density of the material in g/cm^3

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

  • dump_all_33_stresses (str) – Optional filename to dump all 33 stresses from DNS

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.c3d4_volume(node_location, mesh)[source]

Calculate volume of tetrahedral elements in a mesh https://math.stackexchange.com/questions/3616760/how-to-calculate-the-volume-of-tetrahedron-given-by-4-points http://tamivox.org/redbear/tetra_calc/index.html

Parameters:
  • node_location (array-like) – location of nodes in reference state`

  • mesh (array-like) – the element connectivity for all elements

Returns:

array of calculated tetrahedral volumes

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.initialize_reference(old_results, old_times, input_file, mesh_path, collocation_option)[source]

Manually initialize reference increment

Parameters:
  • old_results (dict) – dictionary of results without reference state

  • old_times (list) – Time increments of DNS without reference state

  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • mesh_path (str) – HDF5 path to mesh data

  • collocation_option (str) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

Returns:

New results dictinoary and times array including reference increment

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.interpolate_to_center(node_array, mesh)[source]

Average a vector or tensor field from the nodes to the center of an element

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.interpolate_to_ip_c3d8(node_array, mesh)[source]

interpolate a vector field from the nodes to the integration points of a trilinear hexahedral element (C3D8)

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.new_XDMF_writer(results, output_file, times, ref_density, sets=None)[source]

Write XDMF file of collected ABaqus DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • times (list) – Time increments of DNS

  • ref_density (float) – The reference density of the material in g/cm^3 which is then converted to Mg/mm^3

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.parse_input(input_file, elem_path, node_path, mesh_path, collocation_option, element_type, velocities=False, accelerations=False, specific_frames=None)[source]

Parse the HDF5 file output by ODBextract (WAVES tool)

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

Returns:

dictionary of results, list of frames, list of time increments

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper.str2bool(v)[source]

Function for converting string to Boolean. Borrowed from: https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

Parameters:

v (str/bool) – A string or boolean indicating a True or False value

Returns:

True or False

ODBextract_to_XDMF_neper_2d.py

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.ODBextract_to_XDMF(input_file, output_file, elem_path, node_path, mesh_path, collocation_option, ref_density, element_type, velocities=False, accelerations=False, specific_frames=None, init_ref=None, sets_file=None, num_steps=None)[source]

Convert Abaqus DNS results of 32D bonded grains to XDMF format

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • output_file (str) – Name for XDMF file pair output for the Micromorphic Filter.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

  • ref_density (float) – The reference density of the material in g/cm^3

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.c3d4_volume(node_location, mesh)[source]

Calculate volume of tetrahedral elements in a mesh https://math.stackexchange.com/questions/3616760/how-to-calculate-the-volume-of-tetrahedron-given-by-4-points http://tamivox.org/redbear/tetra_calc/index.html

Parameters:
  • node_location (array-like) – location of nodes in reference state`

  • mesh (array-like) – the element connectivity for all elements

Returns:

array of calculated tetrahedral volumes

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.collect_tri_areas(points, connectivity)[source]

Calculate the area of all triangular elements/cells

\[\begin{split}A = \frac{1}{2} det \left( \begin{bmatrix} 1 & 1 & 1\\ x1 & x2 & x3\\ y1 & y2 & y3 \end{bmatrix} \right)\end{split}\]
Params array points:

nodal coordinates

Params list connectivity:

list of arrays containing element connectivity

Returns:

array of triangular areas

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.initialize_reference(old_results, old_times, input_file, mesh_path, collocation_option)[source]

Manually initialize reference increment

Parameters:
  • old_results (dict) – dictionary of results without reference state

  • old_times (list) – Time increments of DNS without reference state

  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • mesh_path (str) – HDF5 path to mesh data

  • collocation_option (str) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

Returns:

New results dictinoary and times array including reference increment

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.interpolate_to_center(node_array, mesh)[source]

Average a vector or tensor field from the nodes to the center of an element

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.interpolate_to_ip_c3d8(node_array, mesh)[source]

interpolate a vector field from the nodes to the integration points of a trilinear hexahedral element (C3D8)

Parameters:
  • node_array (array-like) – nodal data to be interpolated

  • mesh (array-like) – the element connectivity for all elements

Returns:

dictionary of interpolated results

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.new_XDMF_writer(results, output_file, times, ref_density, sets=None)[source]

Write XDMF file of collected ABaqus DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • times (list) – Time increments of DNS

  • ref_density (float) – The reference density of the material in g/cm^3 which is then converted to Mg/mm^3

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.parse_input(input_file, elem_path, node_path, mesh_path, collocation_option, element_type, velocities=False, accelerations=False, specific_frames=None)[source]

Parse the HDF5 file output by ODBextract (WAVES tool)

Parameters:
  • input_file (str) – HDF5 file of Abaqus results extracted using the ODB_extract module of WAVES.

  • elem_path (str) – HDF5 path to element data

  • node_path (str) – HDF5 path to node data

  • mesh_path (str) – HDF5 path to mesh data

  • option (str collocation) – String specifying “center” to collocate to element center or “ip” for integration points

  • element_type (str) – Abaqus element type

  • velocities (bool) – Boolean whether or not to collect DNS velocity data

  • accelerations (bool) – Boolean whether or not to collect DNS accelerations data

  • specific_frames (list) – An optional list of frame numbers for converting XDMF data

Returns:

dictionary of results, list of frames, list of time increments

model_package.DNS_Abaqus.ODBextract_to_XDMF_neper_2d.str2bool(v)[source]

Function for converting string to Boolean. Borrowed from: https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

Parameters:

v (str/bool) – A string or boolean indicating a True or False value

Returns:

True or False

parse_sets_from_inp.py

model_package.DNS_Abaqus.parse_sets_from_inp.parse_sets_from_inp(input_file, output_file)[source]

Extract element IDs associated with element sets from Abaqus input file

write_section_file.py

model_package.DNS_Abaqus.write_section_file.write_section_file(output_file, number_grains, material_name)[source]

Write an Abaqus input file for the section definition of grains

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • number_grains (int) – The number of sections to create corresponding to unqieu grains

  • material_name (str) – The name of the material to assign to sections

Returns:

output_file

DNS_GEOS

plot_force_displacement.py

model_package.DNS_GEOS.plot_force_displacement.plot_force_displacement(csv_file, output_file, output_csv, force_col=' Rz+', length_col=' length_z', force_factor=1, disp_factor=1, filter_markers=None)[source]

Process force-displacement from GEOS DNS results

Parameters:
  • csv_file (str) – The csv file containing force results

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • face_id (int) – The face id (or ids) of forces to process

  • final_disp (float) – The final displacement (mm) to linearly ramp over simulation duration

  • force_col (str) – The column containing desired force information

  • header_col (int) – The row containing the headers

  • force_factor (float) – The factor to scale force

Returns:

Write output_file and output_csv

vtk_to_xdmf.py

model_package.DNS_GEOS.vtk_to_xdmf.collect_VTK_output(input_file, file_root)[source]

Parse the GEOS DNS VTK output into a results dictionary

Parameters:
  • input_file (str) – The main VTK PVD file containing GEOS DNS results

  • file_root (str) – The root directory containing DNS results

Returns:

dictionary of results, array of reference positions

model_package.DNS_GEOS.vtk_to_xdmf.convert_VTK_to_XDMF(input_file, file_root, output_file, dist_factor=1, stress_factor=1, density_factor=1)[source]

Convert GEOS DNS results to XDMF format using XML element tree

Parameters:
  • input_file (str) – The main VTK PVD file containing GEOS DNS results

  • file_root (str) – The root directory containing DNS results

  • output_file (str) – The output filename for the h5 + XDMF file pair

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

model_package.DNS_GEOS.vtk_to_xdmf.convert_to_XDMF(results, reference_positions, output_file, dist_factor, stress_factor, density_factor)[source]

Write XDMF file of collected GEOS DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • reference_positions (dict) – dictionary of reference particle positions

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/tonne^3, default=1

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_GEOS.vtk_to_xdmf.get_data(child)[source]

Collect field data from an XML DataArray

Parameters:

child (node) – The xml child node containing GEOS field data

Returns:

Array containing field values

vtk_to_xdmf_fast.py

model_package.DNS_GEOS.vtk_to_xdmf_fast.collect_and_convert_to_XDMF(vtm_file_dict, increments, output_file, dist_factor, stress_factor, density_factor)[source]

Write XDMF file of collected GEOS DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • reference_positions (dict) – dictionary of reference particle positions

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_GEOS.vtk_to_xdmf_fast.convert_VTK_to_XDMF(input_file, file_root, output_file, dist_factor=1, stress_factor=1, density_factor=1)[source]

Convert GEOS DNS results to XDMF format using VTK utilities

Parameters:
  • input_file (str) – The main VTK PVD file containing GEOS DNS results

  • file_root (str) – The root directory containing DNS results

  • output_file (str) – The output filename for the h5 + XDMF file pair

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

vtk_to_xdmf_fast_multi.py

model_package.DNS_GEOS.vtk_to_xdmf_fast_multi.collect_and_convert_to_XDMF(vtm_file_dict, increments, output_file, dist_factor, stress_factor, density_factor, annulus_ratio, upscale_damage=None, num_ranks=1000, grain_particle_key=1, binder_particle_key=2)[source]

Write XDMF file of collected GEOS DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • reference_positions (dict) – dictionary of reference particle positions

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

  • annulus_ratio (float) – Optional fraction of the radius of points to keep in the final geometry

  • upscale_damage (str) – Option to specify if damage will be upscaled

  • num_ranks (int) – The number of ranks to collect data from

  • grain_particle_key (int) – An integer specifying the particle key for grains

  • binder_particle_key (int) – An integer specifying the particle key for binder

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_GEOS.vtk_to_xdmf_fast_multi.convert_VTK_to_XDMF(input_file, file_root, output_file, dist_factor=1, stress_factor=1, density_factor=1, annulus_ratio=None, upscale_damage=None, num_ranks=1000, grain_particle_key=1, binder_particle_key=2)[source]

Convert multiblock GEOS DNS results to XDMF format using VTK utilities

Parameters:
  • input_file (str) – The main VTK PVD file containing GEOS DNS results

  • file_root (str) – The root directory containing DNS results

  • output_file (str) – The output filename for the h5 + XDMF file pair

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

  • annulus_ratio (float) – Optional fraction of the radius of points to keep in the final geometry

  • upscale_damage (str) – Option to specify if damage will be upscaled

  • num_ranks (int) – The number of ranks to collect data from

  • grain_particle_key (int) – An integer specifying the particle key for grains

  • binder_particle_key (int) – An integer specifying the particle key for binder

model_package.DNS_GEOS.vtk_to_xdmf_fast_multi.create_annulus(coord, rad, x0, y0, annulus_ratio)[source]

Remove points except those within some fraction of the outer radius

Parameters:
  • coord (array-like) – Reference coordinates of points

  • rad (float) – The radius of the cylinder

  • x0 (float) – The x-position of the cylinder axis

  • y0 (float) – The y-position of the cylinder axis

  • annulus_ratio (float) – Fraction of the radius of points to keep in the final geometry

Returns:

array of coordinates for points kept, mask of original array to produce final array

model_package.DNS_GEOS.vtk_to_xdmf_fast_multi.multi_blocks_to_array(field, particle_region_block, all_fields_dict, num_partitions=1000, stack='v', id_sort=None)[source]

Extract data for a particular field from a vtk multi block dataset

Parameters:
  • field (str) – The name of the field

  • particle_region_block (vtkMultiBlockDataSet) – The vtk dataset containing information to extract

  • all_fields_dict (dict) – Dictionary for mapping the requested field name to an index in the multi block dataset

  • num_partitions (int) – The number of partitions the full data field is split between corresponding to the number of ranks for the GEOS simulations

  • stack (str) – Option to stack data vertically or horizontally

  • id_sort (array) – Optional ID array for sorting output array by particle ID

Returns:

Array of data

model_package.DNS_GEOS.vtk_to_xdmf_fast_multi.parse_VTP_file(input_file, file_root)[source]

Parse time and subfile information from a VTP file into a dictionary

Parameters:
  • input_file (str) – The VTP file to parse

  • file_root (str) – The directory within peta_data_copy containing DNS results

Returns:

dictionary containing timestamps and vtm files, list of increment numbers

DNS_RATEL

build_options_file.py

model_package.DNS_Ratel.build_options_file.build_options_file(output_file, material_E, material_nu, material_rho, top_id, bottom_id, num_steps, displacement, BCs)[source]

Write Ratel options file

Parameters:
  • output_file (str) – The name of the Ratel options file to output

  • material_E (str) – The material’s elastic modulus

  • material_nu (str) – The material’s Poisson ratio

  • material_rho (str) – The material’s density

  • top_id (int) – The id of the top surface

  • bottom_id (int) – The id of the bottom surface

  • num_steps (int) – The number of steps for the simulation

  • displacement (float) – The displacement to apply to the top surface

  • BCs (str) – The type of boundary conditions, either ‘slip’ or ‘clamp’

Returns:

Write output_file

cgns_to_xdmf.py

model_package.DNS_Ratel.cgns_to_xdmf.collect_and_convert_to_XDMF(input_files, output_file, dist_factor, stress_factor, density_factor, damage)[source]

Write XDMF file of collected Ratel DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • node_dict (dict) – dictionary of nodal coordinates

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • dist_factor (float) – Argument to scale DNS displacements and coordinates

  • stress_factor (float) – Argument to scale DNS stresses

  • density_factor (float) – Factor to scale current density (if provided in the DNS results to Mg/mm^3

Returns:

{output_file}.xdmf and {outptu_file}.h5

model_package.DNS_Ratel.cgns_to_xdmf.convert_CGNS_to_XDMF(input_files, output_file, dist_factor=1, stress_factor=1, density_factor=1, dump_all_33_stresses=None, damage=False)[source]

Driving function to call functions for parsing Ratel CGNS results and writing XDMF output

Parameters:
  • input_file (list) – The input VTK files containing Ratel DNS results

  • output_file (str) – The output filename for the h5 + XDMF file pair

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

model_package.DNS_Ratel.cgns_to_xdmf.unpack_CGNS_coordinates(tree, dist_factor)[source]

Collect and scale the reference positions of nodes from a CGNS tree

Params tree tree:

A CGNS tree

Parameters:

dist_factor (float) – Optional argument to scale DNS displacements and coordinates

model_package.DNS_Ratel.cgns_to_xdmf.unpack_diagnostic(tree, diagnostic_path, quantity)[source]

Collect values of a diagnostic quantity from a CGNS tree

Params tree tree:

A CGNS tree

Params str diagnostic_path:

The root CGNS path for all diagnostic quantities in a given timestep

Params str quantity:

The diagnostic quantity to extract

Returns:

Array of diagnostic quantity data

plot_force_displacement.py

model_package.DNS_Ratel.plot_force_displacement.plot_force_displacement(csv_file, output_file, output_csv, face_id=None, final_disp=None, force_col='force_z', header_row=0, force_factor=1, filter_markers=None)[source]

Process force-displacement from Ratel DNS results

Parameters:
  • csv_file (str) – The csv file containing force results

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • face_id (int) – The face id (or ids) of forces to process

  • final_disp (float) – The final displacement (mm) to linearly ramp over simulation duration

  • force_col (str) – The column containing desired force information

  • header_col (int) – The row containing the headers

  • force_factor (float) – The factor to scale force

Returns:

Write output_file and output_csv

vtk_to_xdmf.py

model_package.DNS_Ratel.vtk_to_xdmf.collect_VTK_output(input_files)[source]

Parse the Ratel DNS VTK output into a results dictionary

Parameters:

input_files (list) – The input VTK files containing Ratel DNS results

Returns:

dictionary of results, dictionary of nodal coordinates

model_package.DNS_Ratel.vtk_to_xdmf.convert_VTK_to_XDMF(input_files, output_file, dist_factor=1, stress_factor=1, ref_density=2e-09, density_factor=1, dump_all_33_stresses=None)[source]

Driving function to call functions for parsing Ratel VTK results and writing XDMF output

Parameters:
  • input_file (list) – The input VTK files containing Ratel DNS results

  • output_file (str) – The output filename for the h5 + XDMF file pair

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • ref_density (float) – Optional argument to specify the reference density to be converted to current density by the Jacobian of deformation if current density is not reported in the DNS results, default=2.e-9

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

model_package.DNS_Ratel.vtk_to_xdmf.convert_to_XDMF(results, node_dict, output_file, dist_factor, stress_factor, ref_density, density_factor)[source]

Write XDMF file of collected Ratel DNS results for Micromorphic Filter

Parameters:
  • results (dict) – dictionary of results

  • node_dict (dict) – dictionary of nodal coordinates

  • output_file – Name for XDMF file pair output for the Micromorphic Filter

  • dist_factor (float) – Optional argument to scale DNS displacements and coordinates, default=1

  • stress_factor (float) – Optional argument to scale DNS stresses, default=1

  • ref_density (float) – Optional argument to specify the reference density to be converted to current density by the Jacobian of deformation if current density is not reported in the DNS results, default=2.e-9

  • density_factor (float) – Optional factor to scale current density (if provided in the DNS results to Mg/mm^3, default=1

Returns:

{output_file}.xdmf and {outptu_file}.h5

Filter

bounds_from_DNS.py

model_package.Filter.bounds_from_DNS.bounds_from_DNS(DNS_file, output_file, coord='coord')[source]

Create a csv file containing the extents of a DNS results file

Parameters:
  • DNS_file (str) – The name of the input XDMF file containing DNS results

  • output_file (str) – The name of the output csv file of bounding information

  • coord (str) – The name of the coordinate field

Returns:

output_file

build_filter_config.py

model_package.Filter.build_filter_config.get_set_yaml_depth(data, depth=0)[source]

Determine the levels of a yaml file containing set information for prescribed micro-averaging domains

Params dict/list data:

Data unpacked from a yaml file containing prescribed micro-averaging set information

Parameters:

depth (int) – default depth of yaml file

Returns:

Integer depth value

model_package.Filter.build_filter_config.write_filter_config(output_file, job_name, dns_file, macro_file, volume, density, displacement, cauchy_stress, velocity=None, acceleration=None, damage=None, max_parallel=None, sets_file=None, micro_averaging_domains='auto', update_filter_domains=False, plot_micro_domains=False)[source]

Write the configuration file for the Micromorphic Filter

Parameters:
  • output_file (str) – The output filename for filter configuration

  • job_name (str) – The name of the job for the Micromorphic Filter

  • dns_file (str) – The name of the XDMF file containing DNS data

  • macro_file (str) – The name of the macroscale filter domain file

  • volume (str) – The string identifying volume quantities located in “dns_file”

  • density (str) – The string identifying density quantities located in “dns-file”

  • cauchy_stress (str) – The string identifying stress quantities located in “dns-file”

  • displacement (str) – The string identifying displacement quantities located in “dns-file”

  • velocity (str) – Optional string identifying velocity quantities located in “dns-file”

  • acceleration (str) – Optional string identifying acceleration quantities located in “dns-file”

  • damage (str) – Optional string identifying damage quantities located in “dns-file”

  • max_parallel (int) – Optional parameter defining the number of parallel processes for the Micromorphic Filter

  • sets_file (str) – Optional yaml file containing prescribed micro-averaging domains, required if micro_averaging_domains=’prescribed’

  • micro_averaging_domains (bool) – Micro-averaging domain detection method. Options include “auto,” “prescribed,” “spectral,” or “HDBSCAN_recursive”

  • update_file_domains (bool) – Option ot update filter and micro-averaging domains for each time step

  • plot_micro_domains (bool) – Option to request filter to plot micro-averaging domains

returns output_file

collect_multi_domain_errors.py

model_package.Filter.collect_multi_domain_errors.collect_errors(csv_files, num_domains, output_file)[source]

Collect balance equation errors across filter domain studies

Parameters:
  • csv_file (list) – A list of csv files containing balance equation errors

  • num_domains (list) – A list of integers corresponding to the number of filtering domains associated with results contained in each csv file

  • output_file (str) – The name of the output file of collected results

Returns:

output_file

collect_multi_domain_stats.py

model_package.Filter.collect_multi_domain_stats.collect_results(csv_files, num_domains, output_file=None, box_plot=None, narrow=False)[source]

Collect statistics of a homogenized micromorphic quantity across filter domain studies

Parameters:
  • csv_files (list) – A list of csv files containing information to collect

  • num_domains (list) – A list of integers corresponding to the number of filtering domains associated with results contained in each csv file

  • output_file (str) – The name of the output file of collected results

  • box_plot (str) – The name of an optional box and whisker plot

  • narrow (str) – Optional flag to make a narrow box plot

Returns:

Summary csv file named output_file and optionally a violin plot named box_plot

force_bounds.py

model_package.Filter.force_bounds.force_bounds(output_file, xmin, xmax, ymin, ymax, zmin, zmax)[source]

Create a csv file containing information for a bounding box encompassing all DNS points

Parameters:
  • output_file (str) – The name of the output csv file

  • xmin (float) – The minimum x-value

  • xmax (float) – The maximum x-value

  • ymin (float) – The minimum y-value

  • ymax (float) – The maximum y-value

  • zmin (float) – The maximum z-value

  • zmax (float) – The maximum z-value

Returns:

Write output_file

parse_balance_errors.py

model_package.Filter.parse_balance_errors.parse_errors(input_file, output_csv, output_plot=None)[source]

Parse balance equation errors from Micromorphic Filter standard output

Parameters:
  • input_file (str) – The standard out file produced when running the Micromorphic Filter

  • output_csv (str) – Name of output csv file summarizing output for each timestep

  • output_plot (str) – Optional filename to plot balance equation errors

Returns:

{output_csv} and optionally {output_plot}

model_package.Filter.parse_balance_errors.plot_errors(df, output_plot)[source]

Plot balance equation errors

Parameters:
  • df (dataframe) – Pandas dataframe containing balance equation errors

  • output_plot (str) – Output filename of plot

Returns:

{output_plot}

run_micromorphic_filter.py

model_package.Filter.run_micromorphic_filter.run_filter(config_file, damage_class=None)[source]

Run the Micromorphic Filter

Parameters:

config_file (str) – The filter configuration file

Runs the Micromorphic Filter

single_macroscale.py

model_package.Filter.single_macroscale.single_domain(X1, X2, Y1, Y2, Z1, Z2, output_file)[source]

Creates an XDMF file containing a single hexahedral element

Parameters:
  • X1 (float) – The minimum X value

  • X2 (float) – The maximum X value

  • Y1 (float) – The minimum Y value

  • Y2 (float) – The maximum Y value

  • Z1 (float) – The minimum Z value

  • Z2 (float) – The maximum Z value

  • output_file (str) – The output filename for the h5 + XDMF file pair

Returns:

{output_file}.h5 and {output_file}.xdmf

model_package.Filter.single_macroscale.single_quad_domain(X1, X2, Y1, Y2, output_file)[source]

Creates an XDMF file containing a single quadrilateral element

Parameters:
  • X1 (float) – The minimum X value

  • X2 (float) – The maximum X value

  • Y1 (float) – The minimum Y value

  • Y2 (float) – The maximum Y value

  • output_file (str) – The output filename for the h5 + XDMF file pair

Returns:

{output_file}.h5 and {output_file}.xdmf quadrilateral filter files

model_package.Filter.single_macroscale.write_filter_domain(output_file, single_points=None, csv_file=None, dimension=3)[source]

Write a single macroscale domain file for the Micromorphic Filter

Parameters:
  • output_file (str) – The output filename for the h5 + XDMF file pair

  • single_points (list) – The X, Y, and Z extens for a single element filter domain

  • csv_file (str) – CSV filename containing the bounds of a DNS file

Calls single_domain function to generate XDMF file

visualize_results.py

model_package.Filter.visualize_results.average_quantities(quantities, dim=3)[source]

Average 2nd order tensor quantites over quadrature points

Parameters:
  • quantities (dict) – A 2nd order tensor dictionary with keys for quadrature points and values storing a 4d array where indices correspond to time, element number, component i, and component j

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output dict with same indices as quantities and a single key

model_package.Filter.visualize_results.calculate_initial_grain_volume_fraction(density, rho_binder, rho_grain, nqp)[source]

Calculate the initial grain volume fraction given the homogenized density and two reference densities

Parameters:
  • density (dict) – Dictionary containing homogenized densities

  • rho_binder (str) – The density of the binder material, required if ‘csv-all-quantities-single-domain’ is specified

  • rho_grain (str) – The density of the grain material, required if ‘csv-all-quantities-single-domain’ is specified

  • nqp (int) – The number of quadrature points

Returns:

Dictionary of grain volume fractions for each quadrature point

model_package.Filter.visualize_results.csv_all_quantities(output_file, times, nqp, quantities, quantity_names, dim=3)[source]

Create csv file of a list of quantities for a single domain

Parameters:
  • output_file (str) – Output filename

  • times (array-like) – Array of times

  • nqp (int) – The number of quadrature points

  • quantities (list) – A list containing Micromorphic Filter output quantities

  • quantity_names (list) – A list containing the names of Micromorphic Filter output quantities

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

Write output_file

model_package.Filter.visualize_results.csv_machine(quantity, output_file, nqp, nel, time, three_point=False, dim=3)[source]

Write a text dump summarizing a variety of statistics

Parameters:
  • quantities (dict) – A 2nd or third order tensor dictionary with keys for quadrature points and values storing a 4d array where indices correspond to time, element number, component i, and component j

  • output_file (str) – Output filename

  • nqp (int) – The dictionary key of the quantityt to output

  • nel (int) – The desired element of the quantity to output

  • time (int) – The desired time increment to output the quantity

  • three_point (bool) – Parameter indicating if tensor is 2nd or 3rd order. “False” by default

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_file

model_package.Filter.visualize_results.deviatoric(stress, dim=3)[source]

Calculate the deviatoric component of a stress quantity

Parameters:
  • stress (array-like) – A second order tensor or 9-component slice of a third order tensor

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

deviatoric of stress

model_package.Filter.visualize_results.dump_all(quantity, output_file, icomp, jcomp, nqp, nel, time)[source]

Dump all values for particular components of a 2nd order tensor for a given time value and element number

Parameters:
  • quantities (dict) – A 2nd order tensor dictionary with keys for quadrature points and values storing a 4d array where indices correspond to time, element number, component i, and component j

  • output_file (str) – Output filename

  • icomp (int) – the desired i component of the quantity to output

  • jcomp (int) – the desired j component of the quantity to output

  • nqp (int) – The number of quadrature points

  • nel (int) – The desired element of the quantity to output

  • time (int) – The desired time increment to output the quantity

Returns:

output_file

model_package.Filter.visualize_results.filter_stress_above_threshold(stress_lists, strain_lists, threshold, elem_qp_string)[source]

Filter out stresses above some threshold for a given element and quadrature point

Parameters:
  • stress_lists (list) – List of arrays/lists containing stress histories

  • strain_lists (list) – List of array/lists containing strain histories

  • threshold (float) – Upper limit threshold for filtering stresses

  • elem_qp_string (str) – The element id and quadrature point id for the provided stress and strain lists

Returns:

Stress lists filtered below threshold, strain lists masked by filtered stress lists

model_package.Filter.visualize_results.get_R_and_U(PK2, F, chi, times, dim=3)[source]

Calculate macro and micro stretches and deformations from deformation gradients

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola Kirchhoff stress

  • F (dict) – The quantities dict storing the macro deformation gradient

  • chi (dict) – The quantities dict storing the micro deformation

  • times (array-like) – The time increments

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

macro rotation (R), macro stretch (U), micro rotation (Rchi), and micro stretch (Uchi)

model_package.Filter.visualize_results.p_q_plot(PK2, SIGMA, M, E, nqp, nel, ninc, output_name, dim=3)[source]

Plot the pressure versus deviatoric norm (P-Q) plot for second Piola-Kirchhoff, symmetric micro, and higher order stresses

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola-Kirchhoff stress

  • SIGMA (dict) – The quantities dict storing symmetric micro stress

  • M (dict) – THe quantities dict storing higher order stress

  • E (dict) – The quantities dict storing Green-Lagrange strain

  • Ecal (dict) – The quantities dict storing micro-strain

  • Gamma (dict) – The quantities dict storing micro deformation gradient

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • ninc (int) – The number of time increments

  • output_name (str) – Output filename

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name plot

model_package.Filter.visualize_results.plot_axial_vector_mag(cauchy, times, average, output_name, dim=3)[source]

Plot the magnitude of the Cauchy couple

Parameters:
  • cauchy (dict) – The quantities dict storing Cauchy stress

  • times (array-like) – The time increments

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.plot_best_stress_norm(PK2, SIGMA, M, E, Ecal, Gamma, nqp, nel, ninc, output_name, transparency=None, dim=3, upper_limit=None)[source]

Plot the infinity norms of deviatoric second Piola-Kirchhoff, symmetric micro, and higher order stresses versus relevant deformation measures

Parameters:
  • cauchy (dict) – The quantities dict storing Cauchy stress

  • symm (dict) – The quantities dict storing symmetric micro stress

  • m (dict) – THe quantities dict storing higher order stress

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • times (array-like) – The time increments

  • output_name (str) – Output filename

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

  • upper_limit (float) – Optional value above which stresses will be ignored

Returns:

output_name plot

model_package.Filter.visualize_results.plot_better_stress_norm(PK2, SIGMA, M, E, Ecal, Gamma, nqp, nel, ninc, output_name, dim=3)[source]

Plot the infinity norms of deviatoric Cauchy, symmetric micro, and higher stresses

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola-Kirchhoff stress

  • SIGMA (dict) – The quantities dict storing symmetric micro stress

  • M (dict) – THe quantities dict storing higher order stress

  • E (dict) – The quantities dict storing Green-Lagrange strain

  • Ecal (dict) – The quantities dict storing micro-strain

  • Gamma (dict) – The quantities dict storing micro deformation gradient

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • ninc (int) – The number of time increments

  • output_name (str) – Output filename

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name plot

model_package.Filter.visualize_results.plot_current_stresses(e, stress, average, output_name, dim=3)[source]

Plot stress vs strain in the current configuration

Parameters:
  • e (dict) – The quantities dict storing Euler-Almansi strain

  • stress (dict) – The quantities dict storing either Cauchy or symmetric micro stress

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.plot_first_moment_of_momentum_measures(coup, spins, times, average, plot_body_couples=None, plot_spin_inertias=None, plot_spin_diff=None, dim=3)[source]

Plot the first moment of momentum measures

Parameters:
  • coup (dict) – The quantities dict storing body couples

  • spins (dict) – THe quantities dict stroring micro spin inertias

  • times (array-like) – The time increments

  • average (bool) – Average over quadrature points if True

  • plot_body_couples (str) – Optional filename to plot body couples vs. simulation time

  • plot_spin_inertias (str) – Optional filename to plot micro spin inertias vs. simulation time

  • plot_spin_diff (str) – Optional filename to plot difference between body couples and micro spin inertias

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

plot_body_couples, plot_spin_inertias, and plot_spin_diff

model_package.Filter.visualize_results.plot_norm_history(PK2, SIGMA, M, E, Ecal, Gamma, nqp, nel, ninc, times, output_name, dim=3)[source]

Plot the infinity norms of deviatoric second Piola-Kirchhoff, symmetric micro, and higher order stresses versus time

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola-Kirchhoff stress

  • SIGMA (dict) – The quantities dict storing symmetric micro stress

  • M (dict) – THe quantities dict storing higher order stress

  • E (dict) – The quantities dict storing Green-Lagrange strain

  • Ecal (dict) – The quantities dict storing micro-strain

  • Gamma (dict) – The quantities dict storing micro deformation gradient

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • ninc (int) – The number of time increments

  • times (array-like) – The time increments

  • output_name (str) – Output filename

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name plot

model_package.Filter.visualize_results.plot_reference_stresses(E, stress, average, output_name, dim=3)[source]

Plot stress vs strain in the reference configuration

Parameters:
  • E (dict) – The quantities dict storing Green-Lagrance strain

  • stress (dict) – The quantities dict storing either second Piola Kirchhoff or Symmetric micro stress

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.plot_rot_diffs(PK2, times, R, Rchi, average, output_name, dim=3)[source]

Plot differences between macro and micro rotations

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola Kirchhoff stress

  • times (array-like) – The time increments

  • R (dict) – The quantities dict storing macro rotations

  • Rchi (dict) – The quantities dict storing micro rotations

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.plot_stress_diffs(cauchy, symm, times, average, output_name, dim=3)[source]

Plot differences between Cauchy and micro symmetric stresses

Parameters:
  • cauchy (dict) – The quantities dict storing Cauchy stress

  • symm (dict) – The quantities dict storing symmetric micro stress

  • times (array-like) – The time increments

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.plot_stress_norm(cauchy, symm, m, nqp, nel, ninc, times, output_name, dim=3)[source]

Plot the infinity norms of deviatoric Cauchy, symmetric micro, and higher stresses

Parameters:
  • cauchy (dict) – The quantities dict storing Cauchy stress

  • symm (dict) – The quantities dict storing symmetric micro stress

  • m (dict) – THe quantities dict storing higher order stress

  • nqp (int) – The number of quadrature points

  • nel (int) – The number of elements

  • ninc (int) – The number of time increments

  • times (array-like) – The time increments

  • output_name (str) – Output filename

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name plot

model_package.Filter.visualize_results.plot_stretch_diffs(PK2, times, U, Uchi, average, output_name, dim=3)[source]

Plot differences between macro and micro stretches

Parameters:
  • PK2 (dict) – The quantities dict storing second Piola Kirchhoff stress

  • times (array-like) – The time increments

  • U (dict) – The quantities dict storing macro stretches

  • Uchi (dict) – The quantities dict storing micro stretches

  • average (bool) – Average over quadrature points if True

  • output_name (str) – The output plot name

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

output_name

model_package.Filter.visualize_results.str2bool(v)[source]

Function for converting string to Boolean. Borrowed from: https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

Parameters:

v (str/bool) – A string or boolean indicating a True or False value

Returns:

True or False

model_package.Filter.visualize_results.triple_deviatoric(stress, dim=3)[source]

Calculate the deviatoric component of a stress quantity

Parameters:
  • stress (array-like) – A second order tensor or (dim*dim)-component slice of a third order tensor

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

Returns:

deviatoric of stress

model_package.Filter.visualize_results.visualize_results(input_file, average, num_domains, plot_cauchy_couple=None, plot_cauchy_stress=None, plot_PK2_stress=None, plot_symm_stress=None, plot_SIGMA_stress=None, plot_stress_diff=None, plot_body_couples=None, plot_spin_inertias=None, plot_spin_diff=None, plot_rotation_diff=None, plot_stretch_diff=None, plot_stress_norms=None, plot_better_stress_norms=None, plot_best_stress_norms=None, plot_norm_histories=None, p_q_plots=None, csv_cauchy=None, csv_PK2=None, csv_GLstrain=None, csv_estrain=None, csv_ref_mod=None, csv_cur_mod=None, csv_symm=None, csv_stress_diff=None, csv_m=None, csv_M=None, csv_stress33_all=None, csv_all_quantities_single_domain=None, rho_binder=None, rho_grain=None, dim=3)[source]

Post-process Micromorphic Filter output

Parameters:
  • input_file (str) – The XDMF Micromorphic Filter results file

  • average (bool) – Average over quadrature points if True

  • num_domains (int) – The number of filter domains

  • plot_cauchy_couple (str) – Optional filename to plot Cauchy couple vs. simulation time

  • plot_cauchy_stress (str) – Optional filename to plot Cauchy stress vs. Eulerian strain

  • plot_PK2_stress (str) – Optional filename to plot PK2 stress vs. Green-Lagrange strain

  • plot_symm_stress (str) – Optional filename to plot symmetric micro stress vs. Eulerian strain

  • plot_SIGMA_stress (str) – Optional filename to plot Symmetric micro stress vs. Green-Lagrange strain

  • plot_stress_diff (str) – Optional filename to plot difference between Cauchy and symmetric micro stresses vs. simulation time

  • plot_body_couples (str) – Optional filename to plot body couples vs. simulation time

  • plot_spin_inertias (str) – Optional filename to plot micro spin inertias vs. simulation time

  • plot_spin_diff (str) – Optional filename to plot difference between body couples and micro spin inertias vs. simulation time

  • plot_rotation_diff (str) – Optional filename to plot difference between macro and micro rotations vs. simulation time

  • plot_stress_diff – Optional filename to plot differences between macro and micro stretches vs. simulation time

  • plot_stress_norms (str) – Optional filename to plot norms of cauchy stress, symmetric micro stress, difference between Cauchy and symmetric micro stresses, and higher order stress

  • plot_better_stress_norms (str) – Optional filename to plot norms of PK2 stress, Symmetric micro stress, difference between PK2 and Symmetric micro stresses, and higher order stress, all against norms of Green-Lagrange strain, Micro strain, and Micro-deformation

  • plot_best_stress_norms (str) – Optional filename to plot norm of PK2 stress vs Green-Lagrange strain, Symmetric micro stress vs Micro strain, and higher order stress vs micro-deformation

  • csv_cauchy (str) – Optional filename for csv output of Cauchy stress summary statistics

  • csv_PK2 (str) – Optional filename for csv output of PK2 stress summary statistics

  • csv_GLstrain (str) – Optional filename for csv output of Green-Lagrange strain summary statistics

  • csv_ref_mod (str) – Optional filename for csv output of ‘moduli’ calculation (S_{ij} / E_{ij}) in reference configuration summary statistics

  • csv_cur_mod (str) – Optional filename for csv output of ‘moduli’ calculation (sigma_{ij} / e_{ij}) in the current configuration summary statistics

  • csv_strain (str) – Optional filename for csv output of Eulerian strain summary statistics

  • csv_symm (str) – Optional filename for csv output of symmetric micro stress summary statistics

  • csv_stress_diff (str) – Optional filename for csv output of difference between Cauchy and symmetric micro stresses summary statistics

  • csv_m (str) – Optional filename for csv output of couple stress (current configuration) summary statistics

  • csv_M (str) – Optional filename for csv output of couple stress (reference configuration) summary statistics

  • csv_stress33_all (str) – Optional filename for csv output of all Cauchy 33 values

  • csv_all_quantities_single_domain (str) – Optional filename for csv output of all quantities for a single domain

  • rho_binder (str) – The density of the binder material, required if ‘csv-all-quantities-single-domain’ is specified

  • rho_grain (str) – The density of the grain material, required if ‘csv-all-quantities-single-domain’ is specified

  • dim (int) – The dimension of the arrays, ‘2’ for 2d or ‘3’ for 3d

xdmf_3d_calculations.py

model_package.Filter.xdmf_3d_calculations.assign_calibration_results(xdmf_file_out, calibration_map_file, reference_positions, connectivity)[source]

Write calibrated results onto unique elements of an XDMF file

Params object xdmf_file_out:

The XDMF file to write to

Params str calibration_map_file:

A csv file containing previously calibrated parameters.

Params array-like reference_positions:

The reference positions of nodes in an existing XDMF file

Params array-like connectivity:

The element to node connectivity in an existing XDMF file

Returns:

Write data to xdmf_file_out

model_package.Filter.xdmf_3d_calculations.average_over_quadrature(xdmf_file_in, type, qp_field_name, inc, num_elements, k=0)[source]

Call relevant stress calculation function for each quadrature point and return average

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params str type:

The type of stress quantity to calculate. Specify “p” for pressure of a second order tensor. Specify “q” for norm of the deviatoric part of a second order tensor. Specify “p3” for pressure of a third order tensor on 3rd index “k”. Specify “q3” for norm of the deviatoric part of a third order tensor on 3rd index “k”.

Params str qp_field_name:

The stress field (defined at the quadrature points) to consider

Params list inc:

The current time increment

Params int num_elements:

The number of macroscale elements

Params int k:

The 3rd index of a third order tensor if type is “p3” or “q3”

model_package.Filter.xdmf_3d_calculations.filter_stress_measures(xdmf_file_in, xdmf_file_out, incs, times, num_elements, reference_positions, connectivity)[source]

Calculate a variety of stress norms averaged over the quadrature points of trilinear hexahedral elements and write to an XDMF file

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params object xdmf_file_out:

The XDMF file to write to

Params list incs:

The list containing time increment indices

Params list times:

The list of unique time stamps

Params int num_elements:

The number of macroscale elements

Params array-like reference_positions:

The reference positions of nodes in an existing XDMF file

Params array-like connectivity:

The element to node connectivity in an existing XDMF file

Returns:

Write data to xdmf_file_out

model_package.Filter.xdmf_3d_calculations.three_devnorm(xdmf_file_in, qp_field_name, inc, num_elements, k)[source]

Calculate the norm of the deviatoric part of a third order tensor on 3rd index “k”

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params str qp_field_name:

The stress field (defined at the quadrature points) to consider

Params list inc:

The current time increment

Params int num_elements:

The number of macroscale elements

Params int k:

The 3rd index of the third order tensor

model_package.Filter.xdmf_3d_calculations.three_pressure(xdmf_file_in, qp_field_name, inc, num_elements, k)[source]

Calculate the pressure of a third order tensor on 3rd index “k”

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params str qp_field_name:

The stress field (defined at the quadrature points) to consider

Params list inc:

The current time increment

Params int num_elements:

The number of macroscale elements

Params int k:

The 3rd index of the third order tensor

model_package.Filter.xdmf_3d_calculations.two_devnorm(xdmf_file_in, qp_field_name, inc, num_elements)[source]

Calculate the norm of the deviatoric part of a second order tensor

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params str qp_field_name:

The stress field (defined at the quadrature points) to consider

Params list inc:

The current time increment

Params int num_elements:

The number of macroscale elements

model_package.Filter.xdmf_3d_calculations.two_pressure(xdmf_file_in, qp_field_name, inc, num_elements)[source]

Calculate the pressure of a second order tensor

Params object xdmf_file_in:

The XDMF file to calculate quantities from

Params str qp_field_name:

The stress field (defined at the quadrature points) to consider

Params list inc:

The current time increment

Params int num_elements:

The number of macroscale elements

Params int k:

The 3rd index of the third order tensor

model_package.Filter.xdmf_3d_calculations.xdmf_3d_calculations(input_file, output_file, write_type, num_elements=None, calibration_map_file=None)[source]

Create an XDMF file containing a variety of derived quantities

Params str input_file:

Specify the input filename for the h5 + XDMF file pair

Params str output_file:

Specify the output filenmae for the h5 + XDMF file pair

Params str write_type:

The type of quantities to write to XDMF. Choose “filter_stress_measures” to calculate stress invariants directly on filter results. Choose “calibration” results to display calibrations on static mesh.

Params int num_elements:

The number of macroscale elements

Parameters:

calibration_map_file (str) – A csv file containing previously calibrated parameters. Required if “–write-type calibration”

Returns:

Call either filter_stress_measures or assign_calibration_results depending on “write_type”

xdmf_local_paths.py

model_package.Filter.xdmf_local_paths.replace_paths(input_file, output_file, oldpath, newpath)[source]

Create a copy of an XDMF file with absolute H5 paths replaced with relative paths

Parameters:
  • input_file (str) – The XDMF file output by the Micromorphic Filter with absolute H5 paths

  • output_file (str) – The new XDMF file with relative H5 paths

  • oldpath (str) – The absolute path to be replaced by newpath

  • newpath (str) – The relative path to replace oldpath

Returns:

Write output_file

xdmf_tomfoolery.py

model_package.Filter.xdmf_tomfoolery.XDMF_tomfoolery(input_file, output_file)[source]

Modify an XDMF file by combining elements from separate ‘blocks’

Parameters:
  • input_file (str) – The XDMF mesh file to operate on

  • output_file (str) – The output filename for the h5 + XDMF file pair

Returns:

{output_file}.xdmf

Calibrate

build_calibration_map.py

model_package.Calibrate.build_calibration_map.build_calibration_map(output_file, calibrated_elements=None, calibrated_files=None, map_type='full_csv', material_type=None, best_parameters_yml_no_BCs=None, boundary_csv=None, previous_calibration_map=None, input_csv=None)[source]

Create a file mapping calibration results for each macroscale element

Params str output_file:

The name of the output csv file

Params list calibrated_elements:

A list of elements with associated calibration files

Params list calibrated_files:

A list of files containing calibration results

Params str map_type:

The type of calibration map to generate. ‘full_csv’ (default) to create a csv file containing material parameters mapped for every element. ‘ignore_boundary_yaml’ to create a yaml file containing names of yaml files containing material parameters for every element.

Parameters:

material_type (str) – The material type: ‘elastic’, ‘plastic’, or ‘full_plastic’

Params str best_parameters_yml_no_BCs:

A yaml file containing the ‘best’ calibration using the kernel density estimate for elements not on the boundary

Params str boundary_csv:

A csv file containing list of boundary elements

Params str previous_calibration_map:

A csv file containing a previous calibration map for all elements to be modified

Params str input_csv:

An input, previously generated csv file using ‘map_type=full_csv’ to be trimmed for Tardigrade

Returns:

Call full_csv_calibration_map function if map_type=’full_csv’, call ignored_elements_calibration_map function if map_type=’ignore_boundary_yaml’, or call trim_csv_file_for_tardigrade if map_type=’trim_for_tardigrade’

model_package.Calibrate.build_calibration_map.full_csv_calibration_map(output_file, calibrated_elements, calibrated_files, material_type)[source]

Create a file mapping calibration results for each macroscale element

Params str output_file:

The name of the output file

Params list calibrated_elements:

A list of elements with associated calibration files

Params list calibrated_files:

A list of files containing calibration results

Parameters:

material_type (str) – The material type: ‘elastic’, ‘plastic’, or ‘full_plastic’

Returns:

Write output_file

model_package.Calibrate.build_calibration_map.ignored_elements_calibration_map(output_file, best_parameters_yml_no_BCs, boundary_csv, previous_calibration_map)[source]

Create a yaml file to map calibration results for interior and boundary elements

Params str output_file:

The name of the output yaml file

Params str best_parameters_yml_no_BCs:

A yaml file containing the ‘best’ calibration using the kernel density estimate for elements not on the boundary

Params str boundary_csv:

A csv file containing list of boundary elements

Params str previous_calibration_map:

A csv file containing a previous calibration map for all elements to be modified

Returns:

Write output_file

model_package.Calibrate.build_calibration_map.trim_csv_file_for_tardigrade(output_file, input_file)[source]

Remove ‘element’ and ‘obj_func_value’ columns from a csv file containing calibration results

Params str output_file:

The name of the output csv file

Params str input_csv:

An input, previously generated csv file to be trimmed for Tardigrade

Returns:

Write output_file

calibrate_element.py

model_package.Calibrate.calibrate_element.calibrate(input_file, output_file, case, Emod, nu, L, element=0, increment=None, plot_file=None, average=False, UQ_file=None, cal_norm='L1', bound_half_width=100000.0, dev_norm_errors=False, input_elastic_parameters=None)[source]

Unpack DNS data and run calibration routine

Parameters:
  • input_file (str) – The homogenized XDMF file output by the Micromorphic Filter

  • output_file (str) – The resulting list of parameters stored in a yaml file

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7 without error for M, 4: all 18 parameters, 5: 7 parameter plus tau7 with error for M, 6: 11 higher order parameters, 7: 7 parameters using fixed higher order parameters determined from case 6, 8: 7 parameters using initial guess and tighter bounds for higher order parameters determined from case 6

  • Emod (float) – Estimate of a homogenized elastic modulus, used for initial parameter estimation

  • nu (float) – Estimate of a homogenized Poisson ratio, used for initial parameter estimation

  • L (float) – DNS max dimension (width, height, depth, etc.), used for initial parameter estimation

  • element (int) – The macro (filter) element to calibration, default is zero

  • increment (int) – An optional list of one or more increments to perform calibration

  • plot_file (str) – Optional root filename to for plotting results

  • average (bool) – Boolean whether or not homogenized DNS results will be averaged

  • UQ_file (str) – Optional csv filename to store function evaluations and parameter sets for UQ

  • cal_norm (str) – The type of norm to use for calibration (“L1”, “L2”, or “L1-L2”)

  • bound_half_width (float) – The uniform parameter bound “half-width” to apply for all parameters to be calibrated. Bounds for lambda will be [0., bound_half_width]. All other parameter bounds will be [-1*bound_half_width, bound_half_width]

  • dev_norm_errors (bool) – Boolean whether to inclue deviatoric stress norms during calibration

  • input_elastic_parameters (str) – Yaml file containing previously calibrated elastic parameters

Returns:

calibrated parameters by minimizing a specified objective function

model_package.Calibrate.calibrate_element.handle_output_for_UQ(Xstore, Lstore, case)[source]

TODO: not currently used

model_package.Calibrate.calibrate_element.objective(x0, Y, inputs, cal_norm, nu_targ, case, element, nqp, increment=None, stresses_to_include=['S', 'SIGMA', 'M'], dev_norm_errors=False)[source]

Primary objective function for calibrating micromorphic linear elasticity constitutive model against homogenized DNS data

Parameters:
  • x0 (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • increment (int) – An optional list of one or more increments to perform calibration

  • stresses_to_include (list) – Which reference configuration stresses to calculate an error for the objective function, default=[‘S’, ‘SIGMA’, ‘M’]

Returns:

the objective function evaluation

model_package.Calibrate.calibrate_element.opti_options_1(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, calibrate=True, increment=None)[source]

Objective function number 1 used for calibrating first 2 parameters of micromorphic linear elasticity. For case 1.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.opti_options_2(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, calibrate=True, increment=None, dev_norm_errors=False)[source]

Objective function number 2 used for calibrating 7 parameters of micromorphic linear elasticity. For case 2.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.opti_options_3(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, calibrate=True, increment=None, dev_norm_errors=False)[source]

Objective function number 3 used for calibrating 8 parameters of micromorphic linear elasticity. For cases 3 and 5.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.opti_options_4(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, calibrate=True, increment=None, dev_norm_errors=False)[source]

Objective function number 4 used for calibrating all 18 parameters of micromorphic linear elasticity. For cases 4 and 8.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.opti_options_6(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, second_order_params, calibrate=True, increment=None, dev_norm_errors=False)[source]

Objective function number 6 used for calibrating 11 higher order “tau” parameters of micromorphci linear elasticity. For case 6.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • second_order_params (array) – Initial guess values for 7 second order parameters

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.opti_options_7(X, Y, inputs, cal_norm, nu_targ, case, element, nqp, third_order_parameters, calibrate=True, increment=None, dev_norm_errors=False)[source]

Objective function number 7 used for calibrating 7 parameters of micromorphic linear elasticity with fixed higher order parameters. For case 7.

Parameters:
  • X (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • nu_targ (float) – The targeted Poisson ratio if calibrating 2 parameter elasticity

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • third_order_parameters (array) – Previously calibrated values for 11 higher order parameters

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element.parameters_to_fparams(parameters)[source]

Map the elastic parameters to the fparams vector for use in the Tardigrade-MOOSE micromorphic linear elastic material model

Parameters:

parameters (numpy.ndarray) – The parameters vector lambda, mu, eta, tau, kappa, nu, sigma, tau1, tau2, tau3, tau4, tau5, tau6, tau7, tau8, tau9, tau10, tau11

Returns:

array of fparams

model_package.Calibrate.calibrate_element.str2bool(v)[source]

Function for converting string to Boolean. Borrowed from: https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse

Parameters:

v (str/bool) – A string or boolean indicating a True or False value

Returns:

True or False

calibrate_element_plastic.py

model_package.Calibrate.calibrate_element_plastic.calibrate_plasticity(input_file, output_file, case, input_parameters, element=0, increment=None, plot_file=None, average=False, UQ_file=None, cal_norm='L1')[source]

Unpack DNS data and run plasticity calibration routine

Parameters:
  • input_file (str) – The homogenized XDMF file output by the Micromorphic Filter

  • output_file (str) – The resulting list of parameters stored in a yaml file

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • input_parameters (str) – Yaml file containing previously calibrated elastic parameter

  • element (int) – The macro (filter) element to calibration, default is zero

  • increment (int) – An optional list of one or more increments to perform calibration

  • plot_file (str) – Optional root filename to for plotting results

  • average (bool) – Boolean whether or not homogenized DNS results will be averaged

  • UQ_file (str) – Optional csv filename to store function evaluations and parameter sets for UQ

  • cal_norm (str) – The type of norm to use for calibration (“L1”, “L2”, or “L1-L2”)

Returns:

calibrated parameters by minimizing a specified objective function

model_package.Calibrate.calibrate_element_plastic.objective(x0, Y, inputs, cal_norm, case, element, nqp, increment=None, stresses_to_include=['S', 'SIGMA', 'M'])[source]

Primary objective function for calibrating micromorphic elastoplasticity constitutive model against homogenized DNS data

Parameters:
  • x0 (array-like) – Array of micromorphic linear elasticity parameters

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • increment (int) – An optional list of one or more increments to perform calibration

  • stresses_to_include (list) – Which reference configuration stresses to calculate an error for the objective function, default=[‘S’, ‘SIGMA’, ‘M’]

Returns:

the objective function evaluation

model_package.Calibrate.calibrate_element_plastic.opti_options_1(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate macro-plasticity initial cohesion parameter. For case 1.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_13(X, Y, inputs, e_params, p_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Case 13 - Calibrate micro-gradient-plasticity initial cohesion and hardening parameters with a previous macro- and micro-plasticity calibration provided. For case 13.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • p_params (array) – The previously calibrated plastic fparams including macro- and micro-plasticity initial cohesion and hardening

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_2(X, cohesion, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate macro plasticity hardening using an initial estimate/calibration for cohesion. For case 2.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • cohesion (float) – The value of the macro-scale initial cohesion parameter

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_3(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate micro-plasticity initial cohesion parameter. For case 3.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_4(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate macro-plasticity initial cohesion and hardening parameters. For case 4.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_5(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate micro-plasticity initial cohesion and hardening parameters. For case 5.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_6(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate macro-plasticity and micro-plasticity initial cohesion and hardening parameters. For case 6, 8, 9, and 10.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.opti_options_7(X, Y, inputs, e_params, cal_norm, case, element, nqp, calibrate=True, increment=None)[source]

Calibrate macro, micro, and micro gradient plasticity initial cohesion and hardening parameters. For case 7.

Parameters:
  • X (array-like) – Array of micromorphic plasticity parameters to calibrate

  • Y (list) – List storing dictionaries of DNS quantities for PK2, SIGMA, and M

  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • e_params (array) – The elastic fparams

  • cal_norm (str) – The form of the norm for the residual, use “L1” or “L2”

  • case (int) – The calibration “case”.

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • calibrate (bool) – A flag specifying whether to perform calibration for “True” or to return the stacked list of parameters for “False”

  • increment (int) – An optional list of one or more increments to perform calibration

Returns:

objective function evaluation by calling primary objective function if calibrate=True or return stacked list of parameters if calibrate=False

model_package.Calibrate.calibrate_element_plastic.stack_parameters(params)[source]

Map the elastic and plastic parameters to the fparams vector for use in the Tardigrade-MOOSE micromorphic elasto-plastic model

Parameters:

parameters (numpy.ndarray) – The parameters vector cu0, Hu, cchi0, Hchi, cGchi0, HGchi, all elastic fparams

Returns:

array of fparams

calibrate_qp.py

model_package.Calibrate.calibrate_qp.calibrate_qp(input_file, output_file, case, Emod, nu, L, element=0, qp=0, increment=None, plot_file=None, average=False, UQ_file=None, cal_norm='L1', bound_half_width=100000.0, dev_norm_errors=False, input_elastic_parameters=None)[source]

Unpack DNS data and run calibration routine

Parameters:
  • input_file (str) – The homogenized XDMF file output by the Micromorphic Filter

  • output_file (str) – The resulting list of parameters stored in a yaml file

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7 without error for M, 4: all 18 parameters, 5: 7 parameter plus tau7 with error for M, 6: 11 higher order parameters, 7: 7 parameters using fixed higher order parameters determined from case 6, 8: 7 parameters using initial guess and tighter bounds for higher order parameters determined from case 6

  • Emod (float) – Estimate of a homogenized elastic modulus, used for initial parameter estimation

  • nu (float) – Estimate of a homogenized Poisson ratio, used for initial parameter estimation

  • L (float) – DNS max dimension (width, height, depth, etc.), used for initial parameter estimation

  • element (int) – The macro (filter) element to calibration, default is zero

  • increment (int) – An optional list of one or more increments to perform calibration

  • plot_file (str) – Optional root filename to for plotting results

  • average (bool) – Boolean whether or not homogenized DNS results will be averaged

  • UQ_file (str) – Optional csv filename to store function evaluations and parameter sets for UQ

  • cal_norm (str) – The type of norm to use for calibration (“L1”, “L2”, or “L1-L2”)

  • bound_half_width (float) – The uniform parameter bound “half-width” to apply for all parameters to be calibrated. Bounds for lambda will be [0., bound_half_width]. All other parameter bounds will be [-1*bound_half_width, bound_half_width]

  • dev_norm_errors (bool) – Boolean whether to inclue deviatoric stress norms during calibration

  • input_elastic_parameters (str) – Yaml file containing previously calibrated elastic parameters

Returns:

calibrated parameters by minimizing a specified objective function

calibration_tools.py

model_package.Calibrate.calibration_tools.Isbuga_micrormorphic_elasticity_parameters(Emod, nu, Lc, case_1_override=False)[source]

Calculate initial estimate of 18 parameter micromorphic linear elasticity model parameters using method defined in https://doi.org/10.1016/j.ijengsci.2011.04.006

Parameters:
  • Emod (float) – An estimate of homogenized elastic modulus

  • nu (float) – An estimate of the homogenized Poisson ratio

  • Lc (float) – An estimate of the length scale parameter

Returns:

array of estimated micromorphic linear elasticity parameters

model_package.Calibrate.calibration_tools.average_quantities(quantities, type, elem)[source]

Average tensor quantites over 8 quadrature points

Parameters:
  • quantities (dict) – A 2nd or 3rd order tensor dictionary with keys for quadrature points and values storing an array where indices correspond to time, element number, and tensor components

  • type (str) – A string specifying the type of tensor to average. Use “3” for a vector. Use “3x3” for a regular second order tensor. Use “9” for a flattened second order tensor. Use “3x3x3” for a third order tensor.

  • elem (int) – The macro (filter) element to calibrate

Returns:

output dict with same indices as quantities and a single key

model_package.Calibrate.calibration_tools.collect_deviatoric_norm_errors(nqp, t, e, PK2, PK2_sim, SIGMA, SIGMA_sim, M, M_sim)[source]

Calculate the errors between filtered and simulated deviatoric norms for second and third order stresses

Parameters:
  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • t (int) – The current time increment

  • e (int) – The current macro element being considered for calibration

  • PK2 (dict) – The quantities dict storing a homogenized DNS second Piola-Kirchhoff stress

  • PK2_sim (dict) – The quantities dict storing a simulated second Piola-Kirchhoff stress

  • SIGMA (dict) – The quantities dict storing a homogenized DNS symmetric micro stress

  • SIGMA_sim (dict) – The quantities dict storing a simulated symmetric micro stress

  • M (dict) – The quantities dict storing a homogenized DNS higher order stress

  • M_sim (dict) – The quantities dict storing a simulated higher order stress

Returns:

error between homogenized and simulations deviatoric second Piola-Kirchhoff, symmetric micro, and higher order stresses

model_package.Calibrate.calibration_tools.deviatoric_norm(stress, third_order=False, full_norm=False)[source]

Calculate the norm(s) of the deviatoric part of a stress quantity

Parameters:
  • stress (array-like) – A second or third order stress tenosr

  • third_order (bool) – A boolean specifying whether the stress tensor is third order

  • full_norm (bool) – A boolean specifying whether a third order tensor norm should be across all indices

Returns:

list of norm of deviatoric stresses (1 item for second order stress, 3 for third order)

model_package.Calibrate.calibration_tools.evaluate_constraints(parameters, svals=None)[source]

Evaluate Smith conditions by calling tardigrade_micromorphic_linear_elasticity/src/python/linear_elastic_parameter_constraint_equations

Parameters:
  • parameters (array-like) – an array of 18 micromorphic linear elasticity parameters

  • svals (array-like) – TODO figure out what this is for

Returns:

a dictionary of constants from evaluating the Smith conditions

model_package.Calibrate.calibration_tools.evaluate_model(inputs, parameters, model_name, parameters_to_fparams, nsdvs, element, nqp, maxinc=None, dim=3, maxsubiter=5)[source]

Evaluate the model given the parameters. Adapted from overlap_coupling/src/python/read_xdmf_output.py.

Parameters:
  • inputs (list) – A list storing DNS quantities for Green-Lagrange strain (dict), displacements (dict), displacement gradient (dict), micro-deformation (dict), micro-deformation gradient (dict), and time increments (list)

  • parameters (numpy.ndarray) – The array of parameters

  • model_name (str) – The name of the model

  • parameters_to_fparams (func) – A function that converts the parameters vector to the fparams vector required for the function

  • nsdvs (int) – The number of solution dependant state variables

  • element (int) – The macro (filter) element to calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • maxinc (int) – The maximum increment to evaluate

  • dim (int) – The spatial dimension of the problem, default=3

  • maxsubiter (int) – The maximum number of sub iterations, default=5

Returns:

evaluated micromorphic simulation quantities for PK2, SIGMA, M, and SDVS

model_package.Calibrate.calibration_tools.isolate_element(quantities, type, elem)[source]

Isolate the homogenized quantities for a specified element

Parameters:
  • quantities (dict) – A 2nd or 3rd order tensor dictionary with keys for quadrature points and values storing an array where indices correspond to time, element number, and tensor components

  • type (str) – A string specifying the type of tensor to average. Use “3” for a vector. Use “3x3” for a regular second order tensor. Use “9” for a flattened second order tensor. Use “3x3x3” for a third order tensor.

  • elem (int) – The macro (filter) element to calibrate

Returns:

output dict with same indices as quantities and a single key

model_package.Calibrate.calibration_tools.isolate_element_and_qp(quantities, type, elem, qp)[source]

solate the homogenized quantities for a specified element and quadrature point

Parameters:
  • quantities (dict) – A 2nd or 3rd order tensor dictionary with keys for quadrature points and values storing an array where indices correspond to time, element number, and tensor components

  • type (str) – A string specifying the type of tensor to average. Use “3” for a vector. Use “3x3” for a regular second order tensor. Use “9” for a flattened second order tensor. Use “3x3x3” for a third order tensor.

  • elem (int) – The macro (filter) element to calibrate

  • qp (int) – The quadrature point of the macro (filter) element to calibrate

Returns:

output dict with same indices as quantities and a single key

model_package.Calibrate.calibration_tools.parse_fparams_file(parameter_file, material_type='elastic')[source]

Parse material parameters from a YAML file into an array with parameter names listed

Parameters:
  • input_parameters (str) – YAML file containing calibration results

  • material_type (str) – The material type: ‘elastic’, ‘plastic’, or ‘full_plastic’

Returns:

array of parameters and list of parameter names

model_package.Calibrate.calibration_tools.parse_input_parameters(input_parameters)[source]

Parse material parameters from a YAML file

Parameters:

input_parameters (str) – YAML file containing calibration results

Returns:

array of elastic parameters and plastic parameters (if there are any)

model_package.Calibrate.calibration_tools.plot_higher_order_stresses(Gamma, M, M_sim, output_name, element, nqp, increment=None, find_bounds=False)[source]

Plot comparison of higher order stress and micro-deformation gradient between homogenized DNS results against calibrated model predictions

Parameters:
  • Gamma (dict) – The quantities dict storing the micro-deformation gradient

  • M (dict) – The quantities dict storing higher order stress from the homogenized DNS results

  • M_sim (dict) – The quantities dict storing higher order stress from the calibrated model predictions

  • output_name (str) – The output plot name

  • element (int) – The macro (filter) element considered for calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • increment (list) – An optional list of one or more increments to plot restults

  • find_bounds (bool) – Boolean specifying whether or not to identify common y-axis bounds for all subplots

Returns:

output_name

model_package.Calibrate.calibration_tools.plot_stress_norm_calibration_comparison(PK2, PK2_sim, SIGMA, SIGMA_sim, M, M_sim, E, Ecal, Gamma, output_name, nqp, increment=None)[source]

Plot the infinity norms of deviatoric Cauchy, symmetric micro, and higher stresses for both homogenized DNS and calibration

Parameters:
  • PK2 (dict) – The quantities dict storing homogenized DNS second Piola-Kirchhoff stress

  • PK2_sim (dict) – The quantities dict storing calibrated second Piola-Kirchhoff stress

  • SIGMA (dict) – The quantities dict storing homogenized DNS symmetric micro stress

  • SIGMA_sim (dict) – The quantities dict storing calibrated symmetric micro stress

  • M (dict) – The quantities dict storing homogenized DNS higher order stress

  • M_sim (dict) – The quantities dict storing calibrated higher order stress

  • E (dict) – The quantities dict storing homogenized DNS Green-Lagrange strain

  • Ecal (dict) – The quantities dict storing homogenized DNS micro strain

  • Gamma (dict) – The quantities dict storing homogenized DNS micro-deformation gradient

  • output_name (str) – Output filename

  • nqp (int) – The number of quadrature points

  • increment (list) – An optional list of one or more increments to plot restults

Returns:

output_name plot

model_package.Calibrate.calibration_tools.plot_stresses(strain, stress, stress_sim, output_name, element, nqp, x_label_base, y_label_base, increment=None, find_bounds=False)[source]

Plot comparison of stress vs strain between homogenized DNS results against calibrated model predictions

Parameters:
  • strain (dict) – The quantities dict storing a strain measure

  • stress (dict) – The quantities dict storing a homogenized DNS stress

  • stress_sim (dict) – The quantities dict storing a calibrated stress

  • output_name (str) – The output plot name

  • element (int) – The macro (filter) element considered for calibration

  • nqp (int) – The number of quadrature points (1 if filter data is averaged, 8 otherwise)

  • x_label_base (str) – A string to include in the plot x-label

  • y_label_base (str) – A string to include in the plot y-label

  • increment (list) – An optional list of one or more increments to plot restults

  • find_bounds (bool) – Boolean specifying whether or not to identify common y-axis bounds for all subplots

Returns:

output_name

elastic_map_to_material_card.py

model_package.Calibrate.elastic_map_to_material_card.elastic_map_to_material_card(map_file, element_number, output_file)[source]

Unpack a csv file of elastic parameters and call function to write elastic yaml file

Params str map_file:

CSV file containing previously calibrated elastic parameters

Params int element_number:

The id of the element to extract calibration data

Params str output_file:

The name of the yml material card to write

identify_z_boundary_elements.py

model_package.Calibrate.identify_z_boundary_elements.identify_z_boundary_elements(macro_file, output_file)[source]

Read in macroscale XDMF file of a cylindrical geometry and identify element found on the z-boundary

Parameters:
  • macro_file (str) – The macroscale filter domain XDMF file, less extension

  • output_file (str) – Output csv filename containing list of boundary elements

Returns:

output_file

joint_probability_distributions.py

model_package.Calibrate.joint_probability_distributions.full_kde_plot(df, columns, full_kde)[source]

Plot combined KDE across all filtering domain studies for each parameter

Parameters:
  • df (dataframe) – Pandas DataFrame containing results from all filtering domains

  • columns (dataframe) – Pandas DataFrame Index containing parameter names to summarize

  • full_kde (str) – Root file name for KDE of each parameter

Returns:

Write {full_kde}_{parameter}.png plot file for each calibration parameter

model_package.Calibrate.joint_probability_distributions.joint_probability_distributions(output_file, csv_files, num_domains, num_params=None, distribution_plots=None, full_kde=None)[source]

Create a joint probability distribution plot to summarize calibration results

Parameters:
  • output_file (str) – The output filename for the joint probability distribution plot”

  • csv_files (list) – The csv files containing calibration results

  • num_domains (list) – A list of integers corresponding to the number of filtering domains associated with results contained in each csv file’

  • num_params (int) – The number of parameters to make a joint probability plot with if not all are desired’

  • distribution_plots (str) – Optional root file name for distribution plots of each parameter

  • full_kde (str) – Optional root file name for KDE of each parameter

Returns:

output_file

model_package.Calibrate.joint_probability_distributions.plot_distributions(dfs, columns, num_domains, distribution_plots)[source]

Plot normal distributions across all filtering domain studies for each parameter

Parameters:
  • dfs (list) – List of Pandas DataFrames containing calibration results for each filtering domain study

  • columns (dataframe) – Pandas DataFrame Index containing parameter names to summarize

  • num_domains (list) – A list of integers corresponding to the number of filtering domains associated with results contained in each csv file’

  • distribution_plots (str) – Root file name for distribution plots of each parameter

Returns:

Write {distribution_plots}_{parameter}.png plot file for each calibraiton parameter

return_minimum_smith_constraint.py

model_package.Calibrate.return_minimum_smith_constraint.return_minimum_smith_constraint(parameters, svals=None)[source]

Evaluate the 13 Smith constraints for micromorphic linear elasticity and return the minimum value

Params list parameters:

The micromorphic linear elasticity parameters

Params list svals:

TODO! Figure out what this is

Returns:

Minimum value for the 13 Smith constraints

summarize_calibration_results.py

model_package.Calibrate.summarize_calibration_results.collect_parameters(parameter_sets, case)[source]

Collect calibration results from one or more yaml files

Parameters:
  • parameter_sets (list) – List of yaml files containing calibration results

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

Returns:

dictionary containing list of parameter results with each key corresponding to a parameter name

model_package.Calibrate.summarize_calibration_results.kde(rootname, results_dict, type, kde_best_parameters=None)[source]

Create a kernel density estimate (KDE) plot for each calibrated parameter

Parameters:
  • rootname (str) – The rootname of the output plot

  • results_dict (dict) – Dictionary containing list of parameter results with each key corresponding to a parameter

  • type (str) – A string specifying the type of KDE to plot. ‘kde’ gives a regular KDE plot. ‘hist’ gives a KDE plot with histograms shown

  • kde_best_parameters (str) – Optional root filename to output a yaml file containing the “best” parameters sampled from the kernel density estimate associated with “kde_best”

Returns:

{rootname}_{key}_{type}.PNG for each key in results_dict, write {kde_best_parameters}.yml if requested

model_package.Calibrate.summarize_calibration_results.make_summary_csv(summary_csv, results_dict)[source]

Make a csv file summarizing the mean, min, max, and standard deviation of calibrated parameters

Parameters:
  • summary_csv (str) – Filename to store summary statistics of calibrated parameters

  • results_dict (dict) – Results dictionary containing list of parameters with each key corresponding to a parameter name

Returns:

summary_csv

model_package.Calibrate.summarize_calibration_results.summarize_calibration_results(parameter_sets, case, results_csv=None, summary_csv=None, kde_hist_plot=None, kde_plot=None, kde_best=None, kde_best_parameters=None)[source]

Main function to drive parameter summary and output

Parameters:
  • parameter_sets (list) – List of yaml files containing calibration results

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7 without error for M, 4: all 18 parameters, 5: 7 parameter plus tau7 with error for M, 6: 11 higher order parameters, 7: 7 parameters using fixed higher order parameters determined from case 6, 8: 7 parameters using initial guess and tighter bounds for higher order parameters determined from case 6

  • results_csv (str) – Optional filename to store all calibrated parameter values

  • summary_csv (str) – Optional filename to store summary statistics of calibrated parameters

  • kde_hist_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter with histogram

  • kde_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter

  • kde_best (str) – Optional root filename to plot kernel density estimate of each calibrated parameter with maximum value in title

  • kde_best_parameters (str) – Optional root filename to output a yaml file containing the “best” parameters sampled from the kernel density estimate associated with “kde_best”

model_package.Calibrate.summarize_calibration_results.write_elastic_material_card(output_file, input_dict)[source]

Write elastic micromorphic material card

Parameters:
  • output_file (str) – The root filename of the output yaml file

  • input_dict (dict) – A dictionary containing calibrated parameters

Returns: Writes output_file.yml

model_package.Calibrate.summarize_calibration_results.write_plastic_material_card(output_file, input_dict)[source]

Write elastic micromorphic material card

Parameters:
  • output_file (str) – The root filename of the output yaml file

  • input_dict (dict) – A dictionary containing calibrated parameters

Returns: Writes output_file.yml

summarize_calibration_results_from_csv.py

model_package.Calibrate.summarize_calibration_results_from_csv.kde(rootname, parameter_df, type, kde_best_parameters=None)[source]

Create a kernel density estimate (KDE) plot for each calibrated parameter

Parameters:
  • rootname (str) – The rootname of the output plot

  • results_dict (dict) – Dictionary containing list of parameter results with each key corresponding to a parameter

  • type (str) – A string specifying the type of KDE to plot. ‘kde’ gives a regular KDE plot. ‘hist’ gives a KDE plot with histograms shown

  • kde_best_parameters (str) – Optional root filename to output a yaml file containing the “best” parameters sampled from the kernel density estimate associated with “kde_best”

Returns:

{rootname}_{key}_{type}.PNG for each key in results_dict, write {kde_best_parameters}.yml if requested

model_package.Calibrate.summarize_calibration_results_from_csv.make_summary_csv(summary_csv, parameter_df)[source]

Make a csv file summarizing the mean, min, max, and standard deviation of calibrated parameters

Parameters:
  • summary_csv (str) – Filename to store summary statistics of calibrated parameters

  • results_dict (dict) – Results dictionary containing list of parameters with each key corresponding to a parameter name

Returns:

summary_csv

model_package.Calibrate.summarize_calibration_results_from_csv.summarize_calibration_results(parameter_csv, summary_csv=None, kde_hist_plot=None, kde_plot=None, kde_best=None, kde_best_parameters=None, boundary_csv=None)[source]

Main function to drive parameter summary and output

Parameters:
  • parameter_sets (list) – List of yaml files containing calibration results

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7, 4: all 18 parameters

  • results_csv (str) – Optional filename to store all calibrated parameter values

  • summary_csv (str) – Optional filename to store summary statistics of calibrated parameters

  • kde_hist_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter with histogram

  • kde_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter

  • kde_best_parameters (str) – Optional root filename to output a yaml file containing the “best” parameters sampled from the kernel density estimate associated with “kde_best”

model_package.Calibrate.summarize_calibration_results_from_csv.write_plastic_material_card(output_file, input_dict)[source]

Write elastic micromorphic material card

Parameters:
  • output_file (str) – The root filename of the output yaml file

  • input_dict (dict) – A dictionary containing calibrated parameters

Returns: Writes output_file.yml

summarize_calibration_results_ignore_boundary.py

model_package.Calibrate.summarize_calibration_results_ignore_boundary.collect_parameters_ignore_boundary(parameter_sets, element_sets, good_elements, case)[source]

Collect calibration results from one or more yaml files

Parameters:
  • parameter_sets (list) – List of yaml files containing calibration results

  • element_sets (list) – List of elements of the macro domain which have been calibrated

  • good_elements (list) – List of elements not found on the z-boundary

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7 without error for M, 4: all 18 parameters, 5: 7 parameter plus tau7 with error for M, 6: 11 higher order parameters, 7: 7 parameters using fixed higher order parameters determined from case 6, 8: 7 parameters using initial guess and tighter bounds for higher order parameters determined from case 6

Returns:

dictionary containing list of parameter results with each key corresponding to a parameter name

model_package.Calibrate.summarize_calibration_results_ignore_boundary.sort_elements(macro_file)[source]

Read in macroscale XDMF file to identify element not found on the z-boundary

Parameters:

macro_file (str) – The macroscale filter domain XDMF file, less extension

Returns:

write good_elements list containing elements not found on the z-boundary

model_package.Calibrate.summarize_calibration_results_ignore_boundary.summarize_calibration_results_ignore_boundary(parameter_sets, element_sets, macro_file, case, results_csv=None, summary_csv=None, kde_hist_plot=None, kde_plot=None, kde_best=None, kde_best_parameters=None)[source]

Main function to drive parameter summary and output

Parameters:
  • parameter_sets (list) – List of yaml files containing calibration results

  • element_sets (list) – List of elements of the macro domain which have been calibrated

  • macro_file (str) – The macroscale filter domain XDMF file, less extension

  • case (int) – The calibration “case”. 1: two parameter, 2: 7 parameter, 3: 7 parameter plus tau7 without error for M, 4: all 18 parameters, 5: 7 parameter plus tau7 with error for M, 6: 11 higher order parameters, 7: 7 parameters using fixed higher order parameters determined from case 6, 8: 7 parameters using initial guess and tighter bounds for higher order parameters determined from case 6

  • results_csv (str) – Optional filename to store all calibrated parameter values

  • summary_csv (str) – Optional filename to store summary statistics of calibrated parameters

  • kde_hist_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter with histogram

  • kde_plot (str) – Optional root filename to plot kernel density estimate of each calibrated parameter

  • kde_best (str) – Optional root filename to plot kernel density estimate of each calibrated parameter with maximum value in title

  • kde_best_parameters (str) – Optional root filename to output a yaml file containing the “best” parameters sampled from the kernel density estimate associated with “kde_best”

Tardigrade_MOOSE

add_element_blocks_to_mesh.py

model_package.Tardigrade_MOOSE.add_element_blocks_to_mesh.add_element_blocks_to_mesh(input_mesh, output_mesh, elements, number_existing_blocks=0, exodus_mesh_map=None)[source]

Take an existing exodus mesh, add element blocks for each element, save with new name

Parameters:
  • input_mesh (str) – The input exodus mesh file to modify

  • output_mesh (str) – The output exodus mesh file with block names defined

  • elements (int) – The number of elements in the mesh for which to define a block name

  • number_of_existing_blocks (int) – The number of existing mesh blocks to keep in final mesh

Params str exodus_mesh_map:

An existing macroscale to optionally map centroids for element block numbering

Returns:

Write output_mesh

model_package.Tardigrade_MOOSE.add_element_blocks_to_mesh.adjust_centroids(centroids, method='absolute')[source]

Adjust the location of an array of centroids

Params array centroids:

Array of centroid locations

Params str method:

The method to adjust all centroids. Specify ‘origin’ to find the centroid closest to the origin. Specify ‘absolute’ to adjust based on the minimum x-, y-, and z-coordinates

Returns:

Dataframe centroids of adjusted centroids

model_package.Tardigrade_MOOSE.add_element_blocks_to_mesh.get_element_centroids_from_exodus_mesh(exodus_mesh_map)[source]

Extract and adjust the centroids from an exodus mesh used for mapping element IDs

Params str exodus_mesh_map:

An existing macroscale to optionally map centroids for element block numbering

Returns:

Dataframe centroids of adjusted centroids from exodus_mesh_map

annulus_from_bounds.py

model_package.Tardigrade_MOOSE.annulus_from_bounds.annulus_from_bounds(output_file, bounds_file, seed_size, annulus_ratio)[source]

Create an annular mesh from the bounds of a DNS file

Parameters:
  • output_file (str) – The output filename

  • bounds_file (str) – The file containing the bounds of the DNS

  • seed_size (float) – The approximate mesh size

  • annulus_ratio (float) – The fraction of the radius to keep in the final geometry

Calls “mesh” function

model_package.Tardigrade_MOOSE.annulus_from_bounds.mesh(rad, height, annulus_ratio, x0, y0, z0, seed_size, output_file)[source]

Mesh a cylinder using Cubit

Parameters:
  • rad (float) – Cylinder radius

  • height (float) – Cylinder height

  • annulus_ratio (float) – The fraction of the radius to keep in the final geometry

  • x0 (float) – The x-distance to translate the cylinder

  • y0 (float) – The y-distance to translate the cylinder

  • z0 (float) – The z-distance to translate the cylinder

  • seed-size (float) – The approximate mesh size

  • output_file (str) – The output filename

Returns:

{output_file}.e

brazilian_disk_apparatus.py

model_package.Tardigrade_MOOSE.brazilian_disk_apparatus.brazilian_disk_apparatus(output_file, specimen_seed_size, platen_seed_size, height, width, chord, app_rad, app_dep, spec_rad, spec_dep, tol, x0=0.0, y0=0.0, z0=0.0, export_platens=True)[source]

Create a Brazilian Disk specimen and loading apparatus

Parameters:
  • output_file (str) – The output filename

  • specimen_seed_size (float) – The approximate mesh size for the specimen

  • platen_seed_size (float) – The approximate mesh size for the platen

  • height (float) – The height of a single Brazilian disk compression platen

  • width (float) – The base width of a Brazilian disk compression platen

  • chord (float) – The chord distance of the Brazilian disk compression platen

  • app_rad (float) – The radius of curvature of the Brazilian disk compression platen

  • depth (float) – The extrusion depth of the Brazilian disk compression platen

  • spec_rad (float) – The radius of the Brazilian disk compression specimen

  • spec_dep (float) – The extrusion depth of the Brazilian disk compression specimen

  • tol (float) – A tolerance / gap distance to insert between Brazilian disk compression specimen and platens

  • x0 (float) – The x-location to move geometry for the center of the Brazil Disk

  • y0 (float) – The y-location to move geometry for the center of the Brazil Disk

  • z0 (float) – The z-location to move geometry for the center of the Brazil Dis

  • export_platens (bool) – Flag to export platen meshes of the brazilian disk apparatus

Returns:

Write {output_file}.cub, {output_file}_specimen.inp, and optionally {output_file}_bottom_platen.inp and {output_file}_top_platen.inp

brazilian_disk_apparatus_symmetry.py

model_package.Tardigrade_MOOSE.brazilian_disk_apparatus_symmetry.brazilian_disk_apparatus(output_file, specimen_seed_size, platen_seed_size, height, width, chord, app_rad, app_dep, spec_rad, spec_dep, tol, symmetry='eighth', x0=0.0, y0=0.0, z0=0.0, export_platens=True)[source]

Create a Brazilian Disk specimen and loading apparatus

Parameters:
  • output_file (str) – The output filename

  • specimen_seed_size (float) – The approximate mesh size for the specimen

  • platen_seed_size (float) – The approximate mesh size for the platen

  • height (float) – The height of a single Brazilian disk compression platen

  • width (float) – The base width of a Brazilian disk compression platen

  • chord (float) – The chord distance of the Brazilian disk compression platen

  • app_rad (float) – The radius of curvature of the Brazilian disk compression platen

  • depth (float) – The extrusion depth of the Brazilian disk compression platen

  • spec_rad (float) – The radius of the Brazilian disk compression specimen

  • spec_dep (float) – The extrusion depth of the Brazilian disk compression specimen

  • tol (float) – A tolerance / gap distance to insert between Brazilian disk compression specimen and platens

  • symmetry (str) – Type of symmetry to create, either “eighth” or “quarter” or “half”

  • x0 (float) – The x-location to move geometry for the center of the Brazil Disk

  • y0 (float) – The y-location to move geometry for the center of the Brazil Disk

  • z0 (float) – The z-location to move geometry for the center of the Brazil Dis

  • export_platens (bool) – Flag to export platen meshes of the brazilian disk apparatus

Returns:

{output_file}.cub, {output_file}_specimen.inp, and optionally {output_file}_bottom_platen.inp

Brazil_disk_normalized_force_vs_displacements.py

model_package.Tardigrade_MOOSE.Brazil_disk_normalized_force_vs_displacements.Brazil_disk_normalized_force_vs_displacements(input_file, plot_file, csv_file, radius, thickness, disp_factor=1, force_factor=1)[source]

Process force-displacement from Tardigrade-MOOSE results

Parameters:
  • input_file (str) – The csv file containing force vs displacement results

  • plot_file (str) – The name of the output file of collected resultss

  • csv_file (str) – The name of the output csv file

  • radius (float) – The specimen initial radius

  • thickness (float) – The specimen initial thickness

  • disp_factor (float) – The final displacement (mm) to linearly ramp over simulation duration

  • force_factor (float) – The factor to scale force

Returns:

Write plot_file and csv_file

build_dynamic_Tardigrade_input_deck.py

model_package.Tardigrade_MOOSE.build_dynamic_Tardigrade_input_deck.build_input(output_file, mesh_file, BCs, pressure, start, duration, dt, ref_density, height, parameter_sets=None, calibration_map=None, phi_BC=None)[source]

Write a Tardigrade-MOOSE input file for dynamic simulation

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

  • pressure (float) – The pressure to be applied

  • duration (float) – The duration of the simulation

  • start (float) – The time when heaviside pressure is applied

  • dt (float) – The fixed time increment

  • ref_density (float) – Density in reference configuration (Mg/mm^3)

  • height (float) – Height of the geometry

  • parameter_sets (list) – The list of yaml files containing calibration results, required if calibration-map is not provided

  • calibration_map (str) – Optional yaml file containing names of calibration files

  • phi_BC (str) – Optional string specifying nodeset to force micro deformation components to be zero

Returns:

output_file

build_elastic_MOOSE_input_deck_brazil_disk_platens.py

model_package.Tardigrade_MOOSE.build_elastic_MOOSE_input_deck_brazil_disk_platens.build_input(output_file, mesh_file, material_E, material_nu, platen_E, platen_nu, disp, duration, specimen_top_surface, specimen_bottom_surface, top_platen_contact, bottom_platen_contact, top_platen_fixture, top_platen_side, top_platen_back, bottom_platen_fixture, bottom_platen_side, bottom_platen_back, contact_type='friction', friction_coefficient=None)[source]

Write MOOSE input file for symmetric Brazilian disk simulation with platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • material_E (float) – The elastic modulus of the specimen material

  • material_nu (float) – The Poisson ratio of the specimen material

  • platen_E (float) – The elastic modulus of the platen material

  • platen_nu (float) – The Poisson ratio of the platen material

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_top_surface (str) – Specify the name of the specimen top contact surface

  • specimen_bottom_surface (str) – Specify the name of the specimen bottom contact surface

  • top_platen_contact (str) – Specify the name of the top platen contact surface

  • bottom_platen_contact (str) – Specify the name of the bottom platen contact surface

  • top_platen_fixture (str) – Specify the name of the top platen fixture surface

  • top_platen_side (str) – Specify the name of the top platen side surface

  • top_platen_back (str) – Specify the name of the top platen back surface

  • bottom_platen_fixture (str) – Specify the name of the bottom platen fixture surface

  • bottom_platen_side (str) – Specify the name of the bottom platen side surface

  • bottom_platen_back (str) – Specify the name of the bottom platen back surface

  • contact_type (str) – The option for specifying contact, either “frictionless” or “friction”

  • friction_coefficient (float) – The friction coefficient if contact_type=”friction”

Returns:

output_file

build_elastic_MOOSE_input_deck_brazil_disk_platens_symmetry.py

model_package.Tardigrade_MOOSE.build_elastic_MOOSE_input_deck_brazil_disk_platens_symmetry.build_input(output_file, mesh_file, material_E, material_nu, platen_E, platen_nu, disp, duration, specimen_bottom_surface, bottom_platen_contact, top_symmetry, back_symmetry, side_set, bottom_platen_fixture, contact_type='friction', friction_coefficient=None, symmetry='eighth')[source]

Write MOOSE input file for eighth symmetry Brazilian disk simulation with platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • material_E (float) – The elastic modulus of the specimen material

  • material_nu (float) – The Poisson ratio of the specimen material

  • platen_E (float) – The elastic modulus of the platen material

  • platen_nu (float) – The Poisson ratio of the platen material

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_bottom_surface (str) – The name of the specimen bottom contact surface

  • bottom_platen_contact (str) – The name of the bottom platen contact surface

  • top_symmetry (str) – The name of the top symmetry surface(s)

  • back_symmetry (str) – The name of the back symmetry surface(s)

  • side_set (str) – The name of the side surface(s) to restrict motion in x-direction

  • bottom_platen_fixture (str) – The name of the bottom platen fixture surface

  • contact_type (str) – The option for specifying contact, either “frictionless” or “friction”

  • friction_coefficient (float) – The friction coefficient if contact_type=”friction”

  • symmetry (str) – Type of symmetry to enforce, either “eighth” or “quarter”

Returns:

output_file

build_elastic_MOOSE_input_deck_brazil_disk_rigid_platens.py

model_package.Tardigrade_MOOSE.build_elastic_MOOSE_input_deck_brazil_disk_rigid_platens.build_input(output_file, mesh_file, material_E, material_nu, platen_radius, disp, duration, specimen_bottom_surface, specimen_top_surface=None, top_symmetry=None, back_symmetry=None, side_symmetry=None, xc_bot=0.0, yc_bot=0.0, xc_top=0.0, yc_top=0.0, geometry='full')[source]

Write MOOSE input file for Brazilian disk simulation with rigid platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • material_E (float) – The elastic modulus of the specimen material

  • material_nu (float) – The Poisson ratio of the specimen material

  • platen_radius (float) – The radius of curvature of the Brazilian disk compression platen

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_bottom_surface (str) – The name of the specimen bottom contact surface

  • specimen_top_surface (str) – The name of the specimen top contact surface. Required if “geometry” = “full.”

  • top_symmetry (str) – The name of the top symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • back_symmetry (str) – The name of the back symmetry surface. Required if “geometry” = “quarter” or “eighth” or “half”

  • side_set (str) – The name of the side symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • xc_bot (float) – The x-position of the center of the circular bottom surface arc

  • yc_bot (float) – The y-position of the center of the circular bottom surface arc

  • xc_top (float) – The x-position of the center of the circular top surface arc

  • yc_top (float) – The y-position of the center of the circular top surface arc

  • geometry (str) – The geometry/symmetry type: “full,” “half,” “quarter,” or “eighth”

Returns:

output_file

build_GED_Tardigrade_input_deck_from_csv.py

model_package.Tardigrade_MOOSE.build_GED_Tardigrade_input_deck_from_csv.build_input(output_file, mesh_file, parameter_csv, BCs, disp, duration, damage_parameter=0.095)[source]

Write Tardigrade-MOOSE input file for a gradient-enhanced damage plasticity simulation

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • parameter_csv (list) – The csv file containing unique calibrations for each element

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • damage_parameter (float) – The value of the damage parameter

Returns:

output_file

build_plastic_Tardigrade_input_deck.py

model_package.Tardigrade_MOOSE.build_plastic_Tardigrade_input_deck.build_input(output_file, mesh_file, calibration_map, BCs, disp, duration)[source]

Write a Tardigrade-MOOSE input file

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • calibration_map (str) – CSV file containing calibration data

  • BCs (str) – The type of boundary conditions, either “slip”, “slip_plane”, “clamp”, or “brazil”

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

Returns:

output_file

model_package.Tardigrade_MOOSE.build_plastic_Tardigrade_input_deck.unpack_plastic_parameter_csv(parameter_df, i)[source]

Convert a single line of a plastic calibration map into relevant material strings and element number

Params DataFrame parameter_df:

The loaded calibration map

Params int i:

The current DataFrame index

Returns:

mat_line_1, mat_line_2, mat_line_3, mat_line_blank, mat_line_10, mat_line_11, mat_line_12, mat_line_14, element

build_plastic_Tardigrade_input_deck_brazil_disk_platens.py

model_package.Tardigrade_MOOSE.build_plastic_Tardigrade_input_deck_brazil_disk_platens.build_input(output_file, mesh_file, parameter_sets, disp, duration, specimen_top_surface, specimen_bottom_surface, top_platen_contact, bottom_platen_contact, top_platen_fixture, bottom_platen_fixture, contact_type='frictionless')[source]

Write Tardigrade-MOOSE input file for Brazilian disk simulation with platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • parameter_sets (list) – The list of yaml files containing calibration results

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_top_surface (str) – Specify the name of the specimen top contact surface

  • specimen_bottom_surface (str) – Specify the name of the specimen bottom contact surface

  • top_platen_contact (str) – Specify the name of the top platen contact surface

  • bottom_platen_contact (str) – Specify the name of the bottom platen contact surface

  • top_platen_fixture (str) – Specify the name of the top platen fixture surface

  • bottom_platen_fixture (str) – Specify the name of the bottom platen fixture surface

  • contact_type (str) – The option for specifying contact, either “frictionless” or “friction”

Returns:

output_file

build_plastic_Tardigrade_input_deck_brazil_disk_platens_symmetry.py

model_package.Tardigrade_MOOSE.build_plastic_Tardigrade_input_deck_brazil_disk_platens_symmetry.build_input(output_file, mesh_file, material_E, material_nu, platen_E, platen_nu, disp, duration, specimen_bottom_surface, bottom_platen_contact, top_symmetry, back_symmetry, side_set, bottom_platen_fixture, contact_type='frictionless', symmetry='eighth', phi_BC=None)[source]

Write MOOSE input file for symmetric Brazilian disk simulation with platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • parameter_sets (list) – The list of yaml files containing calibration results

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_bottom_surface (str) – The name of the specimen bottom contact surface

  • bottom_platen_contact (str) – The name of the bottom platen contact surface

  • top_symmetry (str) – The name of the top symmetry surface(s)

  • back_symmetry (str) – The name of the back symmetry surface(s)

  • side_set (str) – The name of the side surface(s) to restrict motion in x-direction

  • bottom_platen_fixture (str) – The name of the bottom platen fixture surface

  • contact_type (str) – The option for specifying contact, either “frictionless” or “friction”

  • symmetry (str) – Type of symmetry to enforce, either “eighth” or “quarter”

  • phi_BC (str) – Optional string specifying nodeset to force micro deformation components to be zero

Returns:

output_file

build_plastic_Tardigrade_input_deck_platens.py

model_package.Tardigrade_MOOSE.build_plastic_Tardigrade_input_deck_platens.build_input(output_file, mesh_file, calibration_map, disp, duration, specimen_top_surface, specimen_bottom_surface, top_platen_contact, bottom_platen_contact, top_platen_fixture, bottom_platen_fixture, contact_type='frictionless')[source]

Write Tardigrade-MOOSE input file for a plastic simulation with platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • calibration_map (str) – CSV file containing calibration data

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_top_surface (str) – Specify the name of the specimen top contact surface

  • specimen_bottom_surface (str) – Specify the name of the specimen bottom contact surface

  • top_platen_contact (str) – Specify the name of the top platen contact surface

  • bottom_platen_contact (str) – Specify the name of the bottom platen contact surface

  • top_platen_fixture (str) – Specify the name of the top platen fixture surface

  • bottom_platen_fixture (str) – Specify the name of the bottom platen fixture surface

  • contact_type (str) – The option for specifying contact, either “frictionless” or “friction”

Returns:

output_file

build_Tardigrade_input_deck.py

model_package.Tardigrade_MOOSE.build_Tardigrade_input_deck.build_input(output_file, mesh_file, BCs, disp, duration, disp_point=None, calibration_map=None, elastic_material_card=None, phi_BC=None)[source]

Write a Tardigrade-MOOSE input file

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • BCs (str) – The type of boundary conditions, either “slip” or “clamp”

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • disp_point (str) – Optional string of coordinates to query x-displacement

  • calibration_map (str) – CSV file containing calibration data, first method for specifying material parameters

  • elastic_material_card (str) – YML file containing elastic material parameters, second method for specifying material parameters

  • phi_BC (str) – Optional string specifying nodeset to force micro deformation components to be zero

Returns:

output_file

model_package.Tardigrade_MOOSE.build_Tardigrade_input_deck.unpack_elastic_parameter_csv(parameter_df, i)[source]

Convert a single line of an elastic calibration map into relevant material strings and element number

Params DataFrame parameter_df:

The loaded calibration map

Params int i:

The current DataFrame index

Returns:

mat_line_1, mat_line_2, mat_line_3, mat_line_4, element

build_Tardigrade_input_deck_brazil_disk_kernel_platens.py

model_package.Tardigrade_MOOSE.build_Tardigrade_input_deck_brazil_disk_kernel_platens.build_input(output_file, mesh_file, parameter_sets, platen_radius, disp, duration, specimen_bottom_surface, specimen_top_surface=None, top_symmetry=None, back_symmetry=None, side_symmetry=None, xc_bot=0.0, yc_bot=0.0, xc_top=0.0, yc_top=0.0, geometry='full', material_type='elastic', phi_BC=None, phis='on', extra_stress_output='off', higher_order_stress_output='off')[source]

Write MOOSE input file for Brazilian disk simulation with nodal kernel contact

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • parameter_sets (list) – The list of yaml files containing calibration results

  • material_E (float) – The elastic modulus of the specimen material

  • material_nu (float) – The Poisson ratio of the specimen material

  • platen_radius (float) – The radius of curvature of the Brazilian disk compression platen

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_bottom_surface (str) – The name of the specimen bottom contact surface

  • specimen_top_surface (str) – The name of the specimen top contact surface. Required if “geometry” = “full.”

  • top_symmetry (str) – The name of the top symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • back_symmetry (str) – The name of the back symmetry surface. Required if “geometry” = “quarter” or “eighth” or “half.”

  • side_set (str) – The name of the side symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • xc_bot (float) – The x-position of the center of the circular bottom surface arc

  • yc_bot (float) – The y-position of the center of the circular bottom surface arc

  • xc_top (float) – The x-position of the center of the circular top surface arc

  • yc_top (float) – The y-position of the center of the circular top surface arc

  • geometry (str) – The geometry/symmetry type: “full,” “half,” “quarter,” or “eighth”

  • material_type (str) – The material type, either “elastic” or “plastic”

  • phi_BC (str) – Optional string specifying nodeset to force micro deformation components to be zero

  • phis (str) – Either “on” to activate phi coupling kernels, or “off” to deactivate

  • extra_stress_output (str) – Either “on” to output all second order stress variables, or “off” to deactivate

  • higher_order_stress_output (str) – Either “on” to output higher order stress variables, or “off” to deactivate

Returns:

output_file

build_Tardigrade_input_deck_brazil_disk_rigid_platens.py

model_package.Tardigrade_MOOSE.build_Tardigrade_input_deck_brazil_disk_rigid_platens.build_input(output_file, mesh_file, parameter_sets, platen_radius, disp, duration, specimen_bottom_surface, specimen_top_surface=None, top_symmetry=None, back_symmetry=None, side_symmetry=None, xc_bot=0.0, yc_bot=0.0, xc_top=0.0, yc_top=0.0, geometry='full', material_type='elastic', phi_BC=None, platens='cylinder')[source]

Write MOOSE input file for Brazilian disk simulation with rigid contact platens

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • mesh_file (str) – The name of the mesh file

  • parameter_sets (list) – The list of yaml files containing calibration results

  • material_E (float) – The elastic modulus of the specimen material

  • material_nu (float) – The Poisson ratio of the specimen material

  • platen_radius (float) – The radius of curvature of the Brazilian disk compression platen

  • disp (float) – The compressive displacement to be applied

  • duration (float) – The duration of the simulation

  • specimen_bottom_surface (str) – The name of the specimen bottom contact surface

  • specimen_top_surface (str) – The name of the specimen top contact surface. Required if “geometry” = “full.”

  • top_symmetry (str) – The name of the top symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • back_symmetry (str) – The name of the back symmetry surface. Required if “geometry” = “quarter” or “eighth” or “half.”

  • side_set (str) – The name of the side symmetry surface. Required if “geometry” = “quarter” or “eighth.”

  • xc_bot (float) – The x-position of the center of the circular bottom surface arc

  • yc_bot (float) – The y-position of the center of the circular bottom surface arc

  • xc_top (float) – The x-position of the center of the circular top surface arc

  • yc_top (float) – The y-position of the center of the circular top surface arc

  • geometry (str) – The geometry/symmetry type: “full,” “half,” “quarter,” or “eighth”

  • material_type (str) – The material type, either “elastic” or “plastic”

  • phi_BC (str) – Optional string specifying nodeset to force micro deformation components to be zero

  • platens (str) – Either “cylinder” for cylindrical BCs or “flat” for flat plane BCs

Returns:

output_file

cube_mesh.py

model_package.Tardigrade_MOOSE.cube_mesh.cube_mesh(side_length, seed_size, output_file, x0=0.0, y0=0.0, z0=0.0)[source]

Create a cube mesh

Parameters:
  • side_length (float) – Cube side length

  • seed_size (float) – The approximate mesh size

  • output_file (str) – The output filename

  • x0 (float) – The x-distance to translate the cube

  • y0 (float) – The y-distance to translate the cube

  • z0 (float) – The z-distance to translate the cube

Returns:

{output_file}.e

cylinder_from_bounds.py

model_package.Tardigrade_MOOSE.cylinder_from_bounds.cylinder_from_bounds(output_file, bounds_file, seed_size, cut=False, brazil_lines=False, xdmf=True, ascii=False)[source]

Create a cylinder mesh from the bounds of a DNS file

Parameters:
  • output_file (str) – The output filename

  • bounds_file (str) – The file containing the bounds of the DNS

  • seed_size (float) – The approximate mesh size

  • cut (bool) – The option to cut geometry into octants, pass string “True” if desired

  • xdmf (bool) – The option to convert default exodus mesh to XDMF (binary)

  • ascii (bool) – The option to convert binary XDMF mesh to ascii

Calls “mesh” function and converts {output_file}.e to {output_file}.xdmf

model_package.Tardigrade_MOOSE.cylinder_from_bounds.mesh(rad, height, x0, y0, z0, seed_size, output_file, cut=False, brazil_lines=False)[source]

Mesh a cylinder using Cubit

Parameters:
  • rad (float) – Cylinder radius

  • height (float) – Cylinder height

  • x0 (float) – The x-distance to translate the cylinder

  • y0 (float) – The y-distance to translate the cylinder

  • z0 (float) – The z-distance to translate the cylinder

  • seed-size (float) – The approximate mesh size

  • output_file (str) – The output filename

  • cut (bool) – The option to cut geometry into octants, pass string “True” if desired

Returns:

{output_file}.e

cylinder_from_bounds_with_platens.py

model_package.Tardigrade_MOOSE.cylinder_from_bounds_with_platens.cylinder_from_bounds_with_platens(output_file, bounds_file, seed_size, platen_rad_factor=1.5, platen_depth=1.0, xdmf=True, ascii=False, gap=None)[source]

Create a cylinder mesh from the bounds of a DNS file with platens

Parameters:
  • output_file (str) – The output filename

  • bounds_file (str) – The file containing the bounds of the DNS

  • seed_size (float) – The approximate mesh size

  • platen_rad_factor (float) – The factor to multiply the specimen radius by to determine the specimen radius

  • platen_depth (float) – The thickness of the platens

  • xdmf (bool) – The option to convert default exodus mesh to XDMF (binary)

  • ascii (bool) – The option to convert binary XDMF mesh to ascii

Calls “mesh” function and converts {output_file}.e to {output_file}.xdmf

model_package.Tardigrade_MOOSE.cylinder_from_bounds_with_platens.mesh(rad, height, x0, y0, z0, seed_size, output_file, platen_rad_factor, platen_depth, gap=None)[source]

Mesh a cylinder using Cubit with platens

Parameters:
  • rad (float) – Cylinder radius

  • height (float) – Cylinder height

  • x0 (float) – The x-distance to translate the cylinder

  • y0 (float) – The y-distance to translate the cylinder

  • z0 (float) – The z-distance to translate the cylinder

  • seed-size (float) – The approximate mesh size

  • output_file (str) – The output filename

  • platen_rad_factor (float) – The factor to multiply the specimen radius by to determine the specimen radius

  • platen_depth (float) – The thickness of the platens

Returns:

{output_file}.e

extract_exodus_data.py

model_package.Tardigrade_MOOSE.extract_exodus_data.decode_chunk(chunk)[source]

Convert the strange array of characters to a regular string for variable names from netCDF4

Params array chunk:

An array of encoded bytes representing a variable name

Returns:

properly formatted string

model_package.Tardigrade_MOOSE.extract_exodus_data.deviatoric_norm(dataset, prefix='sigma', postfix='')[source]

Calculate the deviatoric norm of a second order stress tensor

Params xarray_DataSet dataset:

The xarray dataset containing stress data

Params str prefix:

The variable name of the stress tensor

Params str postfix:

Optional third order index for higher order stress tensors

Returns:

deviatoric norm

model_package.Tardigrade_MOOSE.extract_exodus_data.extract_cell_data(exofile, num_times, cell_variable_keys, num_elements=None)[source]

Extract cell variables from exodus file

Params netCDF4-Dataset exofile:

Open netCDF4 dataset containing exodus data

Params int num_times:

The number of time steps in the Exodus results file

Params dict cell_variable_keys:

dictionary containing integer keys mapping alphabetically sorted cell data variable names

Returns:

dictionary containing element field arrays and integer specifying the number of elements

model_package.Tardigrade_MOOSE.extract_exodus_data.extract_exodus_data(exodus_file, output_cell_data=None, output_node_data=None, output_plot_base_name=None, output_dt_plot_base_name=None, stress_norms_plot_base=None, xdmf_file=None, higher_order_stresses='off')[source]

Process results from a MOOSE exodus simulation results file

Params str exodus_file:

The MOOSE exodus simulation results file

Params str output_cell_data:

Optional output netcdf file containing xarray of collected cell data

Params str output_node_data:

Optional output netcdf file containing xarray of collected node data

Params str output_plot_base_name:

Optional basename for field output plots

Params str output_dt_plot_base_name:

Optional basename for dt history plots

Params str stress_norms_plot_base:

Optional basename for stress norm history plot

Params str xdmf_file:

Optional basename for writing cell data to an XDMF file

Params str higher_order_stresses:

Either “on” to include higher order stresses in norm calculation, or “off

Returns:

Write {output_cell_data} and {output_node_data}

model_package.Tardigrade_MOOSE.extract_exodus_data.extract_node_data(exofile, node_variable_keys, x, y, z)[source]

Extract node variables from exodus file

Params netCDF4-Dataset exofile:

Open netCDF4 dataset containing exodus data

Params array-like x:

The reference x-coordinates for the mesh

Params array-like y:

The reference y-coordinates for the mesh

Params array-like z:

The reference z-coordinates for the mesh

Returns:

dictionary containing nodal field arrays

model_package.Tardigrade_MOOSE.extract_exodus_data.plot_cell_data_over_time(output_file, cell_data, data_key, times, dataset=None)[source]

Plot cell data over time for all elements

Parameters:
  • output_file (str) – The output plot file name

  • cell_data (dict) – A dictionary containing all cell data arrays

  • data_key (str) – The dictionary key corresponding to the array to be plotted

  • times (array-like) – Array of simulation times

Returns:

Write {output_file} plot

model_package.Tardigrade_MOOSE.extract_exodus_data.plot_delta_t(times, output_file)[source]

Plot timestep history

Parameters:
  • times (array-like) – Array of simulation times

  • output_file (str) – The output plot file name

Returns:

Write {output_file} plot

finite_stVK_calculation.py

model_package.Tardigrade_MOOSE.finite_stVK_calculation.finite_stVK_calculation(diameter=5.0, material_E=250.0, material_nu=0.2, eps_z=-0.01)[source]

Solution for uniaxial stress of a cylinder for finite deformation using the St. Venant-Kirchhoff elasticity model

Params float diameter:

The diameter of the cylinder in millimeters

Params float material_E:

The elastic modulus in MPa

Params float material_nu:

The Poisson ratio

Params float eps_z:

The applied nominal strain in the z-direction

Returns:

Print various solution quantities to the terminal

MOOSE_input_deck_tools.py

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_default_auxkernels(file)[source]

Write the default aux kernels for normal components of PK2 and Sigma stresses

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_default_auxvariables(file)[source]

Write the default aux variables for forces and normal components of PK2 and Sigma stresses

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_elastic_material_card(file, yaml_data, elem_num=None)[source]

Write an elastic material block

Params file file:

The file to write to

Parameters:
  • yaml_data (dict) – Dictionary containing material information unpacked from a yaml file

  • elem_num (int) – Optional element number to make the material card unique to a specific element block

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_extra_second_order_auxvariables(file)[source]

Write the aux variables for off-diagonal components of PK2 and Sigma stresses

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_extra_second_order_stress_auxkernels(file)[source]

Write the off-diagonal aux kernels for normal components of PK2 and Sigma stresses

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_higher_order_stress_auxkernels(file, dim=3)[source]

Write the aux kernels for higher order stress components

Params file file:

The file to write to

Params into dim:

The problem dimension

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_higher_order_stress_auxvariables(file, dim=3)[source]

Write the aux variables for higher order stress components

Params file file:

The file to write to

Params into dim:

The problem dimension

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_kernels(file, phis='on', internal_force='InternalForce', internal_couple='InternalCouple')[source]

Write the kernels block for coupled kinematic variables

Params file file:

The file to write to

Parameters:

phis (str) – Either “on” to activate phi coupling kernels, or “off” to deactivate

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_outputs_block(file)[source]

Write the default outputs block

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_phi_BCs(file, phi_BC)[source]

Write the boundary conditions to fix micro-displacements

Params file file:

The file to write to

Parameters:

phi_BC (str) – Nodeset to force micro deformation components to be zero

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_plastic_auxkernels(file)[source]

Write the aux kernels for plastic multipliers and internal state variables

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_plastic_auxvariables(file)[source]

Write the aux variables for plastic multipliers and internal state variables

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_plastic_material_card(file, yaml_data, elem_num=None)[source]

Write a plastic material block

Params file file:

The file to write to

Parameters:
  • yaml_data (dict) – Dictionary containing material information unpacked from a yaml file

  • elem_num (int) – Optional element number to make the material card unique to a specific element block

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_preconditioner_block(file)[source]

Write the default SMP preconditioner block

Params file file:

The file to write to

model_package.Tardigrade_MOOSE.MOOSE_input_deck_tools.write_variables(file)[source]

Write the variables block for displacements and micro-displacements

Params file file:

The file to write to

plot_dynamic_displacement.py

model_package.Tardigrade_MOOSE.plot_dynamic_displacement.plot_dyanmic_displacement(csv_file, output_file, output_csv, disp_factor=1)[source]

Process displacement vs time from Tardigrade-MOOSE results

Parameters:
  • csv_file (str) – The csv file containing force results

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • disp_factor (float) – The factor to scale displacement

Returns:

Write output_file and output_csv

plot_force_displacement.py

model_package.Tardigrade_MOOSE.plot_force_displacement.plot_force_displacement(csv_file, output_file, output_csv, final_disp=1, force_factor=1, force_field='bot_react_z', time_field='time', disp_field=None)[source]

Process force-displacement from Tardigrade-MOOSE results

Parameters:
  • csv_file (str) – The csv file containing force results

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • final_disp (float) – The final displacement (mm) to linearly ramp over simulation duration

  • force_factor (float) – The factor to scale force

  • force_field (str) – The column label for force values

  • time_field (str) – The column label for time values

  • disp_field (str) – Optional column label for displacement values

Returns:

Write output_file and output_csv

plot_lateral_displacement.py

model_package.Tardigrade_MOOSE.plot_lateral_displacement.plot_lateral_displacement(csv_file, output_file, output_csv)[source]

Process lateral displacement from Tardigrade-MOOSE results

Parameters:
  • csv_file (str) – The csv file containing force results

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

Returns:

Write output_file and output_csv

process_calibration_map_to_parameter_csv.py

model_package.Tardigrade_MOOSE.process_calibration_map_to_parameter_csv.process_calibration_map_to_parameter_csv(output_file, calibration_map)[source]

Process a calibration map file to a parameter csv for Tardigrade-MOOSE

Parameters:
  • output_file (str) – Specify the name of the output csv to write

  • calibration_map (str) – CSV file containing calibration data

Returns:

output_file

summarize_dynamic_displacements.py

model_package.Tardigrade_MOOSE.summarize_dynamic_displacements.summarize_dynamic_displacements(csv_files, plot_labels, output_file, output_csv, disp_factor=1)[source]

Plot mutliple dynamic displacement plots against each other

Parameters:
  • csv_files (list) – The csv files containing force results

  • plot_labels (list) – The plot labels, same size as csv_files

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • disp_factor (float) – The factor to scale displacement

Returns:

Write output_file and output_csv, optionally write convergence_plot

summarize_micro_macro_force_displacements.py

model_package.Tardigrade_MOOSE.summarize_micro_macro_force_displacements.plot_force_displacement(csv_files, plot_labels, output_file, output_csv=None, convergence_plot=None, force_field='force', disp_field='disp', x_label='Displacement (mm)', y_label='Force (N)', brazil_exp_file=None)[source]

Plot multiple force displacement plots against each other

Parameters:
  • csv_files (list) – The csv files containing force results

  • plot_labels (list) – The plot labels, same size as csv_files

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • convergence_plot (str) – Optional file name for convergence plot

  • force_field (str) – The column label for force values

  • disp_field (str) – The column label for displacement values

  • x_label (str) – The label (without units) for the x data

  • y_label (str) – The label (without units) for the y data

Returns:

Write output_file and output_csv

summarize_micro_macro_lateral_displacements.py

model_package.Tardigrade_MOOSE.summarize_micro_macro_lateral_displacements.plot_convergence(convergence_plot, y_values, y_label, elements, convergence_value=None)[source]

Plot convergence of a quantity of interest (QoI) vs element count

Parameters:
  • convergence_plot (str) – File name for convergence plot

  • y_values (array-like) – The QoI values

  • y_label (str) – Plot label for QoI

  • elements (array-lke) – Array of element counts to plot on x-axis

Params float convergence_value:

Optional “true” value for QoI

Returns:

Write convergence_plot

model_package.Tardigrade_MOOSE.summarize_micro_macro_lateral_displacements.plot_lateral_displacement(csv_files, plot_labels, output_file, output_csv, convergence_plot=None)[source]

Plot mutliple lateral displacement plots against each other

Parameters:
  • csv_files (list) – The csv files containing force results

  • plot_labels (list) – The plot labels, same size as csv_files

  • output_file (str) – The name of the output file of collected results

  • output_csv (str) – The name of the output csv file

  • convergence_plot (str) – Optional file name for convergence plot

Returns:

Write output_file and output_csv, optionally write convergence_plot

uniformly_refine_mesh.py

model_package.Tardigrade_MOOSE.uniformly_refine_mesh.refine_mesh(input_mesh, output_mesh, refinement_level, calibration_map_in, calibration_map_out=None)[source]

Uniformly refine an exodus mesh and update a calibration map with new element IDs

Params str input_mesh:

The input exodus mesh file to refine

Params str output_mesh:

The output exodus mesh file

Params int refinement_level:

The uniform refinement level, 1: refine by 1 level (each hex element is split into 8), 2: refinement by 2 levels (each hex element is split into 24)

Params str calibration_map_in:

The original calibration map file

Params str calibration_map_out:

The output calibration map file with updated element ids

Returns:

{output_mesh} and {calibration_map_out}

write_elastic_material_card.py

model_package.Tardigrade_MOOSE.write_elastic_material_card.write_elastic_material_card(output_file, lamb=0.0, mu=0.0, eta=0.0, tau=0.0, kappa=0.0, nu=0.0, sigma=0.0, tau1=0.0, tau2=0.0, tau3=0.0, tau4=0.0, tau5=0.0, tau6=0.0, tau7=0.0001, tau8=0.0, tau9=0.0, tau10=0.0, tau11=0.0)[source]

Write elastic Tardigrade-MOOSE input card (.yml)

Parameters:
  • output_file (str) – The name of Tardigrade-MOOSE file to write

  • lamb (float) – The lambda parameter

  • mu (float) – The mu parameter

  • eta (float) – The eta parameter

  • tau (float) – The tau parameter

  • kappa (float) – The kappa parameter

  • nu (float) – The nu parameter

  • sigma (float) – The sigma parameter

  • tau1 (float) – The tau1 parameter

  • tau2 (float) – The tau2 parameter

  • tau3 (float) – The tau3 parameter

  • tau4 (float) – The tau4 parameter

  • tau5 (float) – The tau5 parameter

  • tau6 (float) – The tau6 parameter

  • tau7 (float) – The tau7 parameter

  • tau8 (float) – The tau8 parameter

  • tau9 (float) – The tau9 parameter

  • tau10 (float) – The tau10 parameter

  • tau11 (float) – The tau11 parameter

Returns:

Write output_file

write_plastic_material_card.py

model_package.Tardigrade_MOOSE.write_plastic_material_card.write_plastic_material_card(output_file, output_type, lamb, mu, eta, tau, kappa, nu, sigma, tau1, tau2, tau3, tau4, tau5, tau6, tau7, tau8, tau9, tau10, tau11, cu0, Hu, cchi0, Hchi, cnablachi0, Hnablachi)[source]

Write elastoplastic Tardigrade-MOOSE input card

Params str output_file:

The name of Tardigrade-MOOSE file to write

Params str output_type:

The type of material card to write, either ‘yaml’ or ‘csv’

Params float lambda:

The elastic lambda parameter

Params float mu:

The elastic mu parameter

Params float eta:

The elastic mu parameter

Params float tau:

The elastic tau parameter

Params float kappa:

The elastic kappa parameter

Params float nu:

The elastic nu parameter

Params float sigma:

The elastic sigma parameter

Params float tau1:

The elastic tau1 parameter

Params float tau2:

The elastic tau2 parameter

Params float tau3:

The elastic tau3 parameter

Params float tau4:

The elastic tau4 parameter

Params float tau5:

The elastic tau5 parameter

Params float tau6:

The elastic tau6 parameter

Params float tau7:

The elastic tau7 parameter

Params float tau8:

The elastic tau8 parameter

Params float tau9:

The elastic tau9 parameter

Params float tau10:

The elastic tau10 parameter

Params float tau11:

The elastic tau11 parameter

Params float cu0:

The plastic initial macro cohesion parameter

Params float Hu:

The plastic macro hardening parameter

Params float cchi0:

The plastic initial micro cohesion parameter

Params float Hchi:

The plastic micro hardening parameter

Params float cnablachi0:

The plastic initial micro gradient cohesion parameter

Params float Hnablachi:

The plastic micro gradient hardening parameter

Returns:

output_file