KTH framework for Nek5000 toolboxes; testing version  0.0.1
Generalised synthetic eddy method module

Turbulence at inlet generated with divergence-free synthetic eddy method. More...

+ Collaboration diagram for Generalised synthetic eddy method module:

Files

file  gSyEM.f
 Generalised Synthetic Eddy Method.
 

Functions

subroutine gsyem_register ()
 Register gSyEM module. More...
 
subroutine gsyem_init ()
 Initilise gSyEM module. More...
 
logical function gsyem_is_initialised ()
 Check if module was initialised. More...
 
subroutine gsyem_main
 Main gSyEM interface. More...
 
subroutine gsyem_rst_write
 Create checkpoint. More...
 
subroutine gsyem_rst_read
 Read from checkpoint. More...
 
subroutine gsyem_mesh_setup ()
 Generate mesh dependent information. More...
 
subroutine gsyem_fam_setup (npoint, poff, rpos, umean, tke, dss)
 Generate family information. More...
 
subroutine gsyem_prof_read (npoint, poff, rpos, umean, tke, dss)
 Read profiles for all familes. More...
 
subroutine gsyem_face_prof (nfam, poff, rpos, umean, tke, dss, iel, ifc, ifn, dist)
 Generate profile information for given family face. More...
 
subroutine gsyem_gen_elist (elist, neddy, nfam, ifinit)
 Generate eddies from the list for a given family. More...
 
subroutine gsyem_gen_eall (nfam)
 Inital generation of all eddies (gsyem_mode.eq.1) for a given family. More...
 
subroutine gsyem_adv_eddy (nfam)
 Advect/recycle eddies (gsyem_mode.eq.1) for a given family. More...
 
subroutine gsyem_gen_mall (nfam)
 Inital generation of all modes (gsyem_mode.eq.3) for a given family. More...
 
subroutine gsyem_evolve ()
 Time evolution of eddies. More...
 
subroutine gsyem_iso (nfam)
 Fill velocity array with eddies; ISO. More...
 
subroutine gsyem_dairay (nfam)
 Fill velocity array with eddies; Dairay. More...
 

Detailed Description

Turbulence at inlet generated with divergence-free synthetic eddy method.

This set of routines generating set of vortices at the computational domain inlet. The method is based on [6].

This module requires runtime parameters defined by Checkpointing routines module to properly perform restart operations. User defined routine (usr_gen_eddy) provides the rules for generating a single vortex. It allows the user to specify vertex distribution on the face (e.g. within a circle or a rectangular region) and a given vortex orientation. An example provided in this directory gives random position within a circle (random rho and theta variables) assuming the face is normal to Z axis. Two different options are considered depending on (ifinit) flag. The first one corresponsd to a simulation initialisation where the vortices fill the whole testing volume. In the second one the vortives are placed on at the inflow position only. Next a vortex position is rotated to match a real face position in the computational domain. The final step is definition of the vortex orinetation with an integer array. In addition the user has to provide a radial distribution of a mean velocity (U_mean), a turbulence kinetic energy (k) and a dissipation rate (eps). U_mean, k and eps have to be given in a text file "gsyem_prof_###.txt" containing three header lines:

# point number in a profile

187

# r U_mean k eps

followed by the data set for each point in the profile. The scend line in the header gives the number of radial positions in the profile, and the data set consists of four real numbers: radial position (r), U_mean, k and eps.

Todo:
This description has to be extended.
Module interface:
Global interface list:
Interface provided:
  1. gsyem_register
  2. gsyem_init
  3. gsyem_main
Global interface dependency:
Interface required:
  1. multiple interfaces from Runtime parameters and Monitoring module modules
  2. io_file_freeid from Input/output module module (debugging only)
  3. chkpt_get_fset from Checkpointing routines module
  4. math_ran_rng, math_zbqlini, math_etovec and math_rot3da from Math module
  5. usr_gen_eddy; user defined
