Bug fixes for plane wave

这个提交包含在:
Craig Warren
2025-03-12 11:40:07 +00:00
父节点 ff08f68733
当前提交 e6adc592ac
共有 3 个文件被更改,包括 10 次插入13 次删除

查看文件

@@ -974,7 +974,7 @@ class DiscretePlaneWave(UserObjectMulti):
self.order = 19
self.hash = "#discrete_plane_wave"
def create(self, grid, uip):
def build(self, grid, uip):
try:
theta = self.kwargs["theta"]
phi = self.kwargs["phi"]
@@ -1069,7 +1069,7 @@ class DiscretePlaneWave(UserObjectMulti):
DPW.calculate_waveform_values(grid)
logger.info(
f"{self.grid_name(grid)} Discrete Plane Wave within the TFSF Box "
f"{self.grid_name(grid)}Discrete Plane Wave within the TFSF Box "
+ f"spanning from {p1} m to {p2} m, incident in the direction "
+ f"theta {theta} degrees and phi {phi} degrees "
+ startstop
@@ -1088,12 +1088,11 @@ class DiscretePlaneWave(UserObjectMulti):
/ np.pi
)
logger.info(
f"Since {self.grid_name(grid)} Discrete Plane Wave has been discretized "
f"{self.grid_name(grid)}Discrete Plane Wave has been discretized "
+ "the angles have been approximated to the nearest rational angles "
+ "with some small tolerance levels. The chosen rational integers are "
+ f"[m_x, m_y, m_z] : {DPW.m[:3]}. The approximated angles are : \n"
+ "Approximated Phi : {:.3f}".format(phi_approx)
+ "\nApproximated Theta : {:.3f} .".format(theta_approx)
+ f"[m_x, m_y, m_z] : {DPW.m[:3]}. The approximated angles are: "
+ f"Phi: {phi_approx:.3f} and Theta: {theta_approx:.3f}"
)
grid.discreteplanewaves.append(DPW)

查看文件

@@ -275,12 +275,12 @@ def process_multicmds(multicmds):
scene_objects.append(plWave)
cmd = "#excitation_file"
if multicmds[cmd] is not None:
cmdname = "#excitation_file"
if multicmds[cmdname] is not None:
for cmdinstance in multicmds[cmdname]:
tmp = cmdinstance.split()
if len(tmp) not in [1, 3]:
logger.exception(f"{cmd} requires either one or three parameter(s)")
logger.exception(f"{cmdname} requires either one or three parameter(s)")
raise ValueError
if len(tmp) > 1:

查看文件

@@ -119,10 +119,8 @@ class CPUUpdates:
precompute = False,
)
if(self.grid.iteration % 10 == 0):
np.save('./snapshots/electric_z_{}.npy'.format(self.grid.iteration), self.grid.Ex)
# if(self.grid.iteration % 10 == 0):
# np.save('./snapshots/electric_z_{}.npy'.format(self.grid.iteration), self.grid.Ex)
def update_electric_a(self):
"""Updates electric field components."""