hvs_asciiSpatial_init Subroutine

public subroutine hvs_asciiSpatial_init(asciiSpatial, varsys, varpos, basename, globProc, outProc, solver, geometry, nDofs, nElems, glob_nElems, useGetPoint, nPoints, glob_nPoints, timeControl, timeform)

Initialize asciiSpatial output format. initialize reduction if reduction is active

Arguments

Type IntentOptional Attributes Name
type(hvs_asciiSpatial_type), intent(inout) :: asciiSpatial

AsciiSpatial output file settings

type(tem_varSys_type), intent(in) :: varsys

Description of the available variable system to get the given varnames from.

integer, intent(in) :: varpos(:)

List of variable positions that should be written in the output.

character(len=*), intent(in) :: basename

An extension to the output basename.

type(tem_comm_env_type), intent(in) :: globProc

Global communicator type for global rank information

type(tem_comm_env_type), intent(in) :: outProc

Process description to use.

type(tem_solveHead_type), intent(in) :: solver

Global solver information

type(tem_shape_type), intent(in), optional :: geometry(:)

shape defined for this ascii output

integer, intent(in) :: nDofs

The number of dofs for each scalar variable of the equation system

integer, intent(in) :: nElems

Number of elements to output by local process

integer(kind=long_k), intent(in) :: glob_nElems

Total number of elements across process on this output

logical, intent(in) :: useGetPoint

if get_point is to be used to track the point

integer, intent(in) :: nPoints

Number of points to output by local process

integer(kind=long_k), intent(in) :: glob_nPoints

Total number of points across process on this output

type(tem_timeControl_type), intent(in), optional :: timeControl

output timeControl

type(tem_timeformatter_type), intent(in), optional :: timeform

Formatting for timestamp


Source Code

  subroutine hvs_asciiSpatial_init(asciiSpatial, varSys, varPos, basename,     &
    &                              globProc, outProc, solver, geometry, nDofs, &
    &                              nElems, glob_nElems, useGetPoint, nPoints,  &
    &                              glob_nPoints, timeControl, timeform         )
    ! --------------------------------------------------------------------------!
    !> AsciiSpatial output file settings
    type(hvs_asciiSpatial_type), intent(inout) :: asciiSpatial

    !> Description of the available variable system to get the given varnames
    !! from.
    type(tem_varSys_type), intent(in) :: varsys

    !> List of variable positions that should be written in the output.
    integer, intent(in) :: varpos(:)

    !> An extension to the output basename.
    character(len=*), intent(in) :: basename

    !> Global communicator type for global rank information
    type(tem_comm_env_type ), intent(in) :: globProc

    !> Process description to use.
    type(tem_comm_env_type), intent(in) :: outProc

    !> The number of dofs for each scalar variable of the equation system
    integer, intent(in) :: nDofs

    !> Number of elements to output by local process
    integer, intent(in) :: nElems

    !> Total number of elements across process on this output
    integer(kind=long_k), intent(in) :: glob_nElems

    !> Global solver information
    type(tem_solveHead_type ),intent(in) :: solver

    !> shape defined for this ascii output
    type(tem_shape_type), optional, intent(in) :: geometry(:)

    !> output timeControl
    type(tem_timeControl_type), optional, intent(in) :: timeControl

    !> Formatting for timestamp
    type(tem_timeformatter_type), optional, intent(in) :: timeform

    !> if get_point is to be used to track the point
    logical, intent(in) :: useGetPoint

    !> Number of points to output by local process
    integer, intent(in) :: nPoints

    !> Total number of points across process on this output
    integer(kind=long_k), intent(in) :: glob_nPoints
    ! ----------------------------------------------------------------------!
    integer :: nScalars, chunkSize, nChunks
    ! ----------------------------------------------------------------------!

    ! Compute nChunks, Abort if nChunks>1 asciiSpatial format
    ! and for ascii format abort if nChunk>1 and no reduction defined
    nScalars = sum(varSys%method%val(varPos(:))%nComponents)

    if (useGetPoint) then
      chunkSize = min(io_buffer_size/nScalars, nPoints)
    else
      chunkSize = min(io_buffer_size/(nScalars*nDofs), nElems)
    end if
    if ( (nElems > 0) .and. (chunkSize == 0) ) then
      write(logUnit(0),*)'Error in asciiSpatial output: '//trim(basename)
      write(logUnit(0),*) 'The chosen io_buffer_size of ', io_buffer_size
      write(logUnit(0),*) 'is too small for outputting ', nScalars
      write(logUnit(0),*) 'scalar values'
      write(logUnit(0),*) 'Please increase the io_buffer_size to at &
        & least ', real(nScalars*nDofs) / real(131072), ' MB!'
      call tem_abort()
    end if

    if (chunkSize>0) then
      if (useGetPoint) then
        nChunks = ceiling(real(nPoints, kind=rk)/real(chunkSize, kind=rk))
      else
        nChunks = ceiling(real(nElems, kind=rk)/real(chunkSize, kind=rk))
      end if
    else
      nChunks = 0
    end if

    asciiSpatial%chunkSize = chunkSize
    asciiSpatial%nChunks = nChunks

    asciiSpatial%basename = trim(basename)
    if (present(timeform)) then
      asciiSpatial%timeform = timeform
    else
      asciiSpatial%timeform = tem_timeformatter_init()
    end if

    ! write ascii header lua
    call hvs_ascii_write_header(out_format   = 'asciispatial', &
      &                         basename     = trim(basename), &
      &                         varSys       = varSys,         &
      &                         varPos       = varPos,         &
      &                         globProc     = globProc,       &
      &                         outProc      = outProc,        &
      &                         nDofs        = nDofs,          &
      &                         solver       = solver,         &
      &                         geometry     = geometry,       &
      &                         timeControl  = timeControl,    &
      &                         glob_nElems  = glob_nElems,    &
      &                         useGetPoint  = useGetPoint,    &
      &                         glob_nPoints = glob_nPoints    )

  end subroutine hvs_asciiSpatial_init