source: LMDZ6/branches/Amaury_dev/libf/phylmd/physiqex_mod.F90

Last change on this file was 5134, checked in by abarral, 4 months ago

Replace academic.h, alpale.h, comdissip.h, comdissipn.h, comdissnew.h by modules
Remove unused clesph0.h

File size: 4.5 KB
RevLine 
[4537]1! $Id: physiq.F 1565 2011-08-31 12:53:29Z jghattas $
2MODULE physiqex_mod
3
4IMPLICIT NONE
5
6CONTAINS
7
[5106]8      SUBROUTINE physiqex(nlon,nlev, &
[5087]9              debut,lafin,pdtphys, &
10              paprs,pplay,pphi,pphis,presnivs, &
11              u,v,rot,t,qx, &
12              flxmass_w, &
13              d_u, d_v, d_t, d_qx, d_ps)
[4537]14
[5101]15      USE dimphy, ONLY: klon,klev
16      USE infotrac_phy, ONLY: nqtot
[5112]17      USE lmdz_geometry, ONLY: latitude
[5101]18!      USE comcstphy, ONLY: rg
19      USE ioipsl, ONLY: ymds2ju
20      USE phys_state_var_mod, ONLY: phys_state_var_init
[5116]21      USE phyetat0_mod, ONLY: phyetat0
[4658]22      USE output_physiqex_mod, ONLY: output_physiqex
[4537]23
[5134]24      IMPLICIT NONE
[5099]25
[4537]26! Routine argument:
27
[5117]28      INTEGER,INTENT(IN) :: nlon ! number of atmospheric colums
29      INTEGER,INTENT(IN) :: nlev ! number of vertical levels (should be =klev)
30      logical,INTENT(IN) :: debut ! signals first CALL to physics
31      logical,INTENT(IN) :: lafin ! signals last CALL to physics
32      REAL,INTENT(IN) :: pdtphys ! physics time step (s)
33      REAL,INTENT(IN) :: paprs(klon,klev+1) ! interlayer pressure (Pa)
34      REAL,INTENT(IN) :: pplay(klon,klev) ! mid-layer pressure (Pa)
35      REAL,INTENT(IN) :: pphi(klon,klev) ! geopotential at mid-layer
36      REAL,INTENT(IN) :: pphis(klon) ! surface geopotential
37      REAL,INTENT(IN) :: presnivs(klev) ! pseudo-pressure (Pa) of mid-layers
38      REAL,INTENT(IN) :: u(klon,klev) ! eastward zonal wind (m/s)
39      REAL,INTENT(IN) :: v(klon,klev) ! northward meridional wind (m/s)
40      REAL,INTENT(IN) :: rot(klon,klev) ! northward meridional wind (m/s)
41      REAL,INTENT(IN) :: t(klon,klev) ! temperature (K)
42      REAL,INTENT(IN) :: qx(klon,klev,nqtot) ! tracers (.../kg_air)
43      REAL,INTENT(IN) :: flxmass_w(klon,klev) ! vertical mass flux
44      REAL,INTENT(OUT) :: d_u(klon,klev) ! physics tendency on u (m/s/s)
45      REAL,INTENT(OUT) :: d_v(klon,klev) ! physics tendency on v (m/s/s)
46      REAL,INTENT(OUT) :: d_t(klon,klev) ! physics tendency on t (K/s)
47      REAL,INTENT(OUT) :: d_qx(klon,klev,nqtot) ! physics tendency on tracers
48      REAL,INTENT(OUT) :: d_ps(klon) ! physics tendency on surface pressure
[4537]49
50!    include "clesphys.h"
51    INTEGER        length
52    PARAMETER    ( length = 100 )
53    REAL tabcntr0( length       )
54    INTEGER, PARAMETER :: longcles=20
55    REAL, SAVE :: clesphy0(longcles)
56    !$OMP THREADPRIVATE(clesphy0)
57
58
[5116]59REAL :: temp_newton(klon,klev)
60INTEGER :: k
[5103]61logical, save :: first=.TRUE.
[4537]62!$OMP THREADPRIVATE(first)
63
[5117]64REAL,save :: rg=9.81
[4658]65!$OMP THREADPRIVATE(rg)
66
[4537]67! For I/Os
[5116]68INTEGER :: itau0
69REAL :: zjulian
[4537]70
71
72!------------------------------------------------------------
73! Initialisations de la physique au premier pas de temps
74!------------------------------------------------------------
75
[5103]76PRINT*,'Debut physiqex',debut
[4537]77! initializations
[5103]78IF (debut) then ! Things to do only for the first CALL to physics
79PRINT*,'Debut physiqex IN'
[4537]80
81! load initial conditions for physics (including the grid)
[5103]82  CALL phys_state_var_init(1) ! some initializations, required before calling phyetat0
83  CALL phyetat0("startphy.nc", clesphy0, tabcntr0)
[4537]84
85! Initialize outputs:
86  itau0=0
87  ! compute zjulian for annee0=1979 and month=1 dayref=1 and hour=0.0
88  !CALL ymds2ju(annee0, month, dayref, hour, zjulian)
[5103]89  CALL ymds2ju(1979, 1, 1, 0.0, zjulian)
[4537]90
91#ifndef CPP_IOIPSL_NO_OUTPUT
92  ! Initialize IOIPSL output file
93#endif
94
[5103]95END IF ! of if (debut)
[4537]96
97!------------------------------------------------------------
98! Initialisations a chaque pas de temps
99!------------------------------------------------------------
100
101
102! set all tendencies to zero
103d_u(1:klon,1:klev)=0.
104d_v(1:klon,1:klev)=0.
105d_t(1:klon,1:klev)=0.
106d_qx(1:klon,1:klev,1:nqtot)=0.
107d_ps(1:klon)=0.
108
109!------------------------------------------------------------
110! Calculs
111!------------------------------------------------------------
112
[4658]113! compute tendencies to return to the dynamics:
114! "friction" on the first layer
115d_u(1:klon,1)=-u(1:klon,1)/86400.
116d_v(1:klon,1)=-v(1:klon,1)/86400.
117! newtonian relaxation towards temp_newton()
[5103]118DO k=1,klev
[4658]119  temp_newton(1:klon,k)=280.+cos(latitude(1:klon))*40.-pphi(1:klon,k)/rg*6.e-3
120  d_t(1:klon,k)=(temp_newton(1:klon,k)-t(1:klon,k))/1.e5
[5103]121END DO
[4537]122
123
124!------------------------------------------------------------
125! Entrees sorties
126!------------------------------------------------------------
127
128
[5103]129CALL output_physiqex(debut,zjulian,pdtphys,presnivs,paprs,u,v,t,qx,0.*t,0.*t,0.*t,0.*t,0.*t,0.*t)
[4537]130
[4548]131
[4537]132! if lastcall, then it is time to write "restartphy.nc" file
[5116]133IF (lafin) THEN
[5103]134  CALL phyredem("restartphy.nc")
135END IF
[4537]136
[4539]137
[5103]138END SUBROUTINE  physiqex
[4537]139
140END MODULE physiqex_mod
Note: See TracBrowser for help on using the repository browser.