KTH framework for Nek5000 toolboxes; testing version  0.0.1
lpm_solve.f
Go to the documentation of this file.
1 !-----------------------------------------------------------------------
2  subroutine lpm_init(rparam,yp,nyp,pp,npp,npart,time_)
3  include 'SIZE'
4  include 'TOTAL'
5  include 'CTIMER'
6 # include "LPM"
7 
8  real yp(*)
9  real pp(*)
10  real rparam(*)
11 
12  lpm_d2chk(2) = 0.0
13  lpm_npart = npart
14  lpm_timef = time_
15 
16  if (nyp.gt.lpm_lrs)
17  $ call exitti('nyp > LPM_LRS$',nyp)
18 
19  if (npp.gt.lpm_lrp)
20  $ call exitti('npp > LPM_LRP$',npp)
21 
22  if (lpm_npart.gt.lpm_lpart)
23  $ call exitti('lpm_npart > LPM_LPART$',lpm_npart)
24 
25  call copy(lpm_y ,yp,lpm_npart*nyp)
26  call copy(lpm_rprop,pp,lpm_npart*npp)
27 
28  if (nio.eq.0) then
29  write(6,*) ' '
30  write(6,*) 'initialize LPM'
31  if (int(rparam(1)) .ne. 0)
32  $ write(6,*) 'overwrite default settings'
33  endif
34 
35  call lpm_rparam_set(rparam)
36  call lpm_tag_init
37  call lpm_tag_set
38 
39  ! get domain bounds
40  call domain_size( lpm_xdrange(1,1),lpm_xdrange(2,1)
41  > ,lpm_xdrange(1,2),lpm_xdrange(2,2)
42  > ,lpm_xdrange(1,3),lpm_xdrange(2,3))
43 
44  ! send particles to correct rank
45  call lpm_init_filter
46 
47  call lpm_comm_setup
49 
50  ! two-way coupling init
51  if (int(lpm_rparam(4)) .ne. 1) then
52  call lpm_project
53  endif
54 
55  call nekgsync()
56  if (nio.eq.0) then
57  write(6,*) 'done :: initialize LPM'
58  write(6,*) ' '
59  endif
60 
61  return
62  end
63 !-----------------------------------------------------------------------
64  subroutine lpm_rparam_set(rparam)
65  include 'SIZE'
66  include 'TOTAL'
67 # include "LPM"
68 
69  real rparam(*)
70 
71  if (rparam(1) .eq. 0) then ! set defaults
72  lpm_rparam(2) = 1 ! time integration method
73  lpm_rparam(3) = lx1-1 ! polynomial order of mesh
74  lpm_rparam(4) = 0 ! use 1 for tracers only
75  lpm_rparam(5) = 0 ! index of filter non-dim in rprop
76  lpm_rparam(6) = 0 ! non-dimensional Gaussian filter width
77  lpm_rparam(7) = 0 ! percent decay of Gaussian filter
78  lpm_rparam(8) = 0 ! periodic in x
79  lpm_rparam(9) = 0 ! periodic in y
80  lpm_rparam(10) = 0 ! periodic in z
81  else ! custom values
82  do i=2,lpm_nparam
83  lpm_rparam(i) = rparam(i)
84  enddo
85  endif
86 
87  return
88  end
89 !-----------------------------------------------------------------------
90  subroutine lpm_init_filter
91  include 'SIZE'
92  include 'TOTAL'
93 # include "LPM"
94 
95  rsig = 0.0
96  jdp = int(lpm_rparam(5))
97  filt = lpm_rparam(6)
98  alph = lpm_rparam(7)
99 
100  rdx_max = 0.0
101 
102  lx1m1 = max(1,lx1-1)
103  ly1m1 = max(1,ly1-1)
104  lz1m1 = max(1,lz1-1)
105 
106  ! first, compute what is the smallest filter size for the grid
107  do ie=1,nelt
108  do k=1,lz1m1
109  do j=1,ly1m1
110  do i=1,lx1m1
111  ip1 = i+1
112  jp1 = j+1
113  kp1 = k+1
114 
115  rdx_test = xm1(ip1,j,k,ie) - xm1(i,j,k,ie)
116  rdy_test = ym1(i,jp1,k,ie) - ym1(i,j,k,ie)
117  if (if3d)
118  > rdz_test = zm1(i,j,kp1,ie) - zm1(i,j,k,ie)
119 
120  rdist = max(rdx_test,rdy_test)
121  if (if3d)
122  > rdist = max(rdz_test,rdist)
123 
124  rdx_dy_test = sqrt(rdx_test**2 + rdy_test**2)
125  rdist = max(rdx_dy_test,rdist)
126  if (if3d) then
127  rdy_dz_test = sqrt(rdy_test**2 + rdz_test**2)
128  rdist = max(rdy_dz_test,rdist)
129  rdx_dz_test = sqrt(rdx_test**2 + rdz_test**2)
130  rdist = max(rdx_dz_test,rdist)
131  endif
132 
133  if (rdist .gt. rdx_max) rdx_max = rdist
134  enddo
135  enddo
136  enddo
137  enddo
138  rdx_max = glmax(rdx_max,1)
139 
140  lpm_rdx_max = rdx_max
141 
142  rsig_dx_min_set = 0.25
143  rfilt_dp_min_set = 1.0
144  rsig_dx_min = 1e12
145 
146  tol = 1.e-12
147  if (wdsize.eq.4) tol = 1.e-6
148 
149  rfilt = lpm_rparam(6)
150  lpm_d2chk(2) = -1
151  if (abs(alph) .lt. tol) then
152  alph = 1e-3
153  lpm_rparam(7) = alph
154  endif
155 
156  do i=1,lpm_npart
157 
158  if (filt .lt. tol) then
159  rsig_test_grid = rsig_dx_min_set*rdx_max + tol
160  rsig_test_diam = rfilt_dp_min_set*lpm_rprop(jdp,i)
161  > /(2.*sqrt(2.*log(2.)))
162  rsig_test = max(rsig_test_grid,rsig_test_diam)
163  filt = rsig_test/lpm_rprop(jdp,i)*2.*sqrt(2.*log(2.))
164  rfilt = filt
165  else
166  rsig_test = filt*lpm_rprop(jdp,i)/(2.*sqrt(2.*log(2.)))
167  endif
168 
169  rsig_dx = rsig_test/rdx_max
170  if (rsig_dx .lt. rsig_dx_min) rsig_dx_min = rsig_dx
171 
172  if (rsig_test .gt. rsig) rsig = rsig_test
173  enddo
174  rsig = glmax(rsig,1)
175  rsig_dx_min = glmin(rsig_dx_min,1)
176 
177  lpm_d2chk(2) = rsig*sqrt(-2*log(alph))
178 
179  if (rsig_dx_min .lt. rsig_dx_min_set) then
180  if (nid .eq. 0) then
181  filt_new = filt/(rsig_dx_min/rsig_dx_min_set)
182  write(6,100) filt, filt_new
183  100 format('Reset Gaussian filter width from', e14.7
184  > ' to', e14.7, ' or larger')
185  endif
186  call exitt
187  endif
188 
189  lpm_rparam(6) = glmax(rfilt,1)
190  lpm_d2chk(2) = glmax(lpm_d2chk(2),1)
191  if (int(lpm_rparam(4)) .eq. 1) lpm_d2chk(2) = 0
192 
193  return
194  end
195 c----------------------------------------------------------------------
196  subroutine lpm_tag_set
197  include 'SIZE'
198  include 'TOTAL'
199 # include "LPM"
200 
201  do i=1,lpm_npart
202  if (lpm_iprop(5,i) .eq. -1) lpm_iprop(5,i) = nid
203  if (lpm_iprop(6,i) .eq. -1) lpm_iprop(6,i) = istep
204  if (lpm_iprop(7,i) .eq. -1) lpm_iprop(7,i) = i
205  enddo
206 
207  return
208  end
209 c----------------------------------------------------------------------
210  subroutine lpm_tag_init
211  include 'SIZE'
212  include 'TOTAL'
213 # include "LPM"
214 
215  if (.not. lpm_restart) then
216  do i=1,lpm_lpart
217  lpm_iprop(5,i) = -1
218  lpm_iprop(6,i) = -1
219  lpm_iprop(7,i) = -1
220  enddo
221  endif
222 
223  return
224  end
225 c----------------------------------------------------------------------
226  subroutine lpm_solve(time_)
227  include 'SIZE'
228  include 'TSTEP'
229 # include "LPM"
230 
231  real time_
232 
233  ts = dnekclock()
234 
235  isol = lpm_rparam(2)
236  dt_ = time_ - lpm_timef
237  n = lpm_npart*lpm_lrs
238 
239  ! save previous solution
240  call copy(lpm_y1,lpm_y,n)
241 
242  if (isol .eq. 1) then
243  call lpm_rk3_driver(time_,dt_,lpm_y1,lpm_y,lpm_ydot,n)
244  else
245  call exitti('unknown LPM integrator$',isol)
246  endif
247 
248  lpm_timef = time_
249 
250  if(nio.eq.0)
251  & write(*,'(4x,i7,a,1p3e12.4)')
252  & istep,' LPM-solver done',time,dnekclock()-ts, lpm_timef
253 
254  return
255  end
256 c----------------------------------------------------------------------
257  subroutine lpm_rk3_driver(time_,dt_,y0,y,ydot,n)
258  include 'SIZE'
259 # include "LPM"
260 
261  real time_
262  real y0(*)
263  real y(*)
264  real ydot(*)
265 
266  parameter(nstage = 3)
267  real tcoef(3,3)
268 
269  call lpm_rk3_coeff(tcoef,dt_)
270 
271  do istage=1,nstage
272  call lpm_fun(time_,y,ydot)
273  do i=1,n
274  y(i) = tcoef(1,istage)*y0(i)
275  > + tcoef(2,istage)*y(i)
276  > + tcoef(3,istage)*ydot(i)
277  enddo
278  enddo
279 
280  return
281  end
282 !-----------------------------------------------------------------------
284  include 'SIZE'
285 # include "LPM"
286 
287  call lpm_move_outlier
288  call lpm_comm_bin_setup
289  call lpm_comm_findpts
290 
291  call lpm_comm_crystal
292 
293  return
294  end
295 !-----------------------------------------------------------------------
296  subroutine lpm_interpolate_fld(jp,fld)
297  include 'SIZE'
298 # include "LPM"
299 
300  common /intp_h/ ih_intp(2,1)
301 
302  real fld(*)
303 
304  ih_intp1 = ih_intp(1,i_fp_hndl)
305 
306 c call fgslib_findpts_eval_local( ih_intp1
307 c > ,lpm_rprop (jp,1)
308 c > ,LPM_LRP
309 c > ,lpm_iprop (2,1)
310 c > ,LPM_LIP
311 c > ,lpm_rprop2(1,1)
312 c > ,LPM_LRP2
313 c > ,LPM_NPART
314 c > ,fld)
315 
316  call fgslib_findpts_eval( ih_intp1
317  > ,lpm_rprop(jp,1)
318  > ,lpm_lrp
319  > ,lpm_iprop(1,1)
320  > ,lpm_lip
321  > ,lpm_iprop(3,1)
322  > ,lpm_lip
323  > ,lpm_iprop(2,1)
324  > ,lpm_lip
325  > ,lpm_rprop2(1,1)
326  > ,lpm_lrp2
327  > ,lpm_npart
328  > ,fld)
329 
330  return
331  end
332 c----------------------------------------------------------------------
333  subroutine lpm_project
334  include 'SIZE'
335 # include "LPM"
336 
337  if (int(lpm_rparam(4)) .ne. 1) then
340  call lpm_solve_project
341  endif
342 
343  return
344  end
345 c----------------------------------------------------------------------
346  subroutine lpm_solve_project
347  include 'SIZE'
348  include 'TOTAL'
349 # include "LPM"
350 
351  real phig(lx1,ly1,lz1,lelt)
352  common /otherpvar/ phig
353 
354  real multfci
355  integer e
356 
357  common /lpm_fix/ phigdum,phigvdum
358  real phigdum(lx1,ly1,lz1,lelt,3),phigvdum(lx1,ly1,lz1,lelt)
359 
360  real xrun(lx1),yrun(ly1),zrun(lz1)
361 
362  integer xrune(lx1),yrune(ly1),zrune(lz1)
363 
364  real rproj(1+LPM_LRP_GP,LPM_LPART+LPM_LPART_GP)
365  integer iproj(4,LPM_LPART+LPM_LPART_GP)
366 
367  logical partl
368 
369  nxyz = lx1*ly1*lz1
370 
371  nxyzdum = nxyz*lpm_lrp_pro*lpm_neltb
372  call rzero(lpm_pro_fldb,nxyzdum)
373 
374  d2chk2_sq = lpm_d2chk(2)**2
375 
376  ! real particles
377  lpm_jxgp = 1
378  lpm_jygp = 2
379  lpm_jzgp = 3
380  lpm_jdp = 4
381  filt = lpm_rparam(6)
382  alph = lpm_rparam(7)
383 
384  nxyze = lx1*ly1*lz1*nelt
385  nxyz = lx1*ly1*lz1
386 
387 c lpm_npart_gp = 0
388 
389  ! real particles
390  do ip=1,lpm_npart
391  rsig = filt*lpm_cp_map(lpm_jdp,ip)/(2.*sqrt(2.*log(2.)))
392  multfci = 1./(sqrt(2.*pi)**2 * rsig**2)
393  if (if3d) multfci = multfci**(1.5d+0)
394  ralph = filt/2.*sqrt(-log(alph)/log(2.))*
395  > lpm_cp_map(lpm_jdp,ip)
396  ralph2 = ralph**2
397  rbexpi = 1./(-2.*rsig**2)
398 
399 c if (.not. if3d)
400 c > multfci = multfci/lpm_cp_map(lpm_jdp,ip)
401 
402  rproj(1 ,ip) = rbexpi
403  rproj(2 ,ip) = lpm_cp_map(lpm_jxgp,ip)
404  rproj(3 ,ip) = lpm_cp_map(lpm_jygp,ip)
405  rproj(4 ,ip) = lpm_cp_map(lpm_jzgp,ip)
406 
407 
408  do j=5,lpm_lrp_gp
409  rproj(j,ip) = lpm_cp_map(j,ip)*multfci
410  enddo
411 
412  iproj(1,ip) = lpm_iprop(8,ip)
413  iproj(2,ip) = lpm_iprop(9,ip)
414  iproj(3,ip) = lpm_iprop(10,ip)
415  iproj(4,ip) = lpm_iprop(11,ip)
416  enddo
417 
418  ! ghost particles
419  do ip=1,lpm_npart_gp
420  rsig = filt*lpm_rprop_gp(lpm_jdp,ip)/(2.*sqrt(2.*log(2.)))
421  multfci = 1./(sqrt(2.*pi)**2 * rsig**2)
422  if (if3d) multfci = multfci**(1.5d+0)
423  ralph = filt/2.*sqrt(-log(alph)/log(2.))*
424  > lpm_rprop_gp(lpm_jdp,ip)
425  ralph2 = ralph**2
426  rbexpi = 1./(-2.*rsig**2)
427 
428 c if (.not. if3d)
429 c > multfci = multfci/lpm_rprop_gp(lpm_jdp,ip)
430 
431  rproj(1 ,ip+lpm_npart) = rbexpi
432  rproj(2 ,ip+lpm_npart) = lpm_rprop_gp(lpm_jxgp,ip)
433  rproj(3 ,ip+lpm_npart) = lpm_rprop_gp(lpm_jygp,ip)
434  rproj(4 ,ip+lpm_npart) = lpm_rprop_gp(lpm_jzgp,ip)
435 
436  do j=5,lpm_lrp_gp
437  rproj(j,ip+lpm_npart) = lpm_rprop_gp(j,ip)*multfci
438  enddo
439 
440  iproj(1,ip+lpm_npart) = lpm_iprop_gp(2,ip)
441  iproj(2,ip+lpm_npart) = lpm_iprop_gp(3,ip)
442  iproj(3,ip+lpm_npart) = lpm_iprop_gp(4,ip)
443  iproj(4,ip+lpm_npart) = lpm_iprop_gp(5,ip)
444  enddo
445 
446  ndum = lpm_npart+lpm_npart_gp
447 c ndum = lpm_npart_gp
448 
449  if (int(lpm_rparam(3)) .eq. 1) then
450  do ip=1,ndum
451  ii = iproj(1,ip)
452  jj = iproj(2,ip)
453  kk = iproj(3,ip)
454  ndum = iproj(4,ip)
455 
456  ilow = ii-1
457  ihigh = ii+1
458  jlow = jj-1
459  jhigh = jj+1
460  klow = kk-1
461  khigh = kk+1
462 
463  do ie=1,lpm_neltb
464 
465  if (lpm_el_map(1,ie) .gt. ndum) exit
466  if (lpm_el_map(2,ie) .lt. ndum) cycle
467 
468  if (lpm_el_map(3,ie) .gt. ihigh) cycle
469  if (lpm_el_map(4,ie) .lt. ilow) cycle
470  if (lpm_el_map(5,ie) .gt. jhigh) cycle
471  if (lpm_el_map(6,ie) .lt. jlow) cycle
472  if (lpm_el_map(7,ie) .gt. khigh) cycle
473  if (lpm_el_map(8,ie) .lt. klow) cycle
474 
475  do i=1,lx1
476  xrun(i) = (lpm_xm1b(i,1,1,1,ie) - rproj(2,ip))**2
477  xrune(i) = 1
478  if (xrun(i) .gt. d2chk2_sq) xrune(i) = -1
479  enddo
480  do j=1,ly1
481  yrun(j) = (lpm_xm1b(1,j,1,2,ie) - rproj(3,ip))**2
482  yrune(j) = 1
483  if (yrun(j) .gt. d2chk2_sq) yrune(j) = -1
484  enddo
485  do k=1,lz1
486  zrun(k) = (lpm_xm1b(1,1,k,3,ie) - rproj(4,ip))**2
487  if (.not. if3d) zrun(k) = 0.0
488  zrune(k) = 1
489  if (zrun(k) .gt. d2chk2_sq) zrune(k) = -1
490  enddo
491 
492  do k=1,lz1
493  if (zrune(k) .lt. 0) cycle
494  do j=1,ly1
495  if (yrune(j) .lt. 0) cycle
496  rdum1 = yrun(j) + zrun(k)
497  do i=1,lx1
498  if (lpm_modgp(i,j,k,ie,4).ne.iproj(4,ip)) cycle
499  rdist2 = rdum1 + xrun(i)
500  if (rdist2 .gt. d2chk2_sq) cycle
501 
502  rexp = exp(rdist2*rproj(1,ip))
503 
504  do jj=1,lpm_lrp_pro
505  j1 = jj+4
506  lpm_pro_fldb(i,j,k,jj,ie) =
507  > lpm_pro_fldb(i,j,k,jj,ie)
508  > + rproj(j1,ip)*rexp
509  enddo
510  enddo
511  enddo
512  enddo
513  enddo
514  enddo
515  else
516  do ip=1,ndum
517  ii = iproj(1,ip)
518  jj = iproj(2,ip)
519  kk = iproj(3,ip)
520  ndum = iproj(4,ip)
521 
522  ilow = ii-1
523  ihigh = ii+1
524  jlow = jj-1
525  jhigh = jj+1
526  klow = kk-1
527  khigh = kk+1
528 
529  do ie=1,lpm_neltb
530 
531  if (lpm_el_map(1,ie) .gt. ndum) exit
532  if (lpm_el_map(2,ie) .lt. ndum) cycle
533 
534  if (lpm_el_map(3,ie) .gt. ihigh) cycle
535  if (lpm_el_map(4,ie) .lt. ilow) cycle
536  if (lpm_el_map(5,ie) .gt. jhigh) cycle
537  if (lpm_el_map(6,ie) .lt. jlow) cycle
538  if (lpm_el_map(7,ie) .gt. khigh) cycle
539  if (lpm_el_map(8,ie) .lt. klow) cycle
540 
541  do i=1,nxyz
542  if (lpm_modgp(i,1,1,ie,4).ne.iproj(4,ip)) cycle
543  rdist2 = (lpm_xm1b(i,1,1,1,ie) - rproj(2,ip))**2 +
544  > (lpm_xm1b(i,1,1,2,ie) - rproj(3,ip))**2
545  if(if3d) rdist2 = rdist2 +
546  > (lpm_xm1b(i,1,1,3,ie) - rproj(4,ip))**2
547  if (rdist2 .gt. d2chk2_sq) cycle
548 
549  rexp = exp(rdist2*rproj(1,ip))
550 
551  do j=1,lpm_lrp_pro
552  j1 = j+4
553  lpm_pro_fldb(i,1,1,j,ie) =
554  > lpm_pro_fldb(i,1,1,j,ie)
555  > + rproj(j1,ip)*rexp
556  enddo
557  enddo
558  enddo
559  enddo
560  endif
561 
562  ! now send xm1b to the processors in nek that hold xm1
563 
564  neltbc = lpm_neltb
565  ndum = lpm_lrmax*neltbc
566  call icopy(lpm_er_mapc,lpm_er_map,ndum)
567  do ie=1,neltbc
568  lpm_er_mapc(5,ie) = lpm_er_mapc(2,ie)
569  lpm_er_mapc(6,ie) = lpm_er_mapc(2,ie)
570  enddo
571  nl = 0
572  nii = lpm_lrmax
573  njj = 6
574  nrr = nxyz*lpm_lrp_pro
575  call fgslib_crystal_tuple_transfer(i_cr_hndl,neltbc,lpm_lbmax
576  > , lpm_er_mapc,nii,partl,nl,lpm_pro_fldb,nrr,njj)
577 
578  ! add the fields from the bins to ptw array
579  nlxyze = lx1*ly1*lz1*lelt
580  call rzero(lpm_pro_fld,nlxyze*lpm_lrp_pro)
581  do ie=1,neltbc
582  iee = lpm_er_mapc(1,ie)
583  do ip=1,lpm_lrp_pro
584  do k=1,nz1
585  do j=1,ny1
586  do i=1,nx1
587  lpm_pro_fld(i,j,k,iee,ip) = lpm_pro_fld(i,j,k,iee,ip) +
588  > lpm_pro_fldb(i,j,k,ip,ie)
589  enddo
590  enddo
591  enddo
592  enddo
593  enddo
594 
595  return
596  end
597 !-----------------------------------------------------------------------
598  subroutine lpm_rk3_coeff(tcoef,rdt)
599  include 'SIZE'
600  include 'TOTAL'
601 
602  real tcoef(*)
603  real rdt
604 
605  tcoef(1) = 0.0
606  tcoef(2) = 1.0
607  tcoef(3) = rdt
608  tcoef(4) = 3.0/4.0
609  tcoef(5) = 1.0/4.0
610  tcoef(6) = rdt/4.0
611  tcoef(7) = 1.0/3.0
612  tcoef(8) = 2.0/3.0
613  tcoef(9) = rdt*2.0/3.0
614 
615  return
616  end
617 !-----------------------------------------------------------------------
618  subroutine lpm_qtl_pvol(divin,phipin)
619 c
620 c Computes modified divergence constraint for multiphase dense
621 c incompressible flow
622 c
623  include 'SIZE'
624  include 'TOTAL'
625 # include "LPM"
626 
627  common /phig_qtl_blk/ phig_last
628  real phig_last(lx1,ly1,lz1,lelt)
629 
630  real divin(lx2,ly2,lz2,lelv), phipin(lx1,ly1,lz1,lelt)
631 
632  COMMON /scrns/ ur(lx1,ly1,lz1,lelt)
633  > ,us(lx1,ly1,lz1,lelt)
634  > ,ut(lx1,ly1,lz1,lelt)
635  > ,phigin(lx1,ly1,lz1,lelt)
636  > ,phig_qtl(lx1,ly1,lz1,lelt)
637  > ,grad_dot(lx1,ly1,lz1,lelt)
638 
639  integer icalld
640  save icalld
641  data icalld /-1/
642 
643  icalld = icalld + 1
644  nxyze = lx1*ly1*lz1*lelt
645 
646  rdt_in = 1./dt
647 
648  call rzero(phig_qtl,nxyze)
649 
650  if (icalld .eq. 0) then
651  call rone(phig_last,nxyze)
652  call sub2(phig_last,phipin,nxyze)
653  endif
654 
655  call rone(phigin,nxyze)
656  call sub2(phigin,phipin,nxyze)
657 
658 c if (icalld .lt. 5) goto 123
659 
660  call opgrad(ur,us,ut,phigin)
661  call sub3(phig_qtl,phigin,phig_last,nxyze)
662  call cmult(phig_qtl,rdt_in,nxyze)
663  call vdot3(grad_dot,vx,vy,vz,ur,us,ut,nxyze)
664  call add2(phig_qtl,grad_dot,nxyze)
665  call invcol2(phig_qtl,phigin,nxyze)
666  call chsign(phig_qtl,nxyze)
667 
668  call copy(phig_last,phigin,nxyze)
669 
670  do ie=1,nelt
671  call map12(divin(1,1,1,ie),phig_qtl(1,1,1,ie),ie)
672  enddo
673 
674  return
675  end
676 c-----------------------------------------------------------------------
677  subroutine lpm_move_outlier
678  include 'SIZE'
679 # include "LPM"
680 
681  integer in_part(LPM_LPART)
682  integer jj(3)
683 
684  iperiodicx = int(lpm_rparam(8))
685  iperiodicy = int(lpm_rparam(9))
686  iperiodicz = int(lpm_rparam(10))
687 
688  jj(1) = 1
689  jj(2) = 2
690  jj(3) = 3
691 
692  do i=1,lpm_npart
693  isl = (i -1) * lpm_lrs + 1
694  in_part(i) = 0
695  do j=0,ndim-1
696  jchk = jj(j+1)
697  if (lpm_y(jchk,i).lt.lpm_xdrange(1,j+1))then
698  if (((iperiodicx.eq.1) .and. (j.eq.0)) .or. ! periodic
699  > ((iperiodicy.eq.1) .and. (j.eq.1)) .or.
700  > ((iperiodicz.eq.1) .and. (j.eq.2)) ) then
701  lpm_y(jchk,i) = lpm_xdrange(2,j+1) -
702  & abs(lpm_xdrange(1,j+1) - lpm_y(jchk,i))
703  lpm_y1(isl+j) = lpm_xdrange(2,j+1) +
704  & abs(lpm_xdrange(1,j+1) - lpm_y1(isl+j))
705  goto 1512
706  endif
707  endif
708  if (lpm_y(jchk,i).gt.lpm_xdrange(2,j+1))then
709  if (((iperiodicx.eq.1) .and. (j.eq.0)) .or. ! periodic
710  > ((iperiodicy.eq.1) .and. (j.eq.1)) .or.
711  > ((iperiodicz.eq.1) .and. (j.eq.2)) ) then
712  lpm_y(jchk,i) = lpm_xdrange(1,j+1) +
713  & abs(lpm_y(jchk,i) - lpm_xdrange(2,j+1))
714  lpm_y1(isl+j) = lpm_xdrange(1,j+1) +
715  & abs(lpm_y1(isl+j) - lpm_xdrange(2,j+1))
716  goto 1512
717  endif
718  endif
719  if (lpm_iprop(1,i) .eq. 2) then
720  in_part(i) = -1 ! only if periodic check fails it will get here
721  endif
722  1512 continue
723  enddo
724  enddo
725 
726  ic = 0
727  do i=1,lpm_npart
728  if (in_part(i).eq.0) then
729  ic = ic + 1
730  if (i .ne. ic) then
731  isl = (i -1) * lpm_lrs + 1
732  isr = (ic-1) * lpm_lrs + 1
733  call copy(lpm_y(1,ic),lpm_y(1,i) ,lpm_lrs)
734  call copy(lpm_y1(isr) ,lpm_y1(isl) ,lpm_lrs)
735  call copy(lpm_ydot(1,ic),lpm_ydot(1,i) ,lpm_lrs)
736  call copy(lpm_ydotc(1,ic),lpm_ydotc(1,i) ,lpm_lrs)
737  call copy(lpm_rprop(1,ic),lpm_rprop(1,i) ,lpm_lrp)
738  call copy(lpm_rprop2(1,ic),lpm_rprop2(1,i),lpm_lrp2)
739  call icopy(lpm_iprop(1,ic),lpm_iprop(1,i) ,lpm_lip)
740  endif
741  endif
742  enddo
743  lpm_npart = ic
744 
745  return
746  end
747 !-----------------------------------------------------------------------
void exitt()
Definition: comm_mpi.f:604
subroutine map12(y, x, iel)
Definition: coef.f:1530
subroutine nekgsync()
Definition: comm_mpi.f:502
subroutine exitti(stringi, idata)
Definition: comm_mpi.f:535
real *8 function dnekclock()
Definition: comm_mpi.f:393
subroutine lpm_comm_bin_setup
Definition: lpm_comm.f:188
subroutine lpm_comm_ghost_create
Definition: lpm_comm.f:522
subroutine lpm_comm_ghost_send
Definition: lpm_comm.f:983
subroutine lpm_comm_setup
Definition: lpm_comm.f:3
subroutine lpm_comm_crystal
Definition: lpm_comm.f:136
subroutine lpm_comm_findpts
Definition: lpm_comm.f:19
subroutine lpm_solve_project
Definition: lpm_solve.f:347
subroutine lpm_init(rparam, yp, nyp, pp, npp, npart, time_)
Definition: lpm_solve.f:3
subroutine lpm_move_outlier
Definition: lpm_solve.f:678
subroutine lpm_rk3_driver(time_, dt_, y0, y, ydot, n)
Definition: lpm_solve.f:258
subroutine lpm_project
Definition: lpm_solve.f:334
subroutine lpm_rparam_set(rparam)
Definition: lpm_solve.f:65
subroutine lpm_solve(time_)
Definition: lpm_solve.f:227
subroutine lpm_tag_set
Definition: lpm_solve.f:197
subroutine lpm_qtl_pvol(divin, phipin)
Definition: lpm_solve.f:619
subroutine lpm_rk3_coeff(tcoef, rdt)
Definition: lpm_solve.f:599
subroutine lpm_init_filter
Definition: lpm_solve.f:91
subroutine lpm_tag_init
Definition: lpm_solve.f:211
subroutine lpm_interpolate_fld(jp, fld)
Definition: lpm_solve.f:297
subroutine lpm_interpolate_setup
Definition: lpm_solve.f:284
subroutine sub2(a, b, n)
Definition: math.f:164
function glmin(a, n)
Definition: math.f:973
subroutine invcol2(a, b, n)
Definition: math.f:73
subroutine icopy(a, b, n)
Definition: math.f:289
subroutine add2(a, b, n)
Definition: math.f:622
subroutine copy(a, b, n)
Definition: math.f:260
subroutine sub3(a, b, c, n)
Definition: math.f:175
subroutine cmult(a, const, n)
Definition: math.f:315
subroutine rone(a, n)
Definition: math.f:230
subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
Definition: math.f:462
subroutine rzero(a, n)
Definition: math.f:208
function glmax(a, n)
Definition: math.f:960
subroutine chsign(a, n)
Definition: math.f:305
subroutine opgrad(out1, out2, out3, inp)
Definition: navier1.f:298
subroutine domain_size(xmin, xmax, ymin, ymax, zmin, zmax)
Definition: navier5.f:2948