GFS Operational Physics Documentation  Revision: 81451
ozphys.f
Go to the documentation of this file.
1 
3 
36  subroutine ozphys (ix, im, levs, ko3, dt, ozi, ozo, tin, po3,
37  & prsl, prdout, pl_coeff, delp, ldiag3d,
38  & ozp,me)
39 !
40 ! this code assumes that both prsl and po3 are from bottom to top
41 ! as are all other variables
42 !
43  use machine , only : kind_phys
44  use physcons, only : grav => con_g
45  implicit none
46 !
47  real, parameter :: gravi=1.0/grav
48  integer im, ix, levs, ko3, pl_coeff,me
49  real(kind=kind_phys) ozi(ix,levs), ozo(ix,levs), po3(ko3),
50  & prsl(ix,levs), tin(ix,levs), delp(ix,levs),
51  & prdout(ix,ko3,pl_coeff),
52  & ozp(ix,levs,pl_coeff), dt
53 !
54  integer k,kmax,kmin,l,i,j
55  logical ldiag3d, flg(im)
56  real(kind=kind_phys) pmax, pmin, tem, temp
57  real(kind=kind_phys) wk1(im), wk2(im), wk3(im), prod(im,pl_coeff),
58  & ozib(im), colo3(im,levs+1)
59 !
60  if (pl_coeff > 2) then
61  colo3(:,levs+1) = 0.0
62  do l=levs,1,-1
63  do i=1,im
64  colo3(i,l) = colo3(i,l+1) + ozi(i,l) * delp(i,l) * gravi
65  enddo
66  enddo
67  endif
68 !
69  do l=1,levs
70  pmin = 1.0e10
71  pmax = -1.0e10
72 !
73  do i=1,im
74  wk1(i) = log(prsl(i,l))
75  pmin = min(wk1(i), pmin)
76  pmax = max(wk1(i), pmax)
77  prod(i,:) = 0.0
78  enddo
79  kmax = 1
80  kmin = 1
81  do k=1,ko3-1
82  if (pmin < po3(k)) kmax = k
83  if (pmax < po3(k)) kmin = k
84  enddo
85 !
86  do k=kmin,kmax
87  temp = 1.0 / (po3(k) - po3(k+1))
88  do i=1,im
89  flg(i) = .false.
90  if (wk1(i) < po3(k) .and. wk1(i) >= po3(k+1)) then
91  flg(i) = .true.
92  wk2(i) = (wk1(i) - po3(k+1)) * temp
93  wk3(i) = 1.0 - wk2(i)
94  endif
95  enddo
96  do j=1,pl_coeff
97  do i=1,im
98  if (flg(i)) then
99  prod(i,j) = wk2(i) * prdout(i,k,j)
100  & + wk3(i) * prdout(i,k+1,j)
101  endif
102  enddo
103  enddo
104  enddo
105 !
106  do j=1,pl_coeff
107  do i=1,im
108  if (wk1(i) < po3(ko3)) then
109  prod(i,j) = prdout(i,ko3,j)
110  endif
111  if (wk1(i) >= po3(1)) then
112  prod(i,j) = prdout(i,1,j)
113  endif
114  enddo
115  enddo
116  if (pl_coeff == 2) then
117  do i=1,im
118  ozib(i) = ozi(i,l) ! no filling
119  ozo(i,l) = (ozib(i) + prod(i,1)*dt) / (1.0 + prod(i,2)*dt)
120  enddo
121 !
122  if (ldiag3d) then ! ozone change diagnostics
123  do i=1,im
124  ozp(i,l,1) = ozp(i,l,1) + prod(i,1)*dt
125  ozp(i,l,2) = ozp(i,l,2) + (ozo(i,l) - ozib(i))
126  enddo
127  endif
128  endif
129  if (pl_coeff == 4) then
130  do i=1,im
131  ozib(i) = ozi(i,l) ! no filling
132  tem = prod(i,1) + prod(i,3)*tin(i,l)
133  & + prod(i,4)*colo3(i,l+1)
134 ! if (me .eq. 0) print *,'ozphys tem=',tem,' prod=',prod(i,:)
135 ! &,' ozib=',ozib(i),' l=',l,' tin=',tin(i,l),'colo3=',colo3(i,l+1)
136  ozo(i,l) = (ozib(i) + tem*dt) / (1.0 + prod(i,2)*dt)
137  enddo
138  if (ldiag3d) then ! ozone change diagnostics
139  do i=1,im
140  ozp(i,l,1) = ozp(i,l,1) + prod(i,1)*dt
141  ozp(i,l,2) = ozp(i,l,2) + (ozo(i,l) - ozib(i))
142  ozp(i,l,3) = ozp(i,l,3) + prod(i,3)*tin(i,l)*dt
143  ozp(i,l,4) = ozp(i,l,4) + prod(i,4)*colo3(i,l+1)*dt
144  enddo
145  endif
146  endif
147  enddo ! vertical loop
148 !
149  return
150  end
151 !! @}
real(kind=kind_phys), parameter con_g
gravity ( )
Definition: physcons.f:59