Open demisjohn opened 8 years ago
Figured out a way:
When a slice's material is set, for example to Si3N4 in the matDB:
app.subnodes[1].subnodes[1].slices[2].layers[2].setMAT(Si3N4)
If the app.defaultlambda
is set to the wavelength of interest, then when you convert that slice into a simple RIX-type material, like so:
app.subnodes[1].subnodes[1].slices[2].layers[2].setMAT()
FimmWave sets the slice's refractive index, which can be retrieved as so:
app.subnodes[1].subnodes[1].slices[2].layers[2].nr11
>>> 2.1076151
You can then set the material back to it's original.
Works in the GUI - not sure if it works in the command-line
Looks like this doesn't work in the Command-Line - for some reason, changing the wavelength (either global or molab params for the WG) does Not result in the RIX (nr11
) being updated when you switch the layer back to RIX-mode.
From Vincent Brulis: No command line version of the Materials Inspector.
If you want the refractive index one work around is to create a uniform waveguide containing the material and using the 3D Effective Index Solver to calculate the fundamental mode. If you set up the boundaries to give you a flat profile (a plane wave) then the effective index of the mode will be the refractive index. This also works for attenuation using the complex version of the solver; alpha will be given by modeLossEV.
Jared Bauters' method:
Jared's Material.get_n( )
function only worked for custom materials in the pyFIMM MatDB (by Including your own MatDB with your own material models in it), and also having a python module/function for that same material.
So FimmWave gets the refractive index from the MatBD, while pyfimm/Python gets the RIx from the python function. It is up to the user to make sure that the MatDB/pyFIMM models match.
Since we already have a refractive-index module, adding these same materials to a custom matDB may not be too difficult.
I would only spend the time to code this up _IF_ WG.polish()
(actually WG.calc(polish=True)
) is significantly faster than rebuilding the WG with a new index & doing a fresh WG.calc()
. This remains to be determined.
For materials created with Material DB (not constant index), refractive index info should be returned when needed, acquired from FimmWave.
from Eric S: my old code used the function get_n() like this "Si.get_n()". Now this function does not exist in the Material class and I can't seem to find how this would actually be implemented with the Fimmwave command line. This Material.get_n() function should just return the index of the material that is initialized with a string of the material from the material database. I'm not really sure how to do this in Fimmwave besides using the Materials Inspector tool, but that seems to only generate a plot of the indices over a given wavelength range rather than return one index for the set wavelength.