Skip to content

Commit

Permalink
Adds run paramaters to control SW decomposition
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-marques committed Aug 10, 2017
1 parent 58f78b9 commit 2582e0a
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ module ocn_comp_mct
use MOM_variables, only: surface
use MOM_error_handler, only: MOM_error, FATAL, is_root_pe
use MOM_time_manager, only: time_type, set_date, set_time, set_calendar_type, NOLEAP
use MOM_file_parser, only: get_param, log_version, param_file_type
use MOM_get_input, only: Get_MOM_Input, directories
use coupler_indices, only: coupler_indices_init, cpl_indices
use coupler_indices, only: ocn_export, fill_ice_ocean_bnd

Expand All @@ -54,8 +56,10 @@ module ocn_comp_mct
type(surface), pointer :: ocn_surface => NULL() !< The ocean surface state
type(ice_ocean_boundary_type) :: ice_ocean_boundary !< The ice ocean boundary type
type(seq_infodata_type), pointer :: infodata !< The input info type
type(cpl_indices), public :: ind !< Variable IDs

type(cpl_indices), public :: ind !< Variable IDs
! runtime params
logical :: sw_decomp !< Controls whether shortwave is decomposed into four components
real :: c1, c2, c3, c4 !< Coeffs. used in the shortwave decomposition
end type MCT_MOM_Data

type(MCT_MOM_Data) :: glb !< global structure
Expand Down Expand Up @@ -87,6 +91,11 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
logical :: ldiag_cpl = .false.
integer :: isc, iec, jsc, jec, ni, nj !< Indices for the start and end of the domain
!! in the x and y dir., respectively.
! runi-time params
type(param_file_type) :: param_file !< A structure to parse for run-time parameters
type(directories) :: dirs_tmp !< A structure containing several relevant directory paths
character(len=40) :: mdl = "ocn_comp_mct" !< This module's name.

! mct variables (these are local for now)
integer :: MOM_MCT_ID
type(mct_gsMap), pointer :: MOM_MCT_gsMap => NULL() !< 2d, points to cdata
Expand Down Expand Up @@ -181,6 +190,34 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
glb%ocn_public%pelist(:) = (/(i,i=pe0,pe0+npes)/)
! \todo Set other bits of glb$ocn_public

! This include declares and sets the variable "version".
! read useful runtime params
call get_MOM_Input(param_file, dirs_tmp, check_params=.false.)
!call log_version(param_file, mdl, version, "")
call get_param(param_file, mdl, "SW_DECOMP", glb%sw_decomp, &
"If True, read coeffs c1, c2, c3 and c4 and decompose" // &
"the net shortwave radiation (SW) into four components:\n" // &
"visible, direct shortwave = c1 * SW \n" // &
"visible, diffuse shortwave = c2 * SW \n" // &
"near-IR, direct shortwave = c3 * SW \n" // &
"near-IR, diffuse shortwave = c4 * SW", default=.true.)
if (glb%sw_decomp) then
call get_param(param_file, mdl, "SW_c1", glb%c1, &
"Coeff. used to convert net shortwave rad. into \n"//&
"visible, direct shortwave.", units="nondim", default=0.285)
call get_param(param_file, mdl, "SW_c2", glb%c2, &
"Coeff. used to convert net shortwave rad. into \n"//&
"visible, diffuse shortwave.", units="nondim", default=0.285)
call get_param(param_file, mdl, "SW_c3", glb%c3, &
"Coeff. used to convert net shortwave rad. into \n"//&
"near-IR, direct shortwave.", units="nondim", default=0.215)
call get_param(param_file, mdl, "SW_c4", glb%c4, &
"Coeff. used to convert net shortwave rad. into \n"//&
"near-IR, diffuse shortwave.", units="nondim", default=0.215)
else
glb%c1 = 0.0; glb%c2 = 0.0; glb%c3 = 0.0; glb%c4 = 0.0
endif

! Initialize the MOM6 model
call ocean_model_init(glb%ocn_public, glb%ocn_state, time_init, time_in)

Expand Down Expand Up @@ -237,7 +274,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
! \todo Need interface to get dt from MOM6
mom_cpl_dt = seconds_in_day / ncouple_per_day
if (mom_cpl_dt /= ocn_cpl_dt) then
write(*,*) 'ERROR pop_cpl_dt and ocn_cpl_dt must be identical'
write(*,*) 'ERROR mom_cpl_dt and ocn_cpl_dt must be identical'
call exit(0)
end if

Expand Down Expand Up @@ -349,7 +386,8 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
if (debug .and. is_root_pe()) write(6,*) 'ocn_run_mct, write_restart_at_eod=', write_restart_at_eod

! fill ice ocean boundary
call fill_ice_ocean_bnd(glb%ice_ocean_boundary, glb%grid, x2o_o%rattr, glb%ind)
call fill_ice_ocean_bnd(glb%ice_ocean_boundary, glb%grid, x2o_o%rattr, glb%ind, glb%sw_decomp, &
glb%c1, glb%c2, glb%c3, glb%c4)
if (debug .and. is_root_pe()) write(6,*) 'fill_ice_ocean_bnd'

call update_ocean_model(glb%ice_ocean_boundary, glb%ocn_state, glb%ocn_public, &
Expand Down

0 comments on commit 2582e0a

Please sign in to comment.