Calculates the derivative of the water density.
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) | :: | d_temperature | A field containing the derivative of the temperature of the
water, in teh same direction as |
||
class(scalar_field), | intent(in) | :: | salinity | A field containing the salinity of the water |
||
class(scalar_field), | intent(in) | :: | d_salinity | A field containing the derivative of the salinity of the
water, in the same direction as |
||
integer, | intent(in) | :: | dir | The direction in which to take the derivative |
A field containing the density of the water
function prescribed_water_deriv(this, temperature, d_temperature, salinity, &
d_salinity, dir) result(d_density)
!* Author: Chris MacMackin
! Date: July 2017
!
! Calculates the derivative of the water density.
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) :: d_temperature
!! A field containing the derivative of the temperature of the
!! water, in teh same direction as `dir`
class(scalar_field), intent(in) :: salinity
!! A field containing the salinity of the water
class(scalar_field), intent(in) :: d_salinity
!! A field containing the derivative of the salinity of the
!! water, in the same direction as `dir`
integer, intent(in) :: dir
!! The direction in which to take the derivative
class(scalar_field), pointer :: d_density
!! A field containing the density of the water
call temperature%guard_temp(); call salinity%guard_temp()
call d_temperature%guard_temp(); call d_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(d_density)
d_density = uniform_scalar_field(0._r8)
else
call this%density%allocate_scalar_field(d_density)
d_density = this%density%d_dx(1)
end if
call temperature%clean_temp(); call salinity%clean_temp()
call d_temperature%clean_temp(); call d_salinity%clean_temp()
call d_density%set_temp()
end function prescribed_water_deriv