*IF DEF,SCMA S_MAIN.2
C *****************************COPYRIGHT****************************** S_MAIN.3
C (c) CROWN COPYRIGHT 1998, METEOROLOGICAL OFFICE, All Rights Reserved. S_MAIN.4
C S_MAIN.5
C Use, duplication or disclosure of this code is subject to the S_MAIN.6
C restrictions as set forth in the contract. S_MAIN.7
C S_MAIN.8
C Meteorological Office S_MAIN.9
C London Road S_MAIN.10
C BRACKNELL S_MAIN.11
C Berkshire UK S_MAIN.12
C RG12 2SZ S_MAIN.13
C S_MAIN.14
C If no contract has been raised with this copy of the code, the use, S_MAIN.15
C duplication or disclosure of it is strictly prohibited. Permission S_MAIN.16
C to do so must first be obtained in writing from the Head of Numerical S_MAIN.17
C Modelling at the above address. S_MAIN.18
C ******************************COPYRIGHT****************************** S_MAIN.19
C S_MAIN.20
C SCMMAIN is the main calling program for the Single Column Model. S_MAIN.21
C It sets up the initial values from forcing datasets or initial S_MAIN.22
C values in NAMELISTS then calls U.M. physics routines and finally S_MAIN.23
C stores diagnostics and means them. If a continuation run is S_MAIN.24
C required the initial values are stored on 'tape'. S_MAIN.25
C See A Guide To The UK Meteorological Office Single Column Model S_MAIN.26
C for a description of the model. S_MAIN.27
C S_MAIN.28
Program scmmain ,33S_MAIN.29
C===================================================================== S_MAIN.30
C SCM S_MAIN.31
C Single Column Unified Model S_MAIN.32
C Master Deck S_MAIN.33
C S_MAIN.34
C S_MAIN.35
C Model variables using U.M conventions as specified in S_MAIN.36
C U. M. Documentation Paper No. 5, Verson No. 2, 22/1/90. S_MAIN.37
C Modified last on 28/6/91 to run with versions 2.1 S_MAIN.38
C Modified on 11/11/91 by C.Bunton to allow for up to 4 meaning S_MAIN.39
C periods as well as a 1 day meaning period for dumps. Dumps for S_MAIN.40
C graph production were removed. S_MAIN.41
C S_MAIN.42
C PROTO-HISTORY (before the SCM was integrated into the UM) : S_MAIN.43
C Nov. 1995 S_MAIN.44
C Major changes to SCM - see file SCM changes C.B S_MAIN.45
C Nov. 1995 S_MAIN.46
C (i) Main updated to cope with UM 3.4 physics routines S_MAIN.47
C (ii) Comdeck NSOILEVS changed to introduce NSOILT_LEVS S_MAIN.48
C soil temps. and NSOILM_LEVS for soil moisture lev S_MAIN.49
C which may not be the same. S_MAIN.50
C (iii) Previous mods used with 3.2 incorporated :- S_MAIN.51
C smoothsun.mod, grafdump.mod, initsoil.mod, noforce S_MAIN.52
C May 1996 S_MAIN.53
C (i) Changed to use version 4.0 physics - to check for S_MAIN.54
C correct HYDROLOGY versions used with Penamn-Monteith S_MAIN.55
C Boundary layer. S_MAIN.56
C Nov.1996 S_MAIN.57
C (1) Added CH_FLUX_H etc. as FLUX_H etc is changed to rate of S_MAIN.58
C change per sec in RUN_INIT. S_MAIN.59
C (2) Add initialisation for MOSES code for deep soil temp. S_MAIN.60
C and soil moisture. S_MAIN.61
C (3) Geostrophic forcing added - extra namelist INGEOFOR S_MAIN.62
C added. S_MAIN.63
C (4) Facility to switch off certain physics routines - extra S_MAIN.64
C Namelist PHYSWITCH added. S_MAIN.65
C (5) Logical switch LRMBL for Rapidly mixing scheme in S_MAIN.66
C Boundary S_MAIN.67
C layer - input through NAMELIST LOGIC S_MAIN.68
C S_MAIN.69
C Modification History: S_MAIN.70
C Version Date Change S_MAIN.71
C 4.5 June 1998 (JC Thil) S_MAIN.72
C Implementation of the SCM as a standard configuration S_MAIN.73
C of the UM centrally maintained. S_MAIN.74
C Extensive re-work if many aspects, including :- S_MAIN.75
C the running configuration is now selected S_MAIN.76
C through namelists vs the old system of comdecks S_MAIN.77
C 3A E-S radiation introduced S_MAIN.78
C MOSES II introduced S_MAIN.79
C S_MAIN.80
Implicit none S_MAIN.81
S_MAIN.82
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC S_MAIN.83
C S_MAIN.84
C Leading dimensions of the main arrays of the SCM ; these are up S_MAIN.85
C to now declared AND defined as a 'parameter' and passed to the S_MAIN.86
C underling subroutines of the SCM. Later, depending on the S_MAIN.87
C choices made for the language used for the UM, they will S_MAIN.88
C be read in in a top level routine and passed as dummy arguments S_MAIN.89
C to the present routine; otherwise arrays could as well S_MAIN.90
C be allocated through the memory management features of Fortran 9X. S_MAIN.91
C Until then, changing the resolution of the scm, means S_MAIN.92
C re-compiling (at least this routine) and linking the model. S_MAIN.93
C S_MAIN.94
Integer points ! Number of points the model is S_MAIN.95
Parameter(points = 1) ! running on (1 now). S_MAIN.96
Integer n_cca_lev ! No of levels for Convective S_MAIN.97
! Cloud Amount. S_MAIN.98
Integer nlevs ! Number of levels of the model. S_MAIN.99
Parameter(nlevs = 20) S_MAIN.100
Integer nwet ! Number of model levels S_MAIN.101
Parameter(nwet = nlevs) ! in which Q is set. S_MAIN.102
Integer nbl_levs ! Number of Boundary layer levels S_MAIN.103
Parameter(nbl_levs = 5) ! S_MAIN.104
Integer nfor ! Number terms for observational S_MAIN.105
Parameter(nfor = 9) ! forcing S_MAIN.106
Integer nsoilt_levs ! Number of soil temperature levels S_MAIN.107
*IF DEF,A08_1A S_MAIN.108
Parameter (nsoilt_levs=3) ! Stndard hydrology and boundary layer S_MAIN.109
*ELSE S_MAIN.110
Parameter (nsoilt_levs=4) ! Penman-Monteith S_MAIN.111
*ENDIF S_MAIN.112
Integer nsoilm_levs ! Number of soil moisture levels S_MAIN.113
*IF DEF,A08_5A S_MAIN.114
Parameter (nsoilm_levs = 4) ! Multilayer hydrology S_MAIN.115
*ELSE S_MAIN.116
Parameter (nsoilm_levs = 1) ! Single layer hydrology S_MAIN.117
*ENDIF S_MAIN.118
Integer ntrop ! Max number of levels in the S_MAIN.119
Parameter (ntrop=12) ! troposphere STATS forcing S_MAIN.120
Integer S_MAIN.121
& sulp_dim1,sulp_dim2 ! Dimensions for Sulphate arrays S_MAIN.122
Real sec_day S_MAIN.123
Parameter(sec_day = 86400.0) S_MAIN.124
Real sec_dump ! no. of seconds between each dump S_MAIN.125
! and is equal to n*timestep where S_MAIN.126
! n is a whole number S_MAIN.127
Parameter(sec_dump = 1200) S_MAIN.128
Integer ndump ! number of dumps per day S_MAIN.129
Parameter(ndump = sec_day / sec_dump) S_MAIN.130
Integer nsprog ! no. of single level prognostics S_MAIN.131
Parameter(nsprog = 10) S_MAIN.132
Integer nsdiag ! no. of single level Diagnostics S_MAIN.133
Parameter(nsdiag = 60) S_MAIN.134
Integer nvars ! no. variables in dump; equal to S_MAIN.135
! nprimvars + X, where X is any S_MAIN.136
! no. of variables (default 71) S_MAIN.137
Parameter(nvars = 6*nlevs+ 8*nwet+ 4*nbl_levs+ nsoilt_levs S_MAIN.138
& + 3*nsoilm_levs+ nsdiag) S_MAIN.139
Integer nprimvars ! minimum no. of variables required S_MAIN.140
! to restart from a dump and is S_MAIN.141
! equal to : S_MAIN.142
Parameter(nprimvars = 4*nlevs+ 4*nwet+ nsoilt_levs S_MAIN.143
& + nsoilm_levs+ nsprog) S_MAIN.144
S_MAIN.145
Integer S_MAIN.146
& cloud_count ! Counter which points to S_MAIN.147
! position of mean cloud base in DUMP S_MAIN.148
& ,qcount ! Points to position of q averaged S_MAIN.149
! throughout atmos. S_MAIN.150
& ,tcount ! Points to position of T averaged S_MAIN.151
! throughout atmos. column in DUMP S_MAIN.152
& ,t1p5m_maxcount ! pointer to T1p5m_max in dump S_MAIN.153
& ,t1p5m_mincount ! pointer to T1p5m_min in dump S_MAIN.154
Parameter( S_MAIN.155
& cloud_count = 4*nlevs+ 8*nwet+ 9, S_MAIN.156
& tcount = 4*nlevs+ 3, S_MAIN.157
& qcount = 4*nlevs+ 8*nwet+ 5, S_MAIN.158
& T1p5m_maxcount = 4*nlevs+ 8*nwet+ 4*nbl_levs+ nsoilt_levs+ 33, S_MAIN.159
& T1p5m_mincount = 4*nlevs+ 8*nwet+ 4*nbl_levs+ nsoilt_levs+ 34) S_MAIN.160
Integer nclds ! Number of possible cloudy levels S_MAIN.161
Parameter(nclds = nlevs-1) S_MAIN.162
Integer nozone ! Number of model levels in which S_MAIN.163
Parameter(nozone = nlevs) ! ozone is set. S_MAIN.164
Integer ntra ! Number of tracer fields S_MAIN.165
Integer trlev ! Number of model levels on which S_MAIN.166
! tracers are included S_MAIN.167
Parameter (ntra = 1, trlev = 20) S_MAIN.168
Integer ntab ! Dimension of array used in random S_MAIN.169
Parameter(ntab = 32) ! generator (Do not change this S_MAIN.170
! value as it is hard coded into S_MAIN.171
! the S_RANDOM deck) S_MAIN.172
Integer sal_dim ! Dimensions of sal_vis and sal_nir S_MAIN.173
Parameter(sal_dim = 1) ! for prognostic snow albedo S_MAIN.174
S_MAIN.175
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC S_MAIN.176
C S_MAIN.177
C Comdecks S_MAIN.178
C S_MAIN.179
*CALL C_PI
S_MAIN.180
*CALL C_G
! degrees to radians & vice versa S_MAIN.181
*CALL C_LHEAT
S_MAIN.182
*CALL C_R_CP
S_MAIN.183
*CALL CMAXSIZE
S_MAIN.184
*CALL CCONSTS
S_MAIN.185
*CALL SWSC
S_MAIN.186
*CALL C_OMEGA
! Comdecks for coriolis parameter S_MAIN.187
*IF DEF,A01_3A,AND,DEF,A02_3A S_MAIN.188
*CALL MXSIZE3A
! Set max sizes for E-S radiation. S_MAIN.189
*CALL SWSPDL3A
! Allocate space for SW spectrum. S_MAIN.190
*CALL SWSPCM3A
! Common space for spectrum. S_MAIN.191
*CALL LWSPDL3A
! Allocate space for LW spectrum. S_MAIN.192
*CALL LWSPCM3A
! Common space for spectrum. S_MAIN.193
c S_MAIN.194
C &R2SWCLNL S_MAIN.195
C S_MAIN.196
*CALL SWOPT3A
! Declarations for R2SWCLNL namelist. S_MAIN.197
! of E-S radiation code. S_MAIN.198
S_MAIN.199
C S_MAIN.200
C &R2LWCLNL S_MAIN.201
C S_MAIN.202
*CALL LWOPT3A
! Declarations for R2LWCLNL namelist. S_MAIN.203
! of E-S radiation code. S_MAIN.204
*CALL SWNBANDS
S_MAIN.205
*ENDIF S_MAIN.206
S_MAIN.207
S_MAIN.208
C S_MAIN.209
C-------------------------------------------------------------------- S_MAIN.210
C Loop Counters and limits S_MAIN.211
C-------------------------------------------------------------------- S_MAIN.212
C S_MAIN.213
Integer S_MAIN.214
& daycount ! Counts through days S_MAIN.215
& ,daysteps ! Number of timestep in a day S_MAIN.216
& ,full_daysteps ! Number of timestep in a full day S_MAIN.217
& ,nstepsin ! Number of steps in final day S_MAIN.218
& ,i,j,k ! General loop counters S_MAIN.219
! array dumpmean S_MAIN.220
& ,m1 ! No. of dumps S_MAIN.221
& ,stepcount ! Counts through timesteps S_MAIN.222
C S_MAIN.223
C--------------------------------------------------------------------- S_MAIN.224
C Namelists S_MAIN.225
C--------------------------------------------------------------------- S_MAIN.226
C S_MAIN.227
C &INDATA S_MAIN.228
C S_MAIN.229
Integer S_MAIN.230
& year_init ! Initial year S_MAIN.231
& ,month_init ! Initial month S_MAIN.232
& ,day_init ! Initial day S_MAIN.233
& ,hour_init ! Initial hour S_MAIN.234
& ,min_init ! Initial minute S_MAIN.235
& ,sec_init ! Initial second S_MAIN.236
& ,tapeyear_init ! Initial year for tape input S_MAIN.237
& ,tapemonth_init ! Initial month for tape input S_MAIN.238
& ,tapeday_init ! Initial day for tape input S_MAIN.239
& ,tapehour_init ! Initial hour for tape input S_MAIN.240
& ,tapemin_init ! Initial minute for tape input S_MAIN.241
& ,tapesec_init ! Initial second for tape input S_MAIN.242
& ,soil_type(points) ! Soil type code 1 to 4 S_MAIN.243
! 1 Ice S_MAIN.244
! 2 Fine S_MAIN.245
! 3 Medium S_MAIN.246
! 4 Coarse S_MAIN.247
& ,veg_type(points) ! Vegetation type code S_MAIN.248
! 1 Equitorial rainforest S_MAIN.249
! 2 Pasture and trees S_MAIN.250
! 3 Coniferous forest S_MAIN.251
! 4 Tropical savannah S_MAIN.252
! 5 Pasture S_MAIN.253
! 6 Arable S_MAIN.254
! 7 Tundra S_MAIN.255
! 8 Semi-desert and trees S_MAIN.256
! 9 Desert S_MAIN.257
Real S_MAIN.258
& dtday(points) ! Amplitudes of daily soil temp. S_MAIN.259
! cycle used to calculate initial S_MAIN.260
! soil temperature profile S_MAIN.261
& ,dtyear(points) ! Amplitudes of annual soil temp. S_MAIN.262
! cycle used to calculate initial S_MAIN.263
! soil temperature profile S_MAIN.264
& ,lat(points) ! Lat. of gridpoint chosen S_MAIN.265
! Read automatically from climate S_MAIN.266
! dataset if STATS forcing chosen S_MAIN.267
& ,long(points) ! Long. of gridpoint chosen S_MAIN.268
! Read automatically from climate S_MAIN.269
! dataset if STATS forcing chosen S_MAIN.270
& ,tconst(points) ! Annual mean surface temp. S_MAIN.271
& ,gridbox_area(points) ! Global dimensions = the price of S_MAIN.272
! fish (huge to minimise advective S_MAIN.273
C S_MAIN.274
C &INGEOFOR S_MAIN.275
C S_MAIN.276
Real S_MAIN.277
& ug(points) ! Geostrophic U velocity (m s^-1) S_MAIN.278
& ,vg(points) ! Geostrophic V velocity (m s^-1) S_MAIN.279
C S_MAIN.280
C S_MAIN.281
C &INOBSFOR S_MAIN.282
C S_MAIN.283
Integer S_MAIN.284
& ichgf ! No. of timesteps between change in S_MAIN.285
! observational forcing S_MAIN.286
& ,ilscnt ! Counts for observational forcing S_MAIN.287
Real S_MAIN.288
& flux_e(points,nfor) ! Forcing fluxes for evap. and heat. S_MAIN.289
& ,flux_h(points,nfor) S_MAIN.290
& ,ch_flux_e(points,nfor-1) ! change per sec of flux_e, flux_h S_MAIN.291
& ,ch_flux_h(points,nfor-1) ! S_MAIN.292
& ,tls(points,nfor,nlevs) ! Temp increment due to S_MAIN.293
! large-scale horizontal and vertical S_MAIN.294
! advection (K s^-1 day^-1) S_MAIN.295
& ,ch_tls(points,nfor-1,nlevs) ! Change per sec in Temp increment S_MAIN.296
& ,qls(points,nfor,nwet) ! Specific humidity increment S_MAIN.297
! due to large-scale horizontal S_MAIN.298
! and vertical advection S_MAIN.299
! (Kg Kg^-1 s^-1 day^-1) S_MAIN.300
& ,ch_qls(points,nfor-1,nwet) ! Change per sec in Spec. humid. S_MAIN.301
! increm. S_MAIN.302
& ,uls(points,nfor,nlevs) ! Zonal and meridional wind S_MAIN.303
& ,vls(points,nfor,nlevs) ! increment due to large-scale S_MAIN.304
! horizontal and vertical S_MAIN.305
& ,ch_uls(nfor-1,nlevs) ! Change in Zonal and meridional S_MAIN.306
& ,ch_vls(nfor-1,nlevs) ! wind increm. S_MAIN.307
C S_MAIN.308
C &INPROF S_MAIN.309
C S_MAIN.310
Integer S_MAIN.311
& iccbi(points) ! Convective cloud base and top S_MAIN.312
! Convective cloud base and top S_MAIN.313
& ,iccti(points) ! (model levels) S_MAIN.314
Real S_MAIN.315
& canopyi(points) ! Initial canopy water (Kg m^-2) S_MAIN.316
& ,ccai(points) ! Convective cloud amnt. S_MAIN.317
! (decimal fraction) S_MAIN.318
& ,pstari(points) ! Initial surface pressure (Pa) S_MAIN.319
& ,qi(points,nwet) ! Initial specific humidity S_MAIN.320
! (Kg Kg^-1) S_MAIN.321
& ,smci(points) ! Initial soil moisture content S_MAIN.322
! (Kg m^-2) S_MAIN.323
& ,snodepi(points) ! Initial snow depth (Kg m^-2) S_MAIN.324
& ,t_deep_soili(points,nsoilt_levs) ! Initial deep soil S_MAIN.325
! temps. (K) S_MAIN.326
& ,ti(points,nlevs) ! Initial temp. profile (K) S_MAIN.327
& ,tstari(points) ! Initial surface temp. (K) S_MAIN.328
& ,ui(points,nlevs) ! Initial zonal and meridional S_MAIN.329
& ,vi(points,nlevs) ! wind comps. (m s^-1) S_MAIN.330
& ,z0mseai(points) ! Initial sea surface roughness S_MAIN.331
! length (m) S_MAIN.332
*IF DEF,A08_1A S_MAIN.333
C Standard scheme Global soil parameters S_MAIN.334
C layer_depth - soil layer depth as a multiple of layer 1 depth S_MAIN.335
& ,layer_depth(nsoilt_levs+1) ! soil layer depth ratios S_MAIN.336
*ELSEIF DEF,A08_5A S_MAIN.337
C Global soil parameters for MOSES formulation S_MAIN.338
C This is not used except as local workspace in RUN_INIT S_MAIN.339
& ,layer_depth(nsoilt_levs) ! soil layer depth ratios S_MAIN.340
*ENDIF S_MAIN.341
& ,sil_orog_land(points) ! Silhouette area of unresolved S_MAIN.342
! orography per unit horizontal S_MAIN.343
! area on land points only. S_MAIN.344
& ,ho2r2_orog(points) ! Standard Deviation of orography S_MAIN.345
! equivalent to peak to trough S_MAIN.346
! height of unresolved orography S_MAIN.347
! divided by 2SQRT(2) on land S_MAIN.348
! points only (m) S_MAIN.349
& ,z0_orog_land(points) ! Orographic roughness S_MAIN.350
! length (m) land pts only S_MAIN.351
& ,tracer(points,trlev,ntra) ! Model tracer fields (Kg Kg^-1) S_MAIN.352
& ,di(points) ! Equivalent thickness of sea-ice (m) S_MAIN.353
& ,ice_fract(points) ! Fraction of grid box covered by S_MAIN.354
! sea ice(decimal fraction) S_MAIN.355
& ,u_0(points) ! Westerly & easterly component of S_MAIN.356
& ,v_0(points) ! surface current (metres per second) S_MAIN.357
C S_MAIN.358
C &INMOSES S_MAIN.359
C S_MAIN.360
Real S_MAIN.361
& fsmc(points) ! Soil moisture stress to initialise S_MAIN.362
! SMCL S_MAIN.363
& ,smcli(points,nsoilm_levs) ! Initial values for SMCL (Kg m^-2) S_MAIN.364
& ,sth(points,nsoilm_levs) ! Total soil moisture in layers as a S_MAIN.365
! fraction of saturation S_MAIN.366
Logical S_MAIN.367
& init_m_smcl ! T if MOSES to be initialised by S_MAIN.368
! input of SMCL S_MAIN.369
& ,init_m_fsmc ! T if MOSES to be initialised by S_MAIN.370
! input of FSMC S_MAIN.371
& ,init_m_sth ! T if MOSES to be initialised by S_MAIN.372
! input of STH S_MAIN.373
C S_MAIN.374
C &LOGIC S_MAIN.375
C S_MAIN.376
Logical S_MAIN.377
& altdat ! T if alternative initial profiles S_MAIN.378
! of T,Q,U and V are to be input S_MAIN.379
& ,altsoil ! T if initial soil temperature S_MAIN.380
! profile is to be input rather S_MAIN.381
! than calculated from INITSOIL S_MAIN.382
! layers is input instead of being S_MAIN.383
! calculated S_MAIN.384
& ,ancyc ! T if annual cycle req'd S_MAIN.385
! (ie. radiation input then S_MAIN.386
! varies throughout year) S_MAIN.387
& ,budg_calcs ! T if printout of primary S_MAIN.388
! variables required at beginning S_MAIN.389
! and end of meaning period S_MAIN.390
! so that buget calculations can S_MAIN.391
! be made S_MAIN.392
& ,geoforce ! T if geostrophic forcing. S_MAIN.393
& ,geoinit ! T if initialising dump to S_MAIN.394
! geostrophic. S_MAIN.395
& ,grafdump_day ! T if graphical dump of mean dai S_MAIN.396
! values required S_MAIN.397
& ,grafdump_days ! T if graphical dump of mean val S_MAIN.398
! over DUMP_DAYS required S_MAIN.399
& ,grafdump_step ! T if graphical dump of mean val S_MAIN.400
! required each DUMP_STEP S_MAIN.401
& ,land_mask(points) ! T for a land point S_MAIN.402
& ,lrmbl ! T if rapidly mixing required in S_MAIN.403
& ,l_climate_aerosol ! New switches for E-S radiation. S_MAIN.404
& ,l_use_sulpc_direct ! Flag to use sulphur cycle for S_MAIN.405
! direct effect. S_MAIN.406
& ,l_use_sulpc_indirect ! Flag to use sulphur cycle for S_MAIN.407
! indirect effect. S_MAIN.408
& ,l_sulpc_so2 ! Sulphur Cycle on, tracers to be S_MAIN.409
! scavenged S_MAIN.410
& ,l_sulpc_nh3 ! Indicates if NH3 present S_MAIN.411
& ,l_soot ! Soot included S_MAIN.412
& ,l_use_soot_direct ! Use direct rad. effect of soot S_MAIN.413
! aerosol S_MAIN.414
& ,l_co2_interactive ! Carbon cycle controls use of 3D S_MAIN.415
! co2 field S_MAIN.416
& ,l_net_flux_trop_LW ! Calculate net downward flux at the S_MAIN.417
! tropopause S_MAIN.418
& ,l_net_flux_trop_SW ! Calculate net downward flux at the S_MAIN.419
! tropopause S_MAIN.420
& ,l_up_flux_trop_SW ! Calculate upward flux at the S_MAIN.421
! tropopause S_MAIN.422
& ,l_down_flux_trop_LW ! Calculate downward flux at the S_MAIN.423
! tropopause S_MAIN.424
& ,l_microphysics ! Microphysical Flag S_MAIN.425
& ,l_lspice ! New cloud/precip microphysics S_MAIN.426
& ,l_lspice_bdy ! QCF present in lateral boundaries S_MAIN.427
! Boundary layer physics :- S_MAIN.428
& ,l_bl_lspice ! TRUE Use scientific treatment of S_MAIN.429
! mixed phase precip scheme. S_MAIN.430
! FALSE Do not use mixed phase S_MAIN.431
! precip considerations S_MAIN.432
& ,l_mom ! Switch for convective momentum S_MAIN.433
! transport. S_MAIN.434
& ,l_phenol ! Indicates whether phenology in use S_MAIN.435
& ,l_triffid ! Indicates whether TRIFFID in use. S_MAIN.436
& ,l_neg_tstar ! Switch for -ve TSTAR error check S_MAIN.437
& ,l_xscomp ! Switch for allowing compensating S_MAIN.438
! cooling and drying of the S_MAIN.439
! environment in initiating layer S_MAIN.440
& ,l_sdxs ! Switch for allowing parcel excess S_MAIN.441
! to be set to s.d. of turbulent S_MAIN.442
! fluctuations in lowest model S_MAIN.443
! layer S_MAIN.444
& ,flg_up_flx ! Flag for updraught mass flux S_MAIN.445
& ,flg_dwn_flx ! Flag for downdraght mass flux S_MAIN.446
& ,flg_entr_up ! Flag for updraught entrainment S_MAIN.447
& ,flg_entr_dwn ! Flag for downdraught entrainmn S_MAIN.448
& ,flg_detr_up ! Flag for updraught detrainment S_MAIN.449
& ,flg_detr_dwn ! Flag for downdraught detrainment S_MAIN.450
& ,l_3d_cca ! Switch for use of 3d cloud amount S_MAIN.451
& ,l_ccw ! If .true. then precip not inc. in S_MAIN.452
! conv. cloud water path. S_MAIN.453
& ,l_cloud_deep ! If true limits phase change of S_MAIN.454
! precip if lh will take temp to S_MAIN.455
! other side of tm. S_MAIN.456
& ,l_phase_lim ! IN Switch to determine if phase S_MAIN.457
! change of precip is limited to S_MAIN.458
! ensure lh does not take temp S_MAIN.459
! to other side of tm S_MAIN.460
& ,l_murk ! Aerosol needs scavenging. S_MAIN.461
& ,l_mixlen ! Switch for reducing the turbulent S_MAIN.462
! mixing length above the top of S_MAIN.463
! the boundary layer. S_MAIN.464
& ,l_z0_orog ! T to use simple orog.roughness S_MAIN.465
& ,l_tracer ! switch for inclusion of tracers S_MAIN.466
& ,l_cape ! switch for use of cape closure S_MAIN.467
& ,local_time ! T if diagnostics required S_MAIN.468
! for local time rather than GMT S_MAIN.469
& ,noforce ! T if no large-scale forcing S_MAIN.470
! is required S_MAIN.471
& ,obs ! T if observational S_MAIN.472
! large-scale forcing used S_MAIN.473
& ,prindump_day ! T if printout of mean daily S_MAIN.474
! dump required S_MAIN.475
& ,prindump_days ! T if printout of mean dump S_MAIN.476
! over DUMP_DAYS required S_MAIN.477
& ,prindump_obs ! T if printout of observational S_MAIN.478
! diagnostics required every OBS_ S_MAIN.479
! timesteps S_MAIN.480
& ,prindump_step ! T if printout of mean dump S_MAIN.481
! required each DUMP_STEP S_MAIN.482
& ,prinstat ! T if printout of stats forcing S_MAIN.483
! required every timestep S_MAIN.484
& ,radcloud_fixed ! T if cloud required fixed for S_MAIN.485
! radiation S_MAIN.486
& ,stats ! T if statistical S_MAIN.487
! large-scale forcing used S_MAIN.488
& ,tapein ! T if initial data is to be read S_MAIN.489
! from previous run stored on S_MAIN.490
! tape S_MAIN.491
& ,tapeout ! T if restart information S_MAIN.492
! plus diagnostic output to be S_MAIN.493
! stored on tape S_MAIN.494
& ,test ! T if detailed sub-timestep S_MAIN.495
! diagnostics required S_MAIN.496
& ,lcal360 ! Choose 360 day calendar or not ; S_MAIN.497
& ,ltimer ! Mesure elapsed time in UM S_MAIN.498
! routines S_MAIN.499
& ,l_snow_albedo ! Flag for prognostic snow S_MAIN.500
! Logicals to flag diagnostics S_MAIN.501
! in BDY_LAYR and HYDROL :- S_MAIN.502
& ,l_ssice_albedo ! Flag on the effect of snow on S_MAIN.503
! sea-ice albedo. S_MAIN.504
& ,l_radheat ! True if radheat_rate to be S_MAIN.505
! calculated. S_MAIN.506
& ,sfme ! IN Flag for fme (q.v.). S_MAIN.507
& ,simlt ! IN Flag for sice_mlt_htf (q.v.) S_MAIN.508
& ,smlt ! IN Flag for sice_mlt_htf (q.v.) S_MAIN.509
& ,slh ! IN Flag for latent_heat (q.v.) S_MAIN.510
& ,sq1p5 ! IN Flag for q1p5m (q.v.) S_MAIN.511
& ,st1p5 ! IN Flag for t1p5m (q.v.) S_MAIN.512
& ,su10, sv10 ! IN Flag for u10m & v10m (q.v.) S_MAIN.513
& ,stf_hf_snow_melt ! IN Flag for snow melt heat flux S_MAIN.514
& ,stf_sub_surf_roff ! IN Flag for sub-surface runoff S_MAIN.515
& ,stf_snomlt_sub_htf S_MAIN.516
S_MAIN.517
C S_MAIN.518
C &RUNDATA S_MAIN.519
C S_MAIN.520
Character*8 S_MAIN.521
& exname_in ! Name of expt. to be read S_MAIN.522
! from previous run stored S_MAIN.523
! on tape up to 6 Characters S_MAIN.524
& ,exname_out ! Name of expt. to be written S_MAIN.525
! to tape up to 6 Characters S_MAIN.526
Integer S_MAIN.527
& change_clim ! No. of days between S_MAIN.528
! changes of climatological data S_MAIN.529
! (default=10) S_MAIN.530
& ,dump_days(4) ! No. of days for which mean S_MAIN.531
! dump is required (default=1) S_MAIN.532
& ,ndayin ! No. of days requested in run S_MAIN.533
& ,nminin ! No. of minutes requested in run S_MAIN.534
& ,nsecin ! No. of seconds requested in run S_MAIN.535
& ,ntrad ! No. of timesteps S_MAIN.536
! between calls to radiation S_MAIN.537
& ,ntrad1 ! 1st timestep on which S_MAIN.538
! radiation called S_MAIN.539
& ,obs_print ! No. of timesteps between S_MAIN.540
! production of printed observati S_MAIN.541
! output when observational forci S_MAIN.542
! used S_MAIN.543
& ,obs_print1 ! Initial timestep for production S_MAIN.544
! printed output when observation S_MAIN.545
! forcing used S_MAIN.546
& ,resdump_days ! frequency of dumps for restart S_MAIN.547
& ,start_diagday ! Day to start diagnostics (not O S_MAIN.548
& ,subdat_step ! No. of timesteps between production S_MAIN.549
! of detailed printed output S_MAIN.550
& ,subdat_step1 ! Initial timestep for production of S_MAIN.551
! detailed printed output S_MAIN.552
& ,runno_in ! Number of run to be read S_MAIN.553
! from previous run stored on tape S_MAIN.554
& ,runno_out ! Number of run to be written to tape S_MAIN.555
Real S_MAIN.556
& timestep ! Model timestep for all physics S_MAIN.557
! subroutines except radiation S_MAIN.558
& ,o3(nlevs) ! Mass mixing ratio of ozone S_MAIN.559
& ,co2start S_MAIN.560
& ,co2end S_MAIN.561
& ,co2rate S_MAIN.562
& ,co2_3d(points,nlevs) ! IN 3D CO2 mass mixing ratio S_MAIN.563
C Mass Mixing Ratios of minor Gases N2O,CH4,CFC11,CFC12 S_MAIN.564
C CFC113, HCFC22, HFC125, and HFC134A S_MAIN.565
C for 1A and 1C radiation (& 3A) : S_MAIN.566
& ,o2mmr ! O2 Mass Mixing Ratio (mmr) S_MAIN.567
& ,n2ommr ! N2O mmr S_MAIN.568
& ,ch4mmr ! CH4 mmr S_MAIN.569
& ,c11mmr ! CFC11 mmr S_MAIN.570
& ,c12mmr ! CFC12 mmr S_MAIN.571
& ,cfc113mmr ! CFC113 mmr S_MAIN.572
& ,hcfc22mmr ! HCFC22 mmr S_MAIN.573
& ,hfc125mmr ! HFC125 mmr S_MAIN.574
& ,hfc134ammr ! HFC134 mmr S_MAIN.575
& ,soot(points) ! Snow soot content (mass fraction) S_MAIN.576
& ,rgrain(points) ! Snow grain size (microns) S_MAIN.577
C Constants used to determine the albedo of sea-ice: S_MAIN.578
C Albedo of sea-ice at melting point (TM) if .not.l_ssice_albedo, or S_MAIN.579
C Albedo of snow on sea-ice at melting point (TM) if l_ssice_albedo S_MAIN.580
& ,alpham ! "M" for "melting" S_MAIN.581
C Albedo of sea-ice at and below TM-DTICE if .not.l_ssice_albedo, or S_MAIN.582
C Albedo of snow on sea-ice at and below TM-DTICE if l_ssice_albedo S_MAIN.583
& ,alphac ! "C" for "cold" S_MAIN.584
C Albedo of snow-free sea-ice if l_ssice_albedo S_MAIN.585
& ,alphab ! "B" for "bare" S_MAIN.586
C Temperature range in which albedo of sea-ice, if .not.l_ssice_albedo S_MAIN.587
C or of snow on sea-ice, if l_ssice_albedo, varies between its limits S_MAIN.588
& ,dtice S_MAIN.589
& ,cort(points) ! Vertical correlation coeff. S_MAIN.590
! for temp. S_MAIN.591
& ,cord(points) ! Vertical correlation coeff for S_MAIN.592
! dew pt. depression S_MAIN.593
& ,corvn(points) ! Vertical correlation coeff. S_MAIN.594
! for velocity VN S_MAIN.595
& ,corw(points) ! Vertical correlation coeff. S_MAIN.596
! for vertical velocity S_MAIN.597
c S_MAIN.598
c &PHYSWITCH - switches to switch on/off individual physics S_MAIN.599
c routines :- S_MAIN.600
c 0 = Run normally S_MAIN.601
c 1 = Run for diagnostics but save dump state S_MAIN.602
c 2 = Don't run S_MAIN.603
c S_MAIN.604
S_MAIN.605
Integer S_MAIN.606
& conv_mode ! Mode to run convection S_MAIN.607
& ,ppn_mode ! Mode to run precipitation S_MAIN.608
& ,lw_mode ! Mode to run longwave S_MAIN.609
& ,sw_mode ! Mode to run shortwave S_MAIN.610
& ,bl_mode ! Mode to run boundary layer S_MAIN.611
& ,hyd_mode ! Mode to run hydrology S_MAIN.612
S_MAIN.613
S_MAIN.614
C S_MAIN.615
C--------------------------------------------------------------------- S_MAIN.616
C Initial day of the year and initial time (in seconds) in that day S_MAIN.617
C--------------------------------------------------------------------- S_MAIN.618
C S_MAIN.619
Integer S_MAIN.620
& dayno_init ! Initial day S_MAIN.621
& ,time_initi ! Initial time in seconds (integer) S_MAIN.622
Real S_MAIN.623
& time_init ! Initial time in seconds (real) S_MAIN.624
S_MAIN.625
C S_MAIN.626
C--------------------------------------------------------------------- S_MAIN.627
C Cloud variable values if clouds to be fixed for radiation S_MAIN.628
C--------------------------------------------------------------------- S_MAIN.629
C S_MAIN.630
Integer S_MAIN.631
& iccb_rad(points) ! Model level of base of convective S_MAIN.632
! cloud S_MAIN.633
& ,icct_rad(points) ! Model level of top of convective S_MAIN.634
! cloud S_MAIN.635
Real S_MAIN.636
& cca_rad(points) ! Convective cloud amount (fraction) S_MAIN.637
& ,layer_cloud_rad(points,nwet) ! Layer cloud amount S_MAIN.638
! (fraction) S_MAIN.639
& ,qcl_rad(points,nwet) ! Total cloud water and ice content S_MAIN.640
! over cloud(Kg Kg^-1) S_MAIN.641
& ,qcf_rad(points,nwet) ! Tet to zero as user will usually S_MAIN.642
! input combined cloud water and S_MAIN.643
! ice content over cloud(Kg Kg^-1) S_MAIN.644
! in QCL_RAD. S_MAIN.645
& ,qcl_rad_box(points,nwet) ! Total cloud water and ice content S_MAIN.646
! over whole box as QCL and QCF are S_MAIN.647
! normally calculated by LSCLD over S_MAIN.648
! whole box. S_MAIN.649
& ,qcf_rad_box(points,nwet) ! Set to zero as SWRAD nad LWRAD S_MAIN.650
! expect water and ice content S_MAIN.651
! separate as calculated by LSCLD. S_MAIN.652
& ,ccwpin_rad(points) ! Convective water path over cloud S_MAIN.653
! only (Kg m^-2). S_MAIN.654
& ,ccwpin(points) ! Condensed water path Kg m^-2 S_MAIN.655
& ,mparwtr ! Reservoir of convective cloud water S_MAIN.656
! left in a layer after conv. S_MAIN.657
! precip. S_MAIN.658
& ,anvil_factor ! Needed for calculation of cloud S_MAIN.659
& ,tower_factor ! amount on model levels if S_MAIN.660
! l_3d_cca = .true. S_MAIN.661
& ,ud_factor ! IN factor used in calculation of S_MAIN.662
! ccwp for radiation if l_ccw is S_MAIN.663
! true. S_MAIN.664
S_MAIN.665
S_MAIN.666
C--------------------------------------------------------------------- S_MAIN.667
C Variables for diagnostic output S_MAIN.668
C--------------------------------------------------------------------- S_MAIN.669
C S_MAIN.670
Integer S_MAIN.671
& dump_step ! No. of timesteps between S_MAIN.672
! mean dumps S_MAIN.673
& ,head_label ! Defines which heading S_MAIN.674
! is to be used by DUMP_PRINT S_MAIN.675
& ,nout(19) ! Output units to receive printout of S_MAIN.676
! initial data by PRINT_INITDATA S_MAIN.677
Real S_MAIN.678
& dump(points,nvars,ndump) ! Dump array, set nvars and S_MAIN.679
! ndump in COMDECKS S_MAIN.680
& ,dumpmean_day(points,nvars) ! Dump array of daily means S_MAIN.681
& ,dumpmean_days(points,nvars,4) ! Dump array of mean over S_MAIN.682
! dump_days S_MAIN.683
& ,resdump(points,nprimvars) ! Dump array of restart variables S_MAIN.684
C S_MAIN.685
C--------------------------------------------------------------------- S_MAIN.686
C Large scale observational forcing S_MAIN.687
C--------------------------------------------------------------------- S_MAIN.688
C S_MAIN.689
C Variables for diagnostic output for observational forcing S_MAIN.690
C S_MAIN.691
Real S_MAIN.692
& dap1(points,36,nlevs) ! Instantaneous profiles S_MAIN.693
& ,dap2(points,36,nlevs) ! Mean profiles S_MAIN.694
& ,dap3(points,36,nfor-1,nlevs) ! Mean profiles - timeseries S_MAIN.695
& ,dab1(points,44) ! Instantaneous budgets S_MAIN.696
& ,dab2(points,44) ! Mean budgets S_MAIN.697
& ,dab3(points,44,nfor-1) ! Mean budgets - timeseries S_MAIN.698
& ,deltap(points, nlevs) ! Layer thickness (Pa) S_MAIN.699
& ,factor_rhokh(points) ! used to specify surface flux S_MAIN.700
! from observation S_MAIN.701
Logical printo ! If printout of OBS required S_MAIN.702
C S_MAIN.703
C Variables for budget calculations with OBS forcing S_MAIN.704
C S_MAIN.705
Real S_MAIN.706
& q_init(points,nwet) ! Initial specific humidity (Kg Kg^- S_MAIN.707
& ,t_init(points,nlevs) ! Initial temp (K) S_MAIN.708
S_MAIN.709
S_MAIN.710
C S_MAIN.711
C--------------------------------------------------------------------- S_MAIN.712
C Large scale statistical forcing S_MAIN.713
C--------------------------------------------------------------------- S_MAIN.714
C S_MAIN.715
C S_MAIN.716
C Random generator variables S_MAIN.717
C S_MAIN.718
C S_MAIN.719
Integer S_MAIN.720
& iv(ntab),iy,idum ! Contains info on generator S_MAIN.721
& ,iseed ! Seed for random number generator S_MAIN.722
S_MAIN.723
Integer S_MAIN.724
& dayno_wint ! Day number relative to winter S_MAIN.725
! solstice S_MAIN.726
Real S_MAIN.727
& ad(points,nwet-1) ! Term a of equation 2.22 S_MAIN.728
! for dewpoint depression S_MAIN.729
& ,alfada(points) ! Amplitude and mean of seasonal S_MAIN.730
& ,alfadb(points) ! variation of tuning factor S_MAIN.731
& ,at(points,nlevs-1) ! Term a of equation 2.22 S_MAIN.732
! for dewpoint depression S_MAIN.733
& ,atime,btime ! Constants for calculating S_MAIN.734
! annual cycle S_MAIN.735
& ,avn(points,nlevs-1) ! Term a of equation 2.22 S_MAIN.736
& ,aw(points,ntrop-1) ! for horiz. and vert. vel. S_MAIN.737
& ,cdbar(points,nwet) ! Mean and SD of random variable S_MAIN.738
& ,cdsd(points,nwet) ! for dew pt. depression S_MAIN.739
& ,ctbar(points,nlevs) ! Mean and SD of random variable S_MAIN.740
& ,ctsd(points,nlevs) ! for temp. S_MAIN.741
& ,cvnbar(points,nlevs) ! Mean and SD of random variable S_MAIN.742
& ,cvnsd(points,nlevs) ! for velocity VN S_MAIN.743
& ,cwbar(points,ntrop) ! Mean and SD of random variable S_MAIN.744
& ,cwsd(points,ntrop) ! for vertical velocity S_MAIN.745
& ,dbar(points,nwet) ! Mean dewpoint depression at daycount S_MAIN.746
! days from winter solstice (K) S_MAIN.747
& ,dbara(points,nwet) ! Amplitude and mean of seasonal S_MAIN.748
& ,dbarb(points,nwet) ! variation of mean dew pt. S_MAIN.749
! depression (K) S_MAIN.750
& ,ddash(points,nwet) ! Dew pt depression correction (K) S_MAIN.751
& ,deltan(points) ! Radius of area (m) S_MAIN.752
& ,dgrada(points,nwet) ! Amplitude and mean of seasonal S_MAIN.753
& ,dgradb(points,nwet) ! variation of dew pt. depression S_MAIN.754
! gradient (K km^-1) S_MAIN.755
& ,dsd(points,nwet) ! SD dewpoint depression S_MAIN.756
! at daycount days S_MAIN.757
! from winter solstice (K) S_MAIN.758
& ,p(points,nlevs) ! Pressure (Pa) S_MAIN.759
& ,rp(points,nlevs) ! Reciprocal pressure (HPa) S_MAIN.760
& ,pstara(points) ! Amplitude and mean of seasonal S_MAIN.761
& ,pstarb(points) ! variation of surface pressure (Pa) S_MAIN.762
& ,px(points,ntrop) ! Reciprocal log functions for S_MAIN.763
& ,py(points,ntrop-1) ! calc. of vert. advection S_MAIN.764
! used in eqns 2.12 and 2.13 S_MAIN.765
& ,qr(points,nwet,2) ! Randomly sampled specific S_MAIN.766
! humidity (Kg Kg^-1) S_MAIN.767
& ,tbar(points,nlevs) ! Mean temperature at S_MAIN.768
! daycount days from S_MAIN.769
! winter solstice (K) S_MAIN.770
& ,tbara(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.771
& ,tbarb(points,nlevs) ! variation of temp. (K) S_MAIN.772
& ,tdash(points,nlevs) ! Temp correction (K) S_MAIN.773
& ,tgrada(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.774
& ,tgradb(points,nlevs) ! variation of temp. gradient S_MAIN.775
! (k Km^-1) S_MAIN.776
& ,tr(points,nlevs,2) ! Randomly sampled temp. (K) S_MAIN.777
& ,tsd(points,nlevs) ! SD temp. at daycount days S_MAIN.778
! from winter solstice (K) S_MAIN.779
& ,tsda(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.780
& ,tsdb(points,nlevs) ! variation of SD of temp. (K) S_MAIN.781
& ,vnbar(points,nlevs) ! Mean velocity VN at daycount days S_MAIN.782
! from winter solstice S_MAIN.783
& ,vnbara(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.784
& ,vnbarb(points,nlevs) ! variation of velocity VN (m s^-1) S_MAIN.785
& ,vnr(points,nlevs,2) ! Randomly sampled horizontal S_MAIN.786
! velocity (m s^-1) S_MAIN.787
& ,vnsd(points,nlevs) ! SD velocity VN at daycount S_MAIN.788
! days from winter solstice (m s^-1) S_MAIN.789
& ,vnsda(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.790
& ,vnsdb(points,nlevs) ! variation of SD of velocity VN S_MAIN.791
! (m s^-1) S_MAIN.792
& ,vpbar(points,nlevs) ! Mean velocity VP at daycount days S_MAIN.793
! from winter solstice S_MAIN.794
& ,vpbara(points,nlevs) ! Amplitude and mean of seasonal S_MAIN.795
& ,vpbarb(points,nlevs) ! variation of velocity VP (m s^-1) S_MAIN.796
& ,vpr(points,nlevs,2) ! Randomly sampled horizontal S_MAIN.797
! velocity (m s^-1) S_MAIN.798
& ,wbar(points,ntrop) ! Mean vertical velocity at daycount S_MAIN.799
! days from winter solstice (m s^-1) S_MAIN.800
& ,wbara(points,ntrop) ! Amplitude and mean of seasonal S_MAIN.801
& ,wbarb(points,ntrop) ! variation of SD of vert. vel. S_MAIN.802
! (mb or HPa s^-1) S_MAIN.803
& ,wr(points,ntrop,2) ! Randomly sampled vertical S_MAIN.804
! velocity (HPa or mb s^-1) S_MAIN.805
& ,wsd(points,ntrop) ! SD vertical velocity S_MAIN.806
! at daycount days from S_MAIN.807
! winter solstice (m s^-1) S_MAIN.808
& ,wsda(points,ntrop) ! Amplitude and mean of seasonal S_MAIN.809
& ,wsdb(points,ntrop) ! variation of SD of vert. vel. S_MAIN.810
! (mb s^-1) S_MAIN.811
! roughness length (m) S_MAIN.812
C S_MAIN.813
C===================================================================== S_MAIN.814
C Variables for PHYSICS subroutines S_MAIN.815
C===================================================================== S_MAIN.816
C S_MAIN.817
C--------------------------------------------------------------------- S_MAIN.818
C Boundary layer S_MAIN.819
C--------------------------------------------------------------------- S_MAIN.820
C S_MAIN.821
Real S_MAIN.822
& can_evap(points) ! Mean evaporation from S_MAIN.823
! canopy/surface store S_MAIN.824
! (kg m^-2 s^-1). 0 over sea. S_MAIN.825
& ,fqw(points,nbl_levs) ! Moisture flux between layers S_MAIN.826
! (Kg m^-2 s^-1) S_MAIN.827
! FQW(,1) is total water flux S_MAIN.828
! from surface, 'E'. S_MAIN.829
& ,ftl(points,nbl_levs) ! FTL(,K) contains net turbulent S_MAIN.830
! sensible heat flux into layer S_MAIN.831
! k from below; so FTL(,1) is the S_MAIN.832
! surface sensible heat, H.(W m^-2) S_MAIN.833
& ,latent_heat(points) ! Surface latent heat flux, +ve S_MAIN.834
! upwards (W m^-2) S_MAIN.835
& ,q1p5m(points) ! Q at 1.5 m S_MAIN.836
! (kg water per Kg air) S_MAIN.837
& ,rhokh(points,nbl_levs) ! Exchange coeffs for moisture. S_MAIN.838
! surface:out of SF_EXCH contains S_MAIN.839
S_MAIN.840
! contains only RHOKH. S_MAIN.841
! above surface:out of KMKH cont- S_MAIN.842
! ains GAMMA(1)*RHOKH(,1)*RDZ(,1) S_MAIN.843
& ,rib(points) ! Bulk Richardson number for S_MAIN.844
! lowest layer. S_MAIN.845
& ,sea_ice_htf(points) ! Heat flux through sea-ice S_MAIN.846
! (w m^-2), +ve downwards). S_MAIN.847
& ,sens_heat(points) ! Sensible heat (W m^-2) =FTL(1) S_MAIN.848
& ,sice_mlt_htf(points) ! Sea ice top melt latent heat S_MAIN.849
! flux (W m^-2) S_MAIN.850
& ,soil_evap(points) ! Surface evapotranspiration S_MAIN.851
! through a resistance S_MAIN.852
! which is not entirely S_MAIN.853
! aerodynamic ie. 'soil S_MAIN.854
! evaporation'. Always +ve S_MAIN.855
! (kg m^-2 s^-1) S_MAIN.856
& ,subl_snow(points) ! Sublimation from lying snow S_MAIN.857
! or sea-ice (Kg m^-2 s^-1) S_MAIN.858
& ,t1p5m(points) ! T at 1.5 m (K). S_MAIN.859
! gamma(1)*rhokh, after IMPL_CALC S_MAIN.860
& ,taux(points,nlevs) ! W'ly component of surface wind S_MAIN.861
! stress (N m^-2). On UV-grid; S_MAIN.862
! comments as per rhokm. S_MAIN.863
& ,tauy(points,nlevs) ! S'ly component of surface wind S_MAIN.864
! stress (N m^-2). On UV-grid; S_MAIN.865
! comments as per rhokm. S_MAIN.866
& ,u10m(points) ! U at 10 m (m s^-1). S_MAIN.867
& ,v10m(points) ! V at 10 m (m s^-1). S_MAIN.868
! atm level wind shear S_MAIN.869
C--------------------------------------------------------------------- S_MAIN.870
C Extra diagnostics for MOSES boundary layer code S_MAIN.871
C--------------------------------------------------------------------- S_MAIN.872
*CALL NSTYPES
S_MAIN.873
Real S_MAIN.874
& can_ht(points) ! Canopy height S_MAIN.875
& ,down_surf_sw_b1(points) ! Downward shortwave radiationin S_MAIN.876
! in band 1. Required for hydrology S_MAIN.877
! calculations in MOSES S_MAIN.878
& ,gs(points) ! Stomatal conductance S_MAIN.879
& ,etran(points) ! Transpiration (Kg m^-2 s^-1) S_MAIN.880
& ,gpp(points) ! Gross primary productivity S_MAIN.881
& ,gpp_ft(points,npft) ! OUT Gross primary productivity S_MAIN.882
! on PFTs (kg C/m2/s). S_MAIN.883
& ,leaf_ai(points) ! Leaf area index S_MAIN.884
& ,npp(points) ! Net primary productivity S_MAIN.885
& ,resp_p(points) ! Plant respiration (Kg C m^-2 s^-1) S_MAIN.886
& ,resp_p_ft(points,npft) ! OUT Plant respiration on PFTs S_MAIN.887
! (kg C/m2/s). S_MAIN.888
& ,surf_ht_flux(points) ! Net downward heat flux at S_MAIN.889
! surface surface over land S_MAIN.890
! or sea-ice fraction of S_MAIN.891
! gridbox (W m^-2) S_MAIN.892
Data down_surf_sw_b1 /0.0/ S_MAIN.893
S_MAIN.894
C ! Additional arguments for 7A boundary layer (MOSES II) S_MAIN.895
Integer S_MAIN.896
& tile_index(points,ntype) S_MAIN.897
! OUT Index of tile points. S_MAIN.898
& ,tile_pts(ntype) S_MAIN.899
! OUT Number of tile points. S_MAIN.900
Real S_MAIN.901
& tile_frac(points,ntype) S_MAIN.902
! OUT Tile fractions adjusted for snow. S_MAIN.903
! 1 to ntype-1: snow-free fraction. S_MAIN.904
! ntype:land-ice plus snow fraction. S_MAIN.905
& ,aresist_tile(points,ntype) S_MAIN.906
! OUT 1/(CD_STD*VSHR) on land tiles S_MAIN.907
& ,canht_ft(points,npft) S_MAIN.908
! IN Canopy height (m) S_MAIN.909
& ,canopy_tile(points,ntype-1) S_MAIN.910
! IN Surface/canopy water for S_MAIN.911
! snow-free land tiles (Kg per sq m) S_MAIN.912
& ,catch_tile(points,ntype-1) S_MAIN.913
! IN Surface/canopy water capacity of S_MAIN.914
! snow-free land tiles (Kg per sq m) S_MAIN.915
& ,cs(points) S_MAIN.916
! IN Soil carbon (Kg C m^-2). S_MAIN.917
& ,ecan_tile(points,ntype-1) S_MAIN.918
! OUT ECAN for snow-free land tiles S_MAIN.919
& ,esoil_tile(points,ntype-1) S_MAIN.920
! OUT ES for snow-free land tiles S_MAIN.921
& ,frac(points,ntype) S_MAIN.922
! IN Tile fracs excluding snow cover S_MAIN.923
& ,ftl_tile(points,ntype) S_MAIN.924
! OUT Surface FTL for land tiles S_MAIN.925
& ,g_leaf(points,npft) S_MAIN.926
! OUT Leaf turnover rate (/yr). S_MAIN.927
& ,g_leaf_acc(points,npft) S_MAIN.928
! INOUT Accumulated G_LEAF S_MAIN.929
& ,lai_ft(points,npft) S_MAIN.930
! IN Leaf area index S_MAIN.931
& ,npp_ft(points,npft) S_MAIN.932
! OUT Net primary productivity S_MAIN.933
! (Kg C m^-2 s^-1). S_MAIN.934
& ,npp_ft_acc(points,npft) S_MAIN.935
! INOUT Accumulated NPP_FT S_MAIN.936
& ,rad_no_snow(points) S_MAIN.937
! IN Surface net radiation, snow-free S_MAIN.938
! fraction of gridbox. S_MAIN.939
& ,rad_snow(points) S_MAIN.940
! IN Surface net radiation, snow- S_MAIN.941
! covered fraction of gridbox. S_MAIN.942
& ,resist_b_tile(points,ntype) S_MAIN.943
! OUT (1/CH-1/CD_STD)/VSHR on S_MAIN.944
! land tiles S_MAIN.945
& ,resp_s(points) S_MAIN.946
! OUT Soil respiration S_MAIN.947
! (Kg C m^-2 s^-1). S_MAIN.948
& ,resp_s_acc(points) S_MAIN.949
! INOUT Accumulated RESP_S S_MAIN.950
& ,resp_w_ft(points,npft) S_MAIN.951
! OUT Wood maintenance respiration S_MAIN.952
! (Kg C m^-2 s^-1). S_MAIN.953
& ,resp_w_ft_acc(points,npft) S_MAIN.954
! INOUT Accumulated RESP_W_FT S_MAIN.955
& ,rho_aresist_tile(points,ntype) S_MAIN.956
! OUT rhostar*cd_std*vshr on S_MAIN.957
! land tiles S_MAIN.958
& ,rib_tile(points,ntype) S_MAIN.959
! OUT rib for land tiles. S_MAIN.960
& ,snow_frac(points) S_MAIN.961
! IN Snow fraction. S_MAIN.962
& ,snow_surf_htf(points) S_MAIN.963
! OUT Net downward heat flux at S_MAIN.964
! snow surface (W m^-2). S_MAIN.965
& ,soil_surf_htf(points) S_MAIN.966
! OUT Net downward heat flux at S_MAIN.967
! snow-free land surface (W m^-2) S_MAIN.968
& ,tsnow(points) S_MAIN.969
! IN Snow surface layer temp. (K). S_MAIN.970
& ,tstar_tile(points,ntype) ! S_MAIN.971
! INOUT Surface tile temperature S_MAIN.972
& ,z0v_tile(points,ntype) S_MAIN.973
! IN Tile roughness lengths (m). S_MAIN.974
S_MAIN.975
C--------------------------------------------------------------------- S_MAIN.976
C Sulphur cycle declarations for large scale precip. S_MAIN.977
C--------------------------------------------------------------------- S_MAIN.978
C S_MAIN.979
C Sulphur cycle : It is not implemented in the SCM and must be S_MAIN.980
C switched off, but arguments for GLUE_LSPP must be declared. S_MAIN.981
Real S_MAIN.982
& lscav_so2(points) ! Column totals of scavenged S_MAIN.983
& ,lscav_so4ait(points) ! S Cycle tracers. S_MAIN.984
& ,lscav_so4acc(points) ! S_MAIN.985
& ,lscav_so4dis(points) ! S_MAIN.986
& ,so2(points,nwet) ! Sulphur Cycle tracers for wet S_MAIN.987
& ,so4_ait(points,nwet) ! scavenging. S_MAIN.988
& ,so4_acc(points,nwet) ! S_MAIN.989
& ,so4_dis(points,nwet) ! S_MAIN.990
& ,aerosol(points,nwet) ! Aerosol values ; only used if S_MAIN.991
! l_murk=.true. ; default .false. S_MAIN.992
S_MAIN.993
C S_MAIN.994
C S_MAIN.995
C--------------------------------------------------------------------- S_MAIN.996
C Convection S_MAIN.997
C--------------------------------------------------------------------- S_MAIN.998
C S_MAIN.999
Real S_MAIN.1000
& conv_rain(points) ! Convective rainfall (Kg m^-2 s^-1) S_MAIN.1001
& ,conv_snow(points) ! Convective snowfall (Kg m^-2 s^-1) S_MAIN.1002
& ,dthbydt(points,nlevs) ! Increments to potential temperature S_MAIN.1003
! due to convection (K s^-1) S_MAIN.1004
& ,dqbydt(points,nlevs) ! Increments to mixing ratio S_MAIN.1005
! due to convection (Kg Kg^-1 s^-1) S_MAIN.1006
& ,up_flux(points,nlevs) ! Updraught mass flux S_MAIN.1007
& ,dwn_flux(points,nlevs) ! Downdraught mass flux S_MAIN.1008
& ,entrain_up(points,nlevs) ! Fractioal entrainment S_MAIN.1009
! rate updraughts. S_MAIN.1010
& ,detrain_up(points,nlevs) ! Fractional detrainment rate S_MAIN.1011
! updraughts S_MAIN.1012
& ,entrain_dwn(points,nlevs) ! Fractional detrainment rate S_MAIN.1013
! downdraughts S_MAIN.1014
& ,detrain_dwn(points,nlevs) ! Fractional detrainment rate S_MAIN.1015
C S_MAIN.1016
C--------------------------------------------------------------------- S_MAIN.1017
C Clouds S_MAIN.1018
C--------------------------------------------------------------------- S_MAIN.1019
C S_MAIN.1020
Real S_MAIN.1021
& layer_cloud(points,nwet) ! layer cloud amount S_MAIN.1022
! (decimal fraction) S_MAIN.1023
& ,rhcrit(nwet) ! Critical humidity for cloud S_MAIN.1024
! formation. S_MAIN.1025
S_MAIN.1026
C S_MAIN.1027
C--------------------------------------------------------------------- S_MAIN.1028
C Radiation S_MAIN.1029
C--------------------------------------------------------------------- S_MAIN.1030
C S_MAIN.1031
Integer S_MAIN.1032
& daynumber ! Day in the year (default=1) S_MAIN.1033
& ,year ! Year S_MAIN.1034
Real S_MAIN.1035
& csolrd(points) ! Clear-sky OLR (W m^-2) S_MAIN.1036
& ,csosdi(points) ! Clear-sky outgoing solar S_MAIN.1037
! (W m^-2) at TOA S_MAIN.1038
& ,isdia(points) ! Diagnosed incoming solar at TOA S_MAIN.1039
! (W m^-2) S_MAIN.1040
& ,lwlut(points,len_lw_tables) ! Long wave look-up table S_MAIN.1041
& ,lwout(points,nlevs+1) ! Longwave atmospheric heating S_MAIN.1042
! rates in levels 2,nlevs+1 S_MAIN.1043
! (K/timestep). NET LW flux S_MAIN.1044
! in level 1 S_MAIN.1045
! If sea point LWOUT(1) contains S_MAIN.1046
! net longwave flux over land S_MAIN.1047
! portion (land or land ice) and S_MAIN.1048
! LWSEA that flux over sea portion S_MAIN.1049
& ,lwsea(points) ! Net longwave flux over sea S_MAIN.1050
! portion of grid box if S_MAIN.1051
! sea point (W m^-2) S_MAIN.1052
& ,net_rad(points) ! Net radiation at surface (W m^-2) S_MAIN.1053
& ,olr(points) ! Outgoing LW radiation at TOA S_MAIN.1054
! (W m^-2) S_MAIN.1055
& ,osdia(points) ! Diagnosed actual outgoing solar at S_MAIN.1056
! TOA S_MAIN.1057
& ,swlut(len_sw_tables) ! Short wave look-up table set by S_MAIN.1058
! SWLKIN S_MAIN.1059
& ,swnocz(points,nlevs) ! Shortwave atmospheric heating S_MAIN.1060
& ,swout(points,nlevs+1) ! rates in levels 2,nlevs+1 S_MAIN.1061
! (K/timestep). NET SW flux S_MAIN.1062
! in level 1 - actual values for S_MAIN.1063
! the current physics timestep S_MAIN.1064
& ,swsea(points) ! Net shortwave flux over sea S_MAIN.1065
! portion of grid box if S_MAIN.1066
! sea point (W m^-2) S_MAIN.1067
& ,radheat_rate(points,nbl_levs) ! Radiative heating rates : S_MAIN.1068
! not used in A03_3A, A03_5A, S_MAIN.1069
! A03_5B, A03_7A. but used for A03_6A S_MAIN.1070
& ,tca(points) ! Total cloud amount (decimal S_MAIN.1071
! fraction) S_MAIN.1072
S_MAIN.1073
Data swnocz / nlevs*0. / S_MAIN.1074
C S_MAIN.1075
C--------------------------------------------------------------------- S_MAIN.1076
C Surface quantities S_MAIN.1077
C--------------------------------------------------------------------- S_MAIN.1078
C S_MAIN.1079
Real S_MAIN.1080
& fast_runoff(points) ! Surface runoff (Kg m^-2 s^-1) S_MAIN.1081
& ,hf_snow_melt(points) ! Non-PM Snowmelt heat flux (W m^-2) S_MAIN.1082
& ,snomlt_surf_htf(points) ! Penman-Monteith form. surface S_MAIN.1083
! snow heatflux S_MAIN.1084
& ,snomlt_sub_htf(points) ! Penman-Monteith form. subsurface S_MAIN.1085
! snow heatflux S_MAIN.1086
& ,snow_melt(points) ! Snowmelt (Kg m^-2 s^-1) S_MAIN.1087
& ,sub_surf_roff(points) ! Subsurface runoff (Kg m^-2 s^-1) S_MAIN.1088
& ,throughfall(points) ! Throughfall (Kg m^-2 s^-1) S_MAIN.1089
Data fast_runoff,sub_surf_roff /2* 0.0/ S_MAIN.1090
Data hf_snow_melt,snomlt_surf_htf,snomlt_sub_htf,snow_melt S_MAIN.1091
& /4* 0.0/ S_MAIN.1092
C S_MAIN.1093
C S_MAIN.1094
C--------------------------------------------------------------------- S_MAIN.1095
C Water S_MAIN.1096
C--------------------------------------------------------------------- S_MAIN.1097
C S_MAIN.1098
Real S_MAIN.1099
C & cw_sea(points) ! Cloud liquid water content S_MAIN.1100
! over sea for efficient S_MAIN.1101
! conversion to ppn S_MAIN.1102
C & ,cw_land(points) ! Cloud liquid water content S_MAIN.1103
! over land for efficient S_MAIN.1104
! conversion to ppn S_MAIN.1105
& ls_rain(points) ! Large scale rainfall rate (Kg*m^-2) S_MAIN.1106
& ,ls_snow(points) ! Large scale snowfall rate S_MAIN.1107
! (Kg m^-2 s^-1) S_MAIN.1108
& ,lsrain3d(points,nwet) ! Rain rate out of each level S_MAIN.1109
& ,lssnow3d(points,nwet) ! Snow rate out of each level S_MAIN.1110
S_MAIN.1111
C S_MAIN.1112
C--------------------------------------------------------------------- S_MAIN.1113
C Primary Model Variables plus T (UMDP No1) S_MAIN.1114
C--------------------------------------------------------------------- S_MAIN.1115
C S_MAIN.1116
Integer S_MAIN.1117
& iccb(points) ! Convective cloud base and top S_MAIN.1118
& ,icct(points) ! at levels 1 to nlevs S_MAIN.1119
Real S_MAIN.1120
& canopy(points) ! Canopy water (Kg m^-2) S_MAIN.1121
& ,cca(points,nlevs) ! Convective cloud amount S_MAIN.1122
& ,pstar(points) ! Pressure at earth's surface S_MAIN.1123
! (Pa not hPa) S_MAIN.1124
& ,q(points,nwet) ! Specific humidity (Kg Kg^-1) S_MAIN.1125
& ,qcf(points,nwet) ! Cloud ice content (Kg Kg^-1) S_MAIN.1126
& ,qcl(points,nwet) ! Cloud water content(Kg Kg^-1) S_MAIN.1127
& ,smc(points) ! Soil moisture content(Kg m^-2) S_MAIN.1128
& ,smcl(points,nsoilm_levs) ! Soil moisture content in layers S_MAIN.1129
! (Kg m^-2) S_MAIN.1130
& ,sthf(points,nsoilm_levs) ! Frozen soil moisture content S_MAIN.1131
! of each layer as a fraction of S_MAIN.1132
! saturation. S_MAIN.1133
& ,sthu(points,nsoilm_levs) ! Unfrozen soil moisture content S_MAIN.1134
! of each layer as a fraction of S_MAIN.1135
! saturation. S_MAIN.1136
! (Kg m^-2) S_MAIN.1137
& ,snodep(points) ! Snow depth (Kg m^-2) S_MAIN.1138
& ,t(points,nlevs) ! Temperature(K) S_MAIN.1139
& ,t_deep_soil(points,nsoilt_levs) ! Deep soil temperatures (K) S_MAIN.1140
! top level not included, =surface S_MAIN.1141
& ,theta(points,nlevs) ! Potential temperature (K) S_MAIN.1142
& ,tsi(points) ! Temperature of sea-ice S_MAIN.1143
& ,tstar(points) ! Surface temperature (K) S_MAIN.1144
& ,u(points,nlevs) ! Zonal wind (m s^-1) S_MAIN.1145
& ,v(points,nlevs) ! Meridional wind (m s^-1) S_MAIN.1146
& ,z0msea(points) ! Sea surface roughness length S_MAIN.1147
& ,zh(points) ! Height above surface of top S_MAIN.1148
! of boundary layer (m) S_MAIN.1149
C S_MAIN.1150
C--------------------------------------------------------------------- S_MAIN.1151
C Basic coefficients S_MAIN.1152
C--------------------------------------------------------------------- S_MAIN.1153
C S_MAIN.1154
Real S_MAIN.1155
C & cd(points),ch(points) ! Bulk transfer coeffs S_MAIN.1156
& exner(points,nlevs+1) ! EXNER function for lower boundary S_MAIN.1157
! of layer (K) S_MAIN.1158
C S_MAIN.1159
C--------------------------------------------------------------------- S_MAIN.1160
C Hybrid Coordinates S_MAIN.1161
C--------------------------------------------------------------------- S_MAIN.1162
C S_MAIN.1163
Real S_MAIN.1164
& ak(nlevs) ! Coefficients defining S_MAIN.1165
& ,bk(nlevs) ! Hybrid vertical coordinates S_MAIN.1166
& ,akh(nlevs+1) ! AK,BK at lower level interfaces S_MAIN.1167
& ,bkh(nlevs+1) S_MAIN.1168
& ,delta_ak(nlevs) ! Half level differences S_MAIN.1169
& ,delta_bk(nlevs) S_MAIN.1170
*CALL S_HYBVER
! Effective values of hybrid levels. S_MAIN.1171
S_MAIN.1172
C===================================================================== S_MAIN.1173
C--------------------------------------------------------------------- S_MAIN.1174
C Miscellaneous S_MAIN.1175
C--------------------------------------------------------------------- S_MAIN.1176
C S_MAIN.1177
Integer S_MAIN.1178
& error ! Error indicator for lsppn, S_MAIN.1179
! bdy_layr,lscld S_MAIN.1180
& ,day ! day in year S_MAIN.1181
& ,yearno ! year in run S_MAIN.1182
C S_MAIN.1183
C S_MAIN.1184
Real S_MAIN.1185
& time_sec ! actual time of day in secs. S_MAIN.1186
& ,modug(points) ! Magnitude of Geostrophic wind S_MAIN.1187
! (m s^-1) S_MAIN.1188
& ,f_coriolis(points) ! 2*omega*sin(latitude) S_MAIN.1189
& ,maxinc ! Maximum wind increment from geoinit S_MAIN.1190
& ,rccb(points) ! Real val. cloud base geoint only S_MAIN.1191
& ,rcct(points) ! Real cloud top geoint only S_MAIN.1192
*IF DEF,A03_5A S_MAIN.1193
& ,tstarsav(points) ! Save tstar S_MAIN.1194
*ENDIF S_MAIN.1195
& ,rh(points,nwet,2) ! Diagnosed RH as seen by moist p S_MAIN.1196
C S_MAIN.1197
Character*8 S_MAIN.1198
& time_string ! String containing actual time S_MAIN.1199
C S_MAIN.1200
C==================================================================== S_MAIN.1201
C Specify namelists S_MAIN.1202
C==================================================================== S_MAIN.1203
C S_MAIN.1204
C INDATA Initial data required to run the model S_MAIN.1205
C INOBSFOR Initial data required if observational forcing S_MAIN.1206
C is chosen S_MAIN.1207
C INPROF Inital model profile of the primary variables (UMDP S_MAIN.1208
C No1) plus T, but QCL and QCF initialised by S_MAIN.1209
C subroutine INITQLCF S_MAIN.1210
C INMOSES Data for initialising soil moisture for MOSES code S_MAIN.1211
C RUNDATA Data required for run S_MAIN.1212
C RADCLOUD Cloud values if clouds to be fixed for radiation S_MAIN.1213
C R2SWCLNL & R2LWCLNL in deck CTLNL3A for options of S/LRAD3A. S_MAIN.1214
C-------------------------------------------------------------------- S_MAIN.1215
C S_MAIN.1216
Namelist/INDATA/ soil_type, veg_type, tapeyear_init S_MAIN.1217
& ,tapemonth_init, tapeday_init, tapehour_init, tapemin_init S_MAIN.1218
& ,tapesec_init, year_init, month_init, day_init, hour_init S_MAIN.1219
& ,min_init, sec_init S_MAIN.1220
& ,tconst, dtday, dtyear, lat, long, gridbox_area S_MAIN.1221
& ,iseed S_MAIN.1222
Namelist/INOBSFOR/ tls, qls, uls, vls, ichgf, ilscnt, S_MAIN.1223
& flux_h, flux_e S_MAIN.1224
Namelist/INPROF/ ui, vi, ti, qi, pstari, smci, canopyi, tstari, S_MAIN.1225
& t_deep_soili, snodepi, z0mseai, ccai, iccbi, iccti, rhcrit, S_MAIN.1226
& layer_depth, sil_orog_land, ho2r2_orog, z0_orog_land, S_MAIN.1227
& tracer, di, ice_fract, u_0, v_0 S_MAIN.1228
Namelist/LOGIC/ ancyc, tapein, altdat, altsoil, l_lspice, S_MAIN.1229
& l_lspice_bdy, local_time, tapeout, S_MAIN.1230
& test, obs, stats, prinstat, prindump_step, prindump_day, S_MAIN.1231
& budg_calcs, prindump_days, prindump_obs, land_mask, noforce, S_MAIN.1232
& radcloud_fixed, S_MAIN.1233
& grafdump_step, grafdump_day, grafdump_days, geoforce, geoinit, S_MAIN.1234
& lrmbl, S_MAIN.1235
& l_lspice, l_lspice_bdy, l_bl_lspice, l_mom, S_MAIN.1236
& l_phenol, l_triffid, l_neg_tstar, l_mixlen, l_z0_orog, S_MAIN.1237
& l_climate_aerosol, l_3d_cca, S_MAIN.1238
& l_use_sulpc_direct, l_use_sulpc_indirect, l_sulpc_so2, S_MAIN.1239
& l_sulpc_nh3, l_soot, l_use_soot_direct, l_co2_interactive, S_MAIN.1240
& l_up_flux_trop_sw, l_down_flux_trop_lw, S_MAIN.1241
& l_net_flux_trop_sw, l_net_flux_trop_lw, S_MAIN.1242
& l_microphysics, S_MAIN.1243
& l_xscomp, l_sdxs S_MAIN.1244
& ,flg_up_flx, flg_dwn_flx, flg_entr_up, flg_entr_dwn S_MAIN.1245
& ,flg_detr_up, flg_detr_dwn S_MAIN.1246
& ,l_ccw, l_cloud_deep, l_phase_lim, l_murk, l_tracer, l_cape, S_MAIN.1247
& lcal360, ltimer, l_snow_albedo, l_radheat, l_ssice_albedo S_MAIN.1248
& ,sfme,simlt,smlt,slh,sq1p5,st1p5,su10,sv10 S_MAIN.1249
& ,stf_hf_snow_melt, stf_sub_surf_roff, stf_snomlt_sub_htf S_MAIN.1250
Namelist/RUNDATA/ ndayin, nminin, nsecin, change_clim, ntrad, S_MAIN.1251
& timestep, subdat_step, subdat_step1, ntrad1, resdump_days, S_MAIN.1252
& exname_in, runno_in, exname_out, runno_out, dump_days, S_MAIN.1253
& obs_print, obs_print1, start_diagday, S_MAIN.1254
& co2start, co2end, co2rate, o3, co2_3d, S_MAIN.1255
& o2mmr, n2ommr, ch4mmr, c11mmr, c12mmr, S_MAIN.1256
& cfc113mmr, hcfc22mmr, hfc125mmr, hfc134ammr, S_MAIN.1257
& soot, rgrain, S_MAIN.1258
& alpham, alphac, alphab, dtice, S_MAIN.1259
& cort, cord, corvn, corw S_MAIN.1260
Namelist/RADCLOUD/ cca_rad, iccb_rad, icct_rad, S_MAIN.1261
& layer_cloud_rad, qcl_rad, qcf_rad, ccwpin_rad, S_MAIN.1262
& mparwtr, anvil_factor, tower_factor , ud_factor S_MAIN.1263
Namelist/INMOSES/ init_m_smcl, init_m_fsmc, init_m_sth, S_MAIN.1264
& smcli, fsmc, sth S_MAIN.1265
Namelist/INGEOFOR/ ug, vg S_MAIN.1266
Namelist/PHYSWITCH/ conv_mode, ppn_mode, lw_mode, sw_mode, S_MAIN.1267
& bl_mode, hyd_mode S_MAIN.1268
Namelist/MOSESII/ ecan_tile, frac, canopy_tile, canht_ft, S_MAIN.1269
& catch_tile, cs, lai_ft, z0v_tile, tstar_tile, g_leaf_acc, S_MAIN.1270
& npp_ft_acc, resp_w_ft_acc, resp_s_acc S_MAIN.1271
*IF DEF,A01_3A,AND,DEF,A02_3A S_MAIN.1272
*CALL CTLNL3A
! namelists R2SWCLNL & R2LWCLNL S_MAIN.1273
! for E-S radiation. S_MAIN.1274
*ENDIF S_MAIN.1275
C S_MAIN.1276
C------------------------------------------------------------------- S_MAIN.1277
C Set namelist variables to default values. S_MAIN.1278
C------------------------------------------------------------------- S_MAIN.1279
C S_MAIN.1280
C &INDATA S_MAIN.1281
C S_MAIN.1282
Data iseed /14/ S_MAIN.1283
Data S_MAIN.1284
& year_init, month_init, day_init, hour_init, min_init,sec_init, S_MAIN.1285
& tapeyear_init, tapemonth_init, tapeday_init, tapehour_init, S_MAIN.1286
& tapemin_init, tapesec_init / S_MAIN.1287
& 1998, 1, 1, 0, 0, 0, S_MAIN.1288
& 1998 , 1, 1, 0, S_MAIN.1289
& 0, 0 / S_MAIN.1290
Do i = 1 , points S_MAIN.1291
gridbox_area(i) = 100000 S_MAIN.1292
soil_type(i) = 3 S_MAIN.1293
veg_type(i) = 5 S_MAIN.1294
dtday(i) = 0 S_MAIN.1295
dtyear(i) = 0 S_MAIN.1296
lat(i) = 0 S_MAIN.1297
long(i) = 0 S_MAIN.1298
tconst(i) = 0 S_MAIN.1299
enddo S_MAIN.1300
C S_MAIN.1301
C &INOBSFOR S_MAIN.1302
C S_MAIN.1303
Data ichgf, ilscnt/1, 0/ S_MAIN.1304
Data flux_h/ nfor*0.0/ S_MAIN.1305
Data flux_e/ nfor*0.0/ S_MAIN.1306
S_MAIN.1307
Do i = 1, points S_MAIN.1308
Do j = 1, nfor S_MAIN.1309
Do k = 1, nlevs S_MAIN.1310
tls(i,j,k)= 0.0 S_MAIN.1311
uls(i,j,k)= 0.0 S_MAIN.1312
vls(i,j,k)= 0.0 S_MAIN.1313
enddo S_MAIN.1314
flux_h(i,j)=0.0 S_MAIN.1315
flux_e(i,j)=0.0 S_MAIN.1316
enddo S_MAIN.1317
enddo S_MAIN.1318
Do i = 1, points S_MAIN.1319
Do j = 1, nfor S_MAIN.1320
Do k = 1, nwet S_MAIN.1321
qls(i,j,k) = 0.0 S_MAIN.1322
enddo S_MAIN.1323
enddo S_MAIN.1324
enddo S_MAIN.1325
C S_MAIN.1326
C &INGEOFOR S_MAIN.1327
C S_MAIN.1328
Do i = 1, points S_MAIN.1329
ug(i) = 5.0 S_MAIN.1330
vg(i) = 5.0 S_MAIN.1331
enddo S_MAIN.1332
C S_MAIN.1333
C &INPROF S_MAIN.1334
C S_MAIN.1335
Do i = 1, points S_MAIN.1336
do k = 1, nlevs S_MAIN.1337
ui(i,k) = 0 S_MAIN.1338
vi(i,k) = 0 S_MAIN.1339
ti(i,k) = 0 S_MAIN.1340
enddo S_MAIN.1341
do k = 1, nwet S_MAIN.1342
qi(i,k) = 0 S_MAIN.1343
enddo S_MAIN.1344
Do k = 1, nsoilt_levs S_MAIN.1345
t_deep_soili(i,k) = 0.0 S_MAIN.1346
enddo S_MAIN.1347
S_MAIN.1348
pstari(i) = 100000.0 S_MAIN.1349
smci(i) = 100.0 S_MAIN.1350
canopyi(i) = 0.0 S_MAIN.1351
snodepi(i) = 0.0 S_MAIN.1352
tstari(i) = 0.0 S_MAIN.1353
z0mseai(i) = 1.0 S_MAIN.1354
ccai(i) = 0.3132 S_MAIN.1355
iccbi(i) = 2 S_MAIN.1356
iccti(i) = 8 S_MAIN.1357
enddo S_MAIN.1358
C Values for 3CV onwards S_MAIN.1359
Data rhcrit S_MAIN.1360
& /0.95,0.90,0.85,0.85,0.85, S_MAIN.1361
& 0.85,0.85,0.85,0.85,0.85, S_MAIN.1362
& 0.85,0.85,0.85,0.85,0.85, S_MAIN.1363
& 0.85,0.85,0.85,0.85,0.85/ S_MAIN.1364
*IF DEF,A08_1A S_MAIN.1365
C Standard scheme Global soil parameters S_MAIN.1366
C layer_depth - soil layer depth as a multiple of layer 1 depth S_MAIN.1367
Data layer_depth /1.0, 3.908, 14.05, 44.65/ S_MAIN.1368
*ELSEIF DEF,A08_5A S_MAIN.1369
C Global soil parameters for MOSES formulation S_MAIN.1370
C This is not used except as local workspace in RUN_INIT S_MAIN.1371
Data layer_depth /0.1, 0.25, 0.65, 2.0/ S_MAIN.1372
*ENDIF S_MAIN.1373
Do i = 1, points S_MAIN.1374
Do j = 1, trlev S_MAIN.1375
Do k = 1, ntra S_MAIN.1376
tracer(i,j,k) = 0.0 S_MAIN.1377
enddo S_MAIN.1378
enddo S_MAIN.1379
enddo S_MAIN.1380
Do i = 1, points S_MAIN.1381
di(i) = 0 ! These model variables are set up as S_MAIN.1382
ice_fract(i) = 0 ! constants for a land point. S_MAIN.1383
u_0(i) = 0 S_MAIN.1384
v_0(i) = 0.0 S_MAIN.1385
enddo S_MAIN.1386
C S_MAIN.1387
C &INMOSES S_MAIN.1388
C S_MAIN.1389
Data init_m_smcl /.false./ S_MAIN.1390
Data init_m_fsmc, init_m_sth /2*.false./ S_MAIN.1391
do i = 1, points S_MAIN.1392
do k = 1, nsoilm_levs S_MAIN.1393
smcli(i,k) = 0.0 S_MAIN.1394
sth(i,k) = 0.0 S_MAIN.1395
enddo S_MAIN.1396
fsmc(i) = 0.5 S_MAIN.1397
gs(i) = 1 S_MAIN.1398
enddo S_MAIN.1399
C S_MAIN.1400
C &LOGIC S_MAIN.1401
C S_MAIN.1402
Data ancyc, land_mask, local_time, altdat/ 4*.true./ S_MAIN.1403
Data S_MAIN.1404
& l_lspice, l_lspice_bdy, l_bl_lspice, l_mom, S_MAIN.1405
& l_phenol, l_triffid, l_neg_tstar, l_mixlen, l_z0_orog S_MAIN.1406
& /.false., .false., .false.,.true., S_MAIN.1407
& .false., .false., .false., .true., .false./ S_MAIN.1408
Data S_MAIN.1409
& l_climate_aerosol, l_3d_cca S_MAIN.1410
& / .false., .false. / S_MAIN.1411
Data altsoil, obs, prindump_obs, stats, noforce/ 5*.false./ S_MAIN.1412
Data geoforce, geoinit, lrmbl/ 3*.false./ S_MAIN.1413
Data budg_calcs, test, radcloud_fixed, prinstat/ 4*.false./ S_MAIN.1414
Data prindump_day, prindump_days, prindump_step/ 3*.false./ S_MAIN.1415
Data grafdump_day, grafdump_days, grafdump_step/ 3*.false./ S_MAIN.1416
Data tapein, tapeout/ 2*.false./ S_MAIN.1417
Data l_use_sulpc_direct, l_use_sulpc_indirect /2*.false./ S_MAIN.1418
Data l_sulpc_so2 /.false./ ! T if Sulphur cycle on. S_MAIN.1419
Data l_sulpc_nh3 /.false./ ! T if Sulphur cycle on. S_MAIN.1420
Data l_soot, l_use_soot_direct /.false.,.false./ S_MAIN.1421
Data l_co2_interactive /.false./ S_MAIN.1422
Data l_microphysics /.false./ S_MAIN.1423
Data l_xscomp, l_sdxs, l_ccw, l_murk /4*.false./ S_MAIN.1424
Data l_cloud_deep, l_phase_lim /2*.true./ S_MAIN.1425
Data flg_up_flx, flg_dwn_flx, flg_entr_up, flg_entr_dwn S_MAIN.1426
& ,flg_detr_up, flg_detr_dwn /6*.false./ S_MAIN.1427
Data S_MAIN.1428
& l_up_flux_trop_sw, l_down_flux_trop_lw, S_MAIN.1429
& l_net_flux_trop_sw, l_net_flux_trop_lw S_MAIN.1430
& /4*.false./ S_MAIN.1431
Data lcal360, ltimer / .false., .false. / S_MAIN.1432
Data l_snow_albedo, l_ssice_albedo / .false., .false. / S_MAIN.1433
Data sfme,simlt,smlt,slh,sq1p5,st1p5,su10,sv10 S_MAIN.1434
& ,stf_hf_snow_melt, stf_sub_surf_roff, stf_snomlt_sub_htf S_MAIN.1435
& / 11 * .true. / S_MAIN.1436
Data l_radheat /.false./ S_MAIN.1437
C S_MAIN.1438
C &RUNDATA S_MAIN.1439
C S_MAIN.1440
Data dump_days, start_diagday / 5*1/ S_MAIN.1441
Data resdump_days, change_clim/ 1, 10/ S_MAIN.1442
Data exname_in, exname_out/ 'XXXXXXXX', 'XXXXXXXX'/ S_MAIN.1443
Data ndayin, timestep, ntrad, ntrad1/ 1, 1800.0, 6, 1/ S_MAIN.1444
Data nminin, nsecin/2*0/ S_MAIN.1445
Data subdat_step, subdat_step1/ 2*1/ S_MAIN.1446
Data runno_in, runno_out/ 0, 999/ S_MAIN.1447
Data obs_print, obs_print1/ 2*1/ S_MAIN.1448
Data co2start / 4.9E-4 / S_MAIN.1449
Data co2end / 4.9E-4 / S_MAIN.1450
Data co2rate / 0.0 / S_MAIN.1451
Data o3 ! U.M. mean annual values -: S_MAIN.1452
& /11 * 7.51254E-08 S_MAIN.1453
& ,2.00281E-07, 3.25461E-07, 3.25529E-07 S_MAIN.1454
& ,1.25218E-06, 3.22454E-06, 6.84375E-06 S_MAIN.1455
& ,1.12713E-05, 1.16831E-05, 1.16831E-05/ S_MAIN.1456
Do i = 1, points S_MAIN.1457
Do k = 1, nlevs S_MAIN.1458
co2_3d(i,k) = 4.9e-4 S_MAIN.1459
enddo S_MAIN.1460
enddo S_MAIN.1461
C These values were taken from UMUI vn4.0 24/4/96 S_MAIN.1462
Data o2mmr /0.2314 / S_MAIN.1463
Data n2ommr /4.71E-7 / S_MAIN.1464
Data ch4mmr /9.5E-7 / S_MAIN.1465
Data c11mmr /1.33E-9 / S_MAIN.1466
Data c12mmr /2.09E-9 / S_MAIN.1467
Data cfc113mmr / 10.E-12 / S_MAIN.1468
Data hcfc22mmr / 10.E-12 / S_MAIN.1469
Data hfc125mmr / 10.E-12 / S_MAIN.1470
Data hfc134ammr / 10.E-12 / S_MAIN.1471
S_MAIN.1472
C N.B. These values are guessed for SCM purposes. S_MAIN.1473
Data alpham, alphac, alphab, dtice / 0.6, 0.85, 0.4, 5.0 / S_MAIN.1474
C sets vertical correlation coefficients S_MAIN.1475
Data cort, cord, corvn, corw / 0.9, 0.9, 0.5, 0.5 / S_MAIN.1476
S_MAIN.1477
Do i = 1, points S_MAIN.1478
Do k = 1, nwet S_MAIN.1479
lscav_so2(i) = 0.0 S_MAIN.1480
lscav_so4ait(i) = 0.0 S_MAIN.1481
lscav_so4acc(i) = 0.0 S_MAIN.1482
lscav_so4dis(i) = 0.0 S_MAIN.1483
so2(i,k) = 0.0 S_MAIN.1484
so4_ait(i,k) = 0.0 S_MAIN.1485
so4_acc(i,k) = 0.0 S_MAIN.1486
so4_dis(i,k) = 0.0 S_MAIN.1487
aerosol(i,k) = 0.0 S_MAIN.1488
enddo S_MAIN.1489
enddo S_MAIN.1490
C S_MAIN.1491
C &RADCLOUD S_MAIN.1492
C S_MAIN.1493
Data mparwtr, anvil_factor, tower_factor /1.0000e-03, 0.0, 0.0/ S_MAIN.1494
Data ud_factor / 1.000 / S_MAIN.1495
Do i = 1, points S_MAIN.1496
do k = 1, nwet S_MAIN.1497
layer_cloud_rad(i,k) = 0.0 S_MAIN.1498
qcl_rad(i,k) = 0.0 S_MAIN.1499
qcf_rad(i,k) = 0.0 S_MAIN.1500
enddo S_MAIN.1501
cca_rad(i) = 0.3132 S_MAIN.1502
ccwpin_rad(i) = 0.0 S_MAIN.1503
ccwpin(i) = 1.0 S_MAIN.1504
iccb_rad(i) = 2 S_MAIN.1505
icct_rad(i) = 8 S_MAIN.1506
enddo S_MAIN.1507
C S_MAIN.1508
C &PHYSWITCH S_MAIN.1509
C S_MAIN.1510
Data conv_mode,ppn_mode,lw_mode,sw_mode,bl_mode,hyd_mode /6*0/ S_MAIN.1511
C S_MAIN.1512
C Zero ls_rain & ls_snow arrays S_MAIN.1513
Do i = 1, points S_MAIN.1514
Do k = 1, nwet S_MAIN.1515
lsrain3d(i,k)=0 S_MAIN.1516
lssnow3d(i,k)=0 S_MAIN.1517
enddo S_MAIN.1518
ls_rain(i) = 0.0 S_MAIN.1519
ls_snow(i) = 0.0 S_MAIN.1520
enddo S_MAIN.1521
S_MAIN.1522
C S_MAIN.1523
C--------------------------------------------------------------------- S_MAIN.1524
C Read in NAMELISTS S_MAIN.1525
C--------------------------------------------------------------------- S_MAIN.1526
C S_MAIN.1527
S_MAIN.1528
Read(5,INDATA) S_MAIN.1529
Read(5,RUNDATA) S_MAIN.1530
Read(5,LOGIC) S_MAIN.1531
If ((stats .and. obs) .or. (stats .and. noforce) S_MAIN.1532
& .or. (stats .and. geoforce) .or. (obs .and. geoforce) S_MAIN.1533
& .or. (geoforce .and. noforce) .or. (obs .and. noforce)) then S_MAIN.1534
Print *, S_MAIN.1535
& 'stats,obs,geoforce or noforce set wrongly - cannot', S_MAIN.1536
& ' have more than one set to true!' S_MAIN.1537
Stop S_MAIN.1538
elseif ((.not. stats) .and. (.not. obs) S_MAIN.1539
& .and. (.not. noforce) .and. (.not. geoforce)) then S_MAIN.1540
Print *, S_MAIN.1541
& 'stats,obs,geoforce or noforce set wrongly - must have', S_MAIN.1542
& ' one set to true !' S_MAIN.1543
Stop S_MAIN.1544
elseif (l_use_soot_direct .or. l_soot) then S_MAIN.1545
Print *, S_MAIN.1546
& 'l_use_soot_direct & l_soot must be set to false: ', S_MAIN.1547
& 'the soot chemistery is not implemented yet.' S_MAIN.1548
Stop S_MAIN.1549
endif S_MAIN.1550
C No of levels for Convective Cloud Amount. S_MAIN.1551
If (l_3d_cca) then S_MAIN.1552
n_cca_lev = nwet S_MAIN.1553
else S_MAIN.1554
n_cca_lev = 1 S_MAIN.1555
endif S_MAIN.1556
S_MAIN.1557
Read(5,PHYSWITCH) S_MAIN.1558
S_MAIN.1559
C Check correct values of physics switches S_MAIN.1560
S_MAIN.1561
If (conv_mode .lt. 0 .or. conv_mode .gt. 2) then S_MAIN.1562
Print *, ' CONV_MODE must be 0,1 or 2' S_MAIN.1563
Stop S_MAIN.1564
elseif (ppn_mode .lt. 0 .or. ppn_mode .gt. 2) then S_MAIN.1565
Print *, ' PPN_MODE must be 0,1 or 2' S_MAIN.1566
Stop S_MAIN.1567
elseif (bl_mode .lt. 0 .or. bl_mode .gt. 2) then S_MAIN.1568
Print *, ' BL_MODE must be 0,1 or 2' S_MAIN.1569
Stop S_MAIN.1570
elseif (hyd_mode .lt. 0 .or. hyd_mode .gt. 2) then S_MAIN.1571
Print *, ' HYD_MODE must be 0,1 or 2' S_MAIN.1572
Stop S_MAIN.1573
elseif (sw_mode .lt. 0 .or. sw_mode .gt. 2) then S_MAIN.1574
Print *, ' SW_MODE must be 0,1 or 2' S_MAIN.1575
Stop S_MAIN.1576
elseif (lw_mode .lt. 0 .or. lw_mode .gt. 2) then S_MAIN.1577
Print *, ' SW_MODE must be 0,1 or 2' S_MAIN.1578
Stop S_MAIN.1579
endif S_MAIN.1580
S_MAIN.1581
C Check that if HYDROLOGY or BOUNDARY layer are switched on that S_MAIN.1582
C RADIATION is also switched on S_MAIN.1583
S_MAIN.1584
If ((hyd_mode .eq. 0 .or. hyd_mode .eq. 1) .and. S_MAIN.1585
& ((bl_mode.ne.0) .or. (sw_mode.ne.0) .or. (lw_mode.ne.0))) then S_MAIN.1586
Print *, S_MAIN.1587
& ' If HYDROLOGY is switched on,', S_MAIN.1588
& ' Radiation and Boundary layer must be Switched on for ', S_MAIN.1589
& ' full run ' S_MAIN.1590
Stop S_MAIN.1591
endif S_MAIN.1592
If ((bl_mode .eq. 0 .or. bl_mode .eq. 1) S_MAIN.1593
& .and. ((hyd_mode.ne.0) .or. (sw_mode.ne.0) S_MAIN.1594
& .or. (lw_mode.ne.0))) then S_MAIN.1595
Print *, S_MAIN.1596
& ' If BOUNDARY LAYER is switched on,', S_MAIN.1597
& ' Radiation and Hydrology must be Switched on for full', S_MAIN.1598
& ' run ' S_MAIN.1599
Stop S_MAIN.1600
endif S_MAIN.1601
S_MAIN.1602
*IF DEF,A08_5A S_MAIN.1603
Do i = 1, points S_MAIN.1604
If (.not. land_mask (i) ) then S_MAIN.1605
Print *, ' You have chosen a sea-point for MOSES! ' S_MAIN.1606
Stop S_MAIN.1607
endif S_MAIN.1608
enddo S_MAIN.1609
Read(5,INMOSES) S_MAIN.1610
If ((init_m_smcl .and. init_m_fsmc) .or. S_MAIN.1611
& (init_m_smcl .and. init_m_sth) .or. S_MAIN.1612
& (init_m_fsmc .and. init_m_sth)) then S_MAIN.1613
Print *, S_MAIN.1614
& ' MOSES initialisation set wrong - cannot have more', S_MAIN.1615
& ' than one set to TRUE' S_MAIN.1616
Stop S_MAIN.1617
endif S_MAIN.1618
*ENDIF S_MAIN.1619
Read(5,INPROF) S_MAIN.1620
If (geoforce) then S_MAIN.1621
Read(5,INGEOFOR) S_MAIN.1622
endif S_MAIN.1623
If (obs) then S_MAIN.1624
Read(5,INOBSFOR) S_MAIN.1625
endif S_MAIN.1626
C S_MAIN.1627
C If the user has specified the values for fixed cloud for S_MAIN.1628
C radiation, conv the cloud water and ice content to the average S_MAIN.1629
C over the whole grid box S_MAIN.1630
C S_MAIN.1631
If (radcloud_fixed) then S_MAIN.1632
Read(5,RADCLOUD) S_MAIN.1633
do i = 1, points S_MAIN.1634
Do k = 1, nwet S_MAIN.1635
qcl_rad_box(i,k) = qcl_rad(i,k) * layer_cloud_rad(i,k) S_MAIN.1636
qcf_rad_box(i,k) = 0.0 S_MAIN.1637
enddo S_MAIN.1638
enddo S_MAIN.1639
endif S_MAIN.1640
S_MAIN.1641
C S_MAIN.1642
C Read namelists for S/LRAD3A algorithmic options S_MAIN.1643
C S_MAIN.1644
*IF DEF,A01_3A,AND,DEF,A02_3A S_MAIN.1645
Read(5,R2SWCLNL) S_MAIN.1646
Read(5,R2LWCLNL) S_MAIN.1647
*ENDIF S_MAIN.1648
C S_MAIN.1649
C Read namelists for MOSESII S_MAIN.1650
C S_MAIN.1651
read(5,MOSESII) S_MAIN.1652
S_MAIN.1653
C S_MAIN.1654
C Derive the initial daynumber in the year and the initial time S_MAIN.1655
C from the UM data structure supplied S_MAIN.1656
C S_MAIN.1657
Call INITTIME
(year_init, month_init, day_init, hour_init, S_MAIN.1658
& min_init, sec_init, dayno_init, time_initi, lcal360) S_MAIN.1659
time_init = time_initi ! type real expected elsewhere. S_MAIN.1660
C S_MAIN.1661
C Initial tape daynumber in the year is the same as the initial S_MAIN.1662
C daynumber S_MAIN.1663
C S_MAIN.1664
tapeday_init = dayno_init S_MAIN.1665
S_MAIN.1666
C S_MAIN.1667
C S_MAIN.1668
C--------------------------------------------------------------------- S_MAIN.1669
C Write header to graphical dump file for use with wave user S_MAIN.1670
C interface. S_MAIN.1671
C--------------------------------------------------------------------- S_MAIN.1672
C S_MAIN.1673
Call write_header
( S_MAIN.1674
& 37, nlevs, nwet, nbl_levs S_MAIN.1675
& ,nsoilt_levs, nsoilm_levs, ntype S_MAIN.1676
& ,timestep, ntrad, ndayin, nminin, nsecin, ndump S_MAIN.1677
& ,ak, bk, akh, bkh, .false. S_MAIN.1678
& ) S_MAIN.1679
C S_MAIN.1680
C--------------------------------------------------------------------- S_MAIN.1681
C Initialise the array giving the unit nos. for output of the S_MAIN.1682
C initial data S_MAIN.1683
C--------------------------------------------------------------------- S_MAIN.1684
C S_MAIN.1685
Data nout / 19*0 / S_MAIN.1686
C S_MAIN.1687
C--------------------------------------------------------------------- S_MAIN.1688
C Set up the unit nos. for output. S_MAIN.1689
C--------------------------------------------------------------------- S_MAIN.1690
C S_MAIN.1691
S_MAIN.1692
nout(1)=6 S_MAIN.1693
If (test) nout(2) = 22 S_MAIN.1694
If (prindump_step) nout(3) = 30 S_MAIN.1695
If (prindump_day) nout(4) = 31 S_MAIN.1696
If (prindump_days) then S_MAIN.1697
If (dump_days(1) .gt. 1) nout(5) = 32 S_MAIN.1698
If (dump_days(2) .gt. 1) nout(6) = 33 S_MAIN.1699
If (dump_days(3) .gt. 1) nout(7) = 34 S_MAIN.1700
If (dump_days(4) .gt. 1) nout(8) = 35 S_MAIN.1701
endif S_MAIN.1702
If (grafdump_step) nout(9) = 37 S_MAIN.1703
If (grafdump_day) nout(10) = 38 S_MAIN.1704
If (grafdump_days) then S_MAIN.1705
If (dump_days(1) .gt. 1) nout(11) = 39 S_MAIN.1706
If (dump_days(2) .gt. 1) nout(12) = 40 S_MAIN.1707
If (dump_days(3) .gt. 1) nout(13) = 41 S_MAIN.1708
If (dump_days(4) .gt. 1) nout(14) = 42 S_MAIN.1709
endif S_MAIN.1710
If (obs .and. prindump_obs) then S_MAIN.1711
Do i = 1, 5 S_MAIN.1712
nout(i+14) = 42 + i S_MAIN.1713
enddo S_MAIN.1714
endif S_MAIN.1715
C S_MAIN.1716
C--------------------------------------------------------------------- S_MAIN.1717
C Write out initial data for run to standard output and to all S_MAIN.1718
C the units to which diagnostics will be written. S_MAIN.1719
C--------------------------------------------------------------------- S_MAIN.1720
C S_MAIN.1721
Call PRINT_INITDATA
( S_MAIN.1722
& points, nlevs, nwet, nozone, S_MAIN.1723
& nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop, S_MAIN.1724
& year_init, dayno_init, ndayin, nminin, nsecin, S_MAIN.1725
& timestep, ntrad, lat, S_MAIN.1726
& long, ancyc, local_time, change_clim, exname_in, runno_in, S_MAIN.1727
& exname_out, runno_out, veg_type, soil_type, altsoil, tconst, S_MAIN.1728
& dtday, dtyear, land_mask, obs, geoforce, geoinit, S_MAIN.1729
& stats, noforce, tapein, tapeout, init_m_smcl, init_m_fsmc, S_MAIN.1730
& init_m_sth, smcli, fsmc, sth, S_MAIN.1731
& ug, vg, S_MAIN.1732
& conv_mode, ppn_mode, lw_mode, sw_mode, bl_mode, hyd_mode, S_MAIN.1733
& altdat, tls, qls, uls, vls, ichgf, ilscnt, flux_h, flux_e, S_MAIN.1734
& ui, vi, ti, qi, ccai, iccbi, iccti, pstari, canopyi, smci, S_MAIN.1735
& snodepi, t_deep_soili, tstari, z0mseai, ntrad1, start_diagday, S_MAIN.1736
& radcloud_fixed, cca_rad, iccb_rad, icct_rad, ccwpin_rad, S_MAIN.1737
& layer_cloud_rad, qcl_rad, time_init, o3, nout, 19) S_MAIN.1738
C S_MAIN.1739
C--------------------------------------------------------------------- S_MAIN.1740
C Control variables : output, number of days etc S_MAIN.1741
C--------------------------------------------------------------------- S_MAIN.1742
C S_MAIN.1743
full_daysteps = int(sec_day/timestep) S_MAIN.1744
nstepsin = int((nminin*60 + nsecin)/timestep) S_MAIN.1745
dump_step = int(sec_dump/timestep) S_MAIN.1746
Do i = 1, points S_MAIN.1747
deltan(i) = 1000. * sqrt(gridbox_area(i)/pi) S_MAIN.1748
enddo S_MAIN.1749
C S_MAIN.1750
C--------------------------------------------------------------------- S_MAIN.1751
C Zero mean dump (for DUMP_DAYS) S_MAIN.1752
C--------------------------------------------------------------------- S_MAIN.1753
C S_MAIN.1754
Do i = 1, points S_MAIN.1755
Do j = 1, nvars S_MAIN.1756
Do k = 1, 4 S_MAIN.1757
dumpmean_days(i,j,k) = 0. S_MAIN.1758
enddo S_MAIN.1759
enddo S_MAIN.1760
enddo S_MAIN.1761
c S_MAIN.1762
error = 0 S_MAIN.1763
C--------------------------------------------------------------------- S_MAIN.1764
C Set model variables to default values. S_MAIN.1765
C--------------------------------------------------------------------- S_MAIN.1766
C--------------------------------------------------------------------- S_MAIN.1767
C large scale cloud S_MAIN.1768
C--------------------------------------------------------------------- S_MAIN.1769
C S_MAIN.1770
If (nwet .gt. nlevs) then S_MAIN.1771
Print *, S_MAIN.1772
& ' ****Error****nwet cannot be greater than nlevs******' S_MAIN.1773
Stop S_MAIN.1774
endif S_MAIN.1775
If (nclds .gt. nwet) then S_MAIN.1776
print *, S_MAIN.1777
& ' ****Error****nclds cannot be greater than nwet******' S_MAIN.1778
Stop S_MAIN.1779
endif S_MAIN.1780
S_MAIN.1781
Do i = 1, points S_MAIN.1782
Do k = 1, nwet S_MAIN.1783
layer_cloud(i,k) = 0.0 S_MAIN.1784
qcl(i,k) = 1.0e-2 S_MAIN.1785
qcf(i,k) = 1.0e-2 S_MAIN.1786
enddo S_MAIN.1787
enddo S_MAIN.1788
daynumber = dayno_init S_MAIN.1789
year = 1 S_MAIN.1790
S_MAIN.1791
C Zero some output radiation arrays. S_MAIN.1792
Do i = 1, points S_MAIN.1793
Do k = 1, nlevs+1 S_MAIN.1794
lwout(i,k) = 0 S_MAIN.1795
swout(i,k) = 0 S_MAIN.1796
enddo S_MAIN.1797
olr(i) = 0 S_MAIN.1798
csolrd(i) = 0 S_MAIN.1799
tca(i) = 0 S_MAIN.1800
enddo S_MAIN.1801
C S_MAIN.1802
C===================================================================== S_MAIN.1803
C Options to set initial profiles S_MAIN.1804
C===================================================================== S_MAIN.1805
C (i) Observational large scale forcing (OBS=TRUE of S_MAIN.1806
C Namelist LOGIC) S_MAIN.1807
C Initial data is then from namelist INPROF S_MAIN.1808
C (ii) Statistical large scale forcing (STATS=TRUE of S_MAIN.1809
C Namelist LOGIC) S_MAIN.1810
C Initial data can either be derived from climate datasets S_MAIN.1811
C using subroutine INITSTAT or set from namelist S_MAIN.1812
C INPROF (set ALTDAT=TRUE in namelist LOGIC) S_MAIN.1813
C (iii) No large-scale forcing initial data is set from namelist S_MAIN.1814
C INPROF S_MAIN.1815
C (iv) Continuation from previous run stored on tape S_MAIN.1816
C (Set TAPEIN=TRUE in namelist LOGIC). All other initial data S_MAIN.1817
C is overwritten S_MAIN.1818
C======sth============================================================ S_MAIN.1819
C S_MAIN.1820
Call RUN_INIT
( S_MAIN.1821
C ! IN leading dimensions of arrays S_MAIN.1822
& points, nlevs, nwet S_MAIN.1823
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.1824
& ,nprimvars S_MAIN.1825
C ! S_MAIN.1826
& ,stats, obs, prindump_obs, noforce, altdat S_MAIN.1827
& ,land_mask, altsoil, tapein, tapeout S_MAIN.1828
& ,l_climate_aerosol, l_use_sulpc_direct, ltimer S_MAIN.1829
& ,l_ch4_lw, l_n2o_lw, l_cfc11_lw, l_cfc12_lw S_MAIN.1830
& ,l_cfc113_lw, l_hcfc22_lw, l_hfc125_lw, l_hfc134a_lw S_MAIN.1831
& ,l_o2_sw S_MAIN.1832
& ,l_use_soot_direct S_MAIN.1833
& ,init_m_smcl, init_m_fsmc, init_m_sth S_MAIN.1834
& ,smcli, fsmc, sth, geoforce, geoinit, ug, vg S_MAIN.1835
& ,year_init, dayno_init, lcal360, ichgf, timestep, ndayin S_MAIN.1836
& ,resdump_days, soil_type, veg_type, layer_depth S_MAIN.1837
& ,pstari, smci, canopyi, snodepi, tstari, t_deep_soili S_MAIN.1838
& ,z0mseai, ui, vi, ti, qi, ccai, iccbi, iccti S_MAIN.1839
& ,time_init, tconst, dtday, dtyear, tapeday_init S_MAIN.1840
& ,exname_in, exname_out, runno_in, runno_out, theta S_MAIN.1841
& ,u, v, t, q, flux_h, flux_e, uls, vls, tls, qls, exner S_MAIN.1842
& ,ch_flux_h, ch_flux_e, ch_uls, ch_vls, ch_tls, ch_qls S_MAIN.1843
& ,dap1, dap2, dap3, dab1, dab2, dab3, deltap, pstar S_MAIN.1844
& ,smc, smcl, canopy, snodep, tstar, tsi, t_deep_soil S_MAIN.1845
& ,sthu,sthf,gs S_MAIN.1846
& ,z0msea, zh, cca, iccb, icct, layer_cloud, qcf, qcl S_MAIN.1847
& ,dayno_wint, alfada, alfadb, atime, btime, lat, long S_MAIN.1848
& ,dbara, dbarb, dgrada, dgradb, pstara, pstarb S_MAIN.1849
& ,tbara, tbarb, tgrada, tgradb, tsda, tsdb S_MAIN.1850
& ,vnbara, vnbarb, vnsda, vnsdb S_MAIN.1851
& ,vpbara, vpbarb, wbara, wbarb, wsda, wsdb S_MAIN.1852
& ,iv, ntab, iy, idum, iseed, resdump S_MAIN.1853
& ,rhcrit ! IN : Critical relative humidities S_MAIN.1854
! IN model levels. S_MAIN.1855
& ,ak, bk ! Coefficients defining S_MAIN.1856
! hybrid vertical coordinates S_MAIN.1857
& ,akh, bkh ! AK,BK at lower level interfaces S_MAIN.1858
! S_MAIN.1859
& ,delta_ak, delta_bk S_MAIN.1860
& ,lwlut, swlut ) S_MAIN.1861
S_MAIN.1862
C Set dimensions of _SULPHATE arrays for passing to Physics S_MAIN.1863
C (avoids wasting space if aerosol not required) S_MAIN.1864
If (l_use_sulpc_direct .or. l_use_sulpc_indirect) then S_MAIN.1865
sulp_dim1 = points S_MAIN.1866
sulp_dim2 = nlevs S_MAIN.1867
else S_MAIN.1868
sulp_dim1 = 1 S_MAIN.1869
sulp_dim2 = 1 S_MAIN.1870
endif S_MAIN.1871
C S_MAIN.1872
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.1873
C For geostrophic forcing S_MAIN.1874
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.1875
C S_MAIN.1876
do i = 1, points S_MAIN.1877
f_coriolis(i) = 2.0 * omega * sin(lat(i) * pi_over_180) S_MAIN.1878
enddo S_MAIN.1879
c S_MAIN.1880
If (geoinit .and. geoforce) then S_MAIN.1881
Do i = 1, points S_MAIN.1882
modug(i) = sqrt(ug(i)*ug(i) + vg(i)*vg(i)) S_MAIN.1883
Do k = 1, nlevs S_MAIN.1884
u(k,i) = ug(i) S_MAIN.1885
v(k,i) = vg(i) S_MAIN.1886
enddo S_MAIN.1887
enddo S_MAIN.1888
C S_MAIN.1889
C--------------------------------------------------------------------- S_MAIN.1890
C Form restart dump S_MAIN.1891
C--------------------------------------------------------------------- S_MAIN.1892
C S_MAIN.1893
Do i = 1, points S_MAIN.1894
Do k = 1, nprimvars S_MAIN.1895
resdump(i,k) = 0.0 S_MAIN.1896
enddo S_MAIN.1897
enddo S_MAIN.1898
Call RESTART_DUMP
( S_MAIN.1899
! IN dimensions of main arrays S_MAIN.1900
& points, nlevs, nwet, nprimvars, S_MAIN.1901
& nbl_levs, nsoilt_levs, nsoilm_levs, S_MAIN.1902
! S_MAIN.1903
& resdump,u,v,t,theta,q,qcl,qcf,layer_cloud, S_MAIN.1904
& pstar,t_deep_soil,smc,canopy, S_MAIN.1905
& snodep,tstar,zh,z0msea, S_MAIN.1906
& cca,iccb,icct,smcl) S_MAIN.1907
Do i = 1, points S_MAIN.1908
rccb(i) = Real(iccb(i)) S_MAIN.1909
rcct(i) = Real(icct(i)) S_MAIN.1910
enddo S_MAIN.1911
C S_MAIN.1912
stepcount = 0 S_MAIN.1913
maxinc = 9999.0 S_MAIN.1914
S_MAIN.1915
Do while (maxinc .gt. 0.1 S_MAIN.1916
& .and. stepcount .lt. full_daysteps) S_MAIN.1917
stepcount = stepcount + 1 S_MAIN.1918
daycount = 1 S_MAIN.1919
Call TIMECALC
(year_init, dayno_init, time_init, timestep S_MAIN.1920
& ,time_string, lcal360, yearno, day, time_sec) S_MAIN.1921
S_MAIN.1922
C Now call the physics routines with flags set to S_MAIN.1923
C only enable the boundary layer call. S_MAIN.1924
Call PHYSICS
( S_MAIN.1925
C IN leading dimensions of arrays S_MAIN.1926
& points, n_cca_lev, nlevs, nwet, nclds, nozone S_MAIN.1927
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.1928
& ,sulp_dim1, sulp_dim2, ntra, trlev, sal_dim S_MAIN.1929
C IN dimension of dump array. S_MAIN.1930
& ,nprimvars, sec_day S_MAIN.1931
& ,1, daycount, time_string, year, day, yearno, daynumber S_MAIN.1932
& ,local_time, lcal360, ltimer S_MAIN.1933
& ,lat, long, soil_type, veg_type, layer_depth S_MAIN.1934
& ,sil_orog_land, ho2r2_orog, z0_orog_land S_MAIN.1935
& ,di,ice_fract,u_0,v_0 S_MAIN.1936
& ,time_init, obs, geoforce, ug, vg, f_coriolis S_MAIN.1937
& ,2, 2, 2, 2, 0, 2, lrmbl S_MAIN.1938
& ,l_lspice ,l_lspice_bdy, l_bl_lspice, l_mom S_MAIN.1939
& ,l_mixlen, l_z0_orog S_MAIN.1940
& ,l_climate_aerosol,l_3d_cca S_MAIN.1941
& ,l_use_sulpc_direct, l_use_sulpc_indirect, l_sulpc_so2 S_MAIN.1942
& ,l_sulpc_nh3 S_MAIN.1943
& ,l_soot, l_use_soot_direct, l_co2_interactive S_MAIN.1944
& ,l_up_flux_trop_sw, l_down_flux_trop_lw S_MAIN.1945
& ,l_net_flux_trop_sw, l_net_flux_trop_lw S_MAIN.1946
& ,l_xscomp, l_sdxs S_MAIN.1947
& ,flg_up_flx, flg_dwn_flx, flg_entr_up, flg_entr_dwn S_MAIN.1948
& ,flg_detr_up, flg_detr_dwn, l_ccw S_MAIN.1949
& ,l_cloud_deep, l_phase_lim, l_murk S_MAIN.1950
& ,l_tracer, l_cape, l_snow_albedo, l_radheat,l_ssice_albedo S_MAIN.1951
& ,sfme,simlt,smlt,slh,sq1p5,st1p5,su10,sv10 S_MAIN.1952
& ,stf_hf_snow_melt, stf_sub_surf_roff, stf_snomlt_sub_htf S_MAIN.1953
C Microphysical Flag S_MAIN.1954
& ,l_microphysics S_MAIN.1955
& ,.false., radcloud_fixed, noforce, land_mask, timestep S_MAIN.1956
& ,prindump_obs, nout(15), ntrad, ntrad1, start_diagday S_MAIN.1957
& ,subdat_step, subdat_step1, swlut, lwlut, exner S_MAIN.1958
& ,ui, vi, icct_rad, iccb_rad, ccwpin, ccwpin_rad, cca_rad S_MAIN.1959
& ,qcl_rad_box ,qcf_rad_box, layer_cloud_rad, tracer S_MAIN.1960
& ,o3, co2start, co2end, co2rate, co2_3d S_MAIN.1961
& ,o2mmr, n2ommr, ch4mmr, c11mmr, c12mmr S_MAIN.1962
& ,cfc113mmr, hcfc22mmr, hfc125mmr, hfc134ammr S_MAIN.1963
& ,alpham, alphac, alphab, dtice S_MAIN.1964
& ,soot, rgrain S_MAIN.1965
& ,mparwtr, anvil_factor, tower_factor, ud_factor S_MAIN.1966
& ,rhcrit ! IN : Critical relative humidities S_MAIN.1967
! IN model levels. S_MAIN.1968
& ,ak, bk ! Coefficients defining S_MAIN.1969
! hybrid vertical coordinates S_MAIN.1970
& ,akh,bkh ! AK,BK at lower level interfaces S_MAIN.1971
! S_MAIN.1972
& ,delta_ak, delta_bk S_MAIN.1973
& ,factor_rhokh, S_MAIN.1974
*IF DEF,A01_3A,AND,DEF,A02_3A S_MAIN.1975
! Algorithmic options for S/LRAD3A. S_MAIN.1976
*CALL SWCAVR3A
S_MAIN.1977
& , S_MAIN.1978
*CALL LWCAVR3A
S_MAIN.1979
C INOUT S_MAIN.1980
& , S_MAIN.1981
*ENDIF S_MAIN.1982
& u, v, t, q, pstar, smc, smcl, canopy, snodep, tstar, tsi S_MAIN.1983
& ,sthu,sthf S_MAIN.1984
& ,t_deep_soil,rh,cca,iccb,icct, layer_cloud, qcl, qcf,zh S_MAIN.1985
& ,z0msea, theta, rhokh, dap1, dap2, dap3, dab1, dab2 ,dab3 S_MAIN.1986
& ,so2 ,so4_ait,so4_acc ,so4_dis, aerosol, radheat_rate S_MAIN.1987
C OUT S_MAIN.1988
& ,up_flux, dwn_flux, entrain_up, detrain_up, entrain_dwn S_MAIN.1989
& ,detrain_dwn S_MAIN.1990
& ,dthbydt, dqbydt, conv_rain, conv_snow, ls_rain, ls_snow S_MAIN.1991
& ,lsrain3d, lssnow3d S_MAIN.1992
& ,lscav_so2,lscav_so4ait,lscav_so4acc,lscav_so4dis S_MAIN.1993
& ,taux, tauy, fqw, ftl, can_evap, soil_evap S_MAIN.1994
& ,surf_ht_flux, sea_ice_htf, subl_snow, latent_heat S_MAIN.1995
& ,sens_heat ,u10m, v10m, t1p5m, rib, q1p5m, fast_runoff S_MAIN.1996
& ,sub_surf_roff, hf_snow_melt, snow_melt, throughfall S_MAIN.1997
& ,swout, swsea, lwout, lwsea, net_rad, osdia, isdia, olr S_MAIN.1998
& ,csolrd, csosdi ,tca, snomlt_surf_htf, snomlt_sub_htf S_MAIN.1999
& ,sice_mlt_htf S_MAIN.2000
C Extra diagnostics output for MOSES S_MAIN.2001
& ,gs, leaf_ai, can_ht, etran, gpp, npp, resp_p S_MAIN.2002
& ,down_surf_sw_b1, S_MAIN.2003
C Additional arguments for 7A boundary layer (MOSES II) S_MAIN.2004
C IN S_MAIN.2005
& l_phenol,l_triffid,l_neg_tstar, S_MAIN.2006
& canht_ft,canopy_tile,catch_tile,cs,lai_ft, S_MAIN.2007
& frac,snow_frac,rad_no_snow,rad_snow,tsnow,z0v_tile, S_MAIN.2008
C INOUT S_MAIN.2009
& tstar_tile, S_MAIN.2010
& g_leaf_acc,npp_ft_acc,resp_w_ft_acc,resp_s_acc, S_MAIN.2011
C OUT S_MAIN.2012
& ecan_tile,esoil_tile,ftl_tile, S_MAIN.2013
& g_leaf,gpp_ft,npp_ft,resp_p_ft,resp_s,resp_w_ft, S_MAIN.2014
& rho_aresist_tile,aresist_tile,resist_b_tile, S_MAIN.2015
& rib_tile,snow_surf_htf,soil_surf_htf, S_MAIN.2016
& tile_index,tile_pts,tile_frac S_MAIN.2017
& ) S_MAIN.2018
C S_MAIN.2019
C Save U and V and calculate max increment S_MAIN.2020
C S_MAIN.2021
maxinc = 0.0 S_MAIN.2022
Do i = 1, points S_MAIN.2023
Do k = 1, nlevs S_MAIN.2024
maxinc = max(maxinc, S_MAIN.2025
& (ui(i,k)-u(i,k))**2 + (vi(i,k)-v(i,k))**2) S_MAIN.2026
ui(i,k) = u(i,k) S_MAIN.2027
vi(i,k) = v(i,k) S_MAIN.2028
enddo S_MAIN.2029
maxinc = sqrt(maxinc)/(f_coriolis(i)*timestep*modug(i)) S_MAIN.2030
C Write (6,*)"MAX RELATIVE WIND CHANGE=",MAXINC,STEPCOUNT S_MAIN.2031
*IF DEF,A03_5A S_MAIN.2032
C SAVE TSTAR S_MAIN.2033
tstarsav(i) = tstar(i) S_MAIN.2034
enddo S_MAIN.2035
*ENDIF S_MAIN.2036
C S_MAIN.2037
C--------------------------------------------------------------------- S_MAIN.2038
C Copy initial data back from DUMP. S_MAIN.2039
C--------------------------------------------------------------------- S_MAIN.2040
C S_MAIN.2041
Call DUMPINIT
( S_MAIN.2042
C IN dimension of dump array. S_MAIN.2043
& points, nprimvars, nlevs, nwet, S_MAIN.2044
& nbl_levs, nsoilt_levs, nsoilm_levs, ntrop, S_MAIN.2045
C S_MAIN.2046
& resdump,u,v,t,theta,q,qcl,qcf,layer_cloud, S_MAIN.2047
& pstar,t_deep_soil,smc,canopy,snodep, S_MAIN.2048
& tstar,zh,z0msea, S_MAIN.2049
& cca,rccb,rcct,smcl) S_MAIN.2050
Do i = 1, points S_MAIN.2051
iccb(i) = int(rccb(i)) S_MAIN.2052
icct(i) = int(rcct(i)) S_MAIN.2053
S_MAIN.2054
C S_MAIN.2055
C Copy saved U,V back S_MAIN.2056
C S_MAIN.2057
Do k = 1, nlevs S_MAIN.2058
u(i,k) = ui(i,k) S_MAIN.2059
v(i,k) = vi(i,k) S_MAIN.2060
enddo S_MAIN.2061
*IF DEF,A03_5A S_MAIN.2062
C Copy saved Tstar back S_MAIN.2063
tstar(i) = tstarsav(i) S_MAIN.2064
*ENDIF S_MAIN.2065
enddo S_MAIN.2066
C timestep_count = 0 S_MAIN.2067
enddo ! maxinc and stepcount < daysteps S_MAIN.2068
S_MAIN.2069
Do i = 1, points S_MAIN.2070
Do j = 1, nprimvars S_MAIN.2071
resdump(i,j) = 0.0 S_MAIN.2072
enddo S_MAIN.2073
enddo S_MAIN.2074
Write (6,*) "Geostrophic wind initialised." S_MAIN.2075
Write (6,*) "max relative wind change at end=",maxinc, S_MAIN.2076
& " after ",stepcount," steps" S_MAIN.2077
daynumber = dayno_init S_MAIN.2078
year = 1 S_MAIN.2079
c S_MAIN.2080
S_MAIN.2081
endif ! Geostrophic forcing initialising. S_MAIN.2082
S_MAIN.2083
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2084
C LOOP OVER DAYS S_MAIN.2085
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2086
C S_MAIN.2087
C S_MAIN.2088
Do daycount = 1, ndayin+1 S_MAIN.2089
C S_MAIN.2090
C--------------------------------------------------------------------- S_MAIN.2091
C Initialise dump array to zero and set counter(M1) S_MAIN.2092
C for no. of dumps S_MAIN.2093
C--------------------------------------------------------------------- S_MAIN.2094
C S_MAIN.2095
If (daycount .ne. ndayin+1 .or. nstepsin .ne. 0) S_MAIN.2096
& Print *, 'daynumber ', daycount S_MAIN.2097
m1 = 1 S_MAIN.2098
Do i = 1, points S_MAIN.2099
Do j = 1, nvars S_MAIN.2100
Do k = 1, ndump S_MAIN.2101
dump(i,j,k) = 0.0 S_MAIN.2102
enddo S_MAIN.2103
enddo S_MAIN.2104
Do j = 1, nprimvars S_MAIN.2105
resdump(i,j) = 0.0 S_MAIN.2106
enddo S_MAIN.2107
Do j = 1, nvars S_MAIN.2108
dumpmean_day(i,j) = 0.0 S_MAIN.2109
enddo S_MAIN.2110
enddo S_MAIN.2111
S_MAIN.2112
C S_MAIN.2113
C--------------------------------------------------------------------- S_MAIN.2114
C Print out primary variables at start of run S_MAIN.2115
C--------------------------------------------------------------------- S_MAIN.2116
C S_MAIN.2117
If ((budg_calcs .or. test) .and. (daycount .eq. 1)) S_MAIN.2118
& Call SUB_DATA
( S_MAIN.2119
C IN leading dimensions of arrays S_MAIN.2120
& points, nlevs, nwet S_MAIN.2121
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2122
& ,' Initial data ', 1, year_init S_MAIN.2123
& ,dayno_init, ' ', daycount, u, v, t, theta, q S_MAIN.2124
& ,qcl, qcf, layer_cloud, pstar, t_deep_soil, smc, canopy S_MAIN.2125
& ,snodep, tstar, zh, z0msea S_MAIN.2126
& ,cca, iccb, icct, smcl) S_MAIN.2127
C S_MAIN.2128
C--------------------------------------------------------------------- S_MAIN.2129
C Reset sinusoidal distribution every 10 days if climate S_MAIN.2130
C stats required S_MAIN.2131
C--------------------------------------------------------------------- S_MAIN.2132
C S_MAIN.2133
If (stats .and. (daycount .eq. 1 S_MAIN.2134
& .or. (ancyc .and. mod(daycount, change_clim) .eq. 0))) then S_MAIN.2135
Call STATDAY
( S_MAIN.2136
C IN leading dimensions of arrays S_MAIN.2137
& points, nlevs, nwet,ntrop, S_MAIN.2138
C S_MAIN.2139
& atime,btime,dayno_wint,deltan,daycount, S_MAIN.2140
& tbara,tbarb,tsda,tsdb,dbara,dbarb,vnbara,vnbarb, S_MAIN.2141
& vnsda,vnsdb,vpbara,vpbarb,wbara,wbarb,wsda,wsdb, S_MAIN.2142
& alfada,alfadb,pstara,pstarb,pstar,tgrada, S_MAIN.2143
& tgradb,dgrada,dgradb,cort,cord,corvn,corw, S_MAIN.2144
& tdash,ddash,ctbar,ctsd,at,cdbar,cdsd,ad, S_MAIN.2145
& cvnbar,cvnsd,avn,cwbar,cwsd,aw, S_MAIN.2146
& tbar,tsd,dbar,dsd, S_MAIN.2147
& vnbar,vnsd,vpbar,wbar,wsd,p,rp,ak,bk) S_MAIN.2148
C S_MAIN.2149
C--------------------------------------------------------------------- S_MAIN.2150
C Calculate EXNER function based on updated value of PSTAR S_MAIN.2151
C--------------------------------------------------------------------- S_MAIN.2152
C S_MAIN.2153
Call EXNER_CALC
(points, nlevs, akh, bkh, pstar, exner) S_MAIN.2154
C S_MAIN.2155
C--------------------------------------------------------------------- S_MAIN.2156
C Initialise PX and PY arrays for calculation of S_MAIN.2157
C vertical fluxes later S_MAIN.2158
C--------------------------------------------------------------------- S_MAIN.2159
C S_MAIN.2160
Do i = 1, points S_MAIN.2161
Do k = 1, ntrop S_MAIN.2162
px(i,k) = 1. / alog(p(i,k+1)/p(i,k)) S_MAIN.2163
enddo S_MAIN.2164
C S_MAIN.2165
Do k = 1, ntrop-1 S_MAIN.2166
py(i,k) = 1. / alog(p(i,k+2)/p(i,k)) S_MAIN.2167
enddo S_MAIN.2168
enddo S_MAIN.2169
endif ! stats S_MAIN.2170
C S_MAIN.2171
C===================================================================== S_MAIN.2172
C Options for forcing S_MAIN.2173
C--------------------------------------------------------------------- S_MAIN.2174
C S_MAIN.2175
C Observational forcing : use observed values of T,Q,U,V S_MAIN.2176
C to calculate their increments due to large scale effects. S_MAIN.2177
C OR S_MAIN.2178
C Statistical forcing : take random sample from Normal S_MAIN.2179
C (Gaussian) distribution with mean and sd climlogical S_MAIN.2180
C average to calculate increments to T and Q due to large scale S_MAIN.2181
C effects. S_MAIN.2182
C===================================================================== S_MAIN.2183
C S_MAIN.2184
C S_MAIN.2185
C Loop over timesteps S_MAIN.2186
C S_MAIN.2187
C S_MAIN.2188
C If it is the last day in the run and a full day is not S_MAIN.2189
C required, loop over the number of timesteps required S_MAIN.2190
C otherwise do the full number of timesteps in a day. S_MAIN.2191
C S_MAIN.2192
If (daycount .eq. ndayin+1 S_MAIN.2193
& .and .nstepsin .ne. full_daysteps) then S_MAIN.2194
daysteps = nstepsin S_MAIN.2195
else S_MAIN.2196
daysteps = full_daysteps S_MAIN.2197
endif S_MAIN.2198
S_MAIN.2199
Do stepcount = 1, daysteps S_MAIN.2200
C S_MAIN.2201
C--------------------------------------------------------------------- S_MAIN.2202
C Calculate the year (in run) and actual time and day number S_MAIN.2203
C for labelling of the diagnostics only. S_MAIN.2204
C--------------------------------------------------------------------- S_MAIN.2205
C S_MAIN.2206
Call TIMECALC
(year_init, dayno_init, time_init, timestep S_MAIN.2207
& ,time_string, lcal360, yearno, day, time_sec) S_MAIN.2208
S_MAIN.2209
C If there is no annual cycle, the year and day numbers S_MAIN.2210
C will be the init one. S_MAIN.2211
If (.not. ancyc) then S_MAIN.2212
year = 1 S_MAIN.2213
day = dayno_init S_MAIN.2214
endif S_MAIN.2215
C S_MAIN.2216
C--------------------------------------------------------------------- S_MAIN.2217
C Write out diagnostics at beginning of timestep S_MAIN.2218
C--------------------------------------------------------------------- S_MAIN.2219
C S_MAIN.2220
If (test .and. obs) then S_MAIN.2221
If (stepcount .ge. obs_print1 S_MAIN.2222
& .and. mod(stepcount-obs_print1 ,obs_print) .eq. 0) S_MAIN.2223
& Call SUB_DATA
( S_MAIN.2224
! IN leading dimensions of arrays S_MAIN.2225
& points, nlevs, nwet S_MAIN.2226
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2227
& ,'Before any calculations variables are ', S_MAIN.2228
& stepcount, yearno, day, time_string, daycount, u, v, t, S_MAIN.2229
& theta, q, qcl, qcf, layer_cloud, pstar, S_MAIN.2230
& t_deep_soil, smc, canopy, snodep, S_MAIN.2231
& tstar, zh, z0msea, S_MAIN.2232
& cca, iccb, icct, smcl) S_MAIN.2233
S_MAIN.2234
endif S_MAIN.2235
C S_MAIN.2236
C--------------------------------------------------------------------- S_MAIN.2237
C Include any forcing required S_MAIN.2238
C--------------------------------------------------------------------- S_MAIN.2239
C S_MAIN.2240
If (stats .or. obs) then S_MAIN.2241
Call FORCING
( S_MAIN.2242
C ! IN leading dimensions of arrays S_MAIN.2243
& points, nlevs, nwet S_MAIN.2244
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2245
C ! S_MAIN.2246
& ,sec_day S_MAIN.2247
& ,stats, obs, prindump_obs, prinstat, S_MAIN.2248
& dayno_wint, daycount, daysteps, stepcount, S_MAIN.2249
& timestep, ichgf, S_MAIN.2250
& ad, at, avn, aw, cdbar, cdsd, ctbar, ctsd, S_MAIN.2251
& cvnbar, cvnsd, cwbar, cwsd, dbar, dsd, ddash, S_MAIN.2252
& deltan, p, rp, S_MAIN.2253
& px, py, tbar, tdash, tsd, vnbar, vnsd, vpbar, S_MAIN.2254
& wbar, wsd, S_MAIN.2255
& t, q, u, v, qr, tr, vnr, vpr, wr, S_MAIN.2256
& flux_h, flux_e, tls, qls, uls, vls, S_MAIN.2257
& ch_flux_h, ch_flux_e, ch_tls, ch_qls, ch_uls, ch_vls, S_MAIN.2258
& dap1, dab1, t_init, q_init, ilscnt, rhokh, S_MAIN.2259
& factor_rhokh, iv, ntab, iy, idum S_MAIN.2260
& ) S_MAIN.2261
endif S_MAIN.2262
C S_MAIN.2263
C--------------------------------------------------------------------- S_MAIN.2264
C Convert temperature to potential temperature S_MAIN.2265
C--------------------------------------------------------------------- S_MAIN.2266
C S_MAIN.2267
Call THETA_CALC
(theta,t,exner,pstar,akh,bkh,nlevs,points) S_MAIN.2268
C S_MAIN.2269
C--------------------------------------------------------------------- S_MAIN.2270
C Write out sub-timestep diagnostics S_MAIN.2271
C--------------------------------------------------------------------- S_MAIN.2272
C S_MAIN.2273
If (test .and. daycount .ge. start_diagday) then S_MAIN.2274
If (stepcount .ge. subdat_step1 S_MAIN.2275
& .and. mod(stepcount-subdat_step1,subdat_step) .eq. 0) S_MAIN.2276
& Call SUB_DATA
( S_MAIN.2277
! IN leading dimensions of arrays S_MAIN.2278
& points, nlevs, nwet S_MAIN.2279
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2280
& ,' After forcing, before cld ', S_MAIN.2281
& stepcount, yearno, day, time_string, daycount, u, v, t, S_MAIN.2282
& theta, q, qcl, qcf, layer_cloud, pstar, t_deep_soil, S_MAIN.2283
& smc, canopy, snodep, tstar, zh, z0msea, S_MAIN.2284
& cca, iccb, icct, smcl) S_MAIN.2285
endif S_MAIN.2286
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2287
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2288
C S_MAIN.2289
C Start of calls to physics subroutines S_MAIN.2290
C S_MAIN.2291
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2292
C S_MAIN.2293
S_MAIN.2294
Call PHYSICS
( S_MAIN.2295
! IN leading dimensions of arrays S_MAIN.2296
& points, n_cca_lev, nlevs, nwet, nclds, nozone S_MAIN.2297
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2298
& ,sulp_dim1, sulp_dim2, ntra, trlev, sal_dim S_MAIN.2299
! IN dimension of dump array. S_MAIN.2300
& ,nprimvars, sec_day S_MAIN.2301
! IN S_MAIN.2302
& ,stepcount, daycount, time_string, year, day, yearno S_MAIN.2303
& ,daynumber, local_time, lcal360, ltimer S_MAIN.2304
& ,lat, long, soil_type, veg_type, layer_depth S_MAIN.2305
& ,sil_orog_land, ho2r2_orog, z0_orog_land S_MAIN.2306
& ,di,ice_fract,u_0,v_0 S_MAIN.2307
& ,time_init, obs, geoforce, ug, vg, f_coriolis S_MAIN.2308
& ,conv_mode,ppn_mode,lw_mode,sw_mode,bl_mode,hyd_mode S_MAIN.2309
& ,lrmbl ,l_lspice ,l_lspice_bdy, l_bl_lspice, l_mom S_MAIN.2310
& ,l_mixlen, l_z0_orog S_MAIN.2311
& ,l_climate_aerosol, l_3d_cca S_MAIN.2312
& ,l_use_sulpc_direct, l_use_sulpc_indirect, l_sulpc_so2 S_MAIN.2313
& ,l_sulpc_nh3 S_MAIN.2314
& ,l_soot, l_use_soot_direct, l_co2_interactive S_MAIN.2315
& ,l_up_flux_trop_sw, l_down_flux_trop_lw S_MAIN.2316
& ,l_net_flux_trop_sw, l_net_flux_trop_lw S_MAIN.2317
& ,l_xscomp, l_sdxs S_MAIN.2318
& ,flg_up_flx, flg_dwn_flx, flg_entr_up, flg_entr_dwn S_MAIN.2319
& ,flg_detr_up, flg_detr_dwn, l_ccw S_MAIN.2320
& ,l_cloud_deep, l_phase_lim, l_murk S_MAIN.2321
& ,l_tracer, l_cape, l_snow_albedo, l_radheat,l_ssice_albedo S_MAIN.2322
& ,sfme,simlt,smlt,slh,sq1p5,st1p5,su10,sv10 S_MAIN.2323
& ,stf_hf_snow_melt, stf_sub_surf_roff, stf_snomlt_sub_htf S_MAIN.2324
! Microphysical Flag S_MAIN.2325
& ,l_microphysics S_MAIN.2326
& ,test, radcloud_fixed, noforce, land_mask, timestep S_MAIN.2327
& ,prindump_obs, nout(15), ntrad, ntrad1, start_diagday S_MAIN.2328
& ,subdat_step, subdat_step1, swlut, lwlut, exner S_MAIN.2329
& ,ui, vi, icct_rad, iccb_rad, ccwpin, ccwpin_rad, cca_rad S_MAIN.2330
& ,qcl_rad_box ,qcf_rad_box, layer_cloud_rad, tracer S_MAIN.2331
& ,o3, co2start, co2end, co2rate, co2_3d S_MAIN.2332
& ,o2mmr,n2ommr,ch4mmr,c11mmr,c12mmr S_MAIN.2333
& ,cfc113mmr, hcfc22mmr, hfc125mmr, hfc134ammr S_MAIN.2334
& ,alpham, alphac, alphab, dtice S_MAIN.2335
& ,soot,rgrain S_MAIN.2336
& ,mparwtr,anvil_factor,tower_factor, ud_factor S_MAIN.2337
& ,rhcrit ! IN : Critical relative humidities S_MAIN.2338
! IN model levels. S_MAIN.2339
& ,ak, bk ! Coefficients defining S_MAIN.2340
! hybrid vertical coordinates S_MAIN.2341
& ,akh,bkh ! AK,BK at lower level interfaces S_MAIN.2342
! S_MAIN.2343
& , delta_ak, delta_bk, factor_rhokh, S_MAIN.2344
*IF DEF,A01_3A,AND,DEF,A02_3A S_MAIN.2345
! algorithmic options for S/LRAD3A. S_MAIN.2346
*CALL SWCAVR3A
S_MAIN.2347
& , S_MAIN.2348
*CALL LWCAVR3A
S_MAIN.2349
& , S_MAIN.2350
*ENDIF S_MAIN.2351
& u, v, t, q, pstar, smc, smcl, canopy, snodep S_MAIN.2352
& ,tstar, tsi, sthu, sthf S_MAIN.2353
& ,t_deep_soil, rh, cca, iccb, icct, layer_cloud, qcl, qcf S_MAIN.2354
& ,zh ,z0msea, theta, rhokh S_MAIN.2355
& ,dap1, dap2, dap3, dab1, dab2, dab3 S_MAIN.2356
& ,so2 ,so4_ait,so4_acc, so4_dis, aerosol, radheat_rate S_MAIN.2357
c S_MAIN.2358
& ,up_flux, dwn_flux, entrain_up, detrain_up, entrain_dwn S_MAIN.2359
& ,detrain_dwn S_MAIN.2360
& ,dthbydt, dqbydt, conv_rain, conv_snow, ls_rain, ls_snow S_MAIN.2361
& ,lsrain3d, lssnow3d S_MAIN.2362
& ,lscav_so2, lscav_so4ait, lscav_so4acc, lscav_so4dis S_MAIN.2363
& ,taux, tauy, fqw, ftl, can_evap, soil_evap S_MAIN.2364
& ,surf_ht_flux, sea_ice_htf, subl_snow, latent_heat S_MAIN.2365
& ,sens_heat S_MAIN.2366
& ,u10m, v10m, t1p5m, rib, q1p5m, fast_runoff S_MAIN.2367
& ,sub_surf_roff, hf_snow_melt, snow_melt, throughfall S_MAIN.2368
& ,swout S_MAIN.2369
& ,swsea, lwout, lwsea, net_rad, osdia, isdia, olr, csolrd S_MAIN.2370
& ,csosdi ,tca, snomlt_surf_htf, snomlt_sub_htf S_MAIN.2371
& ,sice_mlt_htf S_MAIN.2372
C Extra diagnostics output for MOSES S_MAIN.2373
& ,gs, leaf_ai, can_ht, etran, gpp, npp, resp_p S_MAIN.2374
& ,down_surf_sw_b1, S_MAIN.2375
! Additional arguments for 7A boundary layer (MOSES II) S_MAIN.2376
! IN S_MAIN.2377
& l_phenol,l_triffid,l_neg_tstar, S_MAIN.2378
& canht_ft,canopy_tile,catch_tile,cs,lai_ft, S_MAIN.2379
& frac,snow_frac,rad_no_snow,rad_snow,tsnow,z0v_tile, S_MAIN.2380
! INOUT S_MAIN.2381
& tstar_tile, S_MAIN.2382
& g_leaf_acc,npp_ft_acc,resp_w_ft_acc,resp_s_acc, S_MAIN.2383
! OUT S_MAIN.2384
& ecan_tile,esoil_tile,ftl_tile, S_MAIN.2385
& g_leaf,gpp_ft,npp_ft,resp_p_ft,resp_s,resp_w_ft, S_MAIN.2386
& rho_aresist_tile,aresist_tile,resist_b_tile, S_MAIN.2387
& rib_tile,snow_surf_htf,soil_surf_htf, S_MAIN.2388
& tile_index,tile_pts,tile_frac S_MAIN.2389
& ) S_MAIN.2390
C S_MAIN.2391
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2392
C S_MAIN.2393
C End of calls to physics subroutines. S_MAIN.2394
C Start of calls to diagnostic subroutines S_MAIN.2395
C S_MAIN.2396
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2397
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2398
C--------------------------------------------------------------------- S_MAIN.2399
C Form dump array S_MAIN.2400
C--------------------------------------------------------------------- S_MAIN.2401
If (daycount .ge. start_diagday) then S_MAIN.2402
Call DUMPDIAG
( S_MAIN.2403
! IN leading dimensions of arrays S_MAIN.2404
& points, nlevs, nwet S_MAIN.2405
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2406
! IN dump description. S_MAIN.2407
& ,nvars, nprimvars, ndump, cloud_count, tcount, qcount S_MAIN.2408
& ,t1p5m_maxcount ,t1p5m_mincount S_MAIN.2409
! S_MAIN.2410
& ,dump, m1, land_mask, u, v, t, theta, q, qcl, qcf S_MAIN.2411
& ,layer_cloud, dthbydt, dqbydt, cca, iccb, icct S_MAIN.2412
& ,conv_rain, conv_snow, ls_rain, ls_snow S_MAIN.2413
& ,taux, tauy, fqw ,ftl, t_deep_soil, pstar, tstar S_MAIN.2414
& ,smc, canopy, snodep, zh, z0msea S_MAIN.2415
& ,can_evap, soil_evap, surf_ht_flux S_MAIN.2416
& ,sea_ice_htf, subl_snow, latent_heat S_MAIN.2417
& ,sens_heat, u10m, v10m S_MAIN.2418
& ,t1p5m, rib, q1p5m, fast_runoff S_MAIN.2419
& ,sub_surf_roff, hf_snow_melt S_MAIN.2420
& ,snow_melt, throughfall, swout S_MAIN.2421
& ,swsea, lwout, lwsea, net_rad S_MAIN.2422
& ,osdia, isdia, olr, csolrd, csosdi, tca S_MAIN.2423
& ,dump_step, akh, bkh, timestep, stepcount S_MAIN.2424
& ,delta_ak, delta_bk S_MAIN.2425
& ,rh, smcl, sice_mlt_htf S_MAIN.2426
& ,snomlt_surf_htf, snomlt_sub_htf S_MAIN.2427
C Extra diagnostics output for MOSES S_MAIN.2428
& ,sthu, sthf, gs, leaf_ai, can_ht, etran S_MAIN.2429
& ,gpp, npp, resp_p, down_surf_sw_b1 S_MAIN.2430
& ) S_MAIN.2431
endif S_MAIN.2432
c S_MAIN.2433
C--------------------------------------------------------------------- S_MAIN.2434
C S_MAIN.2435
C If required, print DUMP over a no. of timesteps to unit 30. S_MAIN.2436
C or output a graphical dump over a number of timesteps to S_MAIN.2437
C unit 40 after the specified START_DIAGDAY. S_MAIN.2438
C S_MAIN.2439
C--------------------------------------------------------------------- S_MAIN.2440
C S_MAIN.2441
If (daycount .ge. start_diagday) then S_MAIN.2442
head_label = 1 S_MAIN.2443
If (prindump_step .and. mod(stepcount,dump_step) .eq. 0) S_MAIN.2444
& then S_MAIN.2445
Call DUMP_PRINT
( S_MAIN.2446
& points, nlevs, nwet S_MAIN.2447
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2448
! IN dimension of dump array. S_MAIN.2449
& ,nvars, sec_dump S_MAIN.2450
! S_MAIN.2451
& ,dump, m1-1, stepcount, day, yearno S_MAIN.2452
& ,time_string, daycount S_MAIN.2453
& ,dump_days(1), land_mask, head_label, nout(3)) S_MAIN.2454
if (budg_calcs) S_MAIN.2455
& Call SUB_DATA
( S_MAIN.2456
! IN leading dimensions of arrays S_MAIN.2457
& points, nlevs, nwet S_MAIN.2458
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2459
& ,' At end of mean over dump_step ' S_MAIN.2460
& ,stepcount, yearno, day, time_string, daycount, u, v, t S_MAIN.2461
& ,theta, q, qcl, qcf, layer_cloud S_MAIN.2462
& ,pstar, t_deep_soil, smc, canopy, snodep, tstar, zh S_MAIN.2463
& ,z0msea, cca, iccb, icct, smcl) S_MAIN.2464
endif S_MAIN.2465
C S_MAIN.2466
If (grafdump_step .and. mod(stepcount,dump_step) .eq. 0) S_MAIN.2467
& Call DUMP_GRAF
( S_MAIN.2468
& points,nvars S_MAIN.2469
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2470
& ,dump, m1-1, time_sec, day, nout(9)) S_MAIN.2471
endif ! daycount .ge. start_diag S_MAIN.2472
C S_MAIN.2473
C--------------------------------------------------------------------- S_MAIN.2474
C If OBS diagnostics are required, set PRINTO ( starts day 1) S_MAIN.2475
C--------------------------------------------------------------------- S_MAIN.2476
If (obs .and. prindump_obs) then S_MAIN.2477
printo = (stepcount .ge. obs_print1 .and. S_MAIN.2478
& mod(stepcount-obs_print1,obs_print) .eq. 0) S_MAIN.2479
C--------------------------------------------------------------------- S_MAIN.2480
C Output dap and dab observation dignostics to S_MAIN.2481
C units 43, 44, 45, 46 S_MAIN.2482
C--------------------------------------------------------------------- S_MAIN.2483
C S_MAIN.2484
Call OBS_DUMP
(points, dap1, dap2, dap3, dab1, dab2, dab3, S_MAIN.2485
& nlevs, nwet, deltap, ti, qi, t_init, q_init, t, q, S_MAIN.2486
& daycount, stepcount, timestep, time_string, S_MAIN.2487
& printo, conv_rain, conv_snow, ichgf, ilscnt, S_MAIN.2488
& nout(15), nout(16), nout(17)) S_MAIN.2489
If (printo) S_MAIN.2490
C S_MAIN.2491
C Graphical output of observations S_MAIN.2492
C S_MAIN.2493
& Call OBS_GRAF
(points, dap1, 36, nlevs, dab1, 44, 1, day S_MAIN.2494
& ,time_sec, nout(18)) S_MAIN.2495
endif ! obs and prindump_obs S_MAIN.2496
C S_MAIN.2497
enddo ! stepcount S_MAIN.2498
C S_MAIN.2499
C S_MAIN.2500
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2501
C Form and output the daily and periodic means when required S_MAIN.2502
C if either it is the last day in the run and a full day is S_MAIN.2503
C required or it is not the last day. S_MAIN.2504
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2505
C S_MAIN.2506
If (daycount .ne. ndayin+1 .xor. nstepsin .eq. full_daysteps) S_MAIN.2507
& then S_MAIN.2508
C--------------------------------------------------------------------- S_MAIN.2509
C Form daily mean in DUMPMEAN_DAY , S_MAIN.2510
C--------------------------------------------------------------------- S_MAIN.2511
C S_MAIN.2512
If (daycount .ge. start_diagday) then S_MAIN.2513
Call CALC_DUMPDAY
( S_MAIN.2514
C ! IN dump description. S_MAIN.2515
& points, nvars, ndump, cloud_count, tcount, qcount S_MAIN.2516
& ,t1p5m_maxcount, t1p5m_mincount S_MAIN.2517
& ,dump, dumpmean_day) S_MAIN.2518
C S_MAIN.2519
C--------------------------------------------------------------------- S_MAIN.2520
C If required print mean daily dump to unit 31. S_MAIN.2521
C If required output graphical dump of mean daily values S_MAIN.2522
C to unit 38. S_MAIN.2523
C--------------------------------------------------------------------- S_MAIN.2524
C S_MAIN.2525
head_label = 2 S_MAIN.2526
If (prindump_day) S_MAIN.2527
& Call DUMP_PRINT
( S_MAIN.2528
& points, nlevs, nwet S_MAIN.2529
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2530
C ! IN dimension of dump array. S_MAIN.2531
& ,nvars, sec_dump S_MAIN.2532
C ! S_MAIN.2533
& ,dumpmean_day, 1, stepcount, day S_MAIN.2534
& ,yearno, time_string S_MAIN.2535
& ,daycount, dump_days(1), land_mask S_MAIN.2536
& ,head_label, nout(4)) S_MAIN.2537
C S_MAIN.2538
S_MAIN.2539
If (grafdump_day) S_MAIN.2540
& Call DUMP_GRAF
( S_MAIN.2541
& points, nvars S_MAIN.2542
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2543
& ,dumpmean_day, 1, time_init, day, nout(10)) S_MAIN.2544
S_MAIN.2545
C--------------------------------------------------------------------- S_MAIN.2546
C Form dump over a no. of days in DUMPMEAN_DAYS for S_MAIN.2547
C all meaning periods S_MAIN.2548
C required (i.e. wherever DUMP_DAYS, etc. are set >1) S_MAIN.2549
C then output to appropriate units S_MAIN.2550
C--------------------------------------------------------------------- S_MAIN.2551
C S_MAIN.2552
Do j = 1, 4 S_MAIN.2553
If (j .eq. 1 S_MAIN.2554
& .or. (j .gt. 1 .and. dump_days(j) .gt. 1)) then S_MAIN.2555
Do k = 1, nvars S_MAIN.2556
Do i = 1, points S_MAIN.2557
dumpmean_days(i,k,j) = dumpmean_days(i,k,j) S_MAIN.2558
& + dumpmean_day(i,k) S_MAIN.2559
enddo S_MAIN.2560
enddo S_MAIN.2561
If (mod(daycount-start_diagday+1,dump_days(j)) .eq. 0) S_MAIN.2562
& then S_MAIN.2563
Call CALC_DUMPDAYS
( S_MAIN.2564
C ! IN dimension of dump array. S_MAIN.2565
& points, nvars, cloud_count , tcount, qcount S_MAIN.2566
& ,dumpmean_day, dump_days, j S_MAIN.2567
& ,dumpmean_days) S_MAIN.2568
C S_MAIN.2569
C--------------------------------------------------------------------- S_MAIN.2570
C If required print mean DUMP over a no. of days, S_MAIN.2571
C ( up to 4 periods) S_MAIN.2572
C to units 32, 33, 34, 35 resp. S_MAIN.2573
C--------------------------------------------------------------------- S_MAIN.2574
C S_MAIN.2575
head_label = 3 S_MAIN.2576
If (prindump_days S_MAIN.2577
& .and. mod(daycount-start_diagday+1,dump_days(j)) S_MAIN.2578
& .eq. 0.) then S_MAIN.2579
Call DUMP_PRINT
( S_MAIN.2580
& points, nlevs, nwet S_MAIN.2581
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2582
C ! IN dimension of dump array. S_MAIN.2583
& ,nvars, sec_dump S_MAIN.2584
C ! S_MAIN.2585
& ,dumpmean_days(1,1,j), 1, stepcount S_MAIN.2586
& ,day,yearno, time_string, daycount S_MAIN.2587
& ,dump_days(j), land_mask, S_MAIN.2588
& head_label, nout(4+j)) S_MAIN.2589
endif S_MAIN.2590
C S_MAIN.2591
C--------------------------------------------------------------------- S_MAIN.2592
C If required output graphical values of mean DUMP S_MAIN.2593
C over a no. of days, S_MAIN.2594
C ( up to 4 periods given by dump_days, dump_days S_MAIN.2595
C etc in NAMELIST ) S_MAIN.2596
C to units 39, 40, 41, 42 resp. S_MAIN.2597
C--------------------------------------------------------------------- S_MAIN.2598
C S_MAIN.2599
If (grafdump_days .and. S_MAIN.2600
& mod(daycount-start_diagday+1,dump_days(j)).eq. 0.) S_MAIN.2601
& then S_MAIN.2602
Call DUMP_GRAF
( S_MAIN.2603
& points, nvars S_MAIN.2604
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2605
& ,dumpmean_days(1,1,j),1,time_init S_MAIN.2606
& ,day,nout(10+j)) S_MAIN.2607
endif S_MAIN.2608
Do k = 1, nvars S_MAIN.2609
Do i = 1, points S_MAIN.2610
dumpmean_days(i,k,j) = 0. S_MAIN.2611
enddo S_MAIN.2612
enddo S_MAIN.2613
endif S_MAIN.2614
endif ! daycount .ge. start_diagday S_MAIN.2615
enddo ! j S_MAIN.2616
C S_MAIN.2617
C--------------------------------------------------------------------- S_MAIN.2618
C If budget calculations are required ,write them out S_MAIN.2619
C to unit 22. S_MAIN.2620
C--------------------------------------------------------------------- S_MAIN.2621
C S_MAIN.2622
C Daily means S_MAIN.2623
C S_MAIN.2624
If (budg_calcs .and. prindump_day) then S_MAIN.2625
Call SUB_DATA
( S_MAIN.2626
C ! IN leading dimensions of arrays S_MAIN.2627
& points, nlevs, nwet S_MAIN.2628
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2629
& ,' At end of mean over day ', S_MAIN.2630
& stepcount-1, yearno, day, time_string, daycount, S_MAIN.2631
& u, v, t, theta, q, qcl, qcf, layer_cloud, S_MAIN.2632
& pstar, t_deep_soil, smc, canopy, snodep, tstar, zh, S_MAIN.2633
& z0msea, cca, iccb, icct, smcl) S_MAIN.2634
C S_MAIN.2635
C Meaning period of days S_MAIN.2636
C S_MAIN.2637
elseif (budg_calcs .and. prindump_days) then S_MAIN.2638
j = 1 S_MAIN.2639
Do while (dump_days(j) .ne. 1 .and. S_MAIN.2640
& (mod(daycount-start_diagday+1,dump_days(j)) .eq. 0) S_MAIN.2641
& .and. j .le. 4) S_MAIN.2642
S_MAIN.2643
Call SUB_DATA
( S_MAIN.2644
! IN leading dimensions of arrays S_MAIN.2645
& points, nlevs, nwet S_MAIN.2646
& ,nfor, nbl_levs, nsoilt_levs, nsoilm_levs, ntrop S_MAIN.2647
& ,' At end of mean over days ', S_MAIN.2648
& stepcount-1, yearno, day, time_string, daycount, S_MAIN.2649
& u, v, t, theta, q, qcl, qcf, layer_cloud, S_MAIN.2650
& pstar, t_deep_soil, smc, canopy, S_MAIN.2651
& snodep, tstar, zh, S_MAIN.2652
& z0msea, cca, iccb, icct, smcl) S_MAIN.2653
S_MAIN.2654
j = j + 1 S_MAIN.2655
S_MAIN.2656
enddo S_MAIN.2657
endif ! budg_calcs .and. prindump_day S_MAIN.2658
endif ! daycount .ge. start_diagday S_MAIN.2659
C S_MAIN.2660
C--------------------------------------------------------------------- S_MAIN.2661
C Form restart dump S_MAIN.2662
C--------------------------------------------------------------------- S_MAIN.2663
C S_MAIN.2664
Call RESTART_DUMP
( S_MAIN.2665
! IN dimensions of main arrays S_MAIN.2666
& points, nlevs, nwet, nprimvars, S_MAIN.2667
& nbl_levs, nsoilt_levs, nsoilm_levs, S_MAIN.2668
! S_MAIN.2669
& resdump, u, v, t, theta, q, qcl, qcf, layer_cloud, S_MAIN.2670
& pstar, t_deep_soil, smc, canopy, S_MAIN.2671
& snodep, tstar, zh, z0msea, S_MAIN.2672
& cca, iccb, icct, smcl) S_MAIN.2673
C S_MAIN.2674
C S_MAIN.2675
C--------------------------------------------------------------------- S_MAIN.2676
C Write dump and restart information to tape every S_MAIN.2677
C resdump_days or the l S_MAIN.2678
C day of the run whichever is sooner. S_MAIN.2679
C--------------------------------------------------------------------- S_MAIN.2680
C S_MAIN.2681
If (tapeout) then S_MAIN.2682
If ((mod(daycount,resdump_days) .eq. 0) S_MAIN.2683
& .or. daycount .eq. ndayin) then S_MAIN.2684
If (ancyc) then S_MAIN.2685
i = daynumber S_MAIN.2686
else S_MAIN.2687
i = daycount S_MAIN.2688
endif S_MAIN.2689
If (stats) then S_MAIN.2690
Write (55) i, resdump, iv, iy, idum S_MAIN.2691
elseif (obs) then S_MAIN.2692
Write (55) i,resdump S_MAIN.2693
endif S_MAIN.2694
Write (6,*) ' Restart variables for Day ',daycount, S_MAIN.2695
& ' written to tape ( unit 55 )' S_MAIN.2696
endif S_MAIN.2697
endif ! tapeout etc. S_MAIN.2698
If (ancyc) daynumber = daynumber + 1 S_MAIN.2699
If (stats .and. ancyc) dayno_wint = dayno_wint + 1 S_MAIN.2700
S_MAIN.2701
endif ! nstepsin .eq. full_ndayin+1 S_MAIN.2702
S_MAIN.2703
enddo ! daycount S_MAIN.2704
C S_MAIN.2705
C--------------------------------------------------------------------- S_MAIN.2706
C Print out diagnostics for OBS at end of run to units 47 and 44 S_MAIN.2707
C--------------------------------------------------------------------- S_MAIN.2708
C S_MAIN.2709
If (obs .and. prindump_obs) then S_MAIN.2710
Call OBS_DUMP_FINAL
(points, dap3, dab3, nlevs, nwet S_MAIN.2711
& ,daycount-1, stepcount-1, timestep, ichgf S_MAIN.2712
& ,t, q, u, v, smc, snodep, tstar S_MAIN.2713
& ,nout(19), nout(16)) S_MAIN.2714
endif S_MAIN.2715
Stop S_MAIN.2716
End ! Program scmmain S_MAIN.2717
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2718
C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_MAIN.2719
*ENDIF S_MAIN.2720
S_MAIN.2721
S_MAIN.2722