3 #include "sll_assert.h"
41 integer :: nbasis_eta1
42 integer :: nbasis_eta2
45 integer :: degree_eta1
46 integer :: degree_eta2
49 real(
wp),
allocatable :: tau_eta1(:)
50 real(
wp),
allocatable :: tau_eta2(:)
52 real(
wp),
allocatable :: gtau_x1(:, :)
53 real(
wp),
allocatable :: gtau_x2(:, :)
65 procedure :: pole => f_singular_mapping_discrete__pole
66 procedure :: eval => f_singular_mapping_discrete__eval
67 procedure :: jmat => f_singular_mapping_discrete__jmat
79 class(sll_c_bsplines),
intent(in) :: spline_basis_eta1
80 class(sll_c_bsplines),
intent(in) :: spline_basis_eta2
84 real(wp) :: eta(2), x(2)
87 self%nbasis_eta1 = spline_basis_eta1%nbasis
88 self%nbasis_eta2 = spline_basis_eta2%nbasis
91 self%degree_eta1 = spline_basis_eta1%degree
92 self%degree_eta2 = spline_basis_eta2%degree
95 call self%spline_2d_x1%init( &
96 bsplines_x1=spline_basis_eta1, &
97 bsplines_x2=spline_basis_eta2)
100 call self%spline_2d_x2%init( &
101 bsplines_x1=spline_basis_eta1, &
102 bsplines_x2=spline_basis_eta2)
105 call self%spline_interp_eta12%init( &
106 bspl1=spline_basis_eta1, &
107 bspl2=spline_basis_eta2, &
108 bc_xmin=[sll_p_greville, sll_p_periodic], &
109 bc_xmax=[sll_p_greville, sll_p_periodic])
112 call self%spline_interp_eta12%get_interp_points( &
113 tau1=self%tau_eta1, &
116 allocate (self%gtau_x1(
size(self%tau_eta1),
size(self%tau_eta2)))
117 allocate (self%gtau_x2(
size(self%tau_eta1),
size(self%tau_eta2)))
119 associate(ntau1 =>
size(self%tau_eta1), ntau2 =>
size(self%tau_eta2))
124 eta(1) = self%tau_eta1(i1)
125 eta(2) = self%tau_eta2(i2)
126 x(:) = mapping_analytic%eval(eta)
127 self%gtau_x1(i1, i2) = x(1)
128 self%gtau_x2(i1, i2) = x(2)
135 call self%spline_interp_eta12%compute_interpolant( &
136 spline=self%spline_2d_x1, &
140 call self%spline_interp_eta12%compute_interpolant( &
141 spline=self%spline_2d_x2, &
147 sll_pure
function f_singular_mapping_discrete__pole(self)
result(pole)
151 pole(1) = self%spline_2d_x1%bcoef(1, 1)
152 pole(2) = self%spline_2d_x2%bcoef(1, 1)
154 end function f_singular_mapping_discrete__pole
157 sll_pure
function f_singular_mapping_discrete__eval(self, eta)
result(x)
159 real(wp),
intent(in) :: eta(2)
162 x(1) = self%spline_2d_x1%eval(eta(1), eta(2))
163 x(2) = self%spline_2d_x2%eval(eta(1), eta(2))
165 end function f_singular_mapping_discrete__eval
168 sll_pure
function f_singular_mapping_discrete__jmat(self, eta)
result(jmat)
170 real(wp),
intent(in) :: eta(2)
171 real(wp) :: jmat(2, 2)
177 jmat(1, 1) = self%spline_2d_x1%eval_deriv_x1(eta(1), eta(2))
178 jmat(1, 2) = self%spline_2d_x1%eval_deriv_x2(eta(1), eta(2))
179 jmat(2, 1) = self%spline_2d_x2%eval_deriv_x1(eta(1), eta(2))
180 jmat(2, 2) = self%spline_2d_x2%eval_deriv_x2(eta(1), eta(2))
182 end function f_singular_mapping_discrete__jmat
187 integer,
intent(in) :: n1
188 integer,
intent(in) :: n2
189 type(sll_t_hdf5_ser_handle),
intent(in) :: file_id
192 real(wp) :: eta(2), x(2)
194 real(wp),
allocatable :: x1(:, :), x2(:, :), jacobian(:, :)
200 allocate (x1(n1, n2 + 1))
201 allocate (x2(n1, n2 + 1))
204 allocate (jacobian(n1, n2 + 1))
209 eta(1) = real(i1 - 1, wp)/real(n1 - 1, wp)
210 eta(2) = real(i2 - 1, wp)*sll_p_twopi/real(n2, wp)
211 x(:) = self%eval(eta)
214 jacobian(i1, i2) = self%jdet(eta)
219 call sll_o_hdf5_ser_write_array(file_id, x1,
"/x1", error)
220 call sll_o_hdf5_ser_write_array(file_id, x2,
"/x2", error)
223 call sll_o_hdf5_ser_write_array(file_id, jacobian,
"/jacobian", error)
226 associate(nb1 => self%nbasis_eta1, nb2 => self%nbasis_eta2)
227 call sll_o_hdf5_ser_write_array(file_id, self%spline_2d_x1%bcoef(1:nb1, 1:nb2),
"/c_x1", error)
228 call sll_o_hdf5_ser_write_array(file_id, self%spline_2d_x2%bcoef(1:nb1, 1:nb2),
"/c_x2", error)
237 deallocate (self%tau_eta1)
238 deallocate (self%tau_eta2)
239 deallocate (self%gtau_x1)
240 deallocate (self%gtau_x2)
242 call self%spline_2d_x1%free()
243 call self%spline_2d_x2%free()
245 call self%spline_interp_eta12%free()
Write nD array of double precision floats or integers into HDF5 file.
Describe different boundary conditions.
Access point to B-splines of arbitrary degree providing factory function.
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_twopi
Implements the functions to write hdf5 file to store heavy data.
subroutine, public sll_s_hdf5_ser_file_create(filename, handle, error)
Create new HDF5 file.
subroutine, public sll_s_hdf5_ser_file_close(handle, error)
Close existing HDF5 file.
subroutine s_singular_mapping_discrete__init(self, spline_basis_eta1, spline_basis_eta2, mapping_analytic)
subroutine s_singular_mapping_discrete__free(self)
integer, parameter wp
Working precision.
subroutine s_singular_mapping_discrete__store_data(self, n1, n2, file_id)
Module for tensor-product 2D splines.
Interpolator for 2D tensor-product splines of arbitrary degree, on uniform and non-uniform grids (dir...
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
Opaque object around HDF5 file id.
Abstract type, analytical singular mapping.
Abstract type, singular mapping.
Concrete type, discrete singular mapping.
2D tensor-product spline interpolator