ROMS
Loading...
Searching...
No Matches
stdout_mod Module Reference

Functions/Subroutines

integer function, public stdout_unit (mymaster)
 

Variables

logical, save set_stdoutunit = .TRUE.
 

Function/Subroutine Documentation

◆ stdout_unit()

integer function, public stdout_mod::stdout_unit ( logical, intent(in) mymaster)

Definition at line 47 of file stdout_mod.F.

48!
49!***********************************************************************
50! !
51! This function determines ROMS standard output unit to write its !
52! running verbose information. !
53! !
54! On Input: !
55! !
56! MyMaster Switch indicating Master process (logical) !
57! !
58! On Output: !
59! !
60! StdOutUnit Assigned standard output unit (integer; default=6) !
61! !
62!***********************************************************************
63!
64! Imported variable declarations.
65!
66 logical, intent(in) :: MyMaster
67!
68! Local variable declararions
69!
70 integer :: io_err
71 integer :: StdOutUnit
72!
73 character (len=10 ) :: stdout_file
74 character (len=256) :: io_errmsg
75 character (len=*), parameter :: MyFile = &
76 & __FILE__//", stdout_unit"
77!
78 sourcefile=myfile
79!
80!-----------------------------------------------------------------------
81! Set ROMS standard input unit. If requested, set and open standard
82! output file for writing.
83!-----------------------------------------------------------------------
84
85#ifdef ROMS_STDOUT
86!
87! Set the Fortran standard output unit (default unit 6) to direct the
88! ROMS run information to a specific filename. It is advantageous in
89! coupling or disjointed applications that need ROMS information
90! separated from other components.
91!
92# if defined DISTRIBUTE && defined DISJOINTED
93 stdoutunit=60+forkcolor
94 WRITE (stdout_file,'(a,i2.2,a)') 'log', forkcolor+1, '.roms'
95# else
96 stdoutunit=60
97 stdout_file='log.roms'
98# endif
99#else
100!
101! Set default standard output unit in Fortran.
102!
103 stdoutunit=6
104#endif
105
106#ifdef ROMS_STDOUT
107!
108!-----------------------------------------------------------------------
109! Open ROMS standard output file.
110!-----------------------------------------------------------------------
111!
112 io_err=0
113 IF (lappend) THEN
114 OPEN (stdoutunit, file=trim(stdout_file), &
115 & form='formatted', status='old', position='append', &
116 & action='write', iostat=io_err, iomsg=io_errmsg)
117 ELSE
118 OPEN (stdoutunit, file=trim(stdout_file), &
119 & form='formatted', status='replace', &
120 & iostat=io_err, iomsg=io_errmsg)
121 END IF
122 IF (io_err.ne.0) THEN
123 IF (mymaster) WRITE (stdoutunit,10) trim(stdout_file), &
124 & trim(io_errmsg)
125 exit_flag=5
126 10 FORMAT (/,' STDOUT_UNIT - Cannot open standard output file: ', &
127 & a,/,15x,'ERROR: ',a)
128 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
129 END IF
130#endif
131!

References mod_scalars::exit_flag, strings_mod::founderror(), mod_scalars::lappend, mod_parallel::mymaster, mod_scalars::noerror, and mod_iounits::sourcefile.

Referenced by mod_esmf_esm::read_esmconfig(), roms_kernel_mod::roms_initialize(), roms_kernel_mod::roms_initializep1(), and cmeps_roms_mod::roms_setinitializep1().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ set_stdoutunit

logical, save stdout_mod::set_stdoutunit = .TRUE.