-
Notifications
You must be signed in to change notification settings - Fork 12
/
ice_init.F90
1810 lines (1616 loc) · 78.8 KB
/
ice_init.F90
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
! SVN:$Id: ice_init.F90 925 2015-03-04 00:34:27Z eclare $
!=======================================================================
! parameter and variable initializations
!
! authors Elizabeth C. Hunke and William H. Lipscomb, LANL
! C. M. Bitz, UW
!
! 2004 WHL: Block structure added
! 2006 ECH: Added namelist variables, warnings.
! Replaced old default initial ice conditions with 3.14 version.
! Converted to free source form (F90).
module ice_init
use ice_kinds_mod
use ice_communicate, only: my_task, master_task
implicit none
save
character(len=char_len_long) :: &
ice_ic ! method of ice cover initialization
! 'default' => latitude and sst dependent
! 'none' => no ice
! note: restart = .true. overwrites
!=======================================================================
contains
!=======================================================================
! Namelist variables, set to default values; may be altered
! at run time
!
! author Elizabeth C. Hunke, LANL
subroutine input_data(forcing_start_date, cur_exp_date, &
seconds_since_start_year, &
total_runtime_in_seconds, timestep, calendar_type)
use ice_age, only: restart_age
use ice_broadcast, only: broadcast_scalar, broadcast_array
!ars599: 24042015 for the namelist variables
use ice_constants, only: c0, c1, puny, dragio, &
awtvdr, awtidr, awtvdf, awtidf, Tocnfrz
use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt
use ice_domain_size, only: max_nstrm, nilyr, nslyr, max_ntrcr, ncat, n_aero
use ice_fileunits, only: nu_nml, nu_diag, nml_filename, diag_type, &
ice_stdout, get_fileunit, release_fileunit, bfbflag
use ice_fileunits, only: inst_suffix
use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, &
dumpfreq, dumpfreq_n, diagfreq, nstreams, &
npt, dt, ndtd, days_per_year, use_leap_years, &
write_ic, dump_last
use ice_restart_shared, only: &
restart, restart_ext, input_dir, input_dir, restart_dir, restart_file, &
pointer_file, runid, runtype, use_restart_time, restart_format
use ice_history_shared, only: hist_avg, history_dir, history_file, &
history_deflate_level, history_parallel_io, &
history_chunksize_x, history_chunksize_y, &
incond_dir, incond_file
use ice_exit, only: abort_ice
use ice_itd, only: kitd, kcatbound
use ice_ocean, only: oceanmixed_ice, tfrz_option
use ice_firstyear, only: restart_FY
use ice_flux, only: update_ocn_f, l_mpond_fresh
use ice_forcing, only: &
ycycle, fyear_init, dbug, &
atm_data_type, atm_data_dir, precip_units, &
atm_data_format, ocn_data_format, &
sss_data_type, sst_data_type, ocn_data_dir, &
oceanmixed_file, restore_sst, trestore
use ice_grid, only: grid_file, gridcpl_file, kmt_file, grid_type, grid_format
use ice_lvl, only: restart_lvl
use ice_mechred, only: kstrength, krdg_partic, krdg_redist, mu_rdg, Cf
use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve
use ice_shortwave, only: albicev, albicei, albsnowv, albsnowi, ahmax, &
shortwave, albedo_type, R_ice, R_pnd, &
R_snw, dT_mlt, rsnw_mlt, kalg
!ars599: 24092014 (CODE: petteri)
!#if defined(AusCOM) || defined(ACCICE)
#ifdef AusCOM
! AusCOM specific namelist parameters
use ice_dyn_shared, only: cosw, sinw
use ice_shortwave, only: snowpatch, dT_mlt, dalb_mlt
use ice_therm_vertical, only: chio
use ice_atmo, only: iceruf
#endif
use ice_atmo, only: atmbndy, calc_strair, formdrag, highfreq, natmiter
use ice_transport_driver, only: advection
use ice_state, only: tr_iage, tr_FY, tr_lvl, tr_pond, &
tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_aero, &
nt_Tsfc, nt_qice, nt_qsno, nt_sice, nt_iage, nt_FY, &
nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero, &
ntrcr
use ice_meltpond_cesm, only: restart_pond_cesm, hs0
use ice_meltpond_topo, only: hp1, restart_pond_topo
use ice_meltpond_lvl, only: restart_pond_lvl, dpscale, frzpnd, &
rfracmin, rfracmax, pndaspect, hs1
use ice_aerosol, only: restart_aero
use ice_therm_shared, only: ktherm, calc_Tsfc, conduct
use ice_therm_vertical, only: ustar_min, fbot_xfer_type
use ice_therm_mushy, only: a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, &
dSdt_slow_mode, phi_c_slow_mode, &
phi_i_mushy
use ice_restoring, only: restore_ice
#ifdef CCSMCOUPLED
use shr_file_mod, only: shr_file_setIO
#endif
integer, dimension(6), optional, intent(in) :: forcing_start_date
integer, dimension(6), optional, intent(in) :: cur_exp_date
integer, optional, intent(in) :: seconds_since_start_year
integer, optional, intent(in) :: total_runtime_in_seconds, timestep
character(len=9), optional, intent(in) :: calendar_type
! local variables
integer (kind=int_kind) :: &
nml_error, & ! namelist i/o error flag
n ! loop index
character (len=6) :: chartmp
character (len=32) :: str
logical :: exists
real (kind=real_kind) :: rpcesm, rplvl, rptopo
!-----------------------------------------------------------------
! Namelist variables.
!-----------------------------------------------------------------
namelist /setup_nml/ &
days_per_year, use_leap_years, year_init, istep0, &
dt, npt, ndtd, &
runtype, runid, bfbflag, input_dir, &
ice_ic, restart, restart_dir, restart_file, &
restart_ext, use_restart_time, restart_format, &
pointer_file, dumpfreq, dumpfreq_n, dump_last, &
diagfreq, diag_type, diag_file, &
print_global, print_points, latpnt, lonpnt, &
dbug, histfreq, histfreq_n, hist_avg, &
history_dir, history_file, history_deflate_level, &
history_parallel_io, history_chunksize_x, history_chunksize_y, &
write_ic, incond_dir, incond_file
namelist /grid_nml/ &
grid_format, grid_type, grid_file, kmt_file, &
kcatbound, gridcpl_file
namelist /thermo_nml/ &
kitd, ktherm, conduct, &
a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, &
!ars599: 24092014 (CODE: petteri)
#ifdef AusCOM
chio, &
#endif
dSdt_slow_mode, phi_c_slow_mode, phi_i_mushy
namelist /dynamics_nml/ &
kdyn, ndte, revised_evp, yield_curve, &
advection, &
!ars599: 24092014 (CODE: petteri)
#ifdef AusCOM
cosw, sinw, dragio, iceruf, &
#endif
kstrength, krdg_partic, krdg_redist, mu_rdg, &
Cf
namelist /shortwave_nml/ &
shortwave, albedo_type, &
albicev, albicei, albsnowv, albsnowi, &
!ars599: 24092014 (CODE: petteri)
!#if defined(AusCOM) || defined(ACCICE)
#ifdef AusCOM
snowpatch, dalb_mlt, awtvdr, &
awtidr, awtvdf, awtidf, Tocnfrz, &
#endif
ahmax, R_ice, R_pnd, R_snw, &
dT_mlt, rsnw_mlt, kalg
namelist /ponds_nml/ &
hs0, dpscale, frzpnd, &
rfracmin, rfracmax, pndaspect, hs1, &
hp1
namelist /forcing_nml/ &
atmbndy, fyear_init, ycycle, atm_data_format,&
atm_data_type, atm_data_dir, calc_strair, calc_Tsfc, &
precip_units, update_ocn_f, l_mpond_fresh, ustar_min, &
fbot_xfer_type, &
oceanmixed_ice, ocn_data_format, sss_data_type, sst_data_type, &
ocn_data_dir, oceanmixed_file, restore_sst, trestore, &
restore_ice, formdrag, highfreq, natmiter, &
tfrz_option
namelist /tracer_nml/ &
tr_iage, restart_age, &
tr_FY, restart_FY, &
tr_lvl, restart_lvl, &
tr_pond_cesm, restart_pond_cesm, &
tr_pond_lvl, restart_pond_lvl, &
tr_pond_topo, restart_pond_topo, &
tr_aero, restart_aero
!-----------------------------------------------------------------
! default values
!-----------------------------------------------------------------
days_per_year = 365 ! number of days in a year
use_leap_years= .false.! if true, use leap years (Feb 29)
year_init = 0 ! initial year
istep0 = 0 ! no. of steps taken in previous integrations,
! real (dumped) or imagined (to set calendar)
#ifndef CCSMCOUPLED
dt = 3600.0_dbl_kind ! time step, s
#endif
npt = 99999 ! total number of time steps (dt)
diagfreq = 24 ! how often diag output is written
print_points = .false. ! if true, print point data
print_global = .true. ! if true, print global diagnostic data
bfbflag = .false. ! if true, do bit-for-bit computations
diag_type = 'stdout'
diag_file = 'ice_diag.d'
histfreq(1) = '1' ! output frequency option for different streams
histfreq(2) = 'h' ! output frequency option for different streams
histfreq(3) = 'd' ! output frequency option for different streams
histfreq(4) = 'm' ! output frequency option for different streams
histfreq(5) = 'y' ! output frequency option for different streams
histfreq_n(:) = 1 ! output frequency
hist_avg = .true. ! if true, write time-averages (not snapshots)
history_dir = './' ! write to executable dir for default
history_file = 'iceh' ! history file name prefix
history_deflate_level = -1 ! Deflate/compression level to use when
! writing netCDF4 history files, -1
! means no deflation
history_parallel_io = .false. ! Use NetCDF parallel IO to write out history files
history_chunksize_x = -1 ! NetCDF chunksize in x/lon dimension. -1
! means use default selected by NetCDF library
history_chunksize_y = -1 ! NetCDF chunksize in y/lat dimension
! means use default selected by NetCDF library
write_ic = .false. ! write out initial condition
incond_dir = history_dir ! write to history dir for default
incond_file = 'iceh_ic'! file prefix
dumpfreq='y' ! restart frequency option
dumpfreq_n = 1 ! restart frequency
dump_last = .false. ! write restart on last time step
restart = .false. ! if true, read restart files for initialization
restart_dir = './' ! write to executable dir for default
input_dir = char(0) ! set to null char, test later and set to same as
! restart_dir for backwards compatibility
restart_file = 'iced' ! restart file name prefix
restart_ext = .false. ! if true, read/write ghost cells
use_restart_time = .true. ! if true, use time info written in file
pointer_file = 'ice.restart_file'
restart_format = 'pio' ! file format ('bin'=binary or 'nc'=netcdf or 'pio')
ice_ic = 'default' ! latitude and sst-dependent
grid_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
grid_type = 'rectangular' ! define rectangular grid internally
grid_file = 'unknown_grid_file'
gridcpl_file = 'unknown_gridcpl_file'
kmt_file = 'unknown_kmt_file'
kitd = 1 ! type of itd conversions (0 = delta, 1 = linear)
kcatbound = 1 ! category boundary formula (0 = old, 1 = new, etc)
kdyn = 1 ! type of dynamics (1 = evp, 2 = eap)
ndtd = 1 ! dynamic time steps per thermodynamic time step
ndte = 120 ! subcycles per dynamics timestep: ndte=dt_dyn/dte
revised_evp = .false. ! if true, use revised procedure for evp dynamics
yield_curve = 'ellipse'
kstrength = 1 ! 1 = Rothrock 75 strength, 0 = Hibler 79
krdg_partic = 1 ! 1 = new participation, 0 = Thorndike et al 75
krdg_redist = 1 ! 1 = new redistribution, 0 = Hibler 80
mu_rdg = 3 ! e-folding scale of ridged ice, krdg_partic=1 (m^0.5)
Cf = 17.0_dbl_kind ! ratio of ridging work to PE change in ridging
advection = 'remap' ! incremental remapping transport scheme
shortwave = 'default' ! 'default' or 'dEdd' (delta-Eddington)
albedo_type = 'default'! or 'constant'
ktherm = 1 ! 0 = 0-layer, 1 = BL99, 2 = mushy thermo
conduct = 'bubbly' ! 'MU71' or 'bubbly' (Pringle et al 2007)
calc_Tsfc = .true. ! calculate surface temperature
update_ocn_f = .false. ! include fresh water and salt fluxes for frazil
ustar_min = 0.005 ! minimum friction velocity for ocean heat flux (m/s)
l_mpond_fresh = .false. ! logical switch for including meltpond freshwater
! flux feedback to ocean model
fbot_xfer_type = 'constant' ! transfer coefficient type for ocn heat flux
R_ice = 0.00_dbl_kind ! tuning parameter for sea ice
R_pnd = 0.00_dbl_kind ! tuning parameter for ponded sea ice
R_snw = 1.50_dbl_kind ! tuning parameter for snow over sea ice
dT_mlt = 1.5_dbl_kind ! change in temp to give non-melt to melt change
! in snow grain radius
rsnw_mlt = 1500._dbl_kind ! maximum melting snow grain radius
kalg = 0.60_dbl_kind ! algae absorption coefficient for 0.5 m thick layer
! 0.5 m path of 75 mg Chl a / m2
hp1 = 0.01_dbl_kind ! critical pond lid thickness for topo ponds
hs0 = 0.03_dbl_kind ! snow depth for transition to bare sea ice (m)
hs1 = 0.03_dbl_kind ! snow depth for transition to bare pond ice (m)
dpscale = c1 ! alter e-folding time scale for flushing
frzpnd = 'cesm' ! melt pond refreezing parameterization
rfracmin = 0.15_dbl_kind ! minimum retained fraction of meltwater
rfracmax = 0.85_dbl_kind ! maximum retained fraction of meltwater
pndaspect = 0.8_dbl_kind ! ratio of pond depth to area fraction
albicev = 0.78_dbl_kind ! visible ice albedo for h > ahmax
albicei = 0.36_dbl_kind ! near-ir ice albedo for h > ahmax
albsnowv = 0.98_dbl_kind ! cold snow albedo, visible
albsnowi = 0.70_dbl_kind ! cold snow albedo, near IR
ahmax = 0.3_dbl_kind ! thickness above which ice albedo is constant (m)
!ars599: 24092014 (CODE: petteri)
!#if defined(AusCOM) || defined(ACCICE)
! mark out dT_mlt
! 4 Jan 2007 BPB Following are appropriate for complete cloud
! in a summer polar atmosphere with 1.5m bare sea ice surface:
! .636/.364 vis/nir with only 0.5% direct for each band.
#ifdef AusCOM
snowpatch = 0.02_dbl_kind ! parameter for fractional snow area (m)
awtvdr = 0.00318_dbl_kind ! visible, direct ! for history and
awtidr = 0.00182_dbl_kind ! near IR, direct ! diagnostics
awtvdf = 0.63282_dbl_kind ! visible, diffuse
awtidf = 0.36218_dbl_kind ! near IR, diffuse
cosw = c1 ! cos(ocean turning angle) ! turning angle = 0
sinw = c0 ! sin(ocean turning angle) ! turning angle = 0
! dT_mlt = c1 ! change in temp to give dalb_mlt
! ! albedo change
dalb_mlt = -0.075_dbl_kind ! albedo change per dT_mlt change
! in temp for ice
dragio = 0.00536_dbl_kind! ice-ocn drag coefficient
Tocnfrz = -1.8_dbl_kind ! freezing temp of seawater (C),
! used as Tsfcn for open water
chio = 0.006_dbl_kind ! unitless param for basal heat flx ala McPhee and Maykut
iceruf = 0.0005_dbl_kind ! ice surface roughness (m)
#endif
atmbndy = 'default' ! or 'constant'
fyear_init = 1900 ! first year of forcing cycle
ycycle = 1 ! number of years in forcing cycle
atm_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
atm_data_type = 'default'
atm_data_dir = ' '
calc_strair = .true. ! calculate wind stress
formdrag = .false. ! calculate form drag
highfreq = .false. ! calculate high frequency RASM coupling
natmiter = 5 ! number of iterations for atm boundary layer calcs
precip_units = 'mks' ! 'mm_per_month' or
! 'mm_per_sec' = 'mks' = kg/m^2 s
tfrz_option = 'mushy' ! freezing temp formulation
oceanmixed_ice = .false. ! if true, use internal ocean mixed layer
ocn_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
sss_data_type = 'default'
sst_data_type = 'default'
ocn_data_dir = ' '
oceanmixed_file = 'unknown_oceanmixed_file' ! ocean forcing data
restore_sst = .false. ! restore sst if true
trestore = 90 ! restoring timescale, days (0 instantaneous)
restore_ice = .false. ! restore ice state on grid edges if true
dbug = .false. ! true writes diagnostics for input forcing
latpnt(1) = 90._dbl_kind ! latitude of diagnostic point 1 (deg)
lonpnt(1) = 0._dbl_kind ! longitude of point 1 (deg)
latpnt(2) = -65._dbl_kind ! latitude of diagnostic point 2 (deg)
lonpnt(2) = -45._dbl_kind ! longitude of point 2 (deg)
#ifndef CCSMCOUPLED
runid = 'unknown' ! run ID used in CESM and for machine 'bering'
runtype = 'initial' ! run type: 'initial', 'continue'
#endif
! extra tracers
tr_iage = .false. ! ice age
restart_age = .false. ! ice age restart
tr_FY = .false. ! ice age
restart_FY = .false. ! ice age restart
tr_lvl = .false. ! level ice
restart_lvl = .false. ! level ice restart
tr_pond_cesm = .false. ! CESM melt ponds
restart_pond_cesm = .false. ! melt ponds restart
tr_pond_lvl = .false. ! level-ice melt ponds
restart_pond_lvl = .false. ! melt ponds restart
tr_pond_topo = .false. ! explicit melt ponds (topographic)
restart_pond_topo = .false. ! melt ponds restart
tr_aero = .false. ! aerosols
restart_aero = .false. ! aerosols restart
! mushy layer gravity drainage physics
a_rapid_mode = 0.5e-3_dbl_kind ! channel radius for rapid drainage mode (m)
Rac_rapid_mode = 10.0_dbl_kind ! critical Rayleigh number
aspect_rapid_mode = 1.0_dbl_kind ! aspect ratio (larger is wider)
dSdt_slow_mode = -1.5e-7_dbl_kind ! slow mode drainage strength (m s-1 K-1)
phi_c_slow_mode = 0.05_dbl_kind ! critical liquid fraction porosity cutoff
phi_i_mushy = 0.85_dbl_kind ! liquid fraction of congelation ice
!-----------------------------------------------------------------
! read from input file
!-----------------------------------------------------------------
#ifdef CCSMCOUPLED
nml_filename = 'ice_in'//trim(inst_suffix)
#endif
call get_fileunit(nu_nml)
if (my_task == master_task) then
open (nu_nml, file=nml_filename, status='old',iostat=nml_error)
if (nml_error /= 0) then
nml_error = -1
else
nml_error = 1
endif
do while (nml_error > 0)
print*,'Reading setup_nml'
read(nu_nml, nml=setup_nml,iostat=nml_error)
if (nml_error /= 0) then
exit
else
! Make input_dir same as restart_dir for backwards
! compatibility
if (input_dir == char(0)) input_dir = restart_dir
end if
print*,'Reading grid_nml'
read(nu_nml, nml=grid_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading tracer_nml'
read(nu_nml, nml=tracer_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading thermo_nml'
read(nu_nml, nml=thermo_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading dynamics_nml'
read(nu_nml, nml=dynamics_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading shortwave_nml'
read(nu_nml, nml=shortwave_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading ponds_nml'
read(nu_nml, nml=ponds_nml,iostat=nml_error)
if (nml_error /= 0) exit
print*,'Reading forcing_nml'
read(nu_nml, nml=forcing_nml,iostat=nml_error)
if (nml_error /= 0) exit
end do
if (nml_error == 0) close(nu_nml)
! Overwrite some run details passed in as arguments
if (use_restart_time) then
! the initial year is set by the forcing start, the current
! experiment date is calculated using this and values in the
! restart file
if (present(forcing_start_date)) then
year_init = forcing_start_date(1)
endif
else
! the initial year is set to the current experiment year,
! the current experiment date is calculated using this and
! istep0 and npt below
if (present(cur_exp_date)) then
year_init = cur_exp_date(1)
endif
endif
if (present(timestep)) then
dt = timestep
endif
if (present(seconds_since_start_year)) then
istep0 = seconds_since_start_year / dt
endif
if (present(total_runtime_in_seconds)) then
npt = total_runtime_in_seconds / dt
endif
if (present(calendar_type)) then
if (index(calendar_type, 'noleap') /= 0) then
use_leap_years = .false.
else
use_leap_years = .true.
endif
endif
endif
call broadcast_scalar(nml_error, master_task)
if (nml_error /= 0) then
call abort_ice('ice: error reading namelist')
endif
call release_fileunit(nu_nml)
!-----------------------------------------------------------------
! set up diagnostics output and resolve conflicts
!-----------------------------------------------------------------
#ifdef CCSMCOUPLED
! Note in CCSMCOUPLED mode diag_file is not utilized and
! runid and runtype are obtained from the driver, not from the namelist
if (my_task == master_task) then
history_file = trim(runid) // ".cice" // trim(inst_suffix) //".h"
restart_file = trim(runid) // ".cice" // trim(inst_suffix) //".r"
incond_file = trim(runid) // ".cice" // trim(inst_suffix) //".i"
inquire(file='ice_modelio.nml'//trim(inst_suffix),exist=exists)
if (exists) then
call get_fileUnit(nu_diag)
call shr_file_setIO('ice_modelio.nml'//trim(inst_suffix),nu_diag)
end if
else
! each task gets unique ice log filename when if test is true, for debugging
if (1 == 0) then
call get_fileUnit(nu_diag)
write(str,'(a,i4.4)') "ice.log.task_",my_task
open(nu_diag,file=str)
endif
end if
if (trim(ice_ic) /= 'default' .and. trim(ice_ic) /= 'none') then
restart = .true.
end if
#else
if (trim(diag_type) == 'file') call get_fileunit(nu_diag)
#endif
if (my_task == master_task) then
if (trim(diag_type) == 'file') then
write(ice_stdout,*) 'Diagnostic output will be in file ',diag_file
open (nu_diag, file=diag_file, status='unknown')
endif
else
! each task gets unique ice log filename.
call get_fileUnit(nu_diag)
write(str,'(a,i4.4)') "ice.log.task_",my_task
open(nu_diag,file=str)
endif
write(nu_diag,*) '--------------------------------'
write(nu_diag,*) ' CICE model diagnostic output '
write(nu_diag,*) '--------------------------------'
write(nu_diag,*) ' '
if (trim(runtype) == 'continue') restart = .true.
if (trim(runtype) /= 'continue' .and. (restart)) then
if (ice_ic == 'none' .or. ice_ic == 'default') then
if (my_task == master_task) then
write(nu_diag,*) &
'WARNING: runtype, restart, ice_ic are inconsistent:'
write(nu_diag,*) trim(runtype), restart, trim(ice_ic)
write(nu_diag,*) &
'WARNING: Need ice_ic = <filename>.'
write(nu_diag,*) &
'WARNING: Initializing using ice_ic conditions'
endif
restart = .false.
endif
endif
if (trim(runtype) == 'initial' .and. .not.(restart)) then
if (ice_ic /= 'none' .and. ice_ic /= 'default') then
if (my_task == master_task) then
write(nu_diag,*) &
'WARNING: runtype, restart, ice_ic are inconsistent:'
write(nu_diag,*) trim(runtype), restart, trim(ice_ic)
write(nu_diag,*) &
'WARNING: Initializing with NO ICE: '
write(nu_diag,*) ' '
endif
ice_ic = 'none'
endif
endif
#ifndef ncdf
! netcdf is unavailable
grid_format = 'bin'
atm_data_format = 'bin'
ocn_data_format = 'bin'
#endif
chartmp = advection(1:6)
if (chartmp /= 'upwind' .and. chartmp /= 'remap ') advection = 'remap'
if (ncat == 1 .and. kitd == 1) then
if (my_task == master_task) then
write (nu_diag,*) 'Remapping the ITD is not allowed for ncat=1.'
write (nu_diag,*) 'Use kitd = 0 (delta function ITD) with kcatbound = 0'
write (nu_diag,*) 'or for column configurations use kcatbound = -1'
call abort_ice('Error: kitd incompatability: ncat=1 and kitd=1')
endif
endif
if (ncat /= 1 .and. kcatbound == -1) then
if (my_task == master_task) then
write (nu_diag,*) &
'WARNING: ITD required for ncat > 1'
write (nu_diag,*) &
'WARNING: Setting kitd and kcatbound to default values'
endif
kitd = 1
kcatbound = 0
endif
if (kdyn == 2 .and. revised_evp) then
if (my_task == master_task) then
write (nu_diag,*) &
'WARNING: revised_evp = T with EAP dynamics'
write (nu_diag,*) &
'WARNING: Setting revised_evp = F'
endif
revised_evp = .false.
endif
rpcesm = c0
rplvl = c0
rptopo = c0
if (tr_pond_cesm) rpcesm = c1
if (tr_pond_lvl ) rplvl = c1
if (tr_pond_topo) rptopo = c1
tr_pond = .false. ! explicit melt ponds
if (rpcesm + rplvl + rptopo > puny) tr_pond = .true.
if (rpcesm + rplvl + rptopo > c1 + puny) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: Must use only one melt pond scheme'
call abort_ice('ice: multiple melt pond schemes')
endif
endif
if (tr_pond_lvl .and. .not. tr_lvl) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: tr_pond_lvl=T but tr_lvl=F'
write (nu_diag,*) 'WARNING: Setting tr_lvl=T'
endif
tr_lvl = .true.
endif
if (tr_pond_lvl .and. abs(hs0) > puny) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: tr_pond_lvl=T and hs0/=0'
write (nu_diag,*) 'WARNING: Setting hs0=0'
endif
hs0 = c0
endif
if (tr_pond_cesm .and. trim(frzpnd) /= 'cesm') then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: tr_pond_cesm=T'
write (nu_diag,*) 'WARNING: frzpnd, dpscale not used'
endif
frzpnd = 'cesm'
endif
if (trim(shortwave) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: Must use dEdd shortwave'
write (nu_diag,*) 'WARNING: with tr_pond and calc_tsfc=T.'
write (nu_diag,*) 'WARNING: Setting shortwave = dEdd'
endif
shortwave = 'dEdd'
endif
if (tr_aero .and. n_aero==0) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: aerosols activated but'
write (nu_diag,*) 'WARNING: not allocated in tracer array.'
write (nu_diag,*) 'WARNING: Activate in compilation script.'
endif
call abort_ice('ice: aerosol tracer conflict: comp_ice, ice_in')
endif
if (tr_aero .and. trim(shortwave) /= 'dEdd') then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: aerosols activated but dEdd'
write (nu_diag,*) 'WARNING: shortwave is not.'
write (nu_diag,*) 'WARNING: Setting shortwave = dEdd'
endif
shortwave = 'dEdd'
endif
rfracmin = min(max(rfracmin,c0),c1)
rfracmax = min(max(rfracmax,c0),c1)
if (trim(atm_data_type) == 'monthly' .and. calc_strair) &
calc_strair = .false.
if (ktherm == 2 .and. .not. calc_Tsfc) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: ktherm = 2 and calc_Tsfc = F'
write (nu_diag,*) 'WARNING: Setting calc_Tsfc = T'
endif
calc_Tsfc = .true.
endif
if (ktherm == 1 .and. trim(tfrz_option) /= 'linear_salt') then
if (my_task == master_task) then
write (nu_diag,*) &
'WARNING: ktherm = 1 and tfrz_option = ',trim(tfrz_option)
write (nu_diag,*) &
'WARNING: For consistency, set tfrz_option = linear_salt'
endif
endif
if (ktherm == 2 .and. trim(tfrz_option) /= 'mushy') then
if (my_task == master_task) then
write (nu_diag,*) &
'WARNING: ktherm = 2 and tfrz_option = ',trim(tfrz_option)
write (nu_diag,*) &
'WARNING: For consistency, set tfrz_option = mushy'
endif
endif
if (trim(atm_data_type) == 'hadgem' .and. &
trim(precip_units) /= 'mks') then
if (my_task == master_task) &
write (nu_diag,*) &
'WARNING: HadGEM atmospheric data chosen with wrong precip_units'
write (nu_diag,*) &
'WARNING: Changing precip_units to mks (i.e. kg/m2 s).'
precip_units='mks'
endif
if (formdrag) then
if (trim(atmbndy) == 'constant') then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: atmbndy = constant not allowed with formdrag'
write (nu_diag,*) 'WARNING: Setting atmbndy = default'
endif
atmbndy = 'default'
endif
if (.not. calc_strair) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: formdrag=T but calc_strair=F'
write (nu_diag,*) 'WARNING: Setting calc_strair=T'
endif
calc_strair = .true.
endif
if (tr_pond_cesm) then
if (my_task == master_task) then
write (nu_diag,*) 'ERROR: formdrag=T but frzpnd=''cesm'''
call abort_ice('ice_init: Formdrag and no hlid')
endif
endif
if (.not. tr_lvl) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: formdrag=T but tr_lvl=F'
write (nu_diag,*) 'WARNING: Setting tr_lvl=T'
endif
tr_lvl = .true.
endif
endif
if (trim(fbot_xfer_type) == 'Cdn_ocn' .and. .not. formdrag) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: formdrag=F but fbot_xfer_type=Cdn_ocn'
write (nu_diag,*) 'WARNING: Setting fbot_xfer_type = constant'
endif
fbot_xfer_type = 'constant'
endif
call broadcast_scalar(days_per_year, master_task)
call broadcast_scalar(use_leap_years, master_task)
call broadcast_scalar(year_init, master_task)
call broadcast_scalar(istep0, master_task)
call broadcast_scalar(dt, master_task)
call broadcast_scalar(npt, master_task)
call broadcast_scalar(diagfreq, master_task)
call broadcast_scalar(print_points, master_task)
call broadcast_scalar(print_global, master_task)
call broadcast_scalar(bfbflag, master_task)
call broadcast_scalar(diag_type, master_task)
call broadcast_scalar(diag_file, master_task)
do n = 1, max_nstrm
call broadcast_scalar(histfreq(n), master_task)
enddo
call broadcast_array(histfreq_n, master_task)
call broadcast_scalar(hist_avg, master_task)
call broadcast_scalar(history_dir, master_task)
call broadcast_scalar(history_file, master_task)
call broadcast_scalar(history_deflate_level, master_task)
call broadcast_scalar(history_parallel_io, master_task)
call broadcast_scalar(history_chunksize_x, master_task)
call broadcast_scalar(history_chunksize_y, master_task)
call broadcast_scalar(write_ic, master_task)
call broadcast_scalar(incond_dir, master_task)
call broadcast_scalar(incond_file, master_task)
call broadcast_scalar(dumpfreq, master_task)
call broadcast_scalar(dumpfreq_n, master_task)
call broadcast_scalar(dump_last, master_task)
call broadcast_scalar(restart_file, master_task)
call broadcast_scalar(restart, master_task)
call broadcast_scalar(input_dir, master_task)
call broadcast_scalar(restart_dir, master_task)
call broadcast_scalar(restart_ext, master_task)
call broadcast_scalar(use_restart_time, master_task)
call broadcast_scalar(restart_format, master_task)
call broadcast_scalar(pointer_file, master_task)
call broadcast_scalar(ice_ic, master_task)
call broadcast_scalar(grid_format, master_task)
call broadcast_scalar(grid_type, master_task)
call broadcast_scalar(grid_file, master_task)
call broadcast_scalar(gridcpl_file, master_task)
call broadcast_scalar(kmt_file, master_task)
call broadcast_scalar(kitd, master_task)
call broadcast_scalar(kcatbound, master_task)
call broadcast_scalar(kdyn, master_task)
call broadcast_scalar(ndtd, master_task)
call broadcast_scalar(ndte, master_task)
call broadcast_scalar(revised_evp, master_task)
call broadcast_scalar(yield_curve, master_task)
call broadcast_scalar(kstrength, master_task)
call broadcast_scalar(krdg_partic, master_task)
call broadcast_scalar(krdg_redist, master_task)
call broadcast_scalar(mu_rdg, master_task)
call broadcast_scalar(Cf, master_task)
call broadcast_scalar(advection, master_task)
call broadcast_scalar(shortwave, master_task)
call broadcast_scalar(albedo_type, master_task)
call broadcast_scalar(ktherm, master_task)
call broadcast_scalar(conduct, master_task)
call broadcast_scalar(R_ice, master_task)
call broadcast_scalar(R_pnd, master_task)
call broadcast_scalar(R_snw, master_task)
call broadcast_scalar(dT_mlt, master_task)
call broadcast_scalar(rsnw_mlt, master_task)
call broadcast_scalar(kalg, master_task)
call broadcast_scalar(hp1, master_task)
call broadcast_scalar(hs0, master_task)
call broadcast_scalar(hs1, master_task)
call broadcast_scalar(dpscale, master_task)
call broadcast_scalar(frzpnd, master_task)
call broadcast_scalar(rfracmin, master_task)
call broadcast_scalar(rfracmax, master_task)
call broadcast_scalar(pndaspect, master_task)
call broadcast_scalar(albicev, master_task)
call broadcast_scalar(albicei, master_task)
call broadcast_scalar(albsnowv, master_task)
call broadcast_scalar(albsnowi, master_task)
call broadcast_scalar(ahmax, master_task)
!ars599: 24032014 (CODE OZ-ICE)
!#if defined(AusCOM) || defined(ACCICE)
#ifdef AusCOM
call broadcast_scalar(snowpatch, master_task)
call broadcast_scalar(dT_mlt, master_task)
call broadcast_scalar(dalb_mlt, master_task)
call broadcast_scalar(awtvdr, master_task)
call broadcast_scalar(awtvdf, master_task)
call broadcast_scalar(awtidr, master_task)
call broadcast_scalar(awtidf, master_task)
call broadcast_scalar(cosw, master_task)
call broadcast_scalar(sinw, master_task)
call broadcast_scalar(dragio, master_task)
call broadcast_scalar(chio, master_task)
call broadcast_scalar(Tocnfrz, master_task)
call broadcast_scalar(iceruf, master_task)
#endif
call broadcast_scalar(atmbndy, master_task)
call broadcast_scalar(fyear_init, master_task)
call broadcast_scalar(ycycle, master_task)
call broadcast_scalar(atm_data_format, master_task)
call broadcast_scalar(atm_data_type, master_task)
call broadcast_scalar(atm_data_dir, master_task)
call broadcast_scalar(calc_strair, master_task)
call broadcast_scalar(calc_Tsfc, master_task)
call broadcast_scalar(formdrag, master_task)
call broadcast_scalar(highfreq, master_task)
call broadcast_scalar(natmiter, master_task)
call broadcast_scalar(update_ocn_f, master_task)
call broadcast_scalar(l_mpond_fresh, master_task)
call broadcast_scalar(ustar_min, master_task)
call broadcast_scalar(fbot_xfer_type, master_task)
call broadcast_scalar(precip_units, master_task)
call broadcast_scalar(oceanmixed_ice, master_task)
call broadcast_scalar(tfrz_option, master_task)
call broadcast_scalar(ocn_data_format, master_task)
call broadcast_scalar(sss_data_type, master_task)
call broadcast_scalar(sst_data_type, master_task)
call broadcast_scalar(ocn_data_dir, master_task)
call broadcast_scalar(oceanmixed_file, master_task)
call broadcast_scalar(restore_sst, master_task)
call broadcast_scalar(trestore, master_task)
call broadcast_scalar(restore_ice, master_task)
call broadcast_scalar(dbug, master_task)
call broadcast_array (latpnt(1:2), master_task)
call broadcast_array (lonpnt(1:2), master_task)
call broadcast_scalar(runid, master_task)
call broadcast_scalar(runtype, master_task)
if (dbug) & ! else only master_task writes to file
call broadcast_scalar(nu_diag, master_task)
! tracers
call broadcast_scalar(tr_iage, master_task)
call broadcast_scalar(restart_age, master_task)
call broadcast_scalar(tr_FY, master_task)
call broadcast_scalar(restart_FY, master_task)
call broadcast_scalar(tr_lvl, master_task)
call broadcast_scalar(restart_lvl, master_task)
call broadcast_scalar(tr_pond_cesm, master_task)
call broadcast_scalar(restart_pond_cesm, master_task)
call broadcast_scalar(tr_pond_lvl, master_task)
call broadcast_scalar(restart_pond_lvl, master_task)
call broadcast_scalar(tr_pond_topo, master_task)
call broadcast_scalar(restart_pond_topo, master_task)
call broadcast_scalar(tr_pond, master_task)
call broadcast_scalar(tr_aero, master_task)
call broadcast_scalar(restart_aero, master_task)
call broadcast_scalar(a_rapid_mode, master_task)
call broadcast_scalar(Rac_rapid_mode, master_task)
call broadcast_scalar(aspect_rapid_mode, master_task)
call broadcast_scalar(dSdt_slow_mode, master_task)
call broadcast_scalar(phi_c_slow_mode, master_task)
call broadcast_scalar(phi_i_mushy, master_task)
#ifdef CCSMCOUPLED
pointer_file = trim(pointer_file) // trim(inst_suffix)
#endif
!-----------------------------------------------------------------
! spew
!-----------------------------------------------------------------
if (my_task == master_task) then
write(nu_diag,*) ' Document ice_in namelist parameters:'
write(nu_diag,*) ' ==================================== '
write(nu_diag,*) ' '
if (trim(runid) /= 'unknown') &
write(nu_diag,*) ' runid = ', &
trim(runid)
write(nu_diag,1030) ' runtype = ', &
trim(runtype)
write(nu_diag,1020) ' days_per_year = ', days_per_year
write(nu_diag,1010) ' use_leap_years = ', use_leap_years
write(nu_diag,1020) ' year_init = ', year_init
write(nu_diag,1020) ' istep0 = ', istep0
write(nu_diag,1000) ' dt = ', dt
write(nu_diag,1020) ' npt = ', npt
write(nu_diag,1020) ' diagfreq = ', diagfreq
write(nu_diag,1010) ' print_global = ', print_global
write(nu_diag,1010) ' print_points = ', print_points
write(nu_diag,1010) ' bfbflag = ', bfbflag
write(nu_diag,1050) ' histfreq = ', histfreq(:)
write(nu_diag,1040) ' histfreq_n = ', histfreq_n(:)
write(nu_diag,1010) ' hist_avg = ', hist_avg
if (.not. hist_avg) write (nu_diag,*) 'History data will be snapshots'
write(nu_diag,*) ' history_dir = ', &
trim(history_dir)
write(nu_diag,*) ' history_file = ', &
trim(history_file)
write(nu_diag,*) ' history_deflate_level = ', &
history_deflate_level
if (write_ic) then
write (nu_diag,*) 'Initial condition will be written in ', &
trim(incond_dir)
endif
write(nu_diag,1030) ' dumpfreq = ', &
trim(dumpfreq)
write(nu_diag,1020) ' dumpfreq_n = ', dumpfreq_n
write(nu_diag,1010) ' dump_last = ', dump_last
write(nu_diag,1010) ' restart = ', restart
write(nu_diag,*) ' input_dir = ', &
trim(input_dir)
write(nu_diag,*) ' restart_dir = ', &
trim(restart_dir)
write(nu_diag,*) ' restart_ext = ', restart_ext
write(nu_diag,*) ' restart_format = ', &
trim(restart_format)
write(nu_diag,*) ' restart_file = ', &
trim(restart_file)
write(nu_diag,*) ' pointer_file = ', &
trim(pointer_file)
write(nu_diag,*) ' use_restart_time = ', use_restart_time
write(nu_diag,*) ' ice_ic = ', &
trim(ice_ic)
write(nu_diag,*) ' grid_type = ', &
trim(grid_type)
if (trim(grid_type) /= 'rectangular' .or. &
trim(grid_type) /= 'column') then
write(nu_diag,*) ' grid_file = ', &
trim(grid_file)
write(nu_diag,*) ' gridcpl_file = ', &
trim(gridcpl_file)
write(nu_diag,*) ' kmt_file = ', &
trim(kmt_file)
endif
write(nu_diag,1020) ' kitd = ', kitd
write(nu_diag,1020) ' kcatbound = ', &
kcatbound
write(nu_diag,1020) ' kdyn = ', kdyn
write(nu_diag,1020) ' ndtd = ', ndtd
write(nu_diag,1020) ' ndte = ', ndte
write(nu_diag,1010) ' revised_evp = ', &
revised_evp
if (kdyn == 1) &
write(nu_diag,*) ' yield_curve = ', &
trim(yield_curve)
write(nu_diag,1020) ' kstrength = ', kstrength
write(nu_diag,1020) ' krdg_partic = ', &
krdg_partic
write(nu_diag,1020) ' krdg_redist = ', &
krdg_redist
if (krdg_redist == 1) &
write(nu_diag,1000) ' mu_rdg = ', mu_rdg
if (kstrength == 1) &
write(nu_diag,1000) ' Cf = ', Cf
write(nu_diag,1030) ' advection = ', &