/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/integrator_fT_p2_1ang.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/integrator_fT_p2_1ang.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
integrator_fT_p2_1ang.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
6
7namespace DiFfRG
8{
9 namespace internal
10 {
11 template <int dim, typename NT, typename KERNEL> class Transform_fT_p2_1ang
12 {
13 public:
14 static constexpr int sdim = dim - 1; // spatial dimension
15 using ctype = typename get_type::ctype<NT>;
16
17 // The polar angle (spatial loop vs. external momentum) of a 2-point loop lives in the sdim
18 // spatial dimensions and carries the zonal measure (1-c^2)^{(sdim-3)/2} dc, supplied by the
19 // Gauss-Jacobi(alpha=beta=(sdim-3)/2) angular quadrature (see the class below). The remaining
20 // (sdim-2)-sphere gives S_{sdim-1} = S_d_prec(sdim-1).
21 static constexpr ctype int_prefactor = S_d_prec<ctype>(sdim - 1) // remaining solid angle after the polar angle
22 / powr<sdim>(2 * (ctype)M_PI); // fourier factor
23
24 // Forward the kernel's Matsubara traits. The measure this adapter multiplies in is
25 // independent of the frequency, so it changes neither the parity in q0 nor the support in
26 // q0. Without this forwarding the traits are silently lost: QuadratureIntegrator_fT only
27 // ever sees the adapter, never KERNEL, so `matsubara_even` never fired for any
28 // Integrator_fT_p2* flow.
32
33 template <typename... T>
34 static KOKKOS_FORCEINLINE_FUNCTION NT kernel_finite_extent(const ctype q, const ctype cos, const ctype q0,
35 const T &...t)
36 {
37 using namespace DiFfRG::compute;
38
39 const ctype int_element = powr<sdim - 1>(q); // from p integral
40 return int_prefactor * int_element * KERNEL::kernel_finite_extent(q, cos, q0, t...);
41 }
42
43 template <typename... T>
44 static KOKKOS_FORCEINLINE_FUNCTION NT kernel_tail(const ctype q, const ctype cos, const ctype q0, const T &...t)
45 {
46 using namespace DiFfRG::compute;
47
48 const ctype int_element = powr<sdim - 1>(q); // from p integral
49 return int_prefactor * int_element * KERNEL::kernel_tail(q, cos, q0, t...);
50 }
51
52 template <typename... T>
53 static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const ctype q0, const T &...t)
54 {
55 using namespace DiFfRG::compute;
56
57 const ctype int_element = powr<sdim - 1>(q); // from p integral
58 const NT result = KERNEL::kernel(q, cos, q0, t...);
59
60 return int_prefactor * int_element * result;
61 }
62
63 template <typename... T> static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
64 {
65 return KERNEL::constant(t...);
66 }
67 };
68
69 } // namespace internal
70
71 template <int dim, typename NT, typename KERNEL, typename ExecutionSpace>
72 requires(dim >= 3)
74 : public QuadratureIntegrator_fT<3, NT, internal::Transform_fT_p2_1ang<dim, NT, KERNEL>, ExecutionSpace>
75 {
77
78 static constexpr int sdim = dim - 1; // spatial dimension
79
80 // Gauss-Jacobi quadrature on [-1,1] with weight (1-c^2)^{(sdim-3)/2} for the spatial polar angle.
81 // Dimension-agnostic: reduces to Chebyshev-1 (sdim=2), Legendre (sdim=3), Chebyshev-2 (sdim=4), ...
83 {
85 t.a = static_cast<double>(-1);
86 t.b = static_cast<double>(1);
87 t.alpha = (static_cast<double>(sdim) - 3.) / 2.;
88 t.beta = t.alpha;
89 return t;
90 }
91
92 public:
96 using ctype = typename get_type::ctype<NT>;
97 using execution_space = ExecutionSpace;
98
109 {
110 if (config.contains("/integration/force_exact_matsubara_sum"))
111 Base::set_allow_exact_matsubara_sum(config.get_bool("/integration/force_exact_matsubara_sum", false));
112 if (config.contains("/integration/matsubara_extent_margin"))
113 Base::set_matsubara_extent_margin(config.get_double("/integration/matsubara_extent_margin", 1.));
114 }
115
118 : Integrator_fT_p2_1ang(quadrature_provider, internal::make_int_grid<2, NT>(config, {"x_order", "cos1_order"}),
120 config.get_double("/physical/T", 1.0))
121 {
122 apply_matsubara_overrides(config);
123 }
124
125 Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const std::array<size_t, 2> grid_size,
126 ctype x_extent = 2., ctype T = 1, ctype typical_E = 1)
127 : Base(quadrature_provider, grid_size, {0, 0.}, {std::sqrt(x_extent), 1.},
128 {QuadratureType(QuadratureType::legendre), polar_quadrature()}, T, typical_E),
129 x_extent(x_extent), k(1.)
130 {
131 // The spatial grid is already cut at sqrt(x_extent) * k because the regulator dies there;
132 // the summand's support in FREQUENCY is the same ball, so the exact Matsubara sum can be cut
133 // at the same radius. See QuadratureIntegrator_fT::set_frequency_cutoff.
134 Base::set_frequency_cutoff(std::sqrt(this->x_extent) * this->k);
135 }
136
137 void set_x_extent(ctype x_extent)
138 {
139 this->x_extent = x_extent;
140 Base::set_grid_extents({0, 0.}, {std::sqrt(x_extent) * k, 1.});
141 // The spatial grid is already cut at sqrt(x_extent) * k because the regulator dies there;
142 // the summand's support in FREQUENCY is the same ball, so the exact Matsubara sum can be cut
143 // at the same radius. See QuadratureIntegrator_fT::set_frequency_cutoff.
144 Base::set_frequency_cutoff(std::sqrt(this->x_extent) * this->k);
145 }
146
147 void set_k(ctype k)
148 {
149 this->k = k;
150 Base::set_grid_extents({0, 0.}, {std::sqrt(x_extent) * k, 1.});
151 Base::set_k(k);
152 // The spatial grid is already cut at sqrt(x_extent) * k because the regulator dies there;
153 // the summand's support in FREQUENCY is the same ball, so the exact Matsubara sum can be cut
154 // at the same radius. See QuadratureIntegrator_fT::set_frequency_cutoff.
155 Base::set_frequency_cutoff(std::sqrt(this->x_extent) * this->k);
156 }
157
158 void set_typical_E(ctype typical_E) { Base::set_typical_E(typical_E); }
159
160 private:
163 };
164} // namespace DiFfRG
A hierarchical configuration tree, readable from JSON and TOML files.
Definition config_tree.hh:32
Definition integrator_fT_p2_1ang.hh:75
void set_x_extent(ctype x_extent)
Definition integrator_fT_p2_1ang.hh:137
Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const ConfigTree &config)
Definition integrator_fT_p2_1ang.hh:116
void set_k(ctype k)
Definition integrator_fT_p2_1ang.hh:147
ExecutionSpace execution_space
Definition integrator_fT_p2_1ang.hh:97
ctype k
Definition integrator_fT_p2_1ang.hh:162
Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const std::array< size_t, 2 > grid_size, ctype x_extent=2., ctype T=1, ctype typical_E=1)
Definition integrator_fT_p2_1ang.hh:125
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_fT_p2_1ang.hh:96
void set_typical_E(ctype typical_E)
Definition integrator_fT_p2_1ang.hh:158
static QuadratureType polar_quadrature()
Definition integrator_fT_p2_1ang.hh:82
void apply_matsubara_overrides(const ConfigTree &config)
Apply the /integration/force_exact_matsubara_sum override, if the model sets it.
Definition integrator_fT_p2_1ang.hh:108
ctype x_extent
Definition integrator_fT_p2_1ang.hh:161
Definition quadrature_integrator_fT.hh:54
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:239
Definition integrator_fT_p2_1ang.hh:12
static constexpr ctype int_prefactor
Definition integrator_fT_p2_1ang.hh:21
static constexpr bool matsubara_finite_extent
Definition integrator_fT_p2_1ang.hh:30
static KOKKOS_FORCEINLINE_FUNCTION NT kernel_tail(const ctype q, const ctype cos, const ctype q0, const T &...t)
Definition integrator_fT_p2_1ang.hh:44
static constexpr bool matsubara_even
Definition integrator_fT_p2_1ang.hh:29
typename get_type::ctype< NT > ctype
Definition integrator_fT_p2_1ang.hh:15
static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
Definition integrator_fT_p2_1ang.hh:63
static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const ctype q0, const T &...t)
Definition integrator_fT_p2_1ang.hh:53
static constexpr bool matsubara_split
Definition integrator_fT_p2_1ang.hh:31
static KOKKOS_FORCEINLINE_FUNCTION NT kernel_finite_extent(const ctype q, const ctype cos, const ctype q0, const T &...t)
Definition integrator_fT_p2_1ang.hh:34
static constexpr int sdim
Definition integrator_fT_p2_1ang.hh:14
Definition abstract_integrator.hh:38
Definition math.hh:229
typename internal::_ctype< CT >::value ctype
Definition types.hh:76
std::array< size_t, dim > make_int_grid(const ConfigTree &config, const std::array< std::string, dim > &names)
Definition abstract_integrator.hh:23
Definition complex_math.hh:10
constexpr bool kernel_is_matsubara_even
Definition quadrature_integrator_fT.hh:28
constexpr bool kernel_has_finite_matsubara_extent
Definition quadrature_integrator_fT.hh:37
@ config
/discretization/threads.
constexpr KOKKOS_INLINE_FUNCTION NumberType powr(const NumberType x)
A compile-time evaluatable power function for whole number exponents.
Definition math.hh:50
consteval NT S_d_prec(uint d)
Surface of a d-dimensional sphere (precompiled)
Definition math.hh:121
constexpr bool kernel_has_matsubara_split
Definition quadrature_integrator_fT.hh:49
double optimize_x_extent(const ConfigTree &config)
Definition optimize.hh:8
Definition quadrature.hh:44
double a
Definition quadrature.hh:47
double beta
Definition quadrature.hh:48
@ jacobi
Definition quadrature.hh:45
@ legendre
Definition quadrature.hh:45
double alpha
Definition quadrature.hh:48
double b
Definition quadrature.hh:47