source: LMDZ6/branches/cirrus/libf/dynphy_lonlat/phylmd/test_disvert_m.F90 @ 5435

Last change on this file since 5435 was 2597, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: get rid of comconst.h, make it a module comconst_mod.
EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory

File size: 2.1 KB
Line 
1module test_disvert_m
2
3  implicit none
4
5contains
6
7  subroutine test_disvert
8
9    ! Author: Lionel GUEZ
10
11    ! This procedure tests the order of pressure values at half-levels
12    ! and full levels. We arbitrarily choose to test ngrid values of
13    ! the surface pressure, which sample possible values on Earth.
14
15    use exner_hyb_m, only: exner_hyb
16    use vertical_layers_mod, only: ap,bp,preff
17    use comconst_mod, only: kappa, cpp
18
19    ! For llm:
20    include "dimensions.h"
21
22    ! Local:
23    integer l, i
24    integer, parameter:: ngrid = 7
25    real p(ngrid, llm + 1) ! pressure at half-level, in Pa
26    real pks(ngrid) ! exner function at the surface, in J K-1 kg-1
27    real pk(ngrid, llm) ! exner function at full level, in J K-1 kg-1
28    real ps(ngrid) ! surface pressure, in Pa
29    real p_lay(ngrid, llm) ! pressure at full level, in Pa
30    real delta_ps ! in Pa
31
32    !---------------------
33
34    print *, "Call sequence information: test_disvert"
35
36    delta_ps = 6e4 / (ngrid - 1)
37    ps = (/(5e4 + delta_ps * i, i = 0, ngrid - 1)/)
38    forall (l = 1: llm + 1) p(:, l) = ap(l) + bp(l) * ps
39    call exner_hyb(ngrid, ps, p, pks, pk)
40    p_lay = preff * (pk / cpp)**(1. / kappa)
41
42    ! Are pressure values in the right order?
43    if (any(p(:, :llm) <= p_lay .or. p_lay <= p(:, 2:))) then
44       ! List details and stop:
45       do l = 1, llm
46          do i = 1, ngrid
47             if (p(i, l) <= p_lay(i, l)) then
48                print 1000, "ps = ", ps(i) / 100., "hPa, p(level ",  l, &
49                     ") = ", p(i, l) / 100., " hPa <= p(layer ", l, ") = ", &
50                     p_lay(i, l) / 100., " hPa"
51             end if
52             if (p_lay(i, l) <= p(i, l + 1)) then
53                print 1000, "ps = ", ps(i) / 100., "hPa, p(layer ", l, ") = ", &
54                     p_lay(i, l) / 100., " hPa <= p(level ", l + 1, ") = ", &
55                     p(i, l + 1) / 100., " hPa"
56             end if
57          end do
58       end do
59       call abort_physic("test_disvert", "bad order of pressure values", 1)
60    end if
61
621000 format (3(a, g10.4, a, i0))
63
64  end subroutine test_disvert
65
66end module test_disvert_m
Note: See TracBrowser for help on using the repository browser.