43 use json_module,
only : json_file
51 use,
intrinsic :: iso_c_binding, only : c_ptr, c_null_ptr, c_associated
59 character(len=:),
allocatable :: filter_type
65 real(kind=
rp),
allocatable :: fh(:,:), fht(:,:)
66 type(c_ptr) :: fh_d = c_null_ptr
67 type(c_ptr) :: fht_d = c_null_ptr
69 real(kind=
rp),
allocatable :: trnsfr(:)
74 procedure, pass(this) :: init_from_components => &
88 type(json_file),
intent(inout) :: json
89 type(
coef_t),
intent(in) :: coef
90 character(len=:),
allocatable :: filter_type
93 this%filter_type = filter_type
96 call this%init_base(json, coef)
98 call this%init_from_components(coef%dof%xh%lx, this%filter_type)
106 character(len=*) :: filter_type
112 allocate(this%fh(nx, nx))
113 allocate(this%fht(nx, nx))
114 allocate(this%trnsfr(nx))
116 call rzero(this%fh, nx*nx)
117 call rzero(this%fht, nx*nx)
118 call rone(this%trnsfr, nx)
121 call device_map(this%fh, this%fh_d, this%nx * this%nx)
122 call device_map(this%fht, this%fht_d, this%nx * this%nx)
124 call device_cfill(this%fht_d, 0.0_rp, this%nx * this%nx)
133 if (
allocated(this%fh))
then
137 if (
allocated(this%fht))
then
141 if (
allocated(this%trnsfr))
then
142 deallocate(this%trnsfr)
145 if (c_associated(this%fh_d))
then
149 if (c_associated(this%fht_d))
then
153 this%filter_type =
""
157 call this%free_base()
166 this%nx, this%filter_type)
179 type(
field_t),
intent(inout) :: F_out
180 type(
field_t),
intent(in) :: F_in
183 call tnsr3d(f_out%x, this%nx, f_in%x, this%nx, this%fh, this%fht, this%fht, &
196 integer,
intent(in) :: nx
197 real(kind=
rp),
intent(inout) :: fh(nx, nx), fht(nx, nx)
198 real(kind=
rp),
intent(in) :: trnsfr(nx)
199 real(kind=
rp) :: diag(nx, nx), rmult(nx), lj(nx), zpts(nx)
201 integer :: n, i, j, k
203 character(len=*),
intent(in) :: filter_type
205 call phi%init(nx, nx)
206 call pht%init(nx, nx)
208 call zwgll(zpts, rmult, nx)
214 select case (filter_type)
219 pht%x(k,j) = lj(k)-lj(k-2)
226 call trsp(phi%x, nx, pht%x, nx)
234 diag(i,i) = trnsfr(i)
237 call mxm (diag, nx, pht%x, nx, fh, nx)
238 call mxm (phi%x, nx, fh, nx, pht%x, nx)
240 call copy (fh, pht%x, nx*nx)
241 call trsp (fht, nx, fh, nx)
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
subroutine, public device_cfill(a_d, c, n)
Set all elements to a constant c .
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public device_free(x_d)
Deallocate memory on the device.
Implements explicit_filter_t.
subroutine build_1d_cpu(fh, fht, trnsfr, nx, filter_type)
Build the 1d filter for an element on the CPU. Suppose field x is filtered into x_hat by x_hat = fh*x...
subroutine elementwise_filter_init_from_json(this, json, coef)
Constructor.
subroutine elementwise_filter_free(this)
Destructor.
subroutine build_1d(this)
Build the 1d filter for an element.
subroutine elementwise_filter_init_from_components(this, nx, filter_type)
Actual Constructor.
subroutine elementwise_field_filter_3d(this, f_out, f_in)
Filter a 3D field.
Filter to be applied to a scalar field.
Utilities for retrieving parameters from the case files.
subroutine, public rone(a, n)
Set all elements to one.
subroutine, public copy(a, b, n)
Copy a vector .
subroutine, public rzero(a, n)
Zero a real vector.
Wrapper for all matrix-matrix product implementations.
subroutine, public mxm(a, n1, b, n2, c, n3)
Compute matrix-matrix product for contiguously packed matrices A,B, and C.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
LIBRARY ROUTINES FOR SPECTRAL METHODS.
subroutine zwgll(z, w, np)
subroutine legendre_poly(l, x, n)
Evaluate Legendre polynomials of degrees 0-N at point x and store in array L.
subroutine, public trsp(a, lda, b, ldb)
Transpose of a rectangular tensor .
subroutine, public tnsr3d(v, nv, u, nu, a, bt, ct, nelv)
Tensor product performed on nelv elements.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Implements the explicit filter for SEM.
Base abstract class for filter.