76 INTEGER,
PARAMETER ::
pp = 6
81 "minmod ",
"mc ",
"sweby ",
"superbee ",
"ospre ", &
82 "pp ",
"van leer ",
"no limit "/)
98 CLASS(reconstruction_linear),
INTENT(INOUT) :: this
99 CLASS(mesh_base),
INTENT(IN) :: Mesh
100 CLASS(physics_base),
INTENT(IN) :: Physics
101 TYPE(DICT_TYP),
POINTER :: config
102 TYPE(DICT_TYP),
POINTER :: IO
104 CHARACTER(LEN=60) :: key
105 INTEGER :: err,limiter,valwrite,l,m
109 ALLOCATE(this%slopes,this%dx, &
112 CALL this%Error(
"InitReconstruction_linear",
"Unable to allocate memory.")
120 CALL getattr(config,
"limiter", limiter,
minmod)
121 CALL getattr(config,
"theta", theta, 1.0)
129 this%limiter_param = theta
132 CALL this%Error(
"InitReconstruction_linear",
"Unknown limiter")
136 IF (limiter.EQ.
pp)
THEN 137 CALL this%Error(
"InitReconstruction_linear",
"PP limiter currently not supported.")
153 this%slopes%data1d(:) = 0.0
157 IF (mesh%INUM.GT.1)
THEN 159 this%dx%data4d(:,:,:,m) = mesh%curv%faces(:,:,:,1,1) - mesh%curv%bcenter(:,:,:,1)
160 this%dx%data4d(:,:,:,m+1) = mesh%curv%faces(:,:,:,2,1) - mesh%curv%bcenter(:,:,:,1)
163 IF (mesh%JNUM.GT.1)
THEN 164 this%dx%data4d(:,:,:,m) = mesh%curv%faces(:,:,:,3,2) - mesh%curv%bcenter(:,:,:,2)
165 this%dx%data4d(:,:,:,m+1) = mesh%curv%faces(:,:,:,4,2) - mesh%curv%bcenter(:,:,:,2)
168 IF (mesh%KNUM.GT.1)
THEN 169 this%dx%data4d(:,:,:,m) = mesh%curv%faces(:,:,:,5,3) - mesh%curv%bcenter(:,:,:,3)
170 this%dx%data4d(:,:,:,m+1) = mesh%curv%faces(:,:,:,6,3) - mesh%curv%bcenter(:,:,:,3)
173 CALL getattr(config,
"output/slopes", valwrite, 0)
174 IF(valwrite.EQ.1)
THEN 176 IF (mesh%INUM.GT.1)
THEN 179 key = trim(physics%pvarname(l)) //
"_xslope" 180 CALL setattr(io, trim(key), &
181 this%slopes%data5d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX,m,l))
185 IF (mesh%JNUM.GT.1)
THEN 188 key = trim(physics%pvarname(l)) //
"_yslope" 189 CALL setattr(io, trim(key), &
190 this%slopes%data5d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX,m,l))
194 IF (mesh%KNUM.GT.1)
THEN 197 key = trim(physics%pvarname(l)) //
"_zslope" 198 CALL setattr(io, trim(key), &
199 this%slopes%data5d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX,m,l))
204 CALL this%Info(
" limiter: " // trim(this%GetName()))
221 CALL this%CalculateSlopes(mesh,physics,rvar)
228 rstates%data3d(:,n,l) = rvar%data2d(:,l) + &
229 this%slopes%data3d(:,((n+1)/2),l)*
this%dx%data2d(:,n)
247 SELECT CASE(
this%GetType())
250 IF (mesh%INUM.GT.1)
THEN 253 DO k=mesh%KGMIN,mesh%KGMAX
254 DO j=mesh%JGMIN,mesh%JGMAX
256 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
258 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
259 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l))
267 IF (mesh%JNUM.GT.1)
THEN 268 i = mesh%IGMAX-mesh%IGMIN+1
272 DO k=mesh%KGMIN,mesh%KGMAX
275 DO j=i+1,
SIZE(rvar%data3d,1)-i
277 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l), &
278 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l))
285 IF (mesh%KNUM.GT.1)
THEN 286 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
291 DO j=i+1,
SIZE(rvar%data2d,1)-i
293 rvar%data2d(j,l) - rvar%data2d(j-i,l), &
294 rvar%data2d(j+i,l) - rvar%data2d(j,l))
300 IF (mesh%INUM.GT.1)
THEN 303 DO k=mesh%KGMIN,mesh%KGMAX
304 DO j=mesh%JGMIN,mesh%JGMAX
306 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
308 this%limiter_param*(rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l)),&
309 this%limiter_param*(rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l)),&
310 0.5*(rvar%data4d(i+1,j,k,l) - rvar%data4d(i-1,j,k,l)))
318 IF (mesh%JNUM.GT.1)
THEN 319 i = mesh%IGMAX-mesh%IGMIN+1
322 DO k=mesh%KGMIN,mesh%KGMAX
325 DO j=i+1,
SIZE(rvar%data3d,1)-i
327 this%limiter_param*(rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l)),&
328 this%limiter_param*(rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l)),&
329 0.5*(rvar%data3d(j+i,k,l) - rvar%data3d(j-i,k,l)))
336 IF (mesh%KNUM.GT.1)
THEN 337 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
342 DO j=i+1,
SIZE(rvar%data2d,1)-i
344 this%limiter_param*(rvar%data2d(j,l) - rvar%data2d(j-i,l)),&
345 this%limiter_param*(rvar%data2d(j+i,l) - rvar%data2d(j,l)),&
346 0.5*(rvar%data2d(j+i,l) - rvar%data2d(j-i,l)))
352 IF (mesh%INUM.GT.1)
THEN 355 DO k=mesh%KGMIN,mesh%KGMAX
356 DO j=mesh%JGMIN,mesh%JGMAX
358 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
360 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
361 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l),&
370 IF (mesh%JNUM.GT.1)
THEN 371 i = mesh%IGMAX-mesh%IGMIN+1
374 DO k=mesh%KGMIN,mesh%KGMAX
377 DO j=i+1,
SIZE(rvar%data3d,1)-i
379 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l),&
380 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l),&
388 IF (mesh%KNUM.GT.1)
THEN 389 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
394 DO j=i+1,
SIZE(rvar%data2d,1)-i
396 rvar%data2d(j,l) - rvar%data2d(j-i,l),&
397 rvar%data2d(j+i,l) - rvar%data2d(j,l),&
404 IF (mesh%INUM.GT.1)
THEN 407 DO k=mesh%KGMIN,mesh%KGMAX
408 DO j=mesh%JGMIN,mesh%JGMAX
410 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
412 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
413 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l), 2.0)
421 IF (mesh%JNUM.GT.1)
THEN 422 i = mesh%IGMAX-mesh%IGMIN+1
425 DO k=mesh%KGMIN,mesh%KGMAX
428 DO j=i+1,
SIZE(rvar%data3d,1)-i
430 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l),&
431 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l), 2.0)
438 IF (mesh%KNUM.GT.1)
THEN 439 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
444 DO j=i+1,
SIZE(rvar%data2d,1)-i
446 rvar%data2d(j,l) - rvar%data2d(j-i,l),&
447 rvar%data2d(j+i,l) - rvar%data2d(j,l), 2.0)
453 IF (mesh%INUM.GT.1)
THEN 456 DO k=mesh%KGMIN,mesh%KGMAX
457 DO j=mesh%JGMIN,mesh%JGMAX
459 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
461 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
462 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l))
470 IF (mesh%JNUM.GT.1)
THEN 471 i = mesh%IGMAX-mesh%IGMIN+1
474 DO k=mesh%KGMIN,mesh%KGMAX
477 DO j=i+1,
SIZE(rvar%data3d,1)-i
479 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l),&
480 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l))
487 IF (mesh%KNUM.GT.1)
THEN 488 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
493 DO j=i+1,
SIZE(rvar%data2d,1)-i
495 rvar%data2d(j,l) - rvar%data2d(j-i,l),&
496 rvar%data2d(j+i,l) - rvar%data2d(j,l))
525 IF (mesh%INUM.GT.1)
THEN 528 DO k=mesh%KGMIN,mesh%KGMAX
529 DO j=mesh%JGMIN,mesh%JGMAX
531 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
533 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
534 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l))
542 IF (mesh%JNUM.GT.1)
THEN 543 i = mesh%IGMAX-mesh%IGMIN+1
546 DO k=mesh%KGMIN,mesh%KGMAX
549 DO j=i+1,
SIZE(rvar%data3d,1)-i
551 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l),&
552 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l))
559 IF (mesh%KNUM.GT.1)
THEN 560 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
565 DO j=i+1,
SIZE(rvar%data2d,1)-i
567 rvar%data2d(j,l) - rvar%data2d(j-i,l),&
568 rvar%data2d(j+i,l) - rvar%data2d(j,l))
574 IF (mesh%INUM.GT.1)
THEN 577 DO k=mesh%KGMIN,mesh%KGMAX
578 DO j=mesh%JGMIN,mesh%JGMAX
580 DO i=mesh%IGMIN+mesh%IP1,mesh%IGMAX+mesh%IM1
582 rvar%data4d(i,j,k,l) - rvar%data4d(i-1,j,k,l), &
583 rvar%data4d(i+1,j,k,l) - rvar%data4d(i,j,k,l))
591 IF (mesh%JNUM.GT.1)
THEN 592 i = mesh%IGMAX-mesh%IGMIN+1
595 DO k=mesh%KGMIN,mesh%KGMAX
598 DO j=i+1,
SIZE(rvar%data3d,1)-i
600 rvar%data3d(j,k,l) - rvar%data3d(j-i,k,l),&
601 rvar%data3d(j+i,k,l) - rvar%data3d(j,k,l))
608 IF (mesh%KNUM.GT.1)
THEN 609 i = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)
614 DO j=i+1,
SIZE(rvar%data2d,1)-i
616 rvar%data2d(j,l) - rvar%data2d(j-i,l),&
617 rvar%data2d(j+i,l) - rvar%data2d(j,l))
627 CLASS(reconstruction_linear),
INTENT(INOUT) :: this
629 CALL this%slopes%Destroy()
630 CALL this%dx%Destroy()
631 DEALLOCATE(this%slopes,this%dx)
633 CALL this%Finalize_base()
643 REAL,
INTENT(IN) :: arg1, arg2
645 IF (sign(1.0,arg1)*sign(1.0,arg2).GT.0)
THEN 646 limarg = sign(min(abs(arg1),abs(arg2)),arg1)
656 REAL,
INTENT(IN) :: arg1, arg2, arg3
658 IF (((sign(1.0,arg1)*sign(1.0,arg2)).GT.0).AND.&
659 ((sign(1.0,arg2)*sign(1.0,arg3)).GT.0))
THEN 660 limarg = sign(min(abs(arg1),abs(arg2),abs(arg3)),arg1)
666 ELEMENTAL FUNCTION sweby_limiter(arg1,arg2,param)
RESULT(limarg)
670 REAL,
INTENT(IN) :: arg1, arg2, param
672 IF (sign(1.0,arg1)*sign(1.0,arg2).GT.0)
THEN 673 limarg = sign(max(min(param*abs(arg1),abs(arg2)), &
674 min(abs(arg1),param*abs(arg2))),arg1)
684 REAL,
INTENT(IN) :: arg1, arg2
686 limarg = 1.5*arg1*arg2*(arg1 + arg2) / (arg1*(arg1 + 0.5*arg2) &
687 + arg2*(arg2 + 0.5*arg1) + tiny(1.0))
711 REAL,
INTENT(IN) :: arg1, arg2
717 limarg = (arg1 * a2 + arg2 * a1)/(a1 + a2 + tiny(a1))
724 REAL,
INTENT(IN) :: arg1, arg2
726 limarg = 0.5*(arg1+arg2)
subroutine finalize(this)
Destructor of common class.
integer, parameter, public nolimit
character(len=32), dimension(8), parameter limitertype_name
integer, parameter, public linear
integer, parameter, public superbee
elemental real function minmod2_limiter(arg1, arg2)
elemental real function sweby_limiter(arg1, arg2, param)
type(logging_base), save this
derived class for compound of mesh arrays
base class for mesh arrays
elemental real function vanleer_limiter(arg1, arg2)
pure subroutine calculatestates(this, Mesh, Physics, rvar, rstates)
Reconstructes states at cell boundaries.
character(len=32), parameter recontype_name
base module for reconstruction process
integer, parameter, public minmod
integer, parameter, public pp
named integer constants for flavour of state vectors
integer, parameter, public monocent
Dictionary for generic data types.
integer, parameter, public vanleer
subroutine initreconstruction_linear(this, Mesh, Physics, config, IO)
Constructor of linear reconstruction module.
integer, parameter, public sweby
module for linear (first order) TVD reconstruction using slope limiters
integer, parameter, public ospre
elemental real function ospre_limiter(arg1, arg2)
elemental real function nolimit_limiter(arg1, arg2)
pure subroutine calculateslopes(this, Mesh, Physics, rvar)
computes the limited slopes
elemental real function minmod3_limiter(arg1, arg2, arg3)