source: trunk/LMDZ.PLUTO/libf/phypluto/cosurf.F @ 3914

Last change on this file since 3914 was 3853, checked in by tbertrand, 5 months ago

Pluto PCM:
Implementing the CO cycle in the mode no_n2frost in the VTM and GCM
TB

File size: 2.9 KB
Line 
1      SUBROUTINE cosurf(ngrid,nlayer,nq,ptimestep,
2     &  tsurf,pplev,pdpsurf,pq,pdq,pqsurf,pdqsurf,pdqco,pdqsco)
3       
4      use callkeys_mod, only: dayfrac,no_n2frost
5      use comcstfi_mod, only: g, r
6      use comgeomfi_h
7      use comsaison_h, only: fract
8      use planete_mod, only: z0
9      use tracer_h, only: igcm_co_gas,igcm_co_ice,igcm_ch4_ice,
10     &                            igcm_n2,mmol
11      IMPLICIT NONE
12
13c----------------
14c   declarations:
15c   -------------
16
17#include "dimensions.h"
18
19! Routine for nogcm : sublimation/condensation scheme at the surface
20! Output : tendancy for methane mixing ratio and surface reservoir :
21!                             pdqco, pdqs_co 
22
23!-----------------------------------------------------------------------
24!     Arguments
25
26
27      INTEGER ngrid,nlayer,nq
28      REAL ptimestep 
29      INTEGER ig,iq
30
31      ! input :
32      REAL tsurf(ngrid)
33      REAL pplev(ngrid,nlayer+1)
34      REAL pdpsurf(ngrid)
35      REAL pq(ngrid,nlayer,nq)
36      REAL pdq(ngrid,nlayer,nq)
37      REAL pqsurf(ngrid,nq)
38      REAL pdqsurf(ngrid,nq)
39      REAL qsurf_n2(ngrid)
40
41      ! Output
42      REAL pdqco(ngrid)
43      REAL pdqsco(ngrid)
44
45      ! local
46      REAL qsat(ngrid)
47      REAL zpsrf(ngrid)
48      REAL zq_co(ngrid)
49      REAL rho,u,v,uv,z00,cdrag,alt
50      REAL vonk       ! Von Karman Constant
51      SAVE vonk       
52      DATA vonk/0.4/
53     
54      LOGICAL firstcall
55      SAVE firstcall
56      real,dimension(:),save,allocatable :: qsat_co_factor ! factor to prevent co frost formation if no n2 frost
57!$OMP THREADPRIVATE(qsat_co_factor)
58
59      IF (firstcall) THEN
60        firstcall=.false.
61        ! If fixed distribution of N2, then no CO frost either
62        ALLOCATE(qsat_co_factor(ngrid))
63        qsat_co_factor(:)=1.
64        IF (no_n2frost) then
65           DO ig=1,ngrid
66              if (pqsurf(ig,igcm_n2).eq.0.) then
67                   qsat_co_factor(ig) = 1.e6
68              endif
69           ENDDO
70        ENDIF
71      ENDIF
72
73      ! Calculation of turbulent flux : F=rho*cdrag*uv*(qsat-zq)
74   
75      ! Calcul de cdrag
76      alt=5.   ! m
77      z00=z0 !1.e-2 ! rugosity
78      cdrag=(vonk/log(alt/z00))**2
79     
80      u=0.3
81      v=0.4
82      uv=sqrt(u**2+v**2)
83       
84      DO ig=1,ngrid
85         pdqsco(ig)=0.     
86         pdqco(ig)=0.     
87      ENDDO
88
89      DO ig=1,ngrid
90          zpsrf(ig)=pplev(ig,1)
91          zq_co(ig)=pq(ig,1,igcm_co_gas)
92!    &    +  pdq(ig,1,igcm_co_gas)*ptimestep ! pas utile si fast
93      ENDDO
94
95      call cosat(ngrid,tsurf,zpsrf,qsat,pqsurf(:,igcm_n2))
96
97      DO ig=1,ngrid
98         rho = zpsrf(ig) / (r *  tsurf(ig) )
99         
100         pdqsco(ig)=(-rho*uv*cdrag*(qsat(ig)-zq_co(ig)))
101
102         if ((-pdqsco(ig)*ptimestep).gt.(pqsurf(ig,igcm_co_ice))) then
103                  !write(*,*)'cosurf : on sublime plus que qsurf_co!'
104                  pdqsco(ig)=-pqsurf(ig,igcm_co_ice)/ptimestep
105         endif
106         pdqco(ig)=-pdqsco(ig)*g/zpsrf(ig)
107      ENDDO
108      RETURN
109      END
Note: See TracBrowser for help on using the repository browser.