Skip to content

Commit

Permalink
Set coupler_type ind_... variables in declarations
Browse files Browse the repository at this point in the history
  Set the coupler_type sub-element indicies (like ind_flux) in their
declarations.  These should be turned into parameters with the next FMS city
release, but this would interfere with certain openMP directives.
coupler_types_init no longer sets anything related to the coupler_types module,
and it should be extracted and moved into a more logical module with the next
FMS city release.  All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Aug 7, 2017
1 parent f46fcc3 commit d4865fa
Showing 1 changed file with 24 additions and 84 deletions.
108 changes: 24 additions & 84 deletions coupler/coupler_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,22 @@ module coupler_types_mod

!
!----------------------------------------------------------------------
!

! The quality of documentation in these comments is pathetic.
integer, public :: ind_u10 !< ind_u10
integer, public :: ind_psurf !< ind_psurf
integer, public :: ind_pcair !< ind_pcair
integer, public :: ind_csurf !< ind_csurf
integer, public :: ind_alpha !< The index of the solubility array for a tracer
integer, public :: ind_sc_no !< The index for the Schmidt number for a tracer flux
integer, public :: ind_flux !< The index for the tracer flux
integer, public :: ind_deltap !< ind_deltap
integer, public :: ind_kw !< ind_kw
integer, public :: ind_deposition !< ind_deposition
integer, public :: ind_runoff !< ind_runoff
! The following public parameters can help in selecting the sub-elements of a
! coupler type. There are duplicate values because different boundary
! conditions have different sub-elements.
! Note: These should be parameters, but doing so would break openMP directives.

integer, public :: ind_pcair = 1 !< The index of the atmospheric concentration
integer, public :: ind_u10 = 2 !< The index of the 10 m wind speed
integer, public :: ind_psurf = 3 !< The index of the surface atmospheric pressure
integer, public :: ind_alpha = 1 !< The index of the solubility array for a tracer
integer, public :: ind_csurf = 2 !< The index of the ocean surface concentration
integer, public :: ind_sc_no = 3 !< The index for the Schmidt number for a tracer flux
integer, public :: ind_flux = 1 !< The index for the tracer flux
integer, public :: ind_deltap= 2 !< The index for ocean-air gas partial pressure change
integer, public :: ind_kw = 3 !< The index for the piston velocity
integer, public :: ind_deposition = 1 !< The index for the atmospheric deposition flux
integer, public :: ind_runoff = 1 !< The index for a runoff flux

!----------------------------------------------------------------------
! Interface definitions for overloaded routines
Expand Down Expand Up @@ -534,8 +536,8 @@ subroutine coupler_types_init
!-----------------------------------------------------------------------
!

integer :: field_index, outunit
character(len=128) :: error_msg
integer :: outunit
character(len=128) :: error_msg
logical, save :: module_is_initialized = .false.

!
Expand Down Expand Up @@ -628,22 +630,14 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux_generic/atm" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_pcair = field_index
call fm_util_set_value('air_sea_gas_flux_generic/atm/name', 'pcair', index = ind_pcair)
call fm_util_set_value('air_sea_gas_flux_generic/atm/long_name', 'Atmospheric concentration', index = ind_pcair)
call fm_util_set_value('air_sea_gas_flux_generic/atm/units', 'mol/mol', index = ind_pcair)

field_index = field_index + 1
ind_u10 = field_index
call fm_util_set_value('air_sea_gas_flux_generic/atm/name', 'u10', index = ind_u10)
call fm_util_set_value('air_sea_gas_flux_generic/atm/long_name', 'Wind speed at 10 m', index = ind_u10)
call fm_util_set_value('air_sea_gas_flux_generic/atm/units', 'm/s', index = ind_u10)

field_index = field_index + 1
ind_psurf = field_index
call fm_util_set_value('air_sea_gas_flux_generic/atm/name', 'psurf', index = ind_psurf)
call fm_util_set_value('air_sea_gas_flux_generic/atm/long_name', 'Surface atmospheric pressure', index = ind_psurf)
call fm_util_set_value('air_sea_gas_flux_generic/atm/units', 'Pa', index = ind_psurf)
Expand All @@ -654,48 +648,32 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux_generic/ice" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_alpha = field_index
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'alpha', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'alpha', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux_generic/ice/long_name', 'Solubility w.r.t. atmosphere', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'mol/m^3/atm', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'mol/m^3/atm', index = ind_alpha)

field_index = field_index + 1
ind_csurf = field_index
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'csurf', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'csurf', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux_generic/ice/long_name', 'Ocean concentration', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'mol/m^3', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'mol/m^3', index = ind_csurf)

field_index = field_index + 1
ind_sc_no = field_index
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'sc_no', index = ind_sc_no)
call fm_util_set_value('air_sea_gas_flux_generic/ice/name', 'sc_no', index = ind_sc_no)
call fm_util_set_value('air_sea_gas_flux_generic/ice/long_name', 'Schmidt number', index = ind_sc_no)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'dimensionless', index = ind_sc_no)
call fm_util_set_value('air_sea_gas_flux_generic/ice/units', 'dimensionless', index = ind_sc_no)

!> Add the flux output field(s).

if (fm_new_list('air_sea_gas_flux_generic/flux') .le. 0) then !{
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux_generic/flux" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_flux = field_index
call fm_util_set_value('air_sea_gas_flux_generic/flux/name', 'flux', index = ind_flux)
call fm_util_set_value('air_sea_gas_flux_generic/flux/long_name', 'Surface flux', index = ind_flux)
call fm_util_set_value('air_sea_gas_flux_generic/flux/units', 'mol/m^2/s', index = ind_flux)

field_index = field_index + 1
ind_deltap = field_index
call fm_util_set_value('air_sea_gas_flux_generic/flux/name', 'deltap', index = ind_deltap)
call fm_util_set_value('air_sea_gas_flux_generic/flux/long_name', 'Ocean-air delta pressure', index = ind_deltap)
call fm_util_set_value('air_sea_gas_flux_generic/flux/units', 'uatm', index = ind_deltap)

field_index = field_index + 1
ind_kw = field_index
call fm_util_set_value('air_sea_gas_flux_generic/flux/name', 'kw', index = ind_kw)
call fm_util_set_value('air_sea_gas_flux_generic/flux/long_name', 'Piston velocity', index = ind_kw)
call fm_util_set_value('air_sea_gas_flux_generic/flux/units', 'm/s', index = ind_kw)
Expand Down Expand Up @@ -742,22 +720,14 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux/atm" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_pcair = field_index
call fm_util_set_value('air_sea_gas_flux/atm/name', 'pcair', index = ind_pcair)
call fm_util_set_value('air_sea_gas_flux/atm/long_name', 'Atmospheric concentration', index = ind_pcair)
call fm_util_set_value('air_sea_gas_flux/atm/units', 'mol/mol', index = ind_pcair)

field_index = field_index + 1
ind_u10 = field_index
call fm_util_set_value('air_sea_gas_flux/atm/name', 'u10', index = ind_u10)
call fm_util_set_value('air_sea_gas_flux/atm/long_name', 'Wind speed at 10 m', index = ind_u10)
call fm_util_set_value('air_sea_gas_flux/atm/units', 'm/s', index = ind_u10)

field_index = field_index + 1
ind_psurf = field_index
call fm_util_set_value('air_sea_gas_flux/atm/name', 'psurf', index = ind_psurf)
call fm_util_set_value('air_sea_gas_flux/atm/long_name', 'Surface atmospheric pressure', index = ind_psurf)
call fm_util_set_value('air_sea_gas_flux/atm/units', 'Pa', index = ind_psurf)
Expand All @@ -768,16 +738,10 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux/ice" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_alpha = field_index
call fm_util_set_value('air_sea_gas_flux/ice/name', 'alpha', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux/ice/long_name', 'Solubility from atmosphere times Schmidt number term', index = ind_alpha)
call fm_util_set_value('air_sea_gas_flux/ice/units', 'mol/m^3/atm', index = ind_alpha)

field_index = field_index + 1
ind_csurf = field_index
call fm_util_set_value('air_sea_gas_flux/ice/name', 'csurf', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux/ice/long_name', 'Ocean concentration times Schmidt number term', index = ind_csurf)
call fm_util_set_value('air_sea_gas_flux/ice/units', 'mol/m^3', index = ind_csurf)
Expand All @@ -788,10 +752,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_gas_flux/flux" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_flux = field_index
call fm_util_set_value('air_sea_gas_flux/flux/name', 'flux', index = ind_flux)
call fm_util_set_value('air_sea_gas_flux/flux/long_name', 'Surface flux', index = ind_flux)
call fm_util_set_value('air_sea_gas_flux/flux/units', 'mol/m^2/s', index = ind_flux)
Expand Down Expand Up @@ -834,10 +794,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_deposition/atm" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_deposition = field_index
call fm_util_set_value('air_sea_deposition/atm/name', 'deposition', index = ind_deposition)
call fm_util_set_value('air_sea_deposition/atm/long_name', 'Atmospheric deposition', index = ind_deposition)
call fm_util_set_value('air_sea_deposition/atm/units', 'kg/m^2/s', index = ind_deposition)
Expand All @@ -848,8 +804,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_deposition/ice" list')
endif !}

field_index = 0

call fm_util_set_value('air_sea_deposition/ice/name', ' ', index = 0)
call fm_util_set_value('air_sea_deposition/ice/long_name', ' ', index = 0)
call fm_util_set_value('air_sea_deposition/ice/units', ' ', index = 0)
Expand All @@ -860,10 +814,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "air_sea_deposition/flux" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_flux = field_index
call fm_util_set_value('air_sea_deposition/flux/name', 'flux', index = ind_flux)
call fm_util_set_value('air_sea_deposition/flux/long_name', 'Surface deposition', index = ind_flux)
call fm_util_set_value('air_sea_deposition/flux/units', 'mol/m^2/s', index = ind_flux)
Expand Down Expand Up @@ -902,10 +852,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "land_sea_runoff/atm" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_runoff = field_index
call fm_util_set_value('land_sea_runoff/atm/name', 'runoff', index = ind_runoff)
call fm_util_set_value('land_sea_runoff/atm/long_name', 'Concentration in land runoff', index = ind_runoff)
call fm_util_set_value('land_sea_runoff/atm/units', 'mol/m^3', index = ind_runoff)
Expand All @@ -916,8 +862,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "land_sea_runoff/ice" list')
endif !}

field_index = 0

call fm_util_set_value('land_sea_runoff/ice/name', ' ', index = 0)
call fm_util_set_value('land_sea_runoff/ice/long_name', ' ', index = 0)
call fm_util_set_value('land_sea_runoff/ice/units', ' ', index = 0)
Expand All @@ -928,10 +872,6 @@ subroutine coupler_types_init
call mpp_error(FATAL, trim(error_header) // ' Could not set the "land_sea_runoff/flux" list')
endif !}

field_index = 0

field_index = field_index + 1
ind_flux = field_index
call fm_util_set_value('land_sea_runoff/flux/name', 'flux', index = ind_flux)
call fm_util_set_value('land_sea_runoff/flux/long_name', 'Concentration in land runoff', index = ind_flux)
call fm_util_set_value('land_sea_runoff/flux/units', 'mol/m^3', index = ind_flux)
Expand Down

0 comments on commit d4865fa

Please sign in to comment.