General Mechanical

General Mechanical

Duplicate Timestep Row when Creating Chart in ANSYS Mechanical

    • rlolachi
      Subscriber

      Hello All,


      Not sure if this is a common problem, but I have occasionally encountered an odd problem when making custom charts in ANSYS Mechanical. When choosing objects from the Solution Branch the resulting chart creates duplicate rows based on the 'Time' column, one row for the X variable and one for the Y. This is most easily explained with a picture. See the area highlighted by the red box.


      Screenshot showing Chart Time Row Duplicate Problem


      In this example, I have created a chart with 'Contacting Area' (from the Solutions > Solution Information > Contacting Area) as the X value and a Force Reaction scoped to a Fixed Support on the base of the model. This gives the off result seen. What is more bizarre is that for a few steps X and Y values match up okay (at t=0, 0.05, 0.1 and 1), but for all other values of time, it has the duplication problem. This means the resulting chart only has 4 points. I'm assuming this is down to some kind of numerical precision error. Making the same kind of chart for another very similar model works perfectly. Am I being dim and missing something very obvious here?


      Thanks in advance! 

    • Aniket
      Ansys Employee

      Hi, Can you please upload inline images of the tabular data, as well as of the "details view" separately so those would be visible in the post? Please do not upload them as attachments as ANSYS employees are not able to download them.


       


      -Aniket


      Guidelines on the Student Community


      How to access ANSYS help links

    • rlolachi
      Subscriber

      Hi Aniket,


      Thanks very much for getting back to me. My apologies, as I only just realised that the table is not easily visible in the image I posted. Please see the following:



       


    • Aniket
      Ansys Employee

      Thanks for posting those images, and it seems weird but I have not seen it before.


      Do you get this type of behavior each time when you plot some other results on same model? I see that you mentioned other models do not show such an issue.


      Also, as a workaround can you plot them in Excel?

    • rlolachi
      Subscriber

      Thanks for getting back to me. It seems to happen when I plot different parts of the Solution Branch against each other. It also happens for a plot of contact area vs displacement for a probe scoped to the top surface of the model.


       


      I use a Python program, which is able to merge the lines together as a workaround for now.

    • Aniket
      Ansys Employee

      Thanks for letting us know. I will keep an eye on such behavior and file a bug if I encounter it. For helping the community, can you post your workaround as well so that it will help others with a similar question?

    • rlolachi
      Subscriber

      Hi Aniket, 

      Thank you for help too! My workaround is not implemented within ANSYS. Instead, I export data to a text file, which suffers from the same timestep-duplication problem. I read it into a Python program to do plotting and analysis. Part of that program includes a Python function which does the reading-in and merges the lines appropriately. Code for that is as follows:


      from pathlib import Path                # Path library
      import numpy as np # Dependency
      import pandas as pd # Panadas for managing datasets

      def read_ForceArea(file):
          """Function for reading ANSYS Area vs Force data."""
          df = pd.read_csv(file, 
                       sep='t',
                        x_col=0,  
            usecols=[0,1,2,3,4], # Need to set this or it thinks TAB at end-of-line is another data column
        encoding = 'ISO-8859-1') # Set because of Windows text file encoding

          # Check for Area and Force columns and name appropriately
          # Then make all force results positive
          NMEcol =
          i = 0
          for s in df.columns: #df
              if 'Force' in s:
                  NMEcol = 'Force'
              elif 'Area' in s:
                  NMEcol = 'Area'
              else:
                  pass
              i += 1   
          df.columns = NMEcol
          df.Force = np.abs(df.Force)
          df = df'Steps', 'Time', 'Force', 'Area' # Reorder columns 
          df.insert(loc=4, column='File', value=file.stem)

      Hopefully, it might of use to some folk.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.