51 use,
intrinsic :: iso_c_binding
66 real(kind=
rp),
allocatable :: weights_r(:,:)
67 real(kind=
rp),
allocatable :: weights_s(:,:)
68 real(kind=
rp),
allocatable :: weights_t(:,:)
69 type(c_ptr) :: weights_r_d = c_null_ptr
70 type(c_ptr) :: weights_s_d = c_null_ptr
71 type(c_ptr) :: weights_t_d = c_null_ptr
82 generic :: init => init_3arrays, init_1array
92 type(
space_t),
intent(in),
target :: Xh
93 integer,
intent(in) :: n_points
94 real(kind=
rp) :: r(n_points), s(n_points), t(n_points)
95 integer :: size_weights
97 if ((xh%t .eq.
gl) .or. (xh%t .eq.
gll))
then
103 this%n_points = n_points
104 allocate(this%weights_r(xh%lx,n_points))
105 allocate(this%weights_s(xh%ly,n_points))
106 allocate(this%weights_t(xh%lz,n_points))
107 call this%compute_weights(r, s, t)
108 size_weights = xh%lx * n_points
111 call device_map(this%weights_r, this%weights_r_d, size_weights)
112 call device_map(this%weights_s, this%weights_s_d, size_weights)
113 call device_map(this%weights_t, this%weights_t_d, size_weights)
128 type(
space_t),
intent(in),
target :: Xh
129 integer,
intent(in) :: n_points
130 real(kind=
rp),
intent(in) :: rst(3,n_points)
131 real(kind=
rp),
allocatable :: r(:), s(:), t(:)
134 if (
allocated(r))
deallocate(r)
135 allocate(r(n_points))
136 if (
allocated(s))
deallocate(s)
137 allocate(s(n_points))
138 if (
allocated(t))
deallocate(t)
139 allocate(t(n_points))
147 call this%init_3arrays(xh, r, s, t, n_points)
158 if (
associated(this%Xh)) this%Xh => null()
160 if(
allocated(this%weights_r))
deallocate(this%weights_r)
161 if(
allocated(this%weights_s))
deallocate(this%weights_s)
162 if(
allocated(this%weights_t))
deallocate(this%weights_t)
163 if (c_associated(this%weights_r_d))
then
166 if (c_associated(this%weights_s_d))
then
169 if (c_associated(this%weights_t_d))
then
186 real(kind=
rp),
intent(in) :: r(:), s(:), t(:)
193 if ((r(i) <= 1.1_rp .and. r(i) >= -1.1_rp) .and. &
194 (s(i) <= 1.1_rp .and. s(i) >= -1.1_rp) .and. &
195 (t(i) <= 1.1_rp .and. t(i) >= -1.1_rp))
then
196 call fd_weights_full(r(i), this%Xh%zg(:,1), lx-1, 0, this%weights_r(:,i))
197 call fd_weights_full(s(i), this%Xh%zg(:,2), lx-1, 0, this%weights_s(:,i))
198 call fd_weights_full(t(i), this%Xh%zg(:,3), lx-1, 0, this%weights_t(:,i))
200 this%weights_r(:,i) = 0.0_rp
201 this%weights_s(:,i) = 0.0_rp
202 this%weights_t(:,i) = 0.0_rp
224 integer,
intent(in) :: el_list(this%n_points)
225 integer,
intent(in) :: nel
226 real(kind=
rp),
intent(inout) :: interp_values(this%n_points)
227 real(kind=
rp),
intent(inout) ::
field(this%Xh%lxyz, nel)
228 logical,
intent(in) :: on_host
231 this%weights_r, this%weights_s, this%weights_t, el_list, &
232 this%n_points, on_host)
243 integer,
intent(in) :: n_pts
244 real(kind=
rp),
intent(inout) :: rst(3, n_pts)
245 type(
space_t),
intent(inout) :: xh
246 real(kind=
rp),
intent(inout) :: x(xh%lx, xh%ly, xh%lz, n_pts)
247 real(kind=
rp),
intent(inout) :: y(xh%lx, xh%ly, xh%lz, n_pts)
248 real(kind=
rp),
intent(inout) :: z(xh%lx, xh%ly, xh%lz, n_pts)
249 real(kind=
rp),
intent(out) :: jac(3,3, n_pts)
250 real(kind=
rp) :: tmp(3)
251 real(kind=
rp) :: hr(xh%lx, 2), hs(xh%ly, 2), ht(xh%lz, 2)
252 integer :: lx, ly, lz, i
264 call triple_tensor_product(tmp(1), x(:,:,:,i), lx, hr(:,2), hs(:,1), &
267 call triple_tensor_product(tmp(1), y(:,:,:,i), lx, hr(:,2), hs(:,1), &
270 call triple_tensor_product(tmp(1), z(:,:,:,i), lx, hr(:,2), hs(:,1), &
275 call triple_tensor_product(tmp, x(:,:,:,i), y(:,:,:,i), z(:,:,:,i), lx, &
276 hr(:,1), hs(:,2), ht(:,1))
280 call triple_tensor_product(tmp, x(:,:,:,i), y(:,:,:,i), z(:,:,:,i), lx, &
281 hr(:,1), hs(:,1), ht(:,2))
289 real(kind=
rp),
intent(inout) :: rst(3, n_pts)
290 type(
space_t),
intent(inout) :: xh
291 real(kind=
rp),
intent(inout) :: x(xh%lx, xh%ly, xh%lz, n_pts)
292 real(kind=
rp),
intent(inout) :: y(xh%lx, xh%ly, xh%lz, n_pts)
293 real(kind=
rp),
intent(inout) :: z(xh%lx, xh%ly, xh%lz, n_pts)
294 real(kind=
rp),
intent(out) :: jacinv(3,3, n_pts)
295 real(kind=
rp) :: tmp(3,3)
298 call jacobian(jacinv, rst, x, y, z, n_pts, xh)
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
subroutine, public device_rzero(a_d, n, strm)
Zero a real vector.
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public device_free(x_d)
Deallocate memory on the device.
Fast diagonalization methods from NEKTON.
subroutine, public fd_weights_full(xi, x, n, m, c)
Compute finite-difference stencil weights for evaluating derivatives up to order at a point.
subroutine, public setup_intp(jh, jht, z_to, z_from, n_to, n_from, derivative)
Compute interpolation weights for points z_to using values at points z_from.
Routines to obtain interpolated values on a set of points with known rst coordinates in elements loca...
subroutine local_interpolator_compute_weights(this, r, s, t)
Computes interpolation weights for a list of points.
subroutine local_interpolator_free(this)
Free pointers.
subroutine jacobian(jac, rst, x, y, z, n_pts, xh)
Constructs the Jacobian, returns a 3-by-3 times number of points where .
subroutine local_interpolator_init_3arrays(this, xh, r, s, t, n_points)
Initialization of point interpolation.
subroutine local_interpolator_init_1array(this, xh, rst, n_points)
Initialization of point interpolation.
subroutine jacobian_inverse(jacinv, rst, x, y, z, n_pts, xh)
subroutine local_interpolator_evaluate(this, interp_values, el_list, field, nel, on_host)
Interpolates a list of fields based on a set of element ids.
real(rp) function, dimension(3, 3), public matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33)
real(kind=xp) function, dimension(3, 3), public matinv3(a)
Performs a direct calculation of the inverse of a 3×3 matrix. M33INV and M44INV by David G....
real(kind=rp), parameter, public neko_eps
Machine epsilon .
integer, parameter neko_bcknd_device
integer, parameter, public xp
integer, parameter, public rp
Global precision used in computations.
Defines a function space.
integer, parameter, public gll
integer, parameter, public gl
LIBRARY ROUTINES FOR SPECTRAL METHODS.
subroutine, public tnsr3d_el_list(v, nv, u, nu, a, bt, ct, el_list, n_pt, on_host)
Tensor product performed on a subset of the elements.
subroutine, public tnsr3d(v, nv, u, nu, a, bt, ct, nelv)
Tensor product performed on nelv elements.
field_list_t, To be able to group fields together
Interpolation on a set of points with known rst coordinates in elements local to this process....
A point in with coordinates .
The function space for the SEM solution fields.