Module interface usage:
!======================================================================
subroutine userchk
include 'TSTEP' ! ISTEP
! start framework
if (istep.eq.0) call frame_start
! monitor simulation
! save/load files for full-restart
! add turbulent inflow
! finalise framework
if (istep.ge.nsteps.or.lastep.eq.1) then
call frame_end
endif
return
end
!======================================================================
subroutine frame_usr_register
implicit none
include 'SIZE'
include 'FRAMELP'
!-----------------------------------------------------------------------
! register modules
return
end subroutine
!======================================================================
subroutine frame_usr_init
implicit none
include 'SIZE'
include 'FRAMELP'
!-----------------------------------------------------------------------
! initialise modules
return
end subroutine
!======================================================================
subroutine frame_usr_end
implicit none
include 'SIZE'
include 'FRAMELP'
!-----------------------------------------------------------------------
return
end subroutine
!======================================================================
subroutine chkpt_init()
Initilise checkpointing module.
Definition: chkpt.f:87
subroutine chkpt_main
Main checkpoint interface.
Definition: chkpt.f:201
subroutine chkpt_register()
Register checkpointing module.
Definition: chkpt.f:11
subroutine frame_monitor
Simulataion monitoring.
Definition: frame.f:59
subroutine frame_start
Start framework.
Definition: frame.f:12
subroutine frame_end
Finalise framework.
Definition: frame.f:76
subroutine gsyem_register()
Register gSyEM module.
Definition: gSyEM.f:14
subroutine gsyem_init()
Initilise gSyEM module.
Definition: gSyEM.f:117
subroutine gsyem_main
Main gSyEM interface.
Definition: gSyEM.f:300
!=======================================================================
subroutine usr_gen_eddy(epos,eps,nfam,ifinit)
implicit none
include 'SIZE'
include 'TSTEP' ! pi
include 'GSYEMD'
! argument list
real epos(ldim)
integer eps(ldim)
integer nfam
logical ifinit
! local variables
real rho, theta, vrtmp(ldim)
integer il
real yp_cut
parameter(yp_cut=0.45)
! functions
real math_ran_rng
!-----------------------------------------------------------------------
rho = yp_cut*sqrt(math_ran_rng(0.0,1.0))
theta = math_ran_rng(0.,2.0*pi)
vrtmp(1) = rho*cos(theta)
vrtmp(2) = rho*sin(theta)
if (ifinit) then
vrtmp(ldim) = math_ran_rng(-gsyem_bext(nfam),gsyem_bext(nfam))
else
vrtmp(ldim) = -gsyem_bext(nfam)
endif
! rotate coordinates
call math_rot3da(epos,vrtmp,
$ gsyem_raxs(1,nfam),gsyem_rang(nfam))
do il=1,ldim
rho = math_ran_rng(0.0,1.0)
if (rho.gt.0.5) then
eps(il) = 1
else
eps(il) = -1
endif
enddo
return
end subroutine
!=======================================================================
subroutine math_rot3da(vo, vi, va, an)
3D rotation of a vector along given axis.
Definition: math_tools.f:332
Warning
This module's restart procedure depends on Checkpointing routines module. As multisetep checpointeing sets the number of the restart file set chkpt_main must be called before gsyem_main.
Module parameters:
Global parameter list:
Parameters provided by gsyem module (include file - GSYEMD):
Varaible Type Runtime parameter Default value Description
gsyem_mode integer _gsyem:mode 1 gSyEM mode
gsyem_nfam integer _gsyem:nfam 1 Family number
gsyem_neddy(il) integer _gsyem:neddy'il' 10 Numer of eddies of 'il' family
gsyem_fambc(il) integer _gsyem:fambc'il' 10 Boundarry index of 'il' family
gsyem_famasig(il) real _gsyem:famasig'il' 0.025 Max eddy size of 'il' family
gsyem_famisig(il) real _gsyem:famisig'il' 0.025 Min eddy size of 'il' family
gsyem_famdirx(il) real _gsyem:famdirx'il' 0.025 X normal component of 'il' family
gsyem_famdiry(il) real _gsyem:famdiry'il' 0.025 X normal component of 'il' family
gsyem_famdirz(il) real _gsyem:famdirz'il' 0.025 X normal component of 'il' family
Global parameter dependency:
Parameters required by gsyem module:
  1. Checkpointing routines :
    • _chkpt:readchkpt - start simulation form checkpoint
    • _chkpt:chkpFnumber - restart file number
  2. Nek5000
    • PARAM(27)
