/[MITgcm]/MITgcm/pkg/exf/exf_readparms.F
ViewVC logotype

Diff of /MITgcm/pkg/exf/exf_readparms.F

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

revision 1.30 by heimbach, Thu May 25 18:32:56 2006 UTC revision 1.87 by gforget, Wed Jan 11 03:45:34 2017 UTC
# Line 2  C $Header$ Line 2  C $Header$
2  C $Name$  C $Name$
3    
4  #include "EXF_OPTIONS.h"  #include "EXF_OPTIONS.h"
5  #ifdef ALLOW_OBCS  #ifdef ALLOW_EXCH2
6  # include "OBCS_OPTIONS.h"  # include "W2_OPTIONS.h"
7  #endif  #endif /* ALLOW_EXCH2 */
8    
9        subroutine exf_readparms( mythid )        SUBROUTINE EXF_READPARMS( myThid )
10    
11  c     ==================================================================  C     ==================================================================
12  c     SUBROUTINE exf_readparms  C     SUBROUTINE exf_readparms
13  c     ==================================================================  C     ==================================================================
14  c  C
15  c     o This routine initialises the package that calculates external  C     o This routine initialises the package that calculates external
16  c       forcing fields for a given timestep of the MITgcmUV. Parameters  C       forcing fields for a given timestep of the MITgcmUV. Parameters
17  c       for this package are set in "data.externalforcing". Some additional  C       for this package are set in "data.externalforcing". Some additional
18  c       precompiler switches have to be specified in "EXF_OPTIONS.h".  C       precompiler switches have to be specified in "EXF_OPTIONS.h".
19  c  C
20  c     started: Christian Eckert eckert@mit.edu  30-Jun-1999  C     started: Christian Eckert eckert@mit.edu  30-Jun-1999
21  c  C
22  c     changed: Christian Eckert eckert@mit.edu  11-Jan-2000  C     changed: Christian Eckert eckert@mit.edu  11-Jan-2000
23  c              - Restructured the code in order to create a package  C              - Restructured the code in order to create a package
24  c                for the MITgcmUV.  C                for the MITgcmUV.
25  c              Christian Eckert eckert@mit.edu  12-Feb-2000  C              Christian Eckert eckert@mit.edu  12-Feb-2000
26  c              - Changed Routine names (package prefix: exf_)  C              - Changed Routine names (package prefix: exf_)
27  c     changed: Patrick Heimbach, heimbach@mit.edu  04-May-2000  C     changed: Patrick Heimbach, heimbach@mit.edu  04-May-2000
28  c              - changed the handling of precip and sflux with respect  C              - changed the handling of precip and sflux with respect
29  c                to CPP options ALLOW_BULKFORMULAE and ALLOW_ATM_TEMP  C                to CPP options ALLOW_BULKFORMULAE and ALLOW_ATM_TEMP
30  c     changed: Ralf.Giering@FastOpt.de 25-Mai-20000  C     changed: Ralf.Giering@FastOpt.de 25-Mai-20000
31  c              - moved relaxation and climatology to extra routines  C              - moved relaxation and climatology to extra routines
32  c              Patrick Heimbach, heimbach@mit.edu  04-May-2000  C              Patrick Heimbach, heimbach@mit.edu  04-May-2000
33  c              - added obcs parameters  C              - added obcs parameters
34  c     changed: Virginie Thierry, vthierry@ucsd.edu 04-June-2001  C     changed: Virginie Thierry, vthierry@ucsd.edu 04-June-2001
35  c              - added new obcs parameters (for each boundaries)  C              - added new obcs parameters (for each boundaries)
36  c     included runoff D. Stammer, Nov. 25, 2001  C     included runoff D. Stammer, Nov. 25, 2001
37  c     included pressure forcing. heimbach@mit.edu 05-Nov-2002  C     included pressure forcing. heimbach@mit.edu 05-Nov-2002
38  c     added "repeatPeriod" for cycling of forcing datasets 19-Dec-2002  C     added "repeatPeriod" for cycling of forcing datasets 19-Dec-2002
39  c     mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002  C     mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002
40  c  C
41  c     ==================================================================  C     ==================================================================
42  c     SUBROUTINE exf_readparms  C     SUBROUTINE exf_readparms
43  c     ==================================================================  C     ==================================================================
44    
45        implicit none        implicit none
46    
47  c     == global variables ==  C     == global variables ==
48    
49  #include "EEPARAMS.h"  #include "EEPARAMS.h"
50  #include "SIZE.h"  #include "SIZE.h"
51  #include "PARAMS.h"  #include "PARAMS.h"
52  #include "cal.h"  #ifdef USE_EXF_INTERPOLATION
53  #include "exf.h"  # ifdef ALLOW_EXCH2
54  #include "exf_param.h"  # include "W2_EXCH2_SIZE.h"
55  #include "exf_constants.h"  # include "W2_EXCH2_TOPOLOGY.h"
56    # endif /* ALLOW_EXCH2 */
57  c     == routine arguments ==  # include "SET_GRID.h"
58    #endif /* USE_EXF_INTERPOLATION */
59        integer mythid  c#include "cal.h"
60    #include "EXF_PARAM.h"
61  c     == local variables ==  #include "EXF_CONSTANTS.h"
   
       integer i  
       integer date_array(4), difftime(4)  
       integer iUnit  
62    
63        character*(max_len_mbuf) msgbuf  C     == routine arguments ==
64          INTEGER myThid
65    
66  c     == end of interface ==  C     == local variables ==
67    #ifdef USE_EXF_INTERPOLATION
68          INTEGER gridNx, gridNy
69          INTEGER j
70          _RL inp_lon0, inp_lat0, inp_dLon, inp_dLat
71    #endif /* USE_EXF_INTERPOLATION */
72          INTEGER iUnit
73          LOGICAL exf_verbose
74          CHARACTER*(2) exf_yftype
75          CHARACTER*(MAX_LEN_MBUF) msgBuf
76    C     == end of interface ==
77    
78    C     Surface flux data.
79          NAMELIST /EXF_NML_01/
80         &      windstressmax,       repeatPeriod,    exf_albedo,
81         &   ocean_emissivity,     ice_emissivity, snow_emissivity,
82         &          exf_iceCd,          exf_iceCe,     exf_iceCh,
83         &   exf_scal_BulkCdn,     climtempfreeze, useExfCheckRange,
84         &      exf_iprec    ,   exf_iprec_obcs  , exf_yftype,
85         &      exf_verbose  ,   exf_debugLev    , exf_monFreq,
86         & useExfYearlyFields,  twoDigitYear,
87         & useStabilityFct_overIce, readStressOnAgrid, readStressOnCgrid,
88         & rotateStressOnAgrid, useAtmWind, useRelativeWind, noNegativeEvap,
89         & select_ZenAlbedo, useExfZenIncoming,
90         & hu, ht, umin, atmrho, atmcp, cen2kel, gravity_mks,
91         & cdrag_1, cdrag_2, cdrag_3, cstanton_1, cstanton_2, cdalton,
92         & flamb, flami, zolmin, zref,
93         & cvapor_fac, cvapor_exp, cvapor_fac_ice, cvapor_exp_ice,
94         & humid_fac, gamma_blk, saltsat, sstExtrapol, psim_fac
95    
96  c     Surface flux data.        NAMELIST /EXF_NML_02/
97        namelist /exf_nml/       &          hfluxfile,          atempfile,       aqhfile,
98       &      windstressmax,       repeatPeriod,       &          sfluxfile,         precipfile,    runofffile,
99       &         exf_albedo,      surfEmittance,       &                          runoftempfile,   saltflxfile,
100         &        ustressfile,        vstressfile,      evapfile,
101         &     snowprecipfile,          uwindfile,     vwindfile,
102         &         wspeedfile,         swfluxfile,    lwfluxfile,
103         &      apressurefile,         swdownfile,    lwdownfile,
104         &       areamaskfile,        climsstfile,   climsssfile,
105         &                           climustrfile,  climvstrfile,
106       &    hfluxstartdate1,    hfluxstartdate2,   hfluxperiod,       &    hfluxstartdate1,    hfluxstartdate2,   hfluxperiod,
107       &    atempstartdate1,    atempstartdate2,   atempperiod,       &    atempstartdate1,    atempstartdate2,   atempperiod,
108       &      aqhstartdate1,      aqhstartdate2,     aqhperiod,       &      aqhstartdate1,      aqhstartdate2,     aqhperiod,
# Line 80  c     Surface flux data. Line 111  c     Surface flux data.
111       &   precipstartdate1,   precipstartdate2,  precipperiod,       &   precipstartdate1,   precipstartdate2,  precipperiod,
112       & snowprecipstartdate1, snowprecipstartdate2, snowprecipperiod,       & snowprecipstartdate1, snowprecipstartdate2, snowprecipperiod,
113       &   runoffstartdate1,   runoffstartdate2,  runoffperiod,       &   runoffstartdate1,   runoffstartdate2,  runoffperiod,
114         &   saltflxstartdate1, saltflxstartdate2, saltflxperiod,
115       &  ustressstartdate1,  ustressstartdate2, ustressperiod,       &  ustressstartdate1,  ustressstartdate2, ustressperiod,
116       &  vstressstartdate1,  vstressstartdate2, vstressperiod,       &  vstressstartdate1,  vstressstartdate2, vstressperiod,
117       &    uwindstartdate1,    uwindstartdate2,   uwindperiod,       &    uwindstartdate1,    uwindstartdate2,   uwindperiod,
# Line 89  c     Surface flux data. Line 121  c     Surface flux data.
121       &   lwfluxstartdate1,   lwfluxstartdate2,  lwfluxperiod,       &   lwfluxstartdate1,   lwfluxstartdate2,  lwfluxperiod,
122       &   swdownstartdate1,   swdownstartdate2,  swdownperiod,       &   swdownstartdate1,   swdownstartdate2,  swdownperiod,
123       &   lwdownstartdate1,   lwdownstartdate2,  lwdownperiod,       &   lwdownstartdate1,   lwdownstartdate2,  lwdownperiod,
      &    obcsNstartdate1,    obcsNstartdate2,   obcsNperiod,  
      &    obcsSstartdate1,    obcsSstartdate2,   obcsSperiod,  
      &    obcsEstartdate1,    obcsEstartdate2,   obcsEperiod,  
      &    obcsWstartdate1,    obcsWstartdate2,   obcsWperiod,  
