36 $
'module ['//trim(tripl_name)//
'] already registered')
45 $
'parent module ['//
'FRAME'//
'] not registered')
50 $
'Tripping along the line')
55 $
'tripl_TOT',
'Tripping total time',.false.)
58 call rprm_sec_reg(tripl_sec_id,tripl_id,
'_'//adjustl(tripl_name),
59 $
'Runtime paramere section for tripping module')
63 call rprm_rp_reg(tripl_nline_id,tripl_sec_id,
'NLINE',
64 $
'Number of tripping lines',rpar_int,0,0.0,.false.,
' ')
66 do il=1, tripl_nline_max
67 write(str,
'(I2.2)') il
69 call rprm_rp_reg(tripl_tiamp_id(il),tripl_sec_id,
'TIAMP'//str,
70 $
'Time independent amplitude',rpar_real,0,0.0,.false.,
' ')
72 call rprm_rp_reg(tripl_tdamp_id(il),tripl_sec_id,
'TDAMP'//str,
73 $
'Time dependent amplitude',rpar_real,0,0.0,.false.,
' ')
75 call rprm_rp_reg(tripl_spos_id(1,il),tripl_sec_id,
'SPOSX'//str,
76 $
'Starting point X',rpar_real,0,0.0,.false.,
' ')
78 call rprm_rp_reg(tripl_spos_id(2,il),tripl_sec_id,
'SPOSY'//str,
79 $
'Starting point Y',rpar_real,0,0.0,.false.,
' ')
82 call rprm_rp_reg(tripl_spos_id(ldim,il),tripl_sec_id,
83 $
'SPOSZ'//str,
'Starting point Z',
84 $ rpar_real,0,0.0,.false.,
' ')
87 call rprm_rp_reg(tripl_epos_id(1,il),tripl_sec_id,
'EPOSX'//str,
88 $
'Ending point X',rpar_real,0,0.0,.false.,
' ')
90 call rprm_rp_reg(tripl_epos_id(2,il),tripl_sec_id,
'EPOSY'//str,
91 $
'Ending point Y',rpar_real,0,0.0,.false.,
' ')
94 call rprm_rp_reg(tripl_epos_id(ldim,il),tripl_sec_id,
95 $
'EPOSZ'//str,
'Ending point Z',
96 $ rpar_real,0,0.0,.false.,
' ')
99 call rprm_rp_reg(tripl_smth_id(1,il),tripl_sec_id,
'SMTHX'//str,
100 $
'Smoothing length X',rpar_real,0,0.0,.false.,
' ')
102 call rprm_rp_reg(tripl_smth_id(2,il),tripl_sec_id,
'SMTHY'//str,
103 $
'Smoothing length Y',rpar_real,0,0.0,.false.,
' ')
106 call rprm_rp_reg(tripl_smth_id(ldim,il),tripl_sec_id,
107 $
'SMTHZ'//str,
'Smoothing length Z',
108 $ rpar_real,0,0.0,.false.,
' ')
111 call rprm_rp_reg(tripl_lext_id(il),tripl_sec_id,
'LEXT'//str,
112 $
'Line extension',rpar_log,0,0.0,.false.,
' ')
114 call rprm_rp_reg(tripl_rota_id(il),tripl_sec_id,
'ROTA'//str,
115 $
'Rotation angle',rpar_real,0,0.0,.false.,
' ')
116 call rprm_rp_reg(tripl_nmode_id(il),tripl_sec_id,
'NMODE'//str,
117 $
'Number of Fourier modes',rpar_int,0,0.0,.false.,
' ')
118 call rprm_rp_reg(tripl_tdt_id(il),tripl_sec_id,
'TDT'//str,
119 $
'Time step for tripping',rpar_real,0,0.0,.false.,
' ')
126 ltim = dnekclock() - ltim
156 call mntr_log(tripl_id,lp_inf,
'Initialisation started')
159 if (tripl_ifinit)
then
161 $
'module ['//trim(tripl_name)//
'] already initiaised.')
169 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_nline_id,rpar_int)
173 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_tiamp_id(il),
175 tripl_tiamp(il) = rtmp
176 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_tdamp_id(il),
178 tripl_tdamp(il) = rtmp
181 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_spos_id(jl,il),
183 tripl_spos(jl,il) = rtmp
184 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_epos_id(jl,il),
186 tripl_epos(jl,il) = rtmp
187 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_smth_id(jl,il),
189 tripl_smth(jl,il) = abs(rtmp)
191 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_lext_id(il),
193 tripl_lext(il) = ltmp
194 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_rota_id(il),
196 tripl_rota(il) = rtmp
197 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_nmode_id(il),
199 tripl_nmode(il) = itmp
200 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,tripl_tdt_id(il),
207 $
'2D simulation is not supported.')
211 call mntr_logi(tripl_id,lp_inf,
'Line info; line nr: ',il)
212 tripl_ilngt(il) = 0.0
216 tripl_vrs(jl,ldim,il) = tripl_epos(jl,il) - tripl_spos(jl,il)
217 tripl_ilngt(il) = tripl_ilngt(il) + tripl_vrs(jl,ldim,il)**2
219 tripl_ilngt(il) = sqrt(tripl_ilngt(il))
220 call mntr_logr(tripl_id,lp_inf,
'Line length: ',tripl_ilngt(il))
221 if (tripl_ilngt(il).gt.0.0)
then
222 tripl_ilngt(il) = 1.0/tripl_ilngt(il)
224 tripl_vrs(jl,ldim,il) = tripl_vrs(jl,ldim,il)*
229 $
'Line with zero lenght is not supported.')
233 call rzero(rtmpv,ldim)
235 if (tripl_vrs(1,ldim,il).lt.0.95)
then
241 call cross(tripl_vrs(1,2,il),tripl_vrs(1,ldim,il),rtmpv)
243 call cross(tripl_vrs(1,1,il),tripl_vrs(1,2,il),
244 $ tripl_vrs(1,ldim,il))
249 rtmp = rtmp + tripl_vrs(kl,jl,il)*tripl_vrs(kl,jl,il)
251 if (rtmp.gt.0.0)
then
252 rtmp = 1.0/sqrt(rtmp)
254 tripl_vrs(kl,jl,il) = tripl_vrs(kl,jl,il)*rtmp
258 $
'Line versor with zero lenght.')
263 call math_rot3da(rtmpv,tripl_vrs(1,jl,il),tripl_vrs(1,ldim,il)
266 tripl_vrs(kl,jl,il) = rtmpv(kl)
272 call mntr_logi(tripl_id,lp_inf,
'Line versor: ',jl)
273 call mntr_logrv(tripl_id,lp_inf,
'Coordinates:',
274 $ tripl_vrs(1,jl,il),ldim)
279 tripl_smth(jl,il) = tripl_smth(jl,il)*tripl_ilngt(il)
283 if (tripl_smth(jl,il).gt.0.0)
then
284 tripl_ismth(jl,il) = 1.0/tripl_smth(jl,il)
286 tripl_ismth(jl,il) = 1.0
290 call mntr_log(tripl_id,lp_inf,
'Local base calculated')
294 call mntr_log(tripl_id,lp_inf,
'1D projection finalised')
298 tripl_seed(il) = -32*il
299 tripl_ntdt(il) = 1 - tripl_nset_max
300 tripl_ntdt_old(il) = tripl_ntdt(il)
304 il = tripl_nmode_max*tripl_nset_max*tripl_nline_max
305 call rzero(tripl_rphs,il)
307 call mntr_log(tripl_id,lp_inf,
'Random phases calculated')
311 call mntr_log(tripl_id,lp_inf,
'Forcing calculated')
317 call mntr_log(tripl_id,lp_inf,
'Initialisation finalised')
320 ltim = dnekclock() - ltim
364 ltim = dnekclock() - ltim
392 do il= 1, tripl_nline
393 ffn = tripl_fsmth(ix,iy,iz,iel,il)
395 ipos = tripl_map(ix,iy,iz,iel,il)
396 ffn = tripl_ftrp(ipos,il)*ffn
399 ffx = ffx + ffn*tripl_vrs(1,2,il)
400 ffy = ffy + ffn*tripl_vrs(2,2,il)
401 ffz = ffz + ffn*tripl_vrs(ldim,2,il)
432 ltim = dnekclock() - ltim
454 real lcoord(LX1*LY1*LZ1*LELT)
455 common /ctmp0/ lcoord
456 integer lmap(LX1*LY1*LZ1*LELT), lmap_el(4,LX1*LY1*LZ1*LELT)
457 common /ctmp1/ lmap, lmap_el
460 integer nptot, itmp, itmp2
461 integer il, jl, kl, ll, ml, nl
462 real rota, rtmp, epsl
463 parameter(epsl = 1.0e-10)
464 real rtmpv(ldim), rtmpc(ldim)
468 nptot = nx1*ny1*nz1*nelv
473 call ifill(tripl_map(1,1,1,1,il),-1,nptot)
477 call rzero(tripl_fsmth(1,1,1,1,il),nptot)
479 call rzero(tripl_prj(1,il),nptot)
489 rtmpv(1) = xm1(ml,ll,kl,jl)-tripl_spos(1,il)
490 rtmpv(2) = ym1(ml,ll,kl,jl)-tripl_spos(2,il)
491 rtmpv(ldim) = zm1(ml,ll,kl,jl)-tripl_spos(ldim,il)
494 rtmpc(nl) = dot(rtmpv,tripl_vrs(1,nl,il),ldim)
495 rtmpc(nl) = rtmpc(nl)*tripl_ilngt(il)
499 rtmp = (rtmpc(1)*tripl_ismth(1,il))**2+
500 $ (rtmpc(2)*tripl_ismth(2,il))**2
502 if (.not.tripl_lext(il))
then
503 if (rtmpc(ldim).lt.0.0)
then
505 $ (rtmpc(ldim)*tripl_ismth(ldim,il))**2
506 elseif (rtmpc(ldim).gt.1.0)
then
508 $ ((rtmpc(ldim)-1.0)*tripl_ismth(ldim,il))**2
516 if (rtmp.lt.1.0)
then
517 tripl_fsmth(ml,ll,kl,jl,il) =
518 $ exp(-rtmp)*(1-rtmp)**2
523 lcoord(itmp) = rtmpc(ldim)
530 tripl_fsmth(ml,ll,kl,jl,il) = 0.0
539 call sort(lcoord,lmap,itmp)
543 tripl_prj(tripl_npoint(il),il) = lcoord(1)
546 tripl_map(lmap_el(4,itmp2),lmap_el(3,itmp2),
547 $ lmap_el(2,itmp2),lmap_el(1,itmp2),il) = tripl_npoint(il)
550 if((lcoord(jl)-tripl_prj(tripl_npoint(il),il)).gt.
551 $ max(epsl,abs(epsl*lcoord(jl))))
then
552 tripl_npoint(il) = tripl_npoint(il) + 1
553 tripl_prj(tripl_npoint(il),il) = lcoord(jl)
557 tripl_map(lmap_el(4,itmp2),lmap_el(3,itmp2),
558 $ lmap_el(2,itmp2),lmap_el(1,itmp2),il) = tripl_npoint(il)
582 character*3 str1, str2
591 do il = 1, tripl_nline
592 if (tripl_tiamp(il).gt.0.0.and..not.tripl_ifinit)
then
593 do jl=1, tripl_nmode(il)
594 tripl_rphs(jl,1,il) = 2.0*pi*tripl_ran2(il)
600 do il = 1, tripl_nline
601 itmp = int(time/tripl_tdt(il))
602 call bcast(itmp,isize)
603 do kl= tripl_ntdt(il)+1, itmp
604 do jl= tripl_nset_max,3,-1
605 call copy(tripl_rphs(1,jl,il),tripl_rphs(1,jl-1,il),
608 do jl=1, tripl_nmode(il)
609 tripl_rphs(jl,2,il) = 2.0*pi*tripl_ran2(il)
613 tripl_ntdt_old(il) = tripl_ntdt(il)
614 tripl_ntdt(il) = itmp
622 write(str1,
'(i3.3)') nid
623 write(str2,
'(i3.3)') icalldl
624 open(unit=iunit,
file=
'trp_rps.txt'//str1//
'i'//str2)
626 do il=1,tripl_nmode(1)
627 write(iunit,*) il,tripl_rphs(il,1:4,1)
655 integer iff(tripl_nline_max), iy(tripl_nline_max)
656 integer ir(97,tripl_nline_max)
659 parameter(m=714025,ia=1366,ic=150889,rm=1./m)
661 data iff /tripl_nline_max*0/
664 if (tripl_seed(il).lt.0.or.iff(il).eq.0)
then
666 tripl_seed(il)=mod(ic-tripl_seed(il),m)
668 tripl_seed(il)=mod(ia*tripl_seed(il)+ic,m)
669 ir(j,il)=tripl_seed(il)
671 tripl_seed(il)=mod(ia*tripl_seed(il)+ic,m)
672 iy(il)=tripl_seed(il)
679 tripl_seed(il)=mod(ia*tripl_seed(il)+ic,m)
680 ir(j,il)=tripl_seed(il)
707 integer il, jl, kl, ll
713 character*3 str1, str2
723 do il= 1, tripl_nline
725 if (tripl_tiamp(il).gt.0.0)
then
731 do jl = istart, tripl_nset_max
732 call rzero(tripl_frcs(1,jl,il),tripl_npoint(il))
733 do kl= 1, tripl_npoint(il)
734 theta0 = 2*pi*tripl_prj(kl,il)
735 do ll= 1, tripl_nmode(il)
737 tripl_frcs(kl,jl,il) = tripl_frcs(kl,jl,il) +
738 $ sin(theta+tripl_rphs(ll,jl,il))
743 if (tripl_tiamp(il).gt.0.0)
call cmult(tripl_frcs(1,1,il),
744 $ tripl_tiamp(il),tripl_npoint(il))
750 do il= 1, tripl_nline
751 if (tripl_ntdt(il).ne.tripl_ntdt_old(il))
then
753 do jl= tripl_nset_max,3,-1
754 call copy(tripl_frcs(1,jl,il),tripl_frcs(1,jl-1,il),
757 call rzero(tripl_frcs(1,2,il),tripl_npoint(il))
758 do jl= 1, tripl_npoint(il)
759 theta0 = 2*pi*tripl_prj(jl,il)
760 do kl= 1, tripl_nmode(il)
762 tripl_frcs(jl,2,il) = tripl_frcs(jl,2,il) +
763 $ sin(theta+tripl_rphs(kl,2,il))
772 if (int(param(95)).gt.0)
then
777 if (int(param(94)).gt.0)
then
781 if (if3d) ivproj(2,3) = 0
788 do il= 1, tripl_nline
789 if (tripl_tiamp(il).gt.0.0)
then
790 call copy(tripl_ftrp(1,il),tripl_frcs(1,1,il),
793 call rzero(tripl_ftrp(1,il),tripl_npoint(il))
797 do il = 1, tripl_nline
798 theta0= time/tripl_tdt(il)-real(tripl_ntdt(il))
799 if (theta0.gt.0.0)
then
800 theta0=theta0*theta0*(3.0-2.0*theta0)
802 do jl= 1, tripl_npoint(il)
803 tripl_ftrp(jl,il) = tripl_ftrp(jl,il) +
804 $ tripl_tdamp(il)*((1.0-theta0)*tripl_frcs(jl,3,il) +
805 $ theta0*tripl_frcs(jl,2,il))
809 theta0=theta0*theta0*(3.0-2.0*theta0)
811 do jl= 1, tripl_npoint(il)
812 tripl_ftrp(jl,il) = tripl_ftrp(jl,il) +
813 $ tripl_tdamp(il)*((1.0-theta0)*tripl_frcs(jl,4,il) +
814 $ theta0*tripl_frcs(jl,3,il))
824 write(str1,
'(i3.3)') nid
825 write(str2,
'(i3.3)') icalldl
826 open(unit=iunit,
file=
'trp_fcr.txt'//str1//
'i'//str2)
828 do il=1,tripl_npoint(1)
829 write(iunit,*) il,tripl_prj(il,1),tripl_ftrp(il,1),
830 $ tripl_frcs(il,1:4,1)
subroutine bcast(buf, len)
integer function gllel(ieg)
subroutine cross(v1, v2, v3)
subroutine math_rot3da(vo, vi, va, an)
3D rotation of a vector along given axis.
subroutine mntr_logi(mid, priority, logs, ivar)
Write log message adding single integer.
subroutine mntr_tmr_is_name_reg(mid, mname)
Check if timer name is registered and return its id.
subroutine mntr_logr(mid, priority, logs, rvar)
Write log message adding single real.
subroutine mntr_warn(mid, logs)
Write warning message.
subroutine mntr_tmr_add(mid, icount, time)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_mod_is_name_reg(mid, mname)
Check if module name is registered and return its id.
subroutine mntr_logrv(mid, priority, logs, rvarv, rvarn)
Write log message adding real vector of length n.
subroutine mntr_abort(mid, logs)
Abort simulation.
subroutine mntr_log(mid, priority, logs)
Write log message.
subroutine mntr_mod_reg(mid, pmid, mname, mdscr)
Register new module.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine rprm_rp_get(ipval, rpval, lpval, cpval, rpid, ptype)
Get runtime parameter form active section. This operation is performed locally.
subroutine rprm_rp_reg(rpid, mid, pname, pdscr, ptype, ipval, rpval, lpval, cpval)
Register new runtime parameter.
subroutine rprm_sec_set_act(ifact, rpid)
Set section's activation flag. Master value is broadcasted.
subroutine rprm_sec_reg(rpid, mid, pname, pdscr)
Register new parameter section.
subroutine tripl_forcing(ffx, ffy, ffz, ix, iy, iz, ieg)
Compute tripping forcing.
subroutine tripl_register()
Register tripping module.
subroutine tripl_reset()
Reset tripping.
subroutine tripl_update()
Update tripping.
real function tripl_ran2(il)
A simple portable random number generator.
subroutine tripl_frcs_get(ifreset)
Generate forcing along 1D line.
logical function tripl_is_initialised()
Check if module was initialised.
subroutine tripl_rphs_get
Generate set of random phases.
subroutine tripl_1dprj()
Get 1D projection, array mapping and forcing smoothing.
subroutine tripl_init()
Initilise tripping module.
subroutine ifill(ia, ib, n)
subroutine cmult(a, const, n)
subroutine sort(a, ind, n)