Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physics cleanup #37

Merged
merged 10 commits into from
Sep 30, 2023
23 changes: 1 addition & 22 deletions components/mpas-seaice/src/Makefile.icepack
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ OBJS = icepack_aerosol.o \
icepack_itd.o \
icepack_kinds.o \
icepack_mechred.o \
icepack_meltpond_cesm.o \
icepack_meltpond_lvl.o \
icepack_meltpond_topo.o \
icepack_mushy_physics.o \
Expand All @@ -23,7 +22,6 @@ OBJS = icepack_aerosol.o \
icepack_shortwave.o \
icepack_shortwave_data.o \
icepack_snow.o \
icepack_therm_0layer.o \
icepack_therm_bl99.o \
icepack_therm_itd.o \
icepack_therm_mushy.o \
Expand All @@ -33,8 +31,7 @@ OBJS = icepack_aerosol.o \
icepack_warnings.o \
icepack_wavefracspec.o \
icepack_zbgc.o \
icepack_zbgc_shared.o \
icepack_zsalinity.o
icepack_zbgc_shared.o


all: $(OBJS)
Expand Down Expand Up @@ -110,9 +107,6 @@ icepack_mechred.o:icepack_kinds.o
icepack_mechred.o:icepack_parameters.o
icepack_mechred.o:icepack_tracers.o
icepack_mechred.o:icepack_warnings.o
icepack_meltpond_cesm.o:icepack_kinds.o
icepack_meltpond_cesm.o:icepack_parameters.o
icepack_meltpond_cesm.o:icepack_warnings.o
icepack_meltpond_lvl.o:icepack_kinds.o
icepack_meltpond_lvl.o:icepack_parameters.o
icepack_meltpond_lvl.o:icepack_therm_shared.o
Expand Down Expand Up @@ -146,10 +140,6 @@ icepack_snow.o:icepack_kinds.o
icepack_snow.o:icepack_parameters.o
icepack_snow.o:icepack_therm_shared.o
icepack_snow.o:icepack_warnings.o
icepack_therm_0layer.o:icepack_kinds.o
icepack_therm_0layer.o:icepack_parameters.o
icepack_therm_0layer.o:icepack_therm_bl99.o
icepack_therm_0layer.o:icepack_warnings.o
icepack_therm_bl99.o:icepack_kinds.o
icepack_therm_bl99.o:icepack_parameters.o
icepack_therm_bl99.o:icepack_therm_shared.o
Expand Down Expand Up @@ -181,13 +171,11 @@ icepack_therm_vertical.o:icepack_firstyear.o
icepack_therm_vertical.o:icepack_flux.o
icepack_therm_vertical.o:icepack_isotope.o
icepack_therm_vertical.o:icepack_kinds.o
icepack_therm_vertical.o:icepack_meltpond_cesm.o
icepack_therm_vertical.o:icepack_meltpond_lvl.o
icepack_therm_vertical.o:icepack_meltpond_topo.o
icepack_therm_vertical.o:icepack_mushy_physics.o
icepack_therm_vertical.o:icepack_parameters.o
icepack_therm_vertical.o:icepack_snow.o
icepack_therm_vertical.o:icepack_therm_0layer.o
icepack_therm_vertical.o:icepack_therm_bl99.o
icepack_therm_vertical.o:icepack_therm_mushy.o
icepack_therm_vertical.o:icepack_therm_shared.o
Expand All @@ -211,19 +199,10 @@ icepack_zbgc.o:icepack_therm_shared.o
icepack_zbgc.o:icepack_tracers.o
icepack_zbgc.o:icepack_warnings.o
icepack_zbgc.o:icepack_zbgc_shared.o
icepack_zbgc.o:icepack_zsalinity.o
icepack_zbgc_shared.o:icepack_kinds.o
icepack_zbgc_shared.o:icepack_parameters.o
icepack_zbgc_shared.o:icepack_tracers.o
icepack_zbgc_shared.o:icepack_warnings.o
icepack_zsalinity.o:icepack_brine.o
icepack_zsalinity.o:icepack_kinds.o
icepack_zsalinity.o:icepack_parameters.o
icepack_zsalinity.o:icepack_therm_shared.o
icepack_zsalinity.o:icepack_tracers.o
icepack_zsalinity.o:icepack_warnings.o
icepack_zsalinity.o:icepack_zbgc_shared.o


