Open oskooi opened 5 years ago
I think you have to use no-size
instead of 0
for the z
in (make lattice ...)
for it to reduce to 2d.
Using no-size
instead of 0
does fix the issue. However, the 2d (via no-size
in z
) and 3d (via 0
in z
) simulations produce nearly identical results when the cell size in the y
direction is large, e.g. > 10
. It is only when the y
cell size is small (in the example above it was 0.1
) that the discrepancy appears.
Thus, in order to resolve the ambiguity of whether to use 0
or no-size
and to make the Scheme interface consistent with Python which does not have a no_size
keyword, it might be appropriate to remove the no-size
keyword from Scheme.
The following Scheme script involves computing the flux from a line source in an empty 2d cell with periodic boundaries set via
k-point
. This is expected to be a 2d simulation but in fact turns out to be a 3d simulation as demonstrated by its output.Scheme Script
Output
Note that the large flux values indicate that the fields have blown up.
The bug is fixed only when the dimensionality is explicitly defined via
(set! dimensions 2)
before therun
statement.Output using (set! dimensions 2)
The analogous Python script which does not require the dimensionaliy to be explicitly defined yields a 2d simulation with identical results for the flux.
Python Script
Output
Note that the Python script is nearly three times faster than its correctly-functioning Scheme counterpart.