50     real(kind=
rp), 
allocatable :: v(:,:) 
 
   52     real(kind=
rp), 
allocatable :: vt(:,:) 
 
   53     real(kind=
rp), 
allocatable :: vinv(:,:) 
 
   54     real(kind=
rp), 
allocatable :: vinvt(:,:) 
 
   56     real(kind=
rp), 
allocatable :: w(:,:) 
 
   58     real(kind=
rp), 
allocatable :: fldhat(:,:,:,:) 
 
   62     type(
mesh_t), 
pointer :: msh => null()
 
 
   78    type(
field_t), 
intent(in), 
target :: u
 
 
  109    if(
allocated(
cpr%v)) 
then 
  113    if(
allocated(
cpr%vt)) 
then 
  117    if(
allocated(
cpr%vinv)) 
then 
  121    if(
allocated(
cpr%vinvt)) 
then 
  122       deallocate(
cpr%vinvt)
 
  125    if(
allocated(
cpr%w)) 
then 
  129    if(
allocated(
cpr%fldhat)) 
then 
  130       deallocate(
cpr%fldhat)
 
 
  144    type(
cpr_t), 
intent(inout) :: cpr
 
  145    real(kind=
rp) :: l(0:
cpr%Xh%lx-1)
 
  146    real(kind=
rp) :: delta(
cpr%Xh%lx)
 
  147    integer :: i, kj, j, j2, kk
 
  149    associate(xh => 
cpr%Xh, v=> 
cpr%v, vt => 
cpr%vt, &
 
  150         vinv => 
cpr%vinv, vinvt => 
cpr%vinvt, w => 
cpr%w)
 
  158            l(j2) = ( (2*j2-1) * xh%zg(j,1) * l(j2-1) &
 
  159                 - (j2-1) * l(j2-2) ) / j2
 
  172         delta(i) = 2.0_rp / (2*(i-1)+1)
 
  175      delta(xh%lx) = 2.0_rp / (xh%lx-1)
 
  179         delta(i) = sqrt(1.0_rp / delta(i))
 
  184            v(i,j) = v(i,j) * delta(j) 
 
  189      call copy(vt, v, xh%lx * xh%lx)
 
  190      call trsp1(vt, xh%lx)
 
  206      call mxm(vt, xh%lx, w, xh%lx, vinv, xh%lx)
 
  209      call copy(vinvt, vinv, xh%lx * xh%lx)
 
  210      call trsp1(vinvt, xh%lx)
 
 
  219    type(
cpr_t), 
intent(inout) :: cpr
 
  220    real(kind=rp) :: w2(
cpr%Xh%lx,
cpr%Xh%lx,
cpr%Xh%lx)
 
  221    real(kind=rp) :: w1(
cpr%Xh%lx,
cpr%Xh%lx,
cpr%Xh%lx)
 
  222    real(kind=rp) :: specmat(
cpr%Xh%lx,
cpr%Xh%lx)
 
  223    real(kind=rp) :: specmatt(
cpr%Xh%lx,
cpr%Xh%lx)
 
  224    integer :: k, e, nxyz, nelv
 
  225    character(len=4) :: space
 
  232    if (
space .eq. 
'spec') 
then 
  233       call copy(specmat, 
cpr%vinv, 
cpr%Xh%lx*
cpr%Xh%lx)
 
  234       call copy(specmatt, 
cpr%vinvt, 
cpr%Xh%lx*
cpr%Xh%lx)
 
  236    if (
space .eq. 
'phys') 
then 
  237       call copy(specmat, 
cpr%v, 
cpr%Xh%lx*
cpr%Xh%lx)
 
  238       call copy(specmatt, 
cpr%vt, 
cpr%Xh%lx*
cpr%Xh%lx)
 
  243       if (
space .eq. 
'spec') 
then 
  244          call copy(w2, 
cpr%fld%x(1,1,1,e), nxyz) 
 
  246          call copy(w2, 
cpr%fldhat(1,1,1,e), nxyz) 
 
  249       call mxm(specmat, 
cpr%Xh%lx, w2, 
cpr%Xh%lx, w1, 
cpr%Xh%lx*
cpr%Xh%lx)
 
  252          call mxm(w1(1,1,k),
cpr%Xh%lx,specmatt,
cpr%Xh%lx,w2(1,1,k),
cpr%Xh%lx)
 
  255       call mxm (w2, 
cpr%Xh%lx*
cpr%Xh%lx, specmatt, 
cpr%Xh%lx,&
 
  256            cpr%fldhat(1,1,1,e), 
cpr%Xh%lx)
 
 
  263    type(
cpr_t), 
intent(inout) :: cpr
 
  264    type(coef_t), 
