KTH framework for Nek5000 toolboxes; testing version  0.0.1
Time history for set of points

Set of rutines to collect a time history for set of points. More...

+ Collaboration diagram for Time history for set of points:

Files

file  tsrs.f
 Routines for time series module.
 
file  tsrs_IO.f
 I/O routines for time series module.
 

Functions

subroutine tsrs_register ()
 Register point time seriesmodule for statistics tool. More...
 
subroutine tsrs_init ()
 Initilise time series module. More...
 
subroutine tsrs_end ()
 Finalise time series module. More...
 
logical function tsrs_is_initialised ()
 Check if module was initialised. More...
 
subroutine tsrs_main (ifsave)
 Main interface of time series module. More...
 
subroutine tsrs_get ()
 Perform interpolation and data buffering. More...
 
subroutine tsrs_read_redistribute ()
 Read and redistribute points among mpi ranks. More...
 
subroutine tsrs_interpolate (vlct, vort, pres)
 Interpolate fields on a set of points. More...
 
subroutine tsrs_buffer_save (ifapp, ifsave)
 Buffer and save interpolated fields. More...
 
subroutine tsrs_mfo_outfld (bff, lbff)
 Write a point history file. More...
 
subroutine tsrs_mfo_write_hdr (wdsizet, wdsizef)
 Write file header. More...
 
subroutine tsrs_mfo_outs (ul, lpts, ierr)
 Write single field for a local set of points. More...
 
subroutine tsrs_mfi_points ()
 Read interpolation points positions, number and redistribute them. More...
 

Detailed Description

Set of rutines to collect a time history for set of points.

This set of routines performs spectral interpolation of the velocity, pressure and vorticity fileds on a set of points and writes them in a binary file.

Todo:
This have to be completed
Todo:
Rewrite pts_redistribute.f
Module interface:
Global interface list:
Interface provided:
  1. tsrs_register
  2. tsrs_init
  3. tsrs_end
  4. tsrs_is_initialised
  5. tsrs_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. comm_ivglrsum and comm_ibcastn from Comunication routines. module
  4. user_stat_trnsv; user defined
