diff options
author | 2020-08-06 06:30:14 -0700 | |
---|---|---|
committer | 2020-08-06 06:30:14 -0700 | |
commit | 0564feb5041728173716ef251f1d66d37c314770 (patch) | |
tree | 5f621f3818791232a42464b60beb0c43e24df1f6 /Docs/source/running_cpp | |
parent | 8721f1e05af20496c209d71af74fee896aaa5b7f (diff) | |
download | WarpX-0564feb5041728173716ef251f1d66d37c314770.tar.gz WarpX-0564feb5041728173716ef251f1d66d37c314770.tar.zst WarpX-0564feb5041728173716ef251f1d66d37c314770.zip |
Galilean PSATD: current correction and rho-free formulation (#1151)
* Introduce option to update E with/without rho
* Clean up
* Implement current correction for Galilean PSATD (needs bug fix)
* Include equations in docs
* Fix EOL whitespaces error
* Small clean-up
* Implement Galilean PSATD update without rho
* Clean up
* Fix bug in current correction
* Fix EOL whitespaces
* Clean up
* Fix unused import
* Remove unused variable
* [skip CI] Improve docs
* Clean up style
* Fix EOL whitespaces
* Fix EOL whitespaces
* Clean up style
* Revert analysis script to old status
* [skip CI] Clean up style
* Make equations more human-readable and improve comments
* 2D test with current correction works
* Temporary build fix as in #1197
* 3D test with current correction works
* Rename th and th_star as theta and theta_star
* Fix a couple of wrong comments
* Add vertical spaces to improve readability
* Improve documentation
* Function CurrentCorrection is now pure
* 2D benchmark fields data are now correct
* Add limits of coefficients for nu=-1
* Change default of update_with_rho for Galilean PSATD
Diffstat (limited to 'Docs/source/running_cpp')
-rw-r--r-- | Docs/source/running_cpp/parameters.rst | 102 |
1 files changed, 73 insertions, 29 deletions
diff --git a/Docs/source/running_cpp/parameters.rst b/Docs/source/running_cpp/parameters.rst index fca7ef846..b65e69670 100644 --- a/Docs/source/running_cpp/parameters.rst +++ b/Docs/source/running_cpp/parameters.rst @@ -1116,51 +1116,95 @@ Numerics and algorithms for more information. * ``psatd.current_correction`` (`0` or `1`; default: `0`) - If true, the current correction `(Vay et al, JCP 243, 2013) <https://doi.org/10.1016/j.jcp.2013.03.010>`_ + If true, a current correction scheme in Fourier space is applied in order to guarantee charge conservation. + + If ``psatd.v_galilean`` is zero, the spectral solver used is the standard PSATD scheme described in (`Vay et al, JCP 243, 2013 <https://doi.org/10.1016/j.jcp.2013.03.010>`_) and the current correction reads .. math:: - \widetilde{\boldsymbol{J}}^{\,n+1/2}_{\mathrm{correct}} = \widetilde{\boldsymbol{J}}^{\,n+1/2} - -\bigg[\boldsymbol{k}\cdot\widetilde{\boldsymbol{J}}^{\,n+1/2} - -i\frac{\widetilde{\rho}^{n+1}-\widetilde{\rho}^{n}}{\Delta t}\bigg] - \frac{\boldsymbol{k}}{k^2} + \widehat{\boldsymbol{J}}^{\,n+1/2}_{\mathrm{correct}} = \widehat{\boldsymbol{J}}^{\,n+1/2} + - \bigg(\boldsymbol{k}\cdot\widehat{\boldsymbol{J}}^{\,n+1/2} + - i \frac{\widehat{\rho}^{n+1} - \widehat{\rho}^{n}}{\Delta{t}}\bigg) \frac{\boldsymbol{k}}{k^2} + + If ``psatd.v_galilean`` is non-zero, the spectral solver used is the Galilean PSATD scheme described in (`Lehe et al, PRE 94, 2016 <https://doi.org/10.1103/PhysRevE.94.053305>`_) and the current correction reads + + .. math:: + \widehat{\boldsymbol{J}}^{\,n+1/2}_{\mathrm{correct}} = \widehat{\boldsymbol{J}}^{\,n+1/2} + - \bigg(\boldsymbol{k}\cdot\widehat{\boldsymbol{J}}^{\,n+1/2} - (\boldsymbol{k}\cdot\boldsymbol{v}_G) + \,\frac{\widehat\rho^{n+1} - \widehat\rho^{n}\theta^2}{1 - \theta^2}\bigg) \frac{\boldsymbol{k}}{k^2} + + where :math:`\theta=\exp(i\,\boldsymbol{k}\cdot\boldsymbol{v}_G\,\Delta{t}/2)`. - is applied. This option guarantees charge conservation only when used in combination - with ``psatd.periodic_single_box_fft=1``, that is, only for periodic single-box - simulations with global FFTs without guard cells. The implementation for domain - decomposition with local FFTs over guard cells is planned but not yet completed. + This option is currently implemented only for the standard PSATD and Galilean PSATD schemes, while it is not yet available for the averaged Galilean PSATD scheme (activated by the input parameter ``psatd.do_time_averaging``). + + This option guarantees charge conservation only when used in combination with ``psatd.periodic_single_box_fft=1``, namely for periodic single-box simulations with global FFTs without guard cells. + The implementation for domain decomposition with local FFTs over guard cells is planned but not yet completed. * ``psatd.update_with_rho`` (`0` or `1`; default: `0`) - If false, the update equation for the electric field reads + If true, the update equation for the electric field is expressed in terms of both the current density and the charge density, namely :math:`\widehat{\boldsymbol{J}}^{\,n+1/2}`, :math:`\widehat\rho^{n}`, and :math:`\widehat\rho^{n+1}`. + If false, instead, the update equation for the electric field is expressed in terms of the current density :math:`\widehat{\boldsymbol{J}}^{\,n+1/2}` only. + If charge is expected to be conserved (by setting, for example, ``psatd.current_correction=1``), then the two formulations are expected to be equivalent. + + This option is currently implemented only for the standard PSATD and Galilean PSATD schemes, while it is not yet available for the averaged Galilean PSATD scheme (activated by the input parameter ``psatd.do_time_averaging``). + + If ``psatd.v_galilean`` is zero, the spectral solver used is the standard PSATD scheme described in (`Vay et al, JCP 243, 2013 <https://doi.org/10.1016/j.jcp.2013.03.010>`_): + + 1. if ``psatd.update_with_rho=0``, the update equation for the electric field reads + + .. math:: + \begin{split} + \widehat{\boldsymbol{E}}^{\,n+1}= & \: + C \widehat{\boldsymbol{E}}^{\,n} + i \, \frac{S c}{k} \boldsymbol{k}\times\widehat{\boldsymbol{B}}^{\,n} + - \frac{S}{\epsilon_0 c \, k} \widehat{\boldsymbol{J}}^{\,n+1/2} \\[0.2cm] + & +\frac{1-C}{k^2} (\boldsymbol{k}\cdot\widehat{\boldsymbol{E}}^{\,n}) \boldsymbol{k} + + \frac{1}{\epsilon_0 k^2} \left(\frac{S}{c \, k}-\Delta{t}\right) + (\boldsymbol{k}\cdot\widehat{\boldsymbol{J}}^{\,n+1/2}) \boldsymbol{k} + \end{split} + + 2. if ``psatd.update_with_rho=1``, the update equation for the electric field reads .. math:: \begin{split} - \widetilde{\boldsymbol{E}}^{\,n+1}= & \: - C\widetilde{\boldsymbol{E}}^{\,n}+i\frac{S}{c\,k}\,c^2\,\boldsymbol{k} - \times\widetilde{\boldsymbol{B}}^{\,n}-\frac{1}{\epsilon_0}\,\frac{S}{c\,k}\, - \,\widetilde{\boldsymbol{J}}^{\,n+1/2} \\ - & +\frac{1-C}{k^2}\,(\boldsymbol{k}\cdot\widetilde{\boldsymbol{E}}^{\,n})\,\boldsymbol{k} - +\frac{1}{\epsilon_0}\,\frac{1}{k^2}\,\left(\frac{S}{c\,k}-\Delta t\right)\, - (\boldsymbol{k}\cdot\widetilde{\boldsymbol{J}}^{\,n+1/2})\,\boldsymbol{k} + \widehat{\boldsymbol{E}}^{\,n+1}= & \: + C\widehat{\boldsymbol{E}}^{\,n} + i \, \frac{S c}{k} \boldsymbol{k}\times\widehat{\boldsymbol{B}}^{\,n} + - \frac{S}{\epsilon_0 c \, k} \widehat{\boldsymbol{J}}^{\,n+1/2} \\[0.2cm] + & + \frac{i}{\epsilon_0 k^2} \left(C-\frac{S}{c\,k}\frac{1}{\Delta{t}}\right) + \widehat{\rho}^{n} \boldsymbol{k} - \frac{i}{\epsilon_0 k^2} \left(1-\frac{S}{c \, k} + \frac{1}{\Delta{t}}\right)\widehat{\rho}^{n+1} \boldsymbol{k} \end{split} - where :math:`C=\cos(k\,c\,\Delta t)` and :math:`S=\sin(k\,c\,\Delta t)`, respectively. + The coefficients :math:`C` and :math:`S` are defined in (`Vay et al, JCP 243, 2013 <https://doi.org/10.1016/j.jcp.2013.03.010>`_). + + If ``psatd.v_galilean`` is non-zero, the spectral solver used is the Galilean PSATD scheme described in (`Lehe et al, PRE 94, 2016 <https://doi.org/10.1103/PhysRevE.94.053305>`_): + + 1. if ``psatd.update_with_rho=0``, the update equation for the electric field reads + + .. math:: + \begin{split} + \widehat{\boldsymbol{E}}^{\,n+1} = & \: + \theta^{2} C \widehat{\boldsymbol{E}}^{\,n} + i \, \theta^{2} \frac{S c}{k} + \boldsymbol{k}\times\widehat{\boldsymbol{B}}^{\,n} + + \frac{i \, \nu \, \theta \, \chi_1 - \theta^{2} S}{\epsilon_0 c \, k} + \widehat{\boldsymbol{J}}^{\,n+1/2} \\[0.2cm] + & + \theta^{2} \frac{\chi_2-\chi_3}{k^{2}} + (\boldsymbol{k}\cdot\widehat{\boldsymbol{E}}^{\,n}) \boldsymbol{k} + + i \, \frac{\chi_2\left(\theta^{2}-1\right)}{\epsilon_0 c \, k^{3} \nu} + (\boldsymbol{k}\cdot\widehat{\boldsymbol{J}}^{\,n+1/2}) \boldsymbol{k} + \end{split} - If true, the update equation for the electric field reads instead + 2. if ``psatd.update_with_rho=1``, the update equation for the electric field reads .. math:: \begin{split} - \widetilde{\boldsymbol{E}}^{\,n+1}= & \: - C\widetilde{\boldsymbol{E}}^{\,n}+i\frac{S}{c\,k}\,c^2\,\boldsymbol{k} - \times\widetilde{\boldsymbol{B}}^{\,n}-\frac{1}{\epsilon_0}\,\frac{S}{c\,k} - \,\widetilde{\boldsymbol{J}}^{\,n+1/2} \\ - & -i\frac{1}{\epsilon_0}\,\frac{1}{k^2}\,\bigg[ - \left(1-\frac{S}{c\,k}\frac{1}{\Delta t}\right)\widetilde{\rho}^{n+1} - -\left(C-\frac{S}{c\,k}\frac{1}{\Delta t}\right)\widetilde{\rho}^{n}\bigg] - \,\boldsymbol{k} + \widehat{\boldsymbol{E}}^{\,n+1} = & \: + \theta^{2} C \widehat{\boldsymbol{E}}^{\,n} + i \, \theta^{2} \frac{S c}{k} + \boldsymbol{k}\times\widehat{\boldsymbol{B}}^{\,n} + + \frac{i \, \nu \, \theta \, \chi_1 - \theta^{2} S}{\epsilon_0 c \, k} + \widehat{\boldsymbol{J}}^{\,n+1/2} \\[0.2cm] + & + i \, \frac{\theta^{2} \chi_3}{\epsilon_0 k^{2}} \widehat{\rho}^{\,n} \boldsymbol{k} + - i \, \frac{\chi_2}{\epsilon_0 k^{2}} \widehat{\rho}^{\,n+1} \boldsymbol{k} \end{split} - See `(Vay et al, JCP 243, 2013) <https://doi.org/10.1016/j.jcp.2013.03.010>`_ - for more details about the derivation of these equations. + The coefficients :math:`C`, :math:`S`, :math:`\theta`, :math:`\nu`, :math:`\chi_1`, :math:`\chi_2`, and :math:`\chi_3` are defined in (`Lehe et al, PRE 94, 2016 <https://doi.org/10.1103/PhysRevE.94.053305>`_). * ``pstad.v_galilean`` (`3 floats`, in units of the speed of light; default `0. 0. 0.`) Defines the galilean velocity. |