intent(inout) :: coef
 
  265    real(kind=rp) :: w2(
cpr%Xh%lx, 
cpr%Xh%lx, 
cpr%Xh%lx)
 
  266    real(kind=rp) :: w1(
cpr%Xh%lx, 
cpr%Xh%lx, 
cpr%Xh%lx)
 
  267    real(kind=rp) :: vsort(
cpr%Xh%lx * 
cpr%Xh%lx * 
cpr%Xh%lx)
 
  268    real(kind=rp) :: vtrunc(
cpr%Xh%lx, 
cpr%Xh%lx, 
cpr%Xh%lx)
 
  269    real(kind=rp) :: vtemp(
cpr%Xh%lx * 
cpr%Xh%lx * 
cpr%Xh%lx)
 
  270    real(kind=rp) :: errvec(
cpr%Xh%lx, 
cpr%Xh%lx, 
cpr%Xh%lx)
 
  271    real(kind=rp) :: fx(
cpr%Xh%lx, 
cpr%Xh%lx)
 
  272    real(kind=rp) :: fy(
cpr%Xh%lx, 
cpr%Xh%lx)
 
  273    real(kind=rp) :: fz(
cpr%Xh%lx, 
cpr%Xh%lx)
 
  274    real(kind=rp) :: l2norm, oldl2norm, targeterr
 
  275    integer :: isort(cpr%Xh%lx * cpr%Xh%lx * cpr%Xh%lx)
 
  276    integer :: i, j, k, e, nxyz, nelv
 
  277    integer :: kut, kutx, kuty, kutz, nx
 
  278    character(len=LOG_SIZE) :: log_buf
 
  289       call copy(vtemp, 
cpr%fldhat(1,1,1,e), nxyz)
 
  290       call copy(vtrunc, 
cpr%fldhat(1,1,1,e), nxyz)
 
  297       do while (l2norm .le. targeterr .and. kut .le. (
cpr%Xh%lx-1)*3)
 
  299          call copy(vtrunc, vtemp, nxyz)
 
  309          call copy(w2, vsort, nxyz)
 
  311          call mxm(fx, nx, w2, nx, w1, nx*nx)
 
  314             call mxm(w1(1,1,k), nx, fy, nx, w2(1,1,k), nx)
 
  317          call mxm (w2, nx*nx, fz, nx, vtemp, nx)
 
  321          call reord(vtemp, isort, nxyz)
 
  324          call sub3(errvec, 
cpr%fldhat(1,1,1,e), vtemp, nxyz)
 
  332       call copy(
cpr%fldhat(1,1,1,e), vtrunc, nxyz)
 
  339          write(log_buf, 
'(A)') &
 
  340               'Debugging info for e=50. Do not forget to delete' 
  341          call neko_log%message(log_buf)
 
  343          call reord(vsort,isort,nxyz)
 
  345          write(log_buf, 
'(A)') &
 
  347          call neko_log%message(log_buf)
 
  349          write(log_buf, 
'(A,E15.7)') &
 
  351          call neko_log%message(log_buf)
 
  352          write(log_buf, 
'(A)') &
 
  354          call neko_log%message(log_buf)
 
  356          write(log_buf, 
'(A,I5)') &
 
  358          call neko_log%message(log_buf)
 
  359          write(log_buf, 
'(A)') &
 
  360               'spectral coefficients' 
  361          call neko_log%message(log_buf)
 
  363             write(log_buf, 
'(A,E15.7,A,E15.7)') &
 
  364                  'org coeff:', vsort(i), 
' truncated coeff', &
 
  366             call neko_log%message(log_buf)
 
 
  376    integer, 
intent(in) :: nxyz
 
  377    real(kind=rp), 
intent(inout) :: vsort(nxyz)
 
  378    real(kind=rp), 
intent(inout) :: v(nxyz)
 
  379    integer, 
intent(inout) :: isort(nxyz)
 
  390    call sort(vsort, isort, nxyz)
 
  393    call flipv(vsort, isort, nxyz)
 
  396    call copy(vsort, v, nxyz)
 
  397    call swap(vsort, isort, nxyz)
 
 
  403    integer, 
intent(in) :: lx
 
  404    integer, 
intent(in) :: kut
 
  405    real(kind=rp), 
intent(inout) :: fx(lx,lx)
 
  406    real(kind=rp), 
intent(inout) :: fy(lx,lx)
 
  407    real(kind=rp), 
intent(inout) :: fz(lx,lx)
 
  408    integer :: i, j, k, k0, kk, kutx, kuty, kutz
 
  416    if (kut .gt. 0 .and. kut .le. (lx-1)) 
then 
  421    if (kut .gt. (lx-1) .and. kut .le. (lx-1)*2) 
then 
  426    if (kut .gt. (lx-1)*2 .and. kut .le. (lx-1)*3) 
then 
 
  468    type(coef_t), 
intent(in) :: coef
 
  469    real(kind=rp) :: elemdata(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx)
 
  470    real(kind=rp) :: vole, suma, l2e
 
  472    character(len=4) :: 
space 
  475    nxyz = coef%Xh%lx*coef%Xh%lx*coef%Xh%lx
 
  478       vole = vole+coef%B(i,1,1,e)
 
  483    if (
space .eq. 
'spec') 
then 
  485          suma = suma+elemdata(i,1,1)*elemdata(i,1,1)*coef%jac(i,1,1,e)
 
  488    if (
space .eq. 
'phys') 
then 
  490          suma = suma+elemdata(i,1,1)*elemdata(i,1,1)*coef%B(i,1,1,e)
 
  494    l2e = sqrt(suma)/sqrt(vole)
 
 
subroutine build_filter_tf(fx, fy, fz, kut, lx)
create filter transfer function
 
real(kind=rp) function get_elem_l2norm(elemdata, coef, space, e)
 
subroutine cpr_truncate_wn(cpr, coef)
Truncate the frequencies.
 
subroutine cpr_init_all(cpr, u)
Initialize cpr.
 
subroutine sortcoeff(vsort, v, isort, nxyz)
Sort the spectral coefficient in descending order array vsort. The original indices are stored in the...
 
subroutine cpr_goto_space(cpr, space)
Tranform to spectral space (using tensor product)
 
subroutine cpr_generate_specmat(cpr)
Generate spectral tranform matrices.
 
subroutine, public cpr_free(cpr)
Deallocate coefficients.
 
Defines a mapping of the degrees of freedom.
 
type(log_t), public neko_log
Global log stream.
 
integer, parameter, public log_size
 
subroutine, public sub3(a, b, c, n)
Vector subtraction .
 
subroutine, public copy(a, b, n)
Copy a 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, public rp
Global precision used in computations.
 
Defines a function space.
 
subroutine, public trsp1(a, n)
In-place transpose of a square tensor.
 
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
 
include information needed for compressing fields
 
The function space for the SEM solution fields.