Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Analysis & Postprocessing
  4. How to extract point data?

How to extract point data?

Scheduled Pinned Locked Moved Analysis & Postprocessing
5 Posts 3 Posters 632 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Annalisa
    wrote on last edited by
    #1

    Hi,
    I would need to know if it is possible to automatically (or via Python) extract point data, giving the point coordinates, once the acoustic simulation has run.
    Or I have to set a point sensor in each point of interest before running the simulation?
    Specially, I would need to extract the acoustic intensity value in specific points.
    So far I extracted the profile along an axis and then I manually took the value using the cursor, a very awkward way !!!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Ender
      wrote on last edited by
      #2

      I'm no expert but I would try creating point sensors at the locations of interest before running the simulation, then once the simulation is complete you should be able to extract the data from each of the point sensors.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Annalisa
        wrote on last edited by
        #3

        Thanks Ender.
        Yes, at the moment that's the only way I found to do that.
        Thank you again

        1 Reply Last reply
        0
        • M Offline
          M Offline
          montanaro
          wrote on last edited by
          #4

          Dear Annalisa,

          1. If you want the time domain data then you will need the point sensors which need to be set ahead of time.
          2. If you just want the Intensity values (steady state) and the coordinates then you can use python for that
          • out is 3D numpy array of intensity values
          • xaxis is coordinates is the coordinates of each x point in the out array
            -- Note that Values are stored at cell centers and the xaxis_nodes gives the coordinates for the cell nodes (not cell centers), xaxis is the just the midpoint
            -- Careful with axis units, they're probably in meters by default but not sure (maybe depends on s4l settings)
          import numpy as np
          import s4l_v1.analysis as analysis
          import s4l_v1.document as document
          import s4l_v1.model as model
          import s4l_v1.units as units
          from s4l_v1 import ReleaseVersion
          from s4l_v1 import Unit
          
          simulation = document.AllSimulations["Ac"]
          simulation_extractor = simulation.Results()
          simulation_extractor.Update()
          acoustic_sensor_extractor = simulation_extractor["Overall Field"]
          field = acoustic_sensor_extractor.Outputs["Intensity"]
          field.Update()
          # Get Field - 1D flat array
          out = field.Data.Field(0)
          # Get Axis
          dims = np.array(field.Data.Grid.Dimensions)
          if np.prod(dims) != len(out):
          	dims = dims-1
          # Reshape Field - 3D [x,y,z] array
          out = out.reshape(dims, order='F')
          
          # Coordinates of nodes 
          xaxis_nodes = field.Data.Grid.XAxis
          yaxis_nodes = field.Data.Grid.YAxis
          zaxis_nodes = field.Data.Grid.ZAxis
          
          # Coordinates of cell values
          xaxis = (xaxis_nodes[:-1] + xaxis_nodes[1:]) / 2
          yaxis = (yaxis_nodes[:-1] + yaxis_nodes[1:]) / 2
          zaxis = (zaxis_nodes[:-1] + zaxis_nodes[1:]) / 2
          
          1 Reply Last reply
          0
          • A Offline
            A Offline
            Annalisa
            wrote on last edited by
            #5

            Thanks a lot !

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Search