124       &apressurestartdate1,apressurestartdate2,apressureperiod,       &apressurestartdate1,apressurestartdate2,apressureperiod,
125       &          hfluxfile,          atempfile,       aqhfile,       &  areamaskstartdate1,areamaskstartdate2,areamaskperiod,
126       &          sfluxfile,         precipfile,    runofffile,       &  climsststartdate1,  climsststartdate2, climsstperiod,
127       &        ustressfile,        vstressfile,      evapfile,       &  climsssstartdate1,  climsssstartdate2, climsssperiod,
128       &     snowprecipfile,       & climustrstartdate1, climustrstartdate2,climustrperiod,
129       &          uwindfile,          vwindfile,    wspeedfile,       & climvstrstartdate1, climvstrstartdate2,climvstrperiod,
130       &         swfluxfile,         lwfluxfile, apressurefile,       &   areamaskTauRelax,    climsstTauRelax, climsssTauRelax,
131       &         swdownfile,         lwdownfile,       &   climustrTauRelax,climvstrTauRelax
132       &          exf_iprec,  exf_yftype,  
133       & useExfYearlyFields,  twoDigitYear,         useExfCheckRange,        NAMELIST /EXF_NML_03/
134       &   exf_inscal_hflux,  exf_inscal_sflux,      exf_inscal_evap,       &   exf_inscal_hflux,  exf_inscal_sflux,      exf_inscal_evap,
135       & exf_inscal_ustress,  exf_inscal_vstress,       & exf_inscal_ustress,  exf_inscal_vstress,
136       &   exf_inscal_uwind,  exf_inscal_vwind,    exf_inscal_wspeed,       &   exf_inscal_uwind,  exf_inscal_vwind,    exf_inscal_wspeed,
# Line 110  c     Surface flux data. Line 138  c     Surface flux data.
138       &     exf_inscal_sst,  exf_inscal_sss,       &     exf_inscal_sst,  exf_inscal_sss,
139       &  exf_inscal_swflux,  exf_inscal_lwflux,   exf_inscal_precip,       &  exf_inscal_swflux,  exf_inscal_lwflux,   exf_inscal_precip,
140       &  exf_inscal_runoff,  exf_inscal_apressure, exf_inscal_snowprecip,       &  exf_inscal_runoff,  exf_inscal_apressure, exf_inscal_snowprecip,
141         &  exf_inscal_runoftemp, exf_inscal_saltflx,
142       &  exf_inscal_swdown,  exf_inscal_lwdown,       &  exf_inscal_swdown,  exf_inscal_lwdown,
143         & exf_inscal_climsst, exf_inscal_climsss,
144         & exf_inscal_climustr, exf_inscal_climvstr,
145       &  exf_outscal_hflux,  exf_outscal_ustress, exf_outscal_vstress,       &  exf_outscal_hflux,  exf_outscal_ustress, exf_outscal_vstress,
146       & exf_outscal_swflux,  exf_outscal_sst,     exf_outscal_sss,       & exf_outscal_swflux,  exf_outscal_sst,     exf_outscal_sss,
147       &  exf_outscal_sflux,  exf_outscal_apressure,       &  exf_outscal_sflux,  exf_outscal_apressure,
148       &         hfluxconst,   atempconst,            aqhconst,       & exf_inscal_areamask, exf_outscal_areamask,
149       &         sfluxconst,    evapconst,       &  hfluxconst, atempconst, aqhconst, sfluxconst, evapconst,
150       &        precipconst,   snowprecipconst,       &  precipconst, snowprecipconst, runoffconst, ustressconst,
151       &        runoffconst, ustressconst,        vstressconst,       &  runoftempconst, saltflxconst,
152       &         uwindconst,   vwindconst,         wspeedconst,       &  vstressconst, uwindconst, vwindconst, wspeedconst, swfluxconst,
153       &        swfluxconst,  lwfluxconst,       &  lwfluxconst, swdownconst, lwdownconst, apressureconst,
154       &        swdownconst,  lwdownconst,       &  areamaskconst, climsstconst,   climsssconst,
155       &         apressureconst,       &  climustrconst, climvstrconst,
156       &     hflux_exfremo_intercept, hflux_exfremo_slope,       &     hflux_exfremo_intercept, hflux_exfremo_slope,
157       &     atemp_exfremo_intercept, atemp_exfremo_slope,       &     atemp_exfremo_intercept, atemp_exfremo_slope,
158       &     aqh_exfremo_intercept, aqh_exfremo_slope,       &     aqh_exfremo_intercept, aqh_exfremo_slope,
# Line 130  c     Surface flux data. Line 161  c     Surface flux data.
161       &     precip_exfremo_intercept, precip_exfremo_slope,       &     precip_exfremo_intercept, precip_exfremo_slope,
162       &     snowprecip_exfremo_intercept, snowprecip_exfremo_slope,       &     snowprecip_exfremo_intercept, snowprecip_exfremo_slope,
163       &     runoff_exfremo_intercept, runoff_exfremo_slope,       &     runoff_exfremo_intercept, runoff_exfremo_slope,
164         &     runoftemp_exfremo_intercept, runoftemp_exfremo_slope,
165         &     saltflx_exfremo_intercept, saltflx_exfremo_slope,
166       &     ustress_exfremo_intercept, ustress_exfremo_slope,       &     ustress_exfremo_intercept, ustress_exfremo_slope,
167       &     vstress_exfremo_intercept, vstress_exfremo_slope,       &     vstress_exfremo_intercept, vstress_exfremo_slope,
168       &     uwind_exfremo_intercept, uwind_exfremo_slope,       &     uwind_exfremo_intercept, uwind_exfremo_slope,
# Line 139  c     Surface flux data. Line 172  c     Surface flux data.
172       &     lwflux_exfremo_intercept, lwflux_exfremo_slope,       &     lwflux_exfremo_intercept, lwflux_exfremo_slope,
173       &     swdown_exfremo_intercept, swdown_exfremo_slope,       &     swdown_exfremo_intercept, swdown_exfremo_slope,
174       &     lwdown_exfremo_intercept, lwdown_exfremo_slope,       &     lwdown_exfremo_intercept, lwdown_exfremo_slope,
175       &     apressure_exfremo_intercept, apressure_exfremo_slope       &     apressure_exfremo_intercept, apressure_exfremo_slope,
176         &     areamask_exfremo_intercept, areamask_exfremo_slope,
177         &     climsst_exfremo_intercept, climsst_exfremo_slope,
178         &     climsss_exfremo_intercept, climsss_exfremo_slope,
179         &     climustr_exfremo_intercept, climustr_exfremo_slope,
180         &     climvstr_exfremo_intercept, climvstr_exfremo_slope
181    
182  #ifdef USE_EXF_INTERPOLATION  #ifdef USE_EXF_INTERPOLATION
183       & ,ustress_lon0, ustress_lon_inc, ustress_lat0, ustress_lat_inc,        NAMELIST /EXF_NML_04/
184       & ustress_nlon, ustress_nlat,       & ustress_lon0, ustress_lon_inc, ustress_lat0, ustress_lat_inc,
185         & ustress_nlon, ustress_nlat, ustress_interpMethod,
186       & vstress_lon0, vstress_lon_inc, vstress_lat0, vstress_lat_inc,       & vstress_lon0, vstress_lon_inc, vstress_lat0, vstress_lat_inc,
187       & vstress_nlon, vstress_nlat,       & vstress_nlon, vstress_nlat, vstress_interpMethod,
188       & hflux_lon0, hflux_lon_inc, hflux_lat0, hflux_lat_inc,       & hflux_lon0, hflux_lon_inc, hflux_lat0, hflux_lat_inc,
189       & hflux_nlon, hflux_nlat,       & hflux_nlon, hflux_nlat, hflux_interpMethod,
190       & sflux_lon0, sflux_lon_inc, sflux_lat0, sflux_lat_inc,       & sflux_lon0, sflux_lon_inc, sflux_lat0, sflux_lat_inc,
191       & sflux_nlon, sflux_nlat,       & sflux_nlon, sflux_nlat, sflux_interpMethod,
192       & swflux_lon0, swflux_lon_inc, swflux_lat0, swflux_lat_inc,       & swflux_lon0, swflux_lon_inc, swflux_lat0, swflux_lat_inc,
193       & swflux_nlon, swflux_nlat,       & swflux_nlon, swflux_nlat, swflux_interpMethod,
194       & runoff_lon0, runoff_lon_inc, runoff_lat0, runoff_lat_inc,       & lwflux_lon0, lwflux_lon_inc, lwflux_lat0, lwflux_lat_inc,
195       & runoff_nlon, runoff_nlat,       & lwflux_nlon, lwflux_nlat, lwflux_interpMethod,
196       & atemp_lon0, atemp_lon_inc, atemp_lat0, atemp_lat_inc,       & atemp_lon0, atemp_lon_inc, atemp_lat0, atemp_lat_inc,
197       & atemp_nlon, atemp_nlat,       & atemp_nlon, atemp_nlat, atemp_interpMethod,
198       & aqh_lon0, aqh_lon_inc, aqh_lat0, aqh_lat_inc,       & aqh_lon0, aqh_lon_inc, aqh_lat0,aqh_lat_inc,
199       & aqh_nlon, aqh_nlat,       & aqh_nlon, aqh_nlat, aqh_interpMethod,
200       & evap_lon0, evap_lon_inc, evap_lat0, evap_lat_inc,       & evap_lon0, evap_lon_inc, evap_lat0, evap_lat_inc,
201       & evap_nlon, evap_nlat,       & evap_nlon, evap_nlat, evap_interpMethod,
202       & precip_lon0, precip_lon_inc,       & precip_lon0, precip_lon_inc, precip_lat0, precip_lat_inc,
203       & precip_lat0, precip_lat_inc,       & precip_nlon, precip_nlat, precip_interpMethod,
204       & precip_nlon, precip_nlat,       & runoff_lon0, runoff_lon_inc, runoff_lat0, runoff_lat_inc,
205       & snowprecip_lon0, snowprecip_lon_inc,       & runoff_nlon, runoff_nlat, runoff_interpMethod,
206         & saltflx_lon0, saltflx_lon_inc,
207         & saltflx_lat0, saltflx_lat_inc,
208         & saltflx_nlon, saltflx_nlat, saltflx_interpMethod,
209         & snowprecip_lon0, snowprecip_lon_inc,
210       & snowprecip_lat0, snowprecip_lat_inc,       & snowprecip_lat0, snowprecip_lat_inc,
211       & snowprecip_nlon, snowprecip_nlat,       & snowprecip_nlon, snowprecip_nlat, snowprecip_interpMethod,
212       & uwind_lon0, uwind_lon_inc, uwind_lat0, uwind_lat_inc,       & uwind_lon0, uwind_lon_inc, uwind_lat0, uwind_lat_inc,
213       & uwind_nlon, uwind_nlat,       & uwind_nlon, uwind_nlat, uwind_interpMethod,
214       & vwind_lon0, vwind_lon_inc, vwind_lat0, vwind_lat_inc,       & vwind_lon0, vwind_lon_inc, vwind_lat0, vwind_lat_inc,
215       & vwind_nlon, vwind_nlat,       & vwind_nlon, vwind_nlat, vwind_interpMethod,
216       & wspeed_lon0, wspeed_lon_inc, wspeed_lat0, wspeed_lat_inc,       & wspeed_lon0, wspeed_lon_inc, wspeed_lat0, wspeed_lat_inc,
217       & wspeed_nlon, wspeed_nlat,       & wspeed_nlon, wspeed_nlat, wspeed_interpMethod,
      & lwflux_lon0, lwflux_lon_inc, lwflux_lat0, lwflux_lat_inc,  
      & lwflux_nlon, lwflux_nlat,  
