1 |
edhill |
1.5 |
C |
2 |
mlosch |
1.13 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_set_globfld_yz.F,v 1.12 2007/05/16 00:03:37 heimbach Exp $ |
3 |
heimbach |
1.12 |
C $Name: $ |
4 |
edhill |
1.5 |
|
5 |
heimbach |
1.2 |
#include "CTRL_CPPOPTIONS.h" |
6 |
|
|
|
7 |
|
|
subroutine ctrl_set_globfld_yz( |
8 |
|
|
I fname, ivartype, mythid ) |
9 |
|
|
|
10 |
|
|
c ================================================================== |
11 |
|
|
c SUBROUTINE ctrl_set_globfld_yz |
12 |
|
|
c ================================================================== |
13 |
|
|
c |
14 |
|
|
c o initialise field |
15 |
|
|
c |
16 |
|
|
c started: heimbach@mit.edu, 16-Aug-2001 |
17 |
|
|
c |
18 |
heimbach |
1.4 |
c changed: heimbach@mit.edu 17-Jun-2003 |
19 |
|
|
c merged Armin's changes to replace write of |
20 |
|
|
c nr * globfld2d by 1 * globfld3d |
21 |
|
|
c (ad hoc fix to speed up global I/O) |
22 |
|
|
c |
23 |
heimbach |
1.2 |
c ================================================================== |
24 |
|
|
|
25 |
|
|
implicit none |
26 |
|
|
|
27 |
|
|
c == global variables == |
28 |
|
|
|
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "SIZE.h" |
31 |
|
|
#include "PARAMS.h" |
32 |
|
|
#include "GRID.h" |
33 |
|
|
|
34 |
|
|
#include "ctrl.h" |
35 |
|
|
#include "optim.h" |
36 |
|
|
|
37 |
|
|
c == routine arguments == |
38 |
|
|
|
39 |
|
|
character*( 80) fname |
40 |
|
|
integer ivartype |
41 |
|
|
integer mythid |
42 |
|
|
|
43 |
|
|
c == local variables == |
44 |
|
|
|
45 |
|
|
integer bi,bj |
46 |
|
|
integer ip,jp |
47 |
|
|
integer i,j,k |
48 |
|
|
integer itlo,ithi |
49 |
|
|
integer jtlo,jthi |
50 |
|
|
integer jmin,jmax |
51 |
|
|
integer imin,imax |
52 |
heimbach |
1.4 |
integer irec,nrec_nl |
53 |
heimbach |
1.2 |
|
54 |
heimbach |
1.12 |
_RL globfld3d(1-oLx:sNx+oLx,1-oLy:sNy+oLy,nr,nSx,nSy) |
55 |
|
|
_RL globfldyz(1-oLy:sNy+oLy,nr,nSx,nSy) |
56 |
|
|
|
57 |
heimbach |
1.2 |
|
58 |
|
|
c == external == |
59 |
|
|
|
60 |
|
|
c == end of interface == |
61 |
|
|
|
62 |
|
|
jtlo = 1 |
63 |
|
|
jthi = nsy |
64 |
|
|
itlo = 1 |
65 |
|
|
ithi = nsx |
66 |
heimbach |
1.12 |
jmin = 1-oLy |
67 |
|
|
jmax = sny+oLy |
68 |
|
|
imin = 1-oLx |
69 |
|
|
imax = snx+oLx |
70 |
heimbach |
1.2 |
|
71 |
|
|
c Initialise temporary file |
72 |
heimbach |
1.12 |
do bj = jtlo,jthi |
73 |
|
|
do bi = itlo,ithi |
74 |
|
|
do k = 1,nr |
75 |
heimbach |
1.2 |
do j = jmin,jmax |
76 |
heimbach |
1.12 |
globfldyz(j,k,bi,bj) = 0. _d 0 |
77 |
heimbach |
1.11 |
enddo |
78 |
heimbach |
1.4 |
enddo |
79 |
heimbach |
1.11 |
enddo |
80 |
heimbach |
1.4 |
enddo |
81 |
|
|
c Initialise temporary file |
82 |
heimbach |
1.12 |
do bj = jtlo,jthi |
83 |
|
|
do bi = itlo,ithi |
84 |
|
|
do k = 1,nr |
85 |
heimbach |
1.4 |
do j = jmin,jmax |
86 |
heimbach |
1.12 |
do i = imin,imax |
87 |
|
|
globfld3d(i,j,k,bi,bj) = 0. _d 0 |
88 |
heimbach |
1.11 |
enddo |
89 |
heimbach |
1.2 |
enddo |
90 |
|
|
enddo |
91 |
heimbach |
1.11 |
enddo |
92 |
heimbach |
1.2 |
enddo |
93 |
|
|
|
94 |
|
|
c-- Only the master thread will do I/O. |
95 |
|
|
_BEGIN_MASTER( mythid ) |
96 |
|
|
|
97 |
mlosch |
1.13 |
if ( useSingleCPUio ) then |
98 |
|
|
C MDSWRITEFIELDXZ does not know about useSingleCPUio, so the faster |
99 |
|
|
C method that works for .not.useSingleCPUio cannot be used |
100 |
|
|
nrec_nl = 0 |
101 |
|
|
else |
102 |
|
|
nrec_nl = int(ncvarrecs(ivartype)/Ny) |
103 |
|
|
endif |
104 |
|
|
|
105 |
heimbach |
1.4 |
do irec = 1, nrec_nl |
106 |
mlosch |
1.13 |
call MDSWRITEFIELD( fname, ctrlprec,.FALSE., 'RL', |
107 |
|
|
& Nr, globfld3d, |
108 |
|
|
& irec, optimcycle, mythid) |
109 |
|
|
|
110 |
heimbach |
1.4 |
enddo |
111 |
|
|
|
112 |
heimbach |
1.12 |
CMM( addone for good measure |
113 |
|
|
CMM do irec = nrec_nl*Nx+1, ncvarrecs(ivartype) |
114 |
|
|
do irec = nrec_nl*Nx+1, ncvarrecs(ivartype)+1 |
115 |
|
|
CMM) |
116 |
mlosch |
1.13 |
call MDSWRITEFIELDYZ( fname, ctrlprec,.FALSE., 'RL', |
117 |
|
|
& Nr, globfldyz, |
118 |
|
|
& irec, optimcycle, mythid) |
119 |
heimbach |
1.2 |
enddo |
120 |
|
|
|
121 |
|
|
_END_MASTER( mythid ) |
122 |
|
|
|
123 |
|
|
end |