Module ocean_sbc_mod
OVERVIEW
   Set up the surface boundary conditions for mom4. 
   This module sets up the surface boundary conditions for the model. 
   Also fill Ocean_sfc derived-type used to pass information to other 
   component models.
   
   The surface temperature should be the surface insitu temperature,
   which is the same as the surface potential temperature.  When the 
   model prognostic temperature variable is conservative temperature, 
   then the surface potential temperature is carried in T_diag(index_diag_temp).
   The resulting heat flux is potential enthalpy, which is the correct 
   field to be forcing the T_prog(index_temp) field when the prognostic
   temperature field is the conservative temperature.   
   
 
OTHER MODULES USED
           constants_mod
        diag_manager_mod
                 fms_mod
              fms_io_mod
         mpp_domains_mod
                 mpp_mod
time_interp_external_mod
        time_manager_mod
       ocean_domains_mod
    ocean_parameters_mod
   ocean_riverspread_mod
           ocean_tpm_mod
         ocean_types_mod
     ocean_workspace_mod
 
PUBLIC INTERFACE
PUBLIC DATA
None.
PUBLIC ROUTINES
- 
ocean_sbc_init
- 
DESCRIPTION
-    Initialize the ocean sbc module 
 
 
 
- 
initialize_ocean_sfc
- 
DESCRIPTION
-    Initialize the ocean surface type, which passes information between ocean 
   and other component models. 
   
 
 Note that ocean model sst passed to the atmosphere must be the surface
   potential temperature (which is equated to surface in situ temperature).
   If the ocean prognostic temperature variable is conservative temperature,
   then the sst is carried in T_diag(index_diag_temp).  If the prognostic 
   temperature is potential temperature, then the sst is carried in 
   T_prog(index_temp).
 
 Ocean_sfc%t_surf  = time averaged sst (Kelvin) passed to atmosphere/ice model
   Ocean_sfc%s_surf  = time averaged sss (psu) passed to atmosphere/ice models
   Ocean_sfc%u_surf  = time averaged u-current (m/sec) passed to atmosphere/ice models
   Ocean_sfc%v_surf  = time averaged v-current (m/sec)  passed to atmosphere/ice models 
   Ocean_sfc%sea_lev = time averaged ocean free surface height (m) plus patm/(grav*rho0) 
   Ocean_sfc%frazil  = time accumulated frazil (J/m^2) passed to ice model.  time averaging 
   not performed, since ice model needs the frazil accumulated over the 
   ocean time steps.  Note that Ocean_sfc%frazil is accumulated, whereas 
   T_diag%frazil (saved in diagnostic tracer restart file) is instantaneous.
 
 
 
 
 
- 
sum_ocean_sfc
- 
DESCRIPTION
-    Accumulate the ocean_sfc derived type over the course of the 
   ocean component sub-cycling used when coupling to other models. 
   
 
 Note that ocean model sst passed to the atmosphere must be the surface
   potential temperature (which is equated to surface in situ temperature).
   If the ocean prognostic temperature variable is conservative temperature,
   then the sst is carried in T_diag(index_diag_temp).  If the prognostic 
   temperature is potential temperature, then the sst is carried in 
   T_prog(index_temp).
 
 Note that this routine is called after eta_and_pbot_diagnose,
   so Thickness%eta is eta_t(taup1).
 
 
 
 
 
- 
zero_ocean_sfc
- 
DESCRIPTION
-    Zero the elements of the Ocean_sfc derived type. 
 
 
 
- 
avg_ocean_sfc
- 
DESCRIPTION
-    Compute average of ocean surface quantities.  This is for coupling, 
   where pass time averaged information from ocean to other component
   models. Note that Ocean_sfc%frazil is NOT time averaged.  Rather, it 
   is accumulated from T_diag(index_frazil)%field in subroutine sum_ocean_sfc.
   Doing so is necessary for heat conservation between ocean and sea 
   ice systems.  Since it is not time averaged, frazil is not part of 
   this averaging subroutine.  
   
 
 Note that ocean model SST passed to the atmosphere is the surface
   potential temperature (which is equal to surface in situ temperature).
   If the ocean prognostic temperature variable is conservative temperature,
   then the sst is carried in T_diag(index_diag_temp).  If the prognostic 
   temperature is potential temperature, then the sst is carried in 
   T_prog(index_temp).
 
 Note that if one removes the averaging, then we take only the 
   latest values of the surface fields.  This approach has been 
   found useful to stabilize the "concurrent" coupling approach.
 
 Note that this routine is called after eta_and_pbot_diagnose,
   so Thickness%eta is eta_t(taup1).
 
 
 
 
 
