OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 VTT Technical Research Centre of Finland Ltd
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
39#ifndef PFC_CONSTANTS_HPP
40#define PFC_CONSTANTS_HPP
41
42namespace pfc {
43
44namespace constants {
45
46// ============================================================================
47// Mathematical Constants
48// ============================================================================
49
70constexpr double pi = 3.14159265358979323846;
71
87constexpr double two_pi = 2.0 * pi;
88
99constexpr double pi_2 = pi / 2.0;
100
110constexpr double pi_4 = pi / 4.0;
111
121constexpr double inv_pi = 1.0 / pi;
122
133constexpr double sqrt_pi = 1.77245385090551602729;
134
150constexpr double sqrt2 = 1.41421356237309504880;
151
170constexpr double sqrt3 = 1.73205080756887729352;
171
187constexpr double e = 2.71828182845904523536;
188
199constexpr double ln2 = 0.69314718055994530941;
200
211constexpr double ln10 = 2.30258509299404568401;
212
223constexpr double phi = 1.61803398874989484820;
224
225// ============================================================================
226// Phase Field Crystal Lattice Constants
227// ============================================================================
228
236constexpr double a1D = 2 * pi;
237
246constexpr double a2D = 2 * pi * 2 / sqrt3;
247
256constexpr double a3D = 2 * pi * sqrt2;
257
258// ============================================================================
259// FFT Configuration Constants
260// ============================================================================
261
274constexpr int r2c_direction = 0;
275
276} // namespace constants
277
278// ============================================================================
279// Convenience: Import Common Constants into pfc Namespace
280// ============================================================================
281// This allows both pfc::pi and pfc::constants::pi to work
282
283using constants::e;
284using constants::pi;
285using constants::sqrt2;
286using constants::sqrt3;
287using constants::two_pi;
288
289} // namespace pfc
290
291#endif // PFC_CONSTANTS_HPP
constexpr double sqrt2
The square root of two (√2)
Definition constants.hpp:150
constexpr double phi
The golden ratio (φ)
Definition constants.hpp:223
constexpr double ln2
The natural logarithm of 2 (ln(2))
Definition constants.hpp:199
constexpr double a1D
Lattice constant for 1D ordered phase (stripes)
Definition constants.hpp:236
constexpr double two_pi
Two times pi (2π)
Definition constants.hpp:87
constexpr double pi_4
Pi divided by four (π/4)
Definition constants.hpp:110
constexpr double pi_2
Pi divided by two (π/2)
Definition constants.hpp:99
constexpr double sqrt3
The square root of three (√3)
Definition constants.hpp:170
constexpr int r2c_direction
Direction for real-to-complex FFT symmetry reduction.
Definition constants.hpp:274
constexpr double a3D
Lattice constant for 3D ordered phase (BCC lattice)
Definition constants.hpp:256
constexpr double sqrt_pi
The square root of pi (√π)
Definition constants.hpp:133
constexpr double pi
The ratio of a circle's circumference to its diameter (π)
Definition constants.hpp:70
constexpr double a2D
Lattice constant for 2D ordered phase (triangular lattice)
Definition constants.hpp:246
constexpr double e
Euler's number (e)
Definition constants.hpp:187
constexpr double inv_pi
The reciprocal of pi (1/π)
Definition constants.hpp:121
constexpr double ln10
The natural logarithm of 10 (ln(10))
Definition constants.hpp:211