2D AMRCLAW
regions_module.f90
Go to the documentation of this file.
1 ! ==============================================================================
2 ! Regions Module
3 ! Module containing data structures and setup routines for region refinement.
4 !
5 ! ==============================================================================
7 
8  implicit none
9  save
10 
11  ! Region type definition
13  integer :: min_level,max_level
14  real(kind=8) :: x_low,y_low,x_hi,y_hi,t_low,t_hi
15  end type region_type
16 
17  logical, private :: module_setup
18 
19  integer :: num_regions
20  type(region_type), allocatable :: regions(:)
21 
22 contains
23 
24  subroutine set_regions(fname)
25 
26  use amr_module
27 
28  implicit none
29 
30  ! Function Arguments
31  character(len=*), optional, intent(in) :: fname
32 
33  ! Locals
34  integer, parameter :: unit = 7
35  integer :: i
36 
37  if (.not. module_setup) then
38 
39  write(parmunit,*) ' '
40  write(parmunit,*) '--------------------------------------------'
41  write(parmunit,*) 'REGIONS:'
42  write(parmunit,*) '-----------'
43 
44  if (present(fname)) then
45  call opendatafile(unit,fname)
46  else
47  call opendatafile(unit,'regions.data')
48  endif
49 
50  read(unit,"(i2)") num_regions
51  if (num_regions == 0) then
52  write(parmunit,*) ' No regions specified for refinement'
53 
54  else
55  ! Refinement region data
56  allocate(regions(num_regions))
57  do i=1,num_regions
58  read(unit,*) regions(i)%min_level, regions(i)%max_level, &
59  regions(i)%t_low, regions(i)%t_hi, &
60  regions(i)%x_low, regions(i)%x_hi, &
61  regions(i)%y_low, regions(i)%y_hi
62  enddo
63  endif
64  close(unit)
65 
66  module_setup = .true.
67  end if
68 
69  end subroutine set_regions
70 
71 end module regions_module
type(region_type), dimension(:), allocatable regions
subroutine set_regions(fname)
integer, parameter parmunit
Definition: amr_module.f90:287
subroutine opendatafile(iunit, fname)
Definition: opendatafile.f:3
logical, private module_setup
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21