218       & swdown_lon0, swdown_lon_inc, swdown_lat0, swdown_lat_inc,       & swdown_lon0, swdown_lon_inc, swdown_lat0, swdown_lat_inc,
219       & swdown_nlon, swdown_nlat,       & swdown_nlon, swdown_nlat, swdown_interpMethod,
220       & lwdown_lon0, lwdown_lon_inc, lwdown_lat0, lwdown_lat_inc,       & lwdown_lon0, lwdown_lon_inc, lwdown_lat0, lwdown_lat_inc,
221       & lwdown_nlon, lwdown_nlat,       & lwdown_nlon, lwdown_nlat, lwdown_interpMethod,
222       & apressure_lon0,apressure_lon_inc,apressure_nlon,       & apressure_lon0,apressure_lon_inc,apressure_lat0,apressure_lat_inc
223       & apressure_lat0,apressure_lat_inc,apressure_nlat       & , apressure_nlon, apressure_nlat, apressure_interpMethod,
224  #endif       & areamask_lon0, areamask_lon_inc, areamask_lat0, areamask_lat_inc,
225         & areamask_nlon, areamask_nlat, areamask_interpMethod,
226         & climsst_lon0, climsst_lon_inc, climsst_lat0, climsst_lat_inc,
227         & climsst_nlon, climsst_nlat, climsst_interpMethod,
228         & climsss_lon0, climsss_lon_inc,climsss_lat0, climsss_lat_inc,
229         & climsss_nlon, climsss_nlat, climsss_interpMethod,
230         & climustr_lon0, climustr_lon_inc, climustr_lat0, climustr_lat_inc,
231         & climustr_nlon, climustr_nlat, climustr_interpMethod,
232         & climvstr_lon0, climvstr_lon_inc, climvstr_lat0, climvstr_lat_inc,
233         & climvstr_nlon, climvstr_nlat, climvstr_interpMethod,
234         & exf_output_interp
235    #endif /* USE_EXF_INTERPOLATION */
236    
237        _BEGIN_MASTER(mythid)  #ifdef ALLOW_OBCS
238          NAMELIST /EXF_NML_OBCS/
239         &    useOBCSYearlyFields,
240         &    obcsNstartdate1,    obcsNstartdate2,   obcsNperiod,
241         &    obcsSstartdate1,    obcsSstartdate2,   obcsSperiod,
242         &    obcsEstartdate1,    obcsEstartdate2,   obcsEperiod,
243         &    obcsWstartdate1,    obcsWstartdate2,   obcsWperiod,
244         &    siobNstartdate1,    siobNstartdate2,   siobNperiod,
245         &    siobSstartdate1,    siobSstartdate2,   siobSperiod,
246         &    siobEstartdate1,    siobEstartdate2,   siobEperiod,
247         &    siobWstartdate1,    siobWstartdate2,   siobWperiod
248    #endif /* ALLOW_OBCS */
249    
250  c     Set default values.  #ifdef USE_EXF_INTERPOLATION
251    # ifdef ALLOW_EXCH2
252          gridNx = exch2_mydNx(1)
253          gridNy = exch2_mydNy(1)
254    # else /* ALLOW_EXCH2 */
255          gridNx = Nx
256          gridNy = Ny
257    # endif /* ALLOW_EXCH2 */
258    #endif /* USE_EXF_INTERPOLATION */
259    
260        year2sec           = 365.*86400.        IF ( .NOT.useEXF ) THEN
261    C-    pkg EXF is not used
262            _BEGIN_MASTER(myThid)
263    C-    Track pkg activation status:
264    C     print a (weak) warning if data.exf is found
265             CALL PACKAGES_UNUSED_MSG( 'useEXF', ' ', ' ' )
266            _END_MASTER(myThid)
267            RETURN
268          ENDIF
269    
270          _BEGIN_MASTER(myThid)
271    
272    C     Set default values.
273    
274    c     exf_verbose        = debugMode
275          exf_verbose        = .FALSE.
276          exf_debugLev       = debugLevel
277          exf_monFreq        = monitorFreq
278          useExfCheckRange   = .TRUE.
279          useExfZenAlbedo    = .FALSE.
280          select_ZenAlbedo   = 0
281          useExfZenIncoming  = .FALSE.
282          readStressOnAgrid  = .FALSE.
283          rotateStressOnAgrid = .FALSE.
284          readStressOnCgrid  = .FALSE.
285    #ifdef ALLOW_ATM_WIND
286          useAtmWind         = .TRUE.
287    #else
288          useAtmWind         = .FALSE.
289    #endif
290          useRelativeWind    = .FALSE.
291          noNegativeEvap     = .FALSE.
292    
293  c     Calendar data.  C-  default value should be set to main model parameter:
294    c     cen2kel     =  celsius2K
295    c     gravity_mks = gravity
296    c     atmcp       =  atm_Cp
297    c     humid_fac   =  atm_Rq     <- default is zero !!!
298    
299          cen2kel        =      273.150  _d 0
300          gravity_mks    =        9.81   _d 0
301          atmrho         =        1.200  _d 0
302          atmcp          =     1005.000  _d 0
303          flamb          =  2500000.000  _d 0
304          flami          =   334000.000  _d 0
305          cvapor_fac     =   640380.000  _d 0
306          cvapor_exp     =     5107.400  _d 0
307          cvapor_fac_ice = 11637800.000  _d 0
308          cvapor_exp_ice =     5897.800  _d 0
309          humid_fac      =        0.606  _d 0
310          gamma_blk      =        0.010  _d 0
311          saltsat        =        0.980  _d 0
312          sstExtrapol    =        0.0    _d 0
313          cdrag_1        =        0.0027000 _d 0
314          cdrag_2        =        0.0001420 _d 0
315          cdrag_3        =        0.0000764 _d 0
316          cstanton_1     =        0.0327 _d 0
317          cstanton_2     =        0.0180 _d 0
318          cdalton        =        0.0346 _d 0
319          zolmin         =     -100.000  _d 0
320          psim_fac       =        5.000  _d 0
321          zref           =       10.000  _d 0
322          hu             =       10.000  _d 0
323          ht             =        2.000  _d 0
324          umin           =        0.5    _d 0
325          useStabilityFct_overIce = .FALSE.
326          exf_iceCd        = 1.63 _d -3
327          exf_iceCe        = 1.63 _d -3
328          exf_iceCh        = 1.63 _d -3
329          exf_albedo       = 0.1 _d 0
330    C--   this default is chosen to be backward compatible with
331    C--   an earlier setting of 5.5 = ocean_emissivity*stefanBoltzmann
332          ocean_emissivity = 5.50 _d -8 / 5.670 _d -8
333          ice_emissivity   = 0.95 _d 0
334          snow_emissivity  = 0.95 _d 0
335    
336    C     Calendar data.
337        hfluxstartdate1    = 0        hfluxstartdate1    = 0
338        hfluxstartdate2    = 0        hfluxstartdate2    = 0
339        hfluxperiod        = 0.0 _d 0        hfluxperiod        = 0.0 _d 0
# Line 244  c     Calendar data. Line 390  c     Calendar data.
390        runoff_exfremo_intercept = 0.0 _d 0        runoff_exfremo_intercept = 0.0 _d 0
391        runoff_exfremo_slope = 0.0 _d 0        runoff_exfremo_slope = 0.0 _d 0
392    
393          runoftempconst              = 0.0 _d 0
394          runoftemp_exfremo_intercept = 0.0 _d 0
395          runoftemp_exfremo_slope     = 0.0 _d 0
396    
397          saltflxstartdate1  = 0
398          saltflxstartdate2  = 0
399          saltflxperiod      = 0.0 _d 0
400          saltflxconst       = 0.0 _d 0
401          saltflx_exfremo_intercept = 0.0 _d 0
402          saltflx_exfremo_slope = 0.0 _d 0
403    
404        ustressstartdate1  = 0        ustressstartdate1  = 0
405        ustressstartdate2  = 0        ustressstartdate2  = 0
406        ustressperiod      = 0.0 _d 0        ustressperiod      = 0.0 _d 0
# Line 314  c     Calendar data. Line 471  c     Calendar data.
471        apressure_exfremo_intercept = 0.0 _d 0        apressure_exfremo_intercept = 0.0 _d 0
472        apressure_exfremo_slope = 0.0 _d 0        apressure_exfremo_slope = 0.0 _d 0
473    
474          areamaskstartdate1    = 0
475          areamaskstartdate2    = 0
476          areamaskperiod        = 0.0 _d 0
477          areamaskTauRelax      = 0.0 _d 0
478          areamaskconst         = 0.0 _d 0
479          areamask_exfremo_intercept = 0. _d 0
480          areamask_exfremo_slope = 0. _d 0
481    
482          climsststartdate1  = 0
483          climsststartdate2  = 0
484          climsstperiod      = 0
485          climsstTauRelax    = 0.0 _d 0
486          climsstconst         = 0.0 _d 0
487          climsst_exfremo_intercept = 0.0 _d 0
488          climsst_exfremo_slope = 0.0 _d 0
489    
490          climsssstartdate1  = 0
491          climsssstartdate2  = 0
492          climsssperiod      = 0
493          climsssTauRelax    = 0.0 _d 0
494          climsssconst         = 0.0 _d 0
495          climsss_exfremo_intercept = 0.0 _d 0
496          climsss_exfremo_slope = 0.0 _d 0
497    
498          climustrstartdate1  = 0
499          climustrstartdate2  = 0
500          climustrperiod      = 0
501          climustrTauRelax    = 0.0 _d 0
502          climustrconst         = 0.0 _d 0
503          climustr_exfremo_intercept = 0.0 _d 0
504          climustr_exfremo_slope = 0.0 _d 0
505    
506          climvstrstartdate1  = 0
507          climvstrstartdate2  = 0
508          climvstrperiod      = 0
509          climvstrTauRelax    = 0.0 _d 0
510          climvstrconst         = 0.0 _d 0
511          climvstr_exfremo_intercept = 0.0 _d 0
512          climvstr_exfremo_slope = 0.0 _d 0
513    
514          useOBCSYearlyFields = .FALSE.
515        obcsNstartdate1    = 0        obcsNstartdate1    = 0
516        obcsNstartdate2    = 0        obcsNstartdate2    = 0
517        obcsNperiod        = 0.0 _d 0        obcsNperiod        = 0.0 _d 0
   
