prescribed_water_density Function

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

Returns the density corresponding to the prescribed salinity, as calculated in the constructor.

Arguments

Type IntentOptional AttributesName
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

Return Value class(scalar_field), pointer

A field containing the density of the water


Calls

proc~~prescribed_water_density~~CallsGraph proc~prescribed_water_density prescribed_water_density uniform_scalar_field uniform_scalar_field proc~prescribed_water_density->uniform_scalar_field

Contents


Source Code

  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