.F90.o:
$(RM) $@ $*.mod
Expand Down
29 changes: 24 additions & 5 deletions components/mpas-seaice/src/shared/mpas_seaice_column.F
Original file line number Diff line number Diff line change
Expand Up @@ -9929,7 +9929,7 @@ subroutine check_column_package_configs(domain)
config_calc_surface_temperature, &
config_use_form_drag, &
config_use_level_ice, &
config_use_cesm_meltponds, &
config_use_cesm_meltponds, & ! deprecated
config_use_level_meltponds, &
config_use_topo_meltponds, &
config_use_vertical_zsalinity, &
Expand Down Expand Up @@ -9989,7 +9989,7 @@ subroutine check_column_package_configs(domain)
call MPAS_pool_get_config(domain % configs, "config_snow_to_ice_transition_depth", config_snow_to_ice_transition_depth)
call MPAS_pool_get_config(domain % configs, "config_use_form_drag", config_use_form_drag)
call MPAS_pool_get_config(domain % configs, "config_use_level_ice", config_use_level_ice)
call MPAS_pool_get_config(domain % configs, "config_use_cesm_meltponds", config_use_cesm_meltponds)
call MPAS_pool_get_config(domain % configs, "config_use_cesm_meltponds", config_use_cesm_meltponds) ! deprecated
call MPAS_pool_get_config(domain % configs, "config_use_level_meltponds", config_use_level_meltponds)
call MPAS_pool_get_config(domain % configs, "config_use_topo_meltponds", config_use_topo_meltponds)
call MPAS_pool_get_config(domain % configs, "config_ocean_heat_transfer_type", config_ocean_heat_transfer_type)
Expand Down Expand Up @@ -10026,10 +10026,15 @@ subroutine check_column_package_configs(domain)
!-----------------------------------------------------------------------

! check config_thermodynamics_type value
if (.not. (trim(config_thermodynamics_type) == "zero layer" .or. &
trim(config_thermodynamics_type) == "BL99" .or. &
if (trim(config_thermodynamics_type) == "zero layer") then
call mpas_log_write(&
"check_column_package_configs: config_thermodynamics_type) = zero layer but 0-layer thermo is being deprecated", &
messageType=MPAS_LOG_WARN)
endif

if (.not. (trim(config_thermodynamics_type) == "BL99" .or. &
trim(config_thermodynamics_type) == "mushy")) then
call config_error("config_thermodynamics_type", config_thermodynamics_type, "'zero layer', 'BL99' or 'mushy'")
call config_error("config_thermodynamics_type", config_thermodynamics_type, "'BL99' or 'mushy'")
endif

! check config_heat_conductivity_type value
Expand Down Expand Up @@ -10111,6 +10116,13 @@ subroutine check_column_package_configs(domain)
'Check for inconsistencies in restart file: config_nIceLayers /= nIceLayers', &
messageType=MPAS_LOG_CRIT)

! deprecate cesm ponds
if (config_use_cesm_meltponds) then
call mpas_log_write(&
"check_column_package_configs: config_use_cesm_meltponds = .true. but cesm ponds are being deprecated", &
messageType=MPAS_LOG_CRIT)
endif

!-----------------------------------------------------------------------
! Check combinations
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -10256,6 +10268,13 @@ subroutine check_column_package_configs(domain)
messageType=MPAS_LOG_CRIT)
endif

! deprecate zsalinity
if (config_use_vertical_zsalinity) then
call mpas_log_write(&
"check_column_package_configs: vertical zSalinity has been deprecated", &
messageType=MPAS_LOG_CRIT)
endif

