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

Capillary waveguide help #116

Closed
timothyara opened this issue Jan 2, 2024 · 14 comments
Closed

Capillary waveguide help #116

timothyara opened this issue Jan 2, 2024 · 14 comments

Comments

@timothyara
Copy link

Hello,
I'm new to femwell and I was wondering if there's a particular example that I could use to compute the supported modes in an air filled capillary waveguide with a fused silica cladding. The internal diameter of the capillary is 700 microns and outer diameter is 850 micron. I appreciate any help!

-Timothy

@HelgeGehring
Copy link
Owner

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?

@timothyara
Copy link
Author

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

@HelgeGehring
Copy link
Owner

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

@timothyara
Copy link
Author

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

@HelgeGehring
Copy link
Owner

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? :)

@timothyara
Copy link
Author

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

@timothyara
Copy link
Author

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.

@simbilod
Copy link
Contributor

simbilod commented Jan 6, 2024

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

@timothyara
Copy link
Author

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.

@timothyara
Copy link
Author

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

@simbilod
Copy link
Contributor

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

@simbilod
Copy link
Contributor

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

fastapi/typer#371

@timothyara
Copy link
Author

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

@simbilod
Copy link
Contributor

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

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

No branches or pull requests

3 participants