/[lmdze]/trunk/phylmd/Mobidic/regr_pr_int.f
ViewVC logotype

Diff of /trunk/phylmd/Mobidic/regr_pr_int.f

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

trunk/phylmd/Mobidic/regr_pr_int.f revision 90 by guez, Wed Mar 12 21:16:36 2014 UTC trunk/Sources/phylmd/Mobidic/regr_pr_int.f revision 168 by guez, Wed Sep 9 10:41:47 2015 UTC
# Line 1  Line 1 
1  module regr_pr_int_m  module regr_pr_int_m
2    
3      ! Author: Lionel GUEZ
4    
5    implicit none    implicit none
6    
7  contains  contains
8    
9    subroutine regr_pr_int(ncid, name, julien, top_value, v3)    subroutine regr_pr_int(ncid, name, julien, pplay, top_value, v3)
10    
11      ! "regr_pr_int" stands for "regrid pressure interpolation".      ! "regr_pr_int" stands for "regrid pressure interpolation".
12    
# Line 25  contains Line 27  contains
27    
28      use dimens_m, only: iim, jjm, llm      use dimens_m, only: iim, jjm, llm
29      use dimphy, only: klon      use dimphy, only: klon
30      use grid_change, only: dyn_phy      use grid_change, only: gr_dyn_phy
31      use netcdf95, only: nf95_inq_varid, nf95_get_var      use netcdf95, only: nf95_inq_varid, nf95_get_var
32      use nr_util, only: assert      use nr_util, only: assert
33      use numer_rec_95, only: regr1_lint      use numer_rec_95, only: regr1_lint
34      use press_coefoz_m, only: plev      use press_coefoz_m, only: plev
     use pressure_var, only: pls  
35    
36      integer, intent(in):: ncid ! NetCDF ID of the file      integer, intent(in):: ncid ! NetCDF ID of the file
37      character(len=*), intent(in):: name ! of the NetCDF variable      character(len=*), intent(in):: name ! of the NetCDF variable
38      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360
39    
40        real, intent(in):: pplay(:, :) ! (klon, llm)
41        ! (pression pour le mileu de chaque couche, en Pa)
42    
43      real, intent(in):: top_value      real, intent(in):: top_value
44      ! (extra value of field at 0 pressure)      ! (extra value of field at 0 pressure)
45    
# Line 45  contains Line 49  contains
49    
50      ! Variables local to the procedure:      ! Variables local to the procedure:
51    
52      integer varid, ncerr ! for NetCDF      integer varid ! for NetCDF
53    
54      real  v1(jjm + 1, 0:size(plev))      real v1(jjm + 1, 0:size(plev))
55      ! Input field at day "julien". "v1(j, k >=1)" is at latitude      ! Input field at day "julien". "v1(j, k >=1)" is at latitude
56      ! "rlatu(j)" and pressure "plev(k)".      ! "rlatu(j)" and pressure "plev(k)".
57    
58      real v2(iim + 1, jjm + 1, llm)      real v2(klon, 0:size(plev))
59      ! Regridded field on the "dynamics" horizontal grid. "v2(i, j, k)"      ! Field on the "physics" horizontal grid.  "v2(i, k >= 1)" is at
60      ! is at longitude "rlonv(i)", latitude "rlatu(j)" and pressure      ! longitude "xlon(i)", latitude "xlat(i)" and pressure "plev(k)".)
     ! "pls(i, j, k)".  
61    
62      integer i, j, k      integer i
63    
64      !--------------------------------------------      !--------------------------------------------
65    
# Line 73  contains Line 76  contains
76      ! Complete "v1" with the value at 0 pressure:      ! Complete "v1" with the value at 0 pressure:
77      v1(:, 0) = top_value      v1(:, 0) = top_value
78    
79        v2 = gr_dyn_phy(spread(v1, dim = 1, ncopies = iim + 1))
80    
81      ! Regrid in pressure at each horizontal position:      ! Regrid in pressure at each horizontal position:
82      do j = 1, jjm + 1      do i = 1, klon
83         do i = 1, iim         v3(i, llm:1:-1) = regr1_lint(v2(i, :), (/0., plev/), pplay(i, llm:1:-1))
84            if (dyn_phy(i, j)) then         ! (invert order of indices because "pplay" is in descending order)
              v2(i, j, llm:1:-1) &  
                   = regr1_lint(v1(j, :), (/0., plev/), pls(i, j, llm:1:-1))  
              ! (invert order of indices because "pls" is in descending order)  
           end if  
        end do  
85      end do      end do
86    
     forall (k = 1:llm) v3(:, k) = pack(v2(:, :, k), dyn_phy)  
   
87    end subroutine regr_pr_int    end subroutine regr_pr_int
88    
89  end module regr_pr_int_m  end module regr_pr_int_m

Legend:
Removed from v.90  
changed lines
  Added in v.168

  ViewVC Help
Powered by ViewVC 1.1.21