- 
ocean_sfc_restart
- 
DESCRIPTION
-    Write out restart files registered through register_restart_file 
 
 
 
- 
ocean_sfc_end
- 
DESCRIPTION
-    Save information from Ocean_sfc to restarts. Note that it is 
   important in general to distinguish the time accumulated quantity 
   Ocean_sfc%frazil, saved here, from the instantaneous quantity 
   T_diag%frazil, which is saved in the diagnostic tracer restart file. 
 
 
 
- 
get_ocean_sbc
- 
DESCRIPTION
-    Subroutine to get the surface fluxes passed into the ocean from 
   other component models. 
 
 
 
- 
flux_adjust
- 
DESCRIPTION
-    Subroutine to compute the surface fluxes derived from a 
   restoring condition and/or correction from an input file. 
   
 
 We use a convention whereby a positive 
   flux enters the ocean:  (+) down convention.
 
 When restoring salinity, one may choose to convert this
   flux to an implied water flux, or keep it a salt flux.
   The default is to keep it as a salt flux.  Converting to 
   a water flux will alter the sea level, and so alter the 
   concentration of other tracers.
 
 
 
 
 
NAMELIST
&ocean_sbc_nml
- 
use_waterflux
   Set to true when wish to use real fresh water flux as opposed to virtual 
   salt fluxes. 
[logical]
- 
waterflux_tavg
   Set to true when aiming to suppress the leap-frog computational mode
   by setting pme and river equal to a time averaged value over the 
   present and previous time step.  This method requires an extra
   field in the restart file.  This method is not needed when using
   the TWO_LEVEL time tendency.  It remains for those who wish to 
   use the leap-frog THREE_LEVEL time stepping scheme.  
   Note that it does not lead to simple checks of conservation across
   model components, since there is a time averaging performed for 
   the water flux added to the ocean model.  It is generally NOT 
   recommended.  Default waterflux_tavg=.false. 
[logical]
- 
temp_restore_tscale
   Time scale in days for restoring temperature within the top model 
   grid cell. 
[real, units: day]
- 
salt_restore_tscale
   Time scale in days for restoring salinity within the top model 
   grid cell. 
[real, units: day]
- 
salt_restore_as_salt_flux
   When running a use_waterflux=.true. model, we may choose to add the 
   salinity from a restoring condition as a salt flux or convert to 
   a fresh water flux. The addition of salt does not alter the sea 
   level nor does it alter the concentration of other tracers, whereas
   converting to an implied water flux will alter sea level and other
   concentrations.  So we generally recommend the default   
   salt_restore_as_salt_flux=.true. 
[logical]
- 
max_delta_salinity_restore
   When computing the restoring flux for salinity, we can define
   a maximum absolute value for the difference between salinity(k=1)
   and the restoring salinity from a dataset.  This approach is useful
   especially in NAtl western boundary, where poor Gulf Stream separation
   can lead to large salinity biases.  If restore too much the salinity
   field, we can spuriously transport large amounts of fresh water to the 
   subpoloar gyre, thus impacting the overturning circulation too much.  
   If max_delta_salinity_restore < 0.0, then will NOT provide a max to the 
   delta salinity; will instead compute an unbounded restoring flux.  
   Default max_delta_salinity_restore=-0.50. 
[real, units: ppt]
- 
read_restore_mask
   For reading in a mask that selects regions of the domain 
   that are restored (mask=1) or not restored (mask=0).
   Default  read_restore_mask=.false., whereby restore_mask
   is set to tmask(k=1). 
[logical]
- 
restore_mask_gfdl
   For modifying the restore mask based on reading in 
   the GFDL regional mask. Default restore_mask_gfdl=.false. 
[logical]
- 
salinity_ref
   Reference salinity used for converting fresh water flux
   to salt flux. 
[real, units: psu]
- 
salt_restore_under_ice
   Logical indicating whether to restore salinity under sea ice or not.
   When .false. then will not restore salinity  in regions where we 
   use a "frazil" condition as a proxy for where sea-ice is present.
   Do not use sea ice extent from a sea ice model since we generally do 
   not pass information regarding ice extent between the sea ice model 
   and the ocean model. 
[logical]
- 
zero_net_salt_restore
   Logical indicating whether to remove the area mean of the salinity 
   restore flux so there is a net zero input of salt to the ocean
   associated with restoring. 
[logical]
- 
zero_net_salt_correction
   Logical indicating whether to remove the area mean of the salinity 
   correction flux so there is a net zero input of salt to the ocean
   associated with salt correction. 