! check biogeochemistry flags:
if (.not. config_use_column_biogeochemistry .and. (config_use_brine .or. config_use_vertical_zsalinity .or. &
config_use_vertical_biochemistry .or. config_use_shortwave_bioabsorption .or. config_use_vertical_tracers .or. &
Expand Down
29 changes: 12 additions & 17 deletions components/mpas-seaice/src/shared/mpas_seaice_constants.F
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
! seaice_constants
!
!> \brief
!> \author Adrian K. Turner, LANL
!> \date 2013-2014
!> \author Adrian K. Turner and Elizabeth Hunke, LANL
!> \date 2013-2014, 2023
!> \details
!> Values in this module have been copied from the two ice_constants_colpkg.F90
! modules in the column physics package (colpkg, in column/). They will remain
! duplicates until the column physic package is deprecated.
!> modules in the column physics package (in column/). They will remain
!> duplicates until the column physics package is deprecated.
!
!-----------------------------------------------------------------------

module seaice_constants
Expand Down Expand Up @@ -93,23 +94,17 @@ module seaice_constants

! fundamental constants
real (kind=RKIND), parameter, public :: &
pii = 3.141592653589793_RKIND, & ! echmod - why is this different from pi above?
seaiceDegreesToRadians = pii / 180.0_RKIND, &
seaiceRadiansToDegrees = 180.0_RKIND / pii, &
!echmod - BFB but slower???
! pii = pi, &
! seaiceDegreesToRadians = pi / 180.0_RKIND, &
! seaiceRadiansToDegrees = 180.0_RKIND / pi, &
seaiceSecondsPerYear = 24.0_RKIND * 3600.0_RKIND * 365.0_RKIND, & !echmod - incorrect for leap years
seaiceDaysPerSecond = 1.0_RKIND/seaiceSecondsPerDay
pii = pi, & !echmod - replace pii with seaicePi elsewhere
seaiceDegreesToRadians = pi / 180.0_RKIND, &
seaiceRadiansToDegrees = 180.0_RKIND / pi, &
seaiceSecondsPerYear = 24.0_RKIND * 3600.0_RKIND * 365.0_RKIND, & !echmod - incorrect for leap years
seaiceDaysPerSecond = 1.0_RKIND/seaiceSecondsPerDay

real (kind=RKIND), public :: &
seaicePi
!echmod - BFB but slower???
! seaicePi = pi ! pi
seaicePi = pi ! pi

character (len=*), public, parameter :: &
coupleAlarmID = 'coupling'
coupleAlarmID = 'coupling'

real(kind=RKIND), public :: &
seaicePuny = 1.0e-11_RKIND ! a small value
Expand Down
33 changes: 25 additions & 8 deletions components/mpas-seaice/src/shared/mpas_seaice_forcing.F
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,9 @@ subroutine prepare_oceanic_coupling_variables_ISPOL(block, firstTimeStep)
use ice_colpkg, only: &
colpkg_sea_freezing_temperature

use icepack_intfc, only: &
icepack_sea_freezing_temperature

type (block_type), pointer :: block

logical, intent(in) :: &
Expand All @@ -2615,7 +2618,8 @@ subroutine prepare_oceanic_coupling_variables_ISPOL(block, firstTimeStep)
seaFreezingTemperature

character(len=strKIND), pointer :: &
config_sea_freezing_temperature_type
config_sea_freezing_temperature_type, &
config_column_physics_type

logical, pointer :: &
config_do_restart
Expand All @@ -2641,16 +2645,29 @@ subroutine prepare_oceanic_coupling_variables_ISPOL(block, firstTimeStep)
call MPAS_pool_get_array(ocean_coupling, "oceanMixedLayerDepth", oceanMixedLayerDepth)
call MPAS_pool_get_array(ocean_coupling, "seaFreezingTemperature", seaFreezingTemperature)

do iCell = 1, nCellsSolve
if (trim(config_column_physics_type) == "icepack") then
do iCell = 1, nCellsSolve

! ensure physical realism
seaSurfaceSalinity(iCell) = max(seaSurfaceSalinity(iCell), 0.0_RKIND)
oceanMixedLayerDepth(iCell) = max(oceanMixedLayerDepth(iCell), 0.0_RKIND)

! sea freezing temperature
seaFreezingTemperature(iCell) = icepack_sea_freezing_temperature(seaSurfaceSalinity(iCell))

! ensure physical realism
seaSurfaceSalinity(iCell) = max(seaSurfaceSalinity(iCell), 0.0_RKIND)
oceanMixedLayerDepth(iCell) = max(oceanMixedLayerDepth(iCell), 0.0_RKIND)
enddo ! iCell
else if (trim(config_column_physics_type) == "column_package") then
do iCell = 1, nCellsSolve

! sea freezing temperature
seaFreezingTemperature(iCell) = colpkg_sea_freezing_temperature(seaSurfaceSalinity(iCell))
! ensure physical realism
seaSurfaceSalinity(iCell) = max(seaSurfaceSalinity(iCell), 0.0_RKIND)
oceanMixedLayerDepth(iCell) = max(oceanMixedLayerDepth(iCell), 0.0_RKIND)

enddo ! iCell
! sea freezing temperature
seaFreezingTemperature(iCell) = colpkg_sea_freezing_temperature(seaSurfaceSalinity(iCell))

enddo ! iCell
endif ! config_column_physics_type

! only update sea surface temperature on first non-restart timestep
if (firstTimeStep .and. .not. config_do_restart) then
Expand Down
Loading