diff --git a/src/global_interpolation/legendre_rst_finder.f90 b/src/global_interpolation/legendre_rst_finder.f90 index 6e2d1f5d458c..cf2386a24935 100644 --- a/src/global_interpolation/legendre_rst_finder.f90 +++ b/src/global_interpolation/legendre_rst_finder.f90 @@ -245,9 +245,12 @@ subroutine find_rst_legendre_cpu(this, rst, pt_x, pt_y, pt_z, & real(kind=rp) :: dt_legendre(this%Xh%lx, 1) real(kind=rp) :: jac(3,3) real(kind=xp) :: rst_d(3), jacinv(3,3) + real(kind=rp), dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: x_hat + real(kind=rp), dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: y_hat + real(kind=rp), dimension(this%Xh%lx * this%Xh%lx * this%Xh%lx) :: z_hat integer :: conv_pts logical :: converged - integer :: i, j, e, iter, lx + integer :: i, j, e, iter, lx, ih @@ -293,32 +296,40 @@ subroutine find_rst_legendre_cpu(this, rst, pt_x, pt_y, pt_z, & + rst(3,i)*dt_legendre(j, 1) end do e = (el_list(i))*this%Xh%lxyz + 1 + + ! Pull the element data to a static array instead of a slice + do ih = 0, lx*lx*lx - 1 + x_hat(ih + 1) = this%x_hat%x(e + ih) + y_hat(ih + 1) = this%y_hat%x(e + ih) + z_hat(ih + 1) = this%z_hat%x(e + ih) + end do + ! Compute the current xyz value - call tnsr3d_el_cpu(resx(i), 1, this%x_hat%x(e), lx, & + call tnsr3d_el_cpu(resx(i), 1, x_hat, lx, & r_legendre, s_legendre, t_legendre) - call tnsr3d_el_cpu(resy(i), 1, this%y_hat%x(e), lx, & + call tnsr3d_el_cpu(resy(i), 1, y_hat, lx, & r_legendre, s_legendre, t_legendre) - call tnsr3d_el_cpu(resz(i), 1, this%z_hat%x(e), lx, & + call tnsr3d_el_cpu(resz(i), 1, z_hat, lx, & r_legendre, s_legendre, t_legendre) ! This should in principle be merged into some larger kernel ! Compute the jacobian - call tnsr3d_el_cpu(jac(1,1), 1, this%x_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(1,1), 1, x_hat, lx, & dr_legendre, s_legendre, t_legendre) - call tnsr3d_el_cpu(jac(1,2), 1, this%y_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(1,2), 1, y_hat, lx, & dr_legendre, s_legendre, t_legendre) - call tnsr3d_el_cpu(jac(1,3), 1, this%z_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(1,3), 1, z_hat, lx, & dr_legendre, s_legendre, t_legendre) - call tnsr3d_el_cpu(jac(2,1), 1, this%x_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(2,1), 1, x_hat, lx, & r_legendre, ds_legendre, t_legendre) - call tnsr3d_el_cpu(jac(2,2), 1, this%y_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(2,2), 1, y_hat, lx, & r_legendre, ds_legendre, t_legendre) - call tnsr3d_el_cpu(jac(2,3), 1, this%z_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(2,3), 1, z_hat, lx, & r_legendre, ds_legendre, t_legendre) - call tnsr3d_el_cpu(jac(3,1), 1, this%x_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(3,1), 1, x_hat, lx, & r_legendre, s_legendre, dt_legendre) - call tnsr3d_el_cpu(jac(3,2), 1, this%y_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(3,2), 1, y_hat, lx, & r_legendre, s_legendre, dt_legendre) - call tnsr3d_el_cpu(jac(3,3), 1, this%z_hat%x(e), lx, & + call tnsr3d_el_cpu(jac(3,3), 1, z_hat, lx, & r_legendre, s_legendre, dt_legendre) resx(i) = pt_x(i) - resx(i) resy(i) = pt_y(i) - resy(i) diff --git a/src/wall_models/wall_sampler.f90 b/src/wall_models/wall_sampler.f90 index 15f226492173..f4099fee50ed 100644 --- a/src/wall_models/wall_sampler.f90 +++ b/src/wall_models/wall_sampler.f90 @@ -147,7 +147,7 @@ subroutine wall_sampler_init_base(this, n_nodes, n_samples, h, output_h) call neko_error('Wall sampler distances have an invalid size') end if - call this%h%free() + call this%h%init(h%size()) this%n_nodes = n_nodes this%n_samples = n_samples this%user_values = .false.