1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getforcing.F,v 1.10 2004/03/03 13:48:19 edhill Exp $ |
2 |
|
3 |
#include "EXF_OPTIONS.h" |
4 |
|
5 |
CBOI |
6 |
C |
7 |
C !TITLE: EXTERNAL FORCING |
8 |
C !AUTHORS: mitgcm developers ( support@mitgcm.org ) |
9 |
C !AFFILIATION: Massachussetts Institute of Technology |
10 |
C !DATE: |
11 |
C !INTRODUCTION: External forcing package |
12 |
c \bv |
13 |
c * The external forcing package, in conjunction with the |
14 |
c calendar package, enables the handling of realistic forcing |
15 |
c fields of differing temporal forcing patterns. |
16 |
c * It comprises climatological restoring and relaxation |
17 |
c * Bulk formulae are implemented to convert atmospheric fields |
18 |
c to surface fluxes. |
19 |
c |
20 |
C !CALLING SEQUENCE: |
21 |
c ... |
22 |
c exf_getforcing |
23 |
c | |
24 |
c |-- exf_getclim (get climatological fields used e.g. for relax.) |
25 |
c | |
26 |
c |-- exf_getffields <- this one does almost everything |
27 |
c | | 1. reads in fields, either flux or atmos. state, |
28 |
c | | depending on CPP options |
29 |
c | | 2. If forcing and control is flux, we're already done here |
30 |
c | | 3. If forcing is atmos. state, then |
31 |
c | | (a) if control is atmos. state, then the control variable |
32 |
c | | anomalies are read here |
33 |
c | | * ctrl_getatemp |
34 |
c | | * ctrl_getaqh |
35 |
c | | * ctrl_getuwind |
36 |
c | | * ctrl_getvwind |
37 |
c | | 4. flux fields are interpolated on current time |
38 |
c | | (b) next the flux fields are computed via bulk formulae |
39 |
c | | |
40 |
c | |-- exf_obcs |
41 |
c | If open boundaries are prescribed externally, |
42 |
c | OB values for current time step are read here |
43 |
c | 1. for each boundary (north, south, west, east) |
44 |
c | sliced fields are read for T,S,U,V |
45 |
c | 2. if OB's are part of control vector, |
46 |
c | control variable anomalies are added to OB values |
47 |
c | * ctrl_getobcsn |
48 |
c | * ctrl_getobcss |
49 |
c | * ctrl_getobcsw |
50 |
c | * ctrl_getobcse |
51 |
c | |
52 |
c |-- exf_bulkformulae |
53 |
c | If ALLOW_BULKFORMULAE, compute fluxes via bulkformulae |
54 |
c | |
55 |
c |-- exf_getsurfacefluxes |
56 |
c | If forcing and control is flux, then the |
57 |
c | control vector anomalies are read here |
58 |
c | * ctrl_getheatflux |
59 |
c | * ctrl_getsaltflux |
60 |
c | * ctrl_getzonstress |
61 |
c | * call ctrl_getmerstress |
62 |
c | |
63 |
c |-- exf_mapfields |
64 |
c | Forcing fields from exf package are mapped onto |
65 |
c | mitgcm forcing arrays. |
66 |
c | Mapping enables a runtime rescaling of fields |
67 |
c |
68 |
c \ev |
69 |
CEOI |
70 |
|
71 |
CBOP |
72 |
C !ROUTINE: exf_getforcing |
73 |
C !INTERFACE: |
74 |
subroutine exf_getforcing( mytime, myiter, mythid ) |
75 |
|
76 |
C !DESCRIPTION: \bv |
77 |
c *================================================================= |
78 |
c | SUBROUTINE exf_getforcing |
79 |
c *================================================================= |
80 |
c o Get the forcing fields for the current time step. The switches |
81 |
c for the inclusion of the individual forcing components have to |
82 |
c be set in EXF_OPTIONS.h (or ECCO_CPPOPTIONS.h). |
83 |
c A note on surface fluxes: |
84 |
c The MITgcmUV's vertical coordinate z is positive upward. |
85 |
c This implies that a positive flux is out of the ocean |
86 |
c model. However, the wind stress forcing is not treated |
87 |
c this way. A positive zonal wind stress accelerates the |
88 |
c model ocean towards the east. |
89 |
c started: eckert@mit.edu, heimbach@mit.edu, ralf@ocean.mit.edu |
90 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
91 |
c *================================================================= |
92 |
c | SUBROUTINE exf_getforcing |
93 |
c *================================================================= |
94 |
C \ev |
95 |
|
96 |
C !USES: |
97 |
implicit none |
98 |
|
99 |
#include "EEPARAMS.h" |
100 |
#include "SIZE.h" |
101 |
#include "PARAMS.h" |
102 |
#include "GRID.h" |
103 |
|
104 |
#include "exf_param.h" |
105 |
#include "exf_fields.h" |
106 |
#include "exf_constants.h" |
107 |
|
108 |
c == global variables == |
109 |
|
110 |
C !INPUT/OUTPUT PARAMETERS: |
111 |
c == routine arguments == |
112 |
integer mythid |
113 |
integer myiter |
114 |
_RL mytime |
115 |
|
116 |
C !LOCAL VARIABLES: |
117 |
c == local variables == |
118 |
|
119 |
integer bi,bj |
120 |
integer i,j,k |
121 |
|
122 |
c == end of interface == |
123 |
CEOP |
124 |
|
125 |
c Get values of climatological fields. |
126 |
call exf_getclim( mytime, myiter, mythid ) |
127 |
|
128 |
c Get the surface forcing fields. |
129 |
call exf_getffields( mytime, myiter, mythid ) |
130 |
|
131 |
if ( debugLevel .GE. debLevB ) then |
132 |
#ifdef ALLOW_DEBUG |
133 |
call debug_call( 'exf_check_range', myThid ) |
134 |
#endif |
135 |
call exf_check_range( mytime, myiter, mythid ) |
136 |
endif |
137 |
|
138 |
c Compute bulk formulae |
139 |
#ifdef ALLOW_BULKFORMULAE |
140 |
call exf_bulkformulae( mytime, myiter, mythid ) |
141 |
#endif |
142 |
|
143 |
c Apply runoff, masks and exchanges |
144 |
do bj = mybylo(mythid),mybyhi(mythid) |
145 |
do bi = mybxlo(mythid),mybxhi(mythid) |
146 |
k = 1 |
147 |
do j = 1,sny |
148 |
do i = 1,snx |
149 |
#ifdef ALLOW_RUNOFF |
150 |
sflux(i,j,bi,bj) = sflux(i,j,bi,bj) - runoff(i,j,bi,bj) |
151 |
#endif |
152 |
|
153 |
hflux(i,j,bi,bj) = hflux(i,j,bi,bj)*maskc(i,j,1,bi,bj) |
154 |
sflux(i,j,bi,bj) = sflux(i,j,bi,bj)*maskc(i,j,1,bi,bj) |
155 |
enddo |
156 |
enddo |
157 |
enddo |
158 |
enddo |
159 |
|
160 |
c Update the tile edges. |
161 |
_EXCH_XY_R8(hflux, mythid) |
162 |
_EXCH_XY_R8(sflux, mythid) |
163 |
CALL EXCH_UV_XY_RL(ustress, vstress, .TRUE., myThid) |
164 |
#ifdef SHORTWAVE_HEATING |
165 |
_EXCH_XY_R8(swflux, mythid) |
166 |
#endif |
167 |
#ifdef ATMOSPHERIC_LOADING |
168 |
_EXCH_XY_R8(apressure, mythid) |
169 |
#endif |
170 |
|
171 |
c Get values of the surface flux anomalies. |
172 |
call exf_getsurfacefluxes( mytime, myiter, mythid ) |
173 |
|
174 |
c Map the forcing fields onto the corresponding model fields. |
175 |
call exf_mapfields( mythid ) |
176 |
|
177 |
end |
178 |
|