var.f90 9.46 KiB
!> @author Holger Grosshans
!> @brief definition of public variables, global denotes the complete domain, local only one processor
!>
!> how to add a new public variable:
!> fluid: var,initVariables(allocate+init)
!> particles: var,allocateParticleArrays,initVariables,particlesNextProc(?),partN2M(?)
module var
implicit none
! hardcoded parameters which the user cannot change
character(70) :: version='pafiX v1.1.0 (Copyright 2015-21 by H. Grosshans)'
integer, parameter :: &
precision=8, & !< number precision
pr=selected_real_kind(precision), &
elforceScheme=3, & !< 1=Gauss, 2=Coulomb, 3=Hybrid (Grosshans&Papalexandris, 2017)
gc= 2 !< number of ghost cells, depends on stencils, but >= 2
real(kind=pr), parameter :: &
eps_el= 8.85e-12_pr, & !< permittivity vacuum/air (F/m)
pi= 4._pr*atan(1._pr), &
urfu= 0.25_pr, & !< under-relaxation factor variable u
urfv= urfu, &
urfw= urfv, &
urfp= 4.0_pr, &
C_s= 0.17_pr !< Smagorinsky constant
real(kind=pr), parameter :: &
Ew=1.e11_pr, & !< duct Young's modulus (kg/s**2/m)
Ep=1.e8_pr, & !< particle Young's modulus (kg/s**2/m)
nyp=0.4_pr , & !< particle Poisson ratio
nyw=0.28_pr, & !< duct Poisson ratio
Qaccfactor= 0.1_pr !< artificially accelerate the charging rate
! input
real(kind=pr) :: &
cfl, & !< CFL number (-)
ubulk, ubulk0, & !< streamwise bulk fluid velocity, initial/inlet (m/s)
prad, & !< particle radius (m)
qp0,qpmax, & !< initial and maximum particle charge (C,C)
dimx,dimy,dimz, & !< dimension of local domain in x-direction (m)
rhof, & !< fluid density (kg/m**3)
nuf, & !< fluid kinematic viscosity (m**2/s)
pnd, & !< particle number density (-/m**3)
rhop, & !< particle material density (kg/m**3)
restRatio, & !< particle material restitution ratio
g(3), & !< gravity vector (m/s**2,m/s**2,m/s**2)
tol, & !< factor by which L2 shall decrease
dimxtot, & !< dimension of domain (m)
delta, & !< duct half width
tau_w, & !< wall shear stress
u_tau, & !< friction velocity
Re, & !< bulk Reynolds number
Re_tau, & !< friction Reynolds number
delta_v, & !< viscous length scale (m)
t_tau, & !< viscous time scale (s)
ftt !< flow through time (s)
integer :: &
ntstart, & !< start time step
ntime, & !< end time step
dimi,dimj,diml, & !< local number of cells in x-direction
int_results, & !< interval write out results
int_restart, & !< interval write out restart files
itmax, & !< max number of iterations for 1 equation
dimitot, & !< global number of cells in x-direction
ntseed !< time step particle seeding
character(11) :: &
turbModel !< turbulence model
! run
real(kind=pr) :: &
dpdx, & !< streamwise pressure gradient (N/m**3)
dtNext, & !< time-step size from (nt) to (nt+1) (s)
dt, & !< time-step size from (nt-1) to (nt) (s)
dt01, & !< time step size from (nt-2) to (nt-1) (s)
dt02, & !< time step size from (nt-3) to (nt-2) (s)
tau01,tau02, &
t, & !< physical time (s)
tstart !< start time step
integer :: nt, & !< time step
ntend !< last time step of computation
! grid
character(1) :: &
bcx,bcy,bcz, & !< type of boundary condition [(w)all/(p)eriodic]
gridx,gridy,gridz !< grid [(u)niform/(s)tretch]
real(kind=pr), allocatable, dimension(:,:,:) :: &
vol,volu,volv,volw !< volume per cell (m**3), centered and staggered variables
real(kind=pr), allocatable, dimension(:) :: &
xc,yc,zc, & !< center point of a cell (m)
xf,yf,zf !< face of a cell in pos. direction from xc (m)
real(kind=pr) :: &
xmin,ymin,zmin, & !< lower local boundary in global coordinates (m)
xmax,ymax,zmax, & !< upper local boundary in global coordinates (m)
deltax, & !< shift between processors (m)
volTot !< total domain volume (m**3)
integer, allocatable, dimension(:,:,:) :: &
celltype !< celltype
integer, parameter :: active=1, passive=2, wall=3
integer :: &
gp, & !< local number of grid cells
dimgp, & !< local number of cells containing fluid
dimgptot, & !< global number of cells containing fluid
ii,jj,ll, & !< max index local grid
imin,jmin,lmin, & !< local min index of cell containing fluid
imax,jmax,lmax !< local max index of cell containing fluid
! pre-computed coefficients
real(kind=pr), allocatable, dimension(:,:,:) :: &
Ca,Cb1,Cb2,Cc1,Cc2,Cd1,Cd2 !< coefficients for SIMPLE algorithm
! fluid
real(kind=pr) :: muf !< fluid dynamic viscosity (kg/s/m)
real(kind=pr), allocatable, dimension(:,:,:) :: &
u,v,w, & !< fluid velocity (m/s)
p, & !< fluid pressure (N/m**2)
u01,v01,w01, & !< fluid velocity previous time-step
u02,v02,w02, & !< fluid velocity previous time-step
Fsx,Fsy,Fsz, & !< source term particles -> fluid (m/s**2)
nuf_ru,nuf_rv,nuf_rw, & !< turbulent viscosity (m**2/s)
filteru,filterv,filterw !< LES filter width (m)
! particles
real(kind=pr) :: &
tau_p_min, & !< min particle response time in a time-step
rtau_el_max, & !< max reciprocal Coulomb force time-scale in a time-step
dup_max !< max particle velocity change in a time-step
integer :: &
np, & !< local number of particles
npTot, & !< total number of particles
npp, & !< local number of particles before some operation
maxnp, & !< maximum possible local number of particles
npstart, & !< number of particles seeded since tstart
nseedLoc !< local counter for seeded particles
real(kind=pr), allocatable, dimension(:) :: &
up,vp,wp, & !< particle velocity at t (m/s)
upNext,vpNext,wpNext, & !< particle velocity at t+dt (m/s)
uf,vf,wf, & !< fluid velocity around a particle (m/s)
dufdy,dufdz, & !< fluid velocity gradient around a particle (m/s)
xp,yp,zp, & !< particle position at t (m)
xpNext,ypNext,zpNext, & !< particle position at t+dt (m)
radp, & !< particle radius (m)
q_el, & !< particle charge at t (C)
q_elNext, & !< particle charge at t+dt (C)
fx_el,fy_el,fz_el, & !< electrostatic force on particle (m/s**2)
fx_d,fy_d,fz_d, & !< drag force on particle (m/s**2)
fx_l,fy_l,fz_l, & !< lift force on particle (m/s**2)
partn !< number of particles represented by parcel
integer, allocatable, dimension(:) :: &
ip,jp,lp, & !< Eulerian indice of particle position
wcollnum, & !< number of particle-wall collisions
ppcollnum, & !< number of particle-particle collisions
nGlob !< global particle id
integer, allocatable, dimension(:,:,:) :: &
npic !< number of particles in a Eulerian cell
integer, allocatable, dimension(:,:,:,:) :: &
nic !< indices of particles in a Eulerian cell
! parallel
real(kind=pr) :: timebeg,timenow,timeend, &
timecom(10) !< 1-8: sync operations, 9: physical time, 10: restart
integer :: &
mpi_pr, &
myid, & !< id of current processor
nrprocs, & !< total number of processors
mpierr, &
next,prev !< id of next and previous processor
integer, allocatable, dimension(:) :: &
mpistatus
! electrostatics
real(kind=pr), allocatable, dimension(:,:,:) :: &
rho_el, & !< electric charge density (C/m**3)
phi_el, & !< electric potential (V)
Ex_el,Ey_el,Ez_el !< electric field strength (V/m)
end module var