/[MITgcm]/MITgcm/pkg/aim/aim_external_fields_load.F
ViewVC logotype

Contents of /MITgcm/pkg/aim/aim_external_fields_load.F

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


Revision 1.1 - (show annotations) (download)
Tue May 29 19:28:53 2001 UTC (23 years, 1 month ago) by cnh
Branch: MAIN
Updates for multi-threaded AIM with support for both latlon
and CS.
Needs compatible changes to verfication/

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/external_fields_load.F,v 1.5 2001/02/04 14:38:47 cnh Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CStartOfInterface
7 SUBROUTINE AIM_EXTERNAL_FIELDS_LOAD(
8 I myTime, myIter, myThid )
9 C /==========================================================\
10 C | SUBROUTINE AIM_EXTERNAL_FIELDS_LOAD |
11 C | o Control reading of AIM fields from external source. |
12 C |==========================================================|
13 C | Loads bottom boundary condition datasets for AIM. |
14 C | The routine is called every timetep and periodically |
15 C | loads a set of external fields. |
16 C | Monthly climatology files are read for |
17 C | Albedo |
18 C | Soil moisture |
19 C | Land and sea surface temps. |
20 C | Most of the work is done by the master the thread while |
21 C | the other threads spin. |
22 C \==========================================================/
23 IMPLICIT NONE
24
25 C === Global variables ===
26 #include "SIZE.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "AIM_FFIELDS.h"
30
31 C === Routine arguments ===
32 C myThid - Thread no. that called this routine.
33 C myTime - Simulation time
34 C myIter - Simulation timestep number
35 INTEGER myThid
36 _RL myTime
37 INTEGER myIter
38 CEndOfInterface
39
40 C === Functions ===
41 LOGICAL DIFFERENT_MULTIPLE
42 EXTERNAL DIFFERENT_MULTIPLE
43
44 #ifdef ALLOW_AIM
45 C === Local variables ===
46 C I, J - Loop counters
47 C tYear - Fraction within year of myTime
48 C mnthIndex - Current time in whole months
49 C prevMnthIndex
50 C fNam - Strings used in constructing file names
51 C mnthNam
52 INTEGER I, J
53 REAL tYear
54 INTEGER mnthIndex
55 INTEGER prevMnthIndex
56 DATA prevMnthIndex / 0 /
57 SAVE prevMnthIndex
58 CHARACTER*16 fNam
59 CHARACTER*3 mnthNam(12)
60 DATA mnthNam /
61 & 'jan', 'feb', 'mar', 'apr', 'may', 'jun',
62 & 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' /
63 SAVE mnthNam
64 LOGICAL firstCall
65 DATA FirstCall /.TRUE./
66 SAVE FirstCall
67
68 C Prevent loading of new data before everyone has finished with it
69 CALL BAR2(myThid)
70
71 C Master thread coordinates loading of AIM datasets
72 _BEGIN_MASTER( myThid )
73
74 C Calculate offset into a year
75 tYear = myTime/(86400.*360.) -
76 & FLOAT(INT(myTime/(86400.*360.)))
77 mnthIndex = INT(tYear*12.)+1
78 IF ( mnthIndex .NE. prevMnthIndex .OR.
79 & FirstCall ) THEN
80 C New month so load in data
81 prevMnthIndex = mnthIndex
82 C o Albedo ( convert % to fraction )
83 WRITE(fNam,'(A,A,A)' ) 'salb.',mnthNam(mnthIndex),'.sun.b'
84 OPEN(1,FILE=fNam(1:14),STATUS='old',FORM='unformatted')
85 READ(1) aim_albedo
86 CLOSE(1)
87 DO J=1,aim_nyIo
88 DO I=1,aim_nxIo
89 C aim_albedo(I,J) = aim_albedo(I,J)/100.
90 ENDDO
91 ENDDO
92
93 C o Surface temperature ( in kelvin )
94 WRITE(fNam,'(A,A,A)' ) 'tsurf.',mnthNam(mnthIndex),'.sun.b'
95 OPEN(1,FILE=fNam(1:15),STATUS='old',FORM='unformatted')
96 READ(1) aim_surfTemp
97 CLOSE(1)
98
99 C o Soil moisture ( convert to 20cm bucket fraction )
100 WRITE(fNam,'(A,A,A)' ) 'smoist.',mnthNam(mnthIndex),'.sun.b'
101 OPEN(1,FILE=fNam(1:16),STATUS='old',FORM='unformatted')
102 READ(1) aim_soilMoisture
103 CLOSE(1)
104 DO J=1,aim_nyIo
105 DO I=1,aim_nxIo
106 C aim_soilMoisture(I,J) = aim_soilMoisture(I,J)/20.
107 ENDDO
108 ENDDO
109
110 ENDIF
111
112 FirstCall = .FALSE.
113 _END_MASTER( myThid )
114
115 C Stop anyone leaving until all data is read
116 CALL BAR2(myThid)
117
118 #endif /* ALLOW_AIM */
119
120 RETURN
121 END

  ViewVC Help
Powered by ViewVC 1.1.22