GithubHelp home page GithubHelp logo

Comments (3)

HelgeGehring avatar HelgeGehring commented on August 16, 2024

Looks like a great start @Kunyuan-LI !

Three quick things on the first look:

  • I'd not unfreeze the mode (it's normalized to power=1), but include the factors for the normalization directly in the calculation, i.e. just divide the calculated number by the three normalization factors. There's so many ways to normalize a mode, it might be hard to store all of them πŸ€”
    If we see in the end that we need them more often, we could add it as a cached_property to the mode object πŸ€”
    what do you think?

  • About the integrals:

@Functional
def E2(w):
   return (w["E"][0] * np.conj(w["E"][0]))

I'm actually a bit confused that this doesn't fail πŸ˜… E[0] should be a 2d vector field. I'd guess what you want to do here is

@Functional
def E2(w):
   return dot(w["E"][0],np.conj(w["E"][0]))

to get the scalar product of the E.

But this also confuses me a bit - the integral you posted in the end doesn't seem to have any vectors inside but uses scalars.
Do we just need there to use the dominant component? (i.e. ['E'][0][0 or 1])
Do you know how that integral is derived?

  • As long as you use complex epsilons the E-fields' phases will also be complex with a random global phase. While this is nothing to worry about and it can just be ignored, there's no reason for this example to go to complex epsilons.
    Just use
epsilon_p = basis0.zeros()
epsilon_s = basis0.zeros()
epsilon_i = basis0.zeros()

and you'll get real fields. While this can still give a random sign to the integral (as the sign of the eigenmode is not defined), we'll get something real :)

Could you make a PR out of this like @elizaleung830 ? That's easiest to discuss/test/improve and in the end we would also get a nice extra example :)

from femwell.

Kunyuan-LI avatar Kunyuan-LI commented on August 16, 2024

Thank you for your answer!

Indeed, the mistake about the normalization of E is quite obviousπŸ˜…. However, maybe getting it right could be helpful for the subsequent calculations?πŸ˜‚

In the numerical integration of finite elements, for normalization, what we actually consider is the sum of the

$$ E(x,y) \cdot E^*(x,y) $$

calculated separately on each element of the basis. Considering $u_v(x,y)$ where $v=p,s,i$ represents our normalized electric field distribution on the xy-plane, I believe the method of calculation for

$${\iint u_p(x, y) u_p(x, y) u_s^*(x, y) u_i^*(x, y)\, dx\,dy}$$

needs to be modified as well because $u_v(x,y)$ is just a normalized $E(x,y)$ and the product inside should be a three-time dot, then function.assemble?πŸ˜‚

And for the complex epsilons, yes I think you are right. As we just concern about the effective refractive index $n_{eff}$, which is the real part given by femwell for TE and TM modes, so no need to use complex epsilons.

For the PR sure I'll make it ASAP.πŸ˜„

from femwell.

Kunyuan-LI avatar Kunyuan-LI commented on August 16, 2024

Hello,

I've just made a PR, you can now critique my coding.πŸ˜‚
And for the overlap in SFWM, in this case $E(x,y)$ and $u_v(x,y)$ have a shape of (2318, 3).
So do you have a good idea to multiply them then intergrate them in the xy-plane?πŸ€”

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.