Skip to content

Commit

Permalink
Merge pull request #7 from adcroft/fix-mct-whitespace
Browse files Browse the repository at this point in the history
Cleans up white space
  • Loading branch information
alperaltuntas authored Jul 21, 2017
2 parents 5700d67 + a1db77f commit 7f2207c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 43 deletions.
58 changes: 29 additions & 29 deletions config_src/mct_driver/coupler_indices.F90
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module coupler_indices

! MCT types
use mct_mod, only : mct_aVect
! MCT fucntions
use mct_mod, only : mct_avect_indexra, mct_aVect_init, mct_aVect_clean
use seq_flds_mod, only : seq_flds_x2o_fields, seq_flds_o2x_fields
use seq_flds_mod, only : seq_flds_i2o_per_cat, ice_ncat
use seq_flds_mod, only : seq_flds_x2o_fields, seq_flds_o2x_fields
use seq_flds_mod, only : seq_flds_i2o_per_cat, ice_ncat

! MOM types
use MOM_grid, only : ocean_grid_type
Expand All @@ -25,7 +25,7 @@ module coupler_indices

! ocn -> drv

integer :: o2x_So_t
integer :: o2x_So_t
integer :: o2x_So_u
integer :: o2x_So_v
integer :: o2x_So_s
Expand All @@ -52,7 +52,7 @@ module coupler_indices
integer :: x2o_Foxx_tauy ! meridonal wind stress (tauy) (W/m2 )
integer :: x2o_Foxx_swnet ! net short-wave heat flux (W/m2 )
integer :: x2o_Foxx_sen ! sensible heat flux (W/m2 )
integer :: x2o_Foxx_lat
integer :: x2o_Foxx_lat
integer :: x2o_Foxx_lwup ! longwave radiation (up) (W/m2 )
integer :: x2o_Faxa_lwdn ! longwave radiation (down) (W/m2 )
integer :: x2o_Fioi_melth ! heat flux from snow & ice melt (W/m2 )
Expand All @@ -62,7 +62,7 @@ module coupler_indices
integer :: x2o_Fioi_flxdst ! flux: dust release from sea ice component
integer :: x2o_Fioi_salt ! salt (kg(salt)/m2/s)
integer :: x2o_Foxx_evap ! evaporation flux (kg/m2/s)
integer :: x2o_Faxa_prec
integer :: x2o_Faxa_prec
integer :: x2o_Faxa_snow ! water flux due to snow (kg/m2/s)
integer :: x2o_Faxa_rain ! water flux due to rain (kg/m2/s)
integer :: x2o_Faxa_bcphidry ! flux: Black Carbon hydrophilic dry deposition
Expand All @@ -88,7 +88,7 @@ module coupler_indices
integer, dimension(:), allocatable :: x2o_fracr_col ! fraction of ocean cell used in radiation computations, per column
integer, dimension(:), allocatable :: x2o_qsw_fracr_col ! qsw * fracr, per column

real, dimension(:,:,:),allocatable :: time_avg_sbuffer !< time averages of send buffer
real, dimension(:,:,:),allocatable :: time_avg_sbuffer !< time averages of send buffer
real :: accum_time !< time for accumulation

end type cpl_indices
Expand All @@ -109,7 +109,7 @@ subroutine coupler_indices_init(ind)
integer :: ncat ! thickness category index
character(len=2) :: cncat ! character version of ncat
integer :: ncol ! column index
integer :: mcog_ncols
integer :: mcog_ncols
integer :: lmcog_flds_sent

! Determine attribute vector indices
Expand Down Expand Up @@ -144,15 +144,15 @@ subroutine coupler_indices_init(ind)
ind%x2o_Foxx_sen = mct_avect_indexra(x2o,'Foxx_sen')
ind%x2o_Foxx_lwup = mct_avect_indexra(x2o,'Foxx_lwup')
ind%x2o_Faxa_lwdn = mct_avect_indexra(x2o,'Faxa_lwdn')
ind%x2o_Fioi_melth = mct_avect_indexra(x2o,'Fioi_melth')
ind%x2o_Fioi_melth = mct_avect_indexra(x2o,'Fioi_melth')
ind%x2o_Fioi_meltw = mct_avect_indexra(x2o,'Fioi_meltw')
ind%x2o_Fioi_salt = mct_avect_indexra(x2o,'Fioi_salt')
ind%x2o_Fioi_salt = mct_avect_indexra(x2o,'Fioi_salt')
ind%x2o_Fioi_bcpho = mct_avect_indexra(x2o,'Fioi_bcpho')
ind%x2o_Fioi_bcphi = mct_avect_indexra(x2o,'Fioi_bcphi')
ind%x2o_Fioi_flxdst = mct_avect_indexra(x2o,'Fioi_flxdst')
ind%x2o_Faxa_prec = mct_avect_indexra(x2o,'Faxa_prec')
ind%x2o_Faxa_snow = mct_avect_indexra(x2o,'Faxa_snow')
ind%x2o_Faxa_rain = mct_avect_indexra(x2o,'Faxa_rain')
ind%x2o_Faxa_prec = mct_avect_indexra(x2o,'Faxa_prec')
ind%x2o_Faxa_snow = mct_avect_indexra(x2o,'Faxa_snow')
ind%x2o_Faxa_rain = mct_avect_indexra(x2o,'Faxa_rain')
ind%x2o_Foxx_evap = mct_avect_indexra(x2o,'Foxx_evap')
ind%x2o_Foxx_rofl = mct_avect_indexra(x2o,'Foxx_rofl')
ind%x2o_Foxx_rofi = mct_avect_indexra(x2o,'Foxx_rofi')
Expand Down Expand Up @@ -220,9 +220,9 @@ subroutine alloc_sbuffer(ind, grid, nsend)

end subroutine alloc_sbuffer


subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)

type(cpl_indices), intent(inout) :: ind !< module control structure
type(ocean_grid_type), intent(inout) :: grid !< ocean grid (inout in order to do halo update)
type(surface), intent(in) :: surf_state !< ocean surface state
Expand All @@ -231,7 +231,7 @@ subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)
logical, optional, intent(in) :: last !< if present and true, divide by accumulated time

! local variables
integer :: i,j,nvar
integer :: i,j,nvar
real :: rtime, slp_L, slp_R, slp_C, u_min, u_max, slope
real, dimension(grid%isd:grid%ied, grid%jsd:grid%jed) :: ssh

Expand All @@ -240,30 +240,30 @@ subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)
ind%time_avg_sbuffer(:,:,:) = 0.
ind%accum_time = 0.
end if
end if
end if

! sst
nvar = ind%o2x_So_t
nvar = ind%o2x_So_t
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar)+dt * surf_state%sst(i,j)
end do; end do

! sss
nvar = ind%o2x_So_s
nvar = ind%o2x_So_s
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar)+dt * surf_state%sss(i,j)
end do; end do


! u
nvar = ind%o2x_So_u
nvar = ind%o2x_So_u
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar)+dt * &
0.5*(surf_state%u(I,j)+surf_state%u(I-1,j))
end do; end do

! v
nvar = ind%o2x_So_v
nvar = ind%o2x_So_v
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar)+dt * &
0.5*(surf_state%v(i,J)+surf_state%v(i,J-1))
Expand All @@ -274,7 +274,7 @@ subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)
ssh(i,j) = surf_state%sea_lev(i,j)
end do; end do
call pass_var(ssh, grid%domain)

! d/dx ssh
nvar = ind%o2x_So_dhdx
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
Expand All @@ -298,7 +298,7 @@ subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)
end if
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar) + dt * slope * grid%IdxT(i,j) * grid%mask2dT(i,j)
end do; end do

! d/dy ssh
nvar = ind%o2x_So_dhdy
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
Expand All @@ -322,17 +322,17 @@ subroutine time_avg_state(ind, grid, surf_state, dt, reset, last)
end if
ind%time_avg_sbuffer(i,j,nvar) = ind%time_avg_sbuffer(i,j,nvar) + dt * slope * grid%IdyT(i,j) * grid%mask2dT(i,j)
end do; end do

! Divide by total accumulated time
ind%accum_time = ind%accum_time + dt
ind%accum_time = ind%accum_time + dt
if (present(last)) then

!! \todo Do dhdx,dhdy need to be rotated before sending to the coupler?
!! \todo Do u,v need to be rotated before sending to the coupler?

rtime = 1./ind%accum_time
if (last) ind%time_avg_sbuffer(:,:,:) = ind%time_avg_sbuffer(:,:,:) * rtime
end if
end if

end subroutine time_avg_state

Expand All @@ -344,7 +344,7 @@ subroutine ocn_export(ind, grid, o2x)
real(kind=8), intent(inout) :: o2x(:,:)

integer :: i, j, n

n = 0
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
n = n+1
Expand Down
10 changes: 5 additions & 5 deletions config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module ocn_comp_mct
use MOM_error_handler, only: MOM_error, FATAL, is_root_pe
use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP
use coupler_indices, only: coupler_indices_init, cpl_indices, alloc_sbuffer, time_avg_state
use ocn_import_export, only: ocn_Export
use ocn_import_export, only: ocn_Export

!
! !PUBLIC MEMBER FUNCTIONS:
Expand All @@ -66,7 +66,7 @@ module ocn_comp_mct
private :: ocn_domain_mct

! !PRIVATE MODULE VARIABLES
type MCT_MOM_Data
type MCT_MOM_Data
type(ocean_state_type), pointer :: ocn_state => NULL() !< Private state of ocean
type(ocean_public_type), pointer :: ocn_public => NULL() !< Public state of ocean
type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure
Expand All @@ -76,7 +76,7 @@ module ocn_comp_mct

type(cpl_indices), public :: ind !< Variable IDs

end type
end type
type(MCT_MOM_Data) :: glb

!=======================================================================
Expand Down Expand Up @@ -263,7 +263,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
if (debug .and. root_pe().eq.pe_here()) print *, "calling alloc_sbuffer()", nsend

call alloc_sbuffer(glb%ind,glb%grid,nsend)


! initialize necessary coupling info

Expand All @@ -284,7 +284,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
! end if

if (debug .and. root_pe().eq.pe_here()) print *, "calling momo_sum_buffer"

! Reset time average of send buffer
call time_avg_state(glb%ind, glb%grid, glb%ocn_surface, 1., reset=.true., last=.true.)

Expand Down
18 changes: 9 additions & 9 deletions config_src/mct_driver/ocn_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module ocn_import_export
save

! accumulated sum of send buffer quantities for averaging before being sent
!real (r8), dimension(:,:,:,:), allocatable :: SBUFF_SUM
!real (r8) :: tlast_coupled
!real (r8), dimension(:,:,:,:), allocatable :: SBUFF_SUM
!real (r8) :: tlast_coupled

!TODO: update the types of following vars
double precision, dimension(:,:,:,:), allocatable :: SBUFF_SUM
double precision :: tlast_coupled
double precision, dimension(:,:,:,:), allocatable :: SBUFF_SUM
double precision :: tlast_coupled
contains

!***********************************************************************
Expand All @@ -25,7 +25,7 @@ subroutine ocn_import(x2o, ldiag_cpl, errorCode)
! This routine receives message from cpl7 driver
!
! The following fields are always received from the coupler:
!
!
! o taux -- zonal wind stress (taux) (W/m2 )
! o tauy -- meridonal wind stress (tauy) (W/m2 )
! o snow -- water flux due to snow (kg/m2/s)
Expand All @@ -41,15 +41,15 @@ subroutine ocn_import(x2o, ldiag_cpl, errorCode)
! o ifrac -- ice fraction
! o rofl -- river runoff flux (kg/m2/s)
! o rofi -- ice runoff flux (kg/m2/s)
!
!
! The following fields are sometimes received from the coupler,
! depending on model options:
!
!
! o pslv -- sea-level pressure (Pa)
! o duu10n -- 10m wind speed squared (m^2/s^2)
! o co2prog-- bottom atm level prognostic co2
! o co2diag-- bottom atm level diagnostic co2
!
!
!-----------------------------------------------------------------------
!
! !REVISION HISTORY:
Expand Down Expand Up @@ -93,7 +93,7 @@ end subroutine ocn_import
! !IROUTINE: ocn_export_mct
! !INTERFACE:

subroutine ocn_export(o2x, ldiag_cpl, errorCode)
subroutine ocn_export(o2x, ldiag_cpl, errorCode)

! !DESCRIPTION:
! This routine calls the routines necessary to send MOM6 fields to
Expand Down

0 comments on commit 7f2207c

Please sign in to comment.