Skip to content

Commit

Permalink
Correcting the scaling for discrete power calculations, so that it no…
Browse files Browse the repository at this point in the history
…w returns field values in V/m. These values will need to be scaled by the transmitting element area for use. Also updated the export functions for antenna structures class.
  • Loading branch information
LyceanEM committed Jun 14, 2024
1 parent ddc2ae0 commit 2374ead
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions lyceanem/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def export_points(self, point_index=None):
point_data_element = np.array(self.points[item].point_data[key])
point_data[key] = np.append(point_data[key], point_data_element, axis=0)

combinded_points = meshio.Mesh(points, cells = [], point_data=point_data)
combinded_points = meshio.Mesh(points, cells = [("vertex", np.array([[i, ] for i in range(points.shape[0])]))], point_data=point_data)
combinded_points = GF.mesh_transform(combinded_points, self.pose, False)
return combinded_points

Expand Down Expand Up @@ -466,14 +466,12 @@ def structure_cells(array):

for item in triangle_meshes:
if item is not None:
new_mesh = pv.PolyData(item.points, structure_cells(item.cells[0].data))
# need to transfer across the point data and cell data
structure_meshes.append(new_mesh)
new_mesh = pv.utilities.from_meshio(item)

point_sets = [self.export_all_points()]
for item in point_sets:
if item is not None:
new_points = pv.PolyData(item.points)
new_points = pv.utilities.from_meshio(item)
aperture_meshes.append(new_points)

return aperture_meshes, structure_meshes
Expand Down
Empty file added lyceanem/utility/__init__.py
Empty file.
10 changes: 5 additions & 5 deletions lyceanem/utility/math_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def discrete_transmit_power(weights,element_area,transmit_power=100.0,impedance=
-------
"""
#to start with assume area per element is consistent
#Calculate the Power at each mesh point from the Intensity at each point
power_at_point=np.linalg.norm(weights,axis=1).reshape(-1,1)*element_area.reshape(-1,1) # calculate power
#integrate power over aperture and normalise to desired power for whole aperture
power_normalisation=transmit_power/np.sum(power_at_point)
transmit_power_density=(power_at_point*power_normalisation)/element_area.reshape(-1,1)
#calculate amplitude density
transmit_amplitude_density=(transmit_power_density*impedance)**0.5
transmit_excitation=transmit_amplitude_density.reshape(-1,1)*element_area.reshape(-1,1)*(weights/np.linalg.norm(weights,axis=1).reshape(-1,1))
return transmit_excitation
#calculate amplitude (V/m)
transmit_amplitude=((transmit_power_density*impedance)**0.5)*(weights/np.linalg.norm(weights,axis=1).reshape(-1,1))
#transmit_excitation=transmit_amplitude_density.reshape(-1,1)*element_area.reshape(-1,1)
return transmit_amplitude

@guvectorize(
[(float32[:], float32[:], float32[:], float32)],
Expand Down

0 comments on commit 2374ead

Please sign in to comment.