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 !!!
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.
Yes, at the moment that's the only way I found to do that.
Thank you again
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()
acoustic_sensor_extractor = simulation_extractor["Overall Field"]
field = acoustic_sensor_extractor.Outputs["Intensity"]
# 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
Thanks a lot !