1 |
molod |
1.1 |
subroutine step_fizhi_corr (myTime, myIter, myThid) |
2 |
|
|
c---------------------------------------------------------------------- |
3 |
|
|
c Subroutine step_fizhi_corr - 'Wrapper' routine to advance |
4 |
|
|
c the physics state and make the new value. |
5 |
|
|
c At this point, increment with the "correction term" |
6 |
|
|
c which includes the dynamics tendency and the integral |
7 |
|
|
c constraint to enforce agreement with the dynamics state |
8 |
|
|
c Also: Set up "bi, bj loop" and some timers and clocks here. |
9 |
|
|
c |
10 |
|
|
c Call:phys2dyn (4) (interpolate physics state to dynamics grid |
11 |
|
|
c for use in the correction terms) |
12 |
|
|
c AtoC (convert physics state on dynamics grid to C-Grid) |
13 |
|
|
c CtoA (convert correction term on dynamics grid to A-Grid) |
14 |
|
|
c dyn2phys (4) (interpolate A-Grid correction term to physics grid) |
15 |
|
|
c step_physics (advance physics state by correction term) |
16 |
|
|
c----------------------------------------------------------------------- |
17 |
|
|
implicit none |
18 |
|
|
#include "CPP_OPTIONS.h" |
19 |
|
|
#include "SIZE.h" |
20 |
|
|
#include "GRID.h" |
21 |
|
|
#include "fizhi_SIZE.h" |
22 |
|
|
#include "land_SIZE.h" |
23 |
|
|
#include "DYNVARS.h" |
24 |
|
|
#include "fizhi_coms.h" |
25 |
|
|
#include "gridalt_mapping.h" |
26 |
|
|
#include "EEPARAMS.h" |
27 |
|
|
#include "SURFACE.h" |
28 |
|
|
|
29 |
|
|
integer myTime, myIter, myThid |
30 |
|
|
|
31 |
|
|
c pe on dynamics and physics grid refers to bottom edge |
32 |
|
|
_RL pephy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy) |
33 |
|
|
_RL pedyn(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr+1,nSx,nSy) |
34 |
|
|
_RL windphy(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
35 |
|
|
_RL udyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
36 |
|
|
_RL vdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
37 |
|
|
_RL thdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
38 |
|
|
_RL sdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
39 |
|
|
_RL uphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
40 |
|
|
_RL vphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
41 |
|
|
_RL thphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
42 |
|
|
_RL sphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
43 |
|
|
|
44 |
|
|
integer i, j, L, Lbotij, bi, bj |
45 |
|
|
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
46 |
molod |
1.2 |
_RL dt |
47 |
molod |
1.1 |
|
48 |
|
|
im1 = 1-OLx |
49 |
|
|
im2 = sNx+OLx |
50 |
|
|
jm1 = 1-OLy |
51 |
|
|
jm2 = sNy+OLy |
52 |
|
|
idim1 = 1 |
53 |
|
|
idim2 = sNx |
54 |
|
|
jdim1 = 1 |
55 |
|
|
jdim2 = sNy |
56 |
molod |
1.2 |
dt = 1. |
57 |
molod |
1.1 |
|
58 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
59 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
60 |
|
|
|
61 |
|
|
C Construct Pressures on physics and dynamics grids |
62 |
|
|
do j = 1,sNy |
63 |
|
|
do i = 1,sNx |
64 |
|
|
do L = 1,Nr |
65 |
|
|
pedyn(i,j,L,bi,bj) = 0. |
66 |
|
|
enddo |
67 |
|
|
enddo |
68 |
|
|
enddo |
69 |
|
|
do j = 1,sNy |
70 |
|
|
do i = 1,sNx |
71 |
|
|
Lbotij = ksurfC(i,j,bi,bj) |
72 |
|
|
if(Lbotij.ne.0.) |
73 |
|
|
. pedyn(i,j,Lbotij,bi,bj) = Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj) |
74 |
|
|
enddo |
75 |
|
|
enddo |
76 |
|
|
do j = 1,sNy |
77 |
|
|
do i = 1,sNx |
78 |
|
|
Lbotij = ksurfC(i,j,bi,bj) |
79 |
|
|
do L = Lbotij+1,Nr+1 |
80 |
|
|
pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) - |
81 |
|
|
. drF(L-1)*hfacC(i,j,L-1,bi,bj) |
82 |
|
|
enddo |
83 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
84 |
|
|
if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5) |
85 |
|
|
. pedyn(i,j,Nr+1,bi,bj) = 1.e-5 |
86 |
|
|
enddo |
87 |
|
|
enddo |
88 |
|
|
|
89 |
|
|
do j = 1,sNy |
90 |
|
|
do i = 1,sNx |
91 |
|
|
pephy(i,j,1,bi,bj)=Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj) |
92 |
|
|
do L = 2,Nrphys+1 |
93 |
|
|
pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj) |
94 |
|
|
enddo |
95 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
96 |
|
|
if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5) |
97 |
|
|
. pephy(i,j,Nrphys+1,bi,bj) = 1.e-5 |
98 |
|
|
enddo |
99 |
|
|
enddo |
100 |
|
|
c |
101 |
|
|
c Create a wind magnitude field on the physics grid - |
102 |
|
|
do L = 1,Nrphys |
103 |
|
|
do j = 1,sNy |
104 |
|
|
do i = 1,sNx |
105 |
|
|
windphy(i,j,L,bi,bj) = sqrt(uphy(i,j,L,bi,bj)*uphy(i,j,L,bi,bj) |
106 |
|
|
. + vphy(i,j,L,bi,bj)*vphy(i,j,L,bi,bj)) |
107 |
|
|
enddo |
108 |
|
|
enddo |
109 |
|
|
enddo |
110 |
|
|
|
111 |
|
|
c Compute correction term (new dyn state-phys state to dyn) on physics grid: |
112 |
|
|
c First: interp physics state to dynamics grid |
113 |
|
|
call phys2dyn(uphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
114 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,udyntemp) |
115 |
|
|
call phys2dyn(vphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
116 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,vdyntemp) |
117 |
|
|
call phys2dyn(thphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
118 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,thdyntemp) |
119 |
|
|
call phys2dyn(sphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
120 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,sdyntemp) |
121 |
|
|
|
122 |
|
|
enddo |
123 |
|
|
enddo |
124 |
|
|
|
125 |
|
|
c Second: Convert physics state on dynamics grid to C-Grid |
126 |
|
|
|
127 |
|
|
call AtoC(myThid,udyntemp,vdyntemp,maskC,im1,im2,jm1,jm2,Nr, |
128 |
|
|
. Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp) |
129 |
|
|
|
130 |
|
|
c Third: Subtract Phys state on dyn. grid from new dynamics state |
131 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
132 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
133 |
|
|
|
134 |
|
|
do L = 1,Nr |
135 |
|
|
do j = jdim1,jdim2 |
136 |
|
|
do i = idim1,idim2 |
137 |
|
|
udyntemp(i,j,L,bi,bj)=uvel(i,j,L,bi,bj)-udyntemp(i,j,L,bi,bj) |
138 |
|
|
vdyntemp(i,j,L,bi,bj)=vvel(i,j,L,bi,bj)-vdyntemp(i,j,L,bi,bj) |
139 |
|
|
thdyntemp(i,j,L,bi,bj)=theta(i,j,L,bi,bj)-thdyntemp(i,j,L,bi,bj) |
140 |
|
|
sdyntemp(i,j,L,bi,bj)=salt(i,j,L,bi,bj)-sdyntemp(i,j,L,bi,bj) |
141 |
|
|
enddo |
142 |
|
|
enddo |
143 |
|
|
enddo |
144 |
|
|
|
145 |
|
|
enddo |
146 |
|
|
enddo |
147 |
|
|
|
148 |
|
|
c Fourth: Convert correction terms to A-Grid |
149 |
|
|
call CtoA(myThid,udyntemp,vdyntemp,maskW,maskS,im1,im2,jm1,jm2, |
150 |
|
|
. Nr,Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp) |
151 |
|
|
|
152 |
|
|
c Fifth: Interpolate correction terms to physics grid |
153 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
154 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
155 |
|
|
|
156 |
|
|
call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
157 |
molod |
1.2 |
. 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,uphytemp) |
158 |
molod |
1.1 |
call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
159 |
molod |
1.2 |
. 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,vphytemp) |
160 |
molod |
1.1 |
call dyn2phys(thdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
161 |
|
|
. 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,thphytemp) |
162 |
|
|
call dyn2phys(sdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
163 |
|
|
. 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,sphytemp) |
164 |
molod |
1.2 |
|
165 |
molod |
1.1 |
c Last: Increment physics state by the correction term |
166 |
molod |
1.2 |
call step_physics(uphy,vphy,thphy,sphy,dt,im1,im2,jm1,jm2, |
167 |
|
|
. Nrphys,Nsx,Nsy,1,sNx,1,sNy,bi,bj, |
168 |
|
|
. uphytemp,vphytemp,thphytemp,sphytemp) |
169 |
molod |
1.1 |
|
170 |
|
|
enddo |
171 |
|
|
enddo |
172 |
|
|
|
173 |
|
|
return |
174 |
|
|
end |