1 |
subroutine step_plumes_corr (myTime, myIter, myThid) |
2 |
c---------------------------------------------------------------------- |
3 |
c Subroutine step_plumes_corr - 'Wrapper' routine to advance |
4 |
c the plumes 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:plume2dyn (4) (interpolate plumes state to dynamics grid |
11 |
c for use in the correction terms) |
12 |
c AtoC (convert plumes state on dynamics grid to C-Grid) |
13 |
c CtoA (convert correction term on dynamics grid to A-Grid) |
14 |
c dyn2plume (4) (interpolate A-Grid correction term to plumes grid) |
15 |
c step_plumes (advance plumes state by correction term) |
16 |
c----------------------------------------------------------------------- |
17 |
implicit none |
18 |
#include "CPP_OPTIONS.h" |
19 |
#include "SIZE.h" |
20 |
#include "GRID.h" |
21 |
#include "plumes_SIZE.h" |
22 |
#include "DYNVARS.h" |
23 |
#include "plumes_coms.h" |
24 |
#include "gridalt_mapping.h" |
25 |
#include "EEPARAMS.h" |
26 |
|
27 |
integer myTime, myIter, myThid |
28 |
|
29 |
_RL udyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
30 |
_RL vdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
31 |
_RL thdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
32 |
_RL sdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
33 |
_RL uplumetemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
34 |
_RL vplumetemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
35 |
_RL thplumetemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
36 |
_RL splumetemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
37 |
|
38 |
integer i, j, L, Lbotij, bi, bj |
39 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
40 |
_RL dt |
41 |
|
42 |
im1 = 1-OLx |
43 |
im2 = sNx+OLx |
44 |
jm1 = 1-OLy |
45 |
jm2 = sNy+OLy |
46 |
idim1 = 1 |
47 |
idim2 = sNx |
48 |
jdim1 = 1 |
49 |
jdim2 = sNy |
50 |
dt = 1. |
51 |
|
52 |
CALL TIMER_START('PLUME2DYN [STEP_PLUME_CORR]',mythid) |
53 |
do bj = myByLo(myThid), myByHi(myThid) |
54 |
do bi = myBxLo(myThid), myBxHi(myThid) |
55 |
|
56 |
c Compute correction term (new dyn state-plume state to dyn) on plumes grid: |
57 |
c First: interp plumes state to dynamics grid |
58 |
call plume2dyn(uplume,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
59 |
. 1,sNx,1,sNy,bi,bj,Nr,udyntemp) |
60 |
call plume2dyn(vplume,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
61 |
. 1,sNx,1,sNy,bi,bj,Nr,vdyntemp) |
62 |
call plume2dyn(thplume,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
63 |
. 1,sNx,1,sNy,bi,bj,Nr,thdyntemp) |
64 |
call plume2dyn(splume,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
65 |
. 1,sNx,1,sNy,bi,bj,Nr,sdyntemp) |
66 |
|
67 |
enddo |
68 |
enddo |
69 |
CALL TIMER_STOP('PLUME2DYN [STEP_PLUME_CORR]',mythid) |
70 |
|
71 |
c Second: Convert plumes state on dynamics grid to C-Grid |
72 |
|
73 |
CALL TIMER_START('ATOC [STEP_PLUME_CORR]',mythid) |
74 |
call AtoC(myThid,udyntemp,vdyntemp,maskC,im1,im2,jm1,jm2,Nr, |
75 |
. Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp) |
76 |
CALL TIMER_STOP('ATOC [STEP_PLUME_CORR]',mythid) |
77 |
|
78 |
c Third: Subtract plumes state on dyn. grid from new dynamics state |
79 |
do bj = myByLo(myThid), myByHi(myThid) |
80 |
do bi = myBxLo(myThid), myBxHi(myThid) |
81 |
|
82 |
do L = 1,Nr |
83 |
do j = jdim1,jdim2 |
84 |
do i = idim1,idim2 |
85 |
udyntemp(i,j,L,bi,bj)=uvel(i,j,L,bi,bj)-udyntemp(i,j,L,bi,bj) |
86 |
vdyntemp(i,j,L,bi,bj)=vvel(i,j,L,bi,bj)-vdyntemp(i,j,L,bi,bj) |
87 |
thdyntemp(i,j,L,bi,bj)=theta(i,j,L,bi,bj)-thdyntemp(i,j,L,bi,bj) |
88 |
sdyntemp(i,j,L,bi,bj)=salt(i,j,L,bi,bj)-sdyntemp(i,j,L,bi,bj) |
89 |
enddo |
90 |
enddo |
91 |
enddo |
92 |
|
93 |
enddo |
94 |
enddo |
95 |
|
96 |
c Fourth: Convert correction terms to A-Grid |
97 |
CALL TIMER_START('CTOA [STEP_PLUME_CORR]',mythid) |
98 |
call CtoA(myThid,udyntemp,vdyntemp,maskW,maskS,im1,im2,jm1,jm2, |
99 |
. Nr,Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp) |
100 |
CALL TIMER_STOP('CTOA [STEP_PLUME_CORR]',mythid) |
101 |
|
102 |
c Fifth: Interpolate correction terms to plumes grid |
103 |
CALL TIMER_START('DYN2PLUME [STEP_PLUME_CORR]',mythid) |
104 |
do bj = myByLo(myThid), myByHi(myThid) |
105 |
do bi = myBxLo(myThid), myBxHi(myThid) |
106 |
|
107 |
call dyn2plume(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
108 |
. 1,sNy,bi,bj,uplumetemp) |
109 |
call dyn2plume(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
110 |
. 1,sNy,bi,bj,vplumetemp) |
111 |
call dyn2plume(thdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
112 |
. 1,sNy,bi,bj,thplumetemp) |
113 |
call dyn2plume(sdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx, |
114 |
. 1,sNy,bi,bj,splumetemp) |
115 |
enddo |
116 |
enddo |
117 |
CALL TIMER_STOP('DYN2PLUME [STEP_PLUME_CORR]',mythid) |
118 |
|
119 |
c Last: Increment plumes state by the correction term |
120 |
do bj = myByLo(myThid), myByHi(myThid) |
121 |
do bi = myBxLo(myThid), myBxHi(myThid) |
122 |
call step_plumes(uplume,vplume,thplume,splume,dt, |
123 |
. Nxplumes,Nyplumes,Nr,Nsx,Nsy, |
124 |
. uplumetemp,vplumetemp,thplumetemp,splumetemp) |
125 |
|
126 |
enddo |
127 |
enddo |
128 |
|
129 |
return |
130 |
end |