!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! !! GNU General Public License !! !! !! !! This file is part of the Flexible Modeling System (FMS). !! !! !! !! FMS is free software; you can redistribute it and/or modify !! !! it and are expected to follow the terms of the GNU General Public !! !! License as published by the Free Software Foundation. !! !! !! !! FMS is distributed in the hope that it will be useful, !! !! but WITHOUT ANY WARRANTY; without even the implied warranty of !! !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !! !! GNU General Public License for more details. !! !! !! !! You should have received a copy of the GNU General Public License !! !! along with FMS; if not, write to: !! !! Free Software Foundation, Inc. !! !! 59 Temple Place, Suite 330 !! !! Boston, MA 02111-1307 USA !! !! or see: !! !! http://www.gnu.org/licenses/gpl.txt !! !! !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! module ocean_diagnostics_mod ! ! S.M. Griffies ! ! ! ! Routine that calls the various numerical diagnostics. ! ! ! ! Routine that calls the various numerical diagnostics. ! ! use diag_manager_mod, only: need_data use fms_mod, only: open_namelist_file, check_nml_error, close_file, write_version_number use fms_mod, only: FATAL, stdout, stdlog use mpp_mod, only: mpp_error use mpp_mod, only: mpp_clock_id, mpp_clock_begin, mpp_clock_end, CLOCK_MODULE use time_manager_mod, only: time_type, increment_time use ocean_adv_vel_diag_mod, only: ocean_adv_vel_diag_init, ocean_adv_vel_diagnostics use ocean_domains_mod, only: get_local_indices use ocean_tracer_diag_mod, only: ocean_tracer_diag_init, ocean_tracer_diagnostics use ocean_types_mod, only: ocean_prog_tracer_type, ocean_diag_tracer_type use ocean_types_mod, only: ocean_domain_type, ocean_grid_type use ocean_types_mod, only: ocean_adv_vel_type, ocean_velocity_type use ocean_types_mod, only: ocean_time_type, ocean_time_steps_type use ocean_types_mod, only: ocean_external_mode_type, ocean_density_type use ocean_types_mod, only: ocean_thickness_type use ocean_velocity_diag_mod, only: ocean_velocity_diag_init, ocean_velocity_diagnostics implicit none private #include integer :: num_prog_tracers = 0 integer :: index_temp = -1 integer :: index_salt = -1 ! for diagnostics clocks integer :: id_adv_vel_diag integer :: id_tracer_diag integer :: id_velocity_diag logical :: module_is_initialized = .FALSE. character(len=128) :: version=& '$Id: ocean_diagnostics.F90,v 16.0.70.1.22.1 2009/10/10 00:42:08 nnz Exp $' character (len=128) :: tagname = & '$Name: mom4p1_pubrel_dec2009_nnz $' public :: ocean_diag_init, ocean_diagnostics contains !####################################################################### ! ! ! ! Initialize the ocean_diag module. ! ! subroutine ocean_diag_init(Grid, Domain, Time, Time_steps, T_prog, T_diag, Dens, & vert_coordinate_class, have_obc, cmip_units) type(ocean_grid_type), intent(in) :: Grid type(ocean_domain_type), intent(in) :: Domain type(ocean_time_type), intent(in) :: Time type(ocean_time_steps_type), intent(in) :: Time_steps type(ocean_prog_tracer_type), intent(in) :: T_prog(:) type(ocean_diag_tracer_type), intent(in) :: T_diag(:) type(ocean_density_type), intent(in) :: Dens integer, intent(in) :: vert_coordinate_class logical, intent(in) :: have_obc logical, intent(in) :: cmip_units integer :: n integer :: stdoutunit,stdlogunit stdoutunit=stdout();stdlogunit=stdlog() module_is_initialized = .TRUE. call write_version_number(version, tagname) !ioun = open_namelist_file() !read(ioun, ocean_diag_nml, iostat=io_status) !write (stdlogunit, ocean_diag_nml) !write (stdoutunit, ocean_diag_nml) !ierr = check_nml_error(io_status,'ocean_diag_nml') !call close_file(ioun) #ifndef MOM4_STATIC_ARRAYS call get_local_indices(Domain, isd, ied, jsd, jed, isc, iec, jsc, jec) nk = Grid%nk #endif num_prog_tracers = size(T_prog, 1) do n = 1, num_prog_tracers if (trim(T_prog(n)%name) == 'temp') index_temp = n if (trim(T_prog(n)%name) == 'salt') index_salt = n enddo if (index_temp < 1 .or. index_salt < 1) then call mpp_error(FATAL,'==>Error in ocean_diagnostics_mod (ocean_diag_init): temp and/or salt not in tracer array') endif id_adv_vel_diag = mpp_clock_id('(Ocean diagnostics: adv_vel)' ,grain=CLOCK_MODULE) id_tracer_diag = mpp_clock_id('(Ocean diagnostics: tracer)' ,grain=CLOCK_MODULE) id_velocity_diag = mpp_clock_id('(Ocean diagnostics: velocity)' ,grain=CLOCK_MODULE) call ocean_adv_vel_diag_init (Grid, Domain, Time, Time_steps, T_prog, Dens, cmip_units) call ocean_tracer_diag_init (Grid, Domain, Time, Time_steps, T_prog, T_diag, Dens, & vert_coordinate_class, have_obc) call ocean_velocity_diag_init(Grid, Domain, Time, Time_steps) end subroutine ocean_diag_init ! NAME="ocean_diag_init" !####################################################################### ! ! ! ! Call some ocean numerical diagnostics ! ! subroutine ocean_diagnostics(Time, Thickness, T_prog, T_diag, Adv_vel, Ext_mode, Dens, Velocity, & pme, melt, runoff, calving, visc_cbu) type(ocean_time_type), intent(in) :: Time type(ocean_thickness_type), intent(in) :: Thickness type(ocean_prog_tracer_type), intent(in) :: T_prog(:) type(ocean_diag_tracer_type), intent(in) :: T_diag(:) type(ocean_adv_vel_type), intent(in) :: Adv_vel type(ocean_external_mode_type), intent(in) :: Ext_mode type(ocean_density_type), intent(in) :: Dens type(ocean_velocity_type), intent(inout) :: Velocity real, dimension(isd:,jsd:), intent(in) :: pme real, dimension(isd:,jsd:), intent(in) :: melt real, dimension(isd:,jsd:), intent(in) :: runoff real, dimension(isd:,jsd:), intent(in) :: calving real, dimension(isd:,jsd:,:), intent(in) :: visc_cbu if (size(T_prog,1) /= num_prog_tracers) then call mpp_error(FATAL, '==>Error from ocean_diagnostics_mod (ocean_diagnostics): wrong size for tracer array') endif call mpp_clock_begin(id_adv_vel_diag) call ocean_adv_vel_diagnostics(Time, Thickness, Adv_vel, T_prog, Dens, visc_cbu) call mpp_clock_end(id_adv_vel_diag) call mpp_clock_begin(id_tracer_diag) call ocean_tracer_diagnostics(Time, Thickness, T_prog, T_diag, Dens, & Ext_mode, Velocity, Adv_vel, pme, melt, runoff, calving) call mpp_clock_end(id_tracer_diag) call mpp_clock_begin(id_velocity_diag) call ocean_velocity_diagnostics(Time, Thickness, Dens, Velocity) call mpp_clock_end(id_velocity_diag) end subroutine ocean_diagnostics ! NAME="ocean_diagnostics" end module ocean_diagnostics_mod