Ignore:
Timestamp:
Apr 26, 2025, 8:20:13 PM (7 weeks ago)
Author:
emillour
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/tcondwater.F90

    r1711 r3739  
    1 SUBROUTINE tcondwater(nbpts,p,q,tcond)
     1module tcondwater_mod
     2
     3implicit none
     4
     5contains
     6
     7subroutine tcondwater(ngrid,nlay,p,q,tcond)
    28IMPLICIT NONE
    39
     
    713!--------------------------------------------------i
    814
    9 integer, intent(in) :: nbpts
    10 real, intent(in), dimension(nbpts):: p,q
    11 real, intent(out), dimension(nbpts):: tcond
     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)
    1219
    13 real, dimension(nbpts):: res
    1420real:: x
    15 integer:: i
    16 
    17 do i=1,nbpts
     21integer:: i,j
     22do i=1,ngrid
     23 do j=1,nlay
    1824   !write(*,*) "i en cours", i, "sur nbpts=", nbpts
    1925   !write(*,*) "q(i)",q(i),"p(i)",p(i)
    20    x=alog10(MAX(q(i),1e-16)*p(i)/(100.*0.41)) ! max pour erreur q<=0
     26   x=alog10(MAX(q(i,j),1e-16)*p(i,j)/(100.*0.41)) ! max pour erreur q<=0
    2127   ! attention change le 0.41 de place le 10 juin 2014 car priorites
    2228   ! fortran dans watersat.F
     
    2632   !        + 2.12411064e-04*x**6+1.64642075e-05*x**7+9.22615632e-07*x**8
    2733   !        + 3.18958825e-08*x**9+5.00656720e-10*x**10 degre 10: trop!
    28    res(i) = 2.52846556e+02+ 2.39229653e+01*x+ 2.21333897e+00*x**2  &
     34   tcond(i,j) = 2.52846556e+02+ 2.39229653e+01*x+ 2.21333897e+00*x**2  &
    2935                + 1.79977992e-01*x**3+ 1.00068175e-02*x**4+2.55145012e-04*x**5
    3036   !write(*,*) "rex(x) tcondwater AP14! :) :) :) :P", res(i)
     37 enddo
    3138enddo
    3239
    33 tcond=res
     40end subroutine tcondwater
    3441
    35 return
    36 end
     42end module tcondwater_mod
    3743!polynome de degre 5 pas 0.0001
    3844!polynomial coefs [  2.52846556e+02   2.39229653e+01   2.21333897e+00
Note: See TracChangeset for help on using the changeset viewer.