518        obcsSstartdate1    = 0        obcsSstartdate1    = 0
519        obcsSstartdate2    = 0        obcsSstartdate2    = 0
520        obcsSperiod        = 0.0 _d 0        obcsSperiod        = 0.0 _d 0
   
521        obcsEstartdate1    = 0        obcsEstartdate1    = 0
522        obcsEstartdate2    = 0        obcsEstartdate2    = 0
523        obcsEperiod        = 0.0 _d 0        obcsEperiod        = 0.0 _d 0
   
524        obcsWstartdate1    = 0        obcsWstartdate1    = 0
525        obcsWstartdate2    = 0        obcsWstartdate2    = 0
526        obcsWperiod        = 0.0 _d 0        obcsWperiod        = 0.0 _d 0
527    
528          siobNstartdate1    = UNSET_I
529          siobNstartdate2    = UNSET_I
530          siobNperiod        = UNSET_RL
531          siobSstartdate1    = UNSET_I
532          siobSstartdate2    = UNSET_I
533          siobSperiod        = UNSET_RL
534          siobEstartdate1    = UNSET_I
535          siobEstartdate2    = UNSET_I
536          siobEperiod        = UNSET_RL
537          siobWstartdate1    = UNSET_I
538          siobWstartdate2    = UNSET_I
539          siobWperiod        = UNSET_RL
540    
541        repeatPeriod       = 0.0 _d 0        repeatPeriod       = 0.0 _d 0
       exf_albedo         = 0.1 _d 0  
542        windstressmax      = 2.0 _d 0        windstressmax      = 2.0 _d 0
 c--   this default is chosen to be backward compatible with  
 c--   an earlier setting of 5.5 = surfEmittance*stefanBoltzmann  
       surfEmittance       = 5.50D-8/5.670D-8  
