Hello everyone,
I have three questions, where I got stuck so far with MEEP:
I want to simulate a lightning return stroke (a channel with many CustomSources at different heights, that become active one after the other to mimique a current propagation with speed of about 1/3*c_o to 1/2*c_0).
1) The first thing is that I am getting a little confused with the meep units, since it is written in the docs, that the time unit is chosen such that c=1 for speed of light in vacuum.
I struggle with the interpretation of this. Why? Because I keep looking at the sim.meep_time, which is used for printing the fields to h5 or calling step functions etc, and after the following interpretation c=1 doesn't make much sense to me.
So I defined a grid, lets say cell = Vector3(20,20,0) (for simplicity I will stay 2 dimensional first).
Then I said: meep length unit = 1km, so my grid is 20km long and 20km high.
This means that if I have no material specified, I have vacuum propagation speed v=c_0=3e8. Based on that, it would make sense to me that one meep_time unit equals 1000m/(3e8m/s)=3.3 microseconds ... is that correct? Or the other way round, I could define 1 meep_time equals 1microsecond, so my gris is 1us*3e8 = (20 x 20) * 300m = (6km x 6km)
I guess the c=1 is a more useful interpretation when I want to relate the frequency to the wavelength...
As already mentioned, I want to activate sources one after another, having something like:
def heidler_fct(t,T1=1, T2=0.1, n=2):
eta = m.exp((T1/T2)*(n*T2/T1)**(1/n))
if t > 0 and t < 1 :
return 1/eta*(t/T1)**n/((t/T1)**n+1)*m.exp(-t/T2)
return 0
sources = [mp.Source(mp.CustomSource(heidler_fct, start_time = i/3), component=mp.Ez, center=mp.Vector3(-7,src_y_start+i/10), size=mp.Vector3(0,0))]
for i in range(100):
sources.append(mp.Source(mp.CustomSource(heidler_fct, start_time = (i+1)/3), component=mp.Ez, center=mp.Vector3(-7,src_y_start+(i+1)/10), size=mp.Vector3(0,0)))
2) Now the problem I figured out was that Meep uses always the current sim.meep_time, which means that the later I start, the more my function has already declined. I could solve it by subtracting sim.meep_time() from t in the heidler_fct ... but how could I access the meep time in the CustomSource function just like in a step function, where this is the first parameter is the simulation instance sim?
3) I havent figured out yet how I could set the arguments T1, T2, and n in heidler_fct when defining the source... using something like lambda: heidler_fct(T1=x, T2=y, n=z) didn't work but this was just guessing, trying out and hoping that it would work.
I would be very glad, if you can help me with those three points.
Thank you very much in advance!
Cheers,
Hannes
(PS: should I - in the future - split up those questions into contextually separated mails (e.g. CustomSources and Meep Units, instead of squeezing all questions into one mail?)
_______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss