TARDIGRADE-EXAMPLES API

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

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)[source]

Map a flattened 2nd order 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

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.

DNS_Abaqus.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.

DNS_Abaqus.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

DNS_Abaqus.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_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

DNS_Abaqus.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

DNS_Abaqus.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.

DNS_Abaqus.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

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

DNS_Ratel.plot_force_displacement.py

model_package.DNS_Ratel.plot_force_displacement.plot_force_displacement(csv_file, output_file, output_csv, face_id, final_disp, force_col='force_z', header_row=0, force_factor=1)[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

DNS_Ratel.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_file (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/tonne^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/tonne^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

Filter.build_filter_config.py

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, max_parallel=None)[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”

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

returns output_file

Filter.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

Filter.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

Filter.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

Filter.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}

Filter.run_micromorphic_filter.py

model_package.Filter.run_micromorphic_filter.run_filter(config_file)[source]

Run the Micromorphic Filter

Parameters:

config_file (str) – The filter configuration file

Runs the Micromorphic Filter

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 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.write_filter_domain(output_file, single_points=None, csv_file=None)[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

Filter.visualize_results.py

model_package.Filter.visualize_results.average_quantities(quantities)[source]

Average 2nd order tensor quantites over 8 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

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)[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

Returns:

Write output_file

model_package.Filter.visualize_results.csv_machine(quantity, output_file, nqp, nel, time, three_point=False)[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

Returns:

output_file

model_package.Filter.visualize_results.deviatoric(stress)[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

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.get_R_and_U(PK2, F, chi, times)[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

Returns:

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

model_package.Filter.visualize_results.plot_axial_vector_mag(cauchy, times, average, output_name)[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

Returns:

output_name

model_package.Filter.visualize_results.plot_current_stresses(e, stress, average, output_name)[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

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)[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 filenmae to plot difference between body couples and micro spin inertias

Returns:

plot_body_couples, plot_spin_inertias, and plot_spin_diff

model_package.Filter.visualize_results.plot_reference_stresses(E, stress, average, output_name)[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

Returns:

output_name

model_package.Filter.visualize_results.plot_rot_diffs(PK2, times, R, Rchi, average, output_name)[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

Returns:

output_name

model_package.Filter.visualize_results.plot_stress_diffs(cauchy, symm, times, average, output_name)[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

Returns:

output_name

model_package.Filter.visualize_results.plot_stress_norm(cauchy, symm, m, nqp, nel, ninc, times, output_name)[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

  • times (array-like) – The time increments

  • output_name (str) – Output filename

Returns:

output_name plot

model_package.Filter.visualize_results.plot_stretch_diffs(PK2, times, U, Uchi, average, output_name)[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

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.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, 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)[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

  • 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

Filter.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

Filter.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(calibrated_elements, calibrated_files, ignore_boundary_yml, ignore_boundary_summary_file, output_file)[source]

Create a yaml file to map calibration results

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 ignore_boundary_yml:

A yaml file containing the ‘best’ calibration using the kernel density estimate

Params str ignore_boundary_summary_file:

A csv file containing a summary of calibrated parameters for each element

Params str output_file:

The name of the output yaml file

Returns:

Write output_file

Calibrate.calibrate_element.py

model_package.Calibrate.calibrate_element.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.calibrate_element.calibrate(input_file, output_file, case, Emod, nu, L, element=0, increment=None, plot_file=None, average=True, UQ_file=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, 4: all 18 parameters

  • 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 argument to calibrate only a specific increment

Returns:

calibrated parameters by minimizing a specified objective function

model_package.Calibrate.calibrate_element.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.calibrate_element.evaluate_model(inputs, parameters, model_name, parameters_to_fparams, nsdvs, element, maxinc=None, dim=3, maxsubiter=5)[source]

Evaluate the model given the parameters. Copied 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

  • 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.calibrate_element.initial_estimate(Emod, nu, L)[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

  • L (float) – An estimate of the length scale parameter

Returns:

array of estimated micromorphic linear elasticity parameters

model_package.Calibrate.calibrate_element.objective(x0, Y, inputs, cal_norm, nu_targ, case, element, increment=None, stresses_to_include=['S', 'SIGMA', 'M'])[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

  • increment (int) – An optional argumet to calibrate only a specific increment, default=None

  • 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, calibrate=True, increment=None)[source]

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

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

  • 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 argumet to calibrate only a specific increment, default=None

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, calibrate=True, increment=None)[source]

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

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

  • 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 argumet to calibrate only a specific increment, default=None

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, calibrate=True, increment=None)[source]

Objective function number 3 used for calibrating 8 parameters of micromorphic linear elasticity

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

  • 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 argumet to calibrate only a specific increment, default=None

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, calibrate=True, increment=None)[source]

Objective function number 4 used for calibrating all 18 parameters of micromorphic linear elasticity

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

  • 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 argumet to calibrate only a specific increment, default=None

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.plot_stresses(estrain, stress, stress_sim, output_name, element)[source]

Plot comparison of stress vs strain (in the current configuration) between homogenized DNS results against calibrated model predictions

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

  • stress (dict) – The quantities dict storing either Cauchy or Symmetric micro stress of the homogenized DNS results

  • stress – The quantities dict storing either Cauchy or Symmetric micro stress of the calibrated model predictions

  • output_name (str) – The output plot name

  • element (int) – The macro (filter) element considered for calibration

Returns:

output_name

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

Calibrate.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

Calibrate.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, 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.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

Calibrate.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

  • parameter_study_file (str) – H5 file with a WAVES parameter study Xarray Dataset

  • 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_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

  • parameter_study_file (str) – H5 file with a WAVES parameter study Xarray Dataset

  • 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 (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)[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

Returns:

Write output_mesh

Tardigrade_MOOSE.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)[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

Returns:

output_file

Tardigrade_MOOSE.build_Tardigrade_input_deck.py

model_package.Tardigrade_MOOSE.build_Tardigrade_input_deck.build_input(output_file, mesh_file, BCs, disp, duration, parameter_sets=None, calibration_map=None, disp_point=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

  • 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

  • disp_point (str) – Optional string of coordinates to query x-displacement

Returns:

output_file

Tardigrade_MOOSE.cylinder_from_bounds.py

model_package.Tardigrade_MOOSE.cylinder_from_bounds.cylinder_from_bounds(output_file, bounds_file, seed_size, cut=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)[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

Tardigrade_MOOSE.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

Tardigrade_MOOSE.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

Tardigrade_MOOSE.plot_force_displacement.py

model_package.Tardigrade_MOOSE.plot_force_displacement.plot_force_displacement(csv_file, output_file, output_csv, final_disp, force_factor=1)[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

Returns:

Write output_file and output_csv

Tardigrade_MOOSE.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, convergence_plot=None)[source]

Plot mutliple 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

Returns:

Write output_file and output_csv

Tardigrade_MOOSE.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