4 #include "sll_assert.h"
49 procedure :: eval_l0 => f_polar_bsplines_2d__eval_l0
50 procedure :: eval_l1 => f_polar_bsplines_2d__eval_l1
51 procedure :: eval_l2 => f_polar_bsplines_2d__eval_l2
66 real(wp) :: tau1, tau2, tau3
70 self%mapping => mapping
73 self%pole = mapping%pole()
76 nb1 = spline_basis_eta1%nbasis
77 nb2 = spline_basis_eta2%nbasis
80 associate(x0 => self%pole(1), &
82 c_x1 => mapping%spline_2d_x1%bcoef(2, 1:nb2), &
83 c_x2 => mapping%spline_2d_x2%bcoef(2, 1:nb2))
85 tau1 = maxval(-2.0_wp*(c_x1 - x0))
86 tau2 = maxval(c_x1 - x0 - sqrt(3.0_wp)*(c_x2 - y0))
87 tau3 = maxval(c_x1 - x0 + sqrt(3.0_wp)*(c_x2 - y0))
89 self%tau = max(tau1, tau2, tau3)
92 self%T0(1) = x0 + self%tau
94 self%T1(1) = x0 - self%tau*0.5_wp
95 self%T1(2) = y0 + self%tau*0.5_wp*sqrt(3.0_wp)
96 self%T2(1) = x0 - self%tau*0.5_wp
97 self%T2(2) = y0 - self%tau*0.5_wp*sqrt(3.0_wp)
102 call self%N0%init(spline_basis_eta1, spline_basis_eta2)
103 call self%N1%init(spline_basis_eta1, spline_basis_eta2)
104 call self%N2%init(spline_basis_eta1, spline_basis_eta2)
107 self%N0%bcoef(1:nb1, 1:nb2) = 0.0_wp
108 self%N1%bcoef(1:nb1, 1:nb2) = 0.0_wp
109 self%N2%bcoef(1:nb1, 1:nb2) = 0.0_wp
112 self%N0%bcoef(1, 1:nb2) = 1.0_wp/3.0_wp
113 self%N1%bcoef(1, 1:nb2) = 1.0_wp/3.0_wp
114 self%N2%bcoef(1, 1:nb2) = 1.0_wp/3.0_wp
117 associate(c_x1 => mapping%spline_2d_x1%bcoef(2, 1:nb2), &
118 c_x2 => mapping%spline_2d_x2%bcoef(2, 1:nb2))
120 self%N0%bcoef(2, 1:nb2) = self%eval_l0(c_x1, c_x2)
121 self%N1%bcoef(2, 1:nb2) = self%eval_l1(c_x1, c_x2)
122 self%N2%bcoef(2, 1:nb2) = self%eval_l2(c_x1, c_x2)
129 sll_pure
elemental function f_polar_bsplines_2d__eval_l0(self, x, y)
result(l0)
131 real(wp),
intent(in) :: x
132 real(wp),
intent(in) :: y
135 associate(x0 => self%pole(1), y0 => self%pole(2), tau => self%tau)
137 l0 = 1.0_wp/3.0_wp + 2.0_wp*(x - x0)/(3.0_wp*tau)
141 end function f_polar_bsplines_2d__eval_l0
144 sll_pure
elemental function f_polar_bsplines_2d__eval_l1(self, x, y)
result(l1)
146 real(wp),
intent(in) :: x
147 real(wp),
intent(in) :: y
150 associate(x0 => self%pole(1), y0 => self%pole(2), tau => self%tau)
152 l1 = 1.0_wp/3.0_wp - (x - x0)/(3.0_wp*tau) + (y - y0)/(sqrt(3.0_wp)*tau)
156 end function f_polar_bsplines_2d__eval_l1
159 sll_pure
elemental function f_polar_bsplines_2d__eval_l2(self, x, y)
result(l2)
161 real(wp),
intent(in) :: x
162 real(wp),
intent(in) :: y
165 associate(x0 => self%pole(1), y0 => self%pole(2), tau => self%tau)
167 l2 = 1.0_wp/3.0_wp - (x - x0)/(3.0_wp*tau) - (y - y0)/(sqrt(3.0_wp)*tau)
171 end function f_polar_bsplines_2d__eval_l2
Abstract class for B-splines of arbitrary degree.
subroutine s_polar_bsplines_2d__free(self)
integer, parameter wp
Working precision.
subroutine s_polar_bsplines_2d__init(self, spline_basis_eta1, spline_basis_eta2, mapping)
Module for tensor-product 2D splines.
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
Abstract type, B-splines.
Type containing new 2D polar basis functions.
Concrete type, discrete singular mapping.