Re: [Meep-discuss] Instantaneous space-time-dependent absorbed power density in a lossy material

2021-08-29 Thread Ardavan Oskooi
To compute the time-dependent absorbed power density is straightforward: 
you would need to manually compute the dot product of the complex 
conjugate of E and dP/dt by using P=D-E. You can obtain the 
time-dependent E and D fields using the `get_array` function: 
https://meep.readthedocs.io/en/latest/Python_User_Interface/#array-slices. 
Note though that the fields obtained using `get_array` are interpolated 
to the center of each Yee grid voxel which means there will be some 
discretization error when computing this dot product. (This 
discretization can be reduced by increasing the grid resolution.) Also, 
you will need to be careful about the finite-difference approximation 
you use to compute the derivative dP/dt to ensure that all the 
quantities used to evaluate the dot product are at the same time instant.



On 8/29/21 07:23, Liang Chen wrote:


"I realize that MEEP can calculate the absorbed power density 
distribution (space-dependent) corresponding to each frequency 
component of a pulse. This is explained in the tutorial "absorbed 
power density map of a lossy cylinder." However, the problem I have on 
hand requires the space-time-dependent absorbed power density since 
the instantaneous absorption is expected to change the material 
properties, which will then affect the propagation of electromagnetic 
fields (i.e., it is nonlinear, and using Fourier transform after the 
simulation is not correct for this problem). If I could get the 
instantaneous absorption, I can add the feedback mechanism in the MEEP 
code."



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

Re: [Meep-discuss] Instantaneous space-time-dependent absorbed power density in a lossy material

2021-08-29 Thread Ardavan Oskooi


On 8/29/21 06:25, Liang Chen wrote:


Is it possible to calculate the instantaneous absorbed power density 
distribution in a lossy material in MEEP? For example, for a 
dispersive material under a pulse excitation, can MEEP calculate the 
absorbed power density distribution during the time iteration (rather 
than using the Fourier-transformed fields in the postprocessing step)?




Yes, see: 
https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#absorbed-power-density-map-of-a-lossy-cylinder.


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

Re: [Meep-discuss] Oblique incident plane wave on a periodic structure (following an old post)

2020-12-06 Thread Ardavan Oskooi
If you want to investigate the field profile, it is better to use a 
ContinuousSource rather than a GaussianSource and time step for a 
sufficiently long time until the fields have reached steady state. The 
advantage of this approach is that you can see what is happening at a 
single frequency (comparing e.g. evanescent and non-evanescent waves) 
rather than over some bandwidth which is difficult to interpret. Note 
that you can take a snapshot of the fields at the end of the run using 
the plot2D routine.


On 12/6/20 19:18, Mandy Xia wrote:
To simplify the problem, I tried to record the incident field only, 
without introducing the scatterer. Here are a few animations. In all 
three tests, I have a 3D simulation where the z direction has a 
periodic boundary condition and boundary layers in the x y directions 
and I show the y=center slice over time. In the first simulation, I 
have pml boundary layers and simulate a source that contains only 
frequencies with well defined mapped incident directions; the second 
simulation also has pml boundary layers but the source is defined such 
that it covers a larger range of frequencies and some small 
frequencies don't have well-defined incident angles; the third 
simulation has thick absorber boundary layers and the source is 
defined the same as in the second simulation. I observed that only in 
the first simulation the incident field looks like it is 
propagating in a fixed direction whereas the other two do not. I was 
wondering if this is what I should expect when there are evanescent 
waves and whether this could be the source of the error in my 
scattering tests.


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

Re: [Meep-discuss] Oblique incident plane wave on a periodic structure (following an old post)

2020-12-06 Thread Ardavan Oskooi
Note that PMLs become less effective for incident waves at large oblique 
angles. This effect is described in: 
https://meep.readthedocs.io/en/latest/FAQ/#why-are-the-fields-not-being-absorbed-by-the-pml. 
Rather than increase the PML thickness as you seem to be doing, a better 
solution is to replace the PML with an Absorber.


On 12/6/20 08:16, Mandy Xia wrote:
incident angles, especially at the two ends of the frequency range 
(i.e. the largest frequency and the smallest frequency that has a well 
defined mapped incident angle). I tried to increase the resolution and 
pml thickness but they didn't help. I tried to construct the source 
with only frequencies that have well-defined mapped incident angles 
and the matching to the ground truth significantly improved (although 
at the small frequency end there is still a relatively large 
difference and I ran out of memory when increasing the resolution and 
couldn't make a conclusion if it was converging or not). I'm trying to 
figure out why this is the case and what is the impact on the 
simulation from the evanescent waves. I have a periodic boundary in 
the z direction and pml layers in the x and y directions. My source is


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

Re: [Meep-discuss] parallel meep hang

2020-12-02 Thread Ardavan Oskooi
This type of behavior is usually due to one of the MPI processes 
deadlocking due to a run function or similar that is called at the end 
of the time stepping in which a field routine 
 
(e.g., get_field_point, etc.) is called from within "if 
meep.am_master():". This issue is described in the Features/Parallel 
Meep/Technical Details 
 
in the paragraph starting with "Warning: Most Meep functions operating 
on the simulation...".


However, this doesn't seem to apply in your case.

On 12/2/20 19:13, Luke Durant wrote:
I have a very simple simulation (almost identical to the 
GaussianBeamSource example), but when I run with MPI (local node only, 
multi-core) it hangs before returning from 'sim.run(until=60)'.


The simulation appears to proceed correctly until the sim should be 
complete:

'
...
Meep progress: 45.56/60.0 = 75.9% done in 16.0s, 5.1s to go
on time step 4556 (time=45.56), 0.0034461 s/step
Meep progress: 57.18/60.0 = 95.3% done in 20.0s, 1.0s to go
on time step 5718 (time=57.18), 0.00344415 s/step
' [Hang forever].

It hangs with 2 threads or 32 threads (Ryzen 3990x CPU). Performance 
scales apparently correctly through the simulation otherwise (2 
threads is 2x serial; 32 again much faster).



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

Re: [Meep-discuss] RAM issues

2020-11-26 Thread Ardavan Oskooi
To improve memory usage in your simulations, try setting 
"split_chunks_evenly=False" in the Simulation constructor which should 
result in chunks that are better matched with the gold layers. You can 
use the visualize_chunks 
 
routine to compare the chunk layouts (equal vs. unequal). For details 
regarding the chunks framework used for paralell/MPI simulations, see 
Features/Parallel Meep 
 as well as 
Section 3 "Data-Driven Load Balancing" of https://arxiv.org/abs/2003.04287.


Finally, note that the memory management of the chunks for Lorentzian 
susceptibility materials (i.e., gold) is currently suboptimal: 
https://github.com/NanoComp/meep/issues/1084. More memory is being used 
than is actually required by the simulation. We are hoping to fix this soon.


On 11/26/2020 4:22, Juan Ramón D wrote:
Is there any way I can reduce the RAM usage for such a simulation, to 
get a higher resolution? Could it be because of a different reason?


I can only think of reducing the cell (PML layers) and using 
non-dispersive models for the materials, but both methods compromise 
the results of my simulation.



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

Re: [Meep-discuss] Unable to access archive

2020-11-18 Thread Ardavan Oskooi
Unfortunately, the archives have not been available on the 
ab-initio.mit.edu server for some time due to configuration issues with 
mailman.


However, the mailing list archive is available at: 
https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/. Note that 
this archive only goes back to Sep. 2010 even though the first post to 
meep-discuss was made on Mar. 30, 2006. If you want to access the 
complete archives, you can use a newsgroup reader (e.g., Mozilla 
Thunderbird) and search the NNTP server news.gmane.io for the list 
"gmane.comp.science.electromagnetism.meep.general".


On 11/18/2020 7:46, Joe Lowney wrote:


I'm getting the below error when trying to access the mail archives at 
http://ab-initio.mit.edu/pipermail/meep-discuss/.. 
.. anyone else 
having this issue?




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

Re: [Meep-discuss] Oblique incident plane wave on a periodic structure (following an old post)

2020-11-18 Thread Ardavan Oskooi
For reference, see the following tutorial example which demonstrates how 
to compute the angular response from a broadband source:


https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#angular-reflectance-spectrum-of-a-planar-interface

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

Re: [Meep-discuss] Flux Monitors for Dipole Power Radiation into Free Space (Fluorescence)

2020-11-16 Thread Ardavan Oskooi

There are a few things you can check.

First, perform a convergence check involving the runtime and the PML 
thickness as described in 
https://meep.readthedocs.io/en/latest/FAQ/#checking-convergence. (The 
resolution of 100 pixels/um you are using should be sufficient but you 
may want to verify that as well.) In your setup 
, 
the PML thickness is 0.25 um which is too small given that the largest 
wavelength is 0.8 um. This will produce spurious reflections from the 
cell boundaries that will introduce artifacts into the simulation. The 
PML thickness should be at least 0.4 um (i.e., half the largest 
wavelength) as described in 
https://meep.readthedocs.io/en/latest/FAQ/#what-is-a-good-rule-of-thumb-for-the-pml-thickness.Also, 
the runtime termination criteria you are using 
("sim.run(until_after_sources=mp.stop_when_fields_decayed(5, mp.Ez, 
mp.Vector3(cx,cy,cz), 1e-8))") may be stopping the simulation 
prematurely before the fields have sufficiently decayed away (due to 
absorption by the PMLs). Try replacing this with 
"sim.run(until_after_sources=runtime)" and repeatedly double the 
"runtime" parameter to see whether your results are changing and by how 
much.


Second, try outputting 2d cross sections of your 3d cell using plot2D 
via the "output_plane" parameter to verify that the flux monitors are 
positioned and sized exactly as you intended.


On 11/12/2020 2:03, Morton, William wrote:


I have a 3D planar surface with bloch periodic boundaries, on all 
except the top and bottom Z plane (I have also tried with just a unit 
cell and PML boundaries on all sides). My structure lies in the lower 
half of the simulation box, with a 45nm thick gold/silver film and a 
dielectric box with index=1.58 below the metal. I have moved the 
dipole around the box in the x and z directions, with polarisations of 
Ex and Ez.*I am unable to measure any power being radiated into the 
space above the dipole.*


I have flux monitors surrounding the dipole in a box, which measure 
the power emanating from the dipole in a homogeneous (air) and 
inhomogeneous (with metal structure) environment. I then normalise the 
results by dividing the sum of the power over all frequencies 
(P_inhomo /P_homo ). This should give the purcell factor, and I appear 
to have good agreement with what I hypothesize. There is a large 
enhancement close to the surface, and especially close to the edges of 
the structure. This part seems to be fine.



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

Re: [Meep-discuss] Gaussian Beam source

2020-11-10 Thread Ardavan Oskooi
For a 2d cell, you need to set force_all_components=True in the 
Simulation constructor.


Note, however, that the GaussianBeamSource is only strictly valid in 3d. 
As described in the manual 
: 



"In 3d, we use a"complex point-source" method 
to define a source that 
generates an exact Gaussian-beam solution. In 2d, we currently use the 
simple approximation of taking a cross-section of the 3d beam. In both 
cases, the beam is most accurate near the source's center frequency."


See: https://github.com/NanoComp/meep/issues/1308.

On 11/10/20 04:42, Ian Sage wrote:
If I set beam_E0=mp.Vector3(1,0,0) or beam_E0=mp.Vector3(0,0,1) it 
works fine, but if E0 is set to any other direction such as 
beam_E0=mp.Vector3(1,0,1) or beam_E0=mp.Vector3(1j,0,1) then I end up 
with fields of zero. Normalizing |E0| to 1 doesn't help.


