22 #ifndef HELMHOLTZ_3D_NEARLY_SINGULAR_INTEGRALS_HPP_INCLUDED
23 #define HELMHOLTZ_3D_NEARLY_SINGULAR_INTEGRALS_HPP_INCLUDED
25 #include "field_type_helpers.hpp"
29 #include "nearly_singular_collocational.hpp"
30 #include "nearly_singular_collocational_telles.hpp"
31 #include "quadrature_store_helper.hpp"
33 #include "../core/nearly_singular_planar_constant_collocation_shortcut.hpp"
49 template <
class elem_t,
class wavenumber_t>
50 static std::complex<double> eval(
53 wavenumber_t
const &k)
56 enum { quadrature_order = 14 };
63 double res_static = laplace_3d_SLP_collocation_constant_plane_nearly_singular::eval(elem, x0);
65 std::complex<double> res_dynamic = 0.0;
67 for (
auto it = quadrature_t::quadrature.begin(); it != quadrature_t::quadrature.end(); ++it)
69 auto const &xi = it->get_xi();
70 double w = it->get_w();
72 x_t y = elem.get_x(xi);
73 double jac = elem.get_normal(xi).norm();
76 ktotal(x0, y) - kstatic(x0, y)
80 return res_static + res_dynamic;
92 template <
class elem_t,
class wavenumber_t>
93 static std::complex<double> eval(
96 wavenumber_t
const &k)
99 enum { quadrature_order = 14 };
106 double res_static = laplace_3d_DLP_collocation_constant_plane_nearly_singular::eval(elem, x0);
108 std::complex<double> res_dynamic = 0.0;
110 x_t ny = elem.get_normal().normalized();
112 for (
auto it = quadrature_t::quadrature.begin(); it != quadrature_t::quadrature.end(); ++it)
114 auto const &xi = it->get_xi();
115 double w = it->get_w();
117 x_t y = elem.get_x(xi);
118 double jac = elem.get_normal(xi).norm();
121 ktotal(x0, y, ny) - kstatic(x0, y, ny)
125 return res_static + res_dynamic;
138 template <
class elem_t,
class wavenumber_t>
139 static std::complex<double> eval(
143 wavenumber_t
const &k)
146 enum { quadrature_order = 14 };
153 double res_static = laplace_3d_DLPt_collocation_constant_plane_nearly_singular::eval(elem, x0, nx);
155 std::complex<double> res_dynamic = 0.0;
157 for (
auto it = quadrature_t::quadrature.begin(); it != quadrature_t::quadrature.end(); ++it)
159 auto const &xi = it->get_xi();
160 double w = it->get_w();
162 x_t y = elem.get_x(xi);
163 double jac = elem.get_normal(xi).norm();
166 ktotal(x0, y, nx) - kstatic(x0, y, nx)
170 return res_static + res_dynamic;
183 template <
class elem_t,
class wavenumber_t>
184 static std::complex<double> eval(
188 wavenumber_t
const &k)
191 enum { quadrature_order = 14 };
200 std::complex<double> res_dynamic = 0.0;
201 x_t ny = elem.get_normal().normalized();
203 for (
auto it = quadrature_t::quadrature.begin(); it != quadrature_t::quadrature.end(); ++it)
205 auto const &xi = it->get_xi();
206 double w = it->get_w();
208 x_t y = elem.get_x(xi);
209 double jac = elem.get_normal(xi).norm();
212 ktotal(x0, y, nx, ny) - kstatic(x0, y, nx, ny)
216 return res_static + res_dynamic;
223 template <
class TestField,
class TrialField,
class WaveNumber>
226 typename std::enable_if<
227 is_collocational<TestField, TrialField>::value &&
228 is_constant_tria<TrialField>::value
240 double const limit = 1.5;
243 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
244 double R = trial_field.
get_elem().get_linear_size_estimate();
248 template <
class result_t>
249 static result_t &eval(
256 result(0) = helmholtz_3d_SLP_collocation_constant_plane_nearly_singular::eval(
259 kernel.derived().get_wave_number());
268 template <
class TestField,
class TrialField,
class WaveNumber>
271 typename std::enable_if<
272 is_collocational<TestField, TrialField>::value &&
273 !is_constant_tria<TrialField>::value
278 typedef typename kernel_t::test_input_t test_input_t;
279 typedef TestField test_field_t;
280 typedef typename test_field_t::nset_t test_nset_t;
281 static unsigned const num_test_nodes = test_nset_t::num_nodes;
290 double const limit = 1.5;
293 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
294 double R = trial_field.
get_elem().get_linear_size_estimate();
299 template <
class result_t>
300 static result_t &eval(
308 nsc_t nsc(trial_field, kernel);
310 for (
unsigned i = 0; i < num_test_nodes; ++i)
312 test_input_t tsti(test_field.
get_elem(), test_nset_t::corner_at(i));
313 nsc.integrate(result.row(i), tsti);
321 template <
class TestField,
class TrialField,
class WaveNumber>
324 typename std::enable_if<
325 is_collocational<TestField, TrialField>::value &&
326 is_constant_tria<TrialField>::value
338 double const limit = 1.5;
341 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
342 double R = trial_field.
get_elem().get_linear_size_estimate();
347 template <
class result_t>
348 static result_t &eval(
355 result(0) = helmholtz_3d_DLP_collocation_constant_plane_nearly_singular::eval(
358 kernel.derived().get_wave_number());
364 template <
class TestField,
class TrialField,
class WaveNumber>
367 typename std::enable_if<
368 is_collocational<TestField, TrialField>::value &&
369 !is_constant_tria<TrialField>::value
374 typedef typename kernel_t::test_input_t test_input_t;
375 typedef TestField test_field_t;
376 typedef typename test_field_t::nset_t test_nset_t;
377 static unsigned const num_test_nodes = test_nset_t::num_nodes;
386 double const limit = 1.5;
389 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
390 double R = trial_field.
get_elem().get_linear_size_estimate();
395 template <
class result_t>
396 static result_t &eval(
406 nsc_t nsc(trial_field, kernel);
408 for (
unsigned i = 0; i < num_test_nodes; ++i)
410 test_input_t tsti(test_field.
get_elem(), test_nset_t::corner_at(i));
411 nsc.integrate(result.row(i), tsti);
421 template <
class TestField,
class TrialField,
class WaveNumber>
424 typename std::enable_if<
425 is_collocational<TestField, TrialField>::value &&
426 is_constant_tria<TrialField>::value
438 double const limit = 1.5;
441 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
442 double R = trial_field.
get_elem().get_linear_size_estimate();
446 template <
class result_t>
447 static result_t &eval(
454 result(0) = helmholtz_3d_DLPt_collocation_constant_plane_nearly_singular::eval(
457 test_field.
get_elem().get_normal().normalized(),
458 kernel.derived().get_wave_number());
468 template <
class TestField,
class TrialField,
class WaveNumber>
471 typename std::enable_if<
472 is_collocational<TestField, TrialField>::value &&
473 !is_constant_tria<TrialField>::value
478 typedef typename kernel_t::test_input_t test_input_t;
479 typedef TestField test_field_t;
480 typedef typename test_field_t::nset_t test_nset_t;
481 static unsigned const num_test_nodes = test_nset_t::num_nodes;
490 double const limit = 1.5;
493 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
494 double R = trial_field.
get_elem().get_linear_size_estimate();
498 template <
class result_t>
499 static result_t &eval(
507 nsc_t nsc(trial_field, kernel);
509 for (
unsigned i = 0; i < num_test_nodes; ++i)
511 test_input_t tsti(test_field.
get_elem(), test_nset_t::corner_at(i));
512 nsc.integrate(result.row(i), tsti);
524 template <
class TestField,
class TrialField,
class WaveNumber>
527 typename std::enable_if<
528 is_collocational<TestField, TrialField>::value &&
529 is_constant_tria<TrialField>::value
541 double const limit = 1.5;
544 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
545 double R = trial_field.
get_elem().get_linear_size_estimate();
549 template <
class result_t>
550 static result_t &eval(
557 result(0) = helmholtz_3d_HSP_collocation_constant_plane_nearly_singular::eval(
560 test_field.
get_elem().get_normal().normalized(),
561 kernel.derived().get_wave_number());
567 template <
class TestField,
class TrialField,
class WaveNumber>
570 typename std::enable_if<
571 is_collocational<TestField, TrialField>::value &&
572 !is_constant_tria<TrialField>::value
577 typedef typename kernel_t::test_input_t test_input_t;
578 typedef TestField test_field_t;
579 typedef typename test_field_t::nset_t test_nset_t;
580 static unsigned const num_test_nodes = test_nset_t::num_nodes;
589 double const limit = 1.5;
592 double d = (test_field.
get_elem().get_center() - trial_field.
get_elem().get_center()).norm();
593 double R = trial_field.
get_elem().get_linear_size_estimate();
597 template <
class result_t>
598 static result_t &eval(
606 nsc_t nsc(trial_field, kernel);
608 for (
unsigned i = 0; i < num_test_nodes; ++i)
610 test_input_t tsti(test_field.
get_elem(), test_nset_t::corner_at(i));
611 nsc.integrate(result.row(i), tsti);
619 template <
class Elem,
class WaveNumber>
625 typedef typename kernel_t::test_input_t test_input_t;
626 typedef typename kernel_t::result_t res_t;
629 test_input_t
const &test_input,
633 return helmholtz_3d_SLP_collocation_constant_plane_nearly_singular::eval(
636 kernel.derived().get_wave_number());
640 template <
class Elem,
class WaveNumber>
646 typedef typename kernel_t::test_input_t test_input_t;
647 typedef typename kernel_t::result_t res_t;
650 test_input_t
const &test_input,
654 return helmholtz_3d_DLP_collocation_constant_plane_nearly_singular::eval(
657 kernel.derived().get_wave_number());
662 template <
class Elem,
class WaveNumber>
668 typedef typename kernel_t::test_input_t test_input_t;
669 typedef typename kernel_t::result_t res_t;
672 test_input_t
const &test_input,
676 return helmholtz_3d_DLPt_collocation_constant_plane_nearly_singular::eval(
679 test_input.get_unit_normal(),
680 kernel.derived().get_wave_number());
685 template <
class Elem,
class WaveNumber>
691 typedef typename kernel_t::test_input_t test_input_t;
692 typedef typename kernel_t::result_t res_t;
695 test_input_t
const &test_input,
699 return helmholtz_3d_HSP_collocation_constant_plane_nearly_singular::eval(
702 test_input.get_unit_normal(),
703 kernel.derived().get_wave_number());