Returns the density corresponding to the prescribed salinity, as calculated in the constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(prescribed_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 |
A field containing the density of the water
function prescribed_water_density(this, temperature, salinity) result(density)
!* Author: Chris MacMackin
! Date: March 2017
!
! Returns the density corresponding to the prescribed salinity, as
! calculated in the constructor.
!
class(prescribed_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()
if (temperature == uniform_scalar_field(0._r8) .and. &
salinity == uniform_scalar_field(0._r8)) then
! Kludge to ensure correct ambient density is returned
call temperature%allocate_scalar_field(density)
density = uniform_scalar_field(0._r8)
else
call this%density%allocate_scalar_field(density)
density = this%density
end if
call temperature%clean_temp(); call salinity%clean_temp()
call density%set_temp()
end function prescribed_water_density