Muscat.IO.SamcefTools module

CheckIntegrity()[source]
class PropertiesReader(folderpath, projectname)[source]

Bases: ReaderBase

Samcef Reader class

ContactRead(fileName=None)[source]

Parse a trace file (.tra) describing contacts and return a dictionary of parsed information.

This method processes a .tra file resulting from the baconpost execution “.MCT LIST n1 A n2 PAS k”, which provides information on contacts. Before executing this command, ensure to enter trace mode with “MODE TRACE” so that baconpost creates the .tra file.

The .tra file contains contact IDs along with the following information: - Attributes (int) - Connected nodes (connected to a face) - Target group (the facet) - Max Radius - Max number of elements - Triangulation option - Shells reverse option - Minimal distance DMIN - UN3 - OPT

Parameters:

fileName (str) – The file path of the result of baconpost execution (.tra file).

Returns:

A dictionary where keys are IDs of the contacts and values are the corresponding definitions.

Return type:

dict

Notes

This function may ignore some information from the trace file. This reader only considers Node-Facet contacts

ElementRead()[source]

Parse a trace file (.tra) and extract element and node information.

This method processes a .tra file generated by the baconpost execution “.MAI DLIST”, which contains information about contacts. The file includes element IDs and their composing nodes.

Returns:

  • dict – A dictionary where keys are element IDs and values are the corresponding nodes.

  • list – A list of original element IDs.

Notes

This function may ignore some information from the .tra file.

FctRead(fileName=None)[source]

Parse a trace file and extract function information.

This method takes a trace file (.tra) describing functions and returns a dictionary of parsed information. The .tra file is the result of the baconpost execution “.FCT LIST n1 n2” (n1, n2 refer to min function id and max id). Before executing “.FCT LIST n1 n2”, enter trace mode with “MODE TRACE” so that baconpost creates the .tra file. The .tra file contains the function ids as well as the function descriptions.

Parameters:

fileName (str) – The file path of the result of baconpost execution (.tra file).

Returns:

A dictionary where keys are ids of the functions and values are the corresponding function definitions.

Return type:

dict

Notes

This function may ignore some information. We assume that we are only facing two types of function definitions: 1. ONLY ONE description WITH abscissae/ordinates format 2. Multiple linear descriptions on intervals giving the interval extremities and the values on those extremities

NodesRead()[source]

Create a trace file and parse node information.

This method creates a trace file (.tra) describing nodes and returns parsed node information. The .tra file is the result of the baconpost execution “.NOE DLIST” (returns information on contacts). It contains the IDs and spatial coordinates of the nodes.

Returns:

  • list – Original IDs of the nodes.

  • list – Corresponding x coordinates.

  • list – Corresponding y coordinates.

  • list – Corresponding z coordinates.

Notes

This function may ignore some information.

ReadElasticMat(fileName=None, string=None)[source]

Parse a trace file (.tra) describing ELASTIC materials and return a dictionary of parsed information.

This method processes a .tra file resulting from the baconpost execution “.MAT LIST I n1 n2”, which returns information on material definitions for identifiers between n1 and n2. The .tra file contains the identifier, name of the material, as well as: - Poisson number (described by reference values and a multiplicative temporal function) - Young modulus (described by reference values and a multiplicative temporal function) - Thermal expansion (described by reference values and a multiplicative temporal function) - Mass density - Reference temperature

Parameters:

fileName (str) – The file path of the result of baconpost execution (.tra file).

Returns:

A dictionary where keys are ids of the materials and values are the corresponding material descriptions.

Return type:

dict

Notes

  • Don’t forget to enter trace mode with “MODE TRACE” before executing “.MAT LIST I n1 n2”

so that baconpost creates the .tra file. - This function may ignore some information from the .tra file.

ReadElementAttributes()[source]

Create a trace file and parse element/material affectations.

This method creates a trace file (.tra) describing element/material affectations and returns a dictionary of parsed information. The .tra file is the result of the baconpost execution “.AEL LIST” (returns information of attributions of properties to element). The .tra file contains the element ids, the corresponding degree, the material name affected to this element, and the integration rules.

Returns:

A dictionary where keys are ids of the elements and values are the corresponding material.

Return type:

dict

Notes

CURRENTLY, THIS METHOD ONLY ALLOWS READING MATERIALS (affected with .AEL in the .dat file), and is not designed to behave well if there are other attributes affected with .AEL in the .dat file. This function may ignore some information.

ReadMechanicalBoundaryConditions()[source]

Create a trace file describing mechanical boundary conditions.

This reader only considers conditions imposed on Node, Edge, and Structure. It creates a .tra file describing mechanical boundary conditions and returns a dictionary of parsed information. The .tra file is the result of the baconpost execution “.CLM LIST TOUT” and contains element ids (for mechanical conditions on edges), node ids, or structure, as well as the nature of the mechanical boundary condition, components, reference values, and corresponding function ids.

Returns:

A dictionary containing three key-value pairs: - node_id_to_clm : dict

Keys are ids of the nodes, values are the corresponding boundary conditions.

  • element_id_to_clmdict

    Keys are ids of the elements, values are the corresponding boundary conditions.

  • structure_id_to_clmdict

    Keys are ids of the structures, values are the corresponding boundary conditions.

Return type:

dict

Notes

This function may ignore some information.

This function assumes that only Node, Edge, and Structure are concerned, which may be restrictive.

The .tra file contains information about mechanical boundary conditions such as “Prescribed pressure”, “Prescribed displacement”, etc.

SelRead()[source]

Create a trace file and parse group contents.

This method creates a trace file (.tra) describing group contents and returns a dictionary of parsed information. The .tra file is the result of the baconpost execution “.SEL LIST TOUT”. It contains the group IDs as well as: - Nature of objects composing the group (cells, nodes, or faces) - Group name - Identifiers of the objects composing the group (for faces, a tuple instead of a single ID)

Returns:

A dictionary where keys are IDs of the groups, and values are the corresponding information (name, nature of objects, IDs of objects).

Return type:

dict

Notes

This function may ignore some information.

get_next_element(string_list, s)[source]
all_strings_are_floats(string_list)[source]