/[MITgcm]/MITgcm/pkg/aim_v23/aim_write_phys.F
ViewVC logotype

Contents of /MITgcm/pkg/aim_v23/aim_write_phys.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Tue Jun 9 22:44:02 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint62, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.1: +4 -5 lines
adapted for new version of MDS_WRITELOCAL

1 C $Header: /u/gcmpack/MITgcm/pkg/aim_v23/aim_write_phys.F,v 1.1 2006/08/04 22:27:46 jmc Exp $
2 C $Name: $
3
4 #include "AIM_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: AIM_WRITE_PHYS
8 C !INTERFACE:
9 SUBROUTINE AIM_WRITE_PHYS(
10 I pref, suff, nNr, field,
11 I kLev, bi, bj, iRec, myIter, myThid )
12 C !DESCRIPTION: \bv
13 C *==========================================================*
14 C | SUBROUTINE AIM_WRITE_PHYS
15 C | o Write variable from AIM physics common block
16 C | (=> no overlap & nThreads) and reverse K index.
17 C *==========================================================*
18 C | Note: assume symetry in tiles per thread treatment
19 C *==========================================================*
20 C !USES
21 IMPLICIT NONE
22
23 C == Global variables ===
24 #include "AIM_SIZE.h"
25
26 #include "EEPARAMS.h"
27 c #include "PARAMS.h"
28
29 C !INPUT/OUTPUT PARAMETERS:
30 C == Routine arguments ==
31 C pref :: Prefix of the output file name
32 C suff :: Suffix of the output file name
33 C nNr :: 3rd dim. of the input field
34 C field :: Field (from aim-physics) to write
35 C kLev :: level index to write (0 = write all levels)
36 C bi,bj :: Tile index
37 C iRec :: reccord number in the output file
38 C myIter :: Current iteration number in simulation
39 C myThid :: my Thread Id number
40 CHARACTER*(*) pref, suff
41 INTEGER nNr
42 _RL field(sNx,sNy,nNr,MAX_NO_THREADS)
43 INTEGER kLev, bi, bj, iRec, myIter, myThid
44
45 #ifdef ALLOW_AIM
46
47 C Functions
48 INTEGER ILNBLNK
49 EXTERNAL ILNBLNK
50
51 C !LOCAL VARIABLES:
52 CHARACTER*(MAX_LEN_MBUF) msgBuf
53 _RL tmpFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
54 INTEGER iL
55 INTEGER i, j, k, Katm, nLoc
56 INTEGER ith, biLoc, bjLoc
57 CEOP
58
59 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
60
61 #ifdef LOCBIN_IO_THREAD_SAFE
62 C- safe for any thread to do IO
63 ith = myThid
64 biLoc = bi
65 bjLoc = bj
66 #else /* LOCBIN_IO_THREAD_SAFE */
67 C- master-thread does IO for all threads
68 _BARRIER
69 _BEGIN_MASTER( myThid )
70 DO ith=1,nThreads
71 biLoc = bi + myBxLo(ith) - 1
72 bjLoc = bj + myByLo(ith) - 1
73 #endif /* LOCBIN_IO_THREAD_SAFE */
74
75 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
76
77 C-- Check for argument list consistency
78 IF ( nNr.LT.1 .OR. nNr.GT.Nr ) THEN
79 iL = ILNBLNK( pref )
80 WRITE(msgBuf,'(A,I10,A,2I5,A,I4,2A)')
81 & 'AIM_WRITE_PHYS (it=', myIter, ' bi,bj=', bi,bj,
82 & ' iRec=', iRec, ' ): try to write: ', pref(1:iL)
83 CALL PRINT_ERROR( msgBuf, myThid )
84 WRITE(msgBuf,'(A,I4,A,I4)')
85 & 'AIM_WRITE_PHYS: 3rd dim.(field)=',nNr,' has to be <',Nr
86 CALL PRINT_ERROR( msgBuf , myThid)
87 STOP 'ABNORMAL END: S/R AIM_WRITE_PHYS'
88 ELSEIF ( kLev.NE.0 .AND. kLev.GT.nNr ) THEN
89 iL = ILNBLNK( pref )
90 WRITE(msgBuf,'(A,I10,A,2I5,A,I4,2A)')
91 & 'AIM_WRITE_PHYS (it=', myIter, ' bi,bj=', bi,bj,
92 & ' iRec=', iRec, ' ): try to write: ', pref(1:iL)
93 CALL PRINT_ERROR( msgBuf, myThid )
94 WRITE(msgBuf,'(A,I4,A,I4)')
95 & 'AIM_WRITE_PHYS: kLev=', kLev,
96 & ' out of bounds (dim=', nNr,' )'
97 CALL PRINT_ERROR( msgBuf , myThid)
98 STOP 'ABNORMAL END: S/R AIM_WRITE_PHYS'
99 ENDIF
100
101 C-- Copy the input field into tempo. array:
102 nLoc = nNr
103 IF ( kLev.GE.1 .AND. kLev.LE.nNr ) THEN
104 nLoc = 1
105 DO j=1,sNy
106 DO i=1,sNx
107 tmpFld(i,j,1) = field(i,j,kLev,ith)
108 ENDDO
109 ENDDO
110 ELSEIF (nNr.EQ.Nr) THEN
111 C- Reverse K index:
112 DO k=1,Nr
113 Katm = _KD2KA( k )
114 DO j=1,sNy
115 DO i=1,sNx
116 tmpFld(i,j,k) = field(i,j,Katm,ith)
117 ENDDO
118 ENDDO
119 ENDDO
120 ELSE
121 C- Do simple copy
122 DO k=1,nNr
123 DO j=1,sNy
124 DO i=1,sNx
125 tmpFld(i,j,k) = field(i,j,k,ith)
126 ENDDO
127 ENDDO
128 ENDDO
129 ENDIF
130
131 C-- Write to file: note: call with myThArg=0 => single thread job
132 CALL WRITE_LOCAL_RL( pref, suff, nLoc, tmpFld,
133 & biLoc, bjLoc, iRec, myIter, 0 )
134
135 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
136
137 #ifndef LOCBIN_IO_THREAD_SAFE
138 ENDDO
139 _END_MASTER( myThid )
140 _BARRIER
141 #endif /* ndef LOCBIN_IO_THREAD_SAFE */
142
143 #endif /* ALLOW_AIM */
144 RETURN
145 END

  ViewVC Help
Powered by ViewVC 1.1.22