110 |
CEOP |
CEOP |
111 |
|
|
112 |
C !FUNCTIONS: |
C !FUNCTIONS: |
113 |
_RL sw_adtg |
_RL sw_ptmp |
114 |
EXTERNAL sw_adtg |
EXTERNAL sw_ptmp |
115 |
|
|
116 |
C !LOCAL VARIABLES: |
SW_temp = SW_PTMP (S,T,PR,P) |
|
_RL del_P ,del_th, th, q |
|
|
_RL onehalf, two, three |
|
|
PARAMETER ( onehalf = 0.5 _d 0, two = 2. _d 0, three = 3. _d 0 ) |
|
|
|
|
|
C theta1 |
|
|
C-- here we swap P and PR in order to get in-situ temperature |
|
|
C del_P = PR - P ! to get potential from in-situ temperature |
|
|
del_P = P - PR ! to get in-situ from potential temperature |
|
|
del_th = del_P*sw_adtg(S,T,PR) |
|
|
th = T + onehalf*del_th |
|
|
q = del_th |
|
|
C theta2 |
|
|
del_th = del_P*sw_adtg(S,th,PR+onehalf*del_P) |
|
|
|
|
|
th = th + (1 - 1/sqrt(two))*(del_th - q) |
|
|
q = (two-sqrt(two))*del_th + (-two+three/sqrt(two))*q |
|
|
|
|
|
C theta3 |
|
|
del_th = del_P*sw_adtg(S,th,PR+onehalf*del_P) |
|
|
th = th + (1 + 1/sqrt(two))*(del_th - q) |
|
|
q = (two + sqrt(two))*del_th + (-two-three/sqrt(two))*q |
|
|
|
|
|
C theta4 |
|
|
del_th = del_P*sw_adtg(S,th,PR+del_P) |
|
|
SW_temp= th + (del_th - two*q)/(two*three) |
|
117 |
|
|
118 |
RETURN |
RETURN |
119 |
END |
END |