GithubHelp home page GithubHelp logo

Comments (14)

timothyara avatar timothyara commented on August 16, 2024 2

Thanks @simbilod. I got it to work after updating the interpreter in Jupyter notebooks to python 3.11.

from femwell.

simbilod avatar simbilod commented on August 16, 2024 1

Hi @timothyara ,

I was able to get your geometry to work. I made a PR on your repo.

Couple things:

  1. You don't need to scale your dimensions and wavelength, you can use the numbers as they are and choose appropriate characteristic_lengths and resolutions
  2. I quickly found modes confined to the silica cladding with low resolution, meaning it works -- but to make sure the result is physical, you should increase the resolution until the result stabilizes. Higher resolution will mean longer computation times and memory errors if you go too high for your machine. ***
  3. (Bonus) For circular geometries, we can actually do slightly better than polygons by directly using GMSH disks

*** Note that here this might be tricky. Since your wavelength is so small and your guiding structure so large, there are a large number of modes with an effective index almost exactly equal to the cladding index. So we cannot just use the effective index as a measure of convergence, and the eigensolver may or may not reliably return the eigenvectors in the same order as we change the matrix (number of nodes in the geometry).

image

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

Hey Timothy,

it seems to me that you'd just need to adjust the geometry in https://helgegehring.github.io/femwell/photonics/examples/waveguide_modes.html
you can define circles using

shapely.Point(0,0).buffer(1, resolution=6)

where you can adjust resultuion to have more/less points.

Would you have a paper we could reproduce in the docs?

from femwell.

timothyara avatar timothyara commented on August 16, 2024

I'm sorry but I'm not sure I understand what you mean by 'paper'. Could you please clarify.

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

Some peer-reviewed publication in a journal which deals with a structure similar to the one you want to simulate.

from femwell.

timothyara avatar timothyara commented on August 16, 2024

No, that's the issue. I can't find any scientific papers that use this precise fiber. I have included the data sheet for the glass tube. I am hoping that by modeling this in python I can learn the launch conditions of a He-Ne laser beam into the capillary in order to obtain a gaussian like mode.

1068150029.pdf

from femwell.

HelgeGehring avatar HelgeGehring commented on August 16, 2024

I didn't mean the exact fiber, but just a similar one as a starting point. https://doi.org/10.3390/s20041191 seems for example to be something similar like you're working on? Easiest is usually to start by reproducing something (even through it's a different geometry) and then adjust the numbers to your case.

I'd guess if you create three circles, the inner one, the outer one and an even larger one (to represent the air around the fiber) the geometry should be set up.
You'll need to set the characteristic_lengthscale/resolutions larger for the meshing to not overshoot with elements (should be fine as the solution should vary quite slowly)

Maybe just start and if you run into problems you can post your code here? :)

from femwell.

timothyara avatar timothyara commented on August 16, 2024

Thanks! I will work on it and let you know if I have questions.

from femwell.

timothyara avatar timothyara commented on August 16, 2024

Here is a link to my code: https://github.com/timothyara/test_repo/blob/2c3fd3c20a49d231d4952b67a886c244abf3560b/Capillary_Fiber_calc.ipynb

I wasn't able to get the solution for the modes and I'm not sure why. When I ran compute_modes the computer was taking a really long and at some point I just interrupted the kernel. I made the buffer radius = 2 which represents the physical radius of the fiber of 350 microns. I then used this scaling and determined the wavelength to be .003617 for 633 nm. Not sure if this is the correct way of going about it so clarification on this would be nice. I appreciate your help.

from femwell.

timothyara avatar timothyara commented on August 16, 2024

Thank you @simbilod
I ran the updated code after doing a 'pip install meshwell' to try to replicate your results but I'm getting thrown the following Type error in the Prism class:

File ~/opt/anaconda3/lib/python3.8/site-packages/meshwell/prism.py:24, in Prism()
22 model: Any
23 physical_name: Optional[str] = Field(None)
---> 24 mesh_order: float | None = None
25 mesh_bool: bool = Field(True)
26 buffered_polygons: List[Tuple[float, Polygon]] = []

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

I didn't change anything with the code so I'm not sure why this is happening.

from femwell.

timothyara avatar timothyara commented on August 16, 2024

Can anyone help me understand why I'm receiving the Type error in the Prism class. I'm just trying to produce the same results as @simbilod but this error is preventing me from doing so. Here is the link to the code in my repository that displays the error: https://github.com/timothyara/test_repo/blob/710035f82d68d62b73d59cf3af9361f47f11764a/Capillary_Fiber_calc_updated.ipynb

from femwell.

simbilod avatar simbilod commented on August 16, 2024

what is your pydantic version? When you run pip show pydantic

from femwell.

simbilod avatar simbilod commented on August 16, 2024

Ah nevermind this seems like it's a python version error. Can you use Python 3.10+?

tiangolo/typer#371

from femwell.

simbilod avatar simbilod commented on August 16, 2024

Great! Closing for now, feel free to reach out again if anything else comes up :)

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.