Skip to content

Unstructured mesh refinement regions #2306

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 35 commits into from

Conversation

momchil-flex
Copy link
Collaborator

No description provided.

@momchil-flex momchil-flex marked this pull request as draft March 12, 2025 08:26
vasilyzabelin and others added 16 commits March 13, 2025 08:06
Ref: https://github.com/numpy/numpy/blob/d741eb282dd15acc1f49fa660519c99680435e75/numpy/_core/numeric.py#L1664

For some reason, the warning is not shown in normal tidy3d runs, but if
we enable it around the function call with:

```python
import warnings
warnings.simplefilter("error")
```

it will show as an error. This affects PhotonForge because we don't
differentiate warnings from errors through the python C API, so having
this warning is preventing us from supporting numpy >= 2.

Signed-off-by: Lucas Heitzmann Gabrielli <lucas@flexcompute.com>
CHANGELOG.md Outdated
@@ -22,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Validation step that raises a `ValueError` when no frequency-domain monitors are present, preventing invalid adjoint runs.
- Metal surface roughness models: modified Hammerstad, Huray Snowball, and Cannonball-Huray.
- Support for Fermi-Dirac statistics in Charge solver. This option can be activated when defining the analysis type `IsothermalSteadyChargeDCAnalysis` with `fermi_dirac=True`. This option will provide more accurate results in simulations where very high doping may lead the pseudo-Fermi energy levels to approach either the conduction or the valence energy levels.
- Add refinement regions and refinement lines for the mesh generation for teh CHARGE solver.
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be used to Heat simulations so I would change the sentence to this:
Unstructured grids now support refinement regions (including 1D refinement lines in arbitrary directions)

)

r2: Coordinate = pd.Field(
(0.0, 0.0, 0.0),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make this a required input and not provide a default.

Comment on lines 218 to 229
refinement_regions: Tuple[GridRefinementRegion, ...] = pd.Field(
(),
title="Refinement regions",
description="List of regions for which the mesh refinement will be applied",
)

refinement_lines: Tuple[GridRefinementLine, ...] = pd.Field(
(),
title="Refinement lines",
description="List of lines for which the mesh refinement will be applied",
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I see this I'm thinking that maybe refinement_regions could accept both GridRefinementRegion and GridRefinementLine. Conceptually they're both refinement regions in a way.

Of course this implies updating the back-end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, could be a single argument refinements even.

Copy link
Contributor

Choose a reason for hiding this comment

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

there is also the option to reuse name override_structures from fdtd grid spec

Copy link
Contributor

Choose a reason for hiding this comment

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

that makes a lot of sense

@vasilyzabelin
Copy link
Contributor

There is a new branch for this PR: vasily/refinement_region_update

It should be merged into this PR

@momchil-flex momchil-flex marked this pull request as ready for review April 16, 2025 10:14
@vasilyzabelin
Copy link
Contributor

I have created a new clean PR with the mesh refinement structures:
#2398
It turned out easier that to clean the existing PR from unnecessary commits.

@momchil-flex
Copy link
Collaborator Author

closing in favor of #2398

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

Successfully merging this pull request may close these issues.