Skip to content

Commit

Permalink
Use decomp_2d_testing in io_visu.f90 (2decomp-fft#278)
Browse files Browse the repository at this point in the history
* Update io_visu.f90

Use decomp_2d_testing

* Fix previous commit

Fix 2decomp-fft@0bd6de6
  • Loading branch information
mathrack authored Nov 2, 2023
1 parent f12686b commit a8eea82
Showing 1 changed file with 5 additions and 41 deletions.
46 changes: 5 additions & 41 deletions examples/io_test/io_visu.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ program visu
use mpi

use decomp_2d
use decomp_2d_mpi
use decomp_2d_constants
use decomp_2d_io
use decomp_2d_mpi
use decomp_2d_testing

implicit none

Expand All @@ -25,10 +26,7 @@ program visu
logical :: dir_exists
#endif

integer :: nargin, arg, FNLength, status, DecInd

integer :: i, j, k

integer :: ierr

call init_example()
Expand All @@ -45,7 +43,6 @@ subroutine init_example()

integer :: resize_domain
integer :: nranks_tot
character(len=80) :: InputFN

call MPI_INIT(ierr)
! To resize the domain we need to know global number of ranks
Expand All @@ -56,45 +53,12 @@ subroutine init_example()
ny = ny_base * resize_domain
nz = nz_base * resize_domain
! Now we can check if user put some inputs
! Handle input file like a boss -- GD
nargin = command_argument_count()
if ((nargin == 0) .or. (nargin == 2) .or. (nargin == 5)) then
do arg = 1, nargin
call get_command_argument(arg, InputFN, FNLength, status)
read (InputFN, *, iostat=status) DecInd
if (arg == 1) then
p_row = DecInd
elseif (arg == 2) then
p_col = DecInd
elseif (arg == 3) then
nx = DecInd
elseif (arg == 4) then
ny = DecInd
elseif (arg == 5) then
nz = DecInd
end if
end do
else
! nrank not yet computed we need to avoid write
! for every rank
call MPI_COMM_RANK(MPI_COMM_WORLD, nrank, ierr)
if (nrank == 0) then
print *, "This Test takes no inputs or 2 inputs as"
print *, " 1) p_row (default=0)"
print *, " 2) p_col (default=0)"
print *, "or 5 inputs as"
print *, " 1) p_row (default=0)"
print *, " 2) p_col (default=0)"
print *, " 3) nx "
print *, " 4) ny "
print *, " 5) nz "
print *, "Number of inputs is not correct and the defult settings"
print *, "will be used"
end if
end if
call decomp_2d_testing_init(p_row, p_col, nx, ny, nz)

call decomp_2d_init(nx, ny, nz, p_row, p_col)

call decomp_2d_testing_log()

call decomp_2d_io_init()
call decomp_2d_init_io(io_name)
call decomp_2d_register_variable(io_name, "u1.dat", 1, 0, output2D, mytype)
Expand Down

0 comments on commit a8eea82

Please sign in to comment.