`add_force(fcen, df, nfreq, freq, ForceRegions, decimation_factor=0)` ##sig Add a bunch of `ForceRegion`s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transforms
(self, *args, **kwargs)
| 3380 | near2far.scale_dfts(complex(-1.0)) |
| 3381 | |
| 3382 | def add_force(self, *args, **kwargs): |
| 3383 | """ |
| 3384 | `add_force(fcen, df, nfreq, freq, ForceRegions, decimation_factor=0)` ##sig |
| 3385 | |
| 3386 | Add a bunch of `ForceRegion`s to the current simulation (initializing the fields |
| 3387 | if they have not yet been initialized), telling Meep to accumulate the appropriate |
| 3388 | field Fourier transforms for `nfreq` equally spaced frequencies covering the |
| 3389 | frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily |
| 3390 | spaced frequencies. Return a `force`object, which you can pass to the functions |
| 3391 | below to get the force spectrum, etcetera. To reduce the memory-bandwidth burden of |
| 3392 | accumulating DFT fields, an integer `decimation_factor` can be specified for updating the DFT |
| 3393 | fields at every `decimation_factor` timesteps. If `decimation_factor` is 0 (the default), |
| 3394 | this value is automatically determined from the |
| 3395 | [Nyquist rate](https://en.wikipedia.org/wiki/Nyquist_rate) of the bandwidth-limited |
| 3396 | sources and this DFT monitor. It can be turned off by setting it to 1. Use this feature |
| 3397 | with care, as the decimated timeseries may be corrupted by |
| 3398 | [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies. |
| 3399 | """ |
| 3400 | args = fix_dft_args(args, 0) |
| 3401 | freq = args[0] |
| 3402 | forces = args[1:] |
| 3403 | decimation_factor = kwargs.get("decimation_factor", 0) |
| 3404 | force = DftForce(self._add_force, [freq, forces, decimation_factor]) |
| 3405 | self.dft_objects.append(force) |
| 3406 | return force |
| 3407 | |
| 3408 | def _add_force(self, freq, forces, decimation_factor): |
| 3409 | if self.fields is None: |