543    
544  c     Data files.        exf_scal_BulkCdn   = 1.0  _d 0
545    
546    C     Initialise freezing temperature of sea water
547          climtempfreeze     = -1.9 _d 0
548    
549    C     Data files.
550        hfluxfile          = ' '        hfluxfile          = ' '
551        atempfile          = ' '        atempfile          = ' '
552        aqhfile            = ' '        aqhfile            = ' '
# Line 346  c     Data files. Line 555  c     Data files.
555        snowprecipfile     = ' '        snowprecipfile     = ' '
556        sfluxfile          = ' '        sfluxfile          = ' '
557        runofffile         = ' '        runofffile         = ' '
558          runoftempfile      = ' '
559          saltflxfile        = ' '
560        ustressfile        = ' '        ustressfile        = ' '
561        vstressfile        = ' '        vstressfile        = ' '
562        uwindfile          = ' '        uwindfile          = ' '
# Line 356  c     Data files. Line 567  c     Data files.
567        swdownfile         = ' '        swdownfile         = ' '
568        lwdownfile         = ' '        lwdownfile         = ' '
569        apressurefile      = ' '        apressurefile      = ' '
570          areamaskfile       = ' '
571          climsstfile        = ' '
572          climsssfile        = ' '
573          climustrfile       = ' '
574          climvstrfile       = ' '
575    
576  c     Start dates.  C     Start dates.
577        hfluxstartdate     = 0.        hfluxstartdate     = 0.
578        atempstartdate     = 0.        atempstartdate     = 0.
579        aqhstartdate       = 0.        aqhstartdate       = 0.
580        evapstartdate      = 0.        evapstartdate      = 0.
581        precipstartdate    = 0.        precipstartdate    = 0.
582        snowprecipstartdate = 0.        snowprecipstartdate= 0.
583        sfluxstartdate     = 0.        sfluxstartdate     = 0.
584        runoffstartdate    = 0.        runoffstartdate    = 0.
585          saltflxstartdate   = 0.
586        ustressstartdate   = 0.        ustressstartdate   = 0.
587        vstressstartdate   = 0.        vstressstartdate   = 0.
588        uwindstartdate     = 0.        uwindstartdate     = 0.
# Line 379  c     Start dates. Line 596  c     Start dates.
596        obcsSstartdate     = 0.        obcsSstartdate     = 0.
597        obcsEstartdate     = 0.        obcsEstartdate     = 0.
598        obcsWstartdate     = 0.        obcsWstartdate     = 0.
599          siobNstartdate     = 0.
600          siobSstartdate     = 0.
601          siobEstartdate     = 0.
602          siobWstartdate     = 0.
603        apressurestartdate = 0.        apressurestartdate = 0.
604          areamaskstartdate  = 0.
605          climsststartdate   = 0.
606          climsssstartdate   = 0.
607          climustrstartdate  = 0.
608          climvstrstartdate  = 0.
609    
610  c     Initialise file type and field precision  C     Initialise file type and field precision
611        exf_iprec            = 32        exf_iprec            = 32
612          exf_iprec_obcs       = UNSET_I
613        exf_yftype           = 'RL'        exf_yftype           = 'RL'
614        useExfYearlyFields   = .FALSE.        useExfYearlyFields   = .FALSE.
615        twoDigitYear         = .FALSE.        twoDigitYear         = .FALSE.
       useExfCheckRange     = .TRUE.  
