Appendices¶
Internal Input Parameters/Switches¶
The parameter list is handled internally and is populated based on options prescribed in the .par
file.
In general, it is not recommend for users to override these parameters as their usage may be subject to change.
However they can be set or referenced in the .usr
file via the param()
array.
This list was explicitly set with the legacy .rea
format.
Parameters¶
SETICS
).avg_all
(0: every timestep).h2
in sethlm
Logical switches¶
Like the parameter list, the logical switches are handled internally based on options set in the .par
file and it is not recommended for the user to override these settings.
IFFLOW solve for fluid (velocity, pressure)
IFHEAT solve for heat (temperature and/or scalars)
IFTRAN solve transient equations (otherwise, solve the steady Stokes flow)
IFADVC specify the fields with convection
IFTMSH specify the field(s) defined on T mesh (first field is the ALE mesh)
IFAXIS axisymmetric formulation
IFSTRS use stress formulation
IFLOMACH use low Mach number formulation
IFMGRID moving grid
IFMVBD moving boundary (for free surface flow)
IFCHAR use characteristics for convection operator
IFSYNC use upfront synchronization
IFUSERVP user-defined properties
IFXYO include coordinates in output files
IFPO include pressure field in output files
IFVO include velocity fields in output files
IFTO include temperature field in output files
IFPSCO include passive scalar fields in output files, ifpsco(ldimt1)
Commonly Used Variables¶
Solution Variables¶
Name | Size | Type | Short Description |
---|---|---|---|
vx |
(lx1,ly1,lz1,lelv) | real | x-velocity (\(u\)) |
vy |
(lx1,ly1,lz1,lelv) | real | y-velocity (\(v\)) |
vz |
(lx1,ly1,lz1,lelv) | real | z-velocity (\(w\)) |
pr |
(lx2,ly2,lz2,lelv) | real | pressure (\(P\)) |
t |
(lx1,ly1,lz1,lelt,ldimt) | real | temperature (\(T\)) and passives calars (\(\phi_i\)) |
vtrans |
(lx1,ly1,lz1,lelt,ldimt+1) | real | convective coefficient – \(\rho\), \((\rho c_p)\), \(\rho_i\) |
vdiff |
(lx1,ly1,lz1,lelt,ldimt+1) | real | diffusion coefficient – \(\mu\), \(\lambda\), \(\Gamma_i\) |
vxlag |
(lx1,ly1,lz1,lelv,2) | real | \(u\) at previous time steps |
vylag |
(lx1,ly1,lz1,lelv,2) | real | \(v\) at previous time steps |
vzlag |
(lx1,ly1,lz1,lelv,2) | real | \(w\) at previous time steps |
prlag |
(lx2,ly2,lz2,lelv,lorder2) | real | \(P\) at previous time steps |
tlag |
(lx1,ly1,lz1,lelv,lorder-1,ldimt+1) | real | \(T\) and \(\phi_i\) at previous time steps |
time |
– | real | physical time |
dt |
– | real | time step size |
dtlag |
real | previous time step sizes | |
istep |
– | integer | time step number |
Geometry Variables¶
Name | Size | Type | Description |
---|---|---|---|
xm1 |
(lx1,ly1,lz1,lelt) | real | x-coordinates for velocity mesh |
ym1 |
(lx1,ly1,lz1,lelt) | real | y-coordinates for velocity mesh |
zm1 |
(lx1,ly1,lz1,lelt) | real | z-coordinates for velocity mesh |
bm1 |
(lx1,ly1,lz1,lelt) | real | mass matrix for velocity mesh |
binvm1 |
(lx1,ly1,lz1,lelv) | real | inverse mass matrix for velocity mesh |
bintm1 |
(lx1,ly1,lz1,lelt) | real | inverse mass matrix for t mesh |
volvm1 |
– | real | total volume for velocity mesh |
voltm1 |
– | real | total volume for t mesh |
xm2 |
(lx2,ly2,lz2,lelv) | real | x-coordinates for pressure mesh |
ym2 |
(lx2,ly2,lz2,lelv) | real | y-coordinates for pressure mesh |
zm2 |
(lx2,ly2,lz2,lelv) | real | z-coordinates for pressure mesh |
unx |
(lx1,ly1,6,lelt) | real | x-component of face unit normal |
uny |
(lx1,ly1,6,lelt) | real | y-component of face unit normal |
unz |
(lx1,ly1,6,lelt) | real | z-component of face unit normal |
area |
(lx1,ly1,6,lelt) | real | face area (surface integral weights) |
Problem Setup Variables¶
Name | Size | Type | Description |
---|---|---|---|
nid |
– | integer | MPI rank id (lowest rank is always 0) |
nio |
– | integer | I/O node id |
nelv |
– | integer | number of elements in velocity mesh |
nelt |
– | integer | number of elements in t mesh |
ndim |
– | integer | dimensionality of problem (i.e. 2 or 3) |
nsteps |
– | integer | number of time steps to run |
iostep |
– | integer | time steps between data output |
cbc |
(6,lelt,ldimt+1) | character*3 | character boundary condition, contains the 3-character BC code for every face of every element for every field |
lglel |
(lelt) | integer | local to global element number map |
gllel |
(lelg) | integer | global to local element number map |
Averaging Variables¶
Arrays associated with the avg_all
subroutine
Variable Name | Size | Type | Short Description |
---|---|---|---|
uavg |
(ax1,ay1,az1,lelt) | real | time averaged x-velocity |
vavg |
(ax1,ay1,az1,lelt) | real | time averaged y-velocity |
wavg |
(ax1,ay1,az1,lelt) | real | time averaged z-velocity |
pavg |
(ax2,ay2,az2,lelt) | real | time averaged pressure |
tavg |
(ax1,ay1,az1,lelt,ldimt) | real | time averaged temperature and passive scalars |
urms |
(ax1,ay1,az1,lelt) | real | time averaged u^2 |
vrms |
(ax1,ay1,az1,lelt) | real | time averaged v^2 |
wrms |
(ax1,ay1,az1,lelt) | real | time averaged w^2 |
prms |
(ax1,ay1,az1,lelt) | real | time averaged pr^2 |
trms |
(ax1,ay1,az1,lelt,ldimt) | real | time averaged t^2 and ps^2 |
uvms |
(ax1,ay1,az1,lelt) | real | time averaged uv |
vwms |
(ax1,ay1,az1,lelt) | real | time averaged vw |
wums |
(ax1,ay1,az1,lelt) | real | time averaged wu |
iastep |
– | integer | time steps between averaged data output |
Commonly used Subroutines¶
subroutine cmult(x,C,n)
- multiplies
n
elements of arrayx
by a constant,C
. subroutine rescale_x(x,x0,x1)
- Rescales the array
x
to be in the range(x0,x1)
. This is usually called fromusrdat2
in the.usr
file. subroutine normvc(h1,semi,l2,linf,x1,x2,x3)
- Computes the error norms of a vector field variable
(x1,x2,x3)
defined on mesh 1, the velocity mesh. The error norms are normalized with respect to the volume, with the exception on the infinity norm,linf
. subroutine comp_vort3(vort,work1,work2,u,v,w)
- Computes the vorticity (
vort
) of the velocity field,(u,v,w)
subroutine lambda2(l2)
- Generates the Lambda-2 vortex criterion proposed by Jeong and Hussain (1995)
subroutine planar_average_z(ua,u,w1,w2)
- Computes the r-s planar average of the quantity
u
. subroutine torque_calc(scale,x0,ifdout,iftout)
- Computes torque about the point
x0
. Here scale is a user supplied multiplier so that the results may be scaled to any convenient non-dimensionalization. Both the drag and the torque can be printed to the screen by switching the appropriateifdout(drag)
oriftout(torque)
logical. subroutine set_obj
- Defines objects for surface integrals by changing the value of
hcode
for future calculations. Typically called once withinuserchk
(foristep = 0
) and used for calculating torque. (see above)
subroutine avg1(avg,f, alpha,beta,n,name,ifverbose)
subroutine avg2(avg,f, alpha,beta,n,name,ifverbose)
subroutine avg3(avg,f,g, alpha,beta,n,name,ifverbose)
- These three subroutines calculate the (weighted) average of
f
. Depending on the value of the logical,ifverbose
, the results will be printed to standard output along with name. Inavg2
, thef
component is squared. Inavg3
, vectorg
also contributes to the average calculation. subroutine outpost(x,vy,vz,pr,tz,' ')
- Dumps the current data of
x
,vy
,vz
,pr
,tz
to an.fld
or.f0????
file for post processing. subroutine platform_timer(ivrb)
- Runs the battery of timing tests for matrix-matrix products,contention-free processor-to-processor ping-pong tests, and
mpi_all_reduce
times. Allows one to check the performance of the communication routines used on specific platforms. subroutine quickmv
- Moves the mesh to allow user affine motion.
subroutine runtimeavg(ay,y,j,istep1,ipostep,s5)
- Computes, stores, and (for
ipostep!0
) prints runtime averages ofj
-quantityy
(along w/y
itself unlessipostep<0
) withj
+ ‘rtavg_
’ + (unique)s5
everyipostep
foristep>=istep1
.s5
is a string to append tortavg_
for storage file naming. subroutine lagrng(uo,y,yvec,uvec,work,n,m)
- Compute Lagrangian interpolant for
uo
subroutine opcopy(a1,a2,a3,b1,b2,b3)
- Copies
b1
toa1
,b2
toa2
, andb3
toa3
, whenndim = 3
, subroutine cadd(a,const,n)
- Adds
const
to vectora
of sizen
. subroutine col2(a,b,n)
- For
n
entries, calculatesa=a*b
. subroutine col3(a,b,c,n)
- For
n
entries, calculatesa=b*c
.
function glmax(a,n)
function glamax(a,n)
function iglmax(a,n)
- Calculates the (absolute) max of a vector that is size
n
. Prefixi
implies integer type. function i8glmax(a,n)
- Calculates the max of an integer*8 vector that is size
n
.
function glmin(a,n)
function glamin(a,n)
function iglmin(a,n)
- Calculates the (absolute) min of a vector that is size
n
. Prefixi
implies integer type.
function glsc2(a,b,n)
function glsc3(a,b,mult,n)
function glsc23(a,b,c,n)
function glsum(a,n)
Computes the global sum of the real arraysa
, with number of local entriesn
function iglsum(a,n)
Computes the global sum of the integer arraysa
, with number of local entriesn
function i8glsum(a,n)
Computes the global sum of the integer*8 arraysa
, with number of local entriesn
subroutine surface_int(dphi,dS,phi,ielem,iside)
- Computes the surface integral of scalar array
phi
over faceiside
of elementielem
. The resulting integral is storted indphi
and the area indS
.
Mesh Modification¶
For complex shapes, it is often convenient to modify the mesh
direction in the simulation code, Nek5000. This can be done
through the usrdat2
routine provided in the .usr
file.
The routine usrdat2
is called by Nek5000 immediately after
the geometry, as specified by the .rea
file, is established.
Thus, one can use the existing geometry to map to a new geometry
of interest.
For example, suppose you want the above pipe geometry to have a sinusoidal wall. Let \({\bf x} := (x,y)\) denote the old geometry, and \({\bf x}' := (x',y')\) denote the new geometry. For a domain with \(y\in [0,0.5]\), the following function will map the straight pipe geometry to a wavy wall with amplitude \(A\), wavelength \(\lambda\):
Note that, as \(y \longrightarrow 0\), the perturbation, \(yA \sin( 2 \pi x / \lambda )\), goes to zero. So, near the axis, the mesh recovers its original form.
In Nek5000, you would specify this through usrdat2
as follows
subroutine usrdat2
include 'SIZE'
include 'TOTAL'
real lambda
ntot = nx1*ny1*nz1*nelt
lambda = 3.
A = 0.1
do i=1,ntot
argx = 2*pi*xm1(i,1,1,1)/lambda
ym1(i,1,1,1) = ym1(i,1,1,1) + ym1(i,1,1,1)*A*sin(argx)
end do
param(59) = 1. ! Force nek5 to recognize element deformation.
return
end
Note that, since Nek5000 is modifying the mesh, postx
will not
recognize the current mesh unless you tell it to, because postx
looks to the .rea
file for the mesh geometry. The only way for
Nek5000 to communicate the new mesh to postx
is via the .fld
file, so you must request that the geometry be dumped to the
.fld
file.
The result of above changes is shown in Fig. 32.
Cylindrical/Cartesian-transition Annuli¶
More sophisticated
transition treatments may be generated using the GLOBAL REFINE options in
preNek or through an upgrade of genb7
, as demand warrants.
Example 2D and 3D input files are provided in the nek5000/doc
files
box7.2d
and box7.3d
.
Fig. 33 shows a 2D example generated using
the box7.2d
input file, which reads:
x2d.rea
2 spatial dimension
1 number of fields
#
# comments
#
#
#========================================================
#
Y cYlinder
3 -24 1 nelr,nel_theta,nelz
.5 .3 x0,y0 - center of cylinder
ccbb descriptors: c-cyl, o-oct, b-box (1 character + space)
.5 .55 .7 .8 r0 r1 ... r_nelr
0 1 1 theta0/2pi theta1/2pi ratio
v ,W ,E ,E , bc's (3 characters + comma)
An example of a mesh is shown in Fig. 33. The mesh has been quad-refined once with oct-refine option of preNek. The 3D counterpart to this mesh could joined to a hemisphere/Cartesian transition built with the spherical mesh option in preNek.