Is there any way to generate a circular polarized Gaussian beam in 2d? 
(it's possible with a simulated QWP, of course)



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

Re: [Meep-discuss] Choosing Meep Unit

2020-11-08 Thread Ardavan Oskooi
Your analysis is correct. Using the default Courant factor of S=0.5 and 
resolution of 30 pixels/mm would give Δt = SΔx/c = 5.56 ps which is 
six orders of magnitude larger than what you want. There are only two 
ways to reduce Δt: (1) increase the resolution or (2) reduce the Courant 
factor.


See also: https://meep.readthedocs.io/en/latest/Introduction/#units-in-meep.

On 11/7/20 14:21, Gui Max wrote:


I am trying to run the simulation using a THz source. I wish the 
source to have 0.0264ps timestep(deltaT) and a total of about 1000 
timesteps. I choose the 'a' to be 1mm, as my sample size is about 1 to 
2 cm. I calculated my deltaT as deltaT = (S/resolution)*(1000/c)  , 
and using resolution = 30pixel/mm. However, if I want to achieve my 
desired deltaT, it would require S (Courant Constant) to be a 
ridiculously small number. Or I can keep S=0.5, but the resolution 
will be extremely large, and I don't need the cell sizes to be such 
fine. What did I do wrong here? Any help would be appreciated.


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

Re: [Meep-discuss] Gaussian Beam source

2020-11-08 Thread Ardavan Oskooi
Actually, a simpler way to set up a circularly polarized source is to 
use a single GaussianBeamSource object with complex elements for the 
beam_E0 parameter:


sources = [mp.GaussianBeamSource(src=mp.ContinuousSource(fcen),
 center=mp.Vector3(),
 size=mp.Vector3(s,s,0),
 beam_x0=beam_x0,
 beam_kdir=beam_kdir,
 beam_w0=beam_w0,
 beam_E0=mp.Vector3(1,1j,0))]

This is equivalent to the previous example involving two 
GaussianBeamSource objects with one of the objects containing 
beam_E0=mp.Vector3(0,1,0) and amplitude=1j.


On 11/8/20 19:09, Ardavan Oskooi wrote:


The following script launches a circularly polarized Gaussian beam 
source propagating along the +z direction in 3d. It is based on 
combining two overlapping GaussianBeamSource objects with orthogonal 
transverse polarization (Ex and Ey) that are 90° out of phase. Note 
that for this to work it is necessary to set force_complex_fields=True 
in the Simulation constructor (otherwise only the real part of the 
source is used by default). A 2d cross section of the beam profile is 
output at the end of the run.





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

Re: [Meep-discuss] Gaussian Beam source

2020-11-08 Thread Ardavan Oskooi

On 11/8/20 15:17, Ian Sage wrote:


Does anyone have a working sample circular polarized GaussianBeamSource
code, which they can share?



The following script launches a circularly polarized Gaussian beam 
source propagating along the +z direction in 3d. It is based on 
combining two overlapping GaussianBeamSource objects with orthogonal 
transverse polarization (Ex and Ey) that are 90° out of phase. Note that 
for this to work it is necessary to set force_complex_fields=True in the 
Simulation constructor (otherwise only the real part of the source is 
used by default). A 2d cross section of the beam profile is output at 
the end of the run.



import meep as mp
import math
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt

resolution = 10
s = 12
dpml = 1

cell_size = mp.Vector3(s,s,s)
boundary_layers = [mp.PML(thickness=dpml)]

beam_x0 = mp.Vector3(0,0,0)  # beam center
rot_angle = math.radians(0)  # CCW rotation angle about z axis (0: +y axis)
beam_kdir = mp.Vector3(0,0,1).rotate(mp.Vector3(1,0,0),rot_angle) # beam 
propagation direction

beam_w0 = 0.8  # beam waist radius
fcen = 1
sources = [mp.GaussianBeamSource(src=mp.ContinuousSource(fcen),
 center=mp.Vector3(),
 size=mp.Vector3(s,s,0),
 beam_x0=beam_x0,
 beam_kdir=beam_kdir,
 beam_w0=beam_w0,
 beam_E0=mp.Vector3(1,0,0)),
   mp.GaussianBeamSource(src=mp.ContinuousSource(fcen),
 center=mp.Vector3(),
 size=mp.Vector3(s,s,0),
 beam_x0=beam_x0,
 beam_kdir=beam_kdir,
 beam_w0=beam_w0,
 beam_E0=mp.Vector3(0,1,0),
 amplitude=1j)]

sim = mp.Simulation(resolution=resolution,
    cell_size=cell_size,
    boundary_layers=boundary_layers,
    sources=sources,
    force_complex_fields=True)

sim.run(until=50)

plt.figure()
sim.plot2D(fields=mp.Ex,
   output_plane=mp.Volume(center=mp.Vector3(),
size=mp.Vector3(s-2*dpml,0,s-2*dpml)))
plt.savefig('beam3d_xz_Ex_angle{}.png'.format(int(math.degrees(rot_angle))),bbox_inches='tight',pad_inches=0)

plt.figure()
sim.plot2D(fields=mp.Ex,
   output_plane=mp.Volume(center=mp.Vector3(),
size=mp.Vector3(0,s-2*dpml,s-2*dpml)))
plt.savefig('beam3d_yz_Ex_angle{}.png'.format(int(math.degrees(rot_angle))),bbox_inches='tight',pad_inches=0)


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

Re: [Meep-discuss] Regarding the near to far field calculation, where is the integration done?

2020-11-08 Thread Ardavan Oskooi
For reference, note that the near2far feature already exists for 
cylindrical coordinates. It was added in 
https://github.com/NanoComp/meep/pull/1090. (This implementation is 
based on integrating over φ using green3d.) For a demonstration, see 
this tutorial example 
.


On 11/8/20 16:47, Mandy Xia wrote:
In my problem, I have a periodic cylinder structure along z-direction 
and I would like to compute the scattered field in the far field. 
Using the spectral representation of PGF, I'm able to compute, for a 
particular point in the simulated period, what the total contribution 
summing over all the period is, without an expensive spatial sum. In 
order to collect all the contributions from the cylinder, the last 
step I need is to integrate over the simulated period and I was trying 
to rely on the numerical integration over near-field box in MEEP to 
handle that. However, I found that the computed results are off. I 
suspected this was due to the staggered grid we are using. I examined 
the coordinates of the discrete points on the near field box. For some 
(x, y) combinations, we have z coordinates going from -period/2 to 
period/2 in z and in total an odd number of points. In some other (x, 
y) combinations, we have z coordinates going from -period/2+half_cell 
to period/2-half_cell and in total an even number of points. So it 
seems that in the above two scenarios we are integrating over 
different lengths in z. However, in order to get the correct 
contribution, I need to integrate over exactly one period of the 
structure. I'm wondering if you have any suggestions on this. Or maybe 
there is something wrong with my understanding of the staggered grid, 
and it would be great if you could point it out.


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

Re: [Meep-discuss] Symmetries and amplitude function

2020-11-06 Thread Ardavan Oskooi
There is a known bug involving a 3d cell with periodic boundaries and 
two or more mirror symmetries: https://github.com/NanoComp/meep/issues/132.


The workaround is to simply remove the mirror symmetries.

On 11/6/20 05:58, Juan Ramón D wrote:


The results from the reflectance spectrum are similar to the results I 
expected (comparing with simulations from other people). However I 
have some issues I would like to solve:


  * When I try to set a symmetry my code explodes. With incidence in
the XZ plane, I set mirror symmetry in the y=0 plane. I defined my
PhC slab in such a way that it is invariant under y=0 reflections,
so I think I should not have any problem. In the first simulation
(without geometry objects) there is no problem, the problem arises
after setting the geometry of the second simulation (with geometry
objects). The result using jupyter notebook is a message saying:
“the kernel appears to have died”.
  * When I try to define an amplitude function in the same way as in
http://www.simpetuscloud.com/projects.html#meep_thermal_radiation
I get a similar error: the kernel appears to have died. I have
successfully used the amplitude function in other problems with
point sources but here it does not work. I do not know if this
point is critical for simulating a planewave, since I already get
good results without it. I would be really grateful if someone
could explain if this is strictly necessary and/or why I get this
error.
  * Although the results are good in general, I sometimes get dips I
did not expect, could this be band folding associated with my
rectangular lattice?


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

Re: [Meep-discuss] Field Not Converge with GaussianBeamSource

2020-11-01 Thread Ardavan Oskooi
Perhaps you are combining two or more mirror symmetries with periodic 
boundary conditions in 3d? This may cause field instabilities as 
described in: https://github.com/NanoComp/meep/issues/132. If this is 
the case, try removing the mirror symmetries.


On 11/1/2020 13:28, Gui Max wrote:
However, the simulation terminated with the error "simulation fields 
are NaN or Inf". I have no geometry defined, but I still have this 
error when the resolution and Courant are set to 40 and 0.1. The 
computational cost would be too high if I keep increasing the resolution.


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

Re: [Meep-discuss] Phase offsets of sources in supercells

2020-10-13 Thread Ardavan Oskooi
You can set the relative phase of any two sources using the amplitude 
property. Note that if you set the amplitude to a complex value, you 
will also likely need to set force_complex_fields=True in the Simulation 
constructor since Meep uses real fields by default.


For more details on sources in supercells, see Section 4.6 of our book 
chapter: https://arxiv.org/abs/1301.5366.


On 10/13/20 02:11, lafullo...@malvernoptical.co.uk wrote:


Hi, I’ve been using a supercell to represent a non-orthogonal lattice. 
I know I need to use two sources to counter the effects of band 
folding in reflection or transmission measurements, however I’m 
struggling to get the correct results out from simulations. The two 
(Gaussian) sources currently in the supercell are separated by a 
lattice vector, but I think the problem lies with the phase offset 
between them. Does anyone know how to correctly use a time delay 
between the two sources (or any other method) in order to create the 
correct phase offset for countering band folding?


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

Re: [Meep-discuss] RCS Calculation

2020-09-18 Thread Ardavan Oskooi

On 9/17/20 12:34, Abers, Paul wrote:

using this mailing list and I did not see any rules or guidelines for 
message structure, so please forgive me if I make any errors. Also, 
whenever I try and open the links for the meep mailing list archives, 
I get a 403 forbidden error “You don't have permission to access 
/pipermail/meep-discuss/ on this server.” How can I go about getting 
access to the mailing list archives such that I can try and read 
previous discussions to answer some of my questions/issues.


The mailing list archives are available at: 
https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/.


My first issue is with the units. I am trying to use an input 
frequency of 8 GHz, bandwidth of 500MHz for a cylinder that is 3 
meters long and has a diameter of 1 meter. For converting to 
dimensionless units, do I just choose a value for a that works for my 
system? Say a is 1cm, then frequency = 1/wavelength = 1/3.75 = 0.267, 
bandwidth would be 0.5 / 8 = 0.0625 (used in df calculation for 
GaussianSource and in Simulation.add_flux), and then cylinder height = 
3 / 0.01 = 300 and cylinder diameter = 1 / 0.01 = 100. Is this the 
proper approach for the dimensionless units?



See: https://meep.readthedocs.io/en/latest/Introduction/#units-in-meep.

Second, I am trying to create to separate input sources for my 
simulation. One that has z-polarization, and one that is orthogonal to 
the z-polarization and orthogonal to the k-point vector for an oblique 
planewave. I have attempted to do this by using the EigenModeSource 
and setting the center, size based on the closest cardinal plane 
projection and the k_point based on the direction of travel. The 
polarization I control with component and amp_func. An example of my 
code to achieve this would look like:


