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

Mesh suitable to model skin depth in metals #91

Closed
fedeinthemix opened this issue Nov 29, 2024 · 7 comments · Fixed by #98
Closed

Mesh suitable to model skin depth in metals #91

fedeinthemix opened this issue Nov 29, 2024 · 7 comments · Fixed by #98

Comments

@fedeinthemix
Copy link

I'm trying to use meshwell to model passive mmW IC components. It's common to use thick metals (ca. 3um) at frequencies where the skin depth is a fraction of a um (0.2um -- 0.5um). For this reason I'm trying to have smaller elements close to the surfaces of a prism and larger ones in the bulk of the metal. I've tried using the new ThresholdField applied to surfaces, but they only apply to the polygon surface before extrusion.

image

Is this possible? If yes, do you have an example?

@simbilod
Copy link
Owner

simbilod commented Nov 29, 2024

Yes a threshold field applied to the surfaces should do. I have done that exact thing before.

I don't have access to a computer to make an example right now, can you share your full code? I can maybe take a look

EDIT: looking at the picture you attached this could simply be a matter of choosing different dist max, size min, and size max

@fedeinthemix
Copy link
Author

fedeinthemix commented Nov 29, 2024

Thanks for the quick reply! Here the code:

import shapely
import gdsfactory as gf
from meshwell.model import Model
from meshwell.prism import Prism
from meshwell.resolution import ThresholdField, ConstantInField

polygon_hull = shapely.Polygon(
    [[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]],
)

polygon = polygon_hull
buffers = {0.0: 0.0, 3.0: 0.0}

model = Model()
poly3D = Prism(
    polygons=polygon,
    buffers=buffers,
    model=model,
    physical_name="my_prism1",
    resolutions=[
        ThresholdField(sizemin=0.1, distmax=3, sizemax=2.0, apply_to="surfaces"),
    ],
)

entities_list = [poly3D]

mesh = model.mesh(
    entities_list=entities_list,
    filename="prism.msh",
)

The prism is supposed to represent a short piece of a metal track (just for experimenting) and I'd like to have fine meshes on all surfaces.

@simbilod
Copy link
Owner

simbilod commented Dec 1, 2024

Ok I was able to take a look. I can get the behaviour you want like so:

import shapely
from meshwell.model import Model
from meshwell.prism import Prism
from meshwell.resolution import ThresholdField, ConstantInField, ExponentialField

polygon_hull = shapely.Polygon(
    [[0, 0], [20, 0], [20, 20], [0, 20], [0, 0]],
)

polygon = polygon_hull
buffers = {0.0: 0.0, 20.0: 0.0}

model = Model()
poly3D = Prism(
    polygons=polygon,
    buffers=buffers,
    model=model,
    physical_name="my_prism1",
    resolutions=[
        ThresholdField(sizemin=0.5, distmax=2, sizemax=2, apply_to="surfaces"),
        # ExponentialField(sizemin=0.5, lengthscale=1, growth_factor=2, apply_to="surfaces")
    ],
    mesh_order=1
)

buffers2 = {-1000.0: 0.0, 1000.0: 0.0}
poly3D_2 = Prism(
    polygons=polygon.buffer(10),
    buffers=buffers2,
    model=model,
    physical_name="background",
    mesh_bool=False,
    mesh_order=2
)

entities_list = [poly3D, poly3D_2]

mesh = model.mesh(
    entities_list=entities_list,
    filename="prism.msh",
    default_characteristic_length=100,
)

image

You can also achieve similar with the exponential field:

image

Couple things:

1 - Playing with the Prism dimensions and the resolutions can make this more apparent (in your original example, sizemax and distmax were both 2-3 and the box was around 3 units large so there is not a lot of room to taper)

2 - There is a legitimate issue I have never encountered before because I never set resolutions on surfaces at the "edge" of my simulations (I always let the default mesh there, since I never expect boundaries to affect the physics I am solving for). As you can see, it can be hacked by embedding the Prism inside another, larger Prism with lower mesh order that we don't mesh. This turns the surfaces to entity-entity interfaces instead of entity-"None" interfaces which are handled differently.

I will make a new issue with a note to this specific bug for better handling of boundaries.

@fedeinthemix
Copy link
Author

Thank you very much for the example and your explanations!

In my example I had a single prism just to get familiar with the library, but let me give a couple of examples of what I'd like to mesh and simulate, so that, if you want, you may take these scenarios into account in future developments

  • spiral inductors and transformers: these are implemented by making a spirally shaped metal track, usually using the top thick metals. The losses are in large part due resistance which, at high freuqencies, is affected by the skin effect. The metal is embedded in a dielectric, on top of the Silicon (or other semiconductor) substrate. In this case, the metal surface isn't at the "edge" of the geometry, but it's still necessary to have a fine mesh on all surfaces.

  • Microstrip lines: In this case you have a bottom "ground" metal plane, a dielectric on top of it, and on top of the dielectric, a strip of metal. Again, the losses are mostly due to resistance in the metals. The largest part is due to the strip which is narrower than the plane, but the return current flows in the plane which does contribute to the overall losses. In this case the metal "ground" plane is at the edge of the geometry, and, for accurately simulaitng the losses, the skin effect has to be considered.

Thanks again!

@simbilod
Copy link
Owner

simbilod commented Dec 1, 2024

This is great to consider, thank you!

Beyond fixing the boundaries, I feel that modeling skin effect as you are describing might require a different mesh on the metal side vs dielectric side -- am I correct? It should be doable to add an "inside/outside" attribute or to modify the "sharing" attribute to allow a ResolutionSpec to be selectively applied inside vs outside a metal. This could allow different tapering of the resolution inside vs outside the metal. Should I make a new feature issue with this to take a look sometime soon?

@fedeinthemix
Copy link
Author

That would be great!

The fields variation outside of the metal is definitely different from the one inside.

@simbilod
Copy link
Owner

simbilod commented Dec 8, 2024

should be fixed now on main, will make a new release soon!

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 a pull request may close this issue.

2 participants