/[lmdze]/trunk/dyn3d/test_disvert.f
ViewVC logotype

Diff of /trunk/dyn3d/test_disvert.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 265 by guez, Tue Mar 20 09:35:59 2018 UTC revision 266 by guez, Thu Apr 19 17:54:55 2018 UTC
# Line 22  contains Line 22  contains
22      use jumble, only: new_unit      use jumble, only: new_unit
23    
24      integer i, unit, l      integer i, unit, l
   
25      integer, parameter:: ngrid = 8      integer, parameter:: ngrid = 8
   
26      real p(ngrid, 1, llm + 1) ! pressure at half-level, in Pa      real p(ngrid, 1, llm + 1) ! pressure at half-level, in Pa
27      real z(llm) ! pressure-altitude at half-level (km)      real z(llm) ! pressure-altitude at half-level (km)
28      real pks(ngrid, 1) ! exner function at the surface, in J K-1 kg-1      real pks(ngrid, 1) ! exner function at the surface, in J K-1 kg-1
# Line 37  contains Line 35  contains
35    
36      print *, "Call sequence information: test_disvert"      print *, "Call sequence information: test_disvert"
37    
38      ps(:, 1) = (/(5e4 + delta_ps * i, i = 0, ngrid - 2), preff/)      ps(:, 1) = [(5e4 + delta_ps * i, i = 0, ngrid - 2), preff]
39      forall (l = 1: llm + 1) p(:, 1, l) = ap(l) + bp(l) * ps(:, 1)      forall (l = 1: llm + 1) p(:, 1, l) = ap(l) + bp(l) * ps(:, 1)
40      call exner_hyb(ps, p, pks, pk)      call exner_hyb(ps, p, pks, pk)
41      p_lay = preff * (pk(:, 1, :) / cpp)**(1. / kappa)      p_lay = preff * (pk(:, 1, :) / cpp)**(1. / kappa)
42    
43      ! Write distribution for the reference surface pressure (index ngrid):      ! Write distribution for the reference surface pressure (which is
44        ! surface pressure at index ngrid):
45    
46      z = 7. * log(preff / p(ngrid, 1, :llm))      z = 7. * log(preff / p(ngrid, 1, :llm))
47      call new_unit(unit)      call new_unit(unit)
48    
49      open(unit, file="half_level.csv", status="replace", action="write")      open(unit, file="half_level.csv", status="replace", action="write")
50      ! Title line:      ! Title lines:
51      write(unit, fmt=*) '"ap (hPa)" "bp" "s" "pressure (hPa)" "z (km)"'      write(unit, fmt=*) 'hPa "" "" hPa km'
52        write(unit, fmt=*) 'ap bp s pressure z'
53      do l = 1, llm      do l = 1, llm
54         write(unit, fmt=*) ap(l) / 100., bp(l), s(l), p(ngrid, 1, l) / 100., z(l)         write(unit, fmt=*) ap(l) / 100., bp(l), s(l), p(ngrid, 1, l) / 100., z(l)
55      end do      end do
# Line 57  contains Line 57  contains
57      print *, 'The file "half_level.csv" has been created.'      print *, 'The file "half_level.csv" has been created.'
58    
59      open(unit, file="full_level.csv", status="replace", action="write")      open(unit, file="full_level.csv", status="replace", action="write")
60      ! Title line:      ! Title lines:
61      write(unit, fmt=*) &      write(unit, fmt=*) '"pressure at full level from Exner function for a ', &
62           '"pressure (hPa)" "z (km)" "presnivs (hPa)" "delta z (km)"'           'reference surface pressure" altitude "approximate pressure at ', &
63             'full level for a reference surface pressure" "layer thickness"'
64        write(unit, fmt=*) 'hPa km hPa km'
65        write(unit, fmt=*) 'p_lay z presnivs delta_z'
66      do l = 1, llm - 1      do l = 1, llm - 1
67         write(unit, fmt=*) p_lay(ngrid, l) / 100., &         write(unit, fmt=*) p_lay(ngrid, l) / 100., &
68              7. * log(preff / p_lay(ngrid, l)), presnivs(l) / 100., z(l+1) - z(l)              7. * log(preff / p_lay(ngrid, l)), presnivs(l) / 100., z(l+1) - z(l)
69      end do      end do
70      write(unit, fmt=*) p_lay(ngrid, llm) / 100., &      write(unit, fmt=*) p_lay(ngrid, llm) / 100., &
71           7. * log(preff / p_lay(ngrid, llm)), presnivs(llm) / 100.           7. * log(preff / p_lay(ngrid, llm)), presnivs(llm) / 100., "NaN"
72      close(unit)      close(unit)
73      print *, 'The file "full_level.csv" has been created.'      print *, 'The file "full_level.csv" has been created.'
74    

Legend:
Removed from v.265  
changed lines
  Added in v.266

  ViewVC Help
Powered by ViewVC 1.1.21