616    
617  c     Input scaling factors.  C     Input scaling factors.
618        exf_inscal_hflux     =  1. _d 0        exf_inscal_hflux     =  1. _d 0
619        exf_inscal_sflux     =  1. _d 0        exf_inscal_sflux     =  1. _d 0
620        exf_inscal_ustress   =  1. _d 0        exf_inscal_ustress   =  1. _d 0
# Line 399  c     Input scaling factors. Line 625  c     Input scaling factors.
625        exf_inscal_swflux    =  1. _d 0        exf_inscal_swflux    =  1. _d 0
626        exf_inscal_lwflux    =  1. _d 0        exf_inscal_lwflux    =  1. _d 0
627        exf_inscal_precip    =  1. _d 0        exf_inscal_precip    =  1. _d 0
628        exf_inscal_snowprecip =  1. _d 0        exf_inscal_snowprecip=  1. _d 0
629        exf_inscal_sst       =  1. _d 0        exf_inscal_sst       =  1. _d 0
630        exf_inscal_sss       =  1. _d 0        exf_inscal_sss       =  1. _d 0
631        exf_inscal_atemp     =  1. _d 0        exf_inscal_atemp     =  1. _d 0
# Line 408  c     Input scaling factors. Line 634  c     Input scaling factors.
634        exf_inscal_evap      =  1. _d 0        exf_inscal_evap      =  1. _d 0
635        exf_inscal_apressure =  1. _d 0        exf_inscal_apressure =  1. _d 0
636        exf_inscal_runoff    =  1. _d 0        exf_inscal_runoff    =  1. _d 0
637          exf_inscal_runoftemp =  1. _d 0
638          exf_inscal_saltflx   =  1. _d 0
639        exf_inscal_swdown    =  1. _d 0        exf_inscal_swdown    =  1. _d 0
640        exf_inscal_lwdown    =  1. _d 0        exf_inscal_lwdown    =  1. _d 0
641          exf_inscal_climsst   =  1. _d 0
642          exf_inscal_climsss   =  1. _d 0
643          exf_inscal_climustr  =  1. _d 0
644          exf_inscal_climvstr  =  1. _d 0
645          exf_inscal_areamask  =  1. _d 0
646    
647  c     Output scaling factors.  C     Output scaling factors.
648        exf_outscal_hflux    =  1. _d 0        exf_outscal_hflux    =  1. _d 0
649        exf_outscal_sflux    =  1. _d 0        exf_outscal_sflux    =  1. _d 0
650        exf_outscal_ustress  =  1. _d 0        exf_outscal_ustress  =  1. _d 0
# Line 420  c     Output scaling factors. Line 653  c     Output scaling factors.
653        exf_outscal_sst      =  1. _d 0        exf_outscal_sst      =  1. _d 0
654        exf_outscal_sss      =  1. _d 0        exf_outscal_sss      =  1. _d 0
655        exf_outscal_apressure=  1. _d 0        exf_outscal_apressure=  1. _d 0
656          exf_outscal_areamask =  1. _d 0
657    
658  #ifdef USE_EXF_INTERPOLATION  #ifdef USE_EXF_INTERPOLATION
659        ustress_lon0   = thetaMin  C--   set default input location to match (in case of simple Lat-Lonp grid)
660        uwind_lon0     = thetaMin  C     model grid cell-center position (leading to trivial interpolation)
661        vstress_lon0   = thetaMin + delX(1) / 2        inp_lon0 = xgOrigin + delX(1)*exf_half
662        hflux_lon0     = thetaMin + delX(1) / 2        inp_lat0 = ygOrigin + delY(1)*exf_half
663        sflux_lon0     = thetaMin + delX(1) / 2        inp_dLon = delX(1)
664        swflux_lon0    = thetaMin + delX(1) / 2        inp_dLat = delY(1)
665        runoff_lon0    = thetaMin + delX(1) / 2  
666        atemp_lon0     = thetaMin + delX(1) / 2        ustress_lon0   = inp_lon0
667        aqh_lon0       = thetaMin + delX(1) / 2        uwind_lon0     = inp_lon0
668        evap_lon0      = thetaMin + delX(1) / 2        vstress_lon0   = inp_lon0
669        precip_lon0    = thetaMin + delX(1) / 2        hflux_lon0     = inp_lon0
670        snowprecip_lon0 = thetaMin + delX(1) / 2        sflux_lon0     = inp_lon0
671        vwind_lon0     = thetaMin + delX(1) / 2        swflux_lon0    = inp_lon0
672        wspeed_lon0    = thetaMin + delX(1) / 2        runoff_lon0    = inp_lon0
673        lwflux_lon0    = thetaMin + delX(1) / 2        saltflx_lon0   = inp_lon0
674        swdown_lon0    = thetaMin + delX(1) / 2        atemp_lon0     = inp_lon0
675        lwdown_lon0    = thetaMin + delX(1) / 2        aqh_lon0       = inp_lon0
676        apressure_lon0 = thetaMin + delX(1) / 2        evap_lon0      = inp_lon0
677        vstress_lat0   = phimin        precip_lon0    = inp_lon0
678        vwind_lat0     = phimin        snowprecip_lon0= inp_lon0
679        wspeed_lat0    = phimin        vwind_lon0     = inp_lon0
680        ustress_lat0   = phimin   + delY(1) / 2        wspeed_lon0    = inp_lon0
681        hflux_lat0     = phimin   + delY(1) / 2        lwflux_lon0    = inp_lon0
682        sflux_lat0     = phimin   + delY(1) / 2        swdown_lon0    = inp_lon0
683        runoff_lat0    = phimin   + delY(1) / 2        lwdown_lon0    = inp_lon0
684        swflux_lat0    = phimin   + delY(1) / 2        apressure_lon0 = inp_lon0
685        atemp_lat0     = phimin   + delY(1) / 2        areamask_lon0  = inp_lon0
686        aqh_lat0       = phimin   + delY(1) / 2        vstress_lat0   = inp_lat0
687        evap_lat0      = phimin   + delY(1) / 2        vwind_lat0     = inp_lat0
688        precip_lat0    = phimin   + delY(1) / 2        wspeed_lat0    = inp_lat0
689        snowprecip_lat0 = phimin   + delY(1) / 2        ustress_lat0   = inp_lat0
690        uwind_lat0     = phimin   + delY(1) / 2        hflux_lat0     = inp_lat0
691        lwflux_lat0    = phimin   + delY(1) / 2        sflux_lat0     = inp_lat0
692        swdown_lat0    = phimin   + delY(1) / 2        runoff_lat0    = inp_lat0
693        lwdown_lat0    = phimin   + delY(1) / 2        saltflx_lat0   = inp_lat0
694        apressure_lat0 = phimin   + delY(1) / 2        swflux_lat0    = inp_lat0
695        ustress_nlon   = Nx        atemp_lat0     = inp_lat0
696        ustress_nlat   = Ny        aqh_lat0       = inp_lat0
697        vstress_nlon   = Nx        evap_lat0      = inp_lat0
698        vstress_nlat   = Ny        precip_lat0    = inp_lat0
699        hflux_nlon     = Nx        snowprecip_lat0= inp_lat0
700        hflux_nlat     = Ny        uwind_lat0     = inp_lat0
701        sflux_nlon     = Nx        lwflux_lat0    = inp_lat0
702        sflux_nlat     = Ny        swdown_lat0    = inp_lat0
703        swflux_nlon    = Nx        lwdown_lat0    = inp_lat0
704        swflux_nlat    = Ny        apressure_lat0 = inp_lat0
705        runoff_nlon    = Nx        areamask_lat0  = inp_lat0
706        runoff_nlat    = Ny        ustress_nlon   = gridNx
707        atemp_nlon     = Nx        ustress_nlat   = gridNy
708        atemp_nlat     = Ny        vstress_nlon   = gridNx
709        aqh_nlon       = Nx        vstress_nlat   = gridNy
710        aqh_nlat       = Ny        hflux_nlon     = gridNx
711        evap_nlon      = Nx        hflux_nlat     = gridNy
712        evap_nlat      = Ny        sflux_nlon     = gridNx
713        precip_nlon    = Nx        sflux_nlat     = gridNy
714        snowprecip_nlon = Nx        swflux_nlon    = gridNx
715        precip_nlat    = Ny        swflux_nlat    = gridNy
716        snowprecip_nlat = Ny        runoff_nlon    = gridNx
717        uwind_nlon     = Nx        runoff_nlat    = gridNy
718        uwind_nlat     = Ny        saltflx_nlon   = gridNx
719        vwind_nlon     = Nx        saltflx_nlat   = gridNy
720        vwind_nlat     = Ny        atemp_nlon     = gridNx
721        wspeed_nlon    = Nx        atemp_nlat     = gridNy
722        wspeed_nlat    = Ny        aqh_nlon       = gridNx
723        lwflux_nlon    = Nx        aqh_nlat       = gridNy
724        lwflux_nlat    = Ny        evap_nlon      = gridNx
725        swdown_nlon    = Nx        evap_nlat      = gridNy
726        swdown_nlat    = Ny        precip_nlon    = gridNx
727        lwdown_nlon    = Nx        precip_nlat    = gridNy
728        lwdown_nlat    = Ny        snowprecip_nlon= gridNx
729        apressure_nlon = Nx        snowprecip_nlat= gridNy
730        apressure_nlat = Ny        uwind_nlon     = gridNx
731        Ustress_lon_inc   = delX(1)        uwind_nlat     = gridNy
732        vstress_lon_inc   = delX(1)        vwind_nlon     = gridNx
733        hflux_lon_inc     = delX(1)        vwind_nlat     = gridNy
734        sflux_lon_inc     = delX(1)        wspeed_nlon    = gridNx
735        swflux_lon_inc    = delX(1)        wspeed_nlat    = gridNy
736        runoff_lon_inc    = delX(1)        lwflux_nlon    = gridNx
737        atemp_lon_inc     = delX(1)        lwflux_nlat    = gridNy
738        aqh_lon_inc       = delX(1)        swdown_nlon    = gridNx
739        evap_lon_inc      = delX(1)        swdown_nlat    = gridNy
740        precip_lon_inc    = delX(1)        lwdown_nlon    = gridNx
741        snowprecip_lon_inc = delX(1)        lwdown_nlat    = gridNy
742        uwind_lon_inc     = delX(1)        apressure_nlon = gridNx
743        vwind_lon_inc     = delX(1)        apressure_nlat = gridNy
744        wspeed_lon_inc    = delX(1)        areamask_nlon  = gridNx
745        lwflux_lon_inc    = delX(1)        areamask_nlat  = gridNy
746        swdown_lon_inc    = delX(1)        ustress_lon_inc   = inp_dLon
747        lwdown_lon_inc    = delX(1)        vstress_lon_inc   = inp_dLon
748        apressure_lon_inc = delX(1)        hflux_lon_inc     = inp_dLon
749        DO i=1,MAX_LAT_INC        sflux_lon_inc     = inp_dLon
750           IF (i.LT.Ny) THEN        swflux_lon_inc    = inp_dLon
751              vstress_lat_inc(i)   =  delY(i)        runoff_lon_inc    = inp_dLon
752              vwind_lat_inc(i)     =  delY(i)        saltflx_lon_inc   = inp_dLon
753              wspeed_lat_inc(i)    =  delY(i)        atemp_lon_inc     = inp_dLon
754              ustress_lat_inc(i)   = (delY(i) + delY(i)) / 2.        aqh_lon_inc       = inp_dLon
755              hflux_lat_inc(i)     = (delY(i) + delY(i)) / 2.        evap_lon_inc      = inp_dLon
756              sflux_lat_inc(i)     = (delY(i) + delY(i)) / 2.        precip_lon_inc    = inp_dLon
757              swflux_lat_inc(i)    = (delY(i) + delY(i)) / 2.        snowprecip_lon_inc= inp_dLon
758              runoff_lat_inc(i)    = (delY(i) + delY(i)) / 2.        uwind_lon_inc     = inp_dLon
759              atemp_lat_inc(i)     = (delY(i) + delY(i)) / 2.        vwind_lon_inc     = inp_dLon
760              aqh_lat_inc(i)       = (delY(i) + delY(i)) / 2.        wspeed_lon_inc    = inp_dLon
761              evap_lat_inc(i)      = (delY(i) + delY(i)) / 2.        lwflux_lon_inc    = inp_dLon
762              precip_lat_inc(i)    = (delY(i) + delY(i)) / 2.        swdown_lon_inc    = inp_dLon
763              snowprecip_lat_inc(i) = (delY(i) + delY(i)) / 2.        lwdown_lon_inc    = inp_dLon
764              uwind_lat_inc(i)     = (delY(i) + delY(i)) / 2.        apressure_lon_inc = inp_dLon
765              lwflux_lat_inc(i)    = (delY(i) + delY(i)) / 2.        areamask_lon_inc  = inp_dLon
766              swdown_lat_inc(i)    = (delY(i) + delY(i)) / 2.  
767              lwdown_lat_inc(i)    = (delY(i) + delY(i)) / 2.        climsst_lon0    = inp_lon0
768              apressure_lat_inc(i) = (delY(i) + delY(i)) / 2.        climsss_lon0    = inp_lon0
769           ELSE        climustr_lon0   = inp_lon0
770              ustress_lat_inc(i)   = 0.        climvstr_lon0   = inp_lon0
771              vstress_lat_inc(i)   = 0.        climsst_lat0    = inp_lat0
772              hflux_lat_inc(i)     = 0.        climsss_lat0    = inp_lat0
773              sflux_lat_inc(i)     = 0.        climustr_lat0   = inp_lat0
774              swflux_lat_inc(i)    = 0.        climvstr_lat0   = inp_lat0
775              runoff_lat_inc(i)    = 0.        climsst_nlon    = gridNx
776              atemp_lat_inc(i)     = 0.        climsst_nlat    = gridNy
777              aqh_lat_inc(i)       = 0.        climsss_nlon    = gridNx
778              evap_lat_inc(i)      = 0.        climsss_nlat    = gridNy
779              precip_lat_inc(i)    = 0.        climustr_nlon   = gridNx
780              snowprecip_lat_inc(i) = 0.        climustr_nlat   = gridNy
781              uwind_lat_inc(i)     = 0.        climvstr_nlon   = gridNx
782              vwind_lat_inc(i)     = 0.        climvstr_nlat   = gridNy
783              wspeed_lat_inc(i)    = 0.        climsst_lon_inc = inp_dLon
784              lwflux_lat_inc(i)    = 0.        climsss_lon_inc = inp_dLon
785              swdown_lat_inc(i)    = 0.        climustr_lon_inc= inp_dLon
786              lwdown_lat_inc(i)    = 0.        climvstr_lon_inc= inp_dLon
787              apressure_lat_inc(i) = 0.  
788           ENDIF        DO j=1,MAX_LAT_INC
789            IF (j.LT.gridNy) THEN
790              inp_dLat = (delY(j) + delY(j+1))*exf_half
791            ELSE
792              inp_dLat = 0.
793            ENDIF
794            ustress_lat_inc(j)   = inp_dLat
795            vstress_lat_inc(j)   = inp_dLat
796            hflux_lat_inc(j)     = inp_dLat
797            sflux_lat_inc(j)     = inp_dLat
798            swflux_lat_inc(j)    = inp_dLat
799            runoff_lat_inc(j)    = inp_dLat
800            saltflx_lat_inc(j)   = inp_dLat
801            atemp_lat_inc(j)     = inp_dLat
802            aqh_lat_inc(j)       = inp_dLat
803            evap_lat_inc(j)      = inp_dLat
804            precip_lat_inc(j)    = inp_dLat
805            snowprecip_lat_inc(j)= inp_dLat
806            uwind_lat_inc(j)     = inp_dLat
807            vwind_lat_inc(j)     = inp_dLat
808            wspeed_lat_inc(j)    = inp_dLat
809            lwflux_lat_inc(j)    = inp_dLat
810            swdown_lat_inc(j)    = inp_dLat
811            lwdown_lat_inc(j)    = inp_dLat
812            apressure_lat_inc(j) = inp_dLat
813            areamask_lat_inc(j)  = inp_dLat
814            climsst_lat_inc(j)   = inp_dLat
815            climsss_lat_inc(j)   = inp_dLat
816            climustr_lat_inc(j)  = inp_dLat
817            climvstr_lat_inc(j)  = inp_dLat
818        ENDDO        ENDDO
819    
820          ustress_interpMethod   = 12
821          vstress_interpMethod   = 22
822          hflux_interpMethod     =  1
823          sflux_interpMethod     =  1
824          swflux_interpMethod    =  1
825          runoff_interpMethod    =  1
826          saltflx_interpMethod   =  1
827          atemp_interpMethod     =  1
828          aqh_interpMethod       =  1
829          evap_interpMethod      =  1
830          precip_interpMethod    =  1
831          snowprecip_interpMethod=  1
832          uwind_interpMethod     = 12
833          vwind_interpMethod     = 22
834          wspeed_interpMethod    =  1
835          lwflux_interpMethod    =  1
836          swdown_interpMethod    =  1
837          lwdown_interpMethod    =  1
838          apressure_interpMethod =  1
839          areamask_interpMethod  =  1
840          climsst_interpMethod   =  2
841          climsss_interpMethod   =  2
842          climustr_interpMethod  = 12
843          climvstr_interpMethod  = 22
844    
845          exf_output_interp = .FALSE.
846  #endif /* USE_EXF_INTERPOLATION */  #endif /* USE_EXF_INTERPOLATION */
847    
848  c     Check for the availability of the right calendar version.  C     Next, read the forcing data file.
849        if ( calendarversion .ne. usescalendarversion ) then        WRITE(msgBuf,'(A)') 'EXF_READPARMS: opening data.exf'
850           print*,' exf_readparms: You are not using the appropriate'        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
851           print*,'           version of the calendar package.'       &     SQUEEZE_RIGHT , 1)
          print*  
          print*,' You are using Calendar version: ', calendarversion  
          print*,' Please use    Calendar version: ', usescalendarversion  
          stop ' stopped in exf_readparms.'  
       endif  
   
 c     Next, read the forcing data file.  
         WRITE(msgBuf,'(A)') 'EXF_READPARMS: opening data.exf'  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &                    SQUEEZE_RIGHT , 1)  
