1 |
#include "CTRL_CPPOPTIONS.h" |
2 |
|
3 |
|
4 |
subroutine ctrl_set_globfld_xy( |
5 |
I fname, ivartype, mythid ) |
6 |
|
7 |
c ================================================================== |
8 |
c SUBROUTINE ctrl_set_globfld_xy |
9 |
c ================================================================== |
10 |
c |
11 |
c o initialise field |
12 |
c |
13 |
c started: heimbach@mit.edu, 16-Aug-2001 |
14 |
c |
15 |
c changed: heimbach@mit.edu 17-Jun-2003 |
16 |
c merged Armin's changes to replace write of |
17 |
c nr * globfld2d by 1 * globfld3d |
18 |
c (ad hoc fix to speed up global I/O) |
19 |
c |
20 |
c ================================================================== |
21 |
|
22 |
implicit none |
23 |
|
24 |
c == global variables == |
25 |
|
26 |
#include "EEPARAMS.h" |
27 |
#include "SIZE.h" |
28 |
#include "PARAMS.h" |
29 |
#include "GRID.h" |
30 |
|
31 |
#include "ctrl.h" |
32 |
#include "cost.h" |
33 |
|
34 |
#ifdef ALLOW_ECCO_OPTIMIZATION |
35 |
#include "optim.h" |
36 |
#endif |
37 |
|
38 |
c == routine arguments == |
39 |
|
40 |
character*( 80) fname |
41 |
integer ivartype |
42 |
integer mythid |
43 |
|
44 |
c == local variables == |
45 |
|
46 |
#ifndef ALLOW_ECCO_OPTIMIZATION |
47 |
integer optimcycle |
48 |
#endif |
49 |
|
50 |
integer bi,bj |
51 |
integer ip,jp |
52 |
integer i,j,k |
53 |
integer itlo,ithi |
54 |
integer jtlo,jthi |
55 |
integer jmin,jmax |
56 |
integer imin,imax |
57 |
integer irec,nrec_nl |
58 |
|
59 |
_RL globfld2d( snx,nsx,npx,sny,nsy,npy ) |
60 |
_RL globfld3d( snx,nsx,npx,sny,nsy,npy,nr ) |
61 |
|
62 |
c == external == |
63 |
|
64 |
c == end of interface == |
65 |
|
66 |
jtlo = 1 |
67 |
jthi = nsy |
68 |
itlo = 1 |
69 |
ithi = nsx |
70 |
jmin = 1 |
71 |
jmax = sny |
72 |
imin = 1 |
73 |
imax = snx |
74 |
|
75 |
c Initialise temporary file |
76 |
do jp = 1,nPy |
77 |
do bj = jtlo,jthi |
78 |
do j = jmin,jmax |
79 |
do ip = 1,nPx |
80 |
do bi = itlo,ithi |
81 |
do i = imin,imax |
82 |
globfld2d(i,bi,ip,j,bj,jp) = 0. _d 0 |
83 |
enddo |
84 |
enddo |
85 |
enddo |
86 |
enddo |
87 |
enddo |
88 |
enddo |
89 |
c Initialise temporary file |
90 |
do k = 1,nr |
91 |
do jp = 1,nPy |
92 |
do bj = jtlo,jthi |
93 |
do j = jmin,jmax |
94 |
do ip = 1,nPx |
95 |
do bi = itlo,ithi |
96 |
do i = imin,imax |
97 |
globfld3d(i,bi,ip,j,bj,jp,k) = 0. _d 0 |
98 |
enddo |
99 |
enddo |
100 |
enddo |
101 |
enddo |
102 |
enddo |
103 |
enddo |
104 |
enddo |
105 |
|
106 |
#ifndef ALLOW_ECCO_OPTIMIZATION |
107 |
optimcycle = 0 |
108 |
#endif |
109 |
|
110 |
c-- Only the master thread will do I/O. |
111 |
_BEGIN_MASTER( mythid ) |
112 |
|
113 |
nrec_nl=int(ncvarrecs(ivartype)/Nr) |
114 |
do irec = 1, nrec_nl |
115 |
call MDSWRITEFIELD_3D_GL( fname, ctrlprec, 'RL', |
116 |
& Nr, globfld3d, |
117 |
& irec, optimcycle, mythid) |
118 |
enddo |
119 |
|
120 |
do irec = nrec_nl*Nr+1, ncvarrecs(ivartype) |
121 |
call MDSWRITEFIELD_2D_GL( fname, ctrlprec, 'RL', |
122 |
& 1, globfld2d, |
123 |
& irec, optimcycle, mythid) |
124 |
enddo |
125 |
|
126 |
_END_MASTER( mythid ) |
127 |
|
128 |
end |