Launching a polarized planewave in 3d using the EigenModeSource requires 
passing a (recently added) DiffractedPlanewave object 
(https://meep.readthedocs.io/en/latest/Python_User_Interface/#diffractedplanewave) 
as the eig_band parameter. To access this feature, you will need to use 
the Conda package for the nightly build or build from source using the 
master branch of the GitHub repository.


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

Re: [Meep-discuss] Getting error when trying to run MEEP on a cluster

2020-08-20 Thread Ardavan Oskooi
The meep module seems to be installed in the system folder 
/opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/meep/ 
but the runtime error is in simulation.py is from your local directory 
in /home1/07449/pf04620/bend_flux/meep/. Perhaps there are two different 
(and conflicting) PyMeep versions installed?


Try including the line "export 
PYTHONPATH=/opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/" 
in your batch script to specify the environment variable where Python 
should look to find the meep module files.


PS. The meep-discuss archives are available at: 
https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/.



On 8/20/20 13:23, Patrick Flanigan wrote:
(I apologize if this has already been asked; for some reason I can't 
access the discussion archives at 
http://ab-initio.mit.edu/pipermail/meep-discuss/ at the moment).


I'm trying to run Python-based MEEP codes on the Stampede2 cluster 
(https://portal.tacc.utexas.edu/user-guides/stampede2). I'm actually 
dealing with a lot of errors, but to keep things simple for my first 
post I'll just ask one question. Since I know the sample codes on the 
GitHub repository work, I've been trying to run them on the cluster 
before I use my own. When I take bend-flux.py 
(https://github.com/NanoComp/meep/blob/master/python/examples/bend-flux.py) 
and run it locally on my own Ubuntu terminal, it works fine and gives 
the expected output. However, when I try to run it as batch job, I get 
this error message


Traceback (most recent call last):
  File "bend_flux.py", line 54, in 
sim.run(until_after_sources=mp.stop_when_fields_decayed(50,mp.Ez,pt,1e-3))
  File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
2231, in run
    self._run_sources_until(until_after_sources, step_funcs)
  File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
1519, in _run_sources_until
    self._run_until(new_conds, step_funcs)
  File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
1495, in _run_until
    self.progress.value = t0 + stop_time
UnboundLocalError: local variable 't0' referenced before assignment


This is the batch script that I've been using (it took a lot of help 
from other more experienced users) :


#!/bin/bash
#SBATCH -J bend_flux
#SBATCH -o bend_flux_out.txt
#SBATCH -e bend_flux_err.txt
#SBATCH -n 1
#SBATCH -N 1
#SBATCH -p development
#SBATCH -t 0:10:00

module load python3
module load meep

ln -sf
/opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/meep/
./

ibrun -np 1 python3 bend_flux.py > bend_flux_run.txt


(I just changed the - to _ in the file name because I thought it would 
help avoid errors; I don't think that's the problem). I don't fully 
understand it, but I think that the ln -sf line puts all the MEEP 
files in the folder where the batch script is, but there's some sort 
of problem with reading those files. Could it be because the cluster 
is using an older version of MEEP, and this bug is fixed in more 
recent versions? Or is this something I need to manually change in the 
simulation.py file?


Any help would be greatly appreciated.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] Problem with Inverted Pyramid Structure at Small Absorption

2020-08-15 Thread Ardavan Oskooi
Note that due to the Fourier Uncertainty Principle, the runtime should 
be at least ~1/frequency resolution. In practice, the runtime may even 
have to be twice as large as demonstrated in 
https://meep.readthedocs.io/en/latest/Python_Tutorials/Custom_Source/#stochastic-dipole-emission-in-light-emitting-diodes. 
Try switching to the meep.Simulation(run=run_time) run function and 
repeatedly double run_time.


On 8/15/2020 8:11, J. Philip Haupt wrote:
I've tried increasing PML thickness (went up to 8 micron) and 
resolution (went up to 150). As for run time, I am using the decay 
factor, and have manually been terminating it when the reflectances 
exceed unity. I think the maximum time I've run for is around 3000 units.




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

Re: [Meep-discuss] ModeSolver in Cylindrical Coordinates

2020-08-14 Thread Ardavan Oskooi
Meep's eigenmode decomposition (and eigenmode source) feature only 
supports Cartesian coordinates.


On 8/13/20 01:23, Kramnik Daniel wrote:
I'm trying to design some silicon photonic ring resonator structures 
using MEEP/MPB and was wondering if the modesolver can work in 
cylindrical coordinates. It looks like the FDTD solver supports 
cylindrical coordinates, based on the "ring resonator" examples.


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

Re: [Meep-discuss] Problem with Inverted Pyramid Structure at Small Absorption

2020-08-14 Thread Ardavan Oskooi
For additional details regarding PMLs in Meep, see: 
https://meep.readthedocs.io/en/latest/Perfectly_Matched_Layer/.


As described in 
https://meep.readthedocs.io/en/latest/FAQ/#checking-convergence, you 
need to check the convergence by increasing the resolution, PML 
thickness, and run time (for Fourier spectra). Have you also tried 
doubling the run time?


On 8/13/20 17:06, J. Philip Haupt wrote:
I still haven't gotten this to work. It seems to work in the 
wavelength range 300-1000 nm (which is with different fits), but not 
1000-1200 nm (with fit shown in the previous email).


For what it's worth, my colleague got a converged result using 
Lumerical FDTD Solutions, specifically a "stretched coordinate" PML 
(SCPML). I have been trying to map the parameters in MEEP's PML class 
to the parameters used by Lumerical, but without much luck. Is there 
any documentation for how to change more "standard" PML parameters 
(what Lumerical calls layers (=thickness?), kappa, sigma, polynomial 
(which I assume = degree of pml_profile))? This would help me 
benchmark his results with MEEP.


Also, what does the mean_stretch parameter in meep.PML do? It is 
listed in the documentation 
 but 
not explained.


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

Re: [Meep-discuss] Problem with Inverted Pyramid Structure at Small Absorption

2020-07-30 Thread Ardavan Oskooi
Try turning off subpixel averaging since it sometimes causes 
instabilities with the prism sidewall angle feature. This means that you 
will also need to increase the resolution.


On 7/29/20 16:38, J. Philip Haupt wrote:

I get that the fields diverge (albeit very slowly), at least so it 
seems. Boundary conditions are k_point=Vector3(0,0,0) with PML in the 
Z direction. My guess has been that the pyramid reflects light such 
that it hits the PML at a glancing angle and this gives reflective 
artefacts. I've hence played with PML parameters (thickness, profile, 
R_asymptotic) and the distance between sources, monitors and 
structure, but so far haven't gotten anything to work. Is perhaps the 
absorption too small for MEEP to handle (i.e. leading to significant 
roundoff errors)? Is there a workaround? What are some typical values 
to try if the defaults do not work?


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

Re: [Meep-discuss] Fwd: Installation of parallel Meep

2020-07-28 Thread Ardavan Oskooi
The Conda packages (tagged release and nightly build) are built using 
parallel HDF5:


https://github.com/conda-forge/pymeep-feedstock/blob/master/recipe/meta.yaml#L54

There is no need to install HDF5 (or any other dependency) separately.

On 7/28/20 01:06, Spam Spammer wrote:
i have installed Meep using the miniconda3 prebuild version and 
created a parallel environment via the

conda create -n pmp -c conda-forge pymeep=*=mpi_mpich_*
command line. I have not installed hdf5 or anything else separately, 
just the miniconda3 prebuild.
My question now is whether i still have to configure hdf5 for parallel 
usage to get full use of parallel meep or is this directly done by 
miniconda3.
If i run parallel simulations with about 64 cores they seem to work, 
but they are slower than I expected (~1.5 days in comparison to ~ 8 
day with 4 cores...).
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] Eigenmode source in cylindrical co-ordinates

2020-07-22 Thread Ardavan Oskooi

On 7/22/20 08:04, Alex Abulnaga wrote:

I am trying to simulate a ring resonator in cylindrical co-ordinates 
using an eigenmode source with defined parity, but I am running into 
an error:

"RuntimeError: meep: unsupported dimensionality in add_eigenmode_source"
Is it not possible to use eigenmode sources in cylindrical co-ordinates? Or am 
I making a mistake somewhere? (code and output attached).



The eigenmode source and mode decomposition are not supported in 
cylindrical coordinates.


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

Re: [Meep-discuss] Absorbed Photon Density in Meep

2020-07-15 Thread Ardavan Oskooi
For your reference, we recently added a new tutorial example which 
demonstrates how to compute a density map of the absorbed power:


https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#absorbed-power-density-map-of-a-lossy-cylinder

On 6/17/20 12:21, J. Philip Haupt wrote:
Sorry to bother again. While I think this works, I have encountered 
some issues and am wondering if they're avoidable. Namely, when I use 
add_dft_fields the run time is substantially increased and when I use 
output_dft, the file size is tens of GB.


I am ultimately interested in the total absorbed photon density (for 
all frequencies) of the cell integrated along the y axis. Is my best 
option using add_dft_fields (for the entire volume), calculating 
Im(ε(ω)) |E|^2/hω, then integrating both frequency and space along y?


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

Re: [Meep-discuss] Measure polarization conversion

2020-07-01 Thread Ardavan Oskooi
Take a look at: 
https://meep.readthedocs.io/en/latest/Python_Tutorials/Mode_Decomposition/#diffraction-spectrum-of-liquid-crystal-polarization-gratings


On 7/1/2020 4:48, Lorenzo König wrote:

I am trying to measure the polarization conversion of a half wave plate. In 
practice, I have a right-hand circularly polarized input plane wave (Ex+i*Ey) 
which propagates through a subwavelength grating acting as half wave plate 
(simulation is set in 3d). I would like to measure the polarization conversion, 
i.e. the amount of flux that is converted to left-hand polarization (Ex-i*Ey). 
Is there a way to measure the flux for a specific polarization (similar to 
'add_flux')? I know I could simply output the fields and calculate the 
circularly polarized components as Ex±i*Ey for visualization, but I would 
appreciate a quantitative solution to measure the leakage term, i.e. the amount 
of flux which is not converted to opposite helicity.


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

Re: [Meep-discuss] 2D Quiver Plots?

2020-05-27 Thread Ardavan Oskooi

On 5/27/2020 8:11, David Banas wrote:


Is it possible to plot the 2D equivalent of “quiver” plots?


Yes, this is possible by first calling matplotlib's imshow followed by 
quiver as demonstrated in:


https://stackoverflow.com/questions/42776583/superimpose-matplotlib-quiver-on-image

Note that Meep's plot2D function actually calls imshow to generate the 
images so you can first plot the permittivity profile and then overlay 
it with the quiver plot.