852    
853          CALL OPEN_COPY_DATA_FILE(        CALL OPEN_COPY_DATA_FILE(
854       I                          'data.exf', 'EXF_READPARMS',       I                          'data.exf', 'EXF_READPARMS',
855       O                          iUnit,       O                          iUnit,
856       I                          myThid )       I                          myThid )
857    
858        READ(  iUnit, nml = exf_nml )        WRITE(msgBuf,'(A)')
859         &     'EXF_READPARMS: reading EXF_NML_01'
860          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
861         &     SQUEEZE_RIGHT , 1)
862          READ(  iUnit, nml = EXF_NML_01 )
863          WRITE(msgBuf,'(A)')
864         &     'EXF_READPARMS: reading EXF_NML_02'
865          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
866         &     SQUEEZE_RIGHT , 1)
867          READ(  iUnit, nml = EXF_NML_02 )
868          WRITE(msgBuf,'(A)')
869         &     'EXF_READPARMS: reading EXF_NML_03'
870          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
871         &     SQUEEZE_RIGHT , 1)
872          READ(  iUnit, nml = EXF_NML_03 )
873    #ifdef USE_EXF_INTERPOLATION
874          WRITE(msgBuf,'(A)')
875         &     'EXF_READPARMS: reading EXF_NML_04'
876          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
877         &     SQUEEZE_RIGHT , 1)
878          READ(  iUnit, nml = EXF_NML_04 )
879    #endif /* USE_EXF_INTERPOLATION */
880    
881    #ifdef ALLOW_OBCS
882          IF ( useOBCS ) THEN
883           WRITE(msgBuf,'(A)')
884         &      'EXF_READPARMS: reading EXF_NML_OBCS'
885           CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
886         &      SQUEEZE_RIGHT , 1)
887           READ(  iUnit, nml = EXF_NML_OBCS )
888          ENDIF
889           IF(siobNstartdate1.EQ.UNSET_I ) siobNstartdate1=obcsNstartdate1
890           IF(siobNstartdate2.EQ.UNSET_I ) siobNstartdate2=obcsNstartdate2
891           IF(siobNperiod    .EQ.UNSET_RL) siobNperiod    =obcsNperiod
892           IF(siobSstartdate1.EQ.UNSET_I ) siobSstartdate1=obcsSstartdate1
893           IF(siobSstartdate2.EQ.UNSET_I ) siobSstartdate2=obcsSstartdate2
894           IF(siobSperiod    .EQ.UNSET_RL) siobSperiod    =obcsSperiod
895           IF(siobEstartdate1.EQ.UNSET_I ) siobEstartdate1=obcsEstartdate1
896           IF(siobEstartdate2.EQ.UNSET_I ) siobEstartdate2=obcsEstartdate2
897           IF(siobEperiod    .EQ.UNSET_RL) siobEperiod    =obcsEperiod
898           IF(siobWstartdate1.EQ.UNSET_I ) siobWstartdate1=obcsWstartdate1
899           IF(siobWstartdate2.EQ.UNSET_I ) siobWstartdate2=obcsWstartdate2
900           IF(siobWperiod    .EQ.UNSET_RL) siobWperiod    =obcsWperiod
901    
902        WRITE(msgBuf,'(A)')         IF(exf_iprec_obcs .EQ. UNSET_I) exf_iprec_obcs =exf_iprec
903    #endif /* ALLOW_OBCS */
904    
905          WRITE(msgBuf,'(A)')
906       &     'EXF_READPARMS: finished reading data.exf'       &     'EXF_READPARMS: finished reading data.exf'
907        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
908       &                SQUEEZE_RIGHT , 1)       &                SQUEEZE_RIGHT , 1)
909    
910        CLOSE( iUnit )        CLOSE( iUnit )
911    
912        call exf_check( mythid )  C--   Retired parameters
913          IF ( exf_yftype.NE.'RL' ) THEN
914  c     Complete the start date specifications for the forcing         STOP 'S/R EXF_READPARAMS: value of exf_yftype not allowed'
915  c     fields to get a complete calendar date array.        ENDIF
916    
917  #ifdef ALLOW_ATM_WIND  C--   Derive other parameters:
918        if ( uwindfile .NE. ' ' ) then        IF ( exf_verbose ) exf_debugLev = MAX( exf_debugLev, debLevD )
919           call cal_FullDate  ( uwindstartdate1    ,      uwindstartdate2,        hq = ht
920       &        date_array                        ,mythid )        stressIsOnCgrid = readStressOnCgrid
921           call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  #if ( defined (ALLOW_BULKFORMULAE) )
922           call cal_ToSeconds ( difftime,    uwindstartdate     ,mythid )        IF ( useAtmWind ) stressIsOnCgrid = .FALSE.
          uwindstartdate     = modelstart   + uwindstartdate  
       endif  
       if ( vwindfile .NE. ' ' ) then  
          call cal_FullDate  ( vwindstartdate1    ,      vwindstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,    vwindstartdate     ,mythid )  
          vwindstartdate     = modelstart   + vwindstartdate  
       endif  
       if ( wspeedfile .NE. ' ' ) then  
          call cal_FullDate  ( wspeedstartdate1, wspeedstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,    wspeedstartdate     ,mythid )  
          wspeedstartdate     = modelstart   + wspeedstartdate  
       endif  
 #else  
       if ( ustressfile .NE. ' ' ) then  
          call cal_FullDate  ( ustressstartdate1  ,    ustressstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,  ustressstartdate     ,mythid )  
          ustressstartdate   = modelstart + ustressstartdate  
       endif  
       if ( vstressfile .NE. ' ' ) then  
          call cal_FullDate  ( vstressstartdate1  ,    vstressstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,  vstressstartdate     ,mythid )  
          vstressstartdate   = modelstart + vstressstartdate  
       endif  
 #endif  
   
 #ifdef ALLOW_ATM_TEMP  
       if ( atempfile .NE. ' ' ) then  
          call cal_FullDate  ( atempstartdate1    ,      atempstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,    atempstartdate     ,mythid )  
          atempstartdate     = modelstart   + atempstartdate  
       endif  
       if ( aqhfile .NE. ' ' ) then  
          call cal_FullDate  ( aqhstartdate1      ,        aqhstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,      aqhstartdate     ,mythid )  
          aqhstartdate       = modelstart     + aqhstartdate  
       endif  
       if ( lwfluxfile .NE. ' ' ) then  
          call cal_FullDate  ( lwfluxstartdate1   ,     lwfluxstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   lwfluxstartdate     ,mythid )  
          lwfluxstartdate    = modelstart  + lwfluxstartdate  
       endif  
       if ( precipfile .NE. ' ' ) then  
          call cal_FullDate  ( precipstartdate1   ,     precipstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   precipstartdate     ,mythid )  
          precipstartdate    = modelstart  + precipstartdate  
       endif  
       if ( snowprecipfile .NE. ' ' ) then  
          call cal_FullDate( snowprecipstartdate1, snowprecipstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime, snowprecipstartdate, mythid )  
          snowprecipstartdate    = modelstart  + snowprecipstartdate  
       endif  
 #else  
       if ( hfluxfile .NE. ' ' ) then  
          call cal_FullDate  ( hfluxstartdate1    ,      hfluxstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,    hfluxstartdate     ,mythid )  
          hfluxstartdate     = modelstart   + hfluxstartdate  
       endif  
       if ( sfluxfile .NE. ' ' ) then  
          call cal_FullDate  ( sfluxstartdate1    ,      sfluxstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,    sfluxstartdate     ,mythid )  
          sfluxstartdate     = modelstart   + sfluxstartdate  
       endif  
 #endif  
   
 #if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING)  
       if ( swfluxfile .NE. ' ' ) then  
          call cal_FullDate  ( swfluxstartdate1   ,     swfluxstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   swfluxstartdate     ,mythid )  
          swfluxstartdate    = modelstart  + swfluxstartdate  
       endif  
 #endif  
   
 #ifdef EXF_READ_EVAP  
       if ( evapfile .NE. ' ' ) then  
          call cal_FullDate  ( evapstartdate1     ,       evapstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,     evapstartdate     ,mythid )  
          evapstartdate      = modelstart    + evapstartdate  
       endif  
 #endif  
   
 #ifdef ALLOW_RUNOFF  
       if ( runofffile .NE. ' ' .AND. runoffperiod .NE. 0. ) then  
          call cal_FullDate  ( runoffstartdate1   ,     runoffstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   runoffstartdate     ,mythid )  
          runoffstartdate    = modelstart  + runoffstartdate  
       endif  
 #endif  
   
 #ifdef ALLOW_DOWNWARD_RADIATION  
       if ( swdownfile .NE. ' ' ) then  
          call cal_FullDate  ( swdownstartdate1   ,     swdownstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   swdownstartdate     ,mythid )  
          swdownstartdate    = modelstart  + swdownstartdate  
       endif  
       if ( lwdownfile .NE. ' ' ) then  
          call cal_FullDate  ( lwdownstartdate1   ,     lwdownstartdate2,  
      &        date_array                        ,mythid )  
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,   lwdownstartdate     ,mythid )  
          lwdownstartdate    = modelstart  + lwdownstartdate  
       endif  
