[207] | 1 | !! Calculate pressure (Pa) from MU and MUB (wrfinput data) |
---|
| 2 | |
---|
| 3 | MODULE module_pressure |
---|
| 4 | |
---|
| 5 | CONTAINS |
---|
| 6 | SUBROUTINE pressure(prs) |
---|
| 7 | |
---|
| 8 | USE module_model_basics |
---|
| 9 | |
---|
| 10 | !Arguments |
---|
| 11 | real, pointer, dimension(:,:,:) :: prs |
---|
| 12 | real, dimension(bottom_top_dim) :: rdnw, rdn |
---|
| 13 | real :: dnw, dn |
---|
| 14 | real :: qvf1, qvf2 |
---|
| 15 | real :: p_base |
---|
| 16 | integer :: i, j, k |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | ALLOCATE(prs(west_east_dim,south_north_dim,bottom_top_dim)) |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | DO k = 1, bottom_top_dim |
---|
| 24 | dnw=(ZNW(k+1) - ZNW(k)) |
---|
| 25 | rdnw(k) = 1./dnw |
---|
| 26 | END DO |
---|
| 27 | DO k = 1, bottom_top_dim |
---|
| 28 | dn=.5 * ( 1./rdnw(k+1) + 1./rdnw(k)) |
---|
| 29 | rdn(k)=1./dn |
---|
| 30 | END DO |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | DO j = 1, south_north_dim |
---|
| 35 | DO i = 1, west_east_dim |
---|
| 36 | |
---|
| 37 | ! Get pressure perturbation at model top |
---|
| 38 | k = bottom_top_dim |
---|
| 39 | qvf1 = QV(i,j,k) * .001 |
---|
| 40 | qvf2 = 1. / (1.+qvf1) |
---|
| 41 | qvf1 = qvf1 * qvf2 |
---|
| 42 | prs(i,j,k) = - 0.5 * ( MU(i,j) + qvf1*MUB(i,j) ) / rdnw(k) / qvf2 |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | ! Now get pressure perturbation at levels below |
---|
| 48 | DO k = 1, bottom_top_dim-1 |
---|
| 49 | qvf1 = 0.5 * (QV(i,j,k)+QV(i,j,k+1)) * .001 |
---|
| 50 | qvf2 = 1. / (1.+qvf1) |
---|
| 51 | qvf1 = qvf1 * qvf2 |
---|
| 52 | prs(i,j,k) = prs(i,j,k+1) - ( MU(i,j) + qvf1*MUB(i,j) ) / qvf2 / rdn(k) |
---|
| 53 | END DO |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | ! Finally compute base state pressure and add to pressure perturbation |
---|
| 57 | ! to get total pressure |
---|
| 58 | DO k = 1, bottom_top_dim |
---|
| 59 | p_base = ZNU(k) * MUB(i,j) + PTOP |
---|
| 60 | prs(i,j,k) = prs(i,j,k) + p_base ! Pa |
---|
| 61 | END DO |
---|
| 62 | |
---|
| 63 | END DO |
---|
| 64 | END DO |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | END SUBROUTINE pressure |
---|
| 68 | |
---|
| 69 | END MODULE module_pressure |
---|