60 INTEGER,
PARAMETER :: testnum = 8
61 CHARACTER(LEN=32),
PARAMETER :: teststr(testnum) = (/ &
68 "Isothermal shock tube ", &
69 "Isothermal Noh problem " /)
72 CHARACTER(LEN=3),
PARAMETER :: testdir =
"all" 73 INTEGER,
PARAMETER :: res = 400
75 INTEGER,
PARAMETER :: onum = 1
76 CHARACTER(LEN=8),
PARAMETER :: ofname(testnum) = (/ &
77 "sod ",
"toro2 ",
"toro3 ",
"toro4 ",
"toro5 ",
"noh ", &
79 CHARACTER(LEN=256),
PARAMETER &
86 CLASS(
fosite),
ALLOCATABLE :: sim
87 CLASS(marray_compound),
POINTER :: pvar_exact
88 CHARACTER(LEN=64) :: verbose_tap_output
89 INTEGER :: ic,sd,dir_min,dir_max
90 REAL,
DIMENSION(:,:),
ALLOCATABLE :: sigma
91 REAL,
PARAMETER :: sigma_tol(testnum) &
92 = (/ 1.8e-2, 1.4e-2, 7.9e+0, 3.5e+1, 4.3e+0, 7.9e-2, 1.0e+0, 1.0e+0 /)
96 SELECT CASE (trim(testdir))
112 tap_plan(testnum*(dir_max-dir_min+1))
114 ALLOCATE(sigma(testnum,dir_min:dir_max))
118 DO sd=dir_min,dir_max
122 CALL sim%InitFosite()
132 CALL sim%Physics%new_statevector(pvar_exact,primitive)
135 CALL run(sim,pvar_exact,ic,sd)
137 IF (sim%aborted)
THEN 138 sigma(ic,sd) = huge(1.0)
140 IF (
ASSOCIATED(sim%Timedisc%solution))
THEN 141 sigma(ic,sd) = sqrt(sum((sim%Timedisc%pvar%data1d(:) &
142 -sim%Timedisc%solution%data1d(:))**2)/
SIZE(sim%Timedisc%pvar%data1d))
148 CALL pvar_exact%Destroy()
159 DO sd=dir_min,dir_max
160 WRITE (verbose_tap_output,
'(A,ES8.2)') trim(teststr(ic)) //
" / " // achar(119+sd) &
161 //
" sigma = ", sigma(ic,sd)
163 tap_check_small(sigma(ic,sd),sigma_tol(ic),trim(verbose_tap_output))
175 TYPE(Dict_TYP),
POINTER :: config
179 TYPE(Dict_TYP),
POINTER :: mesh, physics, boundary, datafile, &
181 INTEGER :: xres,yres,zres
182 REAL :: xmax,ymax,zmax
211 CALL sim%Error(
"riemann1d::InitData",
"direction must be one of 1,2,3")
215 mesh => dict(
"meshtype" / midpoint, &
216 "geometry" / cartesian, &
254 CALL sim%Mesh%Error(
"riemann1d::InitData",
"Test problem number should be 1,2,3,4,5,6,7 or 8")
259 IF (csiso.NE.0.0)
THEN 260 physics => dict(
"problem" / euler_isotherm, &
263 physics => dict(
"problem" / euler, &
271 "variables" / conservative, &
272 "limiter" / monocent, &
277 "method" / modified_euler, &
281 "dtlimit" / 1.0e-10, &
287 "output/solution" / 0, &
292 IF (csiso.EQ.0.0)
CALL setattr(timedisc,
"output/solution",1)
296 "western" / no_gradients, &
297 "eastern" / no_gradients, &
298 "southern" / no_gradients, &
299 "northern" / no_gradients, &
300 "bottomer" / no_gradients, &
301 "topper" / no_gradients)
305 "fileformat" / vtk, &
306 "filename" / (trim(odir) // trim(ofname(ic)) //
"-" // achar(119+dir)), &
310 config => dict(
"mesh" / mesh, &
311 "physics" / physics, &
312 "boundary" / boundary, &
314 "timedisc" / timedisc, &
315 "datafile" / datafile)
318 SUBROUTINE run(this,pvar,ic,dir)
322 CLASS(fosite),
INTENT(INOUT) :: this
323 CLASS(marray_compound),
POINTER :: pvar
324 INTEGER,
INTENT(IN) :: ic,dir
327 REAL :: x0, rho_l, rho_r, u_l, u_r, p_l, p_r
328 REAL,
DIMENSION(:),
ALLOCATABLE :: x
393 CALL this%Error(
"InitData",
"Test problem should be 1,2,3,4,5,6,7 or 8")
398 SELECT TYPE(pvar => this%Timedisc%pvar)
399 CLASS IS(statevector_eulerisotherm)
401 pvar%velocity%data1d(:) = 0.0
402 WHERE (this%Mesh%bcenter(:,:,:,dir).LT.x0)
403 pvar%density%data3d(:,:,:) = rho_l
404 pvar%velocity%data4d(:,:,:,1) = u_l
406 pvar%density%data3d(:,:,:) = rho_r
407 pvar%velocity%data4d(:,:,:,1) = u_r
412 SELECT TYPE(pvar => this%Timedisc%pvar)
413 TYPE IS(statevector_euler)
414 WHERE (this%Mesh%bcenter(:,:,:,dir).LT.x0)
415 pvar%pressure%data3d(:,:,:) = p_l
417 pvar%pressure%data3d(:,:,:) = p_r
421 CALL this%Physics%Convert2Conservative(this%Timedisc%pvar,this%Timedisc%cvar)
422 CALL this%Info(
" DATA-----> initial condition: " &
423 //
"1D Riemann problem: " // trim(teststr(ic)))
425 IF (
ASSOCIATED(this%Timedisc%solution))
THEN 427 this%Timedisc%solution = this%Timedisc%pvar
430 ALLOCATE(x(
SIZE(this%Mesh%cart%data3d(:,2,dir),1)), &
431 source=this%Mesh%cart%data3d(:,2,dir))
433 DO WHILE((this%Timedisc%maxiter.LE.0).OR.(this%iter.LE.this%Timedisc%maxiter))
434 SELECT TYPE(phys => this%Physics)
435 TYPE IS (physics_euler)
437 CALL riemann(x0,phys%gamma,rho_l,u_l,p_l,rho_r,u_r,p_r, &
438 this%Timedisc%time,x,this%Timedisc%solution%data2d(:,:))
program riemann1d
1D Riemann problems
subroutine, private run(this)
subroutine makeconfig(Sim, config)
subroutine, public riemann(x0, gamma_, rho_l_, u_l_, p_l_, rho_r_, u_r_, p_r_, t, x, pvar)