MFIX  2016-1
write_spx0.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Module name: WRITE_SPX0(L, unit_add) !
4 ! Author: P. Nicoletti Date: 13-DEC-91 !
5 ! !
6 ! Purpose: Write out the initial single percision data files. !
7 ! !
8 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
9  SUBROUTINE write_spx0(L, UNIT_ADD)
10 
11 ! Global Variables:
12 !---------------------------------------------------------------------//
13 ! User defined run_name
14  use run, only: run_name
15 ! Calendar information for start of run.
16  use machine, only: id_month, id_day, id_year
17 ! Time information for start of run.
18  use machine, only: id_hour, id_minute, id_second
19 ! Base file unit for SPx files.
20  use funits, only: unit_spx
21 ! Flag: Use distributed I/O
22  USE cdist, only: bdist_io
23 ! Rank of current process.
24  use compar, only: mype
25 ! Rank assigned to serial I/O
26  use compar, only: pe_io
27 
28  IMPLICIT NONE
29 
30 ! Passed Variables:
31 !----------------------------------------------------------------------!
32 ! Index of SPx file.
33  INTEGER, INTENT(IN) :: L
34 ! Offset for use in post_mfix
35  INTEGER, INTENT(IN) :: UNIT_ADD
36 
37 ! Local Variables:
38 !----------------------------------------------------------------------!
39 ! File version ID
40  CHARACTER(LEN=512) :: VERSION
41 ! UNIT_SPX + offset from post_mfix
42  INTEGER :: USPX
43 ! Generic SPx end characters.
44  CHARACTER(len=15), PARAMETER :: EXT_END = '123456789ABCDEF'
45 
46 !......................................................................!
47 
48 ! Serial I/O: only PE_IO writes to a single file [default]
49 ! Distributed I/O: all ranks write their own output file.
50  IF(mype /= pe_io .AND. .NOT.bdist_io) RETURN
51 
52 ! Construct the file version string.
53  version = 'SPx = 02.00'
54  WRITE(version(3:3),"(A1)") ext_end(l:l)
55 
56 ! Calculate the SPx file unit
57  uspx = unit_spx + unit_add + l
58 
59 ! Write the SPx file header.
60  WRITE(uspx, rec=1) version
61  WRITE(uspx, rec=2) run_name, id_month, id_day, id_year, &
63 
64 ! The first field contains the pointer to the next record.
65 ! The second field contains the number of records written each time step
66 ! (The 4 and -1 are overwritten in WRITE_SPX1)
67  WRITE (uspx, rec=3) 4, -1
68 
69  IF(unit_add == 0) FLUSH(uspx)
70 
71  RETURN
72  END SUBROUTINE write_spx0
subroutine write_spx0(L, UNIT_ADD)
Definition: write_spx0.f:10
logical bdist_io
Definition: cdist_mod.f:4
integer id_month
Definition: machine_mod.f:22
character(len=60) run_name
Definition: run_mod.f:24
integer id_second
Definition: machine_mod.f:27
integer id_day
Definition: machine_mod.f:23
integer pe_io
Definition: compar_mod.f:30
integer id_year
Definition: machine_mod.f:24
integer id_minute
Definition: machine_mod.f:26
Definition: cdist_mod.f:2
integer, parameter unit_spx
Definition: funits_mod.f:30
Definition: run_mod.f:13
integer mype
Definition: compar_mod.f:24
integer id_hour
Definition: machine_mod.f:25