Added more helpful dimension indices.

This commit is contained in:
Grzegorz Kowal 2008-12-09 21:02:33 -06:00
parent 936420c599
commit 247ecd1178
2 changed files with 60 additions and 11 deletions

View File

@ -138,17 +138,19 @@ module boundaries
!
subroutine bnd_copy(u, b, id, is, ip)
use blocks, only : nvars
use config, only : igrids, jgrids, kgrids, nghost, ncells
use blocks, only : nv => nvars
use config, only : ng, im, ib, ibl, ibu, ie, iel, ieu &
, jm, jb, jbl, jbu, je, jel, jeu &
, km, kb, kbl, kbu, ke, kel, keu
use error , only : print_warning
implicit none
! arguments
!
real, dimension(nvars,igrids,jgrids,kgrids), intent(inout) :: u
real, dimension(nvars,igrids,jgrids,kgrids), intent(in) :: b
integer , intent(in) :: id, is, ip
real, dimension(nv,im,jm,km), intent(inout) :: u
real, dimension(nv,im,jm,km), intent(in) :: b
integer , intent(in) :: id, is, ip
! local variables
!
@ -164,17 +166,17 @@ module boundaries
!
select case(ii)
case(110)
u(:,1:nghost,:,:) = b(:,ncells:ncells+nghost,:,:)
u(:, 1:ibl,:,:) = b(:,iel:ie ,:,:)
case(120)
u(:,igrids-nghost:igrids,:,:) = b(:,nghost+1:2*nghost,:,:)
u(:,ieu:im ,:,:) = b(:, ib:ibu,:,:)
case(210)
u(:,:,1:nghost,:) = b(:,:,ncells:ncells+nghost,:)
u(:,:, 1:jbl,:) = b(:,:,jel:je ,:)
case(220)
u(:,:,jgrids-nghost:jgrids,:) = b(:,:,nghost+1:2*nghost,:)
u(:,:,jeu:jm ,:) = b(:,:, jb:jbu,:)
case(310)
u(:,:,:,1:nghost) = b(:,:,:,ncells:ncells+nghost)
u(:,:,:, 1:kbl) = b(:,:,:,kel:ke )
case(320)
u(:,:,:,kgrids-nghost:kgrids) = b(:,:,:,nghost+1:2*nghost)
u(:,:,:,keu:km ) = b(:,:,:, kb:kbu)
case default
call print_warning("boundaries::bnd_copy", "Boundary flag unsupported!")
end select

View File

@ -37,6 +37,12 @@ module config
integer(kind=4), save :: ncells = 8, nghost = 2, ngrids = 10 &
, igrids = 10, jgrids = 10, kgrids = 10
! derived dimensional variables
!
integer(kind=4), save :: in, im, ib, ie, ibl, ibu, iel, ieu, ng &
, jn, jm, jb, je, jbl, jbu, jel, jeu &
, kn, km, kb, ke, kbl, kbu, kel, keu
! mesh refinement control
!
integer(kind=4), save :: maxlev = 2
@ -205,6 +211,47 @@ module config
kgrids = ngrids
#endif /* */
ng = nghost
in = ncells
im = in + 2 * ng
ib = ng + 1
ie = ng + in
ibl = ib - 1
ibu = ib + ng - 1
iel = ie - ng + 1
ieu = ie - 1
jn = ncells
jm = jn + 2 * ng
jb = ng + 1
je = ng + jn
jbl = jb - 1
jbu = jb + ng - 1
jel = je - ng + 1
jeu = je - 1
#if NDIMS == 2
kn = 1
km = 1
kb = 1
ke = 1
kbl = 1
kbu = 1
kel = 1
keu = 1
#endif /* NDIMS == 2 */
#if NDIMS == 3
kn = ncells
km = kn + 2 * ng
kb = ng + 1
ke = ng + kn
kbl = kb - 1
kbu = kb + ng - 1
kel = ke - ng + 1
keu = ke - 1
#endif /* NDIMS == 3 */
gammam1 = gamma - 1.0
gammam1i = 1.0 / gammam1
csnd2 = csnd * csnd