/[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

revision 134 by guez, Wed Apr 29 15:47:56 2015 UTC revision 162 by guez, Fri Jul 24 16:54:30 2015 UTC
# Line 4  module regr_pr_int_m Line 4  module regr_pr_int_m
4    
5  contains  contains
6    
7    subroutine regr_pr_int(ncid, name, julien, top_value, v3)    subroutine regr_pr_int(ncid, name, julien, pplay, top_value, v3)
8    
9      ! "regr_pr_int" stands for "regrid pressure interpolation".      ! "regr_pr_int" stands for "regrid pressure interpolation".
10    
# Line 30  contains Line 30  contains
30      use nr_util, only: assert      use nr_util, only: assert
31      use numer_rec_95, only: regr1_lint      use numer_rec_95, only: regr1_lint
32      use press_coefoz_m, only: plev      use press_coefoz_m, only: plev
     use pressure_var, only: pls  
33    
34      integer, intent(in):: ncid ! NetCDF ID of the file      integer, intent(in):: ncid ! NetCDF ID of the file
35      character(len=*), intent(in):: name ! of the NetCDF variable      character(len=*), intent(in):: name ! of the NetCDF variable
36      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360
37    
38        real, intent(in):: pplay(:, :) ! (klon, llm)
39        ! (pression pour le mileu de chaque couche, en Pa)
40    
41      real, intent(in):: top_value      real, intent(in):: top_value
42      ! (extra value of field at 0 pressure)      ! (extra value of field at 0 pressure)
43    
# Line 47  contains Line 49  contains
49    
50      integer varid ! for NetCDF      integer varid ! for NetCDF
51    
52      real  v1(jjm + 1, 0:size(plev))      real v1(jjm + 1, 0:size(plev))
53      ! Input field at day "julien". "v1(j, k >=1)" is at latitude      ! Input field at day "julien". "v1(j, k >=1)" is at latitude
54      ! "rlatu(j)" and pressure "plev(k)".      ! "rlatu(j)" and pressure "plev(k)".
55    
56      real v2(iim + 1, jjm + 1, llm)      real v2(klon, 0:size(plev))
57      ! Regridded field on the "dynamics" horizontal grid. "v2(i, j, k)"      ! Field on the "physics" horizontal grid.  "v2(i, k >= 1)" is at
58      ! is at longitude "rlonv(i)", latitude "rlatu(j)" and pressure      ! longitude "xlon(i)", latitude "xlat(i)" and pressure "plev(k)".)
     ! "pls(i, j, k)".  
59    
60      integer i, j, k      integer i, k
61    
62      !--------------------------------------------      !--------------------------------------------
63    
# Line 73  contains Line 74  contains
74      ! Complete "v1" with the value at 0 pressure:      ! Complete "v1" with the value at 0 pressure:
75      v1(:, 0) = top_value      v1(:, 0) = top_value
76    
77        forall (k = 0:size(plev)) v2(:, k) = pack(spread(v1(:, k), dim = 1, &
78             ncopies = iim + 1), dyn_phy)
79    
80      ! Regrid in pressure at each horizontal position:      ! Regrid in pressure at each horizontal position:
81      do j = 1, jjm + 1      do i = 1, klon
82         do i = 1, iim         v3(i, llm:1:-1) = regr1_lint(v2(i, :), (/0., plev/), pplay(i, llm:1:-1))
83            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  
84      end do      end do
85    
     forall (k = 1:llm) v3(:, k) = pack(v2(:, :, k), dyn_phy)  
   
86    end subroutine regr_pr_int    end subroutine regr_pr_int
87    
88  end module regr_pr_int_m  end module regr_pr_int_m

Legend:
Removed from v.134  
changed lines
  Added in v.162

  ViewVC Help
Powered by ViewVC 1.1.21