/
input_mod.F
8935 lines (8062 loc) · 314 KB
/
input_mod.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !MODULE: input_mod.F
!
! !DESCRIPTION: Module INPUT\_MOD contains routines that read the GEOS-Chem
! input file at the start of the run and pass the information to several
! other GEOS-Chem F90 modules.
!\\
!\\
! !INTERFACE:
!
MODULE INPUT_MOD
!
! !USES:
!
USE CharPak_Mod, ONLY : MAXDIM => MAXSTRLEN
USE inquireMod, ONLY : findFreeLUN
USE PRECISION_MOD ! For GEOS-Chem Precision (fp)
IMPLICIT NONE
PRIVATE
!
! !PUBLIC MEMBER FUNCTIONS:
!
PUBLIC :: Read_Input_File
PUBLIC :: Do_Error_Checks
!
! !PRIVATE MEMBER FUNCTIONS:
!
PRIVATE :: SPLIT_ONE_LINE
PRIVATE :: READ_SIMULATION_MENU
PRIVATE :: READ_ADVECTED_SPECIES_MENU
PRIVATE :: READ_AEROSOL_MENU
PRIVATE :: READ_EMISSIONS_MENU
PRIVATE :: READ_CHEMISTRY_MENU
PRIVATE :: READ_RADIATION_MENU
PRIVATE :: READ_TRANSPORT_MENU
PRIVATE :: READ_CONVECTION_MENU
PRIVATE :: READ_DEPOSITION_MENU
PRIVATE :: READ_OUTPUT_MENU
PRIVATE :: READ_DIAGNOSTIC_MENU
PRIVATE :: READ_PLANEFLIGHT_MENU
PRIVATE :: READ_OBSPACK_MENU
PRIVATE :: SET_TINDEX
PRIVATE :: READ_ND49_MENU
PRIVATE :: READ_ND50_MENU
PRIVATE :: READ_ND51_MENU
PRIVATE :: READ_ND51b_MENU
PRIVATE :: READ_ND63_MENU
PRIVATE :: READ_PROD_LOSS_MENU
PRIVATE :: READ_NESTED_GRID_MENU
PRIVATE :: READ_BENCHMARK_MENU
PRIVATE :: READ_CH4_MENU
PRIVATE :: READ_PASSIVE_SPECIES_MENU
PRIVATE :: VALIDATE_DIRECTORIES
PRIVATE :: CHECK_DIRECTORY
PRIVATE :: CHECK_TIME_STEPS
PRIVATE :: IS_LAST_DAY_GOOD
!
! !REVISION HISTORY:
! 20 Jul 2004 - R. Yantosca - Initial version
! (1 ) Now references LSOA in READ_AEROSOL_MENU (bmy, 9/28/04)
! (2 ) Fixed error checks and assign LSPLIT for tagged Hg. Also now
! refernces LAVHRRLAI from "logical_mod.f" (eck, bmy, 12/20/04)
! (3 ) Updated for crystalline/aqueous aerosol tracers. Also moved routine
! IS_LAST_DAY_GOOD here from "main.f". Also now references
! "ocean_mercury_mod.f". Also now open the bpch file for output in
! READ_DIAGNOSTIC_MENU instead of in "main.f". (cas, sas, bmy, 2/3/05)
! (4 ) Now references "diag03_mod.f" and "diag41_mod.f". Fixed minor
! bugs. Now references FILE_EXISTS from "file_mod.f". Updated
! comments. (bmy, 3/28/05)
! (5 ) Now modified for GEOS-5 and GCAP met fields. Also now set LSPLIT
! correctly for HCN/CH3CN simulation. (swu, xyp, bmy, 6/30/05)
! (6 ) Now make sure all USE statements are USE, ONLY (bmy, 10/3/05)
! (7 ) Now read LMEGAN switch for MEGAN biogenics. Now read variable
! DATA_DIR_1x1 for 1x1 emissions files, etc. Now reference XNUMOL and
! XNUMOLAIR from "tracer_mod.f" (tmf, bmy, 10/25/05)
! (8 ) Now read LEMEP switch for EMEP emissions (bdf, bmy, 11/1/05)
! (9 ) Now added MERCURY MENU section. Also fixed bug in READ_ND48_MENU.
! (eck, cdh, bmy, 3/6/06)
! (10) Now read LGFED2BB switch for GFED2 biomass emissions (bmy, 4/5/06)
! (11) Bug fix for GCAP in IS_LAST_DAY_GOOD. Also now read LCTH, LMFLUX,
! LPRECON in READ_EMISSIONS_MENU. (bmy, 5/10/06)
! (12) Updated for ND42 SOA concentration diagnostic (dkh, bmy, 5/22/06)
! (13) Modified for future emissions (swu, bmy, 6/1/06)
! (14) Modified for BRAVO emissions (rjp, kfb, bmy, 6/26/06)
! (15) Remove support for GEOS-1 and GEOS-STRAT met fields. Also modified
! for David Streets' emissions. (bmy, 8/17/06)
! (16) Modified for variable tropopause. Also set dimension of ND28 diag
! for GFED2 or default biomass burning. Now read if Time Spent in
! Troposphere is wanted (phs, bmy, 10/17/06)
! (17) Now modified for OTD-LIS local redistribution. Remove references
! to GEOS-1 and GEOS-STRAT run dirs. (bmy, 11/5/07)
! (18) New error traps for OTD-LIS scaling, dependent on met field type.
! Bug fix, create string variables for ERROR_STOP. Bug fix: use ND52
! in call to SET_TINDEX in READ_DIAGNOSTIC_MENU. (ltm, bmy, 2/11/08)
! (19) Bug fix: use (0,0) in call to INIT_TRANSFER (phs, 6/17/08)
! (20) Minor fix in READ_TRANSPORT_MENU (cdh, bmy, 7/7/08)
! (21) Fixed typo READ_EMISSIONS_MENU for GEOS-3 (bmy, 10/30/08)
! (22) Set upper limit on dynamic timestep for 0.5 x 0.666 nested
! grids (yxw, bmy, dan, 11/6/08)
! (23) Now read LCAC switch for CAC emissions (amv, 1/09/2008)
! (24) Move the call to NDXX_SETUP (phs, 11/18/08)
! (25) Minor bug fix in READ_DIAGNOSTIC_MENU (tmf, 2/10/09)
! (26) Add LMEGANMONO switch in emission menu (ccc, 3/2/09)
! (27) Add LDICARB switch in aerosol menu (ccc, tmf, 3/10/09)
! (28) Now read LCOOKE in aerosol menu (phs, 5/18/09)
! (29) Add CH4_MENU in input.geos (kjw, 8/18/09)
! (30) Corrected typos in CHECK_TIME_STEPS (bmy, 8/21/09)
! (31) Now read LLINOZ in READ_SIMULATION_MENU (dbm, bmy, 10/16/09)
! (32) Remove reference to obsolete embedded chemistry stuff (bmy, 2/25/10)
! (33) Remove depreciated lightning options (ltm, bmy, 1/24/11)
! 25 Aug 2010 - R. Yantosca - Added modifications for MERRA
! 27 Aug 2010 - R. Yantosca - Added ProTeX headers
! 16 Feb 2011 - R. Yantosca - Add modifications for APM from G. Luo
! 29 Jul 2011 - R. Yantosca - Bug fix in READ_EMISSIONS_MENU for nested NA
! 07 Sep 2011 - P. Kasibhatla - Modified to include monthly GFED3
! 17 Jan 2012 - P. Kasibhatla - Modified to include daily and 3-hourly GFED3
! 08 Feb 2012 - R. Yantosca - Add modifications for GEOS-5.7.x met data
! 28 Feb 2012 - R. Yantosca - Removed support for GEOS-3
! 01 Mar 2012 - R. Yantosca - Now reference new grid_mod.F90
! 30 Jul 2012 - R. Yantosca - READ_INPUT_FILE now accepts am_I_Root from
! both the ESMF interface and main.F
! 03 Aug 2012 - R. Yantosca - Move calls to findFreeLUN out of DEVEL block
! 03 Aug 2012 - R. Yantosca - Now make IU_GEOS a global module variable
! so that we can define it with findFreeLun
! 02 Nov 2012 - R. Yantosca - Now pass the Input Options object to routines;
! this will eventually replace logical_mod, etc.
! 26 Feb 2013 - M. Long - Now make INITIALIZE_GEOS_GRID a public routine
! 04 Mar 2013 - R. Yantosca - Add routine GIGC_Init_Extra to move some init
! calls out of the run stage when using ESMF
! 23 Apr 2013 - R. Yantosca - For TOMAS, rename READ_MICROPHYSICS_MENU to
! INIT_TOMAS_MICROPHYSICS
! 13 Aug 2013 - M. Sulprizio- Add modifications for updated SOA and SOA +
! semivolatile POA simulations (H. Pye)
! 20 Aug 2013 - R. Yantosca - Removed "define.h", this is now obsolete
! 17 Sep 2013 - R. Yantosca - Increase MAXDIM from 255 to 500 for more tracers
! 26 Sep 2013 - R. Yantosca - Renamed GEOS_57 Cpp switch to GEOS_FP everywhere
! 26 Sep 2013 - R. Yantosca - Now read GEOS_FP_DIR from Input_Opt everywhere
! 23 Jun 2014 - R. Yantosca - Remove references to logical_mod.F
! 23 Jun 2014 - R. Yantosca - Removed INIT_INPUT routine
! 14 Nov 2014 - M. Yannetti - Added PRECISION_MOD
! 24 Nov 2014 - C. Keller - Updates on timestep handling in ESMF environment
! 23 Jun 2016 - R. Yantosca - Remove references to APM code; it is no longer
! compatible with the FlexChem implementation
! 28 Jul 2016 - M. Sulprizio- Rename subroutine READ_TRACER_MENU to
! READ_ADVECTED_SPECIES_MENU
! 29 Nov 2016 - R. Yantosca - grid_mod.F90 is now gc_grid_mod.F90
! 24 Aug 2017 - M. Sulprizio- Remove support for GCAP, GEOS-4, GEOS-5 and
! MERRA; Also remove LUNZIP, LWAIT, and TEMP_DIR
! options since they were only used for BPCH met
! 01 Nov 2017 - R. Yantosca - Now define MAXDIM from charpak_mod.F90
! 01 Nov 2017 - R. Yantosca - Now get ReadOneLine from charpak_mod.F90
! 08 Nov 2017 - R. Yantosca - Retire usage of ERROR_STOP; we need to send
! errors all the way up to the top level
! 26 Jan 2018 - M. Sulprizio- Moved Initialize_Geos_Grid and GC_Init_Extra
! routines to gc_environment_mod.F90
! 06 Feb 2018 - E. Lundgren - Change input timestep/freq units from min to sec
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !PRIVATE TYPES:
! LOGICAL :: VERBOSE = .FALSE.
INTEGER :: IU_GEOS
INTEGER, PARAMETER :: FIRSTCOL = 26
INTEGER :: CT1 = 0
CHARACTER(LEN=255) :: FILENAME = 'input.geos'
CONTAINS
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: read_input_file
!
! !DESCRIPTION: Subroutine READ\_INPUT\_FILE is the driver program for
! reading the GEOS-Chem input file "input.geos" from disk.
!\\
!\\
! In an ESMF environment, all time steps (chemistry, convection, emissions,
! dynamics) must be specified externally before calling this routine. This is
! done in routine GIGC\_Init\_Simulation (gigc\_initialization\_mod.F90).
! The time steps specified in input.geos are ignored.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE READ_INPUT_FILE( am_I_Root, Input_Opt, RC )
!
! !USES:
!
USE CMN_SIZE_MOD
USE CHARPAK_MOD, ONLY : ReadOneLine, STRREPL
USE ErrCode_Mod
USE FILE_MOD, ONLY : IOERROR
USE Input_Opt_Mod, ONLY : OptInput
!
! !INPUT PARAMETERS:
!
LOGICAL, INTENT(IN) :: am_I_Root ! Is this the root CPU?
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(OptInput), INTENT(INOUT) :: Input_Opt ! Input options
!
! !OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure
!
! !REVISION HISTORY:
! 20 Jul 2004 - R. Yantosca - Initial version
! (1 ) Now call DO_GAMAP from "gamap_mod.f" to create "diaginfo.dat" and
! "tracerinfo.dat" files after all diagnostic menus have been read in
! (2 ) Now call NDXX_setup from this routine (phs, 11/18/08)
! (3 ) Now call READ_ND51b_MENU (amv, bmy, 12/18/09)
! 27 Aug 2010 - R. Yantosca - Added ProTeX headers
! 30 Jul 2012 - R. Yantosca - Now accept am_I_Root from main.F, so that we
! can get rid of duplicate code in DEVEL blocks
! 03 Aug 2012 - R. Yantosca - Move calls to findFreeLUN out of DEVEL block
! 03 Aug 2012 - R. Yantosca - Now make IU_GEOS a global module variable
! so that we can define it with findFreeLun
! 15 Oct 2012 - R. Yantosca - Add EXTERNAL_GRID, XTERNAL_FORCING to #ifdef
! 16 Oct 2012 - R. Yantosca - Don't call CHECK_TIME_STEPS if we are calling
! READ_INPUT_FILE from the ESMF interface
! 09 Nov 2012 - R. Yantosca - Now pass Input_Opt to lower-level routines
! 06 Dec 2012 - R. Yantosca - Now call CHECK_TIME_STEPS when we are connecting
! to the GEOS-5 GCM via the ESMF environment,
! 19 Mar 2013 - R. Yantosca - When using ESMF interface to GEOS-5, append
! ".rc" to input.geos (instead of ___.rc)
! 04 Apr 2013 - R. Yantosca - Now pass objects to DO_GAMAP routine
! 23 Jun 2014 - R. Yantosca - Now do not call INIT_INPUT, this is replaced
! by the INIT_GIGC_INPUT_OPT routine
! 15 Apr 2015 - R. Yantosca - Also define Input_Opt%ITS_A_NESTED_GRID here
! so that we can pass it to INITIALIZE_GEOS_GRID
! 04 Aug 2015 - M. Long - Removed ".rc" file specifier. Not necessary.
! 16 Dec 2015 - R. Yantosca - Now pass State_Chm to READ_TRACER_MENU
! 04 Sep 2015 - C. Keller - Added passive tracer menu
! 16 Jun 2016 - E. Lundgren - Move TOMAS init to GIGC_INIT_EXTRA
! 08 Nov 2017 - R. Yantosca - Return error condition to calling program
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
LOGICAL :: EOF
INTEGER :: IOS
CHARACTER(LEN=1) :: TAB = ACHAR(9)
CHARACTER(LEN=1) :: SPACE = ' '
CHARACTER(LEN=MAXDIM) :: LINE
CHARACTER(LEN=255) :: TOPTITLE, ErrMsg, ThisLoc
!=================================================================
! READ_INPUT_FILE begins here!
!=================================================================
! Echo output
IF ( am_I_Root ) THEN
WRITE( 6, '(a )' ) REPEAT( '=', 79 )
WRITE( 6, '(a,/)' ) 'G E O S - C H E M U S E R I N P U T'
WRITE( 6, 100 ) TRIM( FILENAME )
100 FORMAT( 'READ_INPUT_FILE: Reading ', a )
ENDIF
! Find a free file LUN
IU_GEOS = findFreeLUN()
! Assume success
RC = GC_SUCCESS
! For error handling
ErrMsg = ''
ThisLoc =
& ' -> at Read_Input_File (in module GeosCore/input_mod.F)'
! Open file
OPEN( IU_GEOS, FILE=TRIM( FILENAME ), STATUS='OLD', IOSTAT=IOS )
IF ( IOS /= 0 ) CALL IOERROR( IOS, IU_GEOS, 'read_input_file:1' )
! Read TOPTITLE for binary punch file
TOPTITLE = ReadOneLine( IU_GEOS, EOF, IOS )
IF ( EOF ) RETURN
IF ( IOS > 0 ) CALL IOERROR( IOS, IU_GEOS, 'read_input_file:2' )
! Loop until EOF
DO
! Read a line from the file, exit if EOF
LINE = ReadOneLine( IU_GEOS, EOF, IOS )
IF ( EOF ) EXIT
IF ( IOS > 0 ) CALL IOERROR( IOS, IU_GEOS, 'read_input_file:3')
! Replace tab characters in LINE (if any) w/ spaces
CALL STRREPL( LINE, TAB, SPACE )
!=============================================================
! Call individual subroutines to read sections of the file
!
! NOTE: You are pretty flexible in setting the order of the
! menus in the input file; however, a few guidelines apply:
!
! (1) SIMULATION MENU should be listed first.
! (2) TIMESTEP MENU should be listed second.
! (3) ADVECTED SPECIES MENU should be listed third.
! (4) EMISSIONS, AEROSOL, CHEMISTRY, TRANSPORT, CONVECTION,
! and DEPOSITION menus (in any order) should follow.
! (5) Diagnostic menus, including OUTPUT, DIAGNOSTIC,
! PLANEFLIGHT, ND48, ND49, ND50, ND51, and PROD_LOSS
! menus (in any order) should follow next.
! (6) The following menus have no other restriction and
! can be placed anywhere (but by convention we will
! place them after the diagnostic menu): NESTED GRID
! UNIX CMDS, ARCHIVED OH, and O3PL menus.
!=============================================================
IF ( INDEX( LINE, 'SIMULATION MENU' ) > 0 ) THEN
CALL READ_SIMULATION_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Simulation_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'TIMESTEP MENU' ) > 0 ) THEN
CALL READ_TIMESTEP_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Timestep_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ADVECTED SPECIES MENU' ) > 0 ) THEN
CALL READ_ADVECTED_SPECIES_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Advected_Species_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'AEROSOL MENU' ) > 0 ) THEN
CALL READ_AEROSOL_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Aerosol_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'EMISSIONS MENU' ) > 0 ) THEN
CALL READ_EMISSIONS_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Emissions_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'CHEMISTRY MENU' ) > 0 ) THEN
CALL READ_CHEMISTRY_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Chemistry_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'TRANSPORT MENU' ) > 0 ) THEN
CALL READ_TRANSPORT_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Transport_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'CONVECTION MENU' ) > 0 ) THEN
CALL READ_CONVECTION_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Convection_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'DEPOSITION MENU' ) > 0 ) THEN
CALL READ_DEPOSITION_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Depositon_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'RADIATION MENU' ) > 0 ) THEN
CALL READ_RADIATION_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Radiation_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'CO SIM MENU' ) > 0 ) THEN
CALL READ_CO_SIM_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_CO_Sim_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'CO2 SIM MENU' ) > 0 ) THEN
CALL READ_CO2_SIM_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_CO2_Sim_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'GAMAP MENU' ) > 0 ) THEN
CALL READ_GAMAP_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Gamap_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'OUTPUT MENU' ) > 0 ) THEN
CALL READ_OUTPUT_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Output_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! NOTE: This will get always get read, but the various bpch
! diagnostics will only be initialized if BPCH_DIAG=y (bmy, 1/16/18)
ELSE IF ( INDEX( LINE, 'DIAGNOSTIC MENU' ) > 0 ) THEN
CALL READ_DIAGNOSTIC_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Diagnostic_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'PLANEFLIGHT MENU' ) > 0 ) THEN
CALL READ_PLANEFLIGHT_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Planeflight_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'OBSPACK MENU' ) > 0 ) THEN
CALL READ_OBSPACK_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ObsPack_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Read even if BPCH_DIAG=n so that time series diags may be
! output if other diagnostics are output as netcdf (ewl, 4/5/18)
ELSE IF ( INDEX( LINE, 'ND48 MENU' ) > 0 ) THEN
CALL READ_ND48_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND48_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ND49 MENU' ) > 0 ) THEN
CALL READ_ND49_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND49_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ND50 MENU' ) > 0 ) THEN
CALL READ_ND50_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND50_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ND51 MENU' ) > 0 ) THEN
CALL READ_ND51_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND51_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ND51b MENU' ) > 0 ) THEN
CALL READ_ND51b_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND51b_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'ND63 MENU' ) > 0 ) THEN
CALL READ_ND63_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_ND63_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
#if defined( BPCH_DIAG )
ELSE IF ( INDEX( LINE, 'PROD & LOSS MENU' ) > 0 ) THEN
CALL READ_PROD_LOSS_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Prod_Loss_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
#endif
ELSE IF ( INDEX( LINE, 'NESTED GRID MENU' ) > 0 ) THEN
CALL READ_NESTED_GRID_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Nested_Grid_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'BENCHMARK MENU' ) > 0 ) THEN
CALL READ_BENCHMARK_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error encountered in ""!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'POPS MENU' ) > 0 ) THEN
CALL READ_POPS_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_POPS_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'MERCURY MENU' ) > 0 ) THEN
CALL READ_MERCURY_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Mercury_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'CH4 MENU' ) > 0 ) THEN
CALL READ_CH4_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_CH4_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'PASSIVE SPECIES' ) > 0 ) THEN
CALL READ_PASSIVE_SPECIES_MENU( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Read_Passive_Species_Menu"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
ELSE IF ( INDEX( LINE, 'END OF FILE' ) > 0 ) THEN
EXIT
ENDIF
ENDDO
! Close input file
CLOSE( IU_GEOS )
!=================================================================
! Further error-checking and initialization
!=================================================================
#if defined( ESMF_ ) || defined( EXTERNAL_GRID ) || defined( EXTERNAL_FORCING )
!-----------------------------------------------------------------
! %%%%%%% GEOS-Chem HP (with ESMF & MPI) %%%%%%%
!
! Do not initialize diagnostics when we are connecting to
! the GEOS-5 GCM via ESMF. (bmy, 11/2/12)
!-----------------------------------------------------------------
#else
!-----------------------------------------------------------------
! %%%%%%% GEOS-Chem CLASSIC (with OpenMP) %%%%%%%
!
! We only need to initialize GEOS-5 diagnostics if we are not
! using ESMF. The GEOS-5 GCM has its own History component
! for diagnostic output (bmy, 3/4/13)
!-----------------------------------------------------------------
! Make sure all directories are valid
CALL VALIDATE_DIRECTORIES( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Validate_Directories"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
#endif
! Check GEOS-CHEM timesteps
CALL CHECK_TIME_STEPS( am_I_Root, Input_Opt, RC )
IF ( RC /= GC_SUCCESS ) THEN
ErrMsg = 'Error in "Check_Time_Steps"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
END SUBROUTINE READ_INPUT_FILE
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: split_one_line
!
! !DESCRIPTION: Subroutine SPLIT\_ONE\_LINE reads a line from the input file
! (via routine READ\_ONE\_LINE), and separates it into substrings.
!\\
!\\
! SPLIT\_ONE\_LINE also checks to see if the number of substrings found is
! equal to the number of substrings that we expected to find. However, if
! you don't know a-priori how many substrings to expect a-priori,
! you can skip the error check.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE SPLIT_ONE_LINE( SUBSTRS, N_SUBSTRS,
& N_EXP, LOCATION, RC )
!
! !USES:
!
USE Charpak_Mod, ONLY: ReadOneLine, StrSplit
Use ErrCode_Mod
USE File_Mod, ONLY: IoError
!
! !INPUT PARAMETERS:
!
INTEGER, INTENT(IN) :: N_EXP ! Expected # of substrs
CHARACTER(LEN=*), INTENT(IN) :: LOCATION ! Name of calling routine
!
! !OUTPUT PARAMETERS:
!
! Array of substrings (separated by " ")
CHARACTER(LEN=255), INTENT(OUT) :: SUBSTRS(MAXDIM) ! Substrings
INTEGER, INTENT(OUT) :: N_SUBSTRS ! # of substrings
INTEGER, INTENT(OUT) :: RC ! Success/failure?
!
! !REVISION HISTORY:
! 20 Jul 2004 - R. Yantosca - Initial version
! 27 Aug 2010 - R. Yantosca - Added ProTeX headers
! 17 Sep 2013 - R. Yantosca - Extend LINE to 500 chars to allow more tracers
! 8 Nov 2017 - R. Yantosca - Now return error conditon to calling routine
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
! Scalars
INTEGER :: IOS
LOGICAL :: EOF
! Strings
CHARACTER(LEN=10) :: IOS_Str
CHARACTER(LEN=255) :: ErrMsg, ThisLoc
CHARACTER(LEN=MAXDIM) :: LINE
!=================================================================
! SPLIT_ONE_LINE begins here!
!=================================================================
! Initialize
RC = GC_SUCCESS
IOS = 0
EOF = .FALSE.
ErrMsg = 'Error reading the "input.geos" file!'
ThisLoc = ' -> at Split_One_Line (in module GeosCore/input_mod.F)'
!=================================================================
! Read a line from disk
!=================================================================
LINE = ReadOneLine( IU_GEOS, EOF, IOS )
! Trap premature end-of-file error
IF ( EOF ) THEN
ErrMsg = 'Unexpected end-of-file reading input.geos!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Trap other I/O error conditions
IF ( IOS > 0 ) THEN
WRITE( IOS_Str, '(i10)' ) IOS
ErrMsg = 'I/O error number: ' // TRIM( IOS_STR ) //
& 'encountered when readiang "input.geos"!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
!=================================================================
! Split the lines between spaces -- start at column FIRSTCOL
!=================================================================
CALL STRSPLIT( LINE(FIRSTCOL:), ' ', SUBSTRS, N_SUBSTRS )
! Sometimes we don't know how many substrings to expect,
! if N_EXP is greater than MAXDIM, then skip the error check
IF ( N_EXP < 0 ) RETURN
! Stop if we found the wrong # of substrings
IF ( N_EXP /= N_SUBSTRS ) THEN
ErrMsg= 'SPLIT_ONE_LINE: error at ' // TRIM( LOCATION )
WRITE( 6, '(a)' ) TRIM( ErrMSg )
WRITE( 6, 100 ) N_EXP, N_SUBSTRS
WRITE( 6, '(a)' ) 'STOP in SPLIT_ONE_LINE (input_mod.f)!'
WRITE( 6, '(a)' ) REPEAT( '=', 79 )
100 FORMAT( 'Expected ',i2, ' substrs but found ',i3 )
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
END SUBROUTINE SPLIT_ONE_LINE
!EOC
!------------------------------------------------------------------------------
! GEOS-Chem Global Chemical Transport Model !
!------------------------------------------------------------------------------
!BOP
!
! !IROUTINE: read_simulation_menu
!
! !DESCRIPTION: Subroutine READ\_SIMULATION\_MENU reads the SIMULATION MENU
! section of the GEOS-Chem input file.
!\\
!\\
! !INTERFACE:
!
SUBROUTINE READ_SIMULATION_MENU( am_I_Root, Input_Opt, RC )
!
! !USES:
!
USE ErrCode_Mod
USE Input_Opt_Mod, ONLY : OptInput
USE TIME_MOD
!
! !INPUT PARAMETERS:
!
LOGICAL, INTENT(IN) :: am_I_Root ! Is this the root CPU?
!
! !INPUT/OUTPUT PARAMETERS:
!
TYPE(OptInput), INTENT(INOUT) :: Input_Opt ! Input options
!
! !OUTPUT PARAMETERS:
!
INTEGER, INTENT(OUT) :: RC ! Success or failure
!
! !REVISION HISTORY:
! 20 Jul 2004 - R. Yantosca - Initial version
! (1 ) Bug fix: Read LSVGLB w/ the * format and not w/ '(a)'. (bmy, 2/23/05)
! (2 ) Now read GEOS_5_DIR and GCAP_DIR from input.geos (swu, bmy, 5/25/05)
! (3 ) Now make sure all USE statements are USE, ONLY (bmy, 10/3/05)
! (4 ) Now references DATA_DIR_1x1 for 1x1 emissions files (bmy, 10/24/05)
! (5 ) Now read switch for using variable tropopause or not (phs, 9/14/06)
! (6 ) Remove references to GEOS-1 and GEOS-STRAT run dirs. Now calls
! INIT_TRANSFER (bmy, 11/5/07)
! (7 ) Fix typo in "print to screen" section (phs, 6/1/08)
! (8 ) Call INIT_TRANSFER w/ (0,0) instead of (I0,J0) (phs, 6/17/08)
! (10) Now read LLINOZ switch from input.geos file (dbm, bmy, 10/16/09)
! 13 Aug 2010 - R. Yantosca - Now read MERRA_DIR
! 19 Aug 2010 - R. Yantosca - Set LUNZIP=F for MERRA met fields.
! 27 Aug 2010 - R. Yantosca - Added ProTeX headers
! 01 Feb 2012 - R. Yantosca - Now read GEOS_57_DIR for GEOS-5.7.x met
! 08 Feb 2012 - R. Yantosca - Set LUNZIP=F for GEOS-5.7.x met fields
! 28 Feb 2012 - R. Yantosca - Removed support for GEOS-3
! 01 Mar 2012 - R. Yantosca - Now call routine INITIALIZE_GEOS_GRID to
! initialize horizontal grid parameters
! 10 Jun 2012 - L. Murray - Move Linoz to chemistry menu
! 30 Jul 2012 - R. Yantosca - Now accept am_I_Root as an argument when
! running with the traditional driver main.F
! 01 Nov 2012 - R. Yantosca - Now pass Input_Opt, RC as arguments
! 06 Dec 2012 - R. Yantosca - Now get NYMDb, NHMSb, NYMDe, NHMSe from the ESMF
! environment when connecting to the GEOS-5 GCM
! 11 Dec 2012 - R. Yantosca - ACCEPT_DATE_TIME_FROM_ESMF has now been renamed
! to ACCEPT_EXTERNAL_DATE_TIME
! 19 May 2014 - C. Keller - Now read HEMCO configuration file.
! 23 Jun 2014 - R. Yantosca - Remove references to logical_mod.F
! 12 Aug 2015 - R. Yantosca - Add support for MERRA2
! 12 Aug 2015 - R. Yantosca - Add support for 05x0625 grids
! 13 Aug 2015 - R. Yantosca - Bug fix: prefix RES_DIR in front of MERRA2_DIR
! 27 Jul 2016 - M. Sulprizio- Remove LSVGLB and OUT_RST_FILE options. Restart
! files are now always saved out and the output
! restart file name is hardcoded in restart_mod.F.
! 09 Aug 2016 - E. Lundgren - Remove call to routine set_restart; use input
! rst filename directly in restart_mod.F.
! 07 Nov 2017 - R. Yantosca - Don't assign to Input_Opt%VARTROP, and will
! eventually remove the line from input.geos
! 08 Nov 2017 - R. Yantosca - Return error condition to calling program
! 26 Jan 2018 - M. Sulprizio- Remove obsolete options LVARTROP and reading of
! DATA_DIR_1x1
!EOP
!------------------------------------------------------------------------------
!BOC
!
! !LOCAL VARIABLES:
!
! Scalars
INTEGER :: N, C
REAL(fp) :: JulianDateStart, JulianDateEnd
#if defined( ESMF_ ) || defined( MODEL_ )
INTEGER :: H, M, S
REAL(f4) :: init_UTC
#endif
! Strings
CHARACTER(LEN=6) :: TimeStr
CHARACTER(LEN=8) :: DateStr
CHARACTER(LEN=255) :: ErrMsg, ThisLoc
! Arrays
CHARACTER(LEN=255) :: SUBSTRS(MAXDIM)
!=================================================================
! READ_SIMULATION_MENU begins here!
!=================================================================
! Initialize
RC = GC_SUCCESS
ErrMsg = 'Error reading the "input.geos" file!'
ThisLoc = ' -> at Read_Simulation_Menu (in GeosCore/input_mod.F)'
!-----------------------------------------------------------------
! Simulation start and end time
!-----------------------------------------------------------------
! Start YYYYMMDD, HHMMSS
CALL SPLIT_ONE_LINE( SUBSTRS, N, 2, 'NYMDb, NHMSb', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
READ( SUBSTRS(1:N), * ) Input_Opt%NYMDb, Input_Opt%NHMSb
! Make sure the starting date NYMDb is valid
IF ( .not. Valid_Date( Input_Opt%NYMDb ) ) THEN
WRITE( DateStr, '(i8.8)' ) Input_Opt%NYMDb
ErrMsg = 'Input%Opt%NYMDb = ' // DateStr //
& ' is not a valid calendar date!' //
& ' Please check your "input.geos" file.'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Make sure the starting time NHMSb is valid
IF ( .not. Valid_Time( Input_Opt%NHMSb ) ) THEN
WRITE( TimeStr, '(i6.6)' ) Input_Opt%NHMSb
ErrMsg = 'Input%Opt%NHMSb = ' // TimeStr //
& ' is not a valid clock time!' //
& ' Please check your "input.geos" file.'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! End YYYYMMDD, HHMMSS
CALL SPLIT_ONE_LINE( SUBSTRS, N, 2, 'NYMDe, NHMSe', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
READ( SUBSTRS(1:N), * ) Input_Opt%NYMDe, Input_Opt%NHMSe
! Make sure the starting date NYMDb is valid
IF ( .not. Valid_Date( Input_Opt%NYMDe ) ) THEN
WRITE( DateStr, '(i8.8)' ) Input_Opt%NYMDe
ErrMsg = 'Input%Opt%NYMDe = ' // DateStr //
& ' is not a valid calendar date!' //
& ' Please check your "input.geos" file.'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Make sure the ending time NHMSe is valid
IF ( .not. Valid_Time( Input_Opt%NHMSe ) ) THEN
WRITE( TimeStr, '(i6.6)' ) Input_Opt%NHMSe
ErrMsg = 'Input%Opt%NHMSe = ' // TimeStr //
& ' is not a valid clock time!' //
& ' Please check your "input.geos" file.'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Compute the length of the simulation, in elapsed seconds
JulianDateStart = GET_JD( Input_Opt%NymdB, Input_Opt%NhmsB )
JulianDateEnd = GET_JD( Input_Opt%NymdE, Input_Opt%NhmsE )
Input_Opt%SimLengthSec = NINT( ( JulianDateEnd - JulianDateStart )
& * 86400_f8)
!-----------------------------------------------------------------
! Data directories
!-----------------------------------------------------------------
! Run directory
CALL SPLIT_ONE_LINE( SUBSTRS, N, 1, 'RUN_DIR', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
READ( SUBSTRS(1:N), '(a)' ) Input_Opt%RUN_DIR
! Root data dir
CALL SPLIT_ONE_LINE( SUBSTRS, N, 1, 'DATA_DIR', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
READ( SUBSTRS(1:N), '(a)' ) Input_Opt%DATA_DIR
! Make sure DATA-DIR ends with a "/" character
C = LEN_TRIM( Input_Opt%DATA_DIR )
IF ( Input_Opt%DATA_DIR(C:C) /= '/' ) THEN
Input_Opt%DATA_DIR = TRIM( Input_Opt%DATA_DIR ) // '/'
ENDIF
! Create CHEM_INPUTS directory
Input_Opt%CHEM_INPUTS_DIR = TRIM( Input_Opt%DATA_DIR ) //
& 'CHEM_INPUTS/'
! Define resolution-specific directory name RES_DIR
#if defined( GRID4x5 )
Input_Opt%RES_DIR = 'GEOS_4x5/'
#elif defined( GRID2x25 )
Input_Opt%RES_DIR = 'GEOS_2x2.5/'
#elif defined( GRID05x0625 ) && defined( NESTED_AS )
Input_Opt%RES_DIR = 'GEOS_0.5x0.625_AS/'
#elif defined( GRID05x0625 ) && defined( NESTED_EU )
Input_Opt%RES_DIR = 'GEOS_0.5x0.625_EU/'
#elif defined( GRID05x0625 ) && defined( NESTED_NA )
Input_Opt%RES_DIR = 'GEOS_0.5x0.625_NA/'
#elif defined( GRID025x03125 ) && defined( NESTED_CH )
Input_Opt%RES_DIR = 'GEOS_0.25x0.3125_CH/'
#elif defined( GRID025x03125 ) && defined( NESTED_EU )
Input_Opt%RES_DIR = 'GEOS_0.25x0.3125_EU/'
#elif defined( GRID025x03125 ) && defined( NESTED_NA )
Input_Opt%RES_DIR = 'GEOS_0.25x0.3125_NA/'
#endif
! Determine if we are running a nested-grid simulation based on
! the settings of the C-preprocessor switches.
#if defined( NESTED_CH ) || defined( NESTED_EU ) || defined( NESTED_NA ) || defined( NESTED_AS )
Input_Opt%ITS_A_NESTED_GRID = .TRUE.
#endif
! I0, J0 for nested-grid simulations
CALL SPLIT_ONE_LINE( SUBSTRS, N, 2, 'Nested I0, J0', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
READ( SUBSTRS(1:N), * ) Input_Opt%NESTED_I0,
& Input_Opt%NESTED_J0
! Separator line
CALL SPLIT_ONE_LINE( SUBSTRS, N, 1, 'separator 1', RC )
IF ( RC /= GC_SUCCESS ) THEN
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
! Return success
RC = GC_SUCCESS
!=================================================================
! Print to screen
!=================================================================
IF ( am_I_Root ) THEN
WRITE( 6, '(/,a)' ) 'SIMULATION MENU'
WRITE( 6, '( a)' ) '---------------'
WRITE( 6, 100 ) 'Start time of run : ',
& Input_Opt%NYMDb, Input_Opt%NHMSb
WRITE( 6, 100 ) 'End time of run : ',
& Input_Opt%NYMDe, Input_Opt%NHMSe
WRITE( 6, 110 ) 'Run directory : ',
& TRIM( Input_Opt%RUN_DIR )
WRITE( 6, 110 ) 'Data Directory : ',
& TRIM( Input_Opt%DATA_DIR )
WRITE( 6, 110 ) 'CHEM_INPUTS directory : ',
& TRIM( Input_Opt%CHEM_INPUTS_DIR )
WRITE( 6, 110 ) 'Resolution-specific dir : ',
& TRIM( Input_Opt%RES_DIR )
WRITE( 6, 120 ) 'Is this a nested-grid sim? : ',
& Input_Opt%ITS_A_NESTED_GRID
WRITE( 6, 130 ) 'Global offsets I0, J0 : ',
& Input_Opt%NESTED_I0,
& Input_Opt%NESTED_J0