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