BLOCKS: Field %coords mean global coordinates at the block level.
If we take the whole domain and divide it between blocks of the size corresponding to the current lever, the field %coords identifies the position of the current block in the domain. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
fa6ca28885
commit
c2656c9b6a
@ -150,13 +150,11 @@ module blocks
|
|||||||
!
|
!
|
||||||
integer(kind=4) :: refine
|
integer(kind=4) :: refine
|
||||||
|
|
||||||
! the position of the block in its siblings
|
! the block position in its parent
|
||||||
! group
|
|
||||||
!
|
!
|
||||||
integer(kind=4) :: pos(ndims)
|
integer(kind=4) :: pos(ndims)
|
||||||
|
|
||||||
! the coordinate of the lower corner of the
|
! the block global coordinates at its level
|
||||||
! block in the effective resolution units
|
|
||||||
!
|
!
|
||||||
integer(kind=4) :: coords(ndims)
|
integer(kind=4) :: coords(ndims)
|
||||||
|
|
||||||
@ -825,7 +823,7 @@ module blocks
|
|||||||
!
|
!
|
||||||
pmeta%pos(:) = -1
|
pmeta%pos(:) = -1
|
||||||
|
|
||||||
! initialize the effective coordinates
|
! initialize the block coordinates in the current level
|
||||||
!
|
!
|
||||||
pmeta%coords(:) = 0
|
pmeta%coords(:) = 0
|
||||||
|
|
||||||
@ -1225,7 +1223,7 @@ module blocks
|
|||||||
!
|
!
|
||||||
!===============================================================================
|
!===============================================================================
|
||||||
!
|
!
|
||||||
subroutine refine_block(pmeta, res, fdata)
|
subroutine refine_block(pmeta, fdata)
|
||||||
|
|
||||||
! import external procedures
|
! import external procedures
|
||||||
!
|
!
|
||||||
@ -1238,7 +1236,6 @@ module blocks
|
|||||||
! subroutine arguments
|
! subroutine arguments
|
||||||
!
|
!
|
||||||
type(block_meta), pointer , intent(inout) :: pmeta
|
type(block_meta), pointer , intent(inout) :: pmeta
|
||||||
integer(kind=4), dimension(3), intent(in) :: res
|
|
||||||
logical , intent(in) :: fdata
|
logical , intent(in) :: fdata
|
||||||
|
|
||||||
! pointers
|
! pointers
|
||||||
@ -1446,10 +1443,10 @@ module blocks
|
|||||||
|
|
||||||
! calculate the block coordinates in effective resolution units
|
! calculate the block coordinates in effective resolution units
|
||||||
!
|
!
|
||||||
ic = pmeta%coords(1) + i * res(1)
|
ic = 2 * pmeta%coords(1) + i
|
||||||
jc = pmeta%coords(2) + j * res(2)
|
jc = 2 * pmeta%coords(2) + j
|
||||||
#if NDIMS == 3
|
#if NDIMS == 3
|
||||||
kc = pmeta%coords(3) + k * res(3)
|
kc = 2 * pmeta%coords(3) + k
|
||||||
#endif /* NDIMS == 3 */
|
#endif /* NDIMS == 3 */
|
||||||
|
|
||||||
! calculate block bounds
|
! calculate block bounds
|
||||||
|
@ -149,7 +149,7 @@ module domains
|
|||||||
|
|
||||||
! local variables
|
! local variables
|
||||||
!
|
!
|
||||||
integer :: i, j, k, n, p, il, jl, kl
|
integer :: i, j, k, n, p, ic, jc, kc
|
||||||
real :: xl, xmn, xmx, yl, ymn, ymx, zl, zmn, zmx
|
real :: xl, xmn, xmx, yl, ymn, ymx, zl, zmn, zmx
|
||||||
|
|
||||||
! local arrays
|
! local arrays
|
||||||
@ -263,7 +263,7 @@ module domains
|
|||||||
|
|
||||||
! claculate the block position along Z
|
! claculate the block position along Z
|
||||||
!
|
!
|
||||||
kl = (k - 1) * res(1,3)
|
kc = k - 1
|
||||||
|
|
||||||
! calculate the Z bounds
|
! calculate the Z bounds
|
||||||
!
|
!
|
||||||
@ -274,7 +274,7 @@ module domains
|
|||||||
|
|
||||||
! claculate the block position along Y
|
! claculate the block position along Y
|
||||||
!
|
!
|
||||||
jl = (j - 1) * res(1,2)
|
jc = j - 1
|
||||||
|
|
||||||
! calculate the Y bounds
|
! calculate the Y bounds
|
||||||
!
|
!
|
||||||
@ -285,7 +285,7 @@ module domains
|
|||||||
|
|
||||||
! claculate the block position along Y
|
! claculate the block position along Y
|
||||||
!
|
!
|
||||||
il = (i - 1) * res(1,1)
|
ic = i - 1
|
||||||
|
|
||||||
! calculate the Z bounds
|
! calculate the Z bounds
|
||||||
!
|
!
|
||||||
@ -306,7 +306,7 @@ module domains
|
|||||||
|
|
||||||
! set block coordinates
|
! set block coordinates
|
||||||
!
|
!
|
||||||
call metablock_set_coordinates(pmeta, il, jl, kl)
|
call metablock_set_coordinates(pmeta, ic, jc, kc)
|
||||||
|
|
||||||
! set the bounds
|
! set the bounds
|
||||||
!
|
!
|
||||||
|
10
src/mesh.F90
10
src/mesh.F90
@ -460,7 +460,7 @@ module mesh
|
|||||||
use blocks , only : append_datablock, remove_datablock
|
use blocks , only : append_datablock, remove_datablock
|
||||||
use blocks , only : link_blocks, unlink_blocks, refine_block
|
use blocks , only : link_blocks, unlink_blocks, refine_block
|
||||||
use blocks , only : get_mblocks, get_nleafs
|
use blocks , only : get_mblocks, get_nleafs
|
||||||
use coordinates , only : minlev, maxlev, res
|
use coordinates , only : minlev, maxlev
|
||||||
use domains , only : setup_domain
|
use domains , only : setup_domain
|
||||||
use error , only : print_error
|
use error , only : print_error
|
||||||
use mpitools , only : master, nproc, nprocs
|
use mpitools , only : master, nproc, nprocs
|
||||||
@ -651,7 +651,7 @@ module mesh
|
|||||||
|
|
||||||
! perform the refinement without creating new data blocks
|
! perform the refinement without creating new data blocks
|
||||||
!
|
!
|
||||||
call refine_block(pmeta, res(pmeta%level + 1,:), .false.)
|
call refine_block(pmeta, .false.)
|
||||||
|
|
||||||
end if ! selected for refinement and at the current level
|
end if ! selected for refinement and at the current level
|
||||||
|
|
||||||
@ -785,7 +785,7 @@ module mesh
|
|||||||
use blocks , only : get_nleafs
|
use blocks , only : get_nleafs
|
||||||
use blocks , only : refine_block, derefine_block
|
use blocks , only : refine_block, derefine_block
|
||||||
use blocks , only : append_datablock, remove_datablock, link_blocks
|
use blocks , only : append_datablock, remove_datablock, link_blocks
|
||||||
use coordinates , only : minlev, maxlev, toplev, im, jm, km, res
|
use coordinates , only : minlev, maxlev, toplev, im, jm, km
|
||||||
use equations , only : nv
|
use equations , only : nv
|
||||||
use error , only : print_error
|
use error , only : print_error
|
||||||
#ifdef MPI
|
#ifdef MPI
|
||||||
@ -1317,12 +1317,12 @@ module mesh
|
|||||||
#ifdef MPI
|
#ifdef MPI
|
||||||
if (pmeta%process .eq. nproc) then
|
if (pmeta%process .eq. nproc) then
|
||||||
#endif /* MPI */
|
#endif /* MPI */
|
||||||
call refine_block(pmeta, res(pmeta%level + 1,:), .true.)
|
call refine_block(pmeta, .true.)
|
||||||
call prolong_block(pparent)
|
call prolong_block(pparent)
|
||||||
call remove_datablock(pparent%data)
|
call remove_datablock(pparent%data)
|
||||||
#ifdef MPI
|
#ifdef MPI
|
||||||
else
|
else
|
||||||
call refine_block(pmeta, res(pmeta%level + 1,:), .false.)
|
call refine_block(pmeta, .false.)
|
||||||
end if
|
end if
|
||||||
#endif /* MPI */
|
#endif /* MPI */
|
||||||
end if
|
end if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user