To obtain the fields and field location data to pass to quiver, you can 
use the get_array 
(https://meep.readthedocs.io/en/latest/Python_User_Interface/#array-slices) 
and get_array_metadata 
(https://meep.readthedocs.io/en/latest/Python_User_Interface/#array-metadata) 
functions.



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

Re: [Meep-discuss] Fiber modes

2020-05-18 Thread Ardavan Oskooi
Before inspecting the field profile, have you verified using the 
simulation output that the mode computed by MPB is correct (i.e., the 
frequency and wavevector match the band structure)?


Also, the cross-sectional area that you are using to compute the fiber 
mode may not be sufficiently large to capture the entire mode. Remember 
that MPB does not use PMLs; the "padding" space around your structure 
needs to be sufficiently large such that the fields from the fiber have 
decayed away to zero at the boundaries (otherwise there will be 
reflections which will interfere with the mode computed by the eigensolver).


On 5/18/2020 8:51, SERAFINI VALENTINA wrote:


Can someone explain me where I am wrong?



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

Re: [Meep-discuss] Symmetry and Phase for a Gaussian Source

2020-04-29 Thread Ardavan Oskooi
There is a known bug when combining two or more symmetries with periodic 
boundary conditions in 3d which causes the fields to blow up 
(https://github.com/NanoComp/meep/issues/132). To test this whether this 
bug is present in your case, check what happens when you have just one 
mirror symmetry.


Note that in addition to mirror symmetries, Meep also supports C2 and C4 
rotation symmetries 
(https://meep.readthedocs.io/en/latest/Python_User_Interface/#symmetry).


On 4/29/20 13:58, J. Philip Haupt wrote:
From what I gather in the documentation, MEEP doesn't support the x=y 
symmetry, but I may still exploit the other symmetry. However, 
whenever I try this I get diverging fields. If I instead use two 
mirror symmetries (one in X and one in Y), I still get a diverging 
field. In particular, my source is
sources = [mp.Source(mp.GaussianSource(frequency=freq_centre, 
width=freq_width),

    component=mp.Ex,
center=mp.Vector3(0,0,0.5*sz-pml_width-0.25),
    size=mp.Vector3(sx,sy,0))]

The symmetry that makes the most sense to me to use here is
symm = [mp.Mirror(mp.X, phase=-1), mp.Mirror(mp.Y, phase=1)]
since Ex should have odd symmetry about X and even symmetry about Y.

Am I misunderstanding the symmetry of this source or is there some 
other numerical error? My fields converge if I do not include the 
symmetry.


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

Re: [Meep-discuss] How to use Simulation.plot3D() in an IPython notebook?

2020-04-20 Thread Ardavan Oskooi

On 4/19/20 18:21, David Banas wrote:


Can someone give me example code for using the Simulation.plot3D() function in 
an IPython (Jupyter) notebook, for viewing a 3D simulation’s results?


The plot3D command just plots a 3D contour plot of the geometry exactly 
as demonstrated in: 
https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#visualizing-3d-structures


You need to call mlab.show() after calling Simulation.plot3D() to 
actually see the plot.


For reference, the code for this function is in 
https://github.com/NanoComp/meep/blob/master/python/visualization.py#L565-L576.



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

Re: [Meep-discuss] Subpixel Averaging and Pyramidal Structures

2020-03-01 Thread Ardavan Oskooi

On 2/29/20 13:52, J. Philip Haupt wrote:

Thanks, I had no idea that the Prism object could do anything but 
right-angle sides. It does leave some other questions (how to make 
oblique pyramids, or rectangular - not square - pyramids), but is 
there a way to do this in the Python interface yet? (Sorry, I am quite 
new to this software)


An experimental feature for slanted prisms was added in #1129 
 via its "sidewall_angle" 
parameter. While we are still working on some remaining issues (see 
libctl #55 ) before it can 
be added to the documentation 
, 
you can try playing with it to see how it works. An alternative approach 
for creating an arbitrary pyramid is by overlapping a set of Block 
objects. It's a little cumbersome to work out the orientation and size 
of all the individual Blocks but it will be much faster and more 
accurate than using a material function.


See: 
https://meep.readthedocs.io/en/latest/FAQ/#why-does-subpixel-averaging-take-so-long
Yes, I was already looking at this. However, I thought the parameter 
Simulation.eps_averaging=False (in Python) turns off subpixel 
averaging, thereby avoiding this issue (at the cost of accuracy). 
Perhaps I do not understand this option, but it is not working as I 
expected it to.


As explained in that FAQ, even if you disable subpixel smoothing, for 
objects involving a material function the slow SWIG callbacks during the 
grid initialization may still be noticeable.



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

Re: [Meep-discuss] Subpixel Averaging and Pyramidal Structures

2020-02-28 Thread Ardavan Oskooi

On 2/28/2020 13:56, J. Philip Haupt wrote:
I am trying to write a basic module to allow for simple 3D shapes in 
MEEP (for now, polyhedra). I am most interested in rectangular 
pyramids. I have two main questions:


  * first, is this an appropriate way to go about writing pyramid
structures? All I did was make a class for the Pyramid (in my
actual code, it inherits a Shape class), along with a material.
Then I convert a list of these objects with MEEP's GeometricObject
to a material_func for my Simulation object. I'm running into
performance problems, especially for subpixel averaging. Is there
a better way to go about this? It would be nice to just make a
more general GeometricObject (say, a polyhedron defined by a set
of planes) but I don't know how to do this.

Have you tried setting up your pyramidal structure using a Prism by 
specifying its vertices? We recently made several changes to improve 
reliability (see: libctl #46 
, #49 
, and #53 
); just make sure you are 
using libctl 4.5.0.



  * I have subpixel averaging disabled in my code by using
eps_average=False. I thought this would fix my problem, but it
does not. Even with this extra line if I run the code it still
gives "subpixel-averaging is 97.7767% done, 0.0910229 s remaining"
etc. Why is it still doing this, and how should I get around this?

See: 
https://meep.readthedocs.io/en/latest/FAQ/#why-does-subpixel-averaging-take-so-long


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

Re: [Meep-discuss] Self Consistency and Reflectivity

2019-11-26 Thread Ardavan Oskooi
Perhaps there is a bug somewhere in your simulation? The following 
tutorial example involves computing the reflectance of a planar 
interface of air and a wavelength-dependent, lossless material (fused 
quartz from the materials library) and validating the results using the 
Fresnel equation:



https://meep.readthedocs.io/en/latest/Python_Tutorials/Material_Dispersion/#reflectance-spectrum-of-air-silica-interface

On 11/25/19 15:57, Mckeithen, Dylan M (US 383A-Affiliate) wrote:

Hey Everyone,

I’m trying to model custom materials in meep by fitting Lorentz-Drude 
susceptibility parameters to provided n and k values. As a sanity check, 
I set up a simulation to measure the reflectivity of a given material, 
and I’m comparing this to the reflectivity as calculated using the 
Lorentz-Drude susceptibility profile given in the materials_library.py 
file. Using Aluminum as an example, I’m finding that the reflectivity in 
the meep simulation is higher than expected based on the given material 
parameters. The reflectivity calculation is consistent with other 
sources for the reflectivity of Aluminum, so I believe there must be a 
problem in the simulation. I would expect that calculating the 
reflectivity based on LD parameters and simulating a material with those 
same LD parameters would give the same answer. I’ve already checked that 
the simulation is using the intensity of the fields, so it isn’t a 
problem of squaring my simulated reflectivity values. If anyone knows 
what might be going on, I would really appreciate it.


Here's a sample of the reflectivity data I’ve collected:

Wavelength (nm) -   500,   600,   700,   800,   
850,   900,   1000


Calculated Reflectivity - 0.920,    0.911,    0.904,    0.871,
0.869,    0.895,    0.936


Simulated Reflectivity - 0.963,    0.959,    0.954,    0.936,
0.929,    0.941,    0.964


- - - - - - - - - - - - - - - - - - - - -

Dylan McKeithen

Jet Propulsion Laboratory


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

Re: [Meep-discuss] Polarimetric RCS simulation of a sphere

2019-11-20 Thread Ardavan Oskooi

On 10/24/19 06:29, Abryoghani, Khashayar wrote:

I'm seeking to calculate the polarimetric RCS for different 3D shapes. 
To get started, I aimed to calculate the none-polarimetric RCS of a 
simple sphere. The following code that I have implemented should be 
able to do so. However, the result is not what I expected. After 
struggling for days, I've still not been able to solve the issue. So I 
would appreciate it if you have a look at the code and the 
corresponding result, so you may be able to help.



See the following tutorial example for differential/radar cross section 
which was recently added to the user manual:



https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#differentialradar-cross-section

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

Re: [Meep-discuss] Unable to install meep (building from source) on ubuntu 19.04

2019-11-11 Thread Ardavan Oskooi
That build script only works with Ubuntu 16.04 and 18.04 (as well as 
CentOs 7.x). You are trying to install under Ubuntu 19.04 which is 
therefore not going to work. However, you can try editing line 12 to 
force "ubuntu=true" and see whether it might still work.


Unfortunately, since Ubuntu 19.xx is not a long term support (LTS) 
release , it has not been included in 
the build instructions 
.


On 11/11/19 07:57, md mir wrote:

Hello meep users,

I am trying to install meep by using this command

|wget 
https://raw.githubusercontent.com/NanoComp/meep/master/contrib/build-meep.sh 
chmod +x build-meep.sh ./build-meep.sh |

and getting this error message.


mir@mir-Lenovo:~/install$ ./build-meep.sh
(use -h for help)

This sript will download or update sources, compile and install MEEP.
Please ensure the following final paths fit your needs:
    '/home/mir/install/bin/meep'
    '/home/mir/install/lib/...'
    '/home/mir/install/share/...'
    '/home/mir/install/...'
    '/home/mir/install/src/'

Press return to continue

LSB Version: 
 core-10.2019031300ubuntu1-noarch:security-10.2019031300ubuntu1-noarch

+ ubuntu=false
+ centos=false
++ lsb_release -r -s
+ distrib=19.04
+ case "$distrib" in
++ lsb_release -a
+ echo 'unsupported distribution '\''LSB Version: 
 core-10.2019031300ubuntu1-noarch:security-10.2019031300ubuntu1-noarch

Distributor ID:    Ubuntu
Description:    Ubuntu 19.04
Release:    19.04
Codename:    disco'\'', edit and fix!'
unsupported distribution 'LSB Version: 
 core-10.2019031300ubuntu1-noarch:security-10.2019031300ubuntu1-noarch

Distributor ID:    Ubuntu
Description:    Ubuntu 19.04
Release:    19.04
Codename:    disco', edit and fix!
+ false

What could be the reason?
thank you?

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

Re: [Meep-discuss] Install / pymeep-1.11 / ModuleNotFound

2019-11-01 Thread Ardavan Oskooi
It's possible that the PyMeep Conda package installed under Python 3.x 
but that your "python" system command defaults to 2.x. (The list of 
packages installed is shown during the "conda create ..." step.) Try 
running your examples using "python3". You can also try e.g. "python3.5" 
or "python3.6" to be even more specific.


On 11/1/19 09:33, Brian Catanzaro wrote:


Typo in my posting…

python -c ‘import meep’ fails

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

Re: [Meep-discuss] Install / pymeep-1.11 / ModuleNotFound

2019-11-01 Thread Ardavan Oskooi

On 11/1/19 08:08, Brian Catanzaro wrote:

Started with a brand new VM (Ubuntu 16.04 LTS hosted on Win 10).  This 
VM is only for meep.


Followed the Conda installation and wind up with 
‘ModuleNotFoundError:  No module named pymeep’.


Checked the packages listed with ‘conda list’, pymeep-1.11 is listed.

None of the examples can find pymeep and ‘python -c ‘import pymeep’ 
fails’.  What went wrong?



The module name is "meep" and not "pymeep".

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

Re: [Meep-discuss] Issues with the Cherenkov radiation

2019-09-18 Thread Ardavan Oskooi

On 9/18/19 07:02, Vladimir Lenok wrote:
I am trying to use MEEP (python) for performing Cherenkov simulations 
and I faced with two issues:


1. When I make a simulation of a horizontally moving charge then 
everything looks fine. But when I incline the trajectory I can see some 
stable fields on the way of the charge.


The small field irregularities you are observing may be due to 
high-frequency numerical artifacts of the discretization. For reference, 
see Fig. 5 of the Meep paper 
(http://ab-initio.mit.edu/~oskooi/papers/Oskooi10.pdf) and the related 
discussion in Section 3 "Interpolation and the illusion of continuity". 
One way to verify this would be to either increase the resolution or 
decrease the Courant factor and see whether these artifacts become less 
noticeable.


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

Re: [Meep-discuss] time varying epsilon

2019-09-18 Thread Ardavan Oskooi

On 9/18/19 09:17, Cícero Julião wrote:

I am trying to code a structure varying in time, during the execution 
of the code. However, until now, I didn't have any success. Below, an 
example of a straightforward code to


Meep has a built-in function phase_in_material 
 
which does exactly this (example script 
). 
This FAQ 
 
also provides more details.


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

Re: [Meep-discuss] How to simulate curved waveguides and see the effects of the others waveguides near them

2019-08-14 Thread Ardavan Oskooi

On 8/14/19 07:57, Gabriel Henrique Armando Jorge wrote:

*1) Do you guys recommend any tutorial that helps in analysing the 
effects  of Waveguides?


2) And how to create curved Waveguides?
*


To create curved planar structures, you can use gdspy 
 to create a GDS file which can 
then be imported into Meep as demonstrated in this tutoria 
l 
for a directional coupler 
.


___
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 RAM estimation

2019-08-13 Thread Ardavan Oskooi

On 8/3/19 16:25, Hannes Kohlmann wrote:


Is there a way how I can estimate 1) how much RAM MEEP will use given,
for instance, a 2D cylindrical simulation with a cell of Nr x Nz points,
PML of given size (how many parameters / tensors per grid point does it
store?) and some material geometries (simple, not anisotropic)? What
takes the biggest part of the RAM, that I might not be aware of as an
end user, since my estimates are much lower than what I find when I
inspect the processes with 'top'?


See the following FAQ which was recently added:

https://meep.readthedocs.io/en/latest/FAQ/#what-is-an-estimate-of-the-memory-requirements-of-a-simulation-given-only-its-cell-size-and-resolution


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

Re: [Meep-discuss] Complex Fields and phase

2019-08-07 Thread Ardavan Oskooi

On 7/25/19 05:13, Shaun Lung wrote:

Why is this the case? I would expect that the complex field would 
correspond to a phase-shifted field. For example, if I were to excite 
a birefringent structure with a linearly polarized plane wave, 
wouldn't I expect an output field with complex components due to the 
retardation of the phase?



We recently updated this FAQ to emphasize that a complex field is not 
required for representing phase, it's just used for mathematical 
convenience using what are known as phasors:


https://meep.readthedocs.io/en/latest/FAQ/#are-complex-fields-physical

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

Re: [Meep-discuss] help for 3D MEEP

2019-07-31 Thread Ardavan Oskooi

On 7/31/2019 1:42, Massimo Moccia wrote:

I want to simulate a 3D periodic unit cell and calculate the 
reflectance spectrum. The geometry is a 50nm thick metallic cross (far 
from plasmonic frequency range) on infinite thick silicon substrate.
Starting from documentation on MEEP website and from simpetus project 
(http://www.simpetuscloud.com/projects.html#meep_thermal_radiation) I 
wrote my python script and run it.
What I expect is a single reflectance peak (maximum) in the range of 4 
-20 um wavelength. The simulation results are very different from what 
I expect: several spikes appear in the analyzed wavelength range.



One possible explanation for why there are unexpected peaks in your 
spectrum is described in:


https://meep.readthedocs.io/en/latest/FAQ/#why-are-there-strange-peaks-in-my-reflectancetransmittance-spectrum-when-modeling-planar-or-periodic-structures


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

Re: [Meep-discuss] Casimir Force Calculation with Python-Meep

2019-07-30 Thread Ardavan Oskooi

On 7/30/19 19:29, Xingyu Gao wrote:

I'm new to use Python-Meep for casimir force calculation. From the 
Meep documentation I find no information about the Casimir Force. But 
the scheme interface provides some functions to calculate Casimir 
force directly. And the documentation said that the scheme interface 
is already replaced by python. So I am thinking that if python-meep 
also has some similar function to calculate Casimir force directly?



The Casimir force feature is only available using the Scheme interface. 
It is not supported in Python.


___
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 Adjoint CrossRouter.py example

2019-06-04 Thread Ardavan Oskooi

For reference, the following response is from Homer Reid:

"With regard to the specific problem you are having, it seems the LaTeX 
installation on your system is incomplete or incorrectly configured. The 
LaTeX formatting engine is trying and failing to find a program named 
'mktexlsr.pl ', which should be present as part of a 
standard LaTeX installation. For example, on my system (Linux Mint 19.1, 
similar to Ubuntu) this file is provided by the 'texlive-base' package 
and is installed at 
'/usr/share/texlive/texmf-dist/scripts/texlive/mktexlsr.pl 
'. One possibility is that you are simply missing 
this file on your machine, and thus that your LaTeX installation is not 
functional. Another possibility is that the environment variables that 
configure things like library search paths are getting confused by your 
conda installation---LaTeX packages are typically installed system-wide, 
but conda often overrides such settings to refer instead to 
environment-specific local installations."


On 5/14/19 06:46, Halvor Fergestad wrote:


Hello again,

Some updates: I figured out that I need some sort of latex package to 
generate the plots in CrossRouter.py. I went with texlive-core which I 
downloaded using the following command


conda install -c conda-forge texlive-core

The error message that I am currently receiving is:

RuntimeError: latex was not able to process the following string:
b'$0.0$'

with the following message:

BEGIN failed--compilation aborted at 
/home/hrferge/anaconda3/envs/mpa/bin/mktexfmt line 25.

I can't find the format file `latex.fmt'!

There is no 'latex.fmt' file to be found. Is this a file I must 
generate (should be generated in run-time) or is it better to download 
a different latex package?


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

Re: [Meep-discuss] Half-ring geometry

2019-05-24 Thread Ardavan Oskooi

On 5/24/19 02:35, Nicolas Bachelard wrote:

I would like to make a ring in which I impose different optical 
indices in the "higher part" and in the "lower part". The way I 
picture it is that I need to tag together two "half-ring" geometries.


Seems this would require a material function since two adjoining half 
rings of different index cannot be constructed purely by overlapping 
various cylinder geometry objects. Note that use of a material function 
will typically require you to increase the resolution as subpixel 
smoothing is disabled by default 
.


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

Re: [Meep-discuss] Strange fields when providing geometry as a material_fct with ε and σ_D

2019-05-24 Thread Ardavan Oskooi

On 5/23/19 16:49, Hannes Kohlmann wrote:

Does the D_conductivity get ignored when it appears in the Medium(...) 
in a material_fct?



If you have a D conductivity in your material function, you will also 
need to specify this in the extra_materials 
 
parameter otherwise it will be ignored (which is what you are observing).


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

Re: [Meep-discuss] Strange fields when providing geometry as a material_fct with ε and σ_D

2019-05-24 Thread Ardavan Oskooi

On 5/23/19 16:49, Hannes Kohlmann wrote:

Does the D_conductivity get ignored when it appears in the Medium(...) 
in a material_fct?


The h5topng output looks *as if**the material was just transparent* 
(reflection and transmission) with only an epsilon=10 and no 
D_conductivity, whereas if I use just a normal Block geometry with the 
same mp.Medium (and leave away the material_fct), almost no field 
enters into the material.


The function output_epsilon only writes the *real* (and also 
frequency-independent) part of the permittivity to an HDF5 file as 
described in this FAQ 
. 
(We will update the user interface documentation to make this clear.)



For your reference, #879  
which was recently merged added two new functions — epsilon(f) and mu(f) 
— that return the complex permittivity/permeability at the frequency f 
as a 3x3 Numpy array.


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

Re: [Meep-discuss] PML in the left-handed material does not work.

2019-05-21 Thread Ardavan Oskooi

On 5/21/19 05:09, ei ru wrote:

In my simulation, the pml overlapping the left-handed material does 
not work.

The wave is not absorbed but growing.
I use drude-conductivity for mu and epsilon to make negative 
refractive index.


The field divergence for a negative-index material everywhere that you 
are observing is described in an FAQ 
:


"If you have negative ε/and/negative μ/everywhere/, the case of a 
negative-index material, then the simulation is fine. However at the 
boundary between negative- and positive-index materials, you will 
encounter instabilities: because of the way Maxwell's equations are 
discretized in FDTD, the ε and μ are discretized on different spatial 
grids, so you will get a half-pixel or so of εμ < 0 at the boundary 
between negative and positive indices, which will cause the simulation 
to diverge. But of course, any physical negative-index metamaterial also 
involves dispersion."


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

Re: [Meep-discuss] Computing Reflectance Spectra

2019-04-23 Thread Ardavan Oskooi

On 4/23/19 10:32, Ben Cerjan wrote:

The interference effects should be captured by the (complex) fields -- 
they contain both amplitude and phase information as a function of 
position (in analogy to the Huygens-Fresnel principle). In my head 
this should work, as a linear superposition of the complex fields will 
produce the total field.


As to your second point, I'm asserting that the two disks are 
sufficiently far apart that they do not couple in the near-field (a 
few hundred nm in the visible, for example). You are absolutely 
correct that if the disks are too close there is no other choice but 
to redo the full simulation.


Two (non-interacting) disks in a single "unit cell" is actually a 
supercell which gives rise to "band folding" effects as described in:


https://meep.readthedocs.io/en/latest/FAQ/#why-are-there-strange-peaks-in-my-reflectancetransmittance-spectrum-when-modeling-planar-or-periodic-structures

To obtain the "unfolded" reflectance spectra, the unit cell must contain 
just a single disk with the cell dimensions in the periodic dimensions 
defined by the lattice constant.



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

Re: [Meep-discuss] Computing Reflectance Spectra

2019-04-23 Thread Ardavan Oskooi

On 4/22/19 09:50, Ben Cerjan wrote:

I'm trying to figure out why the following two processes produce 
different results:


1) Run a simulation (following along with the tutorial for reflectance 
spectra) to generate the reflected spectrum produced by two metallic 
disks sitting on a transparent substrate at Position 1 and Position 2 
(not overlapping). The simulation volume is much larger than the 
disks, and is periodic in X/Y and finite (terminated with PML's) in Z. 
The disks sit on the Z = 0 plane (where the substrate stops) and the 
source is in the empty space above the disks and the substrate.


2) Run a simulation to generate the reflected flux from a single 
metallic disk in the center of (the same) simulation volume (again, 
actually running two simulations to normalize). Then, using 
get_dft_array, get E(freq,position) and H(freq,position). Now, 
circularly-shift (using numpy.roll) the fields so that they appear to 
have been generated at Position 1 and Position 2 before adding them 
together and then manually computing the flux (as is done in the user 
interface guide under "Array Metadata").


These two approaches produce fairly different results -- approach 1 
seems to work, but approach 2 produces the same reflectance spectrum 
as a single disk rather than a pair (after normalizing by number of 
fields added together). Intuitively, I'm not grasping why they are 
different. I would have though that adding the fields would produce 
the same spectrum as running the full simulation with the two disks, 
since the fields obey superposition (even if the fluxes do not).


Eventually, I'm planning on doing some nonlinear optimization to 
design for a particular reflectance spectrum and it is (obviously) 
much faster to use approach 2 rather than re-running the simulation 
every time I move around or add more disks.



In approach 2, how are you able to analytically account for interference 
effects produced by scattering from multiple metallic disks using the 
scattered fields from just a single disk? Assuming the two disks are 
positioned close enough to give rise to non-analytic coupling effects 
(which depends on the disks' permittivity, shape, spacing, orientation, 
etc.), it seems you have no recourse but to do the full simulation to 
compute the reflectance of an arbitrary disk array.


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

Re: [Meep-discuss] k_point influence on array sizes

2019-04-21 Thread Ardavan Oskooi

On 4/21/2019 7:13 AM, Jonathan wrote:


I just came up with a minimal test. I expected that for get_array passing
center=mp.Vector3(), size=cell_size
should be equal to omitting those parameters and the full arrays 
should be returned. Apparently, this is not true, if k_point is set. 
Here is the code:


There is already an open issue regarding this:

https://github.com/NanoComp/meep/issues/818


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

Re: [Meep-discuss] k_point influence on array sizes

2019-04-09 Thread Ardavan Oskooi

On 4/9/2019 11:07 AM, Jonathan wrote:

I realized that if I set the k_point value to simulate periodic 
setups, this changes the size of the arrays that I retrieve via 
get_array. If set, the dielectric array (scene geometry) is two cells 
bigger (e.g. 323x42 instead of 320x40) and the field components (e.g. 
ez) is one cell bigger (321x41). (My field is 1x0.125 units at a 
resolution of 320, so 320x40 is the 'right' size. I am using complex 
fields.)


Having more cells for the periodicity is somewhat plausible, but why 
are the geometry and field arrays of different size?



See the following issue for a description of what is happening 
internally that affects output when k_point is set:


https://github.com/NanoComp/meep/issues/668


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

Re: [Meep-discuss] How to normalize far-field for broadband source

2019-04-05 Thread Ardavan Oskooi

On 4/4/19 09:09, Quang Nguyen wrote:

I have reproduced the structure in MEEP and run the simulation. My 
far-field spectra has some similar features but doesn’t particularly 
match otherwise. I think it might be up to a normalization issue. Thus 
I was wondering how to properly normalize the far-field for different 
wavelengths when using a broadband source.


Normalization of the far fields will typically involve the same 
procedure used to compute the reflectance/transmittance 
, 
i.e.: (1) in an empty cell with just your sources, compute the near 
fields and save the data using get_near2far_data 
 
(or save_near2far), then (2) with your structure, compute the near 
fields but invoke load_minus_near2far_data (or load_minus_near2far) 
prior to time stepping. You then divide the far fields from (2) by those 
in (1) to obtain a fractional value less than unity. Note that we 
recently added support for periodic boundaries (#769 
).


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

Re: [Meep-discuss] set arbitrary flux direction

2019-03-13 Thread Ardavan Oskooi

On 3/13/2019 3:25 AM, Helder Carmen wrote:

I was wondering if anyone could point me in a direction to answer if 
this is possible. I found someone has asked the same question 
previously but the link that was provided with a potential answer is 
no longer active 
https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg05564.html. 
Appreciate any help.




Because of Poynting's theorem, the flux in any arbitrary direction can 
be computed using flux monitors oriented along the Cartesian directions. 
For a demonstration, see the last part of this tutorial example:


https://meep.readthedocs.io/en/latest/Python_Tutorials/Eigenmode_Source/#index-guided-modes-in-a-ridge-waveguide

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

Re: [Meep-discuss] Providing geometry as voxel-array via python

2019-02-21 Thread Ardavan Oskooi

On 2/21/2019 6:13 AM, Jonathan wrote:

the normal way to set up the scene geometry via the Python interface 
is to build it out of primitives (boxes, spheres, etc.). I however 
already have the permitivities as a 3d array. The python interface 
does not seem to provide a direct way to set them. I think it is maybe 
possible via the low level C++ interface, however I could not find any 
examples for this. What is the recommended way (considering 
robustness, performance, etc...) to do so?


You can import the permittivity as an HDF5 file (i.e., multidimensional 
array for the pixels) via the epsilon_input_file parameter as described 
in the documentation 
. See also 
this FAQ 
.


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

Re: [Meep-discuss] Far Field Flux using python flux function in 3D

2019-02-18 Thread Ardavan Oskooi

On 2/18/19 13:11, Karl-Johan Olofsson wrote:

The code finishes the time stepping but has been stuck calculating the 
far field flux for about 2 hours now for a sim cell (4,4,4) 
resolution=40 and time=5. So something seems to not be working properly.




We recently added a feature to improve the load balancing of parallel 
simulations (i.e. #681  and 
#697 ) which is particularly 
relevant for calculations involving Fourier-transformed fields such as 
those used in the near-to-far field transformation. This feature was 
part of version 1.8  released 
last week. Try setting "split_chunks_evenly=False" in the Simulation 
constructor. Currently, the default is "split_chunks_evenly=True" which 
may be suboptimal as described in this FAQ 
.


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

Re: [Meep-discuss] Gaussian beam

2019-02-12 Thread Ardavan Oskooi

On 2/12/19 04:38, Prs R wrote:

Thanks for your answer but I've got a question about the physical 
meaning of the aplitude function.  I understand that the "k" is used 
to obtain an inclination of the beam but how is the "sigma" that I 
introduce linked with pysical values like the NA and the wavelenght?


The NA for a Gaussian beam of width w ("sigma" in the script) at a 
wavelength l in air is sin(l/(πw)) as described in:


    https://en.wikipedia.org/wiki/Gaussian_beam#Beam_divergence


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

Re: [Meep-discuss] Local absorption

2019-02-11 Thread Ardavan Oskooi

On 2/11/19 07:50, Nicolas Bachelard wrote:

I am looking at a 2D-scattering problem one can see as a plane wave 
scattered by multiple absorptive rods. How can I measure the field 
absorbed in each cylinder?


Just surround each cylinder (or any local region in your cell) with a 
closed box of flux planes and use the "weight" property of the 
FluxRegion object to compute the total incoming flux. Since absorptance 
is a fractional quantity, you will need to divide the absorbed power of 
the cylinder by the total power emitted from your source.


For an example of this type of calculation, see the following tutorial 
on computing the light extraction efficiency of an organic 
light-emitting diode (OLED):


    http://www.simpetus.com/projects.html#meep_oled


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

Re: [Meep-discuss] Gaussian beam

2019-02-11 Thread Ardavan Oskooi

On 2/11/19 09:28, Prs R wrote:

I'd like to create a focused gaussian beam where I can choose the 
(numerical aperture) NA of the beam.

Is there any predefined functions to do that?


There are currently no predefined functions to define a Gaussian 
envelope but you can set this up yourself using the amplitude function 
of the source object. An example is provided for a tilted beam in the 
script below. Four snapshots of the resulting field profile for 
different values of the beam width ("sigma") and rotation angle 
("rot_angle") are shown in:


http://ab-initio.mit.edu/~oskooi/meep_discuss/gaussian_beam.png

Since this topic has come up several times before on this list (e.g., 
https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00074.html), 
we'll create a new FAQ for the documentation which will be up shortly.


-

import meep as mp
import math
import cmath
import numpy as np
import matplotlib.pyplot as plt

cell_size = mp.Vector3(20,10,0)

resolution = 40

pml_layers = [mp.PML(thickness=1.0,direction=mp.Y)]

fcen = 1.0 # center frequency of CW source

rot_angle = math.radians(20) # rotation angle of beam
k = mp.Vector3(y=1).rotate(mp.Vector3(z=1),rot_angle).scale(fcen)

sigma = 1.0 # width of beam

def gaussian_beam(sigma, k, x0):
    def _gaussian_beam(x):
    return 
cmath.exp(1j*2*math.pi*k.dot(x-x0)-(x-x0).dot(x-x0)/(2*sigma**2))

    return _gaussian_beam

src_pt = mp.Vector3(y=4)
sources = [mp.Source(src=mp.ContinuousSource(fcen, fwidth=0.2*fcen),
 component=mp.Ez,
 center=src_pt,
 size=mp.Vector3(10),
 amp_func=gaussian_beam(sigma,k,src_pt))]

sim = mp.Simulation(cell_size=cell_size,
    sources=sources,
    k_point=k,
    boundary_layers=pml_layers,
    resolution=resolution)


sim.run(until=50)

non_pml_vol = mp.Volume(center=mp.Vector3(), size=mp.Vector3(20,8,0))
ez_data = sim.get_array(vol=non_pml_vol, component=mp.Ez)

plt.figure()
plt.imshow(np.flipud(np.transpose(np.real(ez_data))), 
interpolation='spline36', cmap='RdBu')

plt.axis('off')
plt.show()


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

Re: [Meep-discuss] Is there exact form what exponential turn on mean?

2019-02-01 Thread Ardavan Oskooi

On 1/31/2019 3:16 PM, ei ru wrote:


Is there exact form of exponential turn on?

https://meep.readthedocs.io/en/latest/Python_User_Interface/#continuoussource

Is this {exp( t/width  ) - 1} (0<=t<=width) ?



See the function definition for the continuous source:

https://github.com/NanoComp/meep/blob/master/src/sources.cpp#L104-L122


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

Re: [Meep-discuss] definition of gamma in susceptibility

2019-01-30 Thread Ardavan Oskooi

On 1/30/2019 12:10 AM, ei ru wrote:


I'm confusing about the definition of gamma in susceptibility.
https://meep.readthedocs.io/en/latest/Python_User_Interface/#drudesusceptibility

In Drude susceptibility, Is gamma [number] equal to gamma_n or gamma_n 
/ 2π ?



See the following FAQ:

https://meep.readthedocs.io/en/latest/FAQ/#should-i-include-the-2-factor-when-defining-the-frequency-or-the-wavevector


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

Re: [Meep-discuss] Error while running a simple code of 1-D waveguide using MEEP on Ubuntu terminal

2019-01-29 Thread Ardavan Oskooi

On 1/29/2019 1:05 AM, Kritika Bhattacharya wrote:


It got installed as when I write $ meepit shows -
creating output file "./eps-00.00.h5"...
ERROR: In procedure %run-finalizers:
ERROR: In procedure delete-meep-volume: Wrong type argument in 
position 1: #


You are likely using an old version of Meep since you are using the 
Ubuntu package which is out of date (version 1.3 from March 2015 using 
Ubuntu 16.04 according to https://packages.ubuntu.com/xenial/meep). The 
version number can be determined using: meep --version. The error you 
are seeing is related to a garbage collection issue in SWIG which was 
fixed in July 2018 (https://github.com/NanoComp/meep/pull/419). Try 
upgrading to the latest version of Meep which requires building from 
source (https://meep.readthedocs.io/en/latest/Build_From_Source/). (The 
Meep package for Ubuntu is in the process of being updated and will 
likely appear in Ubuntu 19.10; this is based on an unstable Debian 
package: https://packages.debian.org/unstable/meep)


In general, we highly recommend using the Python interface as the Scheme 
interface is no longer being supported. You can access PyMeep via a 
Conda package which is built nightly from the latest master branch of 
the source repository. The installation is straightforward and is 
described in: 
https://meep.readthedocs.io/en/latest/Installation/#conda-packages.



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

Re: [Meep-discuss] Electric Field Intensity

2019-01-29 Thread Ardavan Oskooi

On 1/29/2019 5:38 AM, Prs R wrote:

I'm a newbie in Meep and I'm not sure I'm able to do a 2D simulation 
of the Intensity of an Electric Field. I introduce a new variable 
called "Intensity" and I set its value as:


Intensity = mp.Ez**2



This is not the correct procedure for accessing the fields data. You 
need to use the array slicing routines get_array (for time-domain 
fields) or get_dft_array (for Fourier-transformed fields). There are 
also related routines get_array_metadata and get_dft_array_metadata 
which provide information regarding the coordinates and integration 
weights of the geometric slice. These routines are all described in the 
API documentation 
(https://meep.readthedocs.io/en/latest/Python_User_Interface/#array-slices). 
For a demonstration, see the tutorial example for a straight waveguide 
(https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#a-straight-waveguide). 




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

Re: [Meep-discuss] Near-to-far-field problems

2019-01-17 Thread Ardavan Oskooi
It's possible that your results are not converged in both runs (see: 
https://meep.readthedocs.io/en/latest/FAQ/#checking-convergence). In 
your "full" simulation, you are using a continuous source and running 
for an arbitrarily run time until the fields have eventually reached 
steady state. However, note that the continuous source may still 
introduce unwanted frequencies due to the way it is being turned on. To 
mitigate this effect, trying increasing the width and/or cutoff 
parameters of the source. Also, try increasing the run time. In your 
near-field simulation, you are using a Gaussian pulse but running for an 
arbitrary run time which may be too short (see: 
https://meep.readthedocs.io/en/latest/FAQ/#for-calculations-involving-fourier-transformed-fields-why-should-the-source-be-a-pulse-rather-than-a-continuous-wave). 
You should run until the fields have sufficiently decayed away which 
again involves increasing the run time.


On 1/15/2019 10:35 PM, Shaun Lung wrote:

I'm trying to use the near to far field projection of meep. I'm 
working with a toy model of a simple double slit experiment. Using a 
full simulation (code here 
) 
I generated a 2D double slit. This looks reasonable: 
https://i.imgur.com/zynMiO2.png


However, when I generate the same area using the near-to-farfield 
capture (code here 
) 
it results in this: https://i.imgur.com/VgKNsz5.png (Real and 
imaginary components at the top and bottom respectively.) I'm aware 
that there can be a phase difference, as per the documentation, 
however, the overall relative phase should not be different, which is 
not the case here: https://i.imgur.com/NCXRSRg.png.


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

Re: [Meep-discuss] Making a magnetic dipole

2019-01-17 Thread Ardavan Oskooi

On 1/17/19 07:28, Jameson Collins wrote:


I would like to create a magnetic dipole in MEEP.  As far as I can
tell the easiest way to do this is to create a loop of current.


You can create a magnetic point dipole directly by specifying the 
component of the source to be Hx, Hz, etc. This is because Meep supports 
magnetic-charge currents as described in:


https://meep.readthedocs.io/en/latest/Introduction/#maxwells-equations

https://meep.readthedocs.io/en/latest/FAQ/#how-is-the-source-current-defined

There is no need to create a magnetic dipole indirectly by creating a 
loop of electric currents.



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

Re: [Meep-discuss] Incorrect Transmission/Reflection in 3D

2019-01-10 Thread Ardavan Oskooi

On 1/10/2019 4:38 AM, Alexander Davis wrote:

I am trying to find the reflection off of a slab with epsilon = 1.5 in 
3D as a means of honing my code for a more complicated geometry. 
However, I keep running in to a problem where the transmission I am 
getting is greater than 1. I am attaching the code that I used. Am I 
making a mistake with setting my flux planes?



See the following FAQ:


https://meep.readthedocs.io/en/latest/FAQ/#why-are-my-reflectancetransmittance-values-less-than-zero-andor-greater-than-one

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

Re: [Meep-discuss] Problem using epsilon_offdiag with load_minus_flux_data

2018-12-21 Thread Ardavan Oskooi

On 12/21/2018 12:50 PM, Ian Sage wrote:


As a matter of interest, can I now use that flag in a 1-d simulation to
access E_y field components?



Unfortunately, not: force_all_components can only be used for a 2d 
simulation.


Additional note: an anisotropic permittivity tensor with non-zero 
off-diagonal elements will automatically involve all field components 
and there is no need to set force_all_components explicitly. Thus, in 
your flux calculation example, it's only in your normalization run 
involving an empty cell that you need to set this parameter.



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

Re: [Meep-discuss] Problem using epsilon_offdiag with load_minus_flux_data

2018-12-21 Thread Ardavan Oskooi
You will need to add "force_all_components=True" to your Simulation 
constructor in order to force Meep to use all field components in a 2d 
simulation. By default, Meep uses only one of the two sets of orthogonal 
polarizations, ie., TE/TM or S/P, depending on your current source. This 
flag was only recently added in #631 
(https://github.com/stevengj/meep/pull/631) so you will need to update 
to the latest build from the master branch. Documentation for this 
feature is currently missing and will be added to the manual shortly.



On 12/21/18 9:45 AM, Ian Sage wrote:

I have been trying to examine the reflection of light from a
(semi-infinite) birefringent slab, and encounter a problem when the
optic axis is rotated, giving non-zero entries in epsilon_offdiag. Under
this condition, the program fails at the load_minus_flux_data command,
with the error message:

     meep: Total dft_chunks size does not agree with size allocated for
output array.

emitted by each thread. The fairly minimal example attached, shows this
problem.

The error can be cleared by un-commenting line 29 (to set the optic axis
rotation to zero) or line 39 (to artificially set epsilon_offdiag to
zeros) or by commenting out line 70 (to avoid calling
load_minus_flux_data). In the latter case, sensible results are given by
performing the flux subtraction manually, outside meep.

Am I doing something wrong, or is this a tiny bug?

Many thanks for any help, and best wishes to all for the holiday,

Ian


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

Re: [Meep-discuss] Virtual Instance: Cannot launch Meep simulations using Python 3 from the default Bash terminal

2018-11-19 Thread Ardavan Oskooi

On 11/19/18 6:48 AM, Peyyety, Naga Anirudh (INT) wrote:



But this results in anImportError: No module named meep.



The Meep Python module cannot be found because the PYTHONPATH 
environment variable is empty (it should be 
"/usr/local/lib/python3.5/site-packages"). This variable is defined in 
the customized default Bash script file /home/ubuntu/.bashrc (note: the 
default login user for the Simpetus AMI is ubuntu). However, you have 
created a new user "nanocarbon" which has a different and uncustomized 
.bashrc file that does not include this environment variable. Add the 
following line to your .bashrc file or run directly from the shell 
command line:



    export PYTHONPATH="/usr/local/lib/python3.5/site-packages"

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

Re: [Meep-discuss] Prism will not extend to negative z values

2018-11-15 Thread Ardavan Oskooi
Turns out this is a bug; thanks for catching this. I have filed a bug 
report: https://github.com/stevengj/meep/issues/608. Should be fixed soon.




On 11/15/18 10:27 AM, Alexander Davis wrote:


Hi All,


I am trying to define a prism object in addition to a few blocks. No 
matter what I set my z-values as for the vertices, the prism will only 
ever take up half of the domain. I am attempting to set the prism face 
at the bottom of the domain and have it extend to the top of the 
domain. Has anyone ever had this problem/know how to fix it?



Code:


(set! geometry (list
(make block                         ; upper lamina
(center 0 0 0)
(size ult sy sz)
(material (make medium (epsilon refr
(make block                         ; hole 1
(center 0 0 0)
(size ult ywid zwid)
(material (make medium (epsilon 1
(make block                         ; hole 2
(center 0 0 (- (+ zwid crt)))
(size ult ywid zwid)
(material (make medium (epsilon 1
(make block                         ; hole 3
(center 0 0 (+ zwid crt))
(size ult ywid zwid)
(material (make medium (epsilon 1
(make block                         ; lower lamina
(center (- (+ ild llt)) 0 0)
(size llt sy sz)
(material (make medium (epsilon refr
(make prism                         ; One of the ridges
(vertices
 (list
  (vector3 (* 0.5 ult) (* 0.5 sy) -5)
    (vector3 (+ rh (* 0.5 ult)) (- (* 0.5 sy) 0.13) -5)
    (vector3 (+ rh (* 0.5 ult)) (- (* 0.5 sy) 0.23) -5)
    (vector3 (* 0.5 ult) (* 0.5 ywid) -5)))
                                  (height (* 50 sz))
                                  (center (vector3 0 0))
                                  (material (make medium (epsilon 
refr))
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] Prism will not extend to negative z values

2018-11-15 Thread Ardavan Oskooi

On 11/15/18 10:27 AM, Alexander Davis wrote:

I am trying to define a prism object in addition to a few blocks. No 
matter what I set my z-values as for the vertices, the prism will only 
ever take up half of the domain. I am attempting to set the prism face 
at the bottom of the domain and have it extend to the top of the 
domain. Has anyone ever had this problem/know how to fix it?




As explained in the documentation 
(https://meep.readthedocs.io/en/latest/Scheme_User_Interface/#prism), 
the center property of a prism object should be ignored. (Note: this is 
not the case in the Python interface: 
https://meep.readthedocs.io/en/latest/Python_User_Interface/#prism). 
Thus, it seems that this could be a bug where the center property which 
you have defined as (0,0,0) is being used somehow internally in the 
prism definition. What happens when you remove the center property in 
the prism definition?


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

Re: [Meep-discuss] Multilevel-Atomic Susceptibility Units Question

2018-11-14 Thread Ardavan Oskooi

On 11/14/2018 9:57 AM, Priscilla Kelly wrote:

I am working off of this: 
https://meep.readthedocs.io/en/latest/Scheme_Tutorials/Multilevel_Atomic_Susceptibility/


I was wondering why the emission frequency, having units of 2πc/a has 
the 2πin the denominator in the example?
(define freq-21 (/ omega-a (* 2 pi))); emission frequency  (units of 
2πc/a)


For your reference, the units of the various terms as well as a 
description of the underlying update equations for the multilevel atom 
susceptibility are discussed elsewhere in the documentation:


https://meep.readthedocs.io/en/latest/Materials/#saturable-gain-and-absorption

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

Re: [Meep-discuss] EPS averaging affecting harminv mode search and mode distribution

2018-11-13 Thread Ardavan Oskooi

On 11/13/2018 3:58 AM, Chee Fai wrote:

I found that, with eps averaging on, harminv would still work when the 
resolution is at 42. However, harminv would fail when the resolution 
is increased to 44 (originally 40). Also, the mode field output is 
completely off.




For your reference, we recently added a new FAQ on finding resonant 
modes using Harminv:



https://meep.readthedocs.io/en/latest/FAQ/#harminv-is-unable-to-find-the-resonant-modes-of-my-structure



I would appreciate it if you could consider the following feature 
requests:



1) Independent resolution for different axes:



Providing support for non-uniform resolutions would be a major 
undertaking and one is which not part of our near-term plans. It is 
possible using transformation optics to vary the spatial resolution 
without any changes to the underlying code. This is described in the 
notes linked to in this FAQ:



https://meep.readthedocs.io/en/latest/FAQ/#does-meep-support-a-non-uniform-grid 





2) Cylinder with major and minor axes / an elliptical cylinder



There is already an Ellipsoid object with these properties which is 
described in the documentation: 
https://meep.readthedocs.io/en/latest/Python_User_Interface/#geometricobject.


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

Re: [Meep-discuss] The Meep logo

2018-11-09 Thread Ardavan Oskooi

On 11/8/2018 11:38 PM, John Weiner wrote:

The Meep logo, e.g. on the first page of readthedocs, 
https://meep.readthedocs.io/en/latest/, shows a clock face set to 18 
minutes past 8 o’clock.  Does anyone know the origin and meaning of 
this logo?


The time shown on the Meep clock is a reference to two academic 
departments at MIT which are based on a numbering system: 8 (Physics) 
and 18 (Mathematics). These departments are home to the research groups 
of John Joannopoulos and Steven Johnson in which Meep originated. The 
logo was created by Steven Johnson.


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

Re: [Meep-discuss] EPS averaging affecting harminv mode search and mode distribution

2018-11-05 Thread Ardavan Oskooi
Finding resonant modes using harminv is a topic that has come up 
numerous times on this mailing list:


https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg02636.html

https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00683.html

https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00592.html

https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00540.html

https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00594.html

___
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 1.6.0 with Singularity?

2018-11-04 Thread Ardavan Oskooi

On 11/4/18 7:53 PM, Priscilla Kelly wrote:

I wanted to use MEEP v1.6.0 on a supercomputing resource I have access 
to, but it is not registering the multilevel-atom variable.


The Meep 1.6.0 tarball, which was released on September 7, does not 
include support for multilevel atomic susceptibility. This is because 
this feature was merged into the source repository on September 13 (see: 
https://github.com/stevengj/meep/pull/500).


To obtain access to this feature, you have two options:

    (1) build from source: 
https://meep.readthedocs.io/en/latest/Build_From_Source/


    (2) install the nightly-built Conda package: 
https://meep.readthedocs.io/en/latest/Installation/#nightly-builds


The second approach is more straightforward and less error prone.

In general, the manual on ReadTheDocs is only for the master branch of 
the source repository. We do not currently provide different versions of 
the manual for the various stable releases.



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

Re: [Meep-discuss] Comparing Poynting-Flux from get_fluxes with time-average

2018-10-25 Thread Ardavan Oskooi


On 10/23/18 9:03 AM, Karl-Johan Olofsson wrote:
I am comparing the flux of the whole simulation cell using 
meep.get_fluxes with the far-field flux out from a sphere with a 
radius much larger than the length of the sim. cell. However, I get a 
complete mismatch of the flux values where I believe they should be 
close to same and I can't figure out the error.



Note that the far fields are computed from the near fields using an 
analytic transformation involving the Green's function (i.e., the far 
field at a single point in space will consist of contributions from all 
the related near fields weighted by the equivalent surface current at 
that point; for details, see Section 4.2.1 of our book chapter: 
https://arxiv.org/abs/1301.5366). Thus, there is not a simple scaling 
relationship between the near and far fields which is why their flux 
values are different.


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

Re: [Meep-discuss] Import materials.py

2018-10-08 Thread Ardavan Oskooi

On 10/08/2018 01:27 AM, John Weiner wrote:

This is the entry that is imported into my simulation.  The 
“metal_range” entry shows that the valid frequency range corresponds 
to a wavelength range from 200nm to 12.4um.  However, when I run a 
series of simulations, starting at an input wavelength of 200nm 
(0.2um), I get the following runtime warning:


Is it possible that you are using a Gaussian source where the center 
frequency corresponds to a wavelength of 0.2 um and has a non-zero 
frequency width? This would involve fields with wavelengths below 0.2 um 
which would trigger the warning.


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

Re: [Meep-discuss] Bloch periodicity with conserved k_x and changing lattice vector

2018-10-04 Thread Ardavan Oskooi

On 10/4/2018 2:36 PM, Christoph Kleinhans wrote:


I would like to change a_x depending on the number of translations, f.i.

epsilon(r) = epsilon(r + n * a_x * f(n))


Is this the right approach for simulating a periodic structure where 
the holes in the lattice are getting smaller? Is it possible to 
implement this in py-meep?


This is possible. See the following example involving a nanobeam cavity 
where the periodicity of the unit cell is tapered to create a high-Q 
defect mode:


http://www.simpetus.com/projects.html#meep_cavity
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] Comparing power from a far field with total power flux

2018-09-19 Thread Ardavan Oskooi
On 09/19/2018 05:48 AM, Karl-Johan Olofsson wrote:

I am interesting in comparing the power flux through a far field with the
total radiated power from the simulated structure. However, reading the
documentation it seems that the scaling of the far fields are not the same
as the "close" fields. So is it even possible to look at the ratio of the
power flux through a far field and the power flux through the entire
structure?

My solution is the following. After the simulation is finished I calculate
the Poynting-vector for each point in the far field and then perform a
Riemann sum over the area to get the total flux through that far field.
Then I compare that to the total power flux out from the stucture with the
add.flux and get.flux function. Is this the correct way to go or am I lost?
Any guidance would be greatly appreciated.


We have an open PR to compute the Poynting flux of the far fields (
https://github.com/stevengj/meep/pull/27). However, this PR is out of date
and needs to be updated before it can be merged. In the meantime, you can
compute the Poynting flux of the fields yourself in post processing which
is straightforward (remember to do a normalization run first to compute the
incident flux). Note, in case it may be relevant, that similar to the
load_minus_flux routine which is used to compute the reflectance, there is
a load_minus_near2far routine for near2far calculations.

If you are interested in computing the power radiated in a given direction,
consider instead using the mode decomposition feature which is more
efficient for these types of calculations. For a demonstration, see this
tutorial example for planewaves:


https://meep.readthedocs.io/en/latest/Python_Tutorials/Mode_Decomposition/#diffraction-spectrum-of-a-binary-grating
___
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-1.5 does not install from git clone

2018-08-03 Thread Ardavan Oskooi

On 08/03/2018 01:31 AM, John Weiner wrote:

Yesterday I discovered the meep releases page on GitHub, 
https://github.com/stevengj/meep/releases.


Note that since new features and bug fixes are being merged into the 
master repository weekly, the released tarballs tend to become out of 
date rather quickly. The Conda packages are built nightly and provide 
access to the latest experimental features without the challenges of 
building from source:


http://meep.readthedocs.io/en/latest/Installation/#nightly-builds

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

Re: [Meep-discuss] Link of simulation result to Fourier propagation

2018-07-19 Thread Ardavan Oskooi

On 07/19/2018 03:34 AM, - wrote:


I wondered if anybody could point me to a way in which I could use the
output of a meep simulation, to obtain a scalar electric field, which
I could propagate over longer distance using Fourier optics, or in the
far field even switch to a raytracing simulation.  I expect, that one
has to make certain assumptions (e.g. about the propagation direction)
etc. Has this mixed modelling been done?


The input to ray-tracing tools (e.g., LightTools, FRED, Zemax, etc.) is 
typically the bidirectional scattering distribution function (BSDF): for 
an input planewave at a given wavelength and angle of incidence, compute 
the reflectance (BRDF) and transmittance (BTDF) over a range of angles 
(e.g., -90 to +90 degrees). The BSDF can be computed in Meep via the 
mode-decomposition feature as demonstrated in this tutorial example for 
the BTDF:


https://meep.readthedocs.io/en/latest/Python_Tutorials/Mode_Decomposition/#diffraction-spectrum-of-a-binary-grating

Note that you will need format the BSDF data in a way that is readable 
by the ray-tracing tool as each tool has its own unique convention for 
importing such data.


Another approach for obtaining the far field directly is to use Meep's 
near2far feature as demonstrated in this tutorial example:


http://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/



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

Re: [Meep-discuss] Qestion about material library

2018-07-19 Thread Ardavan Oskooi

On 07/18/2018 12:04 PM, Vince Lee wrote:


Thank you so much for your reply. So if I use the Li 1980 reference for 1.2-1.4 
um, which is in the transparent range, I should download the data and fit the 
Sellmeier coefficients, but I'm still not very clear how to convert that to 
Lorentz form.


You will need to use nonlinear optimization to fit the data as described 
in the FAQ:


http://meep.readthedocs.io/en/latest/FAQ/#how-do-i-import-n-and-k-values-into-meep


On a separate account, I tried to load the default material library and got the 
following warning message,

from materials_library import Si,SiO2
meep/geom.py:175: RuntimeWarning: Epsilon < 1 may require adjusting the Courant 
parameter. See the 'Numerical Stability' entry under the 'Materials' section of 
the documentation
   warnings.warn(eps_warning, RuntimeWarning)

why would epsilon be <1 for these 2 materials?


This is because the entire materials library, which includes other 
materials with epsilon < 1, was being executed during the import. This 
issue has been recently fixed via https://github.com/stevengj/meep/pull/426.




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

Re: [Meep-discuss] Qestion about material library

2018-07-18 Thread Ardavan Oskooi

On 07/18/2018 10:47 AM, Vince Lee wrote:


I'm new to Meep. I've installed pymeep and I'm running some of the tutorial examples. I 
have a question about the material library mentioned here 
(https://meep.readthedocs.io/en/latest/Materials/). The material library 
(https://github.com/stevengj/meep/tree/master/python/examples/materials_library.py) has 
Silicon but it only covers a wavelength range of 1.36 - 11 um, which misses the 1~1.4 
um range I'm interested in. From the reference website 
https://refractiveindex.info/?shelf=main&book=Si&page=Salzberg there're many 
other models that covers that range, but I don't know how to get the necessary 
parameters to build the Lorentzian susceptibility profile of my own.



The fitting parameters in the materials library are all based on 
published references. Silicon has an indirect bandgap at approximately 
1.12 eV (wavelength of 1.1 um) at T=300K which makes fitting to a 
Drude-Lorentz susceptibility profile particularly challenging (the 
complex part is nearly negligible over a broad bandwidth). Note that the 
Salzberg reference included in the materials library is based on the 
Sellmeier coefficients which is valid for only a real permittivity and 
can be readily converted into Drude-Lorentz form by setting γ=0.


Perhaps you can find a reference which has the fitting parameters over 
the missing wavelength range or try doing the fit on your own?



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

Re: [Meep-discuss] LD for n'k data

2018-07-02 Thread Ardavan Oskooi

On 07/02/2018 09:19 PM, Saurav Kumar wrote:

I'm trying to find LD parameters of GaAs for the solar spectrum from 
0.2um to 1.2um. I'll be glad if you can share the code.


It would be good to find a published reference which contains the 
Drude-Lorentz fit for GaAs in the visible range which we can add to the 
materials library.


Unfortunately, GaAs has several nonlinear features in both the real and 
imaginary part of its permittivity in the visible regime which make 
fitting particularly challenging:


https://refractiveindex.info/?shelf=main&book=GaAs&page=Jellison

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

Re: [Meep-discuss] h5topng: Make perfect conductor visible

2018-06-28 Thread Ardavan Oskooi

On 06/28/2018 02:25 AM, Hannes Kohlmann wrote:



When I perform a simulation with a perfectly conducting block, I 
cannot see this object when using these colormaps with the 
same parameters. Is the perfect conductor an eps=-1e20? Then I guess 
that may be the reason. What would be the best way to output this 
block, for example in grey?




h5topng has a -m flag which can be used to set the bottom of the color 
scale to a given value. Similarly, there is a -M flag to set the top of 
the color scale.


More generally, note that Meep only outputs the real, 
frequency-independent part of ε and μ to an HDF5 file. We will soon add 
a new routine to output the frequency-dependent part.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] formula to convert unit from si to meep unit for d-conductivity

2018-06-27 Thread Ardavan Oskooi

On 06/27/2018 10:29 AM, zigen 37 wrote:


I found the formula from
_https://meep.readthedocs.io/en/latest/Materials/#conductivity-and-complex_
,but I cannot see which one is correct.
σ_D=(a/c)*(σ/ε_r)*ε_0
              or
σ_D=(a/c)*(σ/ε_r *ε_0)




The second formula is correct where the relative permittivity multiplies 
the vacuum permittivity.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

[Meep-discuss] Meep 1.5 released

2018-06-07 Thread Ardavan Oskooi
A new version of Meep has been released. This requires a new version of 
Libctl which has also just been released.


The main new Meep features are mode decomposition, slices of 
Fourier-transformed fields, prism geometric objects, and structure 
dump/load. There is also a new Python interface to MPB.


The source repository and documentation are available at: 
https://github.com/stevengj/meep. Please use GitHub to file bug reports 
and feature requests.


Cordially,
Ardavan Oskooi

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

Re: [Meep-discuss] Additional negative peak due to incident angle

2018-05-18 Thread Ardavan Oskooi
It is possible that you are not running for long enough and thus the fields 
have not yet fully converged. Try reducing the tolerance in the 
stop_when_fields_decayed run function or simply increase the run time.

For reference, see this new tutorial example on computing the angular 
reflectance spectrum of a planar interface:

http://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/#angular-reflectance-spectrum-of-a-planar-interface


> On May 18, 2018, at 6:22 AM, Christoph Kleinhans  
> wrote:
> 
> Hello Meep users,
> 
> using the Python interface, I simulate a scatter-problem with PML in 
> y-direction and a grating with periodic boundary conditions in x-direction. 
> The periodic structure is made of silver.
> 
> The distance between source and scatterer is high enough to not influence the 
> LDOS at the source location. Also the padding between scatterer and PML is 
> high enough.
> 
> My target is to measure the reflectance by letting a p-polarized plane wave 
> propagating in different angles (from 10 to 35 degree) on the scatterer and 
> then plot the reflectance over the angles. Right now I am doing for every 
> degree a simulation without scatterer (for normalisation) and with the 
> scatterer.
> 
> Between 10 and 20 degree the measured reflectance looks good and almost 
> matches the measured reflectance of a component build at the university 
> laboratory (I am using the specifications of that component to verify the 
> simulation set up).
> After 20 degree to 35 degree the reflectance get messed up (see attachment if 
> you like). At 25 degree the reflectance drop off, but it should be about 1, 
> the same at 33 degree.
> 
> I use the plane wave amp function build by Steven G Johnson with specifying 
> the kdir-vector for the incident angle (math is m and cmath is cm).
> 
> wavelength = 0.6328
> fcen = 1/wavelength
> df = wavelength
> phi_pw = (2*m.pi/360)*rot_degree
> 
> def pw_amp(k, x0):
> def _pw_amp(x):
> return cm.exp(1j * k.dot(x + x0))
> return _pw_amp
> 
> kdir = mp.Vector3(m.sin(phi_pw), m.cos(phi_pw))
> k = kdir.unit().scale(2 * m.pi * fcen)
> sources = [mp.Source(mp.GaussianSource(fcen, fwidth = df),
> component = mp.Hz,
> center = mp.Vector3(0,0.4*y),
> size = mp.Vector3(x,0),
> amp_func=pw_amp(k, mp.Vector3(y = 0.4*y)))]
> 
> 
> Now it is not exactly like the pw-example by Steven G Johnson. I have only 
> ONE source at the +y boundary. In my Simulation the computational cell got 
> the size of x = 0.8 and y = 2.2 (without PML) and I don’t know how exactly I 
> can implement the pw source with two interfer sources like this:
> https://github.com/stevengj/meep/blob/master/python/examples/pw-source.py
> 
> Can please anyone help me to set up my source so in the cell to get the right 
> incident angles.
> 
> Best Regards
> Christoph
> 
> 
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] When does meep *not* perform subpixel averaging?

2018-04-09 Thread Ardavan Oskooi

On 04/09/2018 07:40 PM, Derek Kita wrote:



(1) If I specify my material geometry via "epsilon_input_file", does 
meep perform subpixel averaging after input and before simulation?

(2) Under what situations does subpixel averaging not occur?


By default, Meep always performs subpixel averaging. In the Scheme 
interface, the only case in which subpixel smoothing is automatically 
turned off is when perfect electric or magnetic conductors are present. 
For reference, see scheme/structure.cpp#L749-751 
 
in the source repository. In the Python interface, subpixel averaging is 
always on (currently).


Note that you can manually turn off subpixel smoothing, which is only 
valid for lossless dielectrics, via the eps_averaging (Python) or 
eps-averaging? (Scheme) boolean variable. More details are provided in 
this FAQ 
 
of the documentation.


We recently added a new feature to dump/load the grid permittivity 
to/from a file. This way, you don't have to run subpixel averaging every 
time if all you are doing is just changing the sources, monitors, etc. 
See PR #261  ("structure 
dump/load functions") on GitHub as well as PR #266 
 ("Add load_structure and 
dump_structure with test") for an example. Documentation for this 
feature will appear shortly.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] Documentation of use_output_directory

2018-03-25 Thread Ardavan Oskooi

On 03/25/2018 03:13 PM, Ian Sage wrote:


In the Python Tutorial/Basics documentation, it says:

Instead, we can add the following command to run:
mp.use_output_directory()

but my attempts to use the command in this way (as a clause in the
sim.run command) have been unsuccessful. Everything is fine if I do:

sim.use_output_directory()

outside the run command. The account of the command in the Python user


Thanks for pointing this out. This is a typo in the documentation which 
will be fixed shortly.


Note that the documentation, which is in markdown format, is part of the 
source repository . 
This means that you can submit changes by creating a Pull Request on GitHub.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] export fourier transform fields by (ab)using near2far?

2018-03-21 Thread Ardavan Oskooi

On 02/28/2018 06:27 AM, Steve Byrnes wrote:

I want to calculate the E-field at a certain frequency on a surface. 
As far as I can tell, this feature is not implemented ...


We recently added an output_dft 
 
routine which writes the Fourier-transformed fields to an HDF5 file. An 
example is provided in the new frequency-domain solver 
 
tutorial.


We will soon add a routine (get_dft_slice) to access these fields 
directly without having to write to a file.


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

Re: [Meep-discuss] eigenmode-source recall

2018-03-18 Thread Ardavan Oskooi

On 03/18/2018 03:07 PM, wjasiewi wrote:

Would You , please, explain me is any procedure (or in near future) 
enabling the user
to recall and launch once computed eigenmode field in subsequent runs 
in the same structure?


There is no way to do this currently but we do have plans to add support 
for importing the source amplitude from an HDF5 file. In this case, the 
input file for the eigenmode can be generated either directly using the 
mode-solver MPB or using Meep's new output routine for the 
Fourier-transformed fields . 
Expected release is late 2018. We also want to eventually support 
importing fields from other solvers/methods, e.g., ray tracing, finite 
element, etc.


Also, we will soon enable outputting the raw permittivity data from the 
Yee grid which will be able to be read back into Meep via an extension 
of the epsilon_input_file parameter. This way, the sub-pixel smoothing 
can be performed just once for a given structure (since it can be 
computationally expensive) and the permittivity values reused.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] units of python-meep

2018-03-17 Thread Ardavan Oskooi

On 03/17/2018 11:39 AM, xxh...@gmail.com wrote:

Additionally, I noticed that there is a materials library 
(materials_library.py) where I can find the epsilon functions for some 
common materials. In that file, they made the conversion of eV to 1/um:


eV_um_scale = 1/1.2398

If I want to import materials from this file, and want to set a = 100 
nm, do I need to change the conversion as well? (i.e. eV_100nm_scale = 
1/12.398)




That's correct. For a unit distance of 100 nm, you will need to modify 
the scaling parameter as follows: eV_um_scale = 0.1/1.23984193. This is 
explained in the documentation 
.


Make sure that you make this change directly to the materials library 
file. If you set this parameter in your Python script after importing 
the materials library, it will have no effect.


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

Re: [Meep-discuss] epsilon_input_file and anisotropy

2018-03-13 Thread Ardavan Oskooi

On 03/13/2018 09:16 AM, Jisha C P wrote:

I am trying to use epsilon_input_file in PyMeep to define an arbitrary 
anisotropic geometry. But as per the document the HDF5 file can have 
only one dataset corresponding to a scalar dielectric function.


As described in the documentation 
, only the 
scalar, real-valued, frequency-independent dielectric function over some 
discrete grid can be imported using the epsilon_input_file. Anisotropic 
materials (i.e., those with a tensor permittivity), are not currently 
supported.
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] epsilon-input-file format?

2018-02-27 Thread Ardavan Oskooi

On 02/27/2018 05:12 PM, Priscilla Kelly wrote:


I am trying to input a specialized complex permittivity using an HDF5 file 
using epsilon-input-file but I have run into problems with how the data needs 
to be represented. I have frequency data and


Currently, only frequency-independent, real-valued permittivities can be 
imported as an HDF5 file. In general, since Meep is a time-domain 
solver, the only way to model frequency-dependent complex permittivites 
is by fitting the data to a Drude-Lorentzian susceptibility profile 
. 
Note that we recently added a materials library 
 for 
11 metals commonly used in optoelectronic devices. For narrowband or 
frequency-independent calculations involving complex epsilon, you can 
instead specify the conductivity 
 
(to speed up these kinds of calculations, you may want to consider using 
Meep's frequency-domain solver 
). 

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

Re: [Meep-discuss] A strange result of trans. and refl. calculation

2018-02-23 Thread Ardavan Oskooi
Since you are modeling a flat/planar structure, you will need to use a 
1d computational cell. The 2d cell you are using is a supercell which 
introduces unwanted additional modes due to band folding (for more 
details, see Section 4.6 of our book chapter 
). Note that a 1d cell in Meep must be 
along the z direction with only the Ex and Hy field components 
permitted. This is explained in the documentation 
 (under the 
description for the "dimensions" variable).



On 02/23/2018 02:29 PM, Hirokazu Ishida wrote:

Hello meep users,

I tried to calculate the transmittance and reflectance of glass 
(eps=2.25). However, the result was strange; the resulting 
transmittance and reflectance were fluctuated according to the 
frequency as the figure in the link below.

https://drive.google.com/open?id=16aHzipAuuyIyyuambuQU2J_5fcwnpSSF

So, I would be grateful if someone would point out my mistakes in my 
script or some misunderstandings.


The simulation space has PMLs at the both Y+ and Y- sides, and two 
flux-regions: "trans" and "refl" are attached on these PMLs (Y+ and 
Y-, respectively). Note that there is periodic boundary conditions. To 
subtract the direct incident to the "refl" flux-region, I did two 
simulations with and without the glass. The illustration of the 
configuration is available in the following URL.

https://drive.google.com/open?id=1c5oqaMfG9UpIIzhrCRQ7nZVhxRNiIQU-


As for the scheme script, please see the following.

;- 


; test.scm
;-(define-param 
obj? 1)

(set-param! resolution 30)
(define-param sx 4)
(define-param sy 8)
(define-param dpml 1)
(set! geometry-lattice (make lattice (size sx (+ sy (* 2 dpml)) 
no-size)))

(set! k-point (vector3 0 0 0))
(set! pml-layers (list
  (make pml (thickness dpml)(direction Y)(side Low))
  (make pml (thickness dpml)(direction Y)(side High
(if (= obj? 1)
    (set! geometry (list
        (make block (center 0 1) (size sx 2)
      (material (make dielectric (epsilon 2.25)))
(define-param fcen 1.0)
(define-param df 0.6)
(define-param fnpont 101)
(define-param src-cmpt Ex)
(set! sources (list (make source
    (src (make gaussian-src (frequency fcen) (fwidth df)))
    (center 0 -2)
    (size sx 0 0)
    (component src-cmpt
(define trans
    (add-flux fcen df fnpont
    (make flux-region (center 0 (* 0.5 sy)) (size sx 0
(define refl
    (add-flux fcen df fnpont
    (make flux-region (center 0 (* 0 -0.5 sy)) (size sx 0) (weight -1
(if (= obj? 1) (load-minus-flux "refl-flux" refl))
(run-until 200)
(if (= obj? 0)(save-flux "refl-flux" refl))
(display-fluxes trans refl)
;- 

;- 



To run the code, please hit the following:
meep obj?=0 test.scm
meep obj?=1 test.scm | tee a.out
grep flux1: a.out>a.csv


To plot the result please use the following matlab script:

%-- 

%-- 


filename  = 'a.csv'; fid = fopen(filename);
data = [];
while ~feof(fid)
    tline = fgetl(fid);
    C = strsplit(tline);
    add_tmp = [str2double(C(2)); str2double(C(3)); str2double(C(4))]';
    data = [data; add_tmp];
end
fclose all;
f = data(:,1);
trans = data(:,2)./(data(:,2)+data(:,3));
ref = data(:,3)./(data(:,2)+data(:,3));
plot(f, trans, 'r', f, ref, 'b');
legend('Trans.', 'Refl.'); xlabel('frequency');
set( gca,'FontSize',16 );
xlim([0.7, 1.3]), ylim([0 1]);
%--- 

%-- 



Best,
Hirokazu Ishida


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

Re: [Meep-discuss] Photonic crystal band structure code

2018-02-22 Thread Ardavan Oskooi

On 02/21/2018 11:22 PM, Daewoong Hwang wrote:
I am a new user in meep and want to plot band diagram of photonic 
crystal (PHC) in meep.


MPB  is better suited then 
Meep/FDTD for band structure calculations of lossless dielectrics, 
particularly for periodic systems with nonorthogonal unit cells (i.e., 
triangular lattices). For a discussion regarding the differences between 
frequency-domain and time-domain methods, see the relevant section in 
the Introduction  of 
the MPB documentation.


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

  1   2   >