1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "AIM_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: AIM_WRITE_LOCAL |
8 |
C !INTERFACE: |
9 |
SUBROUTINE AIM_WRITE_LOCAL( |
10 |
I pref,suff,nNr,field,bi,bj,iRec,myIter,myThid) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE AIM_WRITE_LOCAL |
14 |
C | o Write local variable from AIM physics (=> no overlap) |
15 |
C | and reverse K index. |
16 |
C *==========================================================* |
17 |
C !USES |
18 |
IMPLICIT NONE |
19 |
|
20 |
C == Global variables === |
21 |
#include "AIM_SIZE.h" |
22 |
|
23 |
#include "EEPARAMS.h" |
24 |
c #include "PARAMS.h" |
25 |
|
26 |
C !INPUT/OUTPUT PARAMETERS: |
27 |
C == Routine arguments == |
28 |
C pref = Prefix of the output file name |
29 |
C suff = Suffix of the output file name |
30 |
C Nr = 3rd dim. of the input field |
31 |
C field = Field (from aim-physics) to write |
32 |
C bi,bj = Tile index |
33 |
C iRec = reccord number in the output file |
34 |
C myIter - Current iteration number in simulation |
35 |
C myThid - Thread number for this instance of the routine |
36 |
CHARACTER*(*) pref,suff |
37 |
INTEGER nNr |
38 |
_RL field(sNx,sNy,nNr) |
39 |
INTEGER bi, bj, iRec, myIter, myThid |
40 |
|
41 |
#ifdef ALLOW_AIM |
42 |
|
43 |
C !LOCAL VARIABLES: |
44 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
45 |
_RL tmpFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
INTEGER i,j,k,Katm |
47 |
|
48 |
CEOP |
49 |
|
50 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
51 |
|
52 |
C- Copy the input field into tempo. array: |
53 |
IF (nNr.EQ.Nr) THEN |
54 |
C- Reverse K index: |
55 |
DO k=1,Nr |
56 |
Katm = _KD2KA( k ) |
57 |
DO j=1,sNy |
58 |
DO i=1,sNx |
59 |
tmpFld(i,j,k) = field(i,j,Katm) |
60 |
ENDDO |
61 |
ENDDO |
62 |
ENDDO |
63 |
ELSEIF (nNr.LT.Nr) THEN |
64 |
DO k=1,nNr |
65 |
DO j=1,sNy |
66 |
DO i=1,sNx |
67 |
tmpFld(i,j,k) = field(i,j,k) |
68 |
ENDDO |
69 |
ENDDO |
70 |
ENDDO |
71 |
ELSE |
72 |
WRITE(msgBuf,'(A,I4,A,I4)') |
73 |
& 'AIM_WRITE_LOCAL: 3rd dim.(field)=',nNr,' has to be <',Nr |
74 |
CALL PRINT_ERROR( msgBuf , myThid) |
75 |
STOP 'ABNORMAL END: S/R AIM_WRITE_LOCAL' |
76 |
ENDIF |
77 |
|
78 |
C- Write to file: |
79 |
CALL WRITE_LOCAL_RL(pref,suff,nNr,tmpFld, |
80 |
& bi,bj,iRec,myIter,myThid) |
81 |
|
82 |
#endif /* ALLOW_AIM */ |
83 |
RETURN |
84 |
END |