1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/Attic/ini_vel.F,v 1.1.2.2 2001/04/09 19:15:33 adcroft Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE INI_VEL( myThid ) |
7 |
IMPLICIT NONE |
8 |
|
9 |
C Initialize 3D flow field (either to zero or from input files) |
10 |
|
11 |
C === Global variables === |
12 |
#include "SIZE.h" |
13 |
#include "EEPARAMS.h" |
14 |
#include "PARAMS.h" |
15 |
#include "GRID.h" |
16 |
#include "DYNVARS.h" |
17 |
|
18 |
C == Routine arguments == |
19 |
C myThid - Number of this instance of INI_UVEL |
20 |
INTEGER myThid |
21 |
|
22 |
C == Local variables == |
23 |
C bi,bj,i,j,k - Loop counters |
24 |
INTEGER bi,bj,i,j,k |
25 |
|
26 |
_RL psi,Lfac,Rpi |
27 |
psi(i,j,k,bi,bj)=Lfac*sin(XG(i,j,bi,bj)*Rpi/Lfac) |
28 |
& *sin( max(RF(k),R_low(i,j,bi,bj))*Rpi*recip_Rcol(i,j,bi,bj)) |
29 |
|
30 |
Rpi=3.14159265358979 |
31 |
Lfac=(DELX(1)*float(Nx)) |
32 |
|
33 |
|
34 |
C-- Initialise velocity fields to zero |
35 |
C |
36 |
C If you want to specify an analytic initial state for the flow |
37 |
C field then customize the following section of code. |
38 |
C It is, however, often easier to generate initial conditions |
39 |
C off-line and read them from input files... |
40 |
C |
41 |
DO bj = myByLo(myThid), myByHi(myThid) |
42 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
43 |
DO k=1,Nr |
44 |
DO j=1-Oly,sNy+Oly |
45 |
DO i=1-Olx,sNx+Olx |
46 |
uVel (I,J,K,bi,bj) = 0. _d 0 |
47 |
& + (psi(I,J,K,bi,bj)-psi(I,J,K+1,bi,bj))*recip_dRF(k) |
48 |
& *recip_hFacW(i,j,k,bi,bj) |
49 |
|
50 |
vVel(i,j,k,bi,bj)=0. |
51 |
wVel(i,j,k,bi,bj)=0. |
52 |
ENDDO |
53 |
ENDDO |
54 |
ENDDO |
55 |
ENDDO |
56 |
ENDDO |
57 |
|
58 |
C Read an initial state for each component if required |
59 |
IF (uVelInitFile .NE. ' ') THEN |
60 |
_BEGIN_MASTER( myThid ) |
61 |
CALL READ_FLD_XYZ_RL( uVelInitFile, ' ', uVel, 0, myThid ) |
62 |
_END_MASTER(myThid) |
63 |
c _EXCH_XYZ_R8(uVel , myThid ) |
64 |
ENDIF |
65 |
|
66 |
IF (vVelInitFile .NE. ' ') THEN |
67 |
_BEGIN_MASTER( myThid ) |
68 |
CALL READ_FLD_XYZ_RL( vVelInitFile, ' ', vVel, 0, myThid ) |
69 |
_END_MASTER(myThid) |
70 |
c _EXCH_XYZ_R8(vVel , myThid ) |
71 |
ENDIF |
72 |
|
73 |
DO bj = myByLo(myThid), myByHi(myThid) |
74 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
75 |
DO k=1,Nr |
76 |
DO j=1-Oly,sNy+Oly |
77 |
DO i=1-Olx,sNx+Olx |
78 |
uVel(i,j,k,bi,bj)=uVel(i,j,k,bi,bj)*_maskW(i,j,k,bi,bj) |
79 |
vVel(i,j,k,bi,bj)=vVel(i,j,k,bi,bj)*_maskS(i,j,k,bi,bj) |
80 |
ENDDO |
81 |
ENDDO |
82 |
CALL INTEGRATE_FOR_W( |
83 |
I bi, bj, k, uVel, vVel, |
84 |
O wVel, |
85 |
I myThid ) |
86 |
ENDDO |
87 |
ENDDO |
88 |
ENDDO |
89 |
|
90 |
c IF (uVelInitFile .NE. ' ' .OR. vVelInitFile .NE. ' ') THEN |
91 |
CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid) |
92 |
_EXCH_XYZ_R8(wVel,myThid) |
93 |
c ENDIF |
94 |
|
95 |
RETURN |
96 |
END |