Skip to content

Commit

Permalink
Changes to lossy propagation to reflect the need for area normalisati…
Browse files Browse the repository at this point in the history
…on based on relative angle between the incoming wave and the surface normal. Also removed the dot product between the transmitting point normal and the wave direction as duplicating the effects of the source launch transform function.
  • Loading branch information
LyceanEM committed Nov 26, 2024
1 parent 9560765 commit 15546b4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lyceanem/electromagnetics/beamforming.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ def MaximumDirectivityMap(
)
WS_weights = WavefrontWeights(source_points, steering_vector, wavelength)
EGC_weights = EGCWeights(
Etheta, Ephi, command_angles, az_range=az_range, elev_range=elev_range
Etheta.astype(np.complex64), Ephi.astype(np.complex64), command_angles, az_range=az_range, elev_range=elev_range
)
EGC_weights2 = EGCWeights(
Etheta,
Ephi,
Etheta.astype(np.complex64),
Ephi.astype(np.complex64),
command_angles,
az_range=az_range,
elev_range=elev_range,
Expand Down
8 changes: 4 additions & 4 deletions lyceanem/electromagnetics/empropagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def clip(a, a_min, a_max):

@cuda.jit(device=True)
def lossy_propagation(point1, point2, alpha, beta):
# calculate loss using improved Rayliegh-Summerfeld
# calculate loss using improved Rayleigh-Summerfeld
length = cuda.local.array(shape=(1), dtype=np.float32)
length[0] = calc_sep(point1, point2, length[0])
outgoing_dir = cuda.local.array(shape=(3), dtype=np.float32)
Expand All @@ -779,9 +779,9 @@ def lossy_propagation(point1, point2, alpha, beta):
)

normal = cuda.local.array(shape=(3), dtype=np.float32)
normal[0] = point1["nx"]
normal[1] = point1["ny"]
normal[2] = point1["nz"]
normal[0] = point2["nx"]
normal[1] = point2["ny"]
normal[2] = point2["nz"]
projection_dot = dot_vec(outgoing_dir, normal)
front = -(1 / (2 * cmath.pi))
s=2.5
Expand Down
21 changes: 16 additions & 5 deletions lyceanem/utility/mesh_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def pyvista_to_meshio(polydata_object):
return meshio_object

def id_cells(faces):
import copy
#temp_faces=copy.deepcopy(faces)
import numpy as np
cell_types ={1 :"vertex",
2 :"line",
Expand All @@ -30,11 +32,20 @@ def id_cells(faces):
"quad" :[]
}

while (faces.shape[0 ]>=1):
trim_num =faces[0]
temp_array =faces[1:trim_num +1]
cells[cell_types[trim_num]].append(temp_array.tolist())
faces =np.delete(faces ,np.arange(0 ,trim_num +1))
moving_index=0
while moving_index<=faces.shape[0]-1:
face_num=faces[moving_index]
temp_array=faces[moving_index+1:moving_index+face_num+1]
cells[cell_types[face_num]].append(temp_array.tolist())
moving_index+=face_num+1

# while (temp_faces.shape[0]>=1):
# trim_num =temp_faces[0]
# if trim_num>3:
# print("Cell Face Error")
# temp_array =temp_faces[1:trim_num +1]
# cells[cell_types[trim_num]].append(temp_array.tolist())
# temp_faces =np.delete(temp_faces ,np.arange(0 ,trim_num +1))

meshio_cells =[]
for key in cells:
Expand Down

0 comments on commit 15546b4

Please sign in to comment.