39 REAL,
PARAMETER :: tsim = 2.0e+0
40 REAL,
PARAMETER :: re = 1.0e+0
41 REAL,
PARAMETER :: ma = 1.0e-2
42 REAL,
PARAMETER :: rho0 = 1.0e-0
43 REAL,
PARAMETER :: eta = 1.0e-0
44 REAL,
PARAMETER :: gam = 1.4
46 INTEGER,
PARAMETER :: mgeo = cylindrical
48 INTEGER,
PARAMETER :: xres = 30
49 INTEGER,
PARAMETER :: yres = 1
50 INTEGER,
PARAMETER :: zres = 5
51 REAL,
PARAMETER :: ltube = 10.0
52 REAL,
PARAMETER :: rtube = 1.0
55 INTEGER,
PARAMETER :: onum = 10
56 CHARACTER(LEN=256),
PARAMETER &
58 CHARACTER(LEN=256),
PARAMETER &
59 :: ofname =
'poiseuille'
65 CLASS(
fosite),
ALLOCATABLE :: sim
81 CALL initdata(sim%Mesh, sim%Physics, sim%Timedisc)
89tap_check(ok,
"stoptime reached")
99 TYPE(dict_typ),
POINTER :: config
103 TYPE(dict_typ),
POINTER :: mesh, physics, boundary, datafile, sources, &
104 vis, timedisc, fluxes
105 REAL :: x1,x2,y1,y2,z1,z2
111 umax = eta/rho0 * re/rtube
113 tvis = rho0/eta * rtube**2
115 pin = rho0/gam * (umax/ma)**2
117 pout = pin * (1.0 - 4*gam * (ma**2/re) * (ltube/rtube) )
119 CALL sim%Error(
"poiseuille::MakeConfig",
"negative outlet pressure")
153 mesh => dict(
"meshtype" / midpoint, &
167 boundary => dict(
"western" / bc(west), &
168 "eastern" / bc(east), &
169 "southern" / bc(south), &
170 "northern" / bc(north), &
171 "bottomer" / bc(bottom), &
175 physics => dict(
"problem" / euler, &
179 fluxes => dict(
"order" / linear, &
181 "variables" / primitive, &
182 "limiter" / vanleer, &
186 vis => dict(
"stype" / viscosity, &
187 "vismodel" / molecular, &
189 "bulkconst" / (-2./3.*eta), &
192 sources => dict(
"vis" / vis)
195 timedisc => dict(
"method" / ssprk, &
198 "stoptime" / (tsim*tvis), &
199 "dtlimit" / (1.0e-7*tvis), &
200 "maxiter" / 100000000)
204 "fileformat" / vtk, &
205 "filename" / (trim(odir) // trim(ofname)), &
208 config => dict(
"mesh" / mesh, &
209 "physics" / physics, &
210 "boundary" / boundary, &
212 "sources" / sources, &
213 "timedisc" / timedisc, &
214 "datafile" / datafile)
220 CLASS(physics_base) :: Physics
221 CLASS(mesh_base) :: Mesh
222 CLASS(timedisc_base):: Timedisc
224 TYPE(marray_base) :: dv
225 INTEGER,
ALLOCATABLE :: seed(:)
227 CHARACTER(LEN=32) :: info_str
229 INTENT(IN) :: mesh,physics
230 INTENT(INOUT) :: timedisc
234 CALL random_seed(size=n)
237 CALL system_clock(count=clock)
238 seed = clock + (timedisc%GetRank()+1) * (/(i-1, i=1,n)/)
239 CALL random_number(dv%data1d)
243 SELECT TYPE(pvar => timedisc%pvar)
244 CLASS IS(statevector_euler)
245 pvar%density%data1d(:) = rho0
246 pvar%pressure%data3d(:,:,:) = pin + (pout-pin)/ltube * mesh%bccart(:,:,:,3)
247 pvar%velocity%data1d(:) = (dv%data1d(:)-0.5) * 0.01
249 CALL timedisc%Error(
"poiseuille::InitData",
"physics not supported")
254 SELECT TYPE(bbottom => timedisc%Boundary%boundary(bottom)%p)
255 CLASS IS (boundary_fixed)
256 bbottom%data(:,:,:,:) = 0.0
257 bbottom%data(:,:,:,physics%DENSITY) = rho0
258 bbottom%data(:,:,:,physics%PRESSURE) = pin
261 bbottom%fixed(:,:,:) = .true.
262 bbottom%fixed(:,:,physics%ZVELOCITY) = .false.
265 SELECT TYPE(btop => timedisc%Boundary%boundary(top)%p)
266 CLASS IS (boundary_fixed)
267 btop%data(:,:,:,:) = 0.0
268 btop%data(:,:,:,physics%DENSITY) = rho0
269 btop%data(:,:,:,physics%PRESSURE) = pout
272 btop%fixed(:,:,:) = .false.
273 btop%fixed(:,:,physics%PRESSURE) = .true.
276 SELECT TYPE(b => timedisc%Boundary%boundary(east)%p)
277 CLASS IS(boundary_noslip)
278 b%data(:,:,:,physics%ZVELOCITY) = 0.0
279 CLASS IS(boundary_custom)
280 CALL b%SetCustomBoundaries(mesh,physics, &
281 (/custom_reflect,custom_reflneg,custom_fixed,custom_fixed,custom_reflect/))
282 b%data(:,:,:,:) = 0.0
283 b%data(:,:,:,physics%DENSITY) = rho0
284 b%data(:,:,:,physics%PRESSURE) = pout
287 CALL physics%Convert2Conservative(timedisc%pvar,timedisc%cvar)
288 CALL mesh%Info(
" DATA-----> initial condition: " // &
289 "tube with pressure gradient")
290 WRITE (info_str,
'(ES10.2)') re
291 CALL physics%Info(
" Reynolds number: " // trim(info_str))
292 WRITE (info_str,
'(ES10.2)') ma
293 CALL physics%Info(
" Mach number: " // trim(info_str))
294 WRITE (info_str,
'(ES10.2)') umax
295 CALL physics%Info(
" max. laminar velocity: " // trim(info_str) //
" m/s")
296 WRITE (info_str,
'(ES10.2)') pin
297 CALL physics%Info(
" inlet pressure: " // trim(info_str) //
" Pa")
298 WRITE (info_str,
'(ES10.2)') 1.-pout/pin
299 CALL physics%Info(
" rel. pressure gradient: " // trim(info_str))
300 WRITE (info_str,
'(ES10.2)') tvis
301 CALL physics%Info(
" viscous time scale: " // trim(info_str) //
" s")
subroutine initdata(Mesh, Physics, Fluxes, Timedisc)
subroutine makeconfig(Sim, config)
program poiseuille
Program and data initialization for testing the law of Hagen-Poiseuille.