Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
2a6a915f
Commit
2a6a915f
authored
3 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
adds documentation
parent
f156d77b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#108873
passed
3 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpp/field.cpp
+68
-0
68 additions, 0 deletions
cpp/field.cpp
with
68 additions
and
0 deletions
cpp/field.cpp
+
68
−
0
View file @
2a6a915f
...
...
@@ -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
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment