1 |
adcroft |
1.1 |
C $Header: /u/gcmpack/models/MITgcmUV/verification/solid-body.cs-32x32x1/code/ini_vel.F,v 1.1 2001/07/31 18:30:55 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 |
|
|
_RL psi,omegaprime,fac |
26 |
|
|
|
27 |
|
|
psi(i,j,bi,bj)=fac*fCoriG(i,j,bi,bj) |
28 |
|
|
|
29 |
|
|
C-- Initialise velocity fields to zero |
30 |
|
|
C |
31 |
|
|
C If you want to specify an analytic initial state for the flow |
32 |
|
|
C field then customize the following section of code. |
33 |
|
|
C It is, however, often easier to generate initial conditions |
34 |
|
|
C off-line and read them from input files... |
35 |
|
|
C |
36 |
|
|
omegaprime=38.60328935834681d0/rSphere |
37 |
|
|
fac=-(rSphere**2)*omegaprime/(2.d0*Omega) |
38 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
39 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
40 |
|
|
DO k=1,Nr |
41 |
|
|
DO j=1-Oly,sNy+Oly |
42 |
|
|
DO i=1-Olx,sNx+Olx |
43 |
|
|
uVel(i,j,k,bi,bj)=0. |
44 |
|
|
& +(psi(i,j,bi,bj)-psi(i,j+1,bi,bj))*recip_dyg(i,j,bi,bj) |
45 |
|
|
vVel(i,j,k,bi,bj)=0. |
46 |
|
|
& +(psi(i+1,j,bi,bj)-psi(i,j,bi,bj))*recip_dxg(i,j,bi,bj) |
47 |
|
|
wVel(i,j,k,bi,bj)=0. |
48 |
|
|
ENDDO |
49 |
|
|
ENDDO |
50 |
|
|
ENDDO |
51 |
|
|
ENDDO |
52 |
|
|
ENDDO |
53 |
|
|
|
54 |
|
|
C Read an initial state for each component if required |
55 |
|
|
IF (uVelInitFile .NE. ' ') THEN |
56 |
|
|
_BEGIN_MASTER( myThid ) |
57 |
|
|
CALL READ_FLD_XYZ_RL( uVelInitFile, ' ', uVel, 0, myThid ) |
58 |
|
|
_END_MASTER(myThid) |
59 |
|
|
c _EXCH_XYZ_R8(uVel , myThid ) |
60 |
|
|
ENDIF |
61 |
|
|
|
62 |
|
|
IF (vVelInitFile .NE. ' ') THEN |
63 |
|
|
_BEGIN_MASTER( myThid ) |
64 |
|
|
CALL READ_FLD_XYZ_RL( vVelInitFile, ' ', vVel, 0, myThid ) |
65 |
|
|
_END_MASTER(myThid) |
66 |
|
|
c _EXCH_XYZ_R8(vVel , myThid ) |
67 |
|
|
ENDIF |
68 |
|
|
|
69 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
70 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
71 |
|
|
DO k=1,Nr |
72 |
|
|
DO j=1-Oly,sNy+Oly |
73 |
|
|
DO i=1-Olx,sNx+Olx |
74 |
|
|
uVel(i,j,k,bi,bj)=uVel(i,j,k,bi,bj)*_maskW(i,j,k,bi,bj) |
75 |
|
|
vVel(i,j,k,bi,bj)=vVel(i,j,k,bi,bj)*_maskS(i,j,k,bi,bj) |
76 |
|
|
ENDDO |
77 |
|
|
ENDDO |
78 |
|
|
CALL INTEGRATE_FOR_W( |
79 |
|
|
I bi, bj, k, uVel, vVel, |
80 |
|
|
O wVel, |
81 |
|
|
I myThid ) |
82 |
|
|
ENDDO |
83 |
|
|
ENDDO |
84 |
|
|
ENDDO |
85 |
|
|
|
86 |
|
|
c IF (uVelInitFile .NE. ' ' .OR. vVelInitFile .NE. ' ') THEN |
87 |
|
|
CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid) |
88 |
|
|
_EXCH_XYZ_R8(wVel,myThid) |
89 |
|
|
c ENDIF |
90 |
|
|
|
91 |
|
|
RETURN |
92 |
|
|
END |