From e245b52096847a1187fd5747bbe34f4e51768993 Mon Sep 17 00:00:00 2001 From: apcraig Date: Sat, 13 May 2023 03:37:59 -0600 Subject: [PATCH 1/2] - Add .readthedocs.yaml to fix readthedocs - Minor update to icepack_mushy_physics inline documentation - Update Icepack interfaces documentation, add icepack_mushy public interfaces - Remove trailing blank spaces in source code --- .readthedocs.yaml | 29 +++++++++ columnphysics/icepack_mechred.F90 | 2 +- columnphysics/icepack_mushy_physics.F90 | 68 ++++++++++---------- columnphysics/icepack_therm_itd.F90 | 10 +-- configuration/driver/icedrv_RunMod.F90 | 2 +- configuration/driver/icedrv_init.F90 | 2 +- configuration/driver/icedrv_restart.F90 | 62 +++++++++---------- configuration/driver/icedrv_step.F90 | 34 +++++----- doc/source/user_guide/interfaces.include | 79 ++++++++++++++++++++++-- 9 files changed, 190 insertions(+), 98 deletions(-) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 000000000..f83760cce --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,29 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.7" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/source/conf.py + +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - pdf + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: doc/requirements.txt diff --git a/columnphysics/icepack_mechred.F90 b/columnphysics/icepack_mechred.F90 index 314dcc7e1..ea049761f 100644 --- a/columnphysics/icepack_mechred.F90 +++ b/columnphysics/icepack_mechred.F90 @@ -1910,7 +1910,7 @@ subroutine icepack_step_ridge (dt, ndtd, & end subroutine icepack_step_ridge !======================================================================= - + end module icepack_mechred !======================================================================= diff --git a/columnphysics/icepack_mushy_physics.F90 b/columnphysics/icepack_mushy_physics.F90 index d100ebd2e..466c5d727 100644 --- a/columnphysics/icepack_mushy_physics.F90 +++ b/columnphysics/icepack_mushy_physics.F90 @@ -68,11 +68,10 @@ module icepack_mushy_physics !======================================================================= ! Physical Quantities !======================================================================= +! Detemine the conductivity of the mush from enthalpy and salinity subroutine conductivity_mush_array(nilyr, zqin, zSin, km) - ! detemine the conductivity of the mush from enthalpy and salinity - integer (kind=int_kind), intent(in) :: & nilyr ! number of ice layers @@ -101,17 +100,19 @@ subroutine conductivity_mush_array(nilyr, zqin, zSin, km) end subroutine conductivity_mush_array !======================================================================= +!autodocument_start icepack_mushy_density_brine +! Compute density of brine from brine salinity function icepack_mushy_density_brine(Sbr) result(rho) - ! density of brine from brine salinity - real(kind=dbl_kind), intent(in) :: & Sbr ! brine salinity (ppt) real(kind=dbl_kind) :: & rho ! brine density (kg m-3) +!autodocument_end + real(kind=dbl_kind), parameter :: & a = 1000.3_dbl_kind , & ! zeroth empirical coefficient b = 0.78237_dbl_kind , & ! linear empirical coefficient @@ -126,11 +127,10 @@ end function icepack_mushy_density_brine !======================================================================= ! Snow !======================================================================= +! Heat conductivity of the snow subroutine conductivity_snow_array(ks) - ! heat conductivity of the snow - real(kind=dbl_kind), dimension(:), intent(out) :: & ks ! snow layer conductivity (W m-1 K-1) @@ -141,11 +141,10 @@ subroutine conductivity_snow_array(ks) end subroutine conductivity_snow_array !======================================================================= +! Enthalpy of snow from snow temperature function enthalpy_snow(zTsn) result(zqsn) - ! enthalpy of snow from snow temperature - real(kind=dbl_kind), intent(in) :: & zTsn ! snow layer temperature (C) @@ -159,11 +158,10 @@ function enthalpy_snow(zTsn) result(zqsn) end function enthalpy_snow !======================================================================= +! Temperature of snow from the snow enthalpy function temperature_snow(zqsn) result(zTsn) - ! temperature of snow from the snow enthalpy - real(kind=dbl_kind), intent(in) :: & zqsn ! snow layer enthalpy (J m-3) @@ -182,12 +180,11 @@ end function temperature_snow !======================================================================= ! Mushy Layer Formulation - Assur (1958) liquidus !======================================================================= +! Liquidus relation: equilibrium brine salinity as function of temperature +! based on empirical data from Assur (1958) function liquidus_brine_salinity_mush(zTin) result(Sbr) - ! liquidus relation: equilibrium brine salinity as function of temperature - ! based on empirical data from Assur (1958) - real(kind=dbl_kind), intent(in) :: & zTin ! ice layer temperature (C) @@ -223,12 +220,11 @@ function liquidus_brine_salinity_mush(zTin) result(Sbr) end function liquidus_brine_salinity_mush !======================================================================= +! Liquidus relation: equilibrium temperature as function of brine salinity +! based on empirical data from Assur (1958) function liquidus_temperature_mush(Sbr) result(zTin) - ! liquidus relation: equilibrium temperature as function of brine salinity - ! based on empirical data from Assur (1958) - real(kind=dbl_kind), intent(in) :: & Sbr ! ice brine salinity (ppt) @@ -264,11 +260,10 @@ function liquidus_temperature_mush(Sbr) result(zTin) end function liquidus_temperature_mush !======================================================================= +! Enthalpy of mush from mush temperature and bulk salinity function enthalpy_mush(zTin, zSin) result(zqin) - ! enthalpy of mush from mush temperature and bulk salinity - real(kind=dbl_kind), intent(in) :: & zTin, & ! ice layer temperature (C) zSin ! ice layer bulk salinity (ppt) @@ -289,11 +284,10 @@ function enthalpy_mush(zTin, zSin) result(zqin) end function enthalpy_mush !======================================================================= +! Enthalpy of mush from mush temperature and liquid fraction function enthalpy_mush_liquid_fraction(zTin, phi) result(zqin) - ! enthalpy of mush from mush temperature and bulk salinity - real(kind=dbl_kind), intent(in) :: & zTin, & ! ice layer temperature (C) phi ! liquid fraction @@ -309,12 +303,11 @@ function enthalpy_mush_liquid_fraction(zTin, phi) result(zqin) end function enthalpy_mush_liquid_fraction !======================================================================= +! Enthalpy of melting of mush from bulk salinity +! Energy needed to fully melt mush (T < 0) function enthalpy_of_melting(zSin) result(qm) - ! enthalpy of melting of mush - ! energy needed to fully melt mush (T < 0) - real(kind=dbl_kind), intent(in) :: & zSin ! ice layer bulk salinity (ppt) @@ -328,11 +321,10 @@ function enthalpy_of_melting(zSin) result(qm) end function enthalpy_of_melting !======================================================================= +! Enthalpy of brine (fully liquid) from temperature function enthalpy_brine(zTin) result(qbr) - ! enthalpy of brine (fully liquid) - real(kind=dbl_kind), intent(in) :: & zTin ! ice layer temperature (C) @@ -346,11 +338,11 @@ function enthalpy_brine(zTin) result(qbr) end function enthalpy_brine !======================================================================= +!autodocument_start icepack_mushy_temperature_mush +! Temperature of mush from mush enthalpy and bulk salinity function icepack_mushy_temperature_mush(zqin, zSin) result(zTin) - ! temperature of mush from mush enthalpy - real(kind=dbl_kind), intent(in) :: & zqin , & ! ice enthalpy (J m-3) zSin ! ice layer bulk salinity (ppt) @@ -358,6 +350,8 @@ function icepack_mushy_temperature_mush(zqin, zSin) result(zTin) real(kind=dbl_kind) :: & zTin ! ice layer temperature (C) +!autodocument_end + real(kind=dbl_kind) :: & qb , & ! liquidus break enthalpy q0 , & ! fully melted enthalpy @@ -454,11 +448,10 @@ function icepack_mushy_temperature_mush(zqin, zSin) result(zTin) end function icepack_mushy_temperature_mush !======================================================================= +! Temperature of mush from mush enthalpy and liquid fraction function temperature_mush_liquid_fraction(zqin, phi) result(zTin) - ! temperature of mush from mush enthalpy - real(kind=dbl_kind), intent(in) :: & zqin , & ! ice enthalpy (J m-3) phi ! liquid fraction @@ -474,11 +467,10 @@ function temperature_mush_liquid_fraction(zqin, phi) result(zTin) end function temperature_mush_liquid_fraction !======================================================================= +! Mush heat conductivity from mush temperature and bulk salinity function heat_conductivity(zTin, zSin) result(km) - ! msuh heat conductivity from mush temperature and bulk salinity - real(kind=dbl_kind), intent(in) :: & zTin , & ! ice layer temperature (C) zSin ! ice layer bulk salinity (ppt) @@ -497,18 +489,22 @@ function heat_conductivity(zTin, zSin) result(km) end function heat_conductivity - !======================================================================= +!======================================================================= +!autodocument_start icepack_mushy_liquid_fraction +! Liquid fraction of mush from mush temperature and bulk salinity function icepack_mushy_liquid_fraction(zTin, zSin) result(phi) - ! liquid fraction of mush from mush temperature and bulk salinity - real(kind=dbl_kind), intent(in) :: & zTin, & ! ice layer temperature (C) zSin ! ice layer bulk salinity (ppt) real(kind=dbl_kind) :: & - phi , & ! liquid fraction + phi ! liquid fraction + +!autodocument_end + + real(kind=dbl_kind) :: & Sbr ! brine salinity (ppt) character(len=*),parameter :: subname='(icepack_mushy_liquid_fraction)' @@ -521,5 +517,3 @@ end function icepack_mushy_liquid_fraction !======================================================================= end module icepack_mushy_physics - - diff --git a/columnphysics/icepack_therm_itd.F90 b/columnphysics/icepack_therm_itd.F90 index 3aac1ac70..c16e38fe7 100644 --- a/columnphysics/icepack_therm_itd.F90 +++ b/columnphysics/icepack_therm_itd.F90 @@ -915,7 +915,7 @@ subroutine lateral_melt (dt, ncat, & real (kind=dbl_kind), intent(in) :: & rside , & ! fraction of ice that melts laterally wlat ! lateral melt rate (m/s) - + real (kind=dbl_kind), intent(inout) :: & fside ! lateral heat flux (W/m^2) @@ -982,7 +982,7 @@ subroutine lateral_melt (dt, ncat, & f_flx ! real (kind=dbl_kind) :: & - sicen, & + sicen, & etot, & ! column energy per itd cat, for FSD code elapsed_t, & ! FSD subcycling subdt ! FSD timestep (s) @@ -1064,8 +1064,8 @@ subroutine lateral_melt (dt, ncat, & do k = 1, nilyr etot = etot + trcrn(nt_qice+k-1,n) * vicen(n)/real(nilyr,kind=dbl_kind) enddo ! nilyr - - ! lateral heat flux, fside < 0 + + ! lateral heat flux, fside < 0 fside = fside + rsiden(n)*etot/dt enddo ! ncat @@ -1245,7 +1245,7 @@ subroutine lateral_melt (dt, ncat, & if (tr_fsd) then trcrn(nt_fsd:nt_fsd+nfsd-1,:) = afsdn - + call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) if (icepack_warnings_aborted(subname)) return diff --git a/configuration/driver/icedrv_RunMod.F90 b/configuration/driver/icedrv_RunMod.F90 index a51a9e72f..db97c79c6 100644 --- a/configuration/driver/icedrv_RunMod.F90 +++ b/configuration/driver/icedrv_RunMod.F90 @@ -177,7 +177,7 @@ subroutine ice_step if (tr_fsd .and. wave_spec) call step_dyn_wave(dt) do k = 1, ndtd - + ! horizontal advection of ice or open water into the single column call step_lateral_flux_scm(dt_dyn) diff --git a/configuration/driver/icedrv_init.F90 b/configuration/driver/icedrv_init.F90 index 5a1dbac77..62b852565 100644 --- a/configuration/driver/icedrv_init.F90 +++ b/configuration/driver/icedrv_init.F90 @@ -278,7 +278,7 @@ subroutine input_data ocn_data_type = 'default' ! source of ocean forcing data ocn_data_file = ' ' ! ocean forcing data file ice_data_file = ' ' ! ice forcing data file (opening, closing) - lateral_flux_type = 'uniform_ice' ! if 'uniform_ice' assume closing + lateral_flux_type = 'uniform_ice' ! if 'uniform_ice' assume closing ! fluxes in uniform ice bgc_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) bgc_data_type = 'default' ! source of BGC forcing data diff --git a/configuration/driver/icedrv_restart.F90 b/configuration/driver/icedrv_restart.F90 index 745ec9210..7202da455 100644 --- a/configuration/driver/icedrv_restart.F90 +++ b/configuration/driver/icedrv_restart.F90 @@ -30,9 +30,9 @@ module icedrv_restart write_restart_fsd, read_restart_fsd, & write_restart_iso, read_restart_iso, & write_restart_aero, read_restart_aero - + character (len=3), private :: nchar ! - + logical (kind=log_kind), private :: diag ! netCDF diagnostics flag #ifdef USE_NETCDF @@ -59,7 +59,7 @@ module icedrv_restart !======================================================================= !---! these subroutines write/read restart data files .. ! Which can either be in unformatted Fortran format -! (restart_format = 'bin') or NetCDF (restart_format = 'nc') +! (restart_format = 'bin') or NetCDF (restart_format = 'nc') !======================================================================= ! Dumps all values needed for a restart @@ -96,7 +96,7 @@ subroutine dumpfile character(len=char_len_long) :: filename character(len=*), parameter :: subname='(dumpfile)' - + #ifdef USE_NETCDF ! local variables if we're writing in NetCDF integer (kind=int_kind) :: & @@ -108,7 +108,7 @@ subroutine dumpfile ! get year iyear = nyr + year_init - 1 - + ! query which tracers are active and their indices call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & nt_qice_out=nt_qice, nt_qsno_out=nt_qsno) @@ -228,14 +228,14 @@ subroutine dumpfile ! called in icedrv_RunMod.F90 to prevent circular dependencies ! if (solve_zsal .or. skl_bgc .or. z_tracers) & ! call write_restart_bgc ! biogeochemistry - + ! Close netcdf file if (restart_format == 'nc') then #ifdef USE_NETCDF status = nf90_close(ncid) if (status /= nf90_noerr) call icedrv_system_abort(string=subname, & file=__FILE__,line= __LINE__) -#endif +#endif endif end subroutine dumpfile @@ -284,7 +284,7 @@ subroutine restartfile (ice_ic) ! local variable for reading from a netcdf file integer (kind=int_kind) :: & status - + ! Query tracers call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & nt_qice_out=nt_qice, nt_qsno_out=nt_qsno) @@ -455,7 +455,7 @@ subroutine read_restart_field(nu,work,ndim,name) real (kind=dbl_kind), dimension(nx,ndim), intent(inout) :: & work ! input array (real, 8-byte) - + character (len=*), intent(in), optional :: & name @@ -514,10 +514,10 @@ subroutine write_restart_field(nu,work,ndim,vname,dims) real (kind=dbl_kind), dimension(nx,ndim), intent(in) :: & work ! input array (real, 8-byte) - + character (len=*), intent(in), optional :: & vname ! variable name for netcdf output - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -540,7 +540,7 @@ subroutine write_restart_field(nu,work,ndim,vname,dims) status, & ! Status variable from netCDF routine varid ! Variable ID #endif - + if (restart_format == 'bin') then do n = 1, ndim work2(:) = work(:,n) @@ -724,10 +724,10 @@ end subroutine read_restart_snow ! author Elizabeth C. Hunke, LANL subroutine write_restart_age(dims) - + use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -761,7 +761,7 @@ subroutine read_restart_age() call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__,line= __LINE__) - + call read_restart_field(nu_restart,trcrn(:,nt_iage,:),ncat,'iage') end subroutine read_restart_age @@ -775,7 +775,7 @@ subroutine write_restart_fsd(dims) use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat, nfsd - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -831,10 +831,10 @@ subroutine write_restart_FY(dims) use icedrv_flux, only: frz_onset use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs - + integer (kind=int_kind) :: nt_FY character(len=*), parameter :: subname='(write_restart_FY)' @@ -940,7 +940,7 @@ subroutine write_restart_pond_lvl(dims) use icedrv_flux, only: fsnow use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -1007,7 +1007,7 @@ subroutine write_restart_aero(dims) use icedrv_domain_size, only: n_aero use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -1092,7 +1092,7 @@ subroutine write_restart_iso(dims) use icedrv_domain_size, only: n_iso use icedrv_state, only: trcrn use icedrv_domain_size, only: ncat - + integer (kind=int_kind), intent(in), optional :: & dims(:) ! netcdf dimension IDs @@ -1331,7 +1331,7 @@ subroutine write_restart_field_nc1D(ncid,nrec,work,atype,vname,ndim3,diag) status = nf90_inq_varid(ncid,trim(vname),varid) if (status /= 0) then - write(nu_diag,*) 'Writing out ',trim(vname) + write(nu_diag,*) 'Writing out ',trim(vname) write(nu_diag,*) 'Erros Status ',status call icedrv_system_abort(string='Write out restart', & file=__FILE__,line= __LINE__) @@ -1346,7 +1346,7 @@ subroutine ice_write_nc2D(fid, nrec, varid, work, diag) ! Write a 2D field (nx, ncat) in NetCDF restart ! author Chris Riedel, NCAR - + use icedrv_domain_size, only: ncat,nx integer (kind=int_kind), intent(in) :: & @@ -1368,7 +1368,7 @@ subroutine ice_write_nc2D(fid, nrec, varid, work, diag) id, & ! dimension index dimlen ! size of dimension integer (kind=int_kind) :: start2(2),count2(2) - + real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array @@ -1382,7 +1382,7 @@ subroutine ice_write_nc2D(fid, nrec, varid, work, diag) count2(1) = nx start2(2) = 1 count2(2) = ncat - + status = nf90_put_var( fid, varid, work, & start=start2, & count=count2) @@ -1462,7 +1462,7 @@ end subroutine ice_write_nc1D !======================================================================= subroutine read_restart_field_net2D(nu,nrec,work,vname,ndim3, & diag) - + ! author Chris Riedel, NCAR use icedrv_domain_size, only: ncat,nx @@ -1493,7 +1493,7 @@ end subroutine read_restart_field_net2D !======================================================================= subroutine read_restart_field_net1D(nu,nrec,work,vname,ndim3, & diag) - + ! author Chris Riedel, NCAR use icedrv_domain_size, only: ncat,nx @@ -1519,11 +1519,11 @@ subroutine read_restart_field_net1D(nu,nrec,work,vname,ndim3, & status ! status variable from netCDF routine call ice_read_nc1D(ncid, 1, vname, work, diag) - + end subroutine read_restart_field_net1D !======================================================================= subroutine ice_read_nc2D(fid, nrec, varname, work, diag) - + ! author Chris Riedel, NCAR use icedrv_domain_size, only: ncat,nx @@ -1582,11 +1582,11 @@ subroutine ice_read_nc2D(fid, nrec, varname, work, diag) asum = sum (work) write(nu_diag,*) ' min, max, sum =', amin, amax, asum endif - + end subroutine ice_read_nc2D !======================================================================= subroutine ice_read_nc1D(fid, nrec, varname, work, diag) - + ! author Chris Riedel, NCAR use icedrv_domain_size, only: ncat,nx diff --git a/configuration/driver/icedrv_step.F90 b/configuration/driver/icedrv_step.F90 index add380006..f21bc1677 100644 --- a/configuration/driver/icedrv_step.F90 +++ b/configuration/driver/icedrv_step.F90 @@ -713,28 +713,28 @@ subroutine step_lateral_flux_scm (dt) use icedrv_flux, only: closing, opening use icedrv_init, only: tmask use icedrv_state, only: vsnon, aicen, vicen, aice0 - + real (kind=dbl_kind), intent(in) :: & dt ! time step - + ! local variables - + integer (kind=int_kind) :: & i, & ! horizontal indices n ! ice thickness category index ! - + real (kind=dbl_kind) :: & expansion_ratio ! how much the ice area will change - + character(len=*), parameter :: subname='(step_lateral_flux_scm)' - + !----------------------------------------------------------------- ! query icepack values !----------------------------------------------------------------- call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__,line= __LINE__) - + !----------------------------------------------------------------- ! Ice advection !----------------------------------------------------------------- @@ -742,10 +742,10 @@ subroutine step_lateral_flux_scm (dt) if (trim(ocn_data_type) == "SHEBA") then ! Currently only uniform_ice (and none) advection is implemented if (trim(lateral_flux_type) == "uniform_ice") then - + do i = 1, nx - - if (tmask(i)) then + + if (tmask(i)) then ! We assume that this single column grid cell is surrounded by ! identical ice. If so, ice closing implies the flux of ! this surrounding ice into the single column grid cell. @@ -761,16 +761,16 @@ subroutine step_lateral_flux_scm (dt) vsnon(i,n) = vsnon(i,n) * expansion_ratio enddo ! n endif ! tmask - + enddo ! i elseif (trim(lateral_flux_type) == "open_water") then do i = 1, nx - - if (tmask(i)) then + + if (tmask(i)) then ! We assume that this single column grid cell is surrounded by ! open water. If so, net ice closing implies the flux of ! this surrounding open water into the single column grid cell. - ! To accomplish this without modifying the icepack + ! To accomplish this without modifying the icepack ! columnphysics code, we do nothing at this step. Within the ! ridge_ice subroutine, icepack will ridge ice by the amount ! given in the forcing. This will drop the cell area (asum) @@ -790,7 +790,7 @@ subroutine step_lateral_flux_scm (dt) enddo ! n endif ! expansion ratio < 1 endif ! tmask - + enddo ! i else call icedrv_system_abort(string=subname//' ERROR: unknown lateral_flux_type: '& @@ -801,9 +801,9 @@ subroutine step_lateral_flux_scm (dt) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__, line=__LINE__) - + end subroutine step_lateral_flux_scm - + !======================================================================= ! ! Run one time step of ridging. diff --git a/doc/source/user_guide/interfaces.include b/doc/source/user_guide/interfaces.include index 95db22ba6..c45625551 100644 --- a/doc/source/user_guide/interfaces.include +++ b/doc/source/user_guide/interfaces.include @@ -601,6 +601,65 @@ icepack_step_ridge +icepack_mushy_physics.F90 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. _icepack_mushy_density_brine: + +icepack_mushy_density_brine +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. code-block:: fortran + + ! Compute density of brine from brine salinity + + function icepack_mushy_density_brine(Sbr) result(rho) + + real(kind=dbl_kind), intent(in) :: & + Sbr ! brine salinity (ppt) + + real(kind=dbl_kind) :: & + rho ! brine density (kg m-3) + + + +.. _icepack_mushy_temperature_mush: + +icepack_mushy_temperature_mush +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. code-block:: fortran + + ! Temperature of mush from mush enthalpy and bulk salinity + + function icepack_mushy_temperature_mush(zqin, zSin) result(zTin) + + real(kind=dbl_kind), intent(in) :: & + zqin , & ! ice enthalpy (J m-3) + zSin ! ice layer bulk salinity (ppt) + + real(kind=dbl_kind) :: & + zTin ! ice layer temperature (C) + + + +.. _icepack_mushy_liquid_fraction: + +icepack_mushy_liquid_fraction +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. code-block:: fortran + + ! Liquid fraction of mush from mush temperature and bulk salinity + + function icepack_mushy_liquid_fraction(zTin, zSin) result(phi) + + real(kind=dbl_kind), intent(in) :: & + zTin, & ! ice layer temperature (C) + zSin ! ice layer bulk salinity (ppt) + + real(kind=dbl_kind) :: & + phi ! liquid fraction + + + icepack_ocean.F90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1908,7 +1967,7 @@ icepack_step_therm2 Tf, sss, & salinz, & rside, meltl, & - fside, & + fside, wlat, & frzmlt, frazil, & frain, fpond, & fresh, fsalt, & @@ -1948,10 +2007,12 @@ icepack_step_therm2 Tf , & ! freezing temperature (C) sss , & ! sea surface salinity (ppt) rside , & ! fraction of ice that melts laterally - fside , & ! lateral heat flux (W/m^2) frzmlt , & ! freezing/melting potential (W/m^2) wave_sig_ht ! significant height of waves in ice (m) + real (kind=dbl_kind), intent(in), optional :: & + wlat ! lateral melt rate (m/s) + real (kind=dbl_kind), dimension(:), intent(in) :: & wave_spectrum ! ocean surface wave spectrum E(f) (m^2 s) @@ -1990,6 +2051,7 @@ icepack_step_therm2 real (kind=dbl_kind), intent(inout) :: & aice , & ! sea ice concentration aice0 , & ! concentration of open water + fside , & ! lateral heat flux (W/m^2) frain , & ! rainfall rate (kg/m^2 s) fpond , & ! fresh water flux to ponds (kg/m^2/s) fresh , & ! fresh water flux to ocean (kg/m^2/s) @@ -2226,7 +2288,7 @@ icepack_step_therm1 fbot , & Tbot , Tsnice , & frzmlt , rside , & - fside , & + fside , wlat , & fsnow , frain , & fpond , fsloss , & fsurf , fsurfn , & @@ -2367,21 +2429,28 @@ icepack_step_therm1 mlt_onset , & ! day of year that sfc melting begins frz_onset ! day of year that freezing begins (congel or frazil) + real (kind=dbl_kind), intent(out), optional :: & + wlat ! lateral melt rate (m/s) + real (kind=dbl_kind), intent(inout), optional :: & fswthru_vdr , & ! vis dir shortwave penetrating to ocean (W/m^2) fswthru_vdf , & ! vis dif shortwave penetrating to ocean (W/m^2) fswthru_idr , & ! nir dir shortwave penetrating to ocean (W/m^2) fswthru_idf , & ! nir dif shortwave penetrating to ocean (W/m^2) dsnow , & ! change in snow depth (m/step-->cm/day) - meltsliq , & ! mass of snow melt (kg/m^2) fsloss ! rate of snow loss to leads (kg/m^2/s) + real (kind=dbl_kind), intent(out), optional :: & + meltsliq ! mass of snow melt (kg/m^2) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & Qa_iso , & ! isotope specific humidity (kg/kg) Qref_iso , & ! isotope 2m atm ref spec humidity (kg/kg) fiso_atm , & ! isotope deposition rate (kg/m^2 s) fiso_ocn , & ! isotope flux to ocean (kg/m^2/s) - fiso_evap , & ! isotope evaporation (kg/m^2/s) + fiso_evap ! isotope evaporation (kg/m^2/s) + + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & meltsliqn ! mass of snow melt (kg/m^2) real (kind=dbl_kind), dimension(:,:), intent(inout), optional :: & From f36fccbddd20ef64bb95282dd85db726dbaa1f76 Mon Sep 17 00:00:00 2001 From: apcraig Date: Sat, 13 May 2023 09:39:43 -0600 Subject: [PATCH 2/2] Add cpp CCSMCOUPLED to trigger CESMCOUPLED cpp in icepack_kinds. icepack_kinds is used by all files in columnphysics, so should be comprehensive. --- columnphysics/icepack_kinds.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/columnphysics/icepack_kinds.F90 b/columnphysics/icepack_kinds.F90 index 664643fa3..832f45466 100644 --- a/columnphysics/icepack_kinds.F90 +++ b/columnphysics/icepack_kinds.F90 @@ -1,3 +1,6 @@ +#ifdef CCSMCOUPLED +#define CESMCOUPLED +#endif !======================================================================= ! Defines variable precision for all common data types