Skip to content

Updates for fully anisotropic mode solver #2728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

momchil-flex
Copy link
Collaborator

@momchil-flex momchil-flex commented Aug 8, 2025

No description provided.

@momchil-flex momchil-flex marked this pull request as draft August 8, 2025 13:26
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 9 comments

Edit Code Review Bot Settings | Greptile

@@ -410,7 +419,7 @@ def conductivity_model_for_good_conductor(

elif not is_eps_complex:
eps_spec = "tensorial_real"
E, H, neff, keff = cls.solver_tensorial(**kwargs, direction="+")
E, H, neff, keff = cls.solver_tensorial(**kwargs, direction="+", col_mats=col_mats)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Missing col_mats parameter in the tensorial_complex case (line 429) - this could cause inconsistent behavior for complex anisotropic materials

Suggested change
E, H, neff, keff = cls.solver_tensorial(**kwargs, direction="+", col_mats=col_mats)
E, H, neff, keff = cls.solver_tensorial(**kwargs, direction=direction, col_mats=col_mats)

Comment on lines 1242 to 1244
# Angle to test
theta = np.pi / 180
theta = np.pi / 6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove commented code and hardcoded values. Consider parameterizing the angle or using a constant.

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

Comment on lines 1248 to 1249
sim_size = (10, 10, 10)
# sim_size = (4, 3, 3)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove commented sim_size definition.

Suggested change
sim_size = (10, 10, 10)
# sim_size = (4, 3, 3)
sim_size = (10, 10, 10)

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

Comment on lines 1268 to 1269
grid_spec=td.GridSpec.auto(wavelength=1.0, min_steps_per_wvl=10),
# grid_spec=td.GridSpec.uniform(dl=0.04),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove commented grid_spec alternatives.

Suggested change
grid_spec=td.GridSpec.auto(wavelength=1.0, min_steps_per_wvl=10),
# grid_spec=td.GridSpec.uniform(dl=0.04),
grid_spec=td.GridSpec.auto(wavelength=1.0, min_steps_per_wvl=10),

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

run_time=1e-12,
symmetry=(0, 0, -1),
sources=[src],
# medium=td.Medium(permittivity=4.5),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove commented medium parameter.

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

Comment on lines 1277 to 1280
# simulation = td.Simulation.from_file("/home/momchil/flexcompute/test_fdtd/lucas/FDTD_Setup_P1@0_v1.json")
# print(simulation.grid.num_cells)
# freq0 = simulation.sources[0].source_time.freq0
# plane = td.Box(center=simulation.monitors[1].center, size=simulation.monitors[1].size)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove commented debugging code with hardcoded file paths.

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

Comment on lines 1298 to 1310
import matplotlib.pyplot as plt

fig, ax = plt.subplots(1, 3)
simulation.plot(x=0, ax=ax[0])
simulation.plot(y=0, ax=ax[1])
simulation.plot(z=0, ax=ax[2])
plt.show()

# Plot the mode_index = 0 mode for both
_, ax = plt.subplots(1, 2)
ms.plot_field("E", mode_index=0, ax=ax[0], robust=False)
ms_angle.plot_field("E", mode_index=0, ax=ax[1], robust=False)
plt.show()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove matplotlib plotting and plt.show() calls. Tests should not display interactive plots or require user interaction.

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

Comment on lines 1312 to 1313
print(modes_zero.n_complex.values)
print(modes_angle.n_complex.values)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove print statements used for debugging.

Context Used: Rule - Remove temporary debugging code (print() calls), commented-out code, and other workarounds before finalizing a pull request. (link)

@momchil-flex momchil-flex force-pushed the momchil/mode_angle_symmetry branch from 34938d1 to 1f5ce51 Compare August 12, 2025 12:25
@momchil-flex momchil-flex changed the title Proper handling of fully anisotropic mode solver Updates for fully anisotropic mode solver Aug 12, 2025
direction,
dls,
Nxy=None,
dmin_pmc=None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff is mostly because of a bit of reorganizing, but nothing substantial is changing in this file except for passing dls, Nxy and dmin_pmc around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant