source: trunk/LMDZ.MARS/libf/phymars/tcondwater.F90 @ 3807

Last change on this file since 3807 was 3739, checked in by emillour, 7 weeks ago

Mars PCM:
Code tidying: put routines in modules, remove useless "return" statements, etc.
EM

File size: 2.9 KB
Line 
1module tcondwater_mod
2
3implicit none
4
5contains
6
7subroutine tcondwater(ngrid,nlay,p,q,tcond)
8IMPLICIT NONE
9
10!---------------------------------------------------
11! Condensation temperature for water ice; based on
12! the saturation in watersat.F AP14
13!--------------------------------------------------i
14
15integer, intent(in) :: ngrid, nlay
16real, intent(in) :: p(ngrid,nlay) ! pressure (Pa)
17real, intent(in) :: q(ngrid,nlay) ! water mass mixing ratio (kg/kg_air)
18real, intent(out):: tcond(ngrid,nlay) ! condensation temeprature (K)
19
20real:: x
21integer:: i,j
22do i=1,ngrid
23 do j=1,nlay
24   !write(*,*) "i en cours", i, "sur nbpts=", nbpts
25   !write(*,*) "q(i)",q(i),"p(i)",p(i)
26   x=alog10(MAX(q(i,j),1e-16)*p(i,j)/(100.*0.41)) ! max pour erreur q<=0
27   ! attention change le 0.41 de place le 10 juin 2014 car priorites
28   ! fortran dans watersat.F
29   !write(*,*) "x tcondwater AP14! :) :) :) :P", x
30   !res(i) = 2.52826991e+02+ 2.39287870e+01*x+ 2.27275932e+00*x**2
31   !        + 2.21832905e-01*x**3+ 2.23453930e-02*x**4+2.26075106e-03*x**5
32   !        + 2.12411064e-04*x**6+1.64642075e-05*x**7+9.22615632e-07*x**8
33   !        + 3.18958825e-08*x**9+5.00656720e-10*x**10 degre 10: trop!
34   tcond(i,j) = 2.52846556e+02+ 2.39229653e+01*x+ 2.21333897e+00*x**2  &
35                + 1.79977992e-01*x**3+ 1.00068175e-02*x**4+2.55145012e-04*x**5
36   !write(*,*) "rex(x) tcondwater AP14! :) :) :) :P", res(i)
37 enddo
38enddo
39
40end subroutine tcondwater
41
42end module tcondwater_mod
43!polynome de degre 5 pas 0.0001
44!polynomial coefs [  2.52846556e+02   2.39229653e+01   2.21333897e+00
45!1.79977992e-01
46!   1.00068175e-02   2.55145012e-04]
47!maximum des abs(difference) 0.0604390646026
48
49! polynome de degre 12
50!polynomial coefs [  2.52826992e+02   2.39287716e+01   2.27274870e+00
51!2.21863471e-01
52 !  2.23765903e-02   2.26605393e-03   2.07841624e-04   1.37374700e-05
53 !  2.45106231e-07  -6.16151111e-08  -6.96026651e-09  -3.22690558e-10
54!  -5.86804217e-12]   maximum des abs(difference) 2.73827428146e-05
55! polynome de degre 6
56!polynomial coefs [  2.52831053e+02   2.39333049e+01   2.26006967e+00
57!2.06350715e-01
58!   1.56882616e-02   7.83034223e-04   1.77637297e-05]
59!maximum des abs(difference) 0.013723768413
60! polynome de degre 8
61! polynomial coefs [  2.52827042e+02   2.39294477e+01   2.27281607e+00
62!2.20637577e-01
63!   2.12491384e-02   1.82810482e-03   1.19638702e-04   4.91167244e-06
64!   9.12272144e-08]
65!maximum des abs(difference) 0.000725035990172
66!polynome de degre 9
67!polynomial coefs [  2.52826985e+02   2.39289186e+01   2.27286626e+00
68!2.21623591e-01
69!   2.20538443e-02   2.11335665e-03   1.73307328e-04   1.04920165e-05
70!   3.94201385e-07   6.70874574e-09]
71!maximum des abs(difference) 0.000168806463876
72!polynome de degre 10
73!polynomial coefs [  2.52826991e+02   2.39287870e+01   2.27275932e+00
74!2.21832905e-01
75!   2.23453930e-02   2.26075106e-03   2.12411064e-04   1.64642075e-05
76!   9.22615632e-07   3.18958825e-08   5.00656720e-10]
77!maximum des abs(difference) 3.96286844477e-05
Note: See TracBrowser for help on using the repository browser.