Actually this also solved 2), because now I made a loop, that creates a bunch of sources that are stored in a list. When initializing the source I take into account the time retardation as an argument and simply subtract it from the variable t in heidler_fct!
Concerning 1), I think my thoughts were not so wrong. Either I decide for the spacial unit (e.g. 1000m), then one meep time unit t equals some value in microseconds or a fix the meep time unit t (e.g. 1 microsecond) then 1a = 300m, for example.
Thanks! Now my lightning return stroke already radiates nicely something that was expected ;)
Cheers
Gesendet: Mittwoch, 27. Juni 2018 um 22:06 Uhr
Von: "Hannes KOHLMANN" <hannes.kohlm...@gmx.at>
An: "Christopher Hogan" <ho...@simpetus.com>
Betreff: Re: [Meep-discuss] Meep Units and custom sources
Von: "Hannes KOHLMANN" <hannes.kohlm...@gmx.at>
An: "Christopher Hogan" <ho...@simpetus.com>
Betreff: Re: [Meep-discuss] Meep Units and custom sources
Her Chris,
thanks, the wrapper solution does the job ;)
Hannes
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
thanks, the wrapper solution does the job ;)
Hannes
Am 27. Juni 2018 17:30:56 MESZ schrieb Christopher Hogan <ho...@simpetus.com>:
Hi Hannes,Regarding question 3, you could try something like this:def heidler_wrapper(T1, T2, n):def heidler_fct(t):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 0return heidler_fctThen, create your CustomSource like this:mp.CustomSource(heidler_wrapper(x, y, z), start_time = ...)This evaluates heidler_wrapper and returns heidler_fct with T1=x, T2=y, and n=z.Unfortunately I can't help with the other 2 questions.ChrisOn Tue, Jun 26, 2018 at 12:08 PM, Hannes Kohlmann <hannes.kohlm...@gmx.at> wrote: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 0sources = [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
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
_______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss