2 subroutine lpm_init(rparam,yp,nyp,pp,npp,npart,time_)
17 $
call exitti(
'nyp > LPM_LRS$',nyp)
20 $
call exitti(
'npp > LPM_LRP$',npp)
22 if (lpm_npart.gt.lpm_lpart)
23 $
call exitti(
'lpm_npart > LPM_LPART$',lpm_npart)
25 call copy(lpm_y ,yp,lpm_npart*nyp)
26 call copy(lpm_rprop,pp,lpm_npart*npp)
30 write(6,*)
'initialize LPM'
31 if (int(rparam(1)) .ne. 0)
32 $
write(6,*)
'overwrite default settings'
41 > ,lpm_xdrange(1,2),lpm_xdrange(2,2)
42 > ,lpm_xdrange(1,3),lpm_xdrange(2,3))
51 if (int(lpm_rparam(4)) .ne. 1)
then
57 write(6,*)
'done :: initialize LPM'
71 if (rparam(1) .eq. 0)
then
83 lpm_rparam(i) = rparam(i)
96 jdp = int(lpm_rparam(5))
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)
118 > rdz_test = zm1(i,j,kp1,ie) - zm1(i,j,k,ie)
120 rdist = max(rdx_test,rdy_test)
122 > rdist = max(rdz_test,rdist)
124 rdx_dy_test = sqrt(rdx_test**2 + rdy_test**2)
125 rdist = max(rdx_dy_test,rdist)
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)
133 if (rdist .gt. rdx_max) rdx_max = rdist
138 rdx_max =
glmax(rdx_max,1)
140 lpm_rdx_max = rdx_max
142 rsig_dx_min_set = 0.25
143 rfilt_dp_min_set = 1.0
147 if (wdsize.eq.4) tol = 1.e-6
149 rfilt = lpm_rparam(6)
151 if (abs(alph) .lt. tol)
then
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.))
166 rsig_test = filt*lpm_rprop(jdp,i)/(2.*sqrt(2.*log(2.)))
169 rsig_dx = rsig_test/rdx_max
170 if (rsig_dx .lt. rsig_dx_min) rsig_dx_min = rsig_dx
172 if (rsig_test .gt. rsig) rsig = rsig_test
175 rsig_dx_min =
glmin(rsig_dx_min,1)
177 lpm_d2chk(2) = rsig*sqrt(-2*log(alph))
179 if (rsig_dx_min .lt. rsig_dx_min_set)
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')
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
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
215 if (.not. lpm_restart)
then
236 dt_ = time_ - lpm_timef
237 n = lpm_npart*lpm_lrs
240 call copy(lpm_y1,lpm_y,n)
242 if (isol .eq. 1)
then
245 call exitti(
'unknown LPM integrator$',isol)
251 &
write(*,
'(4x,i7,a,1p3e12.4)')
252 & istep,
' LPM-solver done',time,
dnekclock()-ts, lpm_timef
266 parameter(nstage = 3)
272 call lpm_fun(time_,y,ydot)
274 y(i) = tcoef(1,istage)*y0(i)
275 > + tcoef(2,istage)*y(i)
276 > + tcoef(3,istage)*ydot(i)
300 common /intp_h/ ih_intp(2,1)
304 ih_intp1 = ih_intp(1,i_fp_hndl)
316 call fgslib_findpts_eval( ih_intp1
337 if (int(lpm_rparam(4)) .ne. 1)
then
351 real phig(lx1,ly1,lz1,lelt)
352 common /otherpvar/ phig
357 common /lpm_fix/ phigdum,phigvdum
358 real phigdum(lx1,ly1,lz1,lelt,3),phigvdum(lx1,ly1,lz1,lelt)
360 real xrun(lx1),yrun(ly1),zrun(lz1)
362 integer xrune(lx1),yrune(ly1),zrune(lz1)
364 real rproj(1+LPM_LRP_GP,LPM_LPART+LPM_LPART_GP)
365 integer iproj(4,LPM_LPART+LPM_LPART_GP)
371 nxyzdum = nxyz*lpm_lrp_pro*lpm_neltb
372 call rzero(lpm_pro_fldb,nxyzdum)
374 d2chk2_sq = lpm_d2chk(2)**2
384 nxyze = lx1*ly1*lz1*nelt
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)
397 rbexpi = 1./(-2.*rsig**2)
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)
409 rproj(j,ip) = lpm_cp_map(j,ip)*multfci
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)
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)
426 rbexpi = 1./(-2.*rsig**2)
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)
437 rproj(j,ip+lpm_npart) = lpm_rprop_gp(j,ip)*multfci
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)
446 ndum = lpm_npart+lpm_npart_gp
449 if (int(lpm_rparam(3)) .eq. 1)
then
465 if (lpm_el_map(1,ie) .gt. ndum)
exit
466 if (lpm_el_map(2,ie) .lt. ndum) cycle
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
476 xrun(i) = (lpm_xm1b(i,1,1,1,ie) - rproj(2,ip))**2
478 if (xrun(i) .gt. d2chk2_sq) xrune(i) = -1
481 yrun(j) = (lpm_xm1b(1,j,1,2,ie) - rproj(3,ip))**2
483 if (yrun(j) .gt. d2chk2_sq) yrune(j) = -1
486 zrun(k) = (lpm_xm1b(1,1,k,3,ie) - rproj(4,ip))**2
487 if (.not. if3d) zrun(k) = 0.0
489 if (zrun(k) .gt. d2chk2_sq) zrune(k) = -1
493 if (zrune(k) .lt. 0) cycle
495 if (yrune(j) .lt. 0) cycle
496 rdum1 = yrun(j) + zrun(k)
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
502 rexp = exp(rdist2*rproj(1,ip))
506 lpm_pro_fldb(i,j,k,jj,ie) =
507 > lpm_pro_fldb(i,j,k,jj,ie)
508 > + rproj(j1,ip)*rexp
531 if (lpm_el_map(1,ie) .gt. ndum)
exit
532 if (lpm_el_map(2,ie) .lt. ndum) cycle
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
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
549 rexp = exp(rdist2*rproj(1,ip))
553 lpm_pro_fldb(i,1,1,j,ie) =
554 > lpm_pro_fldb(i,1,1,j,ie)
555 > + rproj(j1,ip)*rexp
565 ndum = lpm_lrmax*neltbc
566 call icopy(lpm_er_mapc,lpm_er_map,ndum)
568 lpm_er_mapc(5,ie) = lpm_er_mapc(2,ie)
569 lpm_er_mapc(6,ie) = lpm_er_mapc(2,ie)
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)
579 nlxyze = lx1*ly1*lz1*lelt
580 call rzero(lpm_pro_fld,nlxyze*lpm_lrp_pro)
582 iee = lpm_er_mapc(1,ie)
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)
613 tcoef(9) = rdt*2.0/3.0
627 common /phig_qtl_blk/ phig_last
628 real phig_last(lx1,ly1,lz1,lelt)
630 real divin(lx2,ly2,lz2,lelv), phipin(lx1,ly1,lz1,lelt)
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)
644 nxyze = lx1*ly1*lz1*lelt
648 call rzero(phig_qtl,nxyze)
650 if (icalld .eq. 0)
then
651 call rone(phig_last,nxyze)
652 call sub2(phig_last,phipin,nxyze)
655 call rone(phigin,nxyze)
656 call sub2(phigin,phipin,nxyze)
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)
668 call copy(phig_last,phigin,nxyze)
671 call map12(divin(1,1,1,ie),phig_qtl(1,1,1,ie),ie)
681 integer in_part(LPM_LPART)
684 iperiodicx = int(lpm_rparam(8))
685 iperiodicy = int(lpm_rparam(9))
686 iperiodicz = int(lpm_rparam(10))
693 isl = (i -1) * lpm_lrs + 1
697 if (lpm_y(jchk,i).lt.lpm_xdrange(1,j+1))
then
698 if (((iperiodicx.eq.1) .and. (j.eq.0)) .or.
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))
708 if (lpm_y(jchk,i).gt.lpm_xdrange(2,j+1))
then
709 if (((iperiodicx.eq.1) .and. (j.eq.0)) .or.
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))
719 if (lpm_iprop(1,i) .eq. 2)
then
728 if (in_part(i).eq.0)
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)
subroutine map12(y, x, iel)
subroutine exitti(stringi, idata)
real *8 function dnekclock()
subroutine lpm_comm_bin_setup
subroutine lpm_comm_ghost_create
subroutine lpm_comm_ghost_send
subroutine lpm_comm_setup
subroutine lpm_comm_crystal
subroutine lpm_comm_findpts
subroutine lpm_solve_project
subroutine lpm_init(rparam, yp, nyp, pp, npp, npart, time_)
subroutine lpm_move_outlier
subroutine lpm_rk3_driver(time_, dt_, y0, y, ydot, n)
subroutine lpm_rparam_set(rparam)
subroutine lpm_solve(time_)
subroutine lpm_qtl_pvol(divin, phipin)
subroutine lpm_rk3_coeff(tcoef, rdt)
subroutine lpm_init_filter
subroutine lpm_interpolate_fld(jp, fld)
subroutine lpm_interpolate_setup
subroutine invcol2(a, b, n)
subroutine icopy(a, b, n)
subroutine sub3(a, b, c, n)
subroutine cmult(a, const, n)
subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
subroutine opgrad(out1, out2, out3, inp)
subroutine domain_size(xmin, xmax, ymin, ymax, zmin, zmax)