source: codes/icosagcm/devel/src/kernels_hex/compute_temperature.k90 @ 915

Last change on this file since 915 was 915, checked in by dubos, 5 years ago

devel : DYSL for compute_temperature

File size: 2.5 KB
Line 
1   !--------------------------------------------------------------------------
2   !---------------------------- compute_temperature ----------------------------------
3   SELECT CASE(caldyn_thermo)
4   CASE(thermo_theta)
5      IF(physics_thermo==thermo_fake_moist) THEN
6         DO l = ll_begin, ll_end
7            !DIR$ SIMD
8            DO ij=ij_begin, ij_end
9               p_ik = pmid(ij,l)
10               theta_ik = temp(ij,l)
11               qv = q(ij,l,1) ! water vapor mixing ratio = mv/md
12               temp_ik = theta_ik*((p_ik/preff)**kappa)
13               temp_ik = temp_ik/(1+0.608*qv)
14               temp(ij,l) = temp_ik
15            END DO
16         END DO
17      ELSE
18         DO l = ll_begin, ll_end
19            !DIR$ SIMD
20            DO ij=ij_begin, ij_end
21               p_ik = pmid(ij,l)
22               theta_ik = temp(ij,l)
23               qv = q(ij,l,1) ! water vapor mixing ratio = mv/md
24               temp_ik = theta_ik*((p_ik/preff)**kappa)
25               temp(ij,l) = temp_ik
26            END DO
27         END DO
28      END IF
29   CASE(thermo_entropy)
30      IF(physics_thermo==thermo_fake_moist) THEN
31         DO l = ll_begin, ll_end
32            !DIR$ SIMD
33            DO ij=ij_begin, ij_end
34               p_ik = pmid(ij,l)
35               theta_ik = temp(ij,l)
36               qv = q(ij,l,1) ! water vapor mixing ratio = mv/md
37               temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp)
38               temp_ik = temp_ik/(1+0.608*qv)
39               temp(ij,l) = temp_ik
40            END DO
41         END DO
42      ELSE
43         DO l = ll_begin, ll_end
44            !DIR$ SIMD
45            DO ij=ij_begin, ij_end
46               p_ik = pmid(ij,l)
47               theta_ik = temp(ij,l)
48               qv = q(ij,l,1) ! water vapor mixing ratio = mv/md
49               temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp)
50               temp(ij,l) = temp_ik
51            END DO
52         END DO
53      END IF
54   CASE(thermo_moist)
55      DO l = ll_begin, ll_end
56         !DIR$ SIMD
57         DO ij=ij_begin, ij_end
58            p_ik = pmid(ij,l)
59            theta_ik = temp(ij,l)
60            qv = q(ij,l,1) ! water vapor mixing ratio = mv/md
61            Rmix = Rd+qv*Rv
62            chi = ( theta_ik + Rmix*log(p_ik/preff) ) / (cpp + qv*cppv) ! log(T/Treff)
63            temp_ik = Treff*exp(chi)
64            temp(ij,l) = temp_ik
65         END DO
66      END DO
67   END SELECT
68   !---------------------------- compute_temperature ----------------------------------
69   !--------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.