Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move num_dim determination futher up #223

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 16 additions & 36 deletions src/2d/valout.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subroutine valout(level_begin, level_end, time, num_eqn, num_aux)

! Locals
integer, parameter :: out_unit = 50
integer :: i, j, m, level, output_aux_num, num_stop, digit, num_dim
integer :: i, j, m, level, output_aux_num, num_stop, digit
integer :: grid_ptr, num_cells(2), num_grids, q_loc, aux_loc
real(kind=8) :: lower_corner(2), delta(2)
logical :: out_aux
Expand Down Expand Up @@ -78,7 +78,7 @@ subroutine valout(level_begin, level_end, time, num_eqn, num_aux)
! Output timing
call system_clock(clock_start,clock_rate)
call cpu_time(cpu_start)

! Count how many aux components requested
output_aux_num = 0
do i=1, num_aux
Expand Down Expand Up @@ -144,19 +144,13 @@ subroutine valout(level_begin, level_end, time, num_eqn, num_aux)
lower_corner = [rnode(cornxlo, grid_ptr), rnode(cornylo, grid_ptr)]

! Write out header data
if (num_dim == 1) then
write(out_unit, header_format_1d) grid_ptr, level, &
num_cells(1), &
lower_corner(1), &
delta(1)
else
write(out_unit, header_format_2d) grid_ptr, level, &
num_cells(1), &
num_cells(2), &
lower_corner(1), &
lower_corner(2), &
delta(1), delta(2)
end if
write(out_unit, header_format_2d) grid_ptr, level, &
num_cells(1), &
num_cells(2), &
lower_corner(1), &
lower_corner(2), &
delta(1), delta(2)


! Output grids
select case(output_format)
Expand Down Expand Up @@ -263,19 +257,12 @@ subroutine valout(level_begin, level_end, time, num_eqn, num_aux)

! We only output header info for aux data if writing
! ASCII data
if (num_dim == 1) then
write(out_unit, header_format_1d) grid_ptr, level, &
num_cells(1), &
lower_corner(1), &
delta(1)
else
write(out_unit, header_format_2d) grid_ptr, level, &
num_cells(1), &
num_cells(2), &
lower_corner(1), &
lower_corner(2), &
delta(1), delta(2)
end if
write(out_unit, header_format_2d) grid_ptr, level, &
num_cells(1), &
num_cells(2), &
lower_corner(1), &
lower_corner(2), &
delta(1), delta(2)

! Round off if nearly zero
forall (m = 1:num_aux, &
Expand Down Expand Up @@ -351,16 +338,9 @@ subroutine valout(level_begin, level_end, time, num_eqn, num_aux)
! Write fort.t file
open(unit=out_unit, file=file_name(2), status='unknown', form='formatted')

! Handle special case of using 2D AMR to do 1D AMR
if (num_cells(2) > 1) then
num_dim = 2
else
num_dim = 1
end if

! Note: We need to print out num_ghost too in order to strip ghost cells
! from q array when reading in pyclaw.io.binary
write(out_unit, t_file_format) time, num_eqn, num_grids, num_aux, num_dim, &
write(out_unit, t_file_format) time, num_eqn, num_grids, num_aux, 2, &
num_ghost
close(out_unit)

Expand Down