/[MITgcm]/MITgcm/pkg/ctrl/ctrl_getobcse.F
ViewVC logotype

Diff of /MITgcm/pkg/ctrl/ctrl_getobcse.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6 by heimbach, Mon May 14 22:02:33 2007 UTC revision 1.7 by jmc, Tue Oct 9 00:00:00 2007 UTC
# Line 1  Line 1 
1    C $Header$
2    C $Name$
3    
4  #include "CTRL_CPPOPTIONS.h"  #include "CTRL_CPPOPTIONS.h"
5  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
# Line 106  c--   Now, read the control vector. Line 108  c--   Now, read the control vector.
108    
109        if (optimcycle .ge. 0) then        if (optimcycle .ge. 0) then
110          ilobcse=ilnblnk( xx_obcse_file )          ilobcse=ilnblnk( xx_obcse_file )
111          write(fnameobcse(1:80),'(2a,i10.10)')          write(fnameobcse(1:80),'(2a,i10.10)')
112       &       xx_obcse_file(1:ilobcse), '.', optimcycle       &       xx_obcse_file(1:ilobcse), '.', optimcycle
113        endif        endif
114    
# Line 120  c--   Get the counters, flags, and the i Line 122  c--   Get the counters, flags, and the i
122        do iobcs = 1,nobcs        do iobcs = 1,nobcs
123    
124          if ( obcsefirst ) then          if ( obcsefirst ) then
125            call active_read_yz( fnameobcse, tmpfldyz,            call active_read_yz( fnameobcse, tmpfldyz,
126       &                         (obcsecount0-1)*nobcs+iobcs,       &                         (obcsecount0-1)*nobcs+iobcs,
127       &                         doglobalread, ladinit, optimcycle,       &                         doglobalread, ladinit, optimcycle,
128       &                         mythid, xx_obcse_dummy )       &                         mythid, xx_obcse_dummy )
129    
130  #ifdef ALLOW_CTRL_OBCS_BALANCE  #ifdef ALLOW_CTRL_OBCS_BALANCE
131    
132            if ( optimcycle .gt. 0) then                      if ( optimcycle .gt. 0) then
133              if (iobcs .eq. 3) then              if (iobcs .eq. 3) then
134  cgg         Special attention is needed for the normal velocity.  cgg         Special attention is needed for the normal velocity.
135  cgg         For the north, this is the v velocity, iobcs = 4.  cgg         For the north, this is the v velocity, iobcs = 4.
# Line 144  cgg         The barotropic velocity is s Line 146  cgg         The barotropic velocity is s
146    
147                      do k = 1,Nr                      do k = 1,Nr
148  cgg    If cells are not full, this should be modified with hFac.  cgg    If cells are not full, this should be modified with hFac.
149  cgg      cgg
150  cgg    The xx field (tmpfldxz) does not contain the velocity at the  cgg    The xx field (tmpfldxz) does not contain the velocity at the
151  cgg    surface level. This velocity is not independent; it must  cgg    surface level. This velocity is not independent; it must
152  cgg    exactly balance the volume flux, since we are dealing with  cgg    exactly balance the volume flux, since we are dealing with
153  cgg    the baroclinic velocity structure..  cgg    the baroclinic velocity structure..
154                        utop = tmpfldyz(j,k,bi,bj)*                        utop = tmpfldyz(j,k,bi,bj)*
155       &                maskW(i+ip1,j,k,bi,bj) * delR(k) + utop       &                maskW(i+ip1,j,k,bi,bj) * delR(k) + utop
156  cgg    Add the barotropic velocity component.  cgg    Add the barotropic velocity component.
157                        if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then                        if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
158                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro
159                        endif                        endif
160                      enddo                      enddo
161  cgg    Compute the baroclinic velocity at level 1. Should balance flux.  cgg    Compute the baroclinic velocity at level 1. Should balance flux.
162                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)
163       &                                      - utop / delR(1)       &                                      - utop / delR(1)
164                    enddo                    enddo
165                  enddo                  enddo
# Line 179  cgg         The barotropic velocity is s Line 181  cgg         The barotropic velocity is s
181    
182                      do k = 1,Nr                      do k = 1,Nr
183  cgg    If cells are not full, this should be modified with hFac.  cgg    If cells are not full, this should be modified with hFac.
184  cgg      cgg
185  cgg    The xx field (tmpfldxz) does not contain the velocity at the  cgg    The xx field (tmpfldxz) does not contain the velocity at the
186  cgg    surface level. This velocity is not independent; it must  cgg    surface level. This velocity is not independent; it must
187  cgg    exactly balance the volume flux, since we are dealing with  cgg    exactly balance the volume flux, since we are dealing with
188  cgg    the baroclinic velocity structure..  cgg    the baroclinic velocity structure..
189                        utop = tmpfldyz(j,k,bi,bj)*                        utop = tmpfldyz(j,k,bi,bj)*
190       &                maskS(i,j,k,bi,bj) * delR(k) + utop       &                maskS(i,j,k,bi,bj) * delR(k) + utop
191  cgg    Add the barotropic velocity component.  cgg    Add the barotropic velocity component.
192                        if (maskS(i,j,k,bi,bj) .ne. 0.) then                        if (maskS(i,j,k,bi,bj) .ne. 0.) then
193                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro
194                        endif                        endif
195                      enddo                      enddo
196  cgg    Compute the baroclinic velocity at level 1. Should balance flux.  cgg    Compute the baroclinic velocity at level 1. Should balance flux.
197                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)
198       &                                      - utop / delR(1)       &                                      - utop / delR(1)
199                    enddo                    enddo
200                  enddo                  enddo
# Line 215  cgg     & Line 217  cgg     &
217          endif          endif
218    
219          if ( (obcsefirst) .or. (obcsechanged)) then          if ( (obcsefirst) .or. (obcsechanged)) then
220              
221            do bj = jtlo,jthi            do bj = jtlo,jthi
222              do bi = itlo,ithi              do bi = itlo,ithi
223                do j = jmin,jmax                do j = jmin,jmax
# Line 238  cgg     & Line 240  cgg     &
240              enddo              enddo
241            enddo            enddo
242    
243            call active_read_yz( fnameobcse, tmpfldyz,            call active_read_yz( fnameobcse, tmpfldyz,
244       &                         (obcsecount1-1)*nobcs+iobcs,       &                         (obcsecount1-1)*nobcs+iobcs,
245       &                         doglobalread, ladinit, optimcycle,       &                         doglobalread, ladinit, optimcycle,
246       &                         mythid, xx_obcse_dummy )       &                         mythid, xx_obcse_dummy )
247    
248  #ifdef ALLOW_CTRL_OBCS_BALANCE  #ifdef ALLOW_CTRL_OBCS_BALANCE
249    
250            if ( optimcycle .gt. 0) then                      if ( optimcycle .gt. 0) then
251              if (iobcs .eq. 3) then              if (iobcs .eq. 3) then
252  cgg         Special attention is needed for the normal velocity.  cgg         Special attention is needed for the normal velocity.
253  cgg         For the north, this is the v velocity, iobcs = 4.  cgg         For the north, this is the v velocity, iobcs = 4.
# Line 262  cgg         The barotropic velocity is s Line 264  cgg         The barotropic velocity is s
264    
265                      do k = 1,Nr                      do k = 1,Nr
266  cgg    If cells are not full, this should be modified with hFac.  cgg    If cells are not full, this should be modified with hFac.
267  cgg      cgg
268  cgg    The xx field (tmpfldxz) does not contain the velocity at the  cgg    The xx field (tmpfldxz) does not contain the velocity at the
269  cgg    surface level. This velocity is not independent; it must  cgg    surface level. This velocity is not independent; it must
270  cgg    exactly balance the volume flux, since we are dealing with  cgg    exactly balance the volume flux, since we are dealing with
271  cgg    the baroclinic velocity structure..  cgg    the baroclinic velocity structure..
272                        utop = tmpfldyz(j,k,bi,bj)*                        utop = tmpfldyz(j,k,bi,bj)*
273       &                maskW(i+ip1,j,k,bi,bj) * delR(k) + utop       &                maskW(i+ip1,j,k,bi,bj) * delR(k) + utop
274  cgg    Add the barotropic velocity component.  cgg    Add the barotropic velocity component.
275                        if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then                        if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
276                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro
277                        endif                        endif
278                      enddo                      enddo
279  cgg    Compute the baroclinic velocity at level 1. Should balance flux.  cgg    Compute the baroclinic velocity at level 1. Should balance flux.
280                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)
281       &                                      - utop / delR(1)       &                                      - utop / delR(1)
282                    enddo                    enddo
283                  enddo                  enddo
# Line 297  cgg         The barotropic velocity is s Line 299  cgg         The barotropic velocity is s
299    
300                      do k = 1,Nr                      do k = 1,Nr
301  cgg    If cells are not full, this should be modified with hFac.  cgg    If cells are not full, this should be modified with hFac.
302  cgg      cgg
303  cgg    The xx field (tmpfldxz) does not contain the velocity at the  cgg    The xx field (tmpfldxz) does not contain the velocity at the
304  cgg    surface level. This velocity is not independent; it must  cgg    surface level. This velocity is not independent; it must
305  cgg    exactly balance the volume flux, since we are dealing with  cgg    exactly balance the volume flux, since we are dealing with
306  cgg    the baroclinic velocity structure..  cgg    the baroclinic velocity structure..
307                        utop = tmpfldyz(j,k,bi,bj)*                        utop = tmpfldyz(j,k,bi,bj)*
308       &                maskS(i,j,k,bi,bj) * delR(k) + utop       &                maskS(i,j,k,bi,bj) * delR(k) + utop
309  cgg    Add the barotropic velocity component.  cgg    Add the barotropic velocity component.
310                        if (maskS(i,j,k,bi,bj) .ne. 0.) then                        if (maskS(i,j,k,bi,bj) .ne. 0.) then
311                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro                          tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro
312                        endif                        endif
313                      enddo                      enddo
314  cgg    Compute the baroclinic velocity at level 1. Should balance flux.  cgg    Compute the baroclinic velocity at level 1. Should balance flux.
315                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)                      tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj)
316       &                                      - utop / delR(1)       &                                      - utop / delR(1)
317                    enddo                    enddo
318                  enddo                  enddo

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22