ovarre Subroutine

public subroutine ovarre(file, descr, varnam, value, output_flag)

Routine to print out the details of a floating-point variable using 'E' format author: P J Knight, CCFE, Culham Science Centre file : input integer : Fortran output unit identifier descr : input character string : Description of the variable varnam : input character string : Name of the variable value : input real : Value of the variable output_flag : optional character This routine writes out the description, name and value of a double precision variable in E format (e.g. -1.234E+04). !

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: file
character(len=*), intent(in) :: descr
character(len=*), intent(in) :: varnam
real(kind=8), intent(in) :: value
character(len=3), intent(in), optional :: output_flag

Contents

Source Code


Source Code

  subroutine ovarre(file,descr,varnam,value,output_flag)

    !! Routine to print out the details of a floating-point
    !! variable using 'E' format
    !! author: P J Knight, CCFE, Culham Science Centre
    !! file : input integer : Fortran output unit identifier
    !! descr : input character string : Description of the variable
    !! varnam : input character string : Name of the variable
    !! value : input real : Value of the variable
    !! output_flag : optional character
    !! This routine writes out the description, name and value of a
    !! double precision variable in E format (e.g.
    !! <CODE>-1.234E+04</CODE>).
    !!     !
    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    use numerics, only: name_xc
		use global_variables, only: icase, vlabel
		use constants, only: mfile, nout
		use maths_library, only: variable_error
    implicit none

    !  Arguments

    integer, intent(in) :: file
    character(len=*), intent(in) :: descr, varnam
    real(8), intent(in) :: value
    character(len=3), intent(in), optional :: output_flag

    !  Local variables

    character(len=72) :: dum72
    character(len=30) :: dum20
    character(len=20) :: stripped
    character(len=3) :: flag
    integer :: dotindex

    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    !  Replace descr and varnam with dummy strings of the correct length.
    !  This counters problems that would occur if the two original strings
    !  were the wrong length.

    dum72 = descr
    dum20 = varnam
    ! Remove the "(" and ")" from the varnam
    stripped = varnam(2:len(varnam)-1)

    ! May need to strip Python module name (e.g. the pfv. from pfv.coheof)
    ! This ensures the ITV flag is still added when required in output files
    dotindex = scan(stripped,".")
    stripped = stripped(dotindex+1:)

    if (present(output_flag)) then
        flag = output_flag
    else
        flag = ''
    end if

    if (any(name_xc == stripped))  flag = 'ITV'

    if (file /= mfile) then
       ! MDK add ITV label if it is an iteration variable
       ! The ITV flag overwrites the output_flag
       write(file,20) dum72, dum20, value, flag
    end if

    call underscore(dum72)
    call underscore(dum20)
    write(mfile,10) dum72, dum20, value, flag

  ! MFILE.DAT format
  ! Machine epsilon for double ~2.22e-16, hence require 17 sig figs in significand
  ! for full precision of a double float
10  format(1x,a,t75,a,t110,ES23.16e2," ",a,t10)
  ! OUT.DAT format
20  format(1x,a,t75,a,t100,1pe10.3, t112, a)

  end subroutine ovarre