General Mechanical

General Mechanical

Data acquisition

    • Hreetabh Kishore
      Subscriber

      How can we get the time-temperature data of each node for all time steps in doing welding simulation, simulataneously.

    • Aniket
      Ansys Employee

      You can export results at different timepoint to excel and compile it there.

      -Aniket

      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

    • Hreetabh Kishore
      Subscriber

      But in my simulation at a plane there are 4000+ nodes. Is it possible to collect time temperature data collectively. Because, individually is not possible. Which option in settings could help me in getting all the nodes data. Can you please guide me.

    • Mike Rife
      Ansys Employee

      Hi Hreetabh

      What is the purpose to gathering the time-history result for 4000+ nodes?  What are you goind to do with the data and in what format do you need the data?

       

    • Hreetabh Kishore
      Subscriber

      Hii Sir,

      With this data I will be going to predict microstructure and grain growth using Monte Carlo simulation. For which, time temp data will be inputs. To get data for all nodes, I can showcase the predicted microstructure at any of the area in the welding zone. For few nodes I know how to get the data, but collectively how can we do for all nodes?

       

    • Mike Rife
      Ansys Employee

      Does this Monte Carlo simulation program not read Ansys result files?  If not what format do you need?

    • Hreetabh Kishore
      Subscriber

      Sir, If I will get the time temperature data of nodes, I can save in notepad++ or excel file that will work. 

    • Hreetabh Kishore
      Subscriber

      There is no issue of format. Only the problem is how to collect time-temp data of atleast 100 nodes collectively not individually. Individually I have tried and I can do. But simultaneously for all nodes or large number of nodes. How to do that?

      For few nodes the suggested method in video is fine:

       

    • Mike Rife
      Ansys Employee

      Hreetabh

      The whole issue is format.  Let's assume that there are 1000 result time points in your model.  I cannot imagine that you would accept one data point per node to be written to its own text file.  Resulting in 4 million files for you to process.  How about one file of all nodes but containing just one time point of result data for 1000 files.  Or the other way around resulting in 4000 files.  Or one gigantic file with all the data...space separated data?  Tab?  Comma?

      Since you have not answered all my prior questions I guess I can assume that 1) the Monte Carlo program cannot access the solvers binary result file nor 2) do you want to write an access program yourself.

      Now Mechanical APDL (the program used by Mechanical to solve the analysis) has multiple ways of gathering and writing out data to files.  But to do so we need to know the requirements.  Again I am assuming/guessing you need ascii file(s).  Do you need the node x/y/z locations too?  What format i.e how many significant digits?  Do you need 4000+ columns of data - one for each node and then rows of time history results?  Or the other way around?  Looks like I am repeating myself so I will stop here.

      Do you know APDL?  How about Python/IronPython?  Is this a one-time need?  Or some repeatable process for many simulations? 

       

    • Hreetabh Kishore
      Subscriber

      Sir, 

      The format i need is a column of time and a column of temperature for each node in an array. There is no specific format, i need. The matlab code will read text file of these collected data. I need not x,y,z data. Moreover, after decimal 3 digits are ok. Look on the below figure. Suppose I have selected 100 nodes. And I want time-temp data for each nodes of all time steps, 200 (provided during simulation). which means a total of 200 columns will be there. 100 for time and 100 for temperature. This is teh only requirement in the form of text file. But problem is I cannot select each node at a time to acquire the data. I want to get the data simultaneously for all at a time to get recorded.

      Thanks!

       

       

       

    • mjmiddle
      Ansys Employee

       

      The Mechanical GUI does not have the predesigned ability to do this. Only a script could do this. Also, I’m not sure if you know that you can right click in a temperature result and export a tab delimited file of the temperatures at all selected nodes. But this is for one time point. You can change the evaluation time of the result and export all nodes again, and so work through all time points with this method. The other option is the time history that you see at the lower right. You can also export that if you first select the grey box at the upper left in the table, then right click to export. This reports, avg, max, min of the selected nodes. You have noticed that if you only select one node, that it evaluates to the exact value at that node for all time points, since avg,max,min are the same. This is what Mike Rife was stating. You can export all nodes at one time point or one node for all time points, but not all nodes for all time points. The GUI is not set up to do this. You could only do it with a script. Whether done as APDL script or Mechanical script is a matter of choice.

      Also your previous mention of 100 temperature columns and 100 time columns doesn't make sense to me. The temperatures occur at time points. You would have 200 temperature columns where each column represents a time point, plus one column for node ID, since you said you didn't need xyz location. The rows would be each node. In order to use the node ID's this would require you to export the exact mesh used in Mechanical and have that read into your Monte Carlo processing program. If you can't export/import the mesh, then you need 3 columns to represent the XYZ locations of each node.

       

    • Hreetabh Kishore
      Subscriber

      Sounds good!

      Ya I am looking for APDL script to get all time-temp data in Mechanical APDL. If you have any support in getting the script and how to implement that would be helpful for me. 

      The feature of getting time-temperature data for all nodes collectively may be not compatible with workbench in transient thermal analysis. I tried hard but unable to locate this feature.

      Thanks!

    • mjmiddle
      Ansys Employee

      Such a thing is certainly possible and compatible with Mechanical in workbench. It's just not a current feature, so needs to be done as a script in current version or ehancement request for a future version.

    • Hreetabh Kishore
      Subscriber

      Yaa....Definitely. 

      Thanks for the clarification. If possible can do help me in getting code for this so that I can open this model in APDL for such purpose.

    • mjmiddle
      Ansys Employee

       

      We don’t normally write scripts for customers, but I was working on something similar recently so it didn’t take that much time for me to put something together as a derivative of what I was working on. Select the result object, and paste the script into the Mechancal script console. It will write a file to the user_files folder inside the project. It is a general script for multiple result types and analysis types. It has some error checking, but I didn’t rule out all invalid result types, especially for frequency based analysis:

      # first select the result object
      obj = ExtAPI.DataModel.Tree.ActiveObjects[0]

      import os
      dir = ExtAPI.DataModel.WorkingDir
      for i in range(3):
          dir = os.path.dirname(dir)
      dir = os.path.join(dir, ‘user_files’)
      notTypes = [
      ’SolutionInformation’,
      ’Image’,
      ’Figure’,
      ’TreeGroupingFolder’,
      ’Results.StressToolResults.StressTool’,
      ’PostContactTool’,
      ’FatigueTool’,
      ’Results.BoltToolResults.BoltTool’,
      ’CommandSnippet’,
      ’PrimaryCriterion’,
      ]
      freqTypes =[
      AnalysisType.Harmonic,
      AnalysisType.Modal,
      AnalysisType.Spectrum,
      AnalysisType.ResponseSpectrum,
      ]

      type = str(obj.GetType()).lstrip(‘Ansys.ACT.Automation.Mechanical.’)
      if not type.find(‘.’) == -1:
          type2 = type.Split(‘.’)[1]
      else:
          type2 = ”
      if not type in notTypes and not type2 == ‘ProbeResults’:
          if type2 == ‘ContactToolResults’ or type2 == ‘FatigueToolResults’ or type2 == ‘StressToolResults’ or type2 == ‘BoltToolResults’:
              objName = obj.Parent.Name + ‘ ‘ + obj.Name
          else:
              objName = obj.Name
          fileName = os.path.join(dir,objName) + ‘.txt'
          an = obj
          while (an != None and an.GetType() != Ansys.ACT.Automation.Mechanical.Analysis): an = an.Parent
          if an != None:    # found analysis
              reader = an.GetResultsData()
              if not reader == None:
                  resultPoints = reader.ListTimeFreq
                  if an.AnalysisType in freqTypes:
                      freqDomain = True
                      if an.AnalysisType == AnalysisType.Harmonic:
                          resultPoints = [resultPoints[i] for i in range(0,len(resultPoints),2)]
                      #if reader.HasImaginaryResults:    # may be needed to check for duplicate frequency points in modal analysis and skip imaginary results
                      unitP = obj.Frequency.Unit
                  else:
                      freqDomain = False
                      unitP = obj.DisplayTime.Unit
                  resultSetNum = len(resultPoints)
                  with Transaction():    # halt display update
                      initial = 1
                      nodeValues = {}
                      for p in resultPoints:
                          if freqDomain:
                              obj.Frequency = Quantity(p,unitP)
                          else:
                              obj.DisplayTime = Quantity(p,unitP)
                          an.Solution.EvaluateAllResults()
                          data = obj.PlotData
                          if initial == 1:
                              initial = 0
                              unitR = obj.Maximum.Unit
                              file = open(fileName,’w’)
                              file.write(‘Node Number’ + ‘\t’)
                              nodes = data[‘Node’]
                          file.write(objName + ‘ ‘ + unitR + ‘ at ‘ + str(p) + ‘ ‘ + unitP + ‘\t’)
                          nodeValues[p] = []
                          for n in range(0,data[‘Values’].Count):
                              nodeValues[p].append(data[‘Values’][n])

                      file.write(‘\n’)
                      i = 0
                      for node in nodes:
                          file.write(str(node) + ‘\t’)
                          for p in resultPoints:
                              file.write(str(nodeValues[p][i]) + ‘\t’)
                          file.write(‘\n’)
                          i += 1
                      file.close()

       

       

    • Hreetabh Kishore
      Subscriber

      ok thanks Sir. Let me do this.

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