/[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.2 - (show annotations) (download)
Mon Jun 18 17:39:58 2001 UTC (23 years ago) by cnh
Branch: MAIN
CVS Tags: checkpoint40pre1, checkpoint40pre2, checkpoint40pre5, checkpoint40pre6, checkpoint40pre8, release1_b1, checkpoint42, checkpoint43, checkpoint40pre4, ecco-branch-mod1, checkpoint40pre3, checkpoint40pre9, release1_beta1, checkpoint40pre7, checkpoint40, checkpoint41
Branch point for: ecco-branch, release1_coupled, release1
Changes since 1.1: +13 -23 lines
Add to main branch of
  o CS atmos with AIM physics
  o Multi-threaded AIM physics for LatLon and CS tests
  o Tidied up monitor() output

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*17 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),'.cs.bin'
84 CALL MDSREADFIELD(fNam(1:15),readBinaryPrec,'RS',1,
85 O aim_albedo,
86 I 1,myThid)
87
88 C o Surface temperature ( in kelvin )
89 WRITE(fNam,'(A,A,A)' ) 'tsurf.',mnthNam(mnthIndex),'.cs.bin'
90 CALL MDSREADFIELD(fNam(1:16),readBinaryPrec,'RS',1,
91 O aim_surftemp,
92 I 1,myThid)
93
94 C o Soil moisture ( convert to 20cm bucket fraction )
95 WRITE(fNam,'(A,A,A)' ) 'smoist.',mnthNam(mnthIndex),'.cs.bin'
96 CALL MDSREADFIELD(fNam(1:17),readBinaryPrec,'RS',1,
97 O aim_soilMoisture,
98 I 1,myThid)
99
100 ENDIF
101
102 FirstCall = .FALSE.
103 _END_MASTER( myThid )
104
105 C Stop anyone leaving until all data is read
106 CALL BAR2(myThid)
107
108 #endif /* ALLOW_AIM */
109
110 RETURN
111 END

  ViewVC Help
Powered by ViewVC 1.1.22