Note
user_stat_trnsv is a user provided interface for both tsrs and 2D and 3D statistics module modules.
Module interface usage:
!======================================================================
subroutine userchk
include 'TSTEP'
logical ifsave
if (istep.eq.0) then
! start framework
endif
! monitor simulation
! collect time series
ifsave = .false. ! no I/O correlation with other packages
call tsrs_main(ifsave)
! finalise framework
if (istep.eq.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
call tsrs_init
return
end subroutine
!======================================================================
subroutine frame_usr_end
implicit none
include 'SIZE'
include 'FRAMELP'
!-----------------------------------------------------------------------
! finlise modules
call tsrs_end
return
end subroutine
!======================================================================
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 tsrs_register()
Register point time seriesmodule for statistics tool.
Definition: tsrs.f:13
subroutine tsrs_init()
Initilise time series module.
Definition: tsrs.f:99
subroutine tsrs_main(ifsave)
Main interface of time series module.
Definition: tsrs.f:231
subroutine tsrs_end()
Finalise time series module.
Definition: tsrs.f:194
!=======================================================================
subroutine user_stat_trnsv(lvel,dudx,dvdx,dwdx,vort,pres)
implicit none
include 'SIZE'
include 'SOLN'
include 'INPUT' ! if3d
include 'GEOM'
! argument list
real lvel(LX1,LY1,LZ1,LELT,3) ! velocity array
real dudx(LX1,LY1,LZ1,LELT,3) ! velocity derivatives; U
real dvdx(LX1,LY1,LZ1,LELT,3) ! V
real dwdx(LX1,LY1,LZ1,LELT,3) ! W
real vort(LX1,LY1,LZ1,LELT,3) ! vorticity
real pres(LX1,LY1,LZ1,LELT) ! pressure
! local variables
integer itmp ! dummy variable
integer il, jl ! loop index
integer ifll ! field number for object definition
real vrtmp(lx1*lz1) ! work array for face
real vrtmp2(2) ! work array
! functions
real vlsum
!-----------------------------------------------------------------------
! Velocity transformation; simple copy
itmp = nx1*ny1*nz1*nelv
call copy(lvel(1,1,1,1,1),vx,itmp)
call copy(lvel(1,1,1,1,2),vy,itmp)
call copy(lvel(1,1,1,1,3),vz,itmp)
! Derivative transformation
! No transformation
call gradm1(dudx(1,1,1,1,1),dudx(1,1,1,1,2),dudx(1,1,1,1,3),
$ lvel(1,1,1,1,1))
call gradm1(dvdx(1,1,1,1,1),dvdx(1,1,1,1,2),dvdx(1,1,1,1,3),
$ lvel(1,1,1,1,2))
call gradm1(dwdx(1,1,1,1,1),dwdx(1,1,1,1,2),dwdx(1,1,1,1,3),
$ lvel(1,1,1,1,3))
! get vorticity
if (if3d) then
! curlx
call sub3(vort(1,1,1,1,1),dwdx(1,1,1,1,2),
$ dvdx(1,1,1,1,3),itmp)
! curly
call sub3(vort(1,1,1,1,2),dudx(1,1,1,1,3),
$ dwdx(1,1,1,1,1),itmp)
endif
! curlz
call sub3(vort(1,1,1,1,3),dvdx(1,1,1,1,1),dudx(1,1,1,1,2),itmp)
! normalise pressure
! in this example I integrate pressure over all faces marked "W"
ifll = 1 ! I'm interested in velocity bc
call rzero(vrtmp2,2) ! zero work array
obj_srfl = 0.0 ! initialise object surface
pmeanl = 0.0 ! initialise pressure mean
itmp = lx1*lz1
do il=1,nelv ! element loop
do jl=1,2*ldim ! face loop
if (cbc(jl,il,ifll).eq.'W ') then
vrtmp2(1) = vrtmp2(1) + vlsum(area(1,1,jl,il),itmp)
call ftovec(vrtmp,pres,il,jl,lx1,ly1,lz1)
call col2(vrtmp,area(1,1,jl,il),itmp)
vrtmp2(2) = vrtmp2(2) + vlsum(vrtmp,itmp)
enddo
enddo
! global communication
call gop(vrtmp2,vrtmp,'+ ',2)
! missing error check vrtmp2(1) == 0
vrtmp2(2) = -vrtmp2(2)/vrtmp2(1)
! remove mean pressure
itmp = nx1*ny1*nz1*nelv
call cadd(pres,vrtmp2(2),itmp)
return
end subroutine
!======================================================================
subroutine gop(x, w, op, n)
Definition: comm_mpi.f:201
subroutine ftovec(a, b, ie, iface, nx, ny, nz)
Definition: dssum.f:417
subroutine cadd(a, const, n)
Definition: math.f:326
subroutine col2(a, b, n)
Definition: math.f:564
subroutine copy(a, b, n)
Definition: math.f:260
subroutine sub3(a, b, c, n)
Definition: math.f:175
subroutine rzero(a, n)
Definition: math.f:208
subroutine gradm1(ux, uy, uz, u)
Definition: navier5.f:463
Module parameters:
Global parameter list:
Parameters provided by tsrs module (include file - TSRSD):
Varaible Type Runtime parameter Description
tsrs_tstart real _tsrs:tStart sampling starting time
tsrs_tint real _tsrs:tInt sampling time interval
tsrs_skstep integer _tsrs:SkStep skipped initial steps
Module parameter usage:
[_TSRS] # Runtime paramere section for time series module
TSTART = 1.0 # Sampling starting time
TINT = 0.05 # Samplind time interval
SKSTEP = 2 # Skipped initial steps

Function Documentation

◆ tsrs_buffer_save()

subroutine tsrs_buffer_save ( logical  ifapp,
logical  ifsave 
)

Buffer and save interpolated fields.

Parameters
[in]ifappdo we append buffer
[in]ifsavesave and clean the buffer in current call
Remarks
This routine uses global scratch space SCRCH

Definition at line 622 of file tsrs.f.

References copy(), mntr_tmr_add(), rzero(), and tsrs_mfo_outfld().

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

◆ tsrs_end()

subroutine tsrs_end

Finalise time series module.

Note
This routine should be called in frame_usr_end

Definition at line 193 of file tsrs.f.

References tsrs_buffer_save().

+ Here is the call graph for this function:

◆ tsrs_get()

subroutine tsrs_get

Perform interpolation and data buffering.

This routine performs interpolation on set of points, buffering and file writing.

Remarks
This routine uses global scratch space SCRMG, SCRUZ, SCRNS, SCRSF

Definition at line 310 of file tsrs.f.

References mappr(), mntr_tmr_add(), and tsrs_interpolate().

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

◆ tsrs_init()

subroutine tsrs_init

Initilise time series module.

Note
This routine should be called in frame_usr_init

Definition at line 98 of file tsrs.f.

References mntr_log(), mntr_tmr_add(), mntr_warn(), rprm_rp_get(), rzero(), and tsrs_read_redistribute().

+ Here is the call graph for this function:

◆ tsrs_interpolate()

subroutine tsrs_interpolate ( real, dimension(lx1*ly1*lz1*lelt,ldim)  vlct,
real, dimension(lx1*ly1*lz1*lelt,ldim)  vort,
real, dimension(lx1*ly1*lz1*lelt pres 
)

Interpolate fields on a set of points.

Parameters
[in]vlctvelocity field
[in]vortvorticity filed
[in]prespressure filed

Definition at line 577 of file tsrs.f.

+ Here is the caller graph for this function:

◆ tsrs_is_initialised()

logical function tsrs_is_initialised

Check if module was initialised.

Returns
tsrs_is_initialised

Definition at line 213 of file tsrs.f.

◆ tsrs_main()

subroutine tsrs_main ( logical  ifsave)

Main interface of time series module.

This routine calls interpolation routine at proper step and allows a user to write down data in a current step if correlation with some other package is required.

Parameters
[in]ifsaveforce I/O operation at a given step

Definition at line 230 of file tsrs.f.

References add2sxy(), copy(), mntr_log(), opcopy(), tsrs_buffer_save(), and tsrs_get().

+ Here is the call graph for this function:

◆ tsrs_mfi_points()

subroutine tsrs_mfi_points

Read interpolation points positions, number and redistribute them.

Definition at line 377 of file tsrs_IO.f.

References bcast(), blank(), byte_close, byte_open, byte_read, byte_reverse, byte_reverse8, copy(), copy4r(), crecv2(), csend(), mntr_abort(), mntr_check_abort(), and mntr_logi().

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

◆ tsrs_mfo_outfld()

subroutine tsrs_mfo_outfld ( real, dimension(lbff)  bff,
integer  lbff 
)

Write a point history file.

This routine is based on mfo_outfld adopted for point data

Parameters
[in]bffbuffer to write
[in]lbffbuffer size

Definition at line 14 of file tsrs_IO.f.

References byte_close, byte_close_mpi(), byte_set_view(), io_init(), mfo_open_files(), mntr_check_abort(), tsrs_mfo_outs(), and tsrs_mfo_write_hdr().

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

◆ tsrs_mfo_outs()

subroutine tsrs_mfo_outs ( real, dimension(lpts)  ul,
integer  lpts,
integer  ierr 
)

Write single field for a local set of points.

This routine is just a modification of mfo_outs. The only reason to have it is to control dummy array sizes, as mfo_outs could fail in this case. Otherwise it would be completely redundant.

Parameters
[in]ulinput array
[in]lptsarray length
[out]ierrerror flagg
Remarks
This routine uses global scratch space SCRVH

Definition at line 284 of file tsrs_IO.f.

References byte_write, byte_write_mpi(), copy(), copyx4(), crecv(), csend(), and nekgsync().

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

◆ tsrs_mfo_write_hdr()

subroutine tsrs_mfo_write_hdr ( integer  wdsizet,
integer  wdsizef 
)

Write file header.

This routine is based on mfo_write_hdr adopted for point data

Parameters
[in]wdsizetwriting precision for position and time
[in]wdsizefwriting precision for fileds

Definition at line 151 of file tsrs_IO.f.

References blank(), byte_set_view(), byte_write, byte_write_mpi(), crecv(), csend(), icopy(), mntr_check_abort(), and nekgsync().

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

◆ tsrs_read_redistribute()

subroutine tsrs_read_redistribute

Read and redistribute points among mpi ranks.

Definition at line 356 of file tsrs.f.

References copy(), icopy(), io_file_freeid(), mntr_abort(), nekgsync(), pts_rdst(), and tsrs_mfi_points().

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

◆ tsrs_register()

subroutine tsrs_register

Register point time seriesmodule for statistics tool.

Note
This routine should be called in frame_usr_register

Definition at line 12 of file tsrs.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: