GithubHelp home page GithubHelp logo

Comments (9)

lodoreds avatar lodoreds commented on August 16, 2024 1

Sure, with pleasure! I can issue one in the next few days. Is it ok to make a function that returns the intensity?

For the overlap: nice!! Perhaps it could be noted in the fiber example that overlaps between arbitrary modes are supported. Maybe I can issue a request for that as well, since I need to implement it anyway πŸ‘

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024 1

Sounds great! I'd guess it should return a new basis (probably it's fine to just take the same element as used for E_z, that should have the polynominal order we need) and the values at the DOFs.

Great! Feel free to add it to the fiber example (maybe as a second way we could calculate the fiber modes?) or as a new example :)

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024 1

Either sounds fine to me :) Would even be great to have both :)
And lowering the accuracy for the example should be totally fine, the examples are not about perfect accuracy, but about showing fast how things work

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

Hi Lodovico,
thanks for the feedback!

You mean https://github.com/HelgeGehring/femwell/blob/main/femwell/maxwell/waveguide.py#L399 ?

It's the same grid for all components, it's just different basis-functions, which are used to defining the field within the cell.

The reason for dividing the E-vector in two subspaces is their different continuity requirements.
For the in-plane components: Over an edge where epsilon changes the component parallel to the interface is continuous while the normal component can change discontinuously. To consider this in the math, the NΓ©dΓ©lec-Element is employed as it allows these interface conditions.
For the out-of-plane component: It's just a scalar which needs to be continuous physics-wise, so it's resembled by a polynomial element.

For FD-based tools you don't have the possibility to enforce other continuities than linear between the nodes.
Usually you just refine it there at the interfaces a lot and live with the remaining error.

I'm trying to encapsulate all that in the Mode-class that the user doesn't have to deal with that :)
Would you need some additional integrals? Or see some other potential problems? Or is it just out of curiosity?

I'll add the "documentation"-tag as I'd guess we should expand the documentation on this point!

from femwell.

lodoreds avatar lodoreds commented on August 16, 2024

Thanks for the swift reply and for the detailed explanation!
I see now where that comes from. Say, however, I needed to manipulate the single components of a field.
If I follow your code in plot_mode to split the basis (https://github.com/HelgeGehring/femwell/blob/main/femwell/maxwell/waveguide.py#L399 first and https://github.com/HelgeGehring/femwell/blob/main/femwell/maxwell/waveguide.py#L418 then), I cannot perform element-wise operations between the in-plane and out-of-plane components, because the Ex and Ez have different length (and hence my question :D).
If the fields are sampled on the same grid, then it is just a matter of interpolation, which does not affect the plot. Along these lines, I was thinking that it may be convenient to have an easy way to interpolate the fields onto a new grid (maybe this topic needs another issue).
What do you think?

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

I'd guess you don't want to modify the values of the degrees of freedom (DOF) directly.
Usually, you first interpolate on the quadrature points (using basis.interpolate), modify the values and then project back on the basis.
The quadrature points are the points at which all calculations are done, the DOFs are more technical. Using these points you also have the same grid points for all components :)

What do you want to do? Usually I see the mode as something I don't really want to modify and just do calculations with (except if I do some perturbation stuff like phase shifters/... but there I'm not really interested in the new mode, just in the n_eff, so also no need to modify the mode)

from femwell.

lodoreds avatar lodoreds commented on August 16, 2024

Ok, I see, thanks for the clarification!

In general, I would always like to access the raw field data to inspect and compare the fields, as well as to calculate and plot the intensity. However, it would also be great to be able to overlap two modes not necessarily sampled on the same grid (e.g.: to calculate the power overlap in a butt-joint with different widths and/or waveguides), which is straightforward in FDE as long as the grid does not change, but which requires interpolation here.

From your reply above, I believe the butt-joint could also be solved with basis.interpolate similarly to what you did with the fiber in https://helgegehring.github.io/femwell/photonics/examples/fiber_overlap.html, where the Gaussian function is replaced by another mode. Have you already tried to overlap two modes instead of a mode and a function?

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

You can always access raw field data. In this case it's the values of the degrees of freedom. It's just not as direct as FDE, as you usually look at the values at the quadrature points (i.e. points within the triangle at which the values are calculated from the DOFs). This division in DOFs/quadrature points makes FEM a bit less intuitive than FDE, but it allows to way better resemble the physics :)

Hmm, for plotting the intensity I'd interpolate the field on the quadrature points, then calculate the intensity on those points. Probably we can then project the resulting intensity back on a Basis with ElementDG(ElementrP1()) to plot it (Linear interpolation, but can be discontinuous at interfaces) πŸ€”
I think we can add a method to Mode to get the intensities :) Would you want to start a pull request and I'll give feedback? Otherwise I can also give it a try :)

About the overlap: Mode.overlap already supports calculating the overlap with modes calculated on other meshes :)

from femwell.

lodoreds avatar lodoreds commented on August 16, 2024

The full overlap works great! I tested it on different waveguides with even different simulation domains, and so far so good πŸ‘ However, if I try to add a section to the fiber_overlap.py example, the program crashes on my computer due to the high accuracy used, so that I cannot check the output.
How would you recommend to proceed? Should I lower the mesh resolution in the fiber example a little, or should I upload another example with two waveguides (e.g.: Si to SiN butt-joint)?

from femwell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.