python-meep team mailing list archive
-
python-meep team
-
Mailing list archive
-
Message #00060
Re: Material Properties
Hi, Karl,
I had some issues setting the electric conductivity and finally I
resolved it. I needed it for frequency-domain simulation of dispersive
materials. Basically you need to establish what value of conductivity
you need for a given complex epsilon on a given frequency, then define
a new callback class and let MEEP use that callback.
Below are the key excepts from the code. The full working example may
be downloaded from:
http://fzu.cz/~dominecf/130212_scripts_for_Karl.zip
You may launch the frequency-domain simulation using:
python rtsim.py simtime=1e-12 frequency=400e9
Now my metamaterial simulations in MEEP grew over 2000 lines of python
code in total, but I still hope they will be readable and useful. One
time I will sit and write a tutorial on the web...
BTW, I never made the conductivity working by setting meep.D_stuff.
Setting meep.E_stuff works, but the desired value has to be multiplied
by some phenomenologic constant which has no apparent meaning.
I also verified that the results obtained by time-domain simulations
with Lorentz-dispersive media and those obtained by running
frequency-domain simulation at multiple frequencies match pretty well
(+/- 5 % max). Now that code:
---
def permittivity2conductivity(complex_eps, freq):#{{{
magic_constant = 1.65e13 ## A. K. A. bulgarian constant...
return complex_eps.imag / complex_eps.real * 6.28 * freq / c *
8.85e-12 * magic_constant
class MyConductivity(meep.Callback):
def __init__(self, model, frequency):#{{{
meep.Callback.__init__(self)
self.model = model
self.frequency = frequency
def double_vec(self, r):
for material in self.model.materials:
if material.where(r):
return
permittivity2conductivity(analytic_eps(material, self.frequency),
self.frequency)
else: return 0
## Create callback to set conductivity (depends on material
polarizabilities and frequency)
mc = MyConductivity(model, frequency)
meep.set_COND_Callback(mc.__disown__())
s.set_conductivity(meep.E_stuff, meep.COND)
2013/2/11, Karl Edler <kte608@xxxxxxxxx>:
> Hello,
>
> On page http://ab-initio.mit.edu/wiki/index.php/Meep_Introduction I see
> both electric and magnetic conductivities sigmaD and sigmaB respectively.
> How do I set them in python-meep?
>
> Does calling set_COND_Callback set sigmaD?
>
> What do set_DBL1_Callback, set_DBL2_Callback, ..., set_DBL5_Callback do?
>
> Is there a place in the documentation that describes this? A table linking
> AMPL, CHI2, CHI3, CMPL1, CMPL2,CMPL3,CMPL4,CMPL5, COND, DBL1, DBL2, DBL3,
> DBL4, DBL5, EPS, MU, INIF, MU, and SIGMA to their definitions would be
> nice.
>
> Any help would be greatly appreciated,
> Karl Edler
>
References