923  #endif  #endif
924    #ifdef USE_EXF_INTERPOLATION
925          IF ( (ustress_interpMethod.GE.1 .AND. ustressfile.NE.' ') .OR.
926         &     (vstress_interpMethod.GE.1 .AND. vstressfile.NE.' ') )
927         &   stressIsOnCgrid = .FALSE.
928    #endif /* USE_EXF_INTERPOLATION */
929    
930  #ifdef ATMOSPHERIC_LOADING        IF ( select_ZenAlbedo.GT.0 ) THEN
931        if ( apressurefile .NE. ' ' ) then             useExfZenAlbedo=.TRUE.
932           call cal_FullDate  ( apressurestartdate1,  apressurestartdate2,        ENDIf
933       &        date_array                        ,mythid )  
934           call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  C--   Overwrite tauThetaClimRelax but stop if already set.
935           call cal_ToSeconds ( difftime,  apressurestartdate   ,mythid )  C- Note: need this, even if EXF option ALLOW_CLIMSST_RELAXATION is undef;
936           apressurestartdate = modelstart + apressurestartdate  C        this prevents to apply relaxation towards potentially wrong SST since,
937        endif  C        with EXF, we skip the update of loaded SST in EXTERNAL_FIELDS_LOAD.
938  #endif  C- Note2: let s see whether we can put this back under ifdef
939    C        ALLOW_CLIMSST_RELAXATION, but always call EXTERNAL_FIELDS_LOAD.
940  #ifdef ALLOW_OBCS  C        If ALLOW_CLIMSST_RELAXATION is undef, clim.relaxation could still
941  #ifdef ALLOW_OBCS_NORTH  C        be done outside of exf.
942        if ( obcsNperiod .NE. 0 ) then  #ifdef ALLOW_CLIMSST_RELAXATION
943           call cal_FullDate  ( obcsNstartdate1    ,      obcsNstartdate2,        IF ( tauThetaClimRelax.NE.0. _d 0 ) THEN
944       &        date_array                        ,mythid )          WRITE(msgBuf,'(2A)') 'EXF_READPARMS: ',
945           call cal_TimePassed(modelstartdate,date_array,difftime,mythid)       &   'with EXF, cannot use "tauThetaClimRelax" in "data"'
946           call cal_ToSeconds ( difftime,   obcsNstartdate      ,mythid )          CALL PRINT_ERROR( msgBuf, myThid )
947           obcsNstartdate     = modelstart + obcsNstartdate          WRITE(msgBuf,'(2A)') 'since SST relax. is handled by EXF',
948        endif       &   ' (data.exf, "climsstTauRelax")'
949  #endif          CALL PRINT_ERROR( msgBuf, myThid )
950  #ifdef ALLOW_OBCS_SOUTH          STOP 'ABNORMAL END: S/R EXF_READPARMS'
951        if ( obcsSperiod .NE. 0 ) then        ENDIF
952           call cal_FullDate  ( obcsSstartdate1    ,      obcsSstartdate2,        tauThetaClimRelax = climsstTauRelax
953       &        date_array                        ,mythid )  #endif
954           call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
955           call cal_ToSeconds ( difftime,   obcsSstartdate      ,mythid )  #ifdef ALLOW_CLIMSSS_RELAXATION
956           obcsSstartdate     = modelstart + obcsSstartdate  C--   Overwrite tauSaltClimRelax but stop if already set.
957        endif        IF ( tauSaltClimRelax.NE.0. _d 0 ) THEN
958  #endif          WRITE(msgBuf,'(2A)') 'EXF_READPARMS: ',
959  #ifdef ALLOW_OBCS_EAST       &   'with EXF, cannot use "tauSaltClimRelax" in "data"'
960        if ( obcsEperiod .NE. 0 ) then          CALL PRINT_ERROR( msgBuf, myThid )
961           call cal_FullDate  ( obcsEstartdate1    ,      obcsEstartdate2,          WRITE(msgBuf,'(2A)') 'since SSS relax. is handled by EXF',
962       &        date_array                        ,mythid )       &   ' (data.exf, "climsssTauRelax")'
963           call cal_TimePassed(modelstartdate,date_array,difftime,mythid)          CALL PRINT_ERROR( msgBuf, myThid )
964           call cal_ToSeconds ( difftime,   obcsEstartdate      ,mythid )          STOP 'ABNORMAL END: S/R EXF_READPARMS'
965           obcsEstartdate     = modelstart + obcsEstartdate        ENDIF
966        endif        tauSaltClimRelax = climsssTauRelax
967  #endif  #endif
968  #ifdef ALLOW_OBCS_WEST  
969        if ( obcsNperiod .NE. 0 ) then  C     Complete the start date specifications for the forcing
970           call cal_FullDate  ( obcsWstartdate1    ,      obcsWstartdate2,  C     fields to get a complete calendar date array.
971       &        date_array                        ,mythid )  C     => moved to EXF_INIT_FIXED
          call cal_TimePassed(modelstartdate,date_array,difftime,mythid)  
          call cal_ToSeconds ( difftime,  obcsWstartdate       ,mythid )  
          obcsWstartdate     = modelstart + obcsWstartdate  
       endif  
 #endif  
 #endif /* ALLOW_OBCS */  
   
       _END_MASTER( mythid )  
972    
973          _END_MASTER( myThid )
974        _BARRIER        _BARRIER
975    
976  c--   Summarize the External forcing's setup.        RETURN
977        call exf_summary( mythid )        END
   
 c--   set climatology parameters  
       call exf_clim_readparms( mythid )  
   
 c--   summarize climatologic forcing configuration  
       call exf_clim_summary( mythid )  
   
       end  

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.87

  ViewVC Help
Powered by ViewVC 1.1.22