1 |
jmc |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/aim_compon_interf/atm_export_fld.F,v 1.1 2006/07/02 22:47:19 jmc Exp $ |
2 |
jmc |
1.1 |
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 |
jmc |
1.2 |
C | Note: requires arg. array "atmFld" to be shared |
25 |
|
|
C | (in common block) to work in multi-threaded. |
26 |
jmc |
1.1 |
C *==========================================================* |
27 |
|
|
C \ev |
28 |
|
|
|
29 |
|
|
C !USES: |
30 |
|
|
IMPLICIT NONE |
31 |
|
|
C == Global variables == |
32 |
|
|
#include "SIZE.h" |
33 |
|
|
#include "EEPARAMS.h" |
34 |
|
|
|
35 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
36 |
|
|
C === Routine arguments === |
37 |
|
|
C atmFldName :: atmos. Field identificator name |
38 |
|
|
C atmFld :: array containing the atmospheric Field to export |
39 |
|
|
C countTime :: fractional integrated time |
40 |
|
|
C myThid :: my Thread Id number |
41 |
|
|
CHARACTER*(*) atmFldName |
42 |
|
|
_RL atmFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
43 |
|
|
_RL countTime(nSx,nSy) |
44 |
|
|
INTEGER myThid |
45 |
|
|
CEOP |
46 |
|
|
|
47 |
jmc |
1.2 |
#ifdef COMPONENT_MODULE |
48 |
|
|
C !LOCAL VARIABLES: |
49 |
jmc |
1.1 |
C == Local variables == |
50 |
|
|
C recipAvT :: Temp. for holding reciprocal of averaging period. |
51 |
|
|
C i,j,bi,bj :: Loop counters |
52 |
|
|
_RL recipAvT |
53 |
|
|
INTEGER i,j,bi,bj |
54 |
|
|
|
55 |
|
|
C Convert time integrated heatflux to mean value ready for export. |
56 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
57 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
58 |
|
|
IF ( ABS(countTime(bi,bj) -1. _d 0).GT. 1. _d -12 |
59 |
|
|
& .AND. countTime(bi,bj) .NE. 0. ) THEN |
60 |
|
|
recipAvT = 1. _d 0/countTime(bi,bj) |
61 |
|
|
DO j=1,sNy |
62 |
|
|
DO i=1,sNx |
63 |
|
|
atmFld(i,j,bi,bj) = atmFld(i,j,bi,bj)*recipAvT |
64 |
|
|
ENDDO |
65 |
|
|
ENDDO |
66 |
|
|
WRITE(errorMessageUnit,'(3A,2I4,1PE15.8)') |
67 |
|
|
& 'ATM_EXPORT_FLD: ',atmFldName,' : 1-CountTime=', |
68 |
|
|
& bi,bj,1.-countTime(bi,bj) |
69 |
|
|
ENDIF |
70 |
|
|
ENDDO |
71 |
|
|
ENDDO |
72 |
|
|
|
73 |
|
|
C Send atmos. field to coupling layer. |
74 |
jmc |
1.2 |
_BARRIER |
75 |
|
|
_BEGIN_MASTER( myThid ) |
76 |
|
|
CALL COMPSEND_R8TILES( |
77 |
|
|
I atmFldName, sNx, OLx, sNy, OLy, 1, nSx, nSy, |
78 |
|
|
I atmFld ) |
79 |
|
|
_END_MASTER( myThid ) |
80 |
|
|
_BARRIER |
81 |
jmc |
1.1 |
|
82 |
|
|
C Reset atmos. field & integrated time before accumulating again. |
83 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
84 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
85 |
|
|
countTime(bi,bj) = 0. |
86 |
|
|
DO j=1,sNy |
87 |
|
|
DO i=1,sNx |
88 |
|
|
atmFld(i,j,bi,bj) = 0. |
89 |
|
|
ENDDO |
90 |
|
|
ENDDO |
91 |
|
|
ENDDO |
92 |
|
|
ENDDO |
93 |
|
|
|
94 |
jmc |
1.2 |
#endif /* COMPONENT_MODULE */ |
95 |
|
|
|
96 |
jmc |
1.1 |
RETURN |
97 |
|
|
END |