pythonansyspyansys

How do I interpret .rst results file with python using pyansys library?


I am reading the binary files '.rst' using the ansys.mapdl library reader, and I want to understand those results. I have a beam simulated on ansys mechanical and I am evaluating total deformation, equivalent elastic strain and equivalent stress.

What nodes are associated with which values? How are all three results separated? Also, I tried printing random data just to try and make sense of it but some data are NAN, so I would like to know why that is the case.

Here is the simulation and some code enter image description here

enter image description here

enter image description here

enter image description here

EDIT: Here is total deformation for the first 10 nodes exported from ansys mechanical to a .txt file

Node Number Total Deformation (m)
1   3,4011e-002
2   3,1337e-002
3   2,8684e-002
4   2,6064e-002
5   2,3489e-002
6   2,097e-002
7   1,8522e-002
8   1,6157e-002
9   1,389e-002
10  1,1736e-002

Here are my results after running this small script

rst_results = path + "file.rst"
model = pymapdl_reader.read_binary(rst_results)
nnum, data = model.nodal_solution(0, nodes=range(1, 10))
print(data)

output:

[[-1.30837114e-03 -5.18717535e-07 -3.39862333e-02]
 [-1.19035991e-03 -6.35982671e-07 -3.13144870e-02]
 [-1.07379301e-03 -8.05693695e-07 -2.86642968e-02]
 [-9.59576794e-04 -1.01205615e-06 -2.60467228e-02]
 [-8.48646606e-04 -1.24353973e-06 -2.34735376e-02]
 [-7.41942455e-04 -1.49284317e-06 -2.09571697e-02]
 [-6.40385662e-04 -1.75494961e-06 -1.85106729e-02]
 [-5.44855004e-04 -2.02586199e-06 -1.61477097e-02]
 [-4.56160962e-04 -2.30167900e-06 -1.38825364e-02]]

Solution

  • From the docs:

    def principal_nodal_stress(self, rnum, nodes=None):
        """Computes the principal component stresses for each node in
        the solution.
        Parameters
        ----------
        rnum : int or list
            Cumulative result number with zero based indexing, or a
            list containing (step, substep) of the requested result.
        Returns
        -------
        nodenum : numpy.ndarray
            Node numbers of the result.
        pstress : numpy.ndarray
            Principal stresses, stress intensity, and equivalent stress.
            [sigma1, sigma2, sigma3, sint, seqv]
        Examples
        --------
        Load the principal nodal stress for the first solution.
        >>> from ansys.mapdl import reader as pymapdl_reader
        >>> rst = pymapdl_reader.read_binary('file.rst')
        >>> nnum, stress = rst.principal_nodal_stress(0)
    

    So each number in your nodal number array nnum correspond to the stresses in stress.

    Can you check which node numbers correspond to midside nodes? Nodal stress data for printout and postprocessing are available only for the corner nodes. So I would guess that's the reason for the nan.

    For nodal displacements:

        >>> from ansys.mapdl import reader as pymapdl_reader
        >>> rst = pymapdl_reader.read_binary('file.rst')
        >>> nnum, data = rst.nodal_solution(0)
    

    For elastic strain you need an element result:

        >>> enum, edata, enode = rst.element_solution_data(0, datatype='EEL')
        >>> enum[0]  # first element number
        >>> enode[0]  # nodes belonging to element 1
        >>> edata[0]  # data belonging to element 1
    

    The available results are:

            EMS: misc. data
            ENF: nodal forces
            ENS: nodal stresses
            ENG: volume and energies
            EGR: nodal gradients
            EEL: elastic strains
            EPL: plastic strains
            ECR: creep strains
            ETH: thermal strains
            EUL: euler angles
            EFX: nodal fluxes
            ELF: local forces
            EMN: misc. non-sum values
            ECD: element current densities
            ENL: nodal nonlinear data
            EHC: calculated heat
            EPT: element temperatures
            ESF: element surface stresses
            EDI: diffusion strains
            ETB: ETABLE items (post1 only)
            ECT: contact data
            EXY: integration point locations
            EBA: back stresses
            ESV: state variables
            MNL: material nonlinear record