updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / da / da_control / da_control.f90
blob5abe3ff927aa89adf8ed1ce478a9a9c584dc67b5
1 module da_control
3 !--------------------------------------------------------------------------
4 ! Purpose: Common reference point for WRFVAR control.
5 !--------------------------------------------------------------------------
7 use module_driver_constants, only : max_domains, max_eta, max_moves, max_bogus, &
8 max_outer_iterations, max_instruments, max_plevs, &
9 max_zlevs, &
10 max_ocean, num_ob_indexes
12 implicit none
14 #include "namelist_defines.inc"
16 ! switches set from other namelist options
17 logical :: use_obsgts
18 logical :: use_rad
20 !---------------------------------------------------------------------------
21 ! [0.0] WRF hybrid coordinate variables
22 !---------------------------------------------------------------------------
23 real, allocatable :: c1f(:), c2f(:), c3f(:), c4f(:)
24 real, allocatable :: c1h(:), c2h(:), c3h(:), c4h(:)
26 !---------------------------------------------------------------------------
27 ! [1.0] Physical parameter constants (all NIST standard values):
28 !---------------------------------------------------------------------------
30 ! Fundamental constants:
31 real, parameter :: pi = 3.1415926 ! Value used in WRF.
32 real, parameter :: radian = pi / 180.0
33 real, parameter :: gas_constant = 287.0 ! Value used in WRF.
34 real, parameter :: gas_constant_v = 461.6 ! Value used in WRF.
35 real, parameter :: cp = 7.0*gas_constant/2.0 ! Value used in WRF.
36 real, parameter :: t_kelvin = 273.15
37 real, parameter :: t_triple = 273.16 ! triple point of water
38 ! The imported code for ssmi and radiance uses 273.0 in a way that suggests
39 ! it may not be a lazy definition of the melting point of water, so keep the
40 ! value separate for the moment
41 real, parameter :: t_roughem = 273.0
42 real, parameter :: t_landem = 273.0
44 real, parameter :: kappa = gas_constant / cp
45 real, parameter :: rd_over_rv = gas_constant / gas_constant_v
46 real, parameter :: rd_over_rv1 = 1.0 - rd_over_rv
47 real, parameter :: L_over_Rv = 5418.12
49 real, parameter :: gamma = 1.4
51 ! Earth constants:
52 real, parameter :: gravity = 9.81 ! m/s - value used in WRF.
53 ! real, parameter :: earth_radius = 6378.15
54 real, parameter :: earth_radius = 6370.0 ! Be consistant with WRF
55 real, parameter :: satellite_height = 35800.0 ! used by da_get_satzen
56 ! real, parameter :: earth_omega = 2.0*pi/86400.0 ! Omega
57 real, parameter :: earth_omega = 0.000072921 ! Omega 7.2921*10**-5
59 ! Saturation Vapour Pressure Constants(Rogers & Yau, 1989)
60 real, parameter :: es_alpha = 611.2
61 real, parameter :: es_beta = 17.67
62 real, parameter :: es_gamma = 243.5
63 real, parameter :: es_gammabeta = es_gamma * es_beta
64 real, parameter :: es_gammakelvin = es_gamma - t_kelvin
66 ! Explicit moist constants:
67 real, parameter :: SVP1=0.6112, SVP2=17.67, SVP3=29.65
68 real, parameter :: SVPT0=t_kelvin, TO=t_kelvin
69 real, parameter :: N0R=8.0E6, N0S=2.0E7, RHOS=0.1
70 real, parameter :: AVT=841.99667, BVT=0.8, BVT2=2.5+0.5*BVT, BVT3=3.0+BVT
71 real, parameter :: PPI=1.0/(pi*N0R), PPIS=1.0/(pi*N0S*RHOS)
72 real, parameter :: XLV1=2370.0, XLF0=0.3337E6, XLV0=3.15E6
73 real, parameter :: XLS=XLV0-XLV1*t_triple+XLF0
75 ! Planetary boundary physics constants
76 real, parameter :: k_kar = 0.4 ! Von Karman constant
78 ! Zenith Total Delay:
79 ! Hydrostatic delay:
80 real, parameter :: zdk1 = 2.2768e-5
81 real, parameter :: zdk2 = 2.66e-3
82 real, parameter :: zdk3 = 2.8e-7
83 ! Wet delay:
84 real, parameter :: wdk1 = 2.21e-7
85 real, parameter :: wdk2 = 3.73e-3
87 ! GPS Refractivity constant
88 real, parameter :: a_ew = 0.622
89 real, parameter :: b_ew = 0.378
91 ! GPS Refractivity constant
92 real, parameter :: coeff = (wdk2*1.e8) / 77.6
94 ! GPS Excess Phase parameter
95 !hcl-note: is 5km a universal applicable setting?
96 !hcl-note: should this be a namelist option?
97 real, parameter :: gps_ray_path_step = 5.0 !5km
98 !hcl-note: 2000 is derived from 20km (50hPa) top with 0.01km interval
99 !hcl-note: should the top and interval be namelist options?
100 integer, parameter :: interpolate_level = 2000
102 #if RWORDSIZE==8
103 real, parameter :: da_zero = 0D0
104 #else
105 real, parameter :: da_zero = 0.0
106 #endif
108 complex, parameter :: da_zero_complex = (da_zero,da_zero)
110 !---------------------------------------------------------------------------
111 ! [2.0] WRF-Var parameter constants:
112 !---------------------------------------------------------------------------
114 ! Missing values and the index number of the quality control
116 integer, parameter :: missing = -888888
117 real , parameter :: missing_r = -888888.0
118 real , parameter :: xmiss = -88.0
119 ! real , parameter :: Max_StHeight_Diff = 100.0 !became a namelist variable
121 integer, parameter :: cv_options_hum_specific_humidity = 1
122 integer, parameter :: cv_options_hum_relative_humidity = 2
124 ! No-one explains what these options means anywhere
125 integer, parameter :: vert_corr_1 = 1
126 integer, parameter :: vert_corr_2 = 2
128 integer, parameter :: vertical_ip_0 = 0
129 integer, parameter :: vertical_ip_sqrt_delta_p = 1
130 integer, parameter :: vertical_ip_delta_p = 2
132 integer, parameter :: vert_evalue_global = 1
133 integer, parameter :: vert_evalue_local = 2
135 integer, parameter :: alphacv_method_vp = 1
136 integer, parameter :: alphacv_method_xa = 2
138 integer, parameter :: sfc_assi_options_1 = 1
139 integer, parameter :: sfc_assi_options_2 = 2
141 integer, parameter :: check_rh_simple = 1
142 integer, parameter :: check_rh_tpw = 2
144 logical :: anal_type_verify=.false.
145 logical :: anal_type_randomcv=.false.
146 logical :: anal_type_qcobs=.false.
147 logical :: anal_type_hybrid_dual_res=.false.
149 integer,parameter :: monitor_on = 1
150 integer,parameter :: monitor_off = 0
152 integer,parameter :: qc_good = 1
153 integer,parameter :: qc_bad = -1
154 integer,parameter :: qc_varbc_bad = -1
156 integer, parameter :: bufr_satellite_id = 1
157 integer, parameter :: bufr_ifov = 2
158 integer, parameter :: bufr_year = 3
159 integer, parameter :: bufr_month = 4
160 integer, parameter :: bufr_day = 5
161 integer, parameter :: bufr_hour = 6
162 integer, parameter :: bufr_minute = 7
163 integer, parameter :: bufr_second = 8
164 integer, parameter :: bufr_lat = 9
165 integer, parameter :: bufr_lon = 10
166 integer, parameter :: bufr_satzen = 11
167 integer, parameter :: bufr_solzen = 12
168 integer, parameter :: bufr_station_height = 13
169 integer, parameter :: bufr_landsea_mask = 14
170 integer, parameter :: bufr_solazi = 15 !RTTOV9_3
172 integer, parameter :: nchan_amsua = 15
173 integer, parameter :: nchan_amsub = 5
174 integer, parameter :: nchan_mhs = 5
175 integer, parameter :: nchan_msu = 4
176 integer, parameter :: nchan_hirs2 = 19
177 integer, parameter :: nchan_hirs3 = 19
178 integer, parameter :: nchan_hirs4 = 19
179 integer, parameter :: nchan_ssmis = 24
180 integer, parameter :: nchan_airs = 281
182 ! WRFVAR Minimisation:
184 integer :: iter
185 integer :: cv_size
186 integer, parameter :: MP = 6
187 integer, parameter :: LP = 6
188 integer, parameter :: MAXFEV = 10
189 real, parameter :: FTOL = 1.0E-4
190 real, parameter :: GTOL = 0.9
191 real, parameter :: XTOL = 1.0E-17
192 real, parameter :: STPMIN = 1.0E-20
193 real, parameter :: STPMAX = 1.0E+20
195 ! Background errors:
196 real, parameter :: pplow = 1.0e-8 ! Machine lowest number?
197 real, parameter :: pp_umin = 1.0e-2 ! Minimum u back. error (m/s).
198 real, parameter :: pp_vmin = 1.0e-2 ! Minimum v back. error (m/s).
199 real, parameter :: pp_tmin = 1.0e-2 ! Minimum t back. error (K).
200 real, parameter :: pp_qmin = 1.0e-6 ! Minimum q back. error (kg/kg)
201 real, parameter :: pp_pmin= 1.0e+1 ! Minimum pp back. error (Pa).
203 ! FFTs:
204 integer, parameter :: Forward_FFT = -1 ! Grid to spectral
205 integer, parameter :: Inverse_FFT = 1 ! Spectral to grid.
206 integer, parameter :: num_fft_factors = 10 ! Max number of factors.
207 integer, parameter :: nrange =1000! Range to search for efficient FFT.
209 ! Balance:
210 integer, parameter :: balance_geo = 1 ! Geostrophic balance.
211 integer, parameter :: balance_cyc = 2 ! Cyclostrophic balance.
212 integer, parameter :: balance_geocyc = 3 ! Geo/cyclostrophic balance.
214 ! Adjoint tests:
215 real, parameter :: typical_u_rms = 2.0 ! m/s
216 real, parameter :: typical_v_rms = 2.0 ! m/s
217 real, parameter :: typical_speed_rms = 2.0 ! m/s
218 real, parameter :: typical_tb19v_rms = 1.0 ! K
219 real, parameter :: typical_tb19h_rms = 1.0 ! K
220 real, parameter :: typical_tb22v_rms = 1.0 ! K
221 real, parameter :: typical_tb37v_rms = 1.0 ! K
222 real, parameter :: typical_tb37h_rms = 1.0 ! K
223 real, parameter :: typical_tb85v_rms = 1.0 ! K
224 real, parameter :: typical_tb85h_rms = 1.0 ! K
225 real, parameter :: typical_t_rms = 1.0 ! K
226 real, parameter :: typical_p_rms = 100.0 ! Pa
227 real, parameter :: typical_q_rms = 0.00001 ! g/kg
228 real, parameter :: typical_rho_rms = 0.01 ! kg/m^3
229 real, parameter :: typical_tpw_rms = 0.2 ! cm
230 real, parameter :: typical_ref_rms = 5.0 ! N unit
231 real, parameter :: typical_eph_rms =1000.0 ! km
232 real, parameter :: typical_rh_rms = 20.0 ! %
233 real, parameter :: typical_thickness_rms = 50.0 ! m
234 real, parameter :: typical_qrn_rms = 0.00001 ! g/kg
235 real, parameter :: typical_qcw_rms = 0.00001 ! g/kg
236 real, parameter :: typical_qci_rms = 0.00001 ! g/kg
237 real, parameter :: typical_qsn_rms = 0.00001 ! g/kg
238 real, parameter :: typical_qgr_rms = 0.00001 ! g/kg
239 real, parameter :: typical_w_rms = 0.1 ! m/s
240 real, parameter :: typical_rv_rms = 1.0 ! m/s
241 real, parameter :: typical_rf_rms = 1.0 ! dBZ
242 real, parameter :: typical_rain_rms = 1.0 ! mm
244 ! The following typical mean squared values depend on control variable. They
245 ! are calculated in da_setup_background_errors and used in the VvToVp adjoint
246 ! test:
248 real, parameter :: inv_typ_vp1_sumsq = 0.00001 ! 1/sum(psi**2)
249 real, parameter :: inv_typ_vp2_sumsq = 0.00001 ! 1/sum(chi**2)
250 real, parameter :: inv_typ_vp3_sumsq = 0.00001 ! 1/sum(phi_u**2)
251 real, parameter :: inv_typ_vp4_sumsq = 10000.0 ! 1/sum(q**2)
252 real, parameter :: inv_typ_vp5_sumsq = 0.00001 ! 1/sum(?**2)
253 real, parameter :: inv_typ_vpalpha_sumsq = 1.0 ! 1/sum(?**2)
255 #include "version_decl"
257 integer, parameter :: fg_format_wrf_arw_regional = 1
258 integer, parameter :: fg_format_wrf_nmm_regional = 2
259 integer, parameter :: fg_format_wrf_arw_global = 3
260 integer, parameter :: fg_format_kma_global = 4
262 integer, parameter :: ob_format_bufr = 1
263 integer, parameter :: ob_format_ascii = 2
264 integer, parameter :: ob_format_madis = 3
266 integer, parameter :: convert_fd2uv = 1
267 integer, parameter :: convert_uv2fd = -1
269 ! Fortran unit parameters:
271 ! stdout, stderr, trace_unit all controlled from namelist
273 ! Units 9,10 are used for reading and writing namelist.input/output in WRF
275 ! Do not use get_unit/free_unit because tracing is too low level
276 integer, parameter :: trace_csv_unit = 8
278 integer :: y_unit, yp_unit, cost_unit, grad_unit, stats_unit, jo_unit, stats_unit2
279 integer :: check_max_iv_unit, check_buddy_unit, rand_unit, omb_unit, &
280 filtered_obs_unit
281 integer :: biasprep_unit, qcstat_conv_unit
282 integer :: varbc_tamdar_unit
284 integer,parameter :: filename_len = 200
286 integer, parameter :: num_alpha_corr_types = 3
288 integer, parameter :: alpha_corr_type_exp = 1
289 integer, parameter :: alpha_corr_type_soar = 2
290 integer, parameter :: alpha_corr_type_gaussian = 3
292 integer :: alpha_corr_unit1(num_alpha_corr_types)
293 integer :: alpha_corr_unit2(num_alpha_corr_types)
295 integer, parameter :: max_num_of_var = 200 ! Maximum # of stored fields.
297 integer, parameter :: unit_start = 20
298 integer, parameter :: unit_end = 500
299 logical :: unit_used(unit_start:unit_end) = .false.
301 ! grid properties
303 character(len=3), parameter :: grid_ordering = "xyz"
304 character(len=3), parameter :: grid_stagger = "xyz"
306 !---------------------------------------------------------------------------
307 ! [3.0] Variables used in MM5 part of code:
308 !---------------------------------------------------------------------------
310 integer :: map_projection !1=LamConf/2=PolarSte/3=Mercator
311 !0=CylEqui/6=Cassini
312 real :: ycntr
313 integer :: coarse_ix ! coarse domain dim in i direction.
314 integer :: coarse_jy ! coarse domain dim in y direction.
315 real :: coarse_ds ! Coarse domain gridlength (km)
316 real :: start_x ! i posn. of (1,1) in coarse domain.
317 real :: start_y ! j posn. of (1,1) in coarse domain.
318 real :: start_lat ! Latitude coresponds to start_(x,y)
319 real :: start_lon ! Longitude coresponds to start_(x,y)
320 real :: delt_lat ! Latitude increments for global grids
321 real :: delt_lon ! Longitude increments for global grids
323 real :: phic ! coarse domain central lat(degree)
324 real :: xlonc ! coarse domain central lon(degree)
325 real :: cone_factor ! Cone Factor
326 real :: truelat1_3dv ! True latitude 1 (degrees)
327 real :: truelat2_3dv ! True latitude 2 (degrees)
328 real :: pole ! Pole latitude (degrees)
329 real :: dsm ! Current domain gridlength (km)
330 real :: psi1 ! ?
331 real :: c2 ! earth_radius * COS(psi1)
333 real :: ptop
334 real, parameter :: t0 = 300.0
336 !------------------------------------------------------------------------------
337 ! 4.0 vertical interpolation options
338 !------------------------------------------------------------------------------
340 integer, parameter :: v_interp_not_specified = missing, &
341 v_interp_p = 1, &
342 v_interp_h = 2
344 !------------------------------------------------------------------------------
345 ! WRFVAR scalar constants:
346 !------------------------------------------------------------------------------
348 integer :: Anal_Space ! Space of analysis
349 ! ( 1 = Full model,
350 ! 2 = Transformed grid,
351 ! 3 = Ob space (PSAS) )
353 integer :: mix ! 1st dimension of analysis grid.
354 integer :: mjy ! 2nd dimension of analysis grid.
355 integer :: mkz ! 3rd dimension of analysis grid.
357 ! Recursive filter:
359 real, allocatable :: rf_turnconds(:) ! RF turning conditions.
361 integer, parameter :: max_ob_levels = 1001 ! Maximum levels for single ob
362 integer, parameter :: max_fgat_time = 100 ! Maximum levels for FGAT.
364 integer :: time
366 logical :: gaussian_lats
369 integer :: cv_size_domain_jb ! Total jb cv size.
370 integer :: cv_size_domain_je ! Total je cv size.
371 integer :: cv_size_domain_jp ! Total jp cv size.
372 integer :: cv_size_domain_js ! Total js cv size.
373 integer :: cv_size_domain_jl ! Total jl cv size.
374 integer :: cv_size_domain_jt ! Total jt cv size.
375 integer :: cv_size_domain ! Total cv size.
377 ! Hybrid:
378 real :: sigma_alpha ! Alpha standard deviation.
379 real :: jb_factor ! Weighting for Background Error Cov.
381 ! Namelist variables in future?:
382 real, parameter :: maximum_rh = 100.0
383 real, parameter :: minimum_rh = 10.0
385 real, parameter :: qlimit = 1.0e-12 ! imposed minimum mixing ratio
387 ! other
389 integer, parameter :: jperr = 6
391 ! NCEP errors (U in m/s, V in m/s, T in K, H in %, P in Pa)
392 ! rh has been divided by 2
394 real, parameter :: err_k(0:jperr+1) = &
395 (/200000.0, 100100.0,70000.0,50000.0,30000.0,10000.0,5000.0, 1.0/)
396 real, parameter :: err_u(0:jperr+1) = &
397 (/ 1.4, 1.4, 2.4, 2.8, 3.4, 2.5, 2.7, 2.7/)
398 real, parameter :: err_v(0:jperr+1) = &
399 (/ 1.4, 1.4, 2.4, 2.8, 3.4, 2.5, 2.7 , 2.7 /)
400 real, parameter :: err_t(0:jperr+1) = &
401 (/ 1.8, 1.8, 1.3, 1.3, 2.0, 3.1, 4.0 , 4.0 /)
402 real, parameter :: err_rh(0:jperr+1) = &
403 (/ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0/)
404 real, parameter :: err_p(0:jperr+1) = &
405 (/ 100.0,100.0, 100.0, 100.0, 100.0, 100.0,100.0,100.0 /)
407 ! Buddy check parameters (YRG, 10/3/2008):
409 real, parameter :: max_buddy_t = 8.0, &
410 max_buddy_uv = 8.0, &
411 max_buddy_z = 8.0, &
412 max_buddy_rh = 40.0, &
413 max_buddy_p = 350.0, &
414 buddy_weight = 1.0, &
415 bin_p_width = 5000.0, &
416 bin_z_width = 500.0
418 ! Define various ways for bad data to be flagged.
420 integer, parameter :: &
421 missing_data = -88, & ! Data is missing with the value of
422 ! missing_r
423 outside_of_domain = -77, & ! Data outside horizontal domain
424 ! or time window, data set to missing_r
425 fail_varbc_aircraft = -55, & ! Data fail VarBC of aircraft
426 ! => no action
427 wrong_direction = -15, & ! Wind vector direction <0 or> 360
428 ! => direction set to missing_r
429 negative_spd = -14, & ! Wind vector norm is negative
430 ! => norm set to missing_r
431 zero_spd = -13, & ! Wind vector norm is zero
432 ! => norm set to missing_r
433 wrong_wind_data = -12, & ! Spike in wind profile
434 ! =>direction and norm set to missing_r
435 zero_t_td = -11, & ! t or td = 0 => t or td, rh and qv
436 ! are set to missing_r,
437 t_fail_supa_inver = -10, & ! superadiabatic temperature
439 wrong_t_sign = - 9, & ! Spike in Temperature profile
441 above_model_lid = - 8, & ! heigh above model lid
442 ! => no action
443 far_below_model_surface = - 7, & ! heigh far below model surface
444 ! => no action
445 below_model_surface = - 6, & ! height below model surface
446 ! => no action
447 standard_atmosphere = - 5, & ! Missing h, p or t
448 ! =>Datum interpolated from standard atm
449 from_background = - 4, & ! Missing h, p or t
450 ! =>Datum interpolated from model
451 fails_error_max = - 3, & ! Datum Fails error max check
452 ! => no action
453 fails_buddy_check = - 2, & ! Datum Fails buddy check
454 ! => no action
455 no_buddies = - 1, & ! Datum has no buddies
456 ! => no action
457 good_quality = 0, & ! OBS datum has good quality
459 convective_adjustment = 1, & ! convective adjustement check
460 ! =>apply correction on t, td, rh and qv
461 surface_correction = 2, & ! Surface datum
462 ! => apply correction on datum
463 Hydrostatic_recover = 3, & ! Height from hydrostaic assumption with
464 ! the OBS data calibration
465 Reference_OBS_recover = 4, & ! Height from reference state with OBS
466 ! data calibration
467 Other_check = 88 ! passed other quality check
469 ! QC flags for gpsref
470 integer, parameter :: qcflag_pcnt_below = -31
471 integer, parameter :: qcflag_pcnt_middle = -32
472 integer, parameter :: qcflag_pcnt_above = -33
473 integer, parameter :: qcflag_dndz = -34
474 integer, parameter :: qcflag_dndz2 = -35
475 integer, parameter :: qcflag_cutoff = -36
476 integer, parameter :: qcflag_height = -77
478 ! Observations:
480 integer :: num_procs ! Number of total processors.
481 integer :: myproc ! My processor ID.
482 integer, parameter :: root = 0 ! Number of root processor
483 logical :: rootproc ! Am I the root processor
485 integer, parameter :: rtm_option_rttov = 1
486 integer, parameter :: rtm_option_crtm = 2
488 ! rtm_init setup parameter
490 integer, parameter :: maxsensor = 30
492 integer, parameter :: npres_print = 12
495 ! Tracing
497 integer :: trace_start_points=0 ! Number of routines to initiate trace
499 integer, parameter :: sound = 1
500 integer, parameter :: synop = 2
501 integer, parameter :: pilot = 3
502 integer, parameter :: satem = 4
503 integer, parameter :: geoamv = 5
504 integer, parameter :: polaramv = 6
505 integer, parameter :: airep = 7
506 integer, parameter :: gpspw = 8
507 integer, parameter :: gpsref = 9
508 integer, parameter :: metar = 10
509 integer, parameter :: ships = 11
510 integer, parameter :: ssmi_rv = 12
511 integer, parameter :: ssmi_tb = 13
512 integer, parameter :: ssmt1 = 14
513 integer, parameter :: ssmt2 = 15
514 integer, parameter :: qscat = 16
515 integer, parameter :: profiler = 17
516 integer, parameter :: buoy = 18
517 integer, parameter :: bogus = 19
518 integer, parameter :: pseudo = 20
519 integer, parameter :: radar = 21
520 integer, parameter :: radiance = 22
521 integer, parameter :: airsr = 23
522 integer, parameter :: sonde_sfc = 24
523 integer, parameter :: mtgirs = 25
524 integer, parameter :: tamdar = 26
525 integer, parameter :: tamdar_sfc = 27
526 integer, parameter :: rain = 28
527 integer, parameter :: gpseph = 29
528 #if (WRF_CHEM == 1)
529 integer, parameter :: chemic_surf = 30
530 #endif
532 character(len=14), parameter :: obs_names(num_ob_indexes) = (/ &
533 "sound ", &
534 "synop ", &
535 "pilot ", &
536 "satem ", &
537 "geoamv ", &
538 "polaramv ", &
539 "airep ", &
540 "gpspw ", &
541 "gpsrf ", &
542 "metar ", &
543 "ships ", &
544 "ssmi_rv ", &
545 "ssmi_tb ", &
546 "ssmt1 ", &
547 "ssmt2 ", &
548 "qscat ", &
549 "profiler ", &
550 "buoy ", &
551 "bogus ", &
552 "pseudo ", &
553 "radar ", &
554 "radiance ", &
555 "airs retrieval", &
556 "sonde_sfc ", &
557 "mtgirs ", &
558 "tamdar ", &
559 "tamdar_sfc ", &
560 "rain ", &
561 "gpseph " &
562 #if (WRF_CHEM == 1)
563 ,"chemic_surf " &
564 #endif
567 logical :: pseudo_tpw
568 logical :: pseudo_ztd
569 logical :: pseudo_ref
570 logical :: pseudo_uvtpq
572 integer, parameter :: max_no_fm = 290
574 integer, parameter :: num_ob_vars=10
576 logical, parameter :: in_report(num_ob_vars,2) = reshape((/&
577 .false.,.false.,.false.,.false.,.false.,.false.,.false.,.false.,.false., & ! sound
578 .true.,.true.,.true.,.true.,.true.,.true.,.false.,.false.,.false.,.false.,.false./), &
579 (/num_ob_vars,2/))
581 integer, parameter :: report_h = 1
582 integer, parameter :: report_u = 2
583 integer, parameter :: report_v = 3
584 integer, parameter :: report_t = 4
585 integer, parameter :: report_q = 5
586 integer, parameter :: report_p = 6
587 integer, parameter :: report_rh = 7
588 integer, parameter :: report_slp = 8
589 integer, parameter :: report_zk = 9
591 logical :: obs_use(num_ob_indexes) = .false.
593 ! Special cases
595 integer, parameter :: fm_satem = 86
596 integer, parameter :: fm_amv = 88
598 integer, parameter :: fm_index(max_no_fm) = (/ &
599 0,0,0,0,0,0,0,0,0,0, & ! 1-10
600 0,Synop,Ships,0,Metar, & ! 11-15
601 Metar,Ships,buoy,buoy,0, & ! 16-20
602 0,0,0,0,0,0,0,0,0,0, & ! 21-30
603 0,pilot,pilot,pilot,sound, & ! 31-35
604 sound,sound,sound,0,0, & ! 36-40
605 0,airep,0,0,0,0,0,0,0,0, & ! 41-50
606 0,0,0,0,0,0,0,0,0,0, & ! 51-60
607 0,0,0,0,0,0,0,0,0,0, & ! 61-70
608 0,0,0,0,0,0,0,0,0,0, & ! 71-80
609 0,0,0,0,0,satem,0,geoamv,0,0, & ! 81-90
610 0,0,0,0,0,airep,airep,0,0,0, & ! 91-100
611 tamdar,0,0,0,0,0,0,0,0,0, & ! 101-110
612 gpspw,0,0,gpspw,0,gpsref,0,gpseph,0,0, & ! 111-120
613 ssmt1,ssmt2,0,0,ssmi_rv,0,0,0,0,0, & ! 121-130
614 0,profiler,airsr,0,bogus,0,0,0,0,0, & ! 131-140
615 0,0,0,0,0,0,0,0,0,0, & ! 141-150
616 0,0,0,0,0,0,0,0,0,0, & ! 151-160
617 mtgirs,0,0,0,0,0,0,0,0,0, & ! 161-170
618 0,0,0,0,0,0,0,0,0,0, & ! 171-180
619 0,0,0,0,0,0,0,0,0,0, & ! 181-190
620 0,0,0,0,0,0,0,0,0,0, & ! 191-200
621 0,0,0,0,0,0,0,0,0,0, & ! 201-210
622 0,0,0,0,0,0,0,0,0,0, & ! 211-220
623 0,0,0,0,0,0,0,0,0,0, & ! 231-230
624 0,0,0,0,0,0,0,0,0,0, & ! 231-240
625 0,0,0,0,0,0,0,0,0,0, & ! 241-250
626 0,0,0,0,0,0,0,0,0,0, & ! 251-260
627 0,0,0,0,0,0,0,0,0,0, & ! 261-270
628 0,0,0,0,0,0,0,0,0,0, & ! 271-280
629 qscat,0,0,0,0,0,0,0,0,0 /) ! 281-290
631 character(len=120) :: fmt_info ='(a12,1x,a19,1x,a40,1x,i6,3(f12.3,11x),6x,a5)'
632 character(len=120) :: fmt_srfc = '(7(:,f12.3,i4,f7.2))'
633 ! character(len=120) :: fmt_srfc = '(f12.3,i4,f7.2,F12.3,I4,F7.3)'
634 character(len=120) :: fmt_each = &
635 '(3(f12.3,i4,f7.2),11x,3(f12.3,i4,f7.2),11x,3(f12.3,i4,f7.2))'
637 ! lat/long information calculated in da_setup_firstguess_wrf
639 real, parameter :: deg_to_rad = pi/180.0
640 real, parameter :: rad_to_deg = 1.0/deg_to_rad
642 real, allocatable :: cos_xls(:)
643 real, allocatable :: sin_xls(:)
644 real, allocatable :: cos_xle(:)
645 real, allocatable :: sin_xle(:)
647 integer :: ierr ! General error code
648 integer :: comm ! MPI communicator
650 integer :: ids,ide,jds,jde,kds,kde
651 integer :: ims,ime,jms,jme,kms,kme
652 integer :: its,ite,jts,jte,kts,kte
653 integer :: ips,ipe,jps,jpe,kps,kpe
654 integer :: itsy,itey,jtsy,jtey,ktsy,ktey
655 integer :: itsx,itex,jtsx,jtex,ktsx,ktex
657 integer :: ide_ens,jde_ens,kde_ens
659 integer :: its_int,ite_int,jts_int,jte_int,kts_int,kte_int
660 integer :: ids_int,ide_int,jds_int,jde_int,kds_int,kde_int
661 integer :: ims_int,ime_int,jms_int,jme_int,kms_int,kme_int
662 integer :: ips_int,ipe_int,jps_int,jpe_int,kps_int,kpe_int
664 character (len=filename_len) :: input_file_ens = 'fg_ens'
666 TYPE dual_res_type
667 integer :: i
668 integer :: j
669 real :: dx
670 real :: dy
671 real :: dxm
672 real :: dym
673 END TYPE dual_res_type
674 TYPE(dual_res_type), allocatable :: aens_locs(:,:)
676 integer :: num_qcstat_conv(2,num_ob_indexes,num_ob_vars,npres_print+1)
677 character*4, parameter :: ob_vars(num_ob_vars) = (/'U ','V ','T ',&
678 'Q ','Ps ','Spd ',&
679 'Tpw ','GpsR','Thic','Rain'/)
680 real, parameter :: pptop(1:npres_print) = (/ 1000.0, 900.0, 800.0, 600.0, 400.0, 300.0, &
681 250.0, 200.0, 150.0, 100.0, 50.0, 0./)
683 real, parameter :: ppbot(npres_print) = (/ 1200.0, 999.9, 899.9, 799.0, 599.9, 399.9, &
684 299.9, 249.9, 199.9, 149.9, 99.9, 49.9/)
686 real*8, allocatable :: time_slots(:)
687 integer :: ifgat_ana !index of First Guess at Appropriate Time of analysis
689 logical :: global
691 logical, allocatable :: fgat_rain_flags(:)
693 integer, parameter :: no_thin = 0 ! no thinning
694 integer, parameter :: thin_single = 1 ! keep one ob within a thinning box
695 integer, parameter :: thin_multi = 2 ! keep multiple obs within a thinning box
696 integer, parameter :: thin_superob = 3 ! superob in 2-D thinning boxes
697 integer, parameter :: thin_superob_hv = 4 ! superob in horizontal and vertical
699 integer, parameter :: error_opt_nml = 1 ! ob error specified in namelist
701 end module da_control