Skip to content

Commit

Permalink
Revised stdout "MOM Day format"
Browse files Browse the repository at this point in the history
- If the calendar_type() is a calendar (as opposed to "no_calender" which
  is set via the ocean_solo_nml name list used in ocean_only mode), the
  MOM Day line in the stdout stream now reports the date/time in a
  YYYYYY/MM/DD hh:mm:ss format.
- timestats format has not been changed.
- Addresses issue #200, although SIS2 needs to be similarly updated.
- No answer changes.
  • Loading branch information
adcroft committed Jul 17, 2015
1 parent 2a09234 commit 7f5be9a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
36 changes: 27 additions & 9 deletions src/diagnostics/MOM_sum_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ module MOM_sum_output
use MOM_io, only : create_file, fieldtype, flush_file, open_file, reopen_file
use MOM_io, only : file_exists, slasher, vardesc, write_field
use MOM_io, only : APPEND_FILE, ASCII_FILE, SINGLE_FILE, WRITEONLY_FILE
use MOM_time_manager, only : time_type, get_time, set_time, operator(>), operator(-)
use MOM_time_manager, only : time_type, get_time, get_date, set_time, operator(>), operator(-)
use MOM_time_manager, only : get_calendar_type, NO_CALENDAR
use MOM_tracer_flow_control, only : tracer_flow_control_CS, call_tracer_stocks
use MOM_variables, only : surface, thermo_var_ptrs

Expand Down Expand Up @@ -395,6 +396,7 @@ subroutine write_energy(u, v, h, tv, day, n, G, CS, tracer_CSp)
integer :: nTr_stocks
real, allocatable :: toten_PE(:)
integer :: pe_num
integer :: iyear, imonth, iday, ihour, iminute, isecond, itick ! For call to get_date()

! A description for output of each of the fields.
type(vardesc) :: vars(NUM_FIELDS+MAX_FIELDS_)
Expand Down Expand Up @@ -789,6 +791,7 @@ subroutine write_energy(u, v, h, tv, day, n, G, CS, tracer_CSp)
En_mass = toten / mass_tot

call get_time(day, start_of_day, num_days)
call get_date(day, iyear, imonth, iday, ihour, iminute, isecond, itick)
if (abs(CS%timeunit - 86400.0) < 1.0) then
reday = REAL(num_days)+ (REAL(start_of_day)/86400.0)
mesg_intro = "MOM Day "
Expand All @@ -808,15 +811,30 @@ subroutine write_energy(u, v, h, tv, day, n, G, CS, tracer_CSp)

if (is_root_pe()) then
if (CS%use_temperature) then
write(*,'(A,A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12, ", Salt ", F15.11,", Temp ", F15.11)') &
trim(mesg_intro), trim(day_str(1:3))//trim(day_str(4:)), trim(n_str), &
En_mass, max_CFL(1), mass_tot, salin, temp
if (get_calendar_type() == NO_CALENDAR) then
write(*,'(A,A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12, ", Salt ", F15.11,", Temp ", F15.11)') &
trim(mesg_intro), trim(day_str(1:3))//trim(day_str(4:)), trim(n_str), &
En_mass, max_CFL(1), mass_tot, salin, temp
else
write(*,'("MOM Date",i7,2("/",i2.2)," ",i2.2,2(":",i2.2)," ", &
& A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12, ", Salt ", F15.11,", Temp ", F15.11)') &
iyear, imonth, iday, ihour, iminute, isecond, &
trim(n_str), En_mass, max_CFL(1), mass_tot, salin, temp
endif
else
write(*,'(A,A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12)') &
trim(mesg_intro), trim(day_str(1:3))//trim(day_str(4:)), trim(n_str), &
En_mass, max_CFL(1), mass_tot
if (get_calendar_type() == NO_CALENDAR) then
write(*,'(A,A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12)') &
trim(mesg_intro), trim(day_str(1:3))//trim(day_str(4:)), trim(n_str), &
En_mass, max_CFL(1), mass_tot
else
write(*,'("MOM Date",i7,2("/",i2.2)," ",i2.2,2(":",i2.2)," ", &
& A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ",ES18.12)') &
iyear, imonth, iday, ihour, iminute, isecond, &
trim(n_str), En_mass, max_CFL(1), mass_tot
endif
endif

if (CS%use_temperature) then
Expand Down
6 changes: 4 additions & 2 deletions src/framework/MOM_time_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module MOM_time_manager
use time_manager_mod, only : operator(==), operator(/=), operator(//)
use time_manager_mod, only : set_ticks_per_second , get_ticks_per_second
use time_manager_mod, only : get_date, set_date, increment_date
use time_manager_mod, only : set_calendar_type, days_in_month, month_name
use time_manager_mod, only : days_in_month, month_name
use time_manager_mod, only : set_calendar_type, get_calendar_type
use time_manager_mod, only : JULIAN, NOLEAP, THIRTY_DAY_MONTHS, NO_CALENDAR

implicit none ; private
Expand All @@ -26,6 +27,7 @@ module MOM_time_manager
public :: operator(>), operator(<), operator(>=), operator(<=)
public :: operator(==), operator(/=), operator(//)
public :: get_date, set_date, increment_date, month_name, days_in_month
public :: set_calendar_type, JULIAN, NOLEAP, THIRTY_DAY_MONTHS, NO_CALENDAR
public :: JULIAN, NOLEAP, THIRTY_DAY_MONTHS, NO_CALENDAR
public :: set_calendar_type, get_calendar_type

end module MOM_time_manager

0 comments on commit 7f5be9a

Please sign in to comment.