36 $
'module ['//trim(gsyem_name)//
'] already registered')
45 $
'parent module ['//
'FRAME'//
'] not registered')
50 $
'Generalised Synthetic Eddy Method')
54 $
'This code must be compiled with ldim=3')
59 $
'GSYEM_TOT',
'GSYEM total time',.false.)
62 $
'GSYEM_INI',
'GSYEM initialisation time',.true.)
65 $
'GSYEM_EVL',
'GSYEM evolution time',.true.)
68 $
'GSYEM_CHP',
'GSYEM checkpoint saving time',.true.)
71 call rprm_sec_reg(gsyem_sec_id,gsyem_id,
'_'//adjustl(gsyem_name),
72 $
'Runtime paramere section for gSyEM module')
77 $
'gSyEM mode',rpar_int,1,0.0,.false.,
' ')
80 $
'Family number',rpar_int,1,0.0,.false.,
' ')
82 do il=1, gsyem_nfam_max
83 write(str,
'(I2.2)') il
84 call rprm_rp_reg(gsyem_neddy_id(il),gsyem_sec_id,
'NEDDY'//str,
85 $
'Numer of eddies per family',rpar_int,10,0.0,.false.,
' ')
86 call rprm_rp_reg(gsyem_fambc_id(il),gsyem_sec_id,
'FAMBC'//str,
87 $
'Family BC index',rpar_int,1,0.0,.false.,
' ')
89 $
'FAMASIG'//str,
'Family max edge size',rpar_real,
90 $ 1,0.025,.false.,
' ')
92 $
'FAMISIG'//str,
'Family min edge size',rpar_real,
93 $ 1,0.001,.false.,
' ')
94 call rprm_rp_reg(gsyem_dir_id(1,il),gsyem_sec_id,
'FAMDIRX'//str,
95 $
'Family normal X component',rpar_real,1,0.0,.false.,
' ')
96 call rprm_rp_reg(gsyem_dir_id(2,il),gsyem_sec_id,
'FAMDIRY'//str,
97 $
'Family normal Y component',rpar_real,1,0.0,.false.,
' ')
98 call rprm_rp_reg(gsyem_dir_id(3,il),gsyem_sec_id,
'FAMDIRZ'//str,
99 $
'Family normal Z component',
100 $ rpar_real,1,0.0,.false.,
' ')
107 ltim = dnekclock() - ltim
133 integer ierr, lmid, lsid, lrpid
141 if (gsyem_ifinit)
then
143 $
'module ['//trim(gsyem_name)//
'] already initiaised.')
151 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_mode_id,rpar_int)
154 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_nfam_id,rpar_int)
156 if(gsyem_nfam.gt.gsyem_nfam_max)
call mntr_abort(gsyem_id,
157 $
'Too many families')
160 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_neddy_id(il),rpar_int)
161 gsyem_neddy(il) = itmp
162 if(itmp.gt.gsyem_neddy_max)
call mntr_abort(gsyem_id,
163 $
'Too many edies per family')
165 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_fambc_id(il),rpar_int)
168 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_sig_max_id(il),
170 gsyem_sig_max(il)=rtmp
172 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_sig_min_id(il),
174 gsyem_sig_min(il)=rtmp
177 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,gsyem_dir_id(jl,il),
179 gsyem_dir(jl,il)=rtmp
193 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,lrpid,rpar_log)
199 if (gsyem_chifrst)
then
204 call rprm_rp_get(itmp,rtmp,ltmp,ctmp,lrpid,rpar_int)
222 $
'Error reading checkpoint parameters')
225 if (param(27).lt.0)
then
233 gsyem_dirl(il) = .true.
235 if (gsyem_dir(jl,il).ne.0.0) gsyem_dirl(il) = .false.
242 gsyem_eoff(il+1) = gsyem_eoff(il) + gsyem_neddy(il)
251 $ gsyem_pumean,gsyem_ptke,gsyem_pdss)
257 if (gsyem_chifrst)
then
261 if (gsyem_mode.eq.1)
then
265 elseif (gsyem_mode.eq.2)
then
266 elseif (gsyem_mode.eq.3)
then
277 ltim = dnekclock() - ltim
313 if ((gsyem_chifrst.and.(istep.lt.(gsyem_nsnap-1))).or.
325 ltim = dnekclock() - ltim
347 integer step_cnt, set_out
355 parameter(ahdsize=132)
360 integer itmp(4), itmp2
362 real*4 workla4(2*ldim*gsyem_neddy_max)
363 real*8 workla8(ldim*gsyem_neddy_max)
364 equivalence(workla4,workla8)
370 set_out = mod(amr_iorset,amr_ioset_max)
375 if (istep.le.step_cnt)
return
381 if (step_cnt.eq.1)
then
384 call mntr_log(gsyem_id,lp_inf,
'Writing checkpoint snapshot')
390 fname=
'GSEM'//trim(adjustl(session))//
'_rs.'
391 write(str,
'(i5.5)') set_out + 1
392 fname=trim(fname)//trim(str(1:5))//char(0)
399 call blank(hdr,ahdsize)
401 write(hdr,10) gsyem_mode, gsyem_nfam, time
402 10
format(
'#gsem',1x,i2,1x,i2,1x,1pe14.7)
405 if (ierr.gt.0)
goto 20
408 test_pattern = 6.54321
411 if (ierr.gt.0)
goto 20
416 itmp(1) = gsyem_fambc(il)
417 itmp(2) = gsyem_neddy(il)
418 itmp(3) = gsyem_gfnum(il)
419 itmp(4) = gsyem_genum(il)
422 if (ierr.gt.0)
goto 20
424 itmp2 = ldim*gsyem_neddy(il)
425 call copy(workla8,gsyem_epos(1,gsyem_eoff(il)),itmp2)
427 if (ierr.gt.0)
goto 20
429 call byte_write(gsyem_eps(1,gsyem_eoff(il)),itmp2,ierr)
430 if (ierr.gt.0)
goto 20
441 $
'gsyem_rst_write: Error writing restart file.')
445 ltim = dnekclock() - ltim
471 integer lgsyem_mode, lgsyem_nfam, lgsyem_fambc, lgsyem_neddy
472 integer lgsyem_gfnum, lgsyem_genum
478 parameter(ahdsize=132)
483 integer itmp(4), itmp2
485 real*4 workla4(2*ldim*gsyem_neddy_max)
486 real*8 workla8(ldim*gsyem_neddy_max)
487 equivalence(workla4,workla8)
488 logical if_byte_swap_test, if_byte_sw_loc
494 call mntr_log(gsyem_id,lp_inf,
'Reading checkpoint')
500 fname=
'GSEM'//trim(adjustl(session))//
'_rs.'
501 write(str,
'(i5.5)') gsyem_fnum
502 fname=trim(fname)//trim(str(1:5))//char(0)
509 call blank(hdr,ahdsize)
512 if (ierr.gt.0)
goto 20
514 if (indx2(hdr,132,
'#gsem',5).eq.1)
then
515 read(hdr,*) dummy,lgsyem_mode,lgsyem_nfam,ltime
518 $
'gsyem_rst_read; Error reading header')
523 if(lgsyem_mode.ne.gsyem_mode.or.lgsyem_nfam.
524 $ ne.gsyem_nfam)
then
526 $
'gsyem_rst_read; Inconsistent header values')
533 if (ierr.gt.0)
goto 20
535 if_byte_sw_loc = if_byte_swap_test(test_pattern,ierr)
536 if (ierr.gt.0)
goto 20
542 if (if_byte_sw_loc)
then
544 if (ierr.gt.0)
goto 20
546 if(itmp(1).ne.gsyem_fambc(il).or.
547 $ itmp(2).ne.gsyem_neddy(il).or.
548 $ itmp(3).ne.gsyem_gfnum(il).or.
549 $ itmp(4).ne.gsyem_genum(il))
then
551 $
'gsyem_rst_read; Inconsistent family data')
556 itmp2 = ldim*gsyem_neddy(il)
558 if (ierr.gt.0)
goto 20
559 if (if_byte_sw_loc)
then
561 if (ierr.gt.0)
goto 20
563 call copy(gsyem_epos(1,gsyem_eoff(il)),workla8,itmp2)
565 call byte_read(gsyem_eps(1,gsyem_eoff(il)),itmp2,ierr)
566 if (ierr.gt.0)
goto 20
567 if (if_byte_sw_loc)
then
570 if (ierr.gt.0)
goto 20
582 $
'gsyem_rst_read: Error reading restart file.')
585 itmp2 = ldim*(gsyem_eoff(gsyem_nfam + 1) - 1)
586 call bcast(gsyem_epos,itmp2*wdsize)
587 call bcast(gsyem_eps,itmp2*isize)
606 integer ierr, itmp, itmp2, il, iel, iface, jl
613 data iffmap / 2,4,5,6, 1,3,5,6, 2,4,5,6, 1,3,5,6,
619 data ifemap / 10,9,1,3, 10,12,6,8, 12,11,2,4, 9,11,5,7,
629 call izero(gsyem_lfnum,gsyem_nfam_max)
630 call izero(gsyem_gfnum,gsyem_nfam_max)
631 call izero(gsyem_lenum,gsyem_nfam_max)
632 call izero(gsyem_genum,gsyem_nfam_max)
633 itmp = 2*lelt*gsyem_nfam_max
634 call izero(gsyem_lfmap,itmp)
635 call izero(gsyem_lemap,itmp)
641 if(boundaryid(iface,iel).eq.gsyem_fambc(il))
then
643 if(cbc(iface,iel,1).eq.
'v ')
then
644 gsyem_lfmap(1,itmp,il) = iel
645 gsyem_lfmap(2,itmp,il) = iface
648 cbcl = cbc(iffmap(jl,iface),iel,1)
649 if(cbcl(1:1).eq.
'W'.or.cbcl(1:1).eq.
'm')
then
651 gsyem_lemap(1,itmp2,il) = iel
652 gsyem_lemap(2,itmp2,il) = ifemap(jl,iface)
661 gsyem_lfnum(il) = itmp
662 gsyem_gfnum(il) = iglsum(gsyem_lfnum(il),1)
663 if (gsyem_gfnum(il).eq.0)
call mntr_abort(gsyem_id,
665 gsyem_lenum(il) = itmp2
666 gsyem_genum(il) = iglsum(gsyem_lenum(il),1)
673 gsyem_foff(il+1) = gsyem_foff(il) + gsyem_lfnum(il)
678 $ gsyem_pumean,gsyem_ptke,gsyem_pdss)
699 integer npoint(gsyem_nfam_max)
701 integer poff(gsyem_nfam_max+1)
703 real rpos(gsyem_npoint_max*gsyem_nfam_max)
705 real umean(gsyem_npoint_max*gsyem_nfam_max)
707 real tke(gsyem_npoint_max*gsyem_nfam_max)
709 real dss(gsyem_npoint_max*gsyem_nfam_max)
713 integer il, jl, kl, ll, ml, nl
714 integer iel, ifc, ied, ifn, itmp
716 parameter(epsl=1.0e-06)
719 real xyz_ewall(ldim,lx1,gsyem_edge_max,gsyem_nfam_max)
720 real vrtmp(lx1*lz1), work(lx1*ldim*gsyem_edge_max)
721 real drtmp(ldim,lx1*lz1)
724 integer igl_running_sum
725 real vlmin, vlmax, vlsum
727 call mntr_log(gsyem_id,lp_inf,
'Generate family information')
732 call mntr_log(gsyem_id,lp_inf,
'Extract edge position')
734 call rzero(xyz_ewall,ldim*lx1*gsyem_edge_max*gsyem_nfam_max)
738 if (gsyem_genum(il).gt.gsyem_edge_max)
call mntr_abort(gsyem_id,
739 $
'Too many edges per family')
741 itmp = igl_running_sum(gsyem_lenum(il)) - gsyem_lenum(il)
742 do jl=1,gsyem_lenum(il)
743 iel = gsyem_lemap(1,jl,il)
744 ied = gsyem_lemap(2,jl,il)
747 call math_etovec(vrtmp,ied,xm1(1,1,1,iel),lx1,ly1,lz1)
749 xyz_ewall(1,kl,itmp+jl,il) = vrtmp(kl)
751 call math_etovec(vrtmp,ied,ym1(1,1,1,iel),lx1,ly1,lz1)
753 xyz_ewall(2,kl,itmp+jl,il) = vrtmp(kl)
755 call math_etovec(vrtmp,ied,zm1(1,1,1,iel),lx1,ly1,lz1)
757 xyz_ewall(ldim,kl,itmp+jl,il) = vrtmp(kl)
761 call gop(xyz_ewall(1,1,1,il),work,
'+ ',ldim*lx1*gsyem_edge_max)
765 call mntr_log(gsyem_id,lp_inf,
'Extract bounding box information')
769 call cfill(gsyem_bmin(1,il),rtmp,ldim)
771 call cfill(gsyem_bmax(1,il),rtmp,ldim)
773 call rzero(gsyem_bcrd,ldim*gsyem_nfam_max)
774 call rzero(gsyem_bnrm,ldim*gsyem_nfam_max)
775 call rzero(gsyem_area,gsyem_nfam_max)
779 do jl=1,gsyem_lfnum(il)
780 iel = gsyem_lfmap(1,jl,il)
781 ifc = gsyem_lfmap(2,jl,il)
784 call ftovec(vrtmp,xm1,iel,ifc,lx1,ly1,lz1)
785 rtmp = vlmin(vrtmp,itmp)
786 gsyem_bmin(1,il) = min(gsyem_bmin(1,il),rtmp)
787 rtmp = vlmax(vrtmp,itmp)
788 gsyem_bmax(1,il) = max(gsyem_bmax(1,il),rtmp)
789 rtmp = vlsum(vrtmp,itmp)
790 gsyem_bcrd(1,il) = gsyem_bcrd(1,il) + rtmp
791 rtmp = vlsum(unx(1,1,ifc,iel),itmp)
792 gsyem_bnrm(1,il) = gsyem_bnrm(1,il) + rtmp
794 call ftovec(vrtmp,ym1,iel,ifc,lx1,ly1,lz1)
795 rtmp = vlmin(vrtmp,itmp)
796 gsyem_bmin(2,il) = min(gsyem_bmin(2,il),rtmp)
797 rtmp = vlmax(vrtmp,itmp)
798 gsyem_bmax(2,il) = max(gsyem_bmax(2,il),rtmp)
799 rtmp = vlsum(vrtmp,itmp)
800 gsyem_bcrd(2,il) = gsyem_bcrd(2,il) + rtmp
801 rtmp = vlsum(uny(1,1,ifc,iel),itmp)
802 gsyem_bnrm(2,il) = gsyem_bnrm(2,il) + rtmp
804 call ftovec(vrtmp,zm1,iel,ifc,lx1,ly1,lz1)
805 rtmp = vlmin(vrtmp,itmp)
806 gsyem_bmin(ldim,il) = min(gsyem_bmin(ldim,il),rtmp)
807 rtmp = vlmax(vrtmp,itmp)
808 gsyem_bmax(ldim,il) = max(gsyem_bmax(ldim,il),rtmp)
809 rtmp = vlsum(vrtmp,itmp)
810 gsyem_bcrd(ldim,il) = gsyem_bcrd(ldim,il) + rtmp
811 rtmp = vlsum(unz(1,1,ifc,iel),itmp)
812 gsyem_bnrm(ldim,il) = gsyem_bnrm(ldim,il) + rtmp
815 gsyem_area(il) = gsyem_area(il)+vlsum(area(1,1,ifc,iel),itmp)
820 call gop(gsyem_bmin,work,
'm ',ldim*gsyem_nfam_max)
821 call gop(gsyem_bmax,work,
'M ',ldim*gsyem_nfam_max)
822 call gop(gsyem_bcrd,work,
'+ ',ldim*gsyem_nfam_max)
823 call gop(gsyem_bnrm,work,
'+ ',ldim*gsyem_nfam_max)
824 call gop(gsyem_area,work,
'+ ',gsyem_nfam_max)
827 rtmp = 1.0/real(lx1*lx1*gsyem_gfnum(il))
828 call cmult(gsyem_bcrd(1,il),rtmp,ldim)
831 call cmult(gsyem_bnrm(1,il),rtmp,ldim)
835 rtmp = rtmp + gsyem_bnrm(jl,il)**2
837 rtmp = 1.0/sqrt(rtmp)
838 call cmult(gsyem_bnrm(1,il),rtmp,ldim)
843 if(gsyem_bnrm(3,il).gt.(1.0-epsl))
then
844 gsyem_raxs(1,il) = 1.0
845 gsyem_raxs(2,il) = 0.0
846 gsyem_raxs(3,il) = 0.0
848 elseif(gsyem_bnrm(3,il).lt.(epsl-1.0))
then
849 gsyem_raxs(1,il) = 1.0
850 gsyem_raxs(2,il) = 0.0
851 gsyem_raxs(3,il) = 0.0
854 gsyem_raxs(1,il) = -gsyem_bnrm(2,il)
855 gsyem_raxs(2,il) = gsyem_bnrm(1,il)
856 gsyem_raxs(3,il) = 0.0
857 rtmp = sqrt(gsyem_bnrm(1,il)**2 + gsyem_bnrm(2,il)**2)
858 gsyem_rang(il) = atan2(rtmp,gsyem_bnrm(3,il))
870 rtmp = rtmp + (gsyem_bmin(jl,il) - gsyem_bcrd(jl,il))*
874 gsyem_bmin(jl,il) = (gsyem_bmin(jl,il) - gsyem_bcrd(jl,il)) -
875 $ rtmp*gsyem_bnrm(jl,il)
880 rtmp = rtmp + (gsyem_bmax(jl,il) - gsyem_bcrd(jl,il))*
884 gsyem_bmax(jl,il) = (gsyem_bmax(jl,il) - gsyem_bcrd(jl,il)) -
885 $ rtmp*gsyem_bnrm(jl,il)
890 $ gsyem_raxs(1,il),-gsyem_rang(il))
892 $ gsyem_raxs(1,il),-gsyem_rang(il))
899 gsyem_cln_min(il) = 99.0e20
900 gsyem_cln_max(il) = -99.0e20
901 do jl = 1,gsyem_genum(il)
906 $ (gsyem_bcrd(kl,il)-xyz_ewall(kl,ll,jl,il))**2
909 gsyem_cln_min(il) = min(gsyem_cln_min(il),rtmp)
910 gsyem_cln_max(il) = max(gsyem_cln_max(il),rtmp)
914 call gop(gsyem_cln_min,work,
'm ',gsyem_nfam_max)
915 call gop(gsyem_cln_max,work,
'M ',gsyem_nfam_max)
919 call mntr_log(gsyem_id,lp_inf,
'Generate face information')
922 call cfill(gsyem_mdst,rtmp,gsyem_nfam_max)
923 call rzero(gsyem_sigma,lx1*lz1*6*lelt)
924 call rzero(gsyem_umean,lx1*lz1*6*lelt)
925 call rzero(gsyem_intn,lx1*lz1*6*lelt)
926 call rzero(gsyem_ub,ldim*gsyem_nfam_max)
930 do jl=1,gsyem_lfnum(il)
931 iel = gsyem_lfmap(1,jl,il)
932 ifc = gsyem_lfmap(2,jl,il)
935 call ftovec(vrtmp,xm1,iel,ifc,lx1,ly1,lz1)
937 drtmp(1,kl) = vrtmp(kl)
939 call ftovec(vrtmp,ym1,iel,ifc,lx1,ly1,lz1)
941 drtmp(2,kl) = vrtmp(kl)
943 call ftovec(vrtmp,zm1,iel,ifc,lx1,ly1,lz1)
945 drtmp(ldim,kl) = vrtmp(kl)
953 call cfill(vrtmp,rtmp,lx1*lz1)
954 do kl=1,gsyem_genum(il)
960 $ (xyz_ewall(nl,ll,kl,il)-drtmp(nl,ml))**2
963 vrtmp(ml) = min(vrtmp(ml),rtmp)
968 ifn = gsyem_foff(il) + jl - 1
973 rtmp = vlmax(vrtmp,lx1*lz1)
974 gsyem_mdst(il) = max(gsyem_mdst(il),rtmp)
978 call gop(gsyem_ub,work,
'+ ',ldim*gsyem_nfam_max)
979 call gop(gsyem_mdst,work,
'M ',gsyem_nfam_max)
983 rtmp = 1.0/gsyem_area(il)
985 gsyem_ub(jl,il) = gsyem_ub(jl,il)*rtmp
987 if (gsyem_dirl(il))
then
990 gsyem_un(il) = gsyem_un(il) +
991 $ gsyem_ub(jl,il)*gsyem_bnrm(jl,il)
996 gsyem_un(il) = gsyem_un(il) + gsyem_ub(jl,il)**2
998 gsyem_un(il) = sqrt(gsyem_un(il))
1002 gsyem_bext(il) = min(gsyem_sig_max(il),gsyem_cln_min(il))
1006 call mntr_log(gsyem_id,lp_inf,
'General family information')
1008 call mntr_logi(gsyem_id,lp_inf,
'Family: ',il)
1009 call mntr_log(gsyem_id,lp_inf,
'Boundary box:')
1010 call mntr_logr(gsyem_id,lp_inf,
'min x=',gsyem_bmin(1,il))
1011 call mntr_logr(gsyem_id,lp_inf,
'min y=',gsyem_bmin(2,il))
1012 call mntr_logr(gsyem_id,lp_inf,
'min z=',gsyem_bmin(3,il))
1013 call mntr_logr(gsyem_id,lp_inf,
'max x=',gsyem_bmax(1,il))
1014 call mntr_logr(gsyem_id,lp_inf,
'max y=',gsyem_bmax(2,il))
1015 call mntr_logr(gsyem_id,lp_inf,
'max z=',gsyem_bmax(3,il))
1016 call mntr_log(gsyem_id,lp_inf,
'Average centre coordiantes:')
1017 call mntr_logr(gsyem_id,lp_inf,
'x=',gsyem_bcrd(1,il))
1018 call mntr_logr(gsyem_id,lp_inf,
'y=',gsyem_bcrd(2,il))
1019 call mntr_logr(gsyem_id,lp_inf,
'z=',gsyem_bcrd(3,il))
1020 call mntr_log(gsyem_id,lp_inf,
'Average normal:')
1021 call mntr_logr(gsyem_id,lp_inf,
'x=',gsyem_bnrm(1,il))
1022 call mntr_logr(gsyem_id,lp_inf,
'y=',gsyem_bnrm(2,il))
1023 call mntr_logr(gsyem_id,lp_inf,
'z=',gsyem_bnrm(3,il))
1024 call mntr_log(gsyem_id,lp_inf,
'Rotation axis:')
1025 call mntr_logr(gsyem_id,lp_inf,
'rx=',gsyem_raxs(1,il))
1026 call mntr_logr(gsyem_id,lp_inf,
'ry=',gsyem_raxs(2,il))
1027 call mntr_logr(gsyem_id,lp_inf,
'rz=',gsyem_raxs(3,il))
1028 call mntr_log(gsyem_id,lp_inf,
'Rotation angle:')
1029 call mntr_logr(gsyem_id,lp_inf,
'ang=',gsyem_rang(il))
1030 call mntr_log(gsyem_id,lp_inf,
'Characteristic length:')
1031 call mntr_logr(gsyem_id,lp_inf,
'min=',gsyem_cln_min(il))
1032 call mntr_logr(gsyem_id,lp_inf,
'max=',gsyem_cln_max(il))
1033 call mntr_log(gsyem_id,lp_inf,
'Box extent in norm. dir.:')
1034 call mntr_logr(gsyem_id,lp_inf,
'bext=',2.0*gsyem_bext(il))
1035 call mntr_log(gsyem_id,lp_inf,
'Max point distance:')
1036 call mntr_logr(gsyem_id,lp_inf,
'min=',gsyem_mdst(il))
1037 call mntr_log(gsyem_id,lp_inf,
'Surface area:')
1038 call mntr_logr(gsyem_id,lp_inf,
'area=',gsyem_area(il))
1039 call mntr_log(gsyem_id,lp_inf,
'Bulk velocity:')
1040 call mntr_logr(gsyem_id,lp_inf,
'ubx=',gsyem_ub(1,il))
1041 call mntr_logr(gsyem_id,lp_inf,
'uby=',gsyem_ub(2,il))
1042 call mntr_logr(gsyem_id,lp_inf,
'ubz=',gsyem_ub(3,il))
1043 call mntr_log(gsyem_id,lp_inf,
'Projected bulk velocity:')
1044 call mntr_logr(gsyem_id,lp_inf,
'un=',gsyem_un(il))
1068 integer npoint(gsyem_nfam_max), poff(gsyem_nfam_max+1)
1069 real rpos(gsyem_npoint_max*gsyem_nfam_max)
1070 real umean(gsyem_npoint_max*gsyem_nfam_max)
1071 real tke(gsyem_npoint_max*gsyem_nfam_max)
1072 real dss(gsyem_npoint_max*gsyem_nfam_max)
1075 integer itmp, il, jl, ierr, iunit
1080 call mntr_log(gsyem_id,lp_prd,
'Reading family profiles')
1083 itmp = gsyem_npoint_max*gsyem_nfam_max
1084 call rzero(rpos,itmp)
1085 call rzero(umean,itmp)
1086 call rzero(tke,itmp)
1087 call rzero(dss,itmp)
1097 write(str,
'(i2.2)') gsyem_fambc(il)
1098 fname=
'gsyem_prof_'//trim(adjustl(str))//
'.txt'
1099 open(unit=iunit,
file=fname,status=
'old',iostat=ierr)
1101 read(iunit,*,iostat=ierr)
1102 read(iunit,*,iostat=ierr) npoint(il)
1103 if (npoint(il).gt.gsyem_npoint_max.or.
1104 $ npoint(il).le.0)
then
1106 $
'Wrong piont number in '//trim(adjustl(fname)),nid)
1111 do jl=0,npoint(il) - 1
1112 itmp = poff(il) + jl
1113 read(iunit,*,iostat=ierr) rpos(itmp),umean(itmp),
1114 $ tke(itmp),dss(itmp)
1118 poff(il+1) = poff(il) + npoint(il)
1127 call bcast(npoint,gsyem_nfam*isize)
1128 call bcast(poff,(gsyem_nfam+1)*isize)
1129 itmp = (poff(gsyem_nfam+1)-1)*wdsize
1130 call bcast(rpos,itmp)
1131 call bcast(umean,itmp)
1132 call bcast(tke,itmp)
1133 call bcast(dss,itmp)
1161 integer nfam, iel, ifc, ifn
1162 integer poff(gsyem_nfam_max+1)
1163 real rpos(gsyem_npoint_max*gsyem_nfam_max)
1164 real umean(gsyem_npoint_max*gsyem_nfam_max)
1165 real tke(gsyem_npoint_max*gsyem_nfam_max)
1166 real dss(gsyem_npoint_max*gsyem_nfam_max)
1170 integer itmp, il, jl, kl
1171 real nrtmp1(lx1*lz1), nrtmp2(lx1*lz1)
1172 real pvel, ptke, pdss, int1, int2, rtmp
1174 parameter(twothr=2.0/3.0)
1185 itmp = poff(nfam+1)-1
1189 do kl=poff(nfam)+1,itmp
1190 if (dist(il,jl).le.rpos(kl))
then
1191 rtmp = 1.0/(rpos(kl) - rpos(kl-1))
1192 int1 = (rpos(kl) - dist(il,jl))*rtmp
1193 int2 = (dist(il,jl)-rpos(kl-1))*rtmp
1194 pvel = int1*umean(kl-1) + int2*umean(kl)
1195 ptke = int1*tke(kl-1) + int2*tke(kl)
1196 pdss = int1*dss(kl-1) + int2*dss(kl)
1202 rtmp = ptke**1.5/pdss
1208 rtmp = min(rtmp,0.41*gsyem_cln_max(nfam))
1211 rtmp = min(rtmp,dist(il,jl))
1215 rtmp = max(rtmp,0.001*gsyem_cln_min(nfam))
1218 rtmp = min(max(rtmp,gsyem_sig_min(nfam)),gsyem_sig_max(nfam))
1221 gsyem_sigma(il,jl,ifn) = rtmp
1222 gsyem_umean(il,jl,ifn) = pvel
1223 gsyem_intn(il,jl,ifn) = sqrt(twothr*ptke)
1229 call col3(nrtmp1,gsyem_umean(1,1,ifn),area(1,1,ifc,iel),itmp)
1230 if (gsyem_dirl(nfam))
then
1231 call col3(nrtmp2,nrtmp1,unx(1,1,ifc,iel),itmp)
1232 gsyem_ub(1,nfam) = gsyem_ub(1,nfam) - vlsum(nrtmp2,itmp)
1233 call col3(nrtmp2,nrtmp1,uny(1,1,ifc,iel),itmp)
1234 gsyem_ub(2,nfam) = gsyem_ub(2,nfam) - vlsum(nrtmp2,itmp)
1235 call col3(nrtmp2,nrtmp1,unz(1,1,ifc,iel),itmp)
1236 gsyem_ub(3,nfam) = gsyem_ub(3,nfam) - vlsum(nrtmp2,itmp)
1239 call copy(nrtmp2,nrtmp1,itmp)
1240 call cmult(nrtmp2,gsyem_dir(il,nfam),itmp)
1241 gsyem_ub(il,nfam) = gsyem_ub(il,nfam) + vlsum(nrtmp2,itmp)
1264 integer neddy, nfam, elist(neddy)
1268 integer il, itmp1, itmp2, ierr
1272 real eposl(ldim,gsyem_neddy_max)
1273 integer epsl(ldim,gsyem_neddy_max)
1276 integer mntr_lp_def_get
1281 call usr_gen_eddy(eposl(1,il),epsl(1,il),nfam,ifinit)
1286 call bcast(neddy,isize)
1287 call bcast(elist,neddy*isize)
1288 call bcast(eposl,ldim*neddy*wdsize)
1289 call bcast(epsl,ldim*neddy*isize)
1292 itmp1 = gsyem_eoff(nfam)
1293 itmp2 = gsyem_eoff(nfam+1)-1
1297 if (elist(il).lt.itmp1.or.elist(il).gt.itmp2)
then
1301 call copy(gsyem_epos(1,elist(il)),eposl(1,il),ldim)
1302 call icopy(gsyem_eps(1,elist(il)),epsl(1,il),ldim)
1307 call mntr_logi(gsyem_id,lp_prd,
'Generated new eddies neddy=',
1310 if (mntr_lp_def_get().lt.lp_inf)
then
1312 write(str,20) elist(il),eposl(1,il),eposl(2,il),eposl(3,il)
1313 20
format(
'edn=',i6,
' ex=',f9.5,
' ey=',f9.5,
' ez=',f9.5)
1339 integer elist(gsyem_neddy_max)
1342 call mntr_logi(gsyem_id,lp_prd,
'Initilise eddies for family=',
1346 neddy = gsyem_neddy(nfam)
1348 elist(il) = gsyem_eoff(nfam) + il - 1
1372 integer neddy, il, jl, itmp
1377 integer elist(gsyem_neddy_max)
1380 call mntr_logi(gsyem_id,lp_prd,
'Advect eddies for family=',nfam)
1384 do il=0,gsyem_neddy(nfam)-1
1385 itmp = gsyem_eoff(nfam)+il
1388 gsyem_epos(jl,itmp) = gsyem_epos(jl,itmp) +
1389 $ dt*gsyem_un(nfam)*gsyem_bnrm(jl,nfam)
1391 rtmp = rtmp + (gsyem_epos(jl,itmp)-gsyem_bcrd(jl,nfam))*
1392 $ gsyem_bnrm(jl,nfam)
1394 if (rtmp.gt.gsyem_bext(nfam))
then
1423 integer il, jl, itmp
1429 call mntr_logi(gsyem_id,lp_prd,
'Initilise modes for family=',nfam)
1433 do il=0,gsyem_neddy(nfam)-1
1434 itmp = gsyem_eoff(nfam)+il
1436 gsyem_eamp(jl,itmp) = math_ran_rng(0.0,1.0)
1437 gsyem_ephs(jl,itmp) = math_ran_rng(0.0,2.0*pi)
1443 call bcast(gsyem_eamp(1,gsyem_eoff(nfam)),
1444 $ ldim*gsyem_neddy(nfam)*wdsize)
1445 call bcast(gsyem_ephs(1,gsyem_eoff(nfam)),
1446 $ ldim*gsyem_neddy(nfam)*wdsize)
1463 if (gsyem_mode.eq.1)
then
1468 elseif (gsyem_mode.eq.2)
then
1469 elseif (gsyem_mode.eq.3)
then
1496 integer il, jl, kl, ll, ml
1497 integer iel, ifc, ifn, itmp, itmp2
1498 real vrtmp(lx1*lz1,ldim), drtmp(ldim,lx1*lz1)
1500 parameter(sqrt32=sqrt(1.5))
1501 real bulk_vel(ldim), vb
1502 real sqrtn, dr(ldim), rtmp, rtmp2, fc(ldim), fcm
1504 integer icount, ipos, iepos(gsyem_neddy_max)
1505 real el_dist, el_cnt(ldim)
1510 call rzero(bulk_vel,ldim)
1513 vb = 2.0*gsyem_area(nfam)*gsyem_bext(nfam)
1515 sqrtn = sqrt(16.0*vb/15/pi/real(gsyem_neddy(nfam)))
1519 do il=1,gsyem_lfnum(nfam)
1521 iel = gsyem_lfmap(1,il,nfam)
1522 ifc = gsyem_lfmap(2,il,nfam)
1524 ifn = gsyem_foff(nfam) + il - 1
1527 rtmp = 1.0/real(itmp)
1528 call ftovec(vrtmp,xm1,iel,ifc,lx1,ly1,lz1)
1530 drtmp(1,jl) = vrtmp(jl,1)
1532 el_cnt(1) = rtmp*vlsum(vrtmp,itmp)
1533 call ftovec(vrtmp,ym1,iel,ifc,lx1,ly1,lz1)
1535 drtmp(2,jl) = vrtmp(jl,1)
1537 el_cnt(2) = rtmp*vlsum(vrtmp,itmp)
1538 call ftovec(vrtmp,zm1,iel,ifc,lx1,ly1,lz1)
1540 drtmp(ldim,jl) = vrtmp(jl,1)
1542 el_cnt(ldim) = rtmp*vlsum(vrtmp,itmp)
1546 call rzero(vrtmp,itmp)
1548 vrtmp(1,1) = vrtmp(1,1)+(drtmp(jl,1)-el_cnt(jl))**2
1549 vrtmp(2,1) = vrtmp(2,1)+(drtmp(jl,lx1)-el_cnt(jl))**2
1550 vrtmp(3,1) = vrtmp(3,1)+(drtmp(jl,itmp-lx1+1)-el_cnt(jl))**2
1551 vrtmp(4,1) = vrtmp(4,1)+(drtmp(jl,itmp)-el_cnt(jl))**2
1553 el_dist = sqrt(vlmax(vrtmp,4))
1555 el_dist = el_dist + vlmax(gsyem_sigma(1,1,ifn),itmp)
1557 el_dist = 1.1*el_dist
1562 call izero(iepos,gsyem_neddy_max)
1563 do kl=0,gsyem_neddy(nfam)-1
1564 ipos = gsyem_eoff(nfam)+kl
1567 dr(ll) = el_cnt(ll) - gsyem_epos(ll,ipos)
1568 rtmp = rtmp + dr(ll)**2
1571 if (rtmp.le.el_dist)
then
1573 iepos(icount) = ipos
1578 if (gsyem_dirl(nfam))
then
1579 call rzero(vrtmp,lx1*lz1*ldim)
1580 call subcol3(vrtmp(1,1),unx(1,1,ifc,iel),
1581 $ gsyem_umean(1,1,ifn),itmp)
1582 call subcol3(vrtmp(1,2),uny(1,1,ifc,iel),
1583 $ gsyem_umean(1,1,ifn),itmp)
1584 call subcol3(vrtmp(1,3),unz(1,1,ifc,iel),
1585 $ gsyem_umean(1,1,ifn),itmp)
1588 call copy(vrtmp(1,kl),gsyem_umean(1,1,ifn),itmp)
1589 call cmult(vrtmp(1,kl),gsyem_dir(kl,nfam),itmp)
1601 dr(ml)=drtmp(ml,itmp2+kl)-gsyem_epos(ml,iepos(ll))
1602 rtmp = rtmp + dr(ml)**2
1605 rtmp2 = gsyem_sigma(kl,jl,ifn)
1606 if (rtmp.le.rtmp2)
then
1612 fc(1) = dr(2)*gsyem_eps(3,iepos(ll)) -
1613 $ dr(3)*gsyem_eps(2,iepos(ll))
1614 fc(2) = dr(3)*gsyem_eps(1,iepos(ll)) -
1615 $ dr(1)*gsyem_eps(3,iepos(ll))
1616 fc(3) = dr(1)*gsyem_eps(2,iepos(ll)) -
1617 $ dr(2)*gsyem_eps(1,iepos(ll))
1622 fcm = sqrtn*gsyem_intn(kl,jl,ifn)*sqrt(rtmp2)*
1623 $ sin(pi*rtmp*rtmp2)**2/rtmp**2
1627 vrtmp(itmp2+kl,ml) = vrtmp(itmp2+kl,ml) +
1636 call vectof(vx,vrtmp(1,1),iel,ifc,lx1,ly1,lz1)
1637 call vectof(vy,vrtmp(1,2),iel,ifc,lx1,ly1,lz1)
1638 call vectof(vz,vrtmp(1,3),iel,ifc,lx1,ly1,lz1)
1642 call col2(vrtmp(1,ml),area(1,1,ifc,iel),itmp)
1643 bulk_vel(ml) = bulk_vel(ml) + vlsum(vrtmp(1,ml),itmp)
1648 call gop(bulk_vel,fc,
'+ ',ldim)
1651 rtmp = 1.0/gsyem_area(nfam)
1652 call cmult(bulk_vel,rtmp,ldim)
1657 rtmp = gsyem_ub(ml,nfam) - bulk_vel(ml)
1658 call cfill(vrtmp(1,ml),rtmp,itmp)
1661 do il=1,gsyem_lfnum(nfam)
1663 iel = gsyem_lfmap(1,il,nfam)
1664 ifc = gsyem_lfmap(2,il,nfam)
1665 call vectof_add(vx,vrtmp(1,1),iel,ifc,lx1,ly1,lz1)
1666 call vectof_add(vy,vrtmp(1,2),iel,ifc,lx1,ly1,lz1)
1667 call vectof_add(vz,vrtmp(1,3),iel,ifc,lx1,ly1,lz1)
subroutine gop(x, w, op, n)
subroutine bcast(buf, len)
subroutine ftovec(a, b, ie, iface, nx, ny, nz)
subroutine vectof_add(b, a, ie, iface, nx, ny, nz)
subroutine vectof(b, a, ie, iface, nx, ny, nz)
subroutine chkpt_get_fset(step_cnt, set_out)
Get step count to the checkpoint and a set number.
subroutine gsyem_dairay(nfam)
Fill velocity array with eddies; Dairay.
subroutine gsyem_adv_eddy(nfam)
Advect/recycle eddies (gsyem_mode.eq.1) for a given family.
subroutine gsyem_register()
Register gSyEM module.
subroutine gsyem_evolve()
Time evolution of eddies.
subroutine gsyem_gen_mall(nfam)
Inital generation of all modes (gsyem_mode.eq.3) for a given family.
subroutine gsyem_gen_eall(nfam)
Inital generation of all eddies (gsyem_mode.eq.1) for a given family.
subroutine gsyem_init()
Initilise gSyEM module.
subroutine gsyem_rst_write
Create checkpoint.
subroutine gsyem_fam_setup(npoint, poff, rpos, umean, tke, dss)
Generate family information.
subroutine gsyem_gen_elist(elist, neddy, nfam, ifinit)
Generate eddies from the list for a given family.
subroutine gsyem_main
Main gSyEM interface.
subroutine gsyem_mesh_setup()
Generate mesh dependent information.
subroutine gsyem_rst_read
Read from checkpoint.
subroutine gsyem_prof_read(npoint, poff, rpos, umean, tke, dss)
Read profiles for all familes.
logical function gsyem_is_initialised()
Check if module was initialised.
subroutine gsyem_face_prof(nfam, poff, rpos, umean, tke, dss, iel, ifc, ifn, dist)
Generate profile information for given family face.
subroutine gsyem_iso(nfam)
Fill velocity array with eddies; ISO.
subroutine math_etovec(vec, edg, vfld, nx, ny, nz)
Extract 3D element edge.
subroutine math_zbqlini(seed)
Initialise Marsaglia-Zaman random number generator.
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_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_get_step_delay(dstep)
Get step delay.
subroutine mntr_log_local(mid, priority, logs, prid)
Write log message from given process.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine mntr_check_abort(mid, ierr, logs)
Abort simulation.
subroutine rprm_rp_is_name_reg(rpid, mid, pname, ptype)
Check if parameter name is registered and return its id. Check flags as well.
subroutine rprm_rp_get(ipval, rpval, lpval, cpval, rpid, ptype)
Get runtime parameter form active section. This operation is performed locally.
subroutine rprm_sec_is_name_reg(rpid, mid, pname)
Check if section name is registered and return its id. Check mid as well.
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 col3(a, b, c, n)
subroutine icopy(a, b, n)
subroutine subcol3(a, b, c, n)
subroutine cmult(a, const, n)
subroutine cfill(a, b, n)