On 10/26/2017 03:41 PM, Steven G. Johnson wrote:

That's not correct.  No synchronization is required for second-order accuracy when accumulating the Fourier transforms.   (i.e. synchronization in add-flux is both expensive and unnecessary.)

In the Fourier summation, you multiply the field by exp(iωt) and add the product (times Δt) to the Fourier amplitude.  The value of "t" is simply different for the E and H fields (because they are staggered in time by half a timestep).

Steven is right and the flux convergence is indeed second-order accurate in time.

To verify this, we can make a plot of the relative error in the flux as a function of the temporal resolution using the waveguide bend example <http://meep.readthedocs.io/en/latest/Scheme_Tutorials/Basics/#transmission-spectrum-around-a-waveguide-bend> from the documentation (examples/bend-flux.ctl <https://github.com/stevengj/meep/blob/master/examples/bend-flux.ctl> file from the source repository). Since the temporal and spatial resolution are linked in FDTD via the Courant stability factor <http://meep.readthedocs.io/en/latest/Introduction/#finite-difference-time-domain-methods>, we just need to sweep the spatial resolution over a large enough interval as follows:

for res in {10,20,40,80,160}; do
    meep no-bend?=true resolution=${res} nfreq=1 bend-flux.ctl;
    meep no-bend?=false resolution=${res} nfreq=1 bend-flux.ctl |grep flux1: |cut -d , -f3- >> flux_scaling.dat;
done;

From the data, we then create a log-log plot in Octave/Matlab of both the reflection and transmission from the waveguide bend as a function of the temporal resolution:

> dx = [ 10 20 40 80 160 ];
> S = 0.5; dt = S./dx;
> flux = load('flux_scaling.dat'); flux = abs(flux);
> loglog(dt(1:end-1),abs(flux(1:end-1,1)-flux(end,1))/flux(end,1),'bo-',dt(1:end-1),abs(flux(1:end-1,2)-flux(end,2))/flux(end,2),'ro-',dt(1:end-1),1./dx(1:end-1).^2,'k-');

The plot <http://ab-initio.mit.edu/%7Eoskooi/meep_discuss/flux_time_convergence.png> shows that the flux is converging quadratically with the temporal resolution.
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to