Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
interp_mod.F90
Go to the documentation of this file.
1 
3 
5 module interp
6  use kinds, only : dp
7  use size_m, only : lxd, ldim
8  implicit none
9 
10  private :: pjgl, pdg
11  public
12 
13  integer, parameter :: ldg=lxd**3, lwkd=4*lxd*lxd
14  integer, parameter :: ld=2*lxd
15  integer, parameter :: ldw = 2*(ld**ldim)
16 
17  real(DP), save :: jgl(ldg), jgt(ldg)
18  real(DP), save :: dgl(ldg), dgt(ldg)
19  integer, save :: pjgl(0:ld*ld) = 0
20  integer, save :: pdg(0:ld*ld) = 0
21 
22  real(DP) :: w(ld**ldim,2)
23  real(DP) :: wkd(lwkd)
24 
25 contains
26 
27 !-----------------------------------------------------------------------
32 subroutine get_int_ptr (ip, mx, md) ! GLL-->GL pointer
33  use kinds, only : dp
34  use size_m
35  implicit none
36 
37  integer, intent(out) :: ip
38  integer, intent(in) :: mx, md
39 
40  integer :: ij, nstore, nwrkd
41 
42  ij = md + ld*(mx-1)
43  ip = pjgl(ij)
44 
45  if (ip == 0) then
46 
47  nstore = pjgl(0)
48  pjgl(ij) = nstore+1
49  nstore = nstore + md*mx
50  pjgl(0) = nstore
51  ip = pjgl(ij)
52 
53  nwrkd = mx + md
54  call lim_chk(nstore,ldg ,'jgl ','ldg ','get_int_pt')
55  call lim_chk(nwrkd ,lwkd,'wkd ','lwkd ','get_int_pt')
56 
57  call gen_int(jgl(ip),jgt(ip),md,mx,wkd)
58  endif
59 
60  return
61 end subroutine get_int_ptr
62 
63 !-----------------------------------------------------------------------
65 subroutine get_dgl_ptr (ip, mx,md)
66  use kinds, only : dp
67  use size_m, only : lxd
68  implicit none
69 
70 
71  integer, intent(out) :: ip
72  integer, intent(in) :: mx, md
73 
74 
75  integer :: ij, nstore, nwrkd
76 
77  ij = md + ld*(mx-1)
78  ip = pdg(ij)
79 
80  if (ip == 0) then
81 
82  nstore = pdg(0)
83  pdg(ij) = nstore+1
84  nstore = nstore + md*mx
85  pdg(0) = nstore
86  ip = pdg(ij)
87 
88  nwrkd = mx + md
89  call lim_chk(nstore,ldg ,'dg ','ldg ','get_dgl_pt')
90  call lim_chk(nwrkd ,lwkd,'wkd ','lwkd ','get_dgl_pt')
91 
92  call gen_dgl(dgl(ip),dgt(ip),md,mx,wkd)
93  endif
94 
95  return
96 end subroutine get_dgl_ptr
97 
98 end module
99 
100 !-----------------------------------------------------------------------
107 subroutine gen_int(jgl,jgt,mp,np,w)
108  use kinds, only : dp
109  use speclib, only : zwgl, zwgll
110  implicit none
111 
112  integer, intent(in) :: mp, np
113  real(DP) :: jgl(mp,np),jgt(np*mp),w(*)
114 
115  integer :: iz, id, n, i, j
116 
117  iz = 1
118  id = iz + np
119 
120  call zwgll(w(iz),jgt,np)
121  call zwgl(w(id),jgt,mp)
122 
123  n = np-1
124  do i=1,mp
125  call fd_weights_full(w(id+i-1),w(iz),n,0,jgt)
126  do j=1,np
127  jgl(i,j) = jgt(j) ! Interpolation matrix
128  enddo
129  enddo
130 
131  call transpose(jgt,np,jgl,mp)
132 
133  return
134 end subroutine gen_int
135 
136 
137 !-----------------------------------------------------------------------
144 subroutine gen_dgl(dgl,dgt,mp,np,w)
145  use kinds, only : dp
146  use speclib, only : zwgl
147  implicit none
148 
149  integer, intent(in) :: mp, np
150  real(DP) :: dgl(mp,np),dgt(np*mp),w(*)
151 
152  integer :: iz, id, ndgt, ldgt, n, i, j
153 
154  iz = 1
155  id = iz + np
156 
157  call zwgl(w(iz),dgt,np) ! GL points
158  call zwgl(w(id),dgt,mp) ! GL points
159 
160  ndgt = 2*np
161  ldgt = mp*np
162  call lim_chk(ndgt,ldgt,'ldgt ','dgt ','gen_dgl ')
163 
164  n = np-1
165  do i=1,mp
166  call fd_weights_full(w(id+i-1),w(iz),n,1,dgt) ! 1=1st deriv.
167  do j=1,np
168  dgl(i,j) = dgt(np+j) ! Derivative matrix
169  enddo
170  enddo
171 
172  call transpose(dgt,np,dgl,mp)
173 
174  return
175 end subroutine gen_dgl
176 !-----------------------------------------------------------------------
178 subroutine lim_chk(n,m,avar5,lvar5,sub_name10)
179  use size_m, only : nid ! need nid
180  implicit none
181  character(5), intent(in) :: avar5,lvar5
182  character(10), intent(in) :: sub_name10
183  integer, intent(in) :: n, m
184 
185  if (n > m) then
186  write(6,1) nid,n,m,avar5,lvar5,sub_name10
187  1 format(i8,' ERROR: :',2i12,2(1x,a5),1x,a10)
188  call exitti('lim_chk problem. $',n)
189  endif
190 
191  return
192 end subroutine lim_chk
193 !-----------------------------------------------------------------------
subroutine get_dgl_ptr(ip, mx, md)
Get pointer to GL-GL interpolation dgl() for pair (mx,md)
Definition: interp_mod.F90:65
Module containing memoized interpolation matrices.
Definition: interp_mod.F90:5
subroutine get_int_ptr(ip, mx, md)
Get pointer to jgl() for interpolation pair (mx,md)
Definition: interp_mod.F90:32
subroutine gen_int(jgl, jgt, mp, np, w)
Generate interpolation from np GLL points to mp GL points jgl = interpolation matrix, mapping from velocity nodes to pressure jgt = transpose of interpolation matrix w = work array of size (np+mp) np = number of points on GLL grid mp = number of points on GL grid.
Definition: interp_mod.F90:107
subroutine fd_weights_full(xx, x, n, m, c)
This routine evaluates the derivative based on all points in the stencils. It is more memory efficien...
Definition: fast3d.F90:409
subroutine gen_dgl(dgl, dgt, mp, np, w)
Generate derivative from np GL points onto mp GL points dgl = interpolation matrix, mapping from velocity nodes to pressure dgt = transpose of interpolation matrix w = work array of size (3*np+mp) np = number of points on GLL grid mp = number of points on GL grid.
Definition: interp_mod.F90:144
subroutine lim_chk(n, m, avar5, lvar5, sub_name10)
Check array limits.
Definition: interp_mod.F90:178
subroutine, public zwgll(Z, W, NP)
Definition: speclib.F90:95
subroutine exitti(stringi, idata)
Definition: comm_mpi.F90:328
subroutine, public zwgl(Z, W, NP)
Generate NP Gauss Legendre points (Z) and weights (W) associated with Jacobi polynomial P(N)(alpha=0...
Definition: speclib.F90:77