Module parameter usage:
[_GSYEM]
mode = 1
nfam = 1
neddy01 = 10000
fambc01 = 1
famasig01 = 0.25
famisig01 = 0.0025
famdirx01 = 0.0
famdiry01 = 0.0
famdirz01 = 0.0

Function Documentation

◆ gsyem_adv_eddy()

subroutine gsyem_adv_eddy ( integer  nfam)

Advect/recycle eddies (gsyem_mode.eq.1) for a given family.

Parameters
[in]nfamfamily number

Definition at line 1360 of file gSyEM.f.

References gsyem_gen_elist(), and mntr_logi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_dairay()

subroutine gsyem_dairay ( integer  nfam)

Fill velocity array with eddies; Dairay.

Parameters
[in]nfamfamily number
Todo:
this routine is not done yet

Definition at line 1679 of file gSyEM.f.

+ Here is the caller graph for this function:

◆ gsyem_evolve()

subroutine gsyem_evolve

Time evolution of eddies.

Definition at line 1453 of file gSyEM.f.

References gsyem_adv_eddy(), gsyem_dairay(), and gsyem_iso().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_face_prof()

subroutine gsyem_face_prof ( integer  nfam,
integer, dimension(gsyem_nfam_max+1)  poff,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  rpos,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  umean,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  tke,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  dss,
integer  iel,
integer  ifc,
integer  ifn,
real, dimension(lx1,lz1 dist 
)

Generate profile information for given family face.

Parameters
[in]nfamfamily number
[in]pofffamily profile array offset
[in]rposposition in a profile
[in]umeanprofile mean velocity
[in]tkeprofile turbulence kinetic energy
[in]dssprofile dissipation rate
[in]iellocal element number
[in]ifcface number
[in]ifnface position in gsyem_sigma,gsyem_umean,gsyem_intn arrays
[in]distpoint distance form the edge

Definition at line 1150 of file gSyEM.f.

References cmult(), col3(), and copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_fam_setup()

subroutine gsyem_fam_setup ( integer, dimension(gsyem_nfam_max)  npoint,
integer, dimension(gsyem_nfam_max+1)  poff,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  rpos,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  umean,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  tke,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  dss 
)

Generate family information.

This routine generates family information including bounding box size, average coordinates, normal vector

Definition at line 687 of file gSyEM.f.

References cfill(), cmult(), ftovec(), gop(), gsyem_face_prof(), math_etovec(), math_rot3da(), mntr_abort(), mntr_log(), mntr_logi(), mntr_logr(), and rzero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_gen_eall()

subroutine gsyem_gen_eall ( integer  nfam)

Inital generation of all eddies (gsyem_mode.eq.1) for a given family.

Parameters
[in]nfamfamily number

Definition at line 1324 of file gSyEM.f.

References gsyem_gen_elist(), and mntr_logi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_gen_elist()

subroutine gsyem_gen_elist ( integer, dimension(neddy)  elist,
integer  neddy,
integer  nfam,
logical  ifinit 
)

Generate eddies from the list for a given family.

Note
This routine redistributes data among mpi ranks
Parameters
[in]elistlist of eddies to be geneated
[in]neddynumber of eddies
[in]nfamfamily number
[in]ifinitintial distribution

Definition at line 1255 of file gSyEM.f.

References bcast(), copy(), icopy(), mntr_check_abort(), mntr_log(), and mntr_logi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_gen_mall()

subroutine gsyem_gen_mall ( integer  nfam)

Inital generation of all modes (gsyem_mode.eq.3) for a given family.

Parameters
[in]nfamfamily number

Definition at line 1410 of file gSyEM.f.

References bcast(), and mntr_logi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_init()

subroutine gsyem_init

Initilise gSyEM module.

Note
This routine should be called in frame_usr_init

Definition at line 116 of file gSyEM.f.

References gsyem_gen_eall(), gsyem_gen_mall(), gsyem_mesh_setup(), gsyem_prof_read(), gsyem_rst_read(), math_zbqlini(), mntr_abort(), mntr_check_abort(), mntr_mod_is_name_reg(), mntr_tmr_add(), mntr_warn(), rprm_rp_get(), rprm_rp_is_name_reg(), and rprm_sec_is_name_reg().

+ Here is the call graph for this function:

◆ gsyem_is_initialised()

logical function gsyem_is_initialised

Check if module was initialised.

Returns
gsyem_is_initialised

Definition at line 286 of file gSyEM.f.

◆ gsyem_iso()

subroutine gsyem_iso ( integer  nfam)

Fill velocity array with eddies; ISO.

Parameters
[in]nfamfamily number
Todo:
This routine is way too slow due to work imbalance

Definition at line 1482 of file gSyEM.f.

References cfill(), cmult(), col2(), copy(), ftovec(), gop(), izero(), rzero(), subcol3(), vectof(), and vectof_add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_main()

subroutine gsyem_main

Main gSyEM interface.

Definition at line 299 of file gSyEM.f.

References gsyem_evolve(), gsyem_rst_write(), and mntr_tmr_add().

+ Here is the call graph for this function:

◆ gsyem_mesh_setup()

subroutine gsyem_mesh_setup

Generate mesh dependent information.

Note
This routine should be called in userchk after refinement is preformed.

Definition at line 596 of file gSyEM.f.

References gsyem_fam_setup(), izero(), mntr_abort(), and mntr_check_abort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_prof_read()

subroutine gsyem_prof_read ( integer, dimension(gsyem_nfam_max)  npoint,
integer, dimension(gsyem_nfam_max+1)  poff,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  rpos,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  umean,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  tke,
real, dimension(gsyem_npoint_max*gsyem_nfam_max)  dss 
)

Read profiles for all familes.

Parameters
[out]npointnumber of points in profile per family
[out]pofffamily profile array offset
[out]rposposition in a profile
[out]umeanprofile mean velocity
[out]tkeprofile turbulence kinetic energy
[out]dssprofile dissipation rate

Definition at line 1058 of file gSyEM.f.

References bcast(), io_file_freeid(), mntr_check_abort(), mntr_log(), mntr_log_local(), and rzero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_register()

subroutine gsyem_register

Register gSyEM module.

Note
This routine should be called in frame_usr_register

Definition at line 13 of file gSyEM.f.

References mntr_abort(), mntr_mod_is_name_reg(), mntr_mod_reg(), mntr_tmr_add(), mntr_tmr_is_name_reg(), mntr_tmr_reg(), mntr_warn(), rprm_rp_reg(), rprm_sec_reg(), and rprm_sec_set_act().

+ Here is the call graph for this function:

◆ gsyem_rst_read()

subroutine gsyem_rst_read

Read from checkpoint.

In current inplementation all data is duplicated over all nodes, so only master performs I/O

Definition at line 456 of file gSyEM.f.

References bcast(), blank(), byte_close, byte_open, byte_read, byte_reverse, copy(), mntr_check_abort(), and mntr_log().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gsyem_rst_write()

subroutine gsyem_rst_write

Create checkpoint.

In current inplementation all data is duplicated over all nodes, so only master performs I/O

Definition at line 335 of file gSyEM.f.

References blank(), byte_close, byte_open, byte_write, chkpt_get_fset(), copy(), mntr_check_abort(), mntr_get_step_delay(), mntr_log(), mntr_tmr_add(), and nekgsync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: