1 |
edhill |
1.5 |
C |
2 |
heimbach |
1.7 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_set_globfld_xy.F,v 1.6 2003/10/30 19:09:05 heimbach Exp $ |
3 |
heimbach |
1.6 |
C $Name: $ |
4 |
edhill |
1.5 |
|
5 |
heimbach |
1.2 |
#include "CTRL_CPPOPTIONS.h" |
6 |
|
|
|
7 |
|
|
subroutine ctrl_set_globfld_xy( |
8 |
|
|
I fname, ivartype, mythid ) |
9 |
|
|
|
10 |
|
|
c ================================================================== |
11 |
|
|
c SUBROUTINE ctrl_set_globfld_xy |
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 |
|
|
|
36 |
|
|
#ifdef ALLOW_ECCO_OPTIMIZATION |
37 |
|
|
#include "optim.h" |
38 |
|
|
#endif |
39 |
|
|
|
40 |
|
|
c == routine arguments == |
41 |
|
|
|
42 |
|
|
character*( 80) fname |
43 |
|
|
integer ivartype |
44 |
|
|
integer mythid |
45 |
|
|
|
46 |
|
|
c == local variables == |
47 |
|
|
|
48 |
|
|
#ifndef ALLOW_ECCO_OPTIMIZATION |
49 |
|
|
integer optimcycle |
50 |
|
|
#endif |
51 |
|
|
|
52 |
|
|
integer bi,bj |
53 |
|
|
integer ip,jp |
54 |
heimbach |
1.4 |
integer i,j,k |
55 |
heimbach |
1.2 |
integer itlo,ithi |
56 |
|
|
integer jtlo,jthi |
57 |
|
|
integer jmin,jmax |
58 |
|
|
integer imin,imax |
59 |
heimbach |
1.4 |
integer irec,nrec_nl |
60 |
heimbach |
1.2 |
|
61 |
|
|
_RL globfld2d( snx,nsx,npx,sny,nsy,npy ) |
62 |
heimbach |
1.4 |
_RL globfld3d( snx,nsx,npx,sny,nsy,npy,nr ) |
63 |
heimbach |
1.2 |
|
64 |
|
|
c == external == |
65 |
|
|
|
66 |
|
|
c == end of interface == |
67 |
|
|
|
68 |
|
|
jtlo = 1 |
69 |
|
|
jthi = nsy |
70 |
|
|
itlo = 1 |
71 |
|
|
ithi = nsx |
72 |
|
|
jmin = 1 |
73 |
|
|
jmax = sny |
74 |
|
|
imin = 1 |
75 |
|
|
imax = snx |
76 |
|
|
|
77 |
|
|
c Initialise temporary file |
78 |
|
|
do jp = 1,nPy |
79 |
|
|
do bj = jtlo,jthi |
80 |
|
|
do j = jmin,jmax |
81 |
|
|
do ip = 1,nPx |
82 |
|
|
do bi = itlo,ithi |
83 |
|
|
do i = imin,imax |
84 |
heimbach |
1.3 |
globfld2d(i,bi,ip,j,bj,jp) = 0. _d 0 |
85 |
heimbach |
1.4 |
enddo |
86 |
|
|
enddo |
87 |
|
|
enddo |
88 |
|
|
enddo |
89 |
|
|
enddo |
90 |
|
|
enddo |
91 |
|
|
c Initialise temporary file |
92 |
|
|
do k = 1,nr |
93 |
|
|
do jp = 1,nPy |
94 |
|
|
do bj = jtlo,jthi |
95 |
|
|
do j = jmin,jmax |
96 |
|
|
do ip = 1,nPx |
97 |
|
|
do bi = itlo,ithi |
98 |
|
|
do i = imin,imax |
99 |
|
|
globfld3d(i,bi,ip,j,bj,jp,k) = 0. _d 0 |
100 |
|
|
enddo |
101 |
heimbach |
1.2 |
enddo |
102 |
|
|
enddo |
103 |
|
|
enddo |
104 |
|
|
enddo |
105 |
|
|
enddo |
106 |
|
|
enddo |
107 |
|
|
|
108 |
|
|
#ifndef ALLOW_ECCO_OPTIMIZATION |
109 |
|
|
optimcycle = 0 |
110 |
|
|
#endif |
111 |
|
|
|
112 |
|
|
c-- Only the master thread will do I/O. |
113 |
|
|
_BEGIN_MASTER( mythid ) |
114 |
|
|
|
115 |
heimbach |
1.4 |
nrec_nl=int(ncvarrecs(ivartype)/Nr) |
116 |
|
|
do irec = 1, nrec_nl |
117 |
|
|
call MDSWRITEFIELD_3D_GL( fname, ctrlprec, 'RL', |
118 |
|
|
& Nr, globfld3d, |
119 |
|
|
& irec, optimcycle, mythid) |
120 |
|
|
enddo |
121 |
|
|
|
122 |
|
|
do irec = nrec_nl*Nr+1, ncvarrecs(ivartype) |
123 |
heimbach |
1.2 |
call MDSWRITEFIELD_2D_GL( fname, ctrlprec, 'RL', |
124 |
|
|
& 1, globfld2d, |
125 |
|
|
& irec, optimcycle, mythid) |
126 |
|
|
enddo |
127 |
|
|
|
128 |
|
|
_END_MASTER( mythid ) |
129 |
|
|
|
130 |
|
|
end |