Re: [Meep-discuss] [Meep discuss] Get the maximum value and another question

2008-10-30 Thread Yan Liu
Dr. Steven and Ian Buss, Thanks for your explaination on the second
question!
I am sorry to mispresent my need. What I meant to do in my first question is
: How can I get the peak value of the sinusoidal E-field in each unit (The
cell), under CW source.

2008/10/30 Steven G. Johnson [EMAIL PROTECTED]

 On Oct 29, 2008, at 2:15 AM, Yan Liu wrote:
  1) How can I get the maximum value of E-field of CW source

 Analytically, it is impossible in general because it depends on the
 geometry.  (This is a FAQ.)

 Numerically, obviously you can just output the field and take the
 maximum.  You can also use the built-in max-abs-field-function routine
 (see the reference manual) to compute the maximum of any arbitrary
 function of the fields.

  2) When I run the time step to 2000, I only want to get the output
  of 1800-2000. How to deal with it?

 Use after-time.  For example:

 (run-until 2000 (after-time 1800 output-efield))


 ___
 meep-discuss mailing list
 meep-discuss@ab-initio.mit.edu
 http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss




-- 
Thanks!
Yan Liu
Department of Biomedical Engineering, Huazhong University of Science and
Technology

Phone: (86)-130-7129-6471
Personal Website: sites.google.com/site/yanliurf
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] [Meep discuss] Get the maximum value and another question

2008-10-30 Thread Steven G. Johnson
On Oct 30, 2008, at 5:58 AM, Yan Liu wrote:
 Dr. Steven and Ian Buss, Thanks for your explaination on the second  
 question!
 I am sorry to mispresent my need. What I meant to do in my first  
 question is : How can I get the peak value of the sinusoidal E-field  
 in each unit (The cell), under CW source.

I'm still not sure I understand your question.

You have the electric field E(x,t) as a function of time (t) and space  
(x) during the simulation.   If I understand you correctly, you are  
asking for the maximum |E(x,t)| over all times t for a fixed position  
x.  Right?

If so, I would just recommend the obvious approach of outputting  
E(x,t) as a function of time and taking the maximum.  You can do this  
by outputting to a file, or you can write a step function that calls  
get-field-pt at each time step and keeps track of the maximum magnitude.

Steven

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


[Meep-discuss] [Meep discuss] Get the maximum value and another question

2008-10-29 Thread Ian Buss
Hi,

 1) How can I get the maximum value of E-field of CW source

I guess the easiest way is to output efield-X to an hdf5 file and then  
import it into Matlab (using h5read) or Python (using the 'tables' and  
'scipy' modules for example) and do max(array) (in Matlab) where array  
is the name you gave the data on import.  Alternatively, make a  
definition to call on each time step in Scheme which does the same  
thing during your simulation (see 
http://ab-initio.mit.edu/wiki/index.php/Meep_Reference#Writing_your_own_step_functions)
 
.  This might be simpler in the long run.  Check out the Meep  
reference though as there might be something that already does this  
that I have missed.

 2) When I run the time step to 2000, I only want to get the output of
 1800-2000. How to deal with it?

This is actually covered in the Meep tutorial in the Modes of a Ring  
Resonator example 
(http://ab-initio.mit.edu/wiki/index.php/Meep_Tutorial#Modes_of_a_ring_resonator
 
).  You just need two run-until loops, e.g:

(run-until time1)
(run-until time2
(at-every blah blah blah...output-efield-X))

where time1 and time2 are 1800 and 200 iterations in your time units  
which is determined by your resolution and characteristic lengthscale  
(if your resolution is 20 say 1 iteration is 0.025 time units, so  
time1 would be 45).

Another option is to enclose your step function in the (after- 
time ... ) enclosure (documented here: 
http://ab-initio.mit.edu/wiki/index.php/Meep_Reference#Controlling_when_a_step_function_executes)
 
.  Both methods will give you the same thing I believe.

Regards,

Ian


 Thanks!
 -- next part --
 An HTML attachment was scrubbed...
 URL: 
 http://ab-initio.mit.edu/pipermail/meep-discuss/attachments/20081029/40a17c01/attachment-0001.htm

 --

 ___
 meep-discuss mailing list
 meep-discuss@ab-initio.mit.edu
 http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

 End of meep-discuss Digest, Vol 32, Issue 19
 

---
Research PhD Student
Photonics Group
Dept. of Electrical  Electrical Engineering
University of Bristol
Rm 2.11, Queen's Building
University Walk
Bristol
BS8 1TR

email: [EMAIL PROTECTED]




___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss