1 |
C $Header: /u/gcmpack/MITgcm/pkg/aim_compon_interf/atm_export_atmslp.F,v 1.1 2004/05/21 19:59:38 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: ATM_EXPORT_FLD |
8 |
C !INTERFACE: |
9 |
SUBROUTINE ATM_EXPORT_FLD( |
10 |
I atmFldName, |
11 |
U atmFld, countTime, |
12 |
I myThid ) |
13 |
|
14 |
C !DESCRIPTION: \bv |
15 |
C *==========================================================* |
16 |
C | SUBROUTINE ATM_EXPORT_FLD |
17 |
C | o Routine for exporting 1 atmos. field to coupling layer: |
18 |
C | - compute the time-average (if needed) |
19 |
C | - send the field to the coupler |
20 |
C | - reset time and field to zero |
21 |
C *==========================================================* |
22 |
C | This version talks to the MIT Coupler. It uses the MIT |
23 |
C | Coupler "checkpoint1" library calls. |
24 |
C *==========================================================* |
25 |
C \ev |
26 |
|
27 |
C !USES: |
28 |
IMPLICIT NONE |
29 |
C == Global variables == |
30 |
#include "SIZE.h" |
31 |
#include "EEPARAMS.h" |
32 |
|
33 |
C !INPUT/OUTPUT PARAMETERS: |
34 |
C === Routine arguments === |
35 |
C atmFldName :: atmos. Field identificator name |
36 |
C atmFld :: array containing the atmospheric Field to export |
37 |
C countTime :: fractional integrated time |
38 |
C myThid :: my Thread Id number |
39 |
CHARACTER*(*) atmFldName |
40 |
_RL atmFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
41 |
_RL countTime(nSx,nSy) |
42 |
INTEGER myThid |
43 |
CEOP |
44 |
|
45 |
C == Local variables == |
46 |
C recipAvT :: Temp. for holding reciprocal of averaging period. |
47 |
C i,j,bi,bj :: Loop counters |
48 |
_RL recipAvT |
49 |
INTEGER i,j,bi,bj |
50 |
|
51 |
C Convert time integrated heatflux to mean value ready for export. |
52 |
DO bj=myByLo(myThid),myByHi(myThid) |
53 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
54 |
IF ( ABS(countTime(bi,bj) -1. _d 0).GT. 1. _d -12 |
55 |
& .AND. countTime(bi,bj) .NE. 0. ) THEN |
56 |
recipAvT = 1. _d 0/countTime(bi,bj) |
57 |
DO j=1,sNy |
58 |
DO i=1,sNx |
59 |
atmFld(i,j,bi,bj) = atmFld(i,j,bi,bj)*recipAvT |
60 |
ENDDO |
61 |
ENDDO |
62 |
WRITE(errorMessageUnit,'(3A,2I4,1PE15.8)') |
63 |
& 'ATM_EXPORT_FLD: ',atmFldName,' : 1-CountTime=', |
64 |
& bi,bj,1.-countTime(bi,bj) |
65 |
ENDIF |
66 |
ENDDO |
67 |
ENDDO |
68 |
|
69 |
C Send atmos. field to coupling layer. |
70 |
CALL COMPSEND_R8TILES( atmFldName, |
71 |
I sNx, OLx, sNy, OLy, 1, nSx, nSy, atmFld ) |
72 |
|
73 |
C Reset atmos. field & integrated time before accumulating again. |
74 |
DO bj=myByLo(myThid),myByHi(myThid) |
75 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
76 |
countTime(bi,bj) = 0. |
77 |
DO j=1,sNy |
78 |
DO i=1,sNx |
79 |
atmFld(i,j,bi,bj) = 0. |
80 |
ENDDO |
81 |
ENDDO |
82 |
ENDDO |
83 |
ENDDO |
84 |
|
85 |
RETURN |
86 |
END |