Skip to content
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

Gradient Magnitude too large #2155

Open
dmarek-flex opened this issue Jan 10, 2025 · 0 comments
Open

Gradient Magnitude too large #2155

dmarek-flex opened this issue Jan 10, 2025 · 0 comments
Assignees

Comments

@dmarek-flex
Copy link
Contributor

I have been having trouble running optimizations when simulations contain PEC structures. The returned value for the gradient is much too large.

Simulation Setup
The attached notebook demonstrates the issue where the simulation is a planewave source incident on a thin rectangular PEC patch. The objective function is simply maximizing the total flux through a field monitor

image

The patch is parameterized by its width and should have some kind of effect on flux, but not as large as the gradient returned by autograd plugin, where at the second iteration it is ~1e16.

image

Other information
Here's the notebook that demonstrates the issue.
pec_grad_issue.zip

I tried modifying the functions in derivative_utils.py following advice from @tylerflex.

def delta_eps(self, spatial_coords: np.ndarray) -> complex | np.ndarray:
    """Change in the permittivity across interface (for E field grads)."""
    return 0.0 

def delta_eps_inv(self, spatial_coords: np.ndarray) -> complex | np.ndarray:
    """Change in 1 / permittivity across interface (for D field grads)."""
    return -1.0 / self._eps_out(spatial_coords)

However, still did not get reasonable results.

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

No branches or pull requests

3 participants