linear_water_density Function

private function linear_water_density(this, temperature, salinity) result(density)

Calculates the density of the water from the temperature and salinity, using a linear equatino of state,

Arguments

Type IntentOptional AttributesName
class(linear_eos), intent(in) :: this
class(scalar_field), intent(in) :: temperature

A field containing the temperature of the water

class(scalar_field), intent(in) :: salinity

A field containing the salinity of the water

Return Value class(scalar_field), pointer

A field containing the density of the water


Contents

Source Code


Source Code

  function linear_water_density(this, temperature, salinity) result(density)
    !* Author: Chris MacMackin
    !  Date: November 2016
    !
    ! Calculates the density of the water from the temperature and
    ! salinity, using a linear equatino of state, $$ \rho =
    ! \rho_0[1-\beta_T(T-T_0) + \beta_S(S-S_0)]. $$
    class(linear_eos), intent(in)    :: this
    class(scalar_field), intent(in)  :: temperature
      !! A field containing the temperature of the water
    class(scalar_field), intent(in)  :: salinity
      !! A field containing the salinity of the water
    class(scalar_field), pointer     :: density
      !! A field containing the density of the water
    call temperature%guard_temp(); call salinity%guard_temp()
    call salinity%allocate_scalar_field(density)
    density = this%ref_rho * (1.0_r8 - this%beta_t*(temperature - this%ref_t) &
                                     + this%beta_s*(salinity - this%ref_s))
    call temperature%clean_temp(); call salinity%clean_temp()
    call density%set_temp()
  end function linear_water_density