output_ekg.F90 coverage: 100.00 %func 88.46 %block
1) module Output_EKG_module
2)
3) use Output_Aux_module
4)
5) use PFLOTRAN_Constants_module
6)
7) implicit none
8)
9) private
10)
11) #include "petsc/finclude/petscsys.h"
12)
13) PetscInt, parameter, public :: IUNIT_EKG = 87
14)
15) public :: OutputEKGInit, &
16) OutputEKGFinalize
17)
18) contains
19)
20) ! ************************************************************************** !
21)
22) subroutine OutputEKGInit(option,num_steps)
23) !
24) ! Open EKG file
25) !
26) ! Author: Glenn Hammond
27) ! Date: 10/20/15
28) !
29) use Option_module
30)
31) implicit none
32)
33) type(option_type) :: option
34) PetscInt :: num_steps
35)
36) character(len=MAXSTRINGLENGTH) :: filename
37) PetscBool :: lexists
38)
39) if (.not.option%print_ekg) return
40)
41) filename = trim(option%global_prefix) // trim(option%group_prefix) // '.ekg'
42) if (OptionPrintToFile(option)) then
43) inquire(file=filename,exist=lexists)
44) if (num_steps == 0 .or. .not. lexists) then
45) open(unit=IUNIT_EKG,file=filename,action="write",status="replace")
46) else
47) open(unit=IUNIT_EKG,file=filename,action="write",status="old", &
48) position="append")
49) endif
50) endif
51)
52) end subroutine OutputEKGInit
53)
54) ! ************************************************************************** !
55)
56) subroutine OutputEKGFinalize()
57) !
58) ! Closes the EKG file
59) !
60) ! Author: Glenn Hammond
61) ! Date: 10/20/15
62) !
63) PetscBool :: lopened
64)
65) inquire(IUNIT_EKG,opened=lopened)
66) if (lopened) then
67) close(IUNIT_EKG)
68) endif
69)
70) end subroutine OutputEKGFinalize
71)
72) end module Output_EKG_module