Skip to content

Commit 9e7cfe9

Browse files
authored
Alternative interface to EQN_OF_STATE="LINEAR" (#842)
* Alternative interface to EQN_OF_STATE="LINEAR" The existing interface to EQN_OF_STATE="LINEAR" is based on RHO_T0_S0, the density at T=0, S=0. This is the most computationally efficient way to specify a linear EOS, but we are usually linearizing about a reference T and S that are not 0. The new interface is based on TREF, SREF, and RHO_TREF_SREF, where: RHO(T,S) = RHO_TREF_SREF + DRHO_DT*(T-TREF) + DRHO_DS*(S-SREF) RHO_T0_S0 = RHO_TREF_SREF - DRHO_DT*TREF - DRHO_DS*SREF RHO(T,S) = RHO_T0_S0 + DRHO_DT*T + DRHO_DS*S The defaults for TREF and SREF are zero and for RHO_TREF_SREF is 1000.0. So if the new interface is not used answers are not changed but there are always new model parameters. * corrected spelling error
1 parent 5f23058 commit 9e7cfe9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/equation_of_state/MOM_EOS.F90

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,9 @@ subroutine EOS_init(param_file, EOS, US)
14721472
character(len=12) :: TFREEZE_DEFAULT ! The default freezing point expression
14731473
character(len=40) :: tmpstr
14741474
logical :: EOS_quad_default
1475+
real :: Rho_Tref_Sref ! Density at Tref degC and Sref ppt [kg m-3]
1476+
real :: Tref ! Reference temperature [degC]
1477+
real :: Sref ! Reference salinity [psu]
14751478

14761479
! Read all relevant parameters and write them to the model log.
14771480
call log_version(param_file, mdl, version, "")
@@ -1512,10 +1515,19 @@ subroutine EOS_init(param_file, EOS, US)
15121515
trim(tmpstr)//'"', 5)
15131516

15141517
if (EOS%form_of_EOS == EOS_LINEAR) then
1518+
! RHO(T,S) = RHO_TREF_SREF + DRHO_DT*(T-TREF) + DRHO_DS*(S-SREF)
1519+
! = RHO_TREF_SREF - DRHO_DT*TREF - DRHO_DS*SREF + DRHO_DT*T + DRHO_DS*S
1520+
! = RHO_T0_S0 + DRHO_DT*T + DRHO_DS*S
15151521
EOS%Compressible = .false.
1516-
call get_param(param_file, mdl, "RHO_T0_S0", EOS%Rho_T0_S0, &
1522+
call get_param(param_file, mdl, "RHO_TREF_SREF", Rho_Tref_Sref, &
1523+
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
1524+
"this is the density at T=TREF, S=SREF.", units="kg m-3", default=1000.0)
1525+
call get_param(param_file, mdl, "TREF", Tref, &
1526+
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
1527+
"this is the reference temperature.", units="degC", default=0.0)
1528+
call get_param(param_file, mdl, "SREF", Sref, &
15171529
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
1518-
"this is the density at T=0, S=0.", units="kg m-3", default=1000.0)
1530+
"this is the reference salinity.", units="psu", default=0.0)
15191531
call get_param(param_file, mdl, "DRHO_DT", EOS%dRho_dT, &
15201532
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
15211533
"this is the partial derivative of density with "//&
@@ -1524,6 +1536,10 @@ subroutine EOS_init(param_file, EOS, US)
15241536
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
15251537
"this is the partial derivative of density with salinity.", &
15261538
units="kg m-3 ppt-1", default=0.8)
1539+
call get_param(param_file, mdl, "RHO_T0_S0", EOS%Rho_T0_S0, &
1540+
"When EQN_OF_STATE="//trim(EOS_LINEAR_STRING)//", "//&
1541+
"this is the density at T=0, S=0.", units="kg m-3", &
1542+
default=Rho_Tref_Sref - EOS%dRho_dT * Tref - EOS%dRho_dS * Sref)
15271543
call EOS_manual_init(EOS, form_of_EOS=EOS_LINEAR, Rho_T0_S0=EOS%Rho_T0_S0, dRho_dT=EOS%dRho_dT, dRho_dS=EOS%dRho_dS)
15281544
endif
15291545
if (EOS%form_of_EOS == EOS_WRIGHT) then

0 commit comments

Comments
 (0)