-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrhoinsitu.F90
executable file
·51 lines (40 loc) · 1.27 KB
/
rhoinsitu.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
!> \file rhoinsitu.f90
!! \BRIEF
!> Module with rhoinsitu subroutine - compute in situ density from S, Tis, P
MODULE mrhoinsitu
CONTAINS
!> Compute in situ density from salinity (psu), in situ temperature (C), & pressure (db).
!! This subroutine is needed because rho is a function (using scalars not arrays)
SUBROUTINE rhoinsitu(salt, tempis, pdbar, N, rhois)
! Purpose:
! Compute in situ density from salinity (psu), in situ temperature (C), & pressure (db)
! Needed because rho is a function
USE msingledouble
USE mrho
IMPLICIT NONE
INTEGER :: N
! INPUT variables
! salt = salinity [psu]
! tempis = in situ temperature [C]
! pdbar = pressure [db]
!> salinity [psu]
REAL(kind=rx), INTENT(in), DIMENSION(N) :: salt
!> in situ temperature [C]
REAL(kind=rx), INTENT(in), DIMENSION(N) :: tempis
!> pressure [db]
REAL(kind=rx), INTENT(in), DIMENSION(N) :: pdbar
!f2py optional , depend(salt) :: n=len(salt)
! OUTPUT variables:
! rhois = in situ density
!> in situ density [kg/m3]
REAL(kind=rx), INTENT(out), DIMENSION(N) :: rhois
! Local variables
INTEGER :: i
! REAL(kind=rx) :: rho
! EXTERNAL rho
DO i = 1,N
rhois(i) = rho(salt(i), tempis(i), pdbar(i)/10.)
END DO
RETURN
END SUBROUTINE rhoinsitu
END MODULE mrhoinsitu