Merge branch 'master' into reconnection
This commit is contained in:
commit
9503fef125
@ -111,7 +111,8 @@ module integrals
|
||||
|
||||
! local variables
|
||||
!
|
||||
character(len=32) :: fname
|
||||
character(len=32) :: fname, append
|
||||
logical :: flag
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -142,19 +143,40 @@ module integrals
|
||||
!
|
||||
if (master) then
|
||||
|
||||
! generate the integrals file name
|
||||
! depending on the append parameter, choose the right file initialization for
|
||||
! the integrals file
|
||||
!
|
||||
write(fname, "('integrals_',i2.2,'.dat')") irun
|
||||
append = "off"
|
||||
call get_parameter("integrals_append", append)
|
||||
select case(trim(append))
|
||||
case ("on", "ON", "t", "T", "y", "Y", "true", "TRUE", "yes", "YES")
|
||||
write(fname, "('integrals.dat')")
|
||||
inquire(file = fname, exist = flag)
|
||||
case default
|
||||
write(fname, "('integrals_',i2.2,'.dat')") irun
|
||||
flag = .false.
|
||||
end select
|
||||
|
||||
! create a new integrals file
|
||||
! check if the file exists; if not, create a new one, otherwise move to the end
|
||||
!
|
||||
if (flag .and. irun > 1) then
|
||||
#ifdef INTEL
|
||||
open (newunit = funit, file = fname, form = 'formatted' &
|
||||
, status = 'replace', buffered = 'yes')
|
||||
open(newunit = funit, file = fname, form = 'formatted', status = 'old' &
|
||||
, position = 'append', buffered = 'yes')
|
||||
#else /* INTEL */
|
||||
open (newunit = funit, file = fname, form = 'formatted' &
|
||||
, status = 'replace')
|
||||
open(newunit = funit, file = fname, form = 'formatted', status = 'old' &
|
||||
, position = 'append')
|
||||
#endif /* INTEL */
|
||||
write(funit,"('#')")
|
||||
else
|
||||
#ifdef INTEL
|
||||
open(newunit = funit, file = fname, form = 'formatted' &
|
||||
, status = 'replace', buffered = 'yes')
|
||||
#else /* INTEL */
|
||||
open(newunit = funit, file = fname, form = 'formatted' &
|
||||
, status = 'replace')
|
||||
#endif /* INTEL */
|
||||
end if
|
||||
|
||||
! write the integral file header
|
||||
!
|
||||
@ -163,19 +185,40 @@ module integrals
|
||||
, 'ener', 'ekin', 'emag', 'eint'
|
||||
write(funit,"('#')")
|
||||
|
||||
! generate the statistics file name
|
||||
! depending on the append parameter, choose the right file initialization for
|
||||
! the statistics file
|
||||
!
|
||||
write(fname, "('statistics_',i2.2,'.dat')") irun
|
||||
append = "off"
|
||||
call get_parameter("statistics_append", append)
|
||||
select case(trim(append))
|
||||
case ("on", "ON", "t", "T", "y", "Y", "true", "TRUE", "yes", "YES")
|
||||
write(fname, "('statistics.dat')")
|
||||
inquire(file = fname, exist = flag)
|
||||
case default
|
||||
write(fname, "('statistics_',i2.2,'.dat')") irun
|
||||
flag = .false.
|
||||
end select
|
||||
|
||||
! create a new statistics file
|
||||
! check if the file exists; if not, create a new one, otherwise move to the end
|
||||
!
|
||||
if (flag .and. irun > 1) then
|
||||
#ifdef INTEL
|
||||
open (newunit = sunit, file = fname, form = 'formatted' &
|
||||
, status = 'replace', buffered = 'yes')
|
||||
open(newunit = sunit, file = fname, form = 'formatted', status = 'old' &
|
||||
, position = 'append', buffered = 'yes')
|
||||
#else /* INTEL */
|
||||
open (newunit = sunit, file = fname, form = 'formatted' &
|
||||
, status = 'replace')
|
||||
open(newunit = sunit, file = fname, form = 'formatted', status = 'old' &
|
||||
, position = 'append')
|
||||
#endif /* INTEL */
|
||||
write(sunit,"('#')")
|
||||
else
|
||||
#ifdef INTEL
|
||||
open(newunit = sunit, file = fname, form = 'formatted' &
|
||||
, status = 'replace', buffered = 'yes')
|
||||
#else /* INTEL */
|
||||
open(newunit = sunit, file = fname, form = 'formatted' &
|
||||
, status = 'replace')
|
||||
#endif /* INTEL */
|
||||
end if
|
||||
|
||||
! write the integral file header
|
||||
!
|
||||
|
@ -477,6 +477,7 @@ module mesh
|
||||
|
||||
! local variables
|
||||
!
|
||||
logical :: refine
|
||||
integer(kind=4) :: level, lev, idir, iside, iface
|
||||
integer(kind=4) :: np, nl
|
||||
integer(kind=4), dimension(0:npmax) :: lb
|
||||
@ -526,23 +527,18 @@ module mesh
|
||||
call print_section(master, "Generating the initial mesh")
|
||||
if (master) write(*,"(4x,a16,11x,'=')",advance="no") "generating level"
|
||||
|
||||
! reset the currently processed level
|
||||
! iterate over all levels up to the maximum one
|
||||
!
|
||||
level = 1
|
||||
|
||||
! iterate over all level up to the maximum one
|
||||
!
|
||||
do while (level < maxlev)
|
||||
|
||||
! print the currently processed level
|
||||
!
|
||||
if (master) write(*, "(1x,i0)", advance = "no") level
|
||||
refine = .true.
|
||||
level = 1
|
||||
do while (level < maxlev .and. refine)
|
||||
|
||||
!! DETERMINE THE REFINEMENT OF ALL BLOCKS AT THE CURRENT LEVEL
|
||||
!!
|
||||
! iterate over all meta blocks at the current level, and initialize the problem
|
||||
! for them using temporary data block
|
||||
!
|
||||
refine = .false.
|
||||
pmeta => list_meta
|
||||
do while (associated(pmeta))
|
||||
|
||||
@ -563,69 +559,84 @@ module mesh
|
||||
if (get_mblocks() == 1 .and. level == 1) pmeta%refine = 1
|
||||
|
||||
call unlink_blocks(pmeta, pdata)
|
||||
|
||||
! set the refine flag, if there is any block selected for refinement or
|
||||
! derefinement
|
||||
!
|
||||
if (pmeta%refine /= 0) refine = .true.
|
||||
end if ! pmeta%level == level
|
||||
pmeta => pmeta%next
|
||||
end do ! pmeta
|
||||
|
||||
! refine or derefine only if it is needed
|
||||
!
|
||||
if (refine) then
|
||||
|
||||
! print the currently processed level
|
||||
!
|
||||
if (master) write(*, "(1x,i0)", advance = "no") level
|
||||
|
||||
!! STEP DOWN AND SELECT BLOCKS WHICH NEED TO BE REFINED
|
||||
!!
|
||||
! walk through all levels down from the current level and check if neighbors
|
||||
! of the refined blocks need to be refined as well; there is no need for
|
||||
! checking the blocks at the lowest level;
|
||||
!
|
||||
do lev = level, 2, -1
|
||||
do lev = level, 2, -1
|
||||
|
||||
! iterate over all meta blocks at the level lev and if the current block is
|
||||
! selected for the refinement and its neighbors are at lower levels select them
|
||||
! for refinement too;
|
||||
!
|
||||
pmeta => list_meta
|
||||
do while (associated(pmeta))
|
||||
pmeta => list_meta
|
||||
do while (associated(pmeta))
|
||||
|
||||
if (pmeta%leaf .and. pmeta%level == lev .and. pmeta%refine == 1) &
|
||||
call set_neighbors_refine(pmeta)
|
||||
if (pmeta%leaf .and. pmeta%level == lev .and. pmeta%refine == 1) &
|
||||
call set_neighbors_refine(pmeta)
|
||||
|
||||
pmeta => pmeta%next
|
||||
end do ! pmeta
|
||||
pmeta => pmeta%next
|
||||
end do ! pmeta
|
||||
|
||||
end do ! lev = level, 2, -1
|
||||
end do ! lev = level, 2, -1
|
||||
|
||||
!! REFINE ALL BLOCKS FROM THE LOWEST LEVEL UP
|
||||
!!
|
||||
! walk through the levels starting from the lowest to the current level
|
||||
!
|
||||
do lev = 1, level
|
||||
do lev = 1, level
|
||||
|
||||
pmeta => list_meta
|
||||
do while (associated(pmeta))
|
||||
pmeta => list_meta
|
||||
do while (associated(pmeta))
|
||||
|
||||
! check if the current block is at the level lev and refine if if
|
||||
! it is selected for refinement (refine without creating new data blocks)
|
||||
!
|
||||
if (pmeta%level == lev .and. pmeta%refine == 1) then
|
||||
if (pmeta%level == lev .and. pmeta%refine == 1) then
|
||||
|
||||
call refine_block(pmeta, .false., status)
|
||||
call refine_block(pmeta, .false., status)
|
||||
|
||||
! quit if the block couldn't be refined
|
||||
!
|
||||
if (status /= 0) then
|
||||
write(error_unit,"('[',a,']: ',a)") trim(loc) &
|
||||
, "Cannot refine meta block!"
|
||||
call deallocate_datablock(pdata, status)
|
||||
status = 1
|
||||
go to 100
|
||||
if (status /= 0) then
|
||||
write(error_unit,"('[',a,']: ',a)") trim(loc) &
|
||||
, "Cannot refine meta block!"
|
||||
call deallocate_datablock(pdata, status)
|
||||
status = 1
|
||||
go to 100
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
pmeta => pmeta%next
|
||||
end do ! pmeta
|
||||
|
||||
pmeta => pmeta%next
|
||||
end do ! pmeta
|
||||
|
||||
end do ! lev = 1, level
|
||||
end do ! lev = 1, level
|
||||
|
||||
! increase the level number
|
||||
!
|
||||
level = level + 1
|
||||
level = level + 1
|
||||
|
||||
end if ! refine
|
||||
|
||||
end do ! level = 1, maxlev
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user