! ADAPTATION GCM POUR CP(T) c====================================================================== c S. Lebonnois, 10/2007: c c TERRE: Cp(T) = cpp c cpp=RCPD=cp0 = 1000. c R/RCPD = RKAPPA c c La fonction d'Exner reste pk = RCPD*(play/pref)**RKAPPA c c T et teta (temperature potentielle) sont liees par: c c integrale[teta a T](cp/T dT) = integrale[pref a p](R/p dp) c c Dans le cas de la Terre, ca donne: c c teta = T * (pref/p)**RKAPPA c ou c teta = T * RCPD/pk c c On passe de T a teta par t2tpot(t,teta,pk) c On passe de teta a T par tpot2t(teta,t,pk) c c c Pour DT <-> Dteta, on utilise: dteta = dT * teta/T c -> routine dt2dtpot(dt,dteta,t,teta) c (utilisee seulement pour le contregradient) c c====================================================================== FUNCTION cpdet(t) IMPLICIT none #include "cpdet.h" real cpdet,t cpdet = cp0 return end c====================================================================== c====================================================================== SUBROUTINE t2tpot(npoints, yt, yteta, ypk) IMPLICIT none c====================================================================== c Arguments: c c yt --------input-R- Temperature c yteta-------output-R- Temperature potentielle c ypk --------input-R- Fonction d'Exner: RCPD*(pplay/pref)**RKAPPA c c====================================================================== #include "cpdet.h" integer npoints REAL yt(npoints), yteta(npoints), ypk(npoints) yteta = yt * cp0/ypk return end c====================================================================== c====================================================================== SUBROUTINE tpot2t(npoints, yteta, yt, ypk) IMPLICIT none c====================================================================== c Arguments: c c yteta--------input-R- Temperature potentielle c yt -------output-R- Temperature c ypk --------input-R- Fonction d'Exner: RCPD*(pplay/pref)**RKAPPA c c====================================================================== #include "cpdet.h" integer npoints REAL yt(npoints), yteta(npoints), ypk(npoints) yt = yteta * ypk/cp0 return end c====================================================================== c====================================================================== SUBROUTINE dt2dtpot(npoints, ydt, ydteta, yt, yteta, ypk, ydpk) IMPLICIT none c====================================================================== c Arguments: c c ydt --------input-R- D Temperature c ydteta------output-R- D Temperature potentielle c yt --------input-R- Temperature c yteta--------input-R- Temperature potentielle c ypk --------input-R- Fonction d'Exner: RCPD*(pplay/pref)**RKAPPA c ydpk -------input-R- D Fonction d'Exner c c====================================================================== #include "cpdet.h" integer npoints REAL ydt(npoints), ydteta(npoints), ydpk(npoints) REAL yt(npoints), yteta(npoints), ypk(npoints) ydteta = yteta* (ydt/yt - ydpk/ypk) return end