[logical]
- 
zero_net_water_restore
   Logical indicating whether to remove the area mean of the water 
   restore flux so there is a net zero input of water to the ocean
   associated with restoring. 
[logical]
- 
zero_net_water_correction
   Logical indicating whether to remove the area mean of the water 
   correction flux so there is a net zero input of water to the ocean
   associated with water correction. 
[logical]
- 
zero_net_water_coupler
   Logical indicating whether to remove the area mean of the water 
   passed through the coupler so there is a net zero input of 
   fresh water to the ocean associated with p-e+r. Do so by removing 
   area mean from pme--keep river values unchanged. Note that a choice
   must be made whether to remove the area mean from rivers or pme.  
   We choose pme since it is more evenly distributed than rivers.   
   Also note that we DO NOT include the ice melt in this normalization. 
[logical]
- 
zero_net_water_couple_restore
   This logical keeps the total water forcing on the ocean+ice system
   to a global mean of zero at each time step.  We DO NOT include
   the ice melt in this normalization.  
   Setting zero_net_water_couple_restore to true may be appropriate when 
   running an ice-ocean model using a bulk formulae to compute
   evaporation (e.g., CORE) and when only providing a weak (or zero)
   salinity restoring.  It is not appropriate when running a coupled
   ocean-atmosphere model, where the moisture budget should be 
   conserved without an artificial removal of the global mean. 
[logical]
- 
land_model_heat_fluxes
   For the case where land model passes through the coupler the heat flux 
   associated with the liquid runoff and calving land ice fields.
   This heat flux is computed relative to 0C, and takes the form 
   heat flux = mass flux of water * temp of water * heat capacity, 
   where the water can be either liquid or solid.  For many coupled models,
   the water temperature is assumed to be that of the SST.  But 
   more complete land models now carry the heat of its water relative to 0C,
   in which case the ocean model does not need to assume anything about the 
   heat content of the land water. 
   Default land_model_heat_fluxes=.false. 
[logical]
- 
debug_water_fluxes
   Logical for debugging water fluxes. Must be true for any of the 
   options zero_water_fluxes, zero_calving_fluxes, zero_pme_fluxes
   or zero_runoff_fluxes to be enabled.  
   Default debug_water_fluxes=.false. 
[logical]
- 
zero_water_fluxes
   Logical for debugging to zero the pme, river, and pme_taum1 into 
   ocean, over-riding any input from Ice_ocean_boundary. 
   Default zero_water_fluxes=.false. 
[logical]
- 
zero_calving_fluxes
   Logical for debugging to zero the calving flux passed into the ocean.
   Default zero_calving_fluxes=.false. 
[logical]
- 
zero_pme_fluxes
   Logical for debugging to zero the pme flux passed into the ocean.
   Default zero_pme_fluxes=.false. 
[logical]
- 
zero_runoff_fluxes
   Logical for debugging to zero the runoff flux passed into the ocean.
   Default zero_runoff_fluxes=.false. 
[logical]
- 
zero_river_fluxes
   Logical for debugging to zero the river (calving+runoff) flux passed into the ocean.
   Default zero_river_fluxes=.false. 
[logical]
- 
convert_river_to_pme
   Logical for debugging.  Here we add the river water input (calving+runoff)
   to pme, then set river=calving=runoff=0.0.
   Default convert_river_to_pme=.false. 
[logical]
- 
zero_heat_fluxes
   Logical for debugging to set all heat fluxes into the ocean to zero, 
   over-riding any input from Ice_ocean_boundary.  Default is .false. 
[logical]
- 
zero_surface_stress
   Logical for debugging to zero all surface stress applied to the ocean,
   over-riding any input from Ice_ocean_boundary.  Default is .false. 
[logical]
- 
rotate_winds
   Set to true when need to rotate the winds onto the ocean model grid.
   This is needed for cases where the winds are on a spherical grid and 
   the ocean model uses tripolar=.true.  If generate the wind data on 
   the ocean model grid, then do not need to rotate, since the rotation 
   has already been done. 
[logical]
- 
max_ice_thickness
   When coupling mom4 to an ice model, the sea ice thickness may need
   to be restricted to prevent vanishing top-level in mom4. Set 
   max_ice_thickness (meters) < dzt(k=1) to restrict. This truncation 
   avoids the numerical problem but we loose mass conservation in the coupled
   sea ice and ocean system. We also alter the pressure felt on the ocean 
   as applied by the sea ice. Different vertical coordinates are needed 
   to do the problem more realistically.   
   
   Note that the problem of vanishing top layer is removed when use
   either ZSTAR or PSTAR as vertical coordinate. 
