Skip to content

Commit

Permalink
+Use new coupler_type routines in the SIS2 code
Browse files Browse the repository at this point in the history
  Replaced extensive code blocks going through the detailed elements of the
coupler_types with equivalent calls to the new subroutines that have been
introduced to more succinctly perform tasks on the coupler types.  All answers
are bitwise identical, but this requires the new interfaces that have been
introduced on the coupler_type_reform_rwh branch of the FMS code.
  • Loading branch information
Hallberg-NOAA committed Jul 20, 2017
1 parent 65b1d23 commit 3209acc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
22 changes: 7 additions & 15 deletions src/combined_ice_ocean_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ module combined_ice_ocean_driver
use ocean_model_mod, only : update_ocean_model, ocean_model_end! , ocean_model_init
use ocean_model_mod, only : ocean_public_type, ocean_state_type, ice_ocean_boundary_type

use coupler_types_mod, only: coupler_type_send_data, coupler_type_data_override
use coupler_types_mod, only: coupler_type_copy_data, coupler_type_redistribute_data
use data_override_mod, only : data_override
use diag_manager_mod, only : send_data
use mpp_domains_mod, only : domain2D, mpp_get_layout, mpp_get_compute_domain

implicit none ; private

public update_slow_ice_and_ocean, ice_ocean_driver_init, ice_ocean_driver_end
public :: update_slow_ice_and_ocean, ice_ocean_driver_init, ice_ocean_driver_end

type, public :: ice_ocean_driver_type ; private
logical :: CS_is_initialized = .false.
Expand Down Expand Up @@ -247,12 +249,7 @@ subroutine direct_flux_ice_to_IOB( Time, Ice, IOB )
if (ASSOCIATED(IOB%q_flux)) IOB%q_flux(:,:) = Ice%flux_q(:,:)

! Extra fluxes
do n=1,IOB%fluxes%num_bcs ; do m=1,IOB%fluxes%bc(n)%num_fields
if ( associated(IOB%fluxes%bc(n)%field(m)%values) ) then
IOB%fluxes%bc(n)%field(m)%values(:,:) = Ice%ocean_fluxes%bc(n)%field(m)%values(:,:)
endif
enddo ; enddo

call coupler_type_copy_data(Ice%ocean_fluxes, IOB%fluxes)

! These lines allow the data override code to reset the fluxes to the ocean.
call data_override('OCN', 'u_flux', IOB%u_flux , Time )
Expand Down Expand Up @@ -282,14 +279,9 @@ subroutine direct_flux_ice_to_IOB( Time, Ice, IOB )
call data_override('OCN', 'mass_berg', IOB%mass_berg , Time)

! Override and output extra fluxes of tracers or gasses
do n=1,IOB%fluxes%num_bcs ; do m=1,IOB%fluxes%bc(n)%num_fields
call data_override('OCN', IOB%fluxes%bc(n)%field(m)%name, &
IOB%fluxes%bc(n)%field(m)%values, Time)

! Perform diagnostic output for the extra fluxes
used = send_data(IOB%fluxes%bc(n)%field(m)%id_diag, &
IOB%fluxes%bc(n)%field(m)%values, Time)
enddo ; enddo
call coupler_type_data_override('OCN', IOB%fluxes, Time )

call coupler_type_send_data(IOB%fluxes, Time )

end subroutine direct_flux_ice_to_IOB

Expand Down
11 changes: 2 additions & 9 deletions src/ice_boundary_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
module ice_boundary_types

use coupler_types_mod, only : coupler_2d_bc_type, coupler_3d_bc_type
use coupler_types_mod, only : coupler_2d_bc_type, coupler_3d_bc_type, coupler_type_write_chksums
use fms_mod, only : stdout
use mpp_mod, only : mpp_chksum
use mpp_parameter_mod, only : CGRID_NE, BGRID_NE, AGRID
Expand Down Expand Up @@ -125,14 +125,7 @@ subroutine ocn_ice_bnd_type_chksum(id, timestep, bnd_type)
! write(outunit,100) 'ocn_ice_bnd_type%data ',mpp_chksum(bnd_type%data )
100 FORMAT("CHECKSUM::",A32," = ",Z20)

do n = 1, bnd_type%fields%num_bcs !{
do m = 1, bnd_type%fields%bc(n)%num_fields !{
write(outunit,101) 'oibt%',trim(bnd_type%fields%bc(n)%name), &
trim(bnd_type%fields%bc(n)%field(m)%name), &
mpp_chksum(bnd_type%fields%bc(n)%field(m)%values)
enddo !} m
enddo !} n
101 FORMAT("CHECKSUM::",A16,a,'%',a," = ",Z20)
call coupler_type_write_chksums(bnd_type%fields, outunit, 'oibt%')

end subroutine ocn_ice_bnd_type_chksum

Expand Down
9 changes: 2 additions & 7 deletions src/ice_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module ice_type_mod
use fms_io_mod, only: save_restart, restore_state, query_initialized
use fms_io_mod, only: register_restart_field, restart_file_type
use time_manager_mod, only: time_type, time_type_to_real
use coupler_types_mod,only: coupler_2d_bc_type, coupler_3d_bc_type
use coupler_types_mod,only: coupler_2d_bc_type, coupler_3d_bc_type, coupler_type_write_chksums

use SIS_hor_grid, only : SIS_hor_grid_type
use ice_grid, only : ice_grid_type
Expand Down Expand Up @@ -598,11 +598,7 @@ subroutine ice_data_type_chksum(id, timestep, Ice)
write(outunit,100) 'ice_data_type%u_surf ',mpp_chksum(Ice%u_surf )
write(outunit,100) 'ice_data_type%v_surf ',mpp_chksum(Ice%v_surf )

do n=1,Ice%ocean_fields%num_bcs ; do m=1,Ice%ocean_fields%bc(n)%num_fields
write(outunit,101) 'ice%', trim(Ice%ocean_fields%bc(n)%name), &
trim(Ice%ocean_fields%bc(n)%field(m)%name), &
mpp_chksum(Ice%ocean_fields%bc(n)%field(m)%values)
enddo ; enddo
call coupler_type_write_chksums(Ice%ocean_fields, outunit, 'ice%')
endif

if (Ice%slow_ice_PE) then
Expand Down Expand Up @@ -633,7 +629,6 @@ subroutine ice_data_type_chksum(id, timestep, Ice)
endif

100 FORMAT(" CHECKSUM::",A32," = ",Z20)
101 FORMAT(" CHECKSUM::",A16,a,'%',a," = ",Z20)

end subroutine ice_data_type_chksum

Expand Down

0 comments on commit 3209acc

Please sign in to comment.