extract_grid_size Subroutine

private subroutine extract_grid_size(file_handler, dims)

Extract the grid size from the grid file header

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: file_handler

(input)file handling unit

type(extent), intent(out) :: dims

Extent of the domain:imx,jmx,kmx


Calls

proc~~extract_grid_size~~CallsGraph proc~extract_grid_size extract_grid_size debugcall debugcall proc~extract_grid_size->debugcall

Called by

proc~~extract_grid_size~~CalledByGraph proc~extract_grid_size extract_grid_size proc~setup_grid setup_grid proc~setup_grid->proc~extract_grid_size proc~setup_solver setup_solver proc~setup_solver->proc~setup_grid proc~start_run start_run proc~start_run->proc~setup_solver program~main main program~main->proc~start_run

Contents

Source Code


Source Code

        subroutine extract_grid_size(file_handler, dims)
            !< Extract the grid size from the grid file header
            !
            ! We assume that the grid could be in 1 or 2 dimensions. If
            ! the grid is in 1 dimension, jmx will be set to 1.
            ! We assume that at least one number is specified in the 
            ! header, i.e., the grid has atleast one dimension.
            !-----------------------------------------------------------

            implicit none
            integer, intent(in) :: file_handler
            !< (input)file handling unit
            character(len=STRING_BUFFER_LENGTH) :: header
            !< store header
            type(extent), intent(out) :: dims
            !< Extent of the domain:imx,jmx,kmx
            integer :: ios  ! io operation status

            DebugCall('extract_grid_size')

            read(file_handler, '(A)', iostat=ios) header
            if (ios /= 0) then
                print *, 'Error while reading grid file header.'
                print *, 'Current buffer length is set to: ', &
                        STRING_BUFFER_LENGTH
                !stop
            end if

            ! Try to read constants corresponding to two dimensions.
            read(header, *, iostat=ios) dims%imx, dims%jmx, dims%kmx
            if (ios /= 0) then
              print*, "Not able to read dimension from the grid file"
              print*, "Make sure you provdie 3D grid"
              Fatal_error
            end if

        end subroutine extract_grid_size