[1017] | 1 | module cpdet_mod |
---|
[5] | 2 | |
---|
[1017] | 3 | implicit none |
---|
| 4 | |
---|
| 5 | ! ADAPTATION OF GCM TO CP(T) |
---|
| 6 | !====================================================================== |
---|
| 7 | ! S. Lebonnois, 10/2010 |
---|
| 8 | ! |
---|
| 9 | ! Cp must be computed using cpdet(t) to be valid |
---|
| 10 | ! |
---|
| 11 | ! The Exner function is still pk = RCPD*(play/pref)**RKAPPA |
---|
| 12 | ! (RCPD=cpp, RKAPPA=kappa) |
---|
| 13 | ! |
---|
| 14 | ! One goes from T to teta (potential temperature) using t2tpot(t,teta,pk) |
---|
| 15 | ! One goes from teta to T using tpot2t(teta,t,pk) |
---|
| 16 | ! |
---|
| 17 | !====================================================================== |
---|
| 18 | |
---|
| 19 | contains |
---|
| 20 | |
---|
[5] | 21 | SUBROUTINE ini_cpdet |
---|
[37] | 22 | |
---|
| 23 | USE control_mod, ONLY: planet_type |
---|
[5] | 24 | IMPLICIT none |
---|
[1017] | 25 | !====================================================================== |
---|
| 26 | ! Initialization of nu_venus and t0_venus |
---|
| 27 | !====================================================================== |
---|
[5] | 28 | |
---|
| 29 | ! for cpp, nu_venus and t0_venus: |
---|
| 30 | #include "comconst.h" |
---|
| 31 | |
---|
| 32 | if (planet_type.eq."venus") then |
---|
| 33 | nu_venus=0.35 |
---|
| 34 | t0_venus=460. |
---|
| 35 | else |
---|
| 36 | nu_venus=0. |
---|
| 37 | t0_venus=0. |
---|
| 38 | endif |
---|
| 39 | |
---|
| 40 | return |
---|
[1017] | 41 | end subroutine ini_cpdet |
---|
[5] | 42 | |
---|
[1017] | 43 | !====================================================================== |
---|
| 44 | !====================================================================== |
---|
[5] | 45 | |
---|
| 46 | FUNCTION cpdet(t) |
---|
[37] | 47 | |
---|
| 48 | USE control_mod, ONLY: planet_type |
---|
[5] | 49 | IMPLICIT none |
---|
| 50 | |
---|
| 51 | ! for cpp, nu_venus and t0_venus: |
---|
| 52 | #include "comconst.h" |
---|
| 53 | |
---|
[1017] | 54 | real,intent(in) :: t |
---|
| 55 | real cpdet |
---|
[5] | 56 | |
---|
| 57 | if (planet_type.eq."venus") then |
---|
| 58 | cpdet = cpp*(t/t0_venus)**nu_venus |
---|
| 59 | else |
---|
| 60 | cpdet = cpp |
---|
| 61 | endif |
---|
| 62 | |
---|
| 63 | return |
---|
[1017] | 64 | end function cpdet |
---|
[5] | 65 | |
---|
[1017] | 66 | !====================================================================== |
---|
| 67 | !====================================================================== |
---|
[5] | 68 | |
---|
| 69 | SUBROUTINE t2tpot(npoints, yt, yteta, ypk) |
---|
[1017] | 70 | !====================================================================== |
---|
| 71 | ! Arguments: |
---|
| 72 | ! |
---|
| 73 | ! yt --------input-R- Temperature |
---|
| 74 | ! yteta-------output-R- Temperature potentielle |
---|
| 75 | ! ypk --------input-R- Fonction d'Exner: RCPD*(pplay/pref)**RKAPPA |
---|
| 76 | ! |
---|
| 77 | !====================================================================== |
---|
[5] | 78 | |
---|
[37] | 79 | USE control_mod, ONLY: planet_type |
---|
| 80 | IMPLICIT NONE |
---|
| 81 | |
---|
[5] | 82 | ! for cpp, nu_venus and t0_venus: |
---|
| 83 | #include "comconst.h" |
---|
| 84 | |
---|
[1017] | 85 | integer,intent(in) :: npoints |
---|
| 86 | REAL,intent(in) :: yt(npoints), ypk(npoints) |
---|
| 87 | REAL,intent(out) :: yteta(npoints) |
---|
[5] | 88 | |
---|
| 89 | if (planet_type.eq."venus") then |
---|
| 90 | yteta = yt**nu_venus & |
---|
| 91 | & - nu_venus * t0_venus**nu_venus * log(ypk/cpp) |
---|
| 92 | yteta = yteta**(1./nu_venus) |
---|
| 93 | else |
---|
| 94 | yteta = yt * cpp/ypk |
---|
| 95 | endif |
---|
| 96 | |
---|
| 97 | return |
---|
[1017] | 98 | end subroutine t2tpot |
---|
[5] | 99 | |
---|
[1017] | 100 | !====================================================================== |
---|
| 101 | !====================================================================== |
---|
[5] | 102 | |
---|
| 103 | SUBROUTINE tpot2t(npoints,yteta, yt, ypk) |
---|
[1017] | 104 | !====================================================================== |
---|
| 105 | ! Arguments: |
---|
| 106 | ! |
---|
| 107 | ! yteta--------input-R- Temperature potentielle |
---|
| 108 | ! yt -------output-R- Temperature |
---|
| 109 | ! ypk --------input-R- Fonction d'Exner: RCPD*(pplay/pref)**RKAPPA |
---|
| 110 | ! |
---|
| 111 | !====================================================================== |
---|
[5] | 112 | |
---|
[37] | 113 | USE control_mod, ONLY: planet_type |
---|
| 114 | IMPLICIT NONE |
---|
[5] | 115 | |
---|
| 116 | ! for cpp, nu_venus and t0_venus: |
---|
| 117 | #include "comconst.h" |
---|
| 118 | |
---|
[1017] | 119 | integer,intent(in) :: npoints |
---|
| 120 | REAL,intent(in) :: yteta(npoints), ypk(npoints) |
---|
| 121 | REAL,intent(out) :: yt(npoints) |
---|
[5] | 122 | |
---|
| 123 | if (planet_type.eq."venus") then |
---|
| 124 | yt = yteta**nu_venus & |
---|
| 125 | & + nu_venus * t0_venus**nu_venus * log(ypk/cpp) |
---|
| 126 | yt = yt**(1./nu_venus) |
---|
| 127 | else |
---|
| 128 | yt = yteta * ypk/cpp |
---|
| 129 | endif |
---|
| 130 | |
---|
| 131 | return |
---|
[1017] | 132 | end subroutine tpot2t |
---|
[5] | 133 | |
---|
[1017] | 134 | !====================================================================== |
---|
| 135 | !====================================================================== |
---|
| 136 | ! |
---|
| 137 | ! ATTENTION |
---|
| 138 | ! |
---|
| 139 | ! Si un jour on a besoin, il faudra coder les routines |
---|
| 140 | ! dt2dtpot / dtpto2dt |
---|
| 141 | ! |
---|
| 142 | !====================================================================== |
---|
| 143 | !====================================================================== |
---|
| 144 | end module cpdet_mod |
---|