Skip to content
Snippets Groups Projects
Commit 2a6a915f authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

adds documentation

parent f156d77b
Branches
Tags
No related merge requests found
Pipeline #108873 passed
......@@ -1502,6 +1502,24 @@ void field<rnumber, be, fc>::Hermitian_reflect()
finish_mpi_profiling_zone(turtle_mpi_pcontrol::FIELD);
}
/** \brief Enforce Hermitian symmetry (slow, reference)
*
* TurTLE uses real-to-complex and complex-to-real FFTW transforms, because the
* equations are PDEs of real-valued fields.
* Hermitian symmetry means that Fourier-transformed real valued fields must
* respect the equation \f$\hat f(-\mathbf{k}) = {\hat f}^*(\mathbf{k})\f$.
*
* FFTW enforces this property mainly by only storing the positive half of the
* Fourier grid for the fastest array component. In TurTLE's case, this means
* \f$ k_x \f$.
* For the \f$ k_x = 0 \f$ plane, the symmetry must be enforced.
*
* This method uses a pair of backwards-forwards FFTs, which leads to FFTW
* effectively imposing Hermitian symmetry. It should be used as a reference
* implementation to calibrate against in the general case.
*
* */
template <typename rnumber,
field_backend be,
field_components fc>
......@@ -1557,6 +1575,29 @@ void field<rnumber, be, fc>::symmetrize_FFT()
return;
}
/** \brief Enforce Hermitian symmetry (unoptimized, amplitude-aware)
*
* TurTLE uses real-to-complex and complex-to-real FFTW transforms, because the
* equations are PDEs of real-valued fields.
* Hermitian symmetry means that Fourier-transformed real valued fields must
* respect the equation \f$\hat f(-\mathbf{k}) = {\hat f}^*(\mathbf{k})\f$.
*
* FFTW enforces this property mainly by only storing the positive half of the
* Fourier grid for the fastest array component. In TurTLE's case, this means
* \f$ k_x \f$.
* For the \f$ k_x = 0 \f$ plane, the symmetry must be enforced.
*
* This method is an alternative to the default arithmetic mean method, meant
* to be used in special circumstances where it is important to retain the
* exact amplitude of modes.
* Rather than an arithmetic mean, here we compute the amplitudes and phases
* for the \f$(0, k_y, k_z)\f$ and \f$(0, -k_y, -k_z)\f$ modes. We then compute
* a mean amplitude as the square root of the product of the two amplitudes,
* and a mean phase as the arithmetic mean of the two phases.
* When this method is applied to a field with fixed amplitudes, but random
* phases, it should preserve the spectrum of the initial field exactly.
*
* */
template <typename rnumber,
field_backend be,
field_components fc>
......@@ -1799,6 +1840,33 @@ void field<rnumber, be, fc>::symmetrize_alternate()
finish_mpi_profiling_zone(turtle_mpi_pcontrol::FIELD);
}
/** \brief Enforce Hermitian symmetry (fast and reasonable)
*
* TurTLE uses real-to-complex and complex-to-real FFTW transforms, because the
* equations are PDEs of real-valued fields.
* Hermitian symmetry means that Fourier-transformed real valued fields must
* respect the equation \f$\hat f(-\mathbf{k}) = {\hat f}^*(\mathbf{k})\f$.
*
* FFTW enforces this property mainly by only storing the positive half of the
* Fourier grid for the fastest array component. In TurTLE's case, this means
* \f$ k_x \f$.
* For the \f$ k_x = 0 \f$ plane, the symmetry must be enforced.
*
* This method uses an arithmetic mean of the \f$ (0, k_y, k_z)\f$ mode and
* the conjugate of the \f$(0, -k_y, -k_z) \f$ mode to generate the desired
* values. The method is fast (other than the required MPI communications).
*
* Note: the method is adequate either in cases where deviations from
* Hermitian symmetry are small, or in cases where deviations from correct
* physics is irrelevant.
* In practice: initial condition fields may be strongly perturbed by the
* application of this method, but they are unphysical anyway; during
* the quasistationary regime of some simulation, the method is applied
* regularly to all relevant fields, and deviations are expected to be small,
* i.e. effect on PDE approximations is negligible.
*
* */
template <typename rnumber,
field_backend be,
field_components fc>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment