-
Notifications
You must be signed in to change notification settings - Fork 1
/
stratchem_setup
executable file
·3411 lines (2938 loc) · 118 KB
/
stratchem_setup
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
#!/bin/tcsh -f
#######################################################################
# Define Colors
# Note: For No Colors, set C1 and C2 to NONE
#######################################################################
set BLACK = `tput setaf 0`
set RED = `tput setaf 1`
set GREEN = `tput setaf 2`
set YELLOW = `tput setaf 3`
set BLUE = `tput setaf 4`
set MAGENTA = `tput setaf 5`
set CYAN = `tput setaf 6`
set WHITE = `tput setaf 7`
set RESET = `tput sgr0`
set BOLD = `tput bold`
set COLORS = `echo $BLACK $RED $GREEN $YELLOW $BLUE $MAGENTA $CYAN $WHITE $RESET`
if( -e $HOME/.GCMSETUP ) then
set GCMSETUPinfo = `cat $HOME/.GCMSETUP`
set C1 = $GCMSETUPinfo[1]
set C2 = $GCMSETUPinfo[2]
else
set C1 = $RED
set C2 = $BLUE
endif
set CN = $RESET
#######################################################################
# Build Directory Locations
#######################################################################
# Set Current Working Path to gcm_setup
# -------------------------------------
setenv ARCH `uname -s`
setenv NODE `uname -n`
if ($ARCH == Darwin) then
set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES'
set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH'
# On macOS we seem to need to call mpirun directly and not use esma_mpirun
# For some reason SIP does not let the libraries be preloaded
set RUN_CMD = 'mpirun -np '
else
set PRELOAD_COMMAND = 'LD_PRELOAD'
set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH'
set RUN_CMD = '$GEOSBIN/esma_mpirun -np '
endif
set BINDIR = `pwd -L`
set GEOSDEF = `dirname $BINDIR`
set ETCDIR = ${GEOSDEF}/etc
# Test if GEOSgcm.x is here which means you are in install directory
if (! -x ${BINDIR}/GEOSgcm.x) then
echo "You are trying to run $0 in the Applications/GEOSgcm_App directory"
echo "This is no longer supported. Please run from the bin/ directory"
echo "in your installation"
exit 1
endif
######################################################################
# Singularity Sandbox
#######################################################################
# This section is to determine if we are running in a Singularity
# sandbox by looking for the .singularity.d directory. If we are,
# then we set the SINGULARITY_SANDBOX environment variable to the
# path to the sandbox. If we are not, then we set it to an empty
# string.
#
# We also set the REAL_BIND_PATH and BASE_BIND_PATH environment
# variables. These are used to set the bind paths for Singularity
# runs. REAL_BIND_PATH is the physical path to the NOBACKUP directory
# and BASE_BIND_PATH is the physical path to the /gpfsm directory
# (needed for boundary conditions)
setenv KEYFILE ".singularity.d"
setenv singstat 0
setenv ORIGPATH `pwd -P`
cd $GEOSDEF
while ($singstat == 0)
if (-d $KEYFILE) then
setenv singstat 1
setenv SINGPATH `pwd -P`
endif
if ($singstat == 0) then
if ("$cwd" == "/") then
break
else
cd ..
endif
endif
end
if ($singstat == 1) then
setenv SINGULARITY_SANDBOX $SINGPATH
setenv REAL_BIND_PATH `realpath $NOBACKUP`
setenv BASE_BIND_PATH "/gpfsm"
else
setenv SINGULARITY_SANDBOX ""
setenv REAL_BIND_PATH ""
setenv BASE_BIND_PATH ""
endif
cd $ORIGPATH
#######################################################################
# Test for Command Line Flags
#######################################################################
# Set default behavior of switches
set LINKX = FALSE
set EXE_VERB = "copied"
set SINGULARITY_RUN_SITE = ""
if ($singstat == 1) then
set USING_SINGULARITY = TRUE
# If we are using Singularity, then where the image was built (say
# AWS) might not match where we run. We at least know NCCS and NAS,
# so we can use that to set the site.
if (($NODE =~ discover*) || ($NODE =~ borg*) || ($NODE =~ warp*)) then
set SINGULARITY_RUN_SITE = "NCCS"
else if (($NODE =~ pfe*) || \
($NODE =~ r[0-9]*i[0-9]*n[0-9]*) || \
($NODE =~ r[0-9]*c[0-9]*t[0-9]*n[0-9]*)) then
set SINGULARITY_RUN_SITE = "NAS"
endif
else
set USING_SINGULARITY = FALSE
endif
while ( $#argv > 0 )
set arg = $argv[1]
shift argv
switch ( $arg )
# Set our colors
case -[Cc]:
case --[Cc][Oo][Ll][Oo][Rr]:
goto SETCOLOR
# Symlink GEOSgcm.x
case --link:
set LINKX = TRUE
set EXE_VERB = "linked"
breaksw
# Avoid Symlink GEOSgcm.x
case --nolink:
set LINKX = FALSE
breaksw
# Here any string not above will trigger USAGE
case -[Hh]:
case --[Hh][Ee][Ll][Pp]:
default:
goto USAGE
endsw
end
#######################################################################
# Determine site
#######################################################################
if ($SINGULARITY_RUN_SITE == "") then
setenv SITE `awk '{print $2}' $ETCDIR/SITE.rc`
else
setenv SITE $SINGULARITY_RUN_SITE
endif
#######################################################################
# Test for Compiler and MPI Setup
#######################################################################
# Get MPI stack from CMake
set MPI_STACK = @MPI_STACK@
#######################################################################
# Enter Experiment Specific Run Parameters
#######################################################################
echo
echo "Enter the ${C1}Experiment ID${CN}:"
set EXPID = $<
DESC:
echo "Enter a 1-line ${C1}Experiment Description${CN}:"
set EXPTMP = `echo $<`
if( $#EXPTMP == 0 ) goto DESC
set EXPDSC = $EXPTMP[1]
foreach WORD ($EXPTMP)
if( $WORD != $EXPDSC ) set EXPDSC = `echo ${EXPDSC}_${WORD}`
end
GEOSTAG:
set GEOSTAG = `cat ${ETCDIR}/.AGCM_VERSION`
#######################################################################
# Test to see if you want to CLONE old experiment
#######################################################################
# Check for CLONE
# ---------------
ASKCLONE:
echo "Do you wish to ${C1}CLONE${CN} an old experiment? (Default: ${C2}NO${CN} or ${C2}FALSE${CN})"
set KLONE = $<
if( .$KLONE == . ) then
set KLONE = FALSE
else
set KLONE = `echo $KLONE | tr "[:lower:]" "[:upper:]"`
if( $KLONE == "Y" | \
$KLONE == "YES" | \
$KLONE == "T" | \
$KLONE == "TRUE" ) set KLONE = TRUE
if( $KLONE == "N" | \
$KLONE == "NO" | \
$KLONE == "F" | \
$KLONE == "FALSE" ) set KLONE = FALSE
if( $KLONE != "TRUE" & $KLONE != "FALSE" ) then
echo
echo "${C1}CLONE${CN} must be set equal to ${C2}TRUE${CN} or ${C2}FALSE${CN}!"
goto ASKCLONE
else if ( $KLONE == "TRUE" ) then
goto DOCLONE
endif
endif
#######################################################################
# Continue to enter in experiment parameters
#######################################################################
HRCODE:
echo "Enter the ${C1}Atmospheric Horizontal Resolution${CN} code:"
echo "--------------------------------------"
echo " Cubed-Sphere"
echo "--------------------------------------"
echo " ${C2}c12 -- 8 deg (${C1}750.0 km${C2}) ${CN}"
echo " ${C2}c24 -- 4 deg (${C1}375.0 km${C2}) ${CN}"
echo " ${C2}c48 -- 2 deg (${C1}187.5 km${C2}) ${CN}"
echo " ${C2}c90 -- 1 deg (${C1}100.0 km${C2}) ${CN}"
echo " ${C2}c180 -- 1/2 deg (${C1} 50.0 km${C2}) ${CN}"
echo " ${C2}c360 -- 1/4 deg (${C1} 25.0 km${C2}) ${CN} "
echo " ${C2}c720 -- 1/8 deg (${C1} 12.5 km${C2}) ${CN}"
echo " ${C2}c1440 - 1/16 deg (${C1} 6.25 km${C2}) ${CN}"
echo " ${C2}c2880 - 1/32 deg (${C1} 3.125 km${C2}) ${CN}"
echo " ${C2}c5760 - 1/64 deg (${C1} 1.5625 km${C2}) ${CN}"
echo " ${C2} CONUS Stretched Grids "
echo " ${C2}c270 -- (${C1} 16.0 -100 km${C2}) ${CN} "
echo " ${C2}c540 -- (${C1} 8.0 - 50 km${C2}) ${CN} "
echo " ${C2}c1080 - (${C1} 4.0 - 25 km${C2}) ${CN} "
echo " ${C2}c1536 - (${C1} 2.0 - 20 km${C2}) ${CN} "
echo " ${C2}c2160 - (${C1} 2.0 - 12 km${C2}) ${CN} "
echo " "
set HRCODE = `echo $<`
set HRCODE = `echo $HRCODE | tr "[:upper:]" "[:lower:]"`
if( $HRCODE != 'c12' & \
$HRCODE != 'c24' & \
$HRCODE != 'c48' & \
$HRCODE != 'c90' & \
$HRCODE != 'c180' & \
$HRCODE != 'c360' & \
$HRCODE != 'c720' & \
$HRCODE != 'c1440' & \
$HRCODE != 'c2880' & \
$HRCODE != 'c5760' & \
$HRCODE != 'c270' & \
$HRCODE != 'c540' & \
$HRCODE != 'c1080' & \
$HRCODE != 'c1536' & \
$HRCODE != 'c2160' ) goto HRCODE
set Resolution = $HRCODE
set DYCORE = FV3
set AGCM_NF = 6
set GRID_TYPE = "Cubed-Sphere"
if (`echo $Resolution[1] | cut -b1` == "c" ) then
set AGCM_IM = $Resolution[1]
else
set AGCM_IM = "c$Resolution[1]"
endif
# We make a variable here so we can easily discriminate for CS ocean support below
if ( $AGCM_IM == 'c12' || $AGCM_IM == 'c24' || $AGCM_IM == 'c48' ) then
set LOW_ATM_RES = TRUE
else
set LOW_ATM_RES = FALSE
endif
# These are superfluous for GCM, but needed for SCM (considered latlon)
set LATLON_AGCM = "#DELETE"
set CUBE_AGCM = ""
echo "Enter the Atmospheric Model ${C1}Vertical Resolution${CN}: ${C2}LM${CN} (Default: 72)"
set AGCM_LM = $<
if( .$AGCM_LM == . ) then
set AGCM_LM = 72
endif
#######################################################################
# Choose microphysics option
#######################################################################
ASKMP:
echo "Enter Choice for Atmospheric Model ${C1}Microphysics${CN}: (Default: BACM_1M)"
echo " ${C2}BACM_1M -- 3-phase 1-moment Bacmeister et al${CN}"
echo " ${C2}GFDL_1M -- 6-phase 1-moment Geophysical Fluid Dynamics Laboratory${CN}"
echo " ${C2}MGB2_2M -- 5 or 6-phase 2-moment Morrison & Gettleman${CN}"
set CLDMICRO = $<
if( .$CLDMICRO == . ) then
set CLDMICRO = "BACM_1M"
else
set CLDMICRO = `echo $CLDMICRO | tr "[:lower:]" "[:upper:]"`
if( "$CLDMICRO" != "BACM_1M" & \
"$CLDMICRO" != "GFDL_1M" & \
"$CLDMICRO" != "MGB2_2M" ) then
echo
echo "${C1}Microphysics${CN} must be one of the options below!"
goto ASKMP
endif
endif
#######################################################################
# Test to see if using hydrostatic or non-hydrostatic atmosphere
#######################################################################
ASKHYDRO:
set DEFAULT_HYDROSTATIC = TRUE
echo "Use ${C1}Hydrostatic Atmosphere${CN}? (Default: ${C2}${DEFAULT_HYDROSTATIC}${CN})"
set USE_HYDROSTATIC = $<
if( .$USE_HYDROSTATIC == . ) then
set USE_HYDROSTATIC = $DEFAULT_HYDROSTATIC
else
set USE_HYDROSTATIC = `echo $USE_HYDROSTATIC | tr "[:lower:]" "[:upper:]"`
if( $USE_HYDROSTATIC == "Y" | \
$USE_HYDROSTATIC == "YES" | \
$USE_HYDROSTATIC == "T" | \
$USE_HYDROSTATIC == "TRUE" ) set USE_HYDROSTATIC = TRUE
if( $USE_HYDROSTATIC == "N" | \
$USE_HYDROSTATIC == "NO" | \
$USE_HYDROSTATIC == "F" | \
$USE_HYDROSTATIC == "FALSE" ) set USE_HYDROSTATIC = FALSE
if( "$USE_HYDROSTATIC" != "TRUE" & "$USE_HYDROSTATIC" != "FALSE" ) then
echo
echo "Use ${C1}Hydrostatic Atmosphere${CN} must be set equal to ${C2}TRUE/YES${CN} or ${C2}FALSE/NO${CN}!"
goto ASKHYDRO
endif
endif
#######################################################################
# Test to see if you want to use ioserver
#######################################################################
ASKIOS:
if( $HRCODE == 'c180' | \
$HRCODE == 'c360' | \
$HRCODE == 'c720' | \
$HRCODE == 'c1440' | \
$HRCODE == 'c270' | \
$HRCODE == 'c540' | \
$HRCODE == 'c1080' | \
$HRCODE == 'c1536' | \
$HRCODE == 'c2160' ) then
set DEFAULT_DO_IOS = TRUE
echo "Do you wish to ${C1}IOSERVER${CN}? (Default: ${C2}YES${CN} or ${C2}TRUE${CN})"
else
set DEFAULT_DO_IOS = FALSE
echo "Do you wish to ${C1}IOSERVER${CN}? (Default: ${C2}NO${CN} or ${C2}FALSE${CN})"
endif
set DO_IOS = $<
if( .$DO_IOS == . ) then
set DO_IOS = $DEFAULT_DO_IOS
else
set DO_IOS = `echo $DO_IOS | tr "[:lower:]" "[:upper:]"`
if( $DO_IOS == "Y" | \
$DO_IOS == "YES" | \
$DO_IOS == "T" | \
$DO_IOS == "TRUE" ) set DO_IOS = TRUE
if( $DO_IOS == "N" | \
$DO_IOS == "NO" | \
$DO_IOS == "F" | \
$DO_IOS == "FALSE" ) set DO_IOS = FALSE
if( $DO_IOS != "TRUE" & $DO_IOS != "FALSE" ) then
echo
echo "${C1}IOSERVER${CN} must be set equal to ${C2}TRUE/YES${CN} or ${C2}FALSE/NO${CN}!"
goto ASKIOS
endif
endif
if ( $DO_IOS == "TRUE" ) then
set USE_IOSERVER = 1
else
set USE_IOSERVER = 0
endif
#######################################################################
# What Processor Should We Run On?
#######################################################################
ASKPROC:
if ( $SITE == 'NCCS' ) then
set BUILT_ON_SLES15 = @BUILT_ON_SLES15@
if ("$BUILT_ON_SLES15" == "TRUE") then
echo "Enter the ${C1}Processor Type${CN} you wish to run on:"
echo " ${C2}mil (Milan)${CN} (default)"
echo " "
set MODEL = `echo $<`
set MODEL = `echo $MODEL | tr "[:upper:]" "[:lower:]"`
if ( .$MODEL == .) then
set MODEL = 'mil'
endif
if( $MODEL != 'mil' ) goto ASKPROC
if ($MODEL == 'mil') then
# We save a couple processes for the kernel
set NCPUS_PER_NODE = 126
endif
else
echo "Enter the ${C1}Processor Type${CN} you wish to run on:"
echo " ${C2}sky (Skylake)${CN}"
echo " ${C2}cas (Cascade Lake) (default)${CN}"
echo " "
set MODEL = `echo $<`
set MODEL = `echo $MODEL | tr "[:upper:]" "[:lower:]"`
if ( .$MODEL == .) then
set MODEL = 'cas'
endif
if( $MODEL != 'sky' & \
$MODEL != 'cas' ) goto ASKPROC
if ($MODEL == 'sky') then
set NCPUS_PER_NODE = 40
else if ($MODEL == 'cas') then
# NCCS currently recommends that users do not run with
# 48 cores per node on SCU16 due to OS issues and
# recommends that CPU-intensive works run with 46 or less
# cores. As 45 is a multiple of 3, it's the best value
# that doesn't waste too much
#set NCPUS_PER_NODE = 48
set NCPUS_PER_NODE = 45
endif
endif
else if ( $SITE == 'NAS' ) then
echo "Enter the ${C1}Processor Type${CN} you wish to run on:"
echo " ${C2}has (Haswell)${CN}"
echo " ${C2}bro (Broadwell)${CN}"
echo " ${C2}sky (Skylake)${CN} (default)"
echo " ${C2}cas (Cascade Lake)${CN}"
echo " ${C2}rom (AMD Rome)${CN}"
echo " ${C2}mil (AMD Milan)${CN}"
echo " "
echo " NOTE Due to how FV3 is compiled by default, Sandy Bridge"
echo " and Ivy Bridge are not supported by current GEOS"
echo " "
set MODEL = `echo $<`
set MODEL = `echo $MODEL | tr "[:upper:]" "[:lower:]"`
if ( .$MODEL == .) then
set MODEL = 'sky'
endif
if( $MODEL != 'has' & \
$MODEL != 'bro' & \
$MODEL != 'sky' & \
$MODEL != 'cas' & \
$MODEL != 'rom' & \
$MODEL != 'mil' ) goto ASKPROC
# Some processors have weird names at NAS
# ---------------------------------------
if ($MODEL == sky) then
set MODEL = 'sky_ele'
else if ($MODEL == cas) then
set MODEL = 'cas_ait'
else if ($MODEL == rom) then
set MODEL = 'rom_ait'
else if ($MODEL == mil) then
set MODEL = 'mil_ait'
endif
if ($MODEL == 'has') then
set NCPUS_PER_NODE = 24
else if ($MODEL == 'bro') then
set NCPUS_PER_NODE = 28
else if ($MODEL == 'sky_ele') then
set NCPUS_PER_NODE = 40
else if ($MODEL == 'cas_ait') then
set NCPUS_PER_NODE = 40
else if ($MODEL == 'rom_ait') then
set NCPUS_PER_NODE = 128
else if ($MODEL == 'mil_ait') then
set NCPUS_PER_NODE = 128
endif
else if( $SITE == 'AWS' | $SITE == 'Azure' ) then
# Because we do not know the name of the model or the number of CPUs
# per node. We ask the user to set these variables in the script
# AWS and Azure users must set the MODEL and NCPUS_PER_NODE
set MODEL = USER_MUST_SET
set NCPUS_PER_NODE = USER_MUST_SET
# Above we need a user to set the MODEL and NCPUS_PER_NODE
# variables. Here we check that they have been set. If not,
# we ask the user to set them
# --------------------------------------------------------
if ( $MODEL == USER_MUST_SET | $NCPUS_PER_NODE == USER_MUST_SET ) then
echo "ERROR: We have detected you are on $SITE. As we do not have"
echo " official fixed node info yet, we ask you to edit $0"
echo " and set the MODEL and NCPUS_PER_NODE variables."
echo " Look for the section that says:"
echo " "
echo " # AWS and Azure users must set the MODEL and NCPUS_PER_NODE"
exit 1
endif
else
set MODEL = 'UNKNOWN'
# As we do not know how many CPUs per node, we detect the number
# of CPUs per node by looking at the number of CPUs. This is different
# on Linux and macOS
if ( $ARCH == 'Linux' ) then
set NCPUS_PER_NODE = `grep -c ^processor /proc/cpuinfo`
else if ( $ARCH == 'Darwin' ) then
set NCPUS_PER_NODE = `sysctl -n hw.ncpu`
else
echo "ERROR: Unknown architecture $ARCH"
exit 1
endif
endif
#######################################################################
# Check for COUPLED Ocean
#######################################################################
OGCM:
echo "Do you wish to run the ${C1}COUPLED${CN} Ocean/Sea-Ice Model? (Default: ${C2}NO${CN} or ${C2}FALSE${CN})"
set OGCM = $<
if( .$OGCM == . ) then
set OGCM = FALSE
else
set OGCM = `echo $OGCM | tr "[:lower:]" "[:upper:]"`
if( $OGCM == "Y" | \
$OGCM == "YES" | \
$OGCM == "T" | \
$OGCM == "TRUE" ) set OGCM = TRUE
if( $OGCM == "N" | \
$OGCM == "NO" | \
$OGCM == "F" | \
$OGCM == "FALSE" ) set OGCM = FALSE
if( $OGCM != TRUE & $OGCM != FALSE ) then
echo
echo "${C1}COUPLED${CN} must be set equal to TRUE or FALSE!"
goto OGCM
else
echo
endif
endif
set MPT_SHEPHERD = ""
if( $OGCM == TRUE ) then
set COUPLED = ""
set DATAOCEAN = "#DELETE"
set OCEAN_NAME = ""
set OCEAN_PRELOAD = ""
set SEAICE_NAME = ""
set SEAICE_PRELOAD = ""
# Ocean Model
# -----------
OCNMODEL:
echo "Choose an ${C1}Ocean Model${CN}: (Default: ${C2}MOM6${CN})"
echo " ${C2}MOM5${CN}"
echo " ${C2}MOM6${CN}"
echo " ${C2}MIT${CN}"
set OCNMODEL = $<
if ( .$OCNMODEL == . ) then
set OCNMODEL = "MOM6"
else
set OCNMODEL = `echo $OCNMODEL | tr "[:lower:]" "[:upper:]"`
if ( "$OCNMODEL" != "MOM5" & "$OCNMODEL" != "MOM6" & "$OCNMODEL" != "MIT") then
echo
echo "${C1}Ocean Model${CN} must be either MOM5, MOM6 or MIT!"
goto OCNMODEL
else
echo
endif
endif
# NOTE: We use a CMake variable here because the shared library
# suffix is different on Linux and macOS. This is set by configure_file()
if ( "$OCNMODEL" == "MOM5" ) then
set OCEAN_NAME="MOM"
set OGRIDTYP = "M5TP"
set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@'
set MOM5=""
set MOM6 = "#DELETE"
set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM-MOM5.rc.tmpl"
set mom5_warning="######################################################\nYou (user) have chosen to set up a coupled model experiment with MOM5.\nBe aware that such a set up is _known_ to have problems. See following for more details.\nhttps://github.com/GEOS-ESM/MOM5/issues/19\nIf your intent is to help _fix_ above issue, your help is much appreciated. Thank you and good luck!\nOtherwise, until this above issue is _fixed_ you are on your own with above choice.\n######################################################"
echo "\033[31;5m"${mom5_warning}"\033[0m"
set MIT = "#DELETE"
else if ( "$OCNMODEL" == "MOM6" ) then
set OCEAN_NAME="MOM6"
set OGRIDTYP = "M6TP"
set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=\$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@'
set MOM6=""
set MOM5 = "#DELETE"
set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM.rc.tmpl"
set MIT = "#DELETE"
else if ( "$OCNMODEL" == "MIT" ) then
set OCEAN_NAME="MIT"
set OGCM_GRID_TYPE = llc
set OGRIDTYP = "MITLLC"
set MIT = ""
set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM_MITgcm.rc.tmpl"
set MOM5 = "#DELETE"
set MOM6 = "#DELETE"
endif
# Coupled Ocean Resolution
# ------------------------
CORSLV:
if( "$OCNMODEL" == "MIT" ) then
if ( $AGCM_IM != "c90" ) then
echo "You MUST select c90 atmospheric resolution for MIT ocean!"
exit 1
endif
set OGRIDTYP = "MITLLC"
set OGCM_JM = 15
set OGCM_IM = `expr $OGCM_JM \* 360`
else if ( $OCEAN_NAME == "MOM" ) then
set Resolution = `echo 360 200`
echo "Enter the Ocean Lat/Lon ${C1}Horizontal Resolution${CN}: ${C2}IM JM${CN} (Default:" $Resolution")"
set Resolution = `echo $<`
set num = $#Resolution
if( $num == 2 ) then
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
else
set Resolution = `echo 360 200`
if( $num == 0 ) then
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
else
goto CORSLV
endif
endif
else if ( "$OCNMODEL" == "MOM6" ) then
# For MOM6 we currently have only 3 allowed ocean resolutions based on the
# atmospheric resolution. The allowed are:
#
# Atm Res Atm NXxNY Atm IMxJM Ocean NXxNY Ocean IMxJM Ocean LM
# ------- --------- --------- ----------- ----------- --------
# c12 1x6 12x72 3x2 72x36 50
# c90 5x36 90x540 90x2 540x458 50
# c180 30x36 180x1080 36x30 1440x1080 75
#
# See https://github.com/GEOS-ESM/GEOSgcm/wiki/Coupled-model-configurations-(GEOS-MOM6)
if ( $AGCM_IM == "c12" ) then
set OGCM_NX = 3
set OGCM_NY = 2
set OGCM_IM = 72
set OGCM_JM = 36
set OGCM_LM = 50
else if ( $AGCM_IM == "c90" ) then
set OGCM_NX = 90
set OGCM_NY = 2
set OGCM_IM = 540
set OGCM_JM = 458
set OGCM_LM = 50
else if ( $AGCM_IM == "c180" ) then
set OGCM_NX = 36
set OGCM_NY = 30
set OGCM_IM = 1440
set OGCM_JM = 1080
set OGCM_LM = 75
else
echo
echo "ERROR: MOM6 is currently only supported for c12, c90, and c180 atmospheric resolutions"
exit 1
endif
endif
set IMO = ${OGCM_IM}
if( $IMO < 10 ) then
set IMO = 000$IMO
else if($IMO < 100) then
set IMO = 00$IMO
else if($IMO < 1000) then
set IMO = 0$IMO
endif
set JMO = ${OGCM_JM}
if( $JMO < 10 ) then
set JMO = 000$JMO
else if($JMO < 100) then
set JMO = 00$JMO
else if($JMO < 1000) then
set JMO = 0$JMO
endif
set OCEAN_RES = ${OGRIDTYP}${IMO}x${JMO}
set OCEAN_TAG = Reynolds
set SSTNAME = "#DELETE"
set SSTFILE = "#DELETE"
set ICEFILE = "#DELETE"
set KPARFILE = SEAWIFS_KPAR_mon_clim.${OGCM_IM}x${OGCM_JM}
set OSTIA = "#DELETE"
set OCEANOUT = "#DELETE"
# Seaice Model
# -----------
SEAICEMODEL:
echo "Choose a ${C1}Seaice Model${CN}: (Default: ${C2}CICE4${CN})"
echo " ${C2}CICE4${CN}"
echo " ${C2}CICE6${CN}"
set SEAICEMODEL = $<
if ( .$SEAICEMODEL == . ) then
set SEAICEMODEL = "CICE4"
else
set SEAICEMODEL = `echo $SEAICEMODEL | tr "[:lower:]" "[:upper:]"`
if ( $SEAICEMODEL != "CICE4" & $SEAICEMODEL != "CICE6" ) then
echo
echo "${C1}Seaice Model${CN} must be either CICE4 or CICE6!"
goto SEAICEMODEL
else
echo
endif
endif
# NOTE: We use a CMake variable here because the shared library
# suffix is different on Linux and macOS. This is set by configure_file()
if ( $SEAICEMODEL == "CICE4" ) then
set SEAICE_NAME="CICE4"
set SEAICE_PRELOAD = '$GEOSDIR/lib/libCICE4@CMAKE_SHARED_LIBRARY_SUFFIX@'
set CICE4=""
set CICE6 = "#DELETE"
set HIST_CICE4 = ""
else if ( $SEAICEMODEL == "CICE6" ) then
set SEAICE_NAME="CICE6"
set SEAICE_PRELOAD = '$GEOSDIR/lib/libcice6@CMAKE_SHARED_LIBRARY_SUFFIX@'
set CICE6=""
set CICE4 = "#DELETE"
set HIST_CICE4 = "#DELETE"
endif
if ( $SEAICEMODEL == "CICE6" & $OCNMODEL != "MOM6" ) then
echo
echo "${C1}Ocean Model${CN} must be MOM6 when Seaice Model is CICE6!"
goto OCNMODEL
endif
# combine seaice preload with ocean preload
set OCEAN_PRELOAD = `echo ${OCEAN_PRELOAD}`:`echo ${SEAICE_PRELOAD}`
# We only ask this if not MOM6
if ( "$OCNMODEL" != "MOM6" ) then
echo "Enter the Ocean Model ${C1}Vertical Resolution${CN}: ${C2}LM${CN} (Default: 50)"
set OGCM_LM = $<
if( .$OGCM_LM == . ) then
set OGCM_LM = 50
endif
set OGCM_NX = 36
set OGCM_NY = 10
endif
@ OGCM_NPROCS = $OGCM_NX * $OGCM_NY
if ( "$OCNMODEL" != "MIT" ) then
set OGCM_GRID_TYPE = Tripolar
endif
set LATLON_OGCM = ""
set CUBE_OGCM = "#DELETE"
set DATAOCEAN = "#DELETE"
set OGCM_NF = 1
if( "$OCNMODEL" == "MIT" ) then
set OGCM_NX = 360
set OGCM_NY = 1
set OGCM_GRIDSPEC = mit.ascii
endif
else
# OGCM = FALSE (Data Ocean Resolution)
# ------------------------------------
DORSLV:
echo "Enter the ${C1}Data_Ocean Horizontal Resolution ${CN}code: ${C2}o1${CN} (1 -deg, 360x180 Reynolds) Default"
echo " ${C2}o2${CN} (1/4-deg, 1440x720 MERRA-2)"
echo " ${C2}o3${CN} (1/8-deg, 2880x1440 OSTIA)"
echo " ${C2}CS${CN} (Cubed-Sphere OSTIA)"
set HRCODE = `echo $<`
if( .$HRCODE == . ) set HRCODE = o1
set HRCODE = `echo $HRCODE | tr "[:upper:]" "[:lower:]"`
if( $HRCODE != 'o1' & \
$HRCODE != 'o2' & \
$HRCODE != 'o3' & \
$HRCODE != 'cs' ) goto DORSLV
if( $HRCODE == 'o1' ) then
set Resolution = `echo 360 180`
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
set OGCM_GRID_TYPE = LatLon
set OGCM_NF = 1
set OCEAN_TAG = Reynolds
set SSTNAME = SST
set OCEANOUT = "360x180"
set SSTFILE = dataoceanfile_MERRA_sst_1971-current.${OGCM_IM}x${OGCM_JM}.LE
set ICEFILE = dataoceanfile_MERRA_fraci_1971-current.${OGCM_IM}x${OGCM_JM}.LE
set KPARFILE = SEAWIFS_KPAR_mon_clim.${OGCM_IM}x${OGCM_JM}
set OGRIDTYP = "DE"
set LATLON_OGCM = ""
set CUBE_OGCM = "#DELETE"
set OSTIA = "#DELETE"
set DATAOCEAN = ""
endif
if( $HRCODE == 'o2' ) then
set Resolution = `echo 1440 720`
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
set OGCM_GRID_TYPE = LatLon
set OGCM_NF = 1
set OCEAN_TAG = MERRA-2
set SSTNAME = MERRA2
set OCEANOUT = "1440x720"
set SSTFILE = dataoceanfile_MERRA2_SST.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set ICEFILE = dataoceanfile_MERRA2_ICE.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set KPARFILE = SEAWIFS_KPAR_mon_clim.${OGCM_IM}x${OGCM_JM}
set OGRIDTYP = "DE"
set LATLON_OGCM = ""
set CUBE_OGCM = "#DELETE"
set OSTIA = ""
set DATAOCEAN = ""
endif
if( $HRCODE == 'o3' ) then
set Resolution = `echo 2880 1440`
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
set OGCM_GRID_TYPE = LatLon
set OGCM_NF = 1
set LATLON_OGCM = ""
set CUBE_OGCM = "#DELETE"
set OCEAN_TAG = Ostia
set SSTNAME = OSTIA_REYNOLDS
set OCEANOUT = "2880x1440"
set SSTFILE = dataoceanfile_OSTIA_REYNOLDS_SST.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set ICEFILE = dataoceanfile_OSTIA_REYNOLDS_ICE.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set KPARFILE = SEAWIFS_KPAR_mon_clim.${OGCM_IM}x${OGCM_JM}
set OGRIDTYP = "DE"
set OSTIA = ""
set DATAOCEAN = ""
endif
if( $HRCODE == 'cs' ) then
if( $LOW_ATM_RES == 'FALSE') then
set OGCM_IM = `echo $AGCM_IM | cut -b2-`
set OGCM_JM = `expr $OGCM_IM \* 6`
set Resolution = `echo $OGCM_IM $OGCM_JM`
set OGCM_IM = $Resolution[1]
set OGCM_JM = $Resolution[2]
set OGCM_GRID_TYPE = Cubed-Sphere
set OGCM_NF = 6
set LATLON_OGCM = "#DELETE"
set CUBE_OGCM = ""
set DATAOCEAN = "#DELETE"
set OCEAN_TAG = Ostia
set SSTNAME = OSTIA_REYNOLDS
set OCEANOUT = "CS"
set SSTFILE = dataoceanfile_OSTIA_REYNOLDS_SST.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set ICEFILE = dataoceanfile_OSTIA_REYNOLDS_ICE.${OGCM_IM}x${OGCM_JM}.\${YEAR}.data
set KPARFILE = SEAWIFS_KPAR_mon_clim.${OGCM_IM}x${OGCM_JM}
set OGRIDTYP = "CF"
set OSTIA = ""
else
echo "Error: Cubed-Sphere Ocean with ${AGCM_IM} not currently supported. Must be c90 or higher"
exit 7
endif
endif
set IMO = ${OGCM_IM}
set JMO = ${OGCM_JM}
if( $IMO < 10 ) then
set IMO = 000$IMO
else if($IMO < 100) then
set IMO = 00$IMO
else if($IMO < 1000) then
set IMO = 0$IMO
endif
if( $JMO < 10 ) then
set JMO = 000$JMO
else if($JMO < 100) then
set JMO = 00$JMO
else if($JMO < 1000) then
set JMO = 0$JMO
endif
if( $HRCODE == 'cs' ) then
set OCEAN_RES = CF${IMO}x6C
else
set OCEAN_RES = DE${IMO}xPE${JMO}
endif
set DATAOCEAN = ""
set OCEAN_NAME = ""
set OCEAN_PRELOAD = ""
set OGCM_LM = 34
set COUPLED = "#DELETE"
set MOM5 = "#DELETE"
set MOM6 = "#DELETE"
set CICE4 = "#DELETE"
set CICE6 = "#DELETE"
set HIST_CICE4 = "#DELETE"
set OCNMODEL = "Data Ocean (${HRCODE})"
set DEFAULT_HISTORY_TEMPLATE="HISTORY_STRATCHEM.rc.tmpl"
set MIT = "#DELETE"
set OGCM_NX = ""
set OGCM_NY = ""
set OGCM_NPROCS = ""
endif
# Set DEFAULT SHMEM Parameter
# ---------------------------
set USE_SHMEM = 0
# Set IAU-Forcing and Bias Correction OFF
# ---------------------------------------
set FORCEDAS = "#"
set FORCEGCM = "#"
# Set Default Readers and Writers
# -------------------------------
set NUM_READERS = 1
set NUM_WRITERS = 1
# Set default CONVPAR_OPTION to GF
# (set to NONE at C2880 and C5760)
# --------------------------------
set CONVPAR_OPTION = GF
# Default Run Parameters
# ----------------------
if( $AGCM_IM == "c12" ) then
set DT = 1800
set SOLAR_DT = 3600
set IRRAD_DT = 3600
set OCEAN_DT = $IRRAD_DT
set LONG_DT = $DT
set SC_SPLIT = 1
set AGCM_IM = 12
set AGCM_JM = `expr $AGCM_IM \* 6`
# C12 MOM6 should be 1x6 to match the default 3x2 ocean layout
if ( "$OCNMODEL" == "MOM6") then
set NX = 1
else
set NX = 2
endif
set NY = `expr $NX \* 6`
set HYDROSTATIC = $USE_HYDROSTATIC
set HIST_IM = `expr $AGCM_IM \* 4`
set HIST_JM = `expr $AGCM_IM \* 2 + 1`
set JOB_SGMT = 00000015
set NUM_SGMT = 20
set ATMOS_RES = CF0012x6C