[real, units: m]
- 
ice_salt_concentration
   The salt concentration of sea ice.  This is taken as a bulk value, and should 
   be the same as that used by the ice model. Default is ice_salt_concentration=0.005,
   as that is the value used in the GFDL coupled climate model. 
[real, units: kg salt / kg ice]
- 
runoff_salinity
   The salinity of river runoff water. Default is runoff_salinity=0.0. 
[real, units: g salt / kg runoff water (ppt)]
- 
runoff_temp_min
   The minimum temperature that river runoff into the ocean is assigned. 
   Default runoff_temp_min=0.0. 
[real, units: DegC]
- 
runoffspread
   Set to true if wish to use the spread_river_horz algorithm to spread 
   the river runoff flux horizontally over an area into the ocean wider than 
   set by the coupler.  This option requires the setup of a table for 
   determining the points over which we spread. 
   Default runoffspread=.false. 
[logical]
- 
calvingspread
   Set to true if wish to use the spread_river_horz algorithm to spread 
   the calving flux horizontally over an area into the ocean wider than 
   set by the coupler.  This option requires the setup of a table for 
   determining the points over which we spread. 
   Default calvingspread=.false. 
[logical]
- 
avg_sfc_velocity
   If set to true, the u and v fields passed up to the sea ice
   are averaged over a coupling interval. TRUE by default. 
[logical]
- 
avg_sfc_temp_salt_eta
   If set to true, the t, s and sea_level fields passed up to the sea ice
   are averaged over a coupling interval. TRUE by default. 
[logical]
- 
use_full_patm_for_sea_level
   The option use_full_patm_for_sea_level allows for the passing 
   of the sea level including the full weight of sea ice back to
   the ice model.  This approach maintains the max weight on the liquid
   ocean according to the nml variable max_ice_thickness.  But it does 
   allow the sea ice to know when there is actually more sea ice than that
   set by max_ice_thickness.  This option then provides for a negative
   feedback on the runaway growth of sea ice, since the full pressure acting to 
   make the ice flow will be correctly felt.  This is a new option, and is not
   fully tested, So the default is use_full_patm_for_sea_level=.false 
[logical]
- 
do_flux_correction
   For applying surface flux correction to to a tracer or wind stress field. 
   This code is used at GFDL for idealized perturbation experiments, such 
   as when one wishes to artificially enhance the wind stress to test 
   model sensitivity.  It is also appropriate for coupled models that 
   may require a modification to the fluxes arrising from a coupled model,
   via reading in information from a pre-defined
   data file, 
   Default do_flux_correction=.false. 
[logical]
- 
temp_correction_scale
   A scale multiplying the flux correction for temperature.  
   Default temp_correction_scale=0.0. 
[real, units: dimensionless]
- 
salt_correction_scale
   A scale multiplying the flux correction for salinity.
   Default salt_correction_scale=0.0. 
[real, units: dimensionless]
- 
tau_x_correction_scale
   A scale multiplying the flux correction for tau_x.
   Default tau_x_correction_scale=0.0. 
[real, units: dimensionless]
- 
tau_y_correction_scale
   A scale multiplying the flux correction for tau_y.
   Default tau_y_correction_scale=0.0. 
[real, units: dimensionless]
- 
do_bitwise_exact_sum
   Set true to do bitwise exact global sum. When it is false, the global
   sum will be non-bitwise_exact, but will significantly increase efficiency.
   The default value is do_bitwise_exact_sum=.true. in order to ensure answers
   do not change when alter processors.  But if wish to enhance the efficiency
   of coupled ocean-ice models that use one of the global normalization options
   zero_net_salt_restore        =.true.
   zero_net_salt_correction     =.true.
   zero_net_water_restore       =.true.
   zero_net_water_correction    =.true.
   zero_net_water_coupler       =.true.
   zero_net_water_couple_restore=.true.
   then one may wish to consider setting do_bitwise_exact_sum=.false. 
[logical]
 
 
DATA SETS
None.
ERROR MESSAGES
None.
REFERENCES
-    "Potential enthalpy: A conservative oceanic variable for evaluating
   heat content and heat fluxes"
   Trevor J McDougall, Journal of Physical Oceanography, 
   vol 33, pages 945--963. 
 
COMPILER SPECIFICS
        None.
      
PRECOMPILER OPTIONS
        None.
      
LOADER OPTIONS
None.
TEST PROGRAM
None.
KNOWN BUGS
        None.
      
NOTES
None.
FUTURE PLANS
        None.