sico_init_m.F90 93.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
!  Module :  s i c o _ i n i t _ m
!
!> @file
!!
!! Initialisations for SICOPOLIS.
!!
!! @section Copyright
!!
11
!! Copyright 2009-2022 Ralf Greve, Thorben Dunse
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
!!
!! @section License
!!
!! This file is part of SICOPOLIS.
!!
!! SICOPOLIS is free software: you can redistribute it and/or modify
!! it under the terms of the GNU General Public License as published by
!! the Free Software Foundation, either version 3 of the License, or
!! (at your option) any later version.
!!
!! SICOPOLIS is distributed in the hope that it will be useful,
!! but WITHOUT ANY WARRANTY; without even the implied warranty of
!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!! GNU General Public License for more details.
!!
!! You should have received a copy of the GNU General Public License
!! along with SICOPOLIS.  If not, see <http://www.gnu.org/licenses/>.
!<
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

!-------------------------------------------------------------------------------
!> Initialisations for SICOPOLIS.
!<------------------------------------------------------------------------------
module sico_init_m

  use sico_types_m
  use sico_variables_m
  use sico_vars_m
  use error_m

  implicit none

  public

contains

!-------------------------------------------------------------------------------
!> Main routine of sico_init_m: Initialisations for SICOPOLIS.
!<------------------------------------------------------------------------------
subroutine sico_init(delta_ts, glac_index, &
               mean_accum, &
               dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser, &
               time, time_init, time_end, time_output, &
               dxi, deta, dzeta_c, dzeta_t, dzeta_r, &
56
               z_mar, &
57
               ndat2d, ndat3d, n_output)
58
59
60
61
62
63
64
65
66
67

  use compare_float_m
  use ice_material_properties_m, only : ice_mat_eqs_pars
  use enth_temp_omega_m, only : calc_c_int_table, calc_c_int_inv_table, &
                                enth_fct_temp_omega

#if (WRITE_SER_FILE_STAKES>0)
  use stereo_proj_m
#endif

68
  use read_m, only : read_2d_input, read_kei, read_phys_para
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

  use boundary_m
  use init_temp_water_age_m
  use calc_enhance_m
  use flag_update_gf_gl_cf_m
  use calc_vxy_m
  use calc_vz_m
  use calc_dxyz_m
  use calc_temp_melt_bas_m

  use output_m

implicit none

integer(i4b),       intent(out) :: ndat2d, ndat3d
integer(i4b),       intent(out) :: n_output
real(dp),           intent(out) :: delta_ts, glac_index
real(dp),           intent(out) :: mean_accum
real(dp),           intent(out) :: dtime, dtime_temp, dtime_wss, &
                                   dtime_out, dtime_ser
real(dp),           intent(out) :: time, time_init, time_end, time_output(100)
real(dp),           intent(out) :: dxi, deta, dzeta_c, dzeta_t, dzeta_r
91
real(dp),           intent(out) :: z_mar
92

93
integer(i4b)       :: i, j, kc, kt, kr, m, n, ir, jr, n1, n2
94
95
integer(i4b)       :: ios
integer(i4b)       :: ierr
96
integer(i4b), dimension(0:JMAX,0:IMAX) :: mask_ref
97
98
99
100
101
102
real(dp)           :: dtime0, dtime_temp0, dtime_wss0, dtime_out0, dtime_ser0
real(dp)           :: time_init0, time_end0
#if (OUTPUT==2 || OUTPUT==3)
real(dp)           :: time_output0(N_OUTPUT)
#endif
real(dp)           :: d_dummy
103
character(len=256) :: anfdatname
104
105
character(len=256) :: filename_with_path
character(len=256) :: shell_command
106
107
character(len= 64) :: ch_var_name
character(len=  3) :: ch_month(12)
108
109
110
character          :: ch_dummy
logical            :: flag_init_output, flag_3d_output

111
112
real(dp), dimension(0:JMAX,0:IMAX) :: field2d_aux

113
114
115
116
117
118
119
120
121
122
123
124
125
integer(i4b) :: n_slide_regions
#if (!defined(N_SLIDE_REGIONS) || N_SLIDE_REGIONS<=1)
integer(i4b) :: p_weert_aux(1)
integer(i4b) :: q_weert_aux(1)
real(dp) :: c_slide_aux(1)
real(dp) :: gamma_slide_aux(1)
#else
integer(i4b) :: p_weert_aux(N_SLIDE_REGIONS)
integer(i4b) :: q_weert_aux(N_SLIDE_REGIONS)
real(dp) :: c_slide_aux(N_SLIDE_REGIONS)
real(dp) :: gamma_slide_aux(N_SLIDE_REGIONS)
#endif

126
127
128
character(len=64), parameter :: fmt1 = '(a)', &
                                fmt2 = '(a,i0)', &
                                fmt3 = '(a,es12.4)'
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143

write(unit=6, fmt='(a)') ' '
write(unit=6, fmt='(a)') ' -------- sico_init --------'
write(unit=6, fmt='(a)') ' '

!-------- Name of the computational domain --------

#if (defined(ANT))
ch_domain_long  = 'Antarctica'
ch_domain_short = 'ant'

#elif (defined(ASF))
ch_domain_long  = 'Austfonna'
ch_domain_short = 'asf'

144
145
146
#elif (defined(EISMINT))
ch_domain_long  = 'EISMINT'
ch_domain_short = 'eismint'
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

#elif (defined(GRL))
ch_domain_long  = 'Greenland'
ch_domain_short = 'grl'

#elif (defined(NHEM))
ch_domain_long  = 'Northern hemisphere'
ch_domain_short = 'nhem'

#elif (defined(SCAND))
ch_domain_long  = 'Scandinavia and Eurasia'
ch_domain_short = 'scand'

#elif (defined(TIBET))
ch_domain_long  = 'Tibet'
ch_domain_short = 'tibet'

#elif (defined(NMARS))
ch_domain_long  = 'North polar cap of Mars'
ch_domain_short = 'nmars'

#elif (defined(SMARS))
ch_domain_long  = 'South polar cap of Mars'
ch_domain_short = 'smars'

#elif (defined(XYZ))
ch_domain_long  = 'XYZ'
ch_domain_short = 'xyz'
#if (defined(HEINO))
ch_domain_long  = trim(ch_domain_long)//'/ISMIP HEINO'
#endif

#else

errormsg = ' >>> sico_init: No valid domain specified!'
call error(errormsg)

#endif

!-------- Some initial values --------

n_output = 0

dtime       = 0.0_dp
dtime_temp  = 0.0_dp
dtime_wss   = 0.0_dp
dtime_out   = 0.0_dp
dtime_ser   = 0.0_dp

time        = 0.0_dp
time_init   = 0.0_dp
time_end    = 0.0_dp
time_output = 0.0_dp

!-------- Initialisation of the Library of Iterative Solvers Lis,
!                                                     if required --------

#if (CALCTHK==3 || CALCTHK==6 || MARGIN==3 || DYNAMICS==2)
  call lis_initialize(ierr)
#endif

!-------- Read physical parameters --------

210
211
212
213
214
215
216
217
218
219
#if (defined(YEAR_SEC))
year2sec = YEAR_SEC
#else
year2sec = 3.1556925445e+07_dp
              ! IUPAC-IUGS year for epoch 2000.0
              ! (Holden et al., 2011, PAC, doi:10.1351/PAC-REC-09-01-22)
#endif

sec2year = 1.0_dp/year2sec

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
call read_phys_para()

call ice_mat_eqs_pars(RF, R_T, KAPPA, C, -190, 10)

!  ------ Some auxiliary quantities required for the enthalpy method

call calc_c_int_table(C, -190, 10, L)
call calc_c_int_inv_table()

!-------- Compatibility check of the SICOPOLIS version with the header file

if ( trim(VERSION) /= trim(SICO_VERSION) ) then
   errormsg = ' >>> sico_init: ' &
                 //'SICOPOLIS version not compatible with header file!'
   call error(errormsg)
end if

!-------- Check whether the dynamics and thermodynamics modes are defined

#if (!defined(DYNAMICS))
errormsg = ' >>> sico_init: DYNAMICS not defined in the header file!'
call error(errormsg)
#endif

#if (!defined(CALCMOD))
errormsg = ' >>> sico_init: CALCMOD not defined in the header file!'
call error(errormsg)
#endif

#if (defined(ENTHMOD))
errormsg = ' >>> sico_init: ENTHMOD must not be defined any more.' &
         //         end_of_line &
         //'        Please update your header file!'
call error(errormsg)
#endif

!-------- Compatibility check of the horizontal resolution with the
!         number of grid points --------

259
260
#if (!defined(CHECK_RES_IMAX_JMAX) || CHECK_RES_IMAX_JMAX==1)

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
#if (GRID==0 || GRID==1)

if (approx_equal(DX, 4.0_dp, eps_sp_dp)) then

   if ((IMAX /= 34).or.(JMAX /= 33)) then
      errormsg = ' >>> sico_init: IMAX and/or JMAX wrong!'
      call error(errormsg)
   end if

else if (approx_equal(DX, 2.0_dp, eps_sp_dp)) then

   if ((IMAX /= 68).or.(JMAX /= 66)) then
      errormsg = ' >>> sico_init: IMAX and/or JMAX wrong!'
      call error(errormsg)
   end if

else if (approx_equal(DX, 1.0_dp, eps_sp_dp)) then

   if ((IMAX /= 136).or.(JMAX /= 132)) then
      errormsg = ' >>> sico_init: IMAX and/or JMAX wrong!'
      call error(errormsg)
   end if

else

   errormsg = ' >>> sico_init: DX wrong!'
   call error(errormsg)

end if

#elif (GRID==2)

errormsg = ' >>> sico_init: GRID==2 not allowed for this application!'
call error(errormsg)

#endif

298
299
300
301
302
303
304
305
306
#else /* CHECK_RES_IMAX_JMAX==0 */

write(6, fmt='(a)') ' >>> sico_init: CHECK_RES_IMAX_JMAX==0'
write(6, fmt='(a)') '      -> compatibility check between horizontal resolution'
write(6, fmt='(a)') '         and number of grid points not performed.'
write(6, fmt='(a)') ' '

#endif /* CHECK_RES_IMAX_JMAX */

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
!-------- Compatibility check of the thermodynamics mode
!         (cold vs. polythermal vs. enthalpy method)
!         and the number of grid points in the lower (kt) ice domain --------

#if (CALCMOD==0 || CALCMOD==2 || CALCMOD==3 || CALCMOD==-1)

if (KTMAX > 2) then
   write(6, fmt='(a)') ' >>> sico_init: For options CALCMOD==0, 2, 3 or -1,'
   write(6, fmt='(a)') '                the separate kt domain is redundant.'
   write(6, fmt='(a)') '                Therefore, consider setting KTMAX to 2.'
   write(6, fmt='(a)') ' '
end if

#endif

!-------- Compatibility check of surface-temperature and precipitation
!         determination by interpolation between present and LGM values
!         with a glacial index --------

#if (TSURFACE == 5 && ACCSURFACE != 5)
errormsg = ' >>> sico_init: ' &
              //'Options TSURFACE==5 and ACCSURFACE==5 must be used together!'
call error(errormsg)
#endif

#if (TSURFACE != 5 && ACCSURFACE == 5)
errormsg = ' >>> sico_init: ' &
              //'Options TSURFACE==5 and ACCSURFACE==5 must be used together!'
call error(errormsg)
#endif

!-------- Compatibility check of discretization schemes for the horizontal and
!         vertical advection terms in the temperature and age equations --------

#if (ADV_HOR==1)
errormsg = ' >>> sico_init: ' &
              //'Option ADV_HOR==1 (central differences) not defined!'
call error(errormsg)
#endif

!-------- Check whether for the shallow shelf
!               or shelfy stream approximation
!                  the chosen grid is Cartesian coordinates
!                             without distortion correction (GRID==0) --------

#if ((MARGIN==3 && DYNAMICS==1) || DYNAMICS==2)   /* requires SSA or SStA */
#if (GRID != 0)
write(6, fmt='(a)') ' >>> sico_init: WARNING:'
write(6, fmt='(a)') '                Distortion correction for GRID.ne.0'
write(6, fmt='(a)') '                not yet implemented'
write(6, fmt='(a)') '                for the shallow shelf approximation (SSA)'
write(6, fmt='(a)') '                or the shelfy stream approximation (SStA).'
write(6, fmt='(a)') ' '
#endif
#endif

!-------- Setting of forcing flag --------

#if (TSURFACE <= 4)

forcing_flag = 1   ! forcing by delta_ts

#elif (TSURFACE == 5)

forcing_flag = 2   ! forcing by glac_index

#endif

!-------- Initialization of numerical time steps --------

dtime0      = DTIME0
dtime_temp0 = DTIME_TEMP0
#if (REBOUND==2)
dtime_wss0  = DTIME_WSS0
#endif

!-------- Further initializations --------

dzeta_c = 1.0_dp/real(KCMAX,dp)
dzeta_t = 1.0_dp/real(KTMAX,dp)
dzeta_r = 1.0_dp/real(KRMAX,dp)

ndat2d = 1
ndat3d = 1

392
393
flag_calc_temp = .true.

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
!-------- General abbreviations --------

!  ------ kc domain

if (DEFORM >= eps) then

   flag_aa_nonzero = .true.   ! non-equidistant grid

   aa = DEFORM
   ea = exp(aa)

   kc=0
   zeta_c(kc)         = 0.0_dp
   eaz_c(kc)          = 1.0_dp
   eaz_c_quotient(kc) = 0.0_dp

   do kc=1, KCMAX-1
      zeta_c(kc) = kc*dzeta_c
      eaz_c(kc)  = exp(aa*zeta_c(kc))
      eaz_c_quotient(kc) = (eaz_c(kc)-1.0_dp)/(ea-1.0_dp)
   end do

   kc=KCMAX
   zeta_c(kc)         = 1.0_dp
   eaz_c(kc)          = exp(aa)
   eaz_c_quotient(kc) = 1.0_dp

else

   flag_aa_nonzero = .false.   ! equidistant grid

   aa = 0.0_dp
   ea = 1.0_dp

   kc=0
   zeta_c(kc)         = 0.0_dp
   eaz_c(kc)          = 1.0_dp
   eaz_c_quotient(kc) = 0.0_dp

   do kc=1, KCMAX-1
      zeta_c(kc) = kc*dzeta_c
      eaz_c(kc)  = 1.0_dp
      eaz_c_quotient(kc) = zeta_c(kc)
   end do

   kc=KCMAX
   zeta_c(kc)         = 1.0_dp
   eaz_c(kc)          = 1.0_dp
   eaz_c_quotient(kc) = 1.0_dp

end if

!  ------ kt domain

kt=0
zeta_t(kt) = 0.0_dp

do kt=1, KTMAX-1
   zeta_t(kt) = kt*dzeta_t
end do

kt=KTMAX
zeta_t(kt) = 1.0_dp

!  ------ kr domain

kr=0
zeta_r(kr) = 0.0_dp

do kr=1, KRMAX-1
   zeta_r(kr) = kr*dzeta_r
end do

kr=KRMAX
zeta_r(kr) = 1.0_dp

!-------- Reshaping of a 2-d array (with indices i, j)
!                                  to a vector (with index n) --------

n=1

do i=0, IMAX
do j=0, JMAX
   n2i(n)    = i
   n2j(n)    = j
   ij2n(j,i) = n
   n=n+1
end do
end do

!-------- Specification of current simulation --------

486
487
488
489
490
491
n1 = len('sico_specs_')+1
n2 = len(trim(RUN_SPECS_HEADER))-len('.h')
run_name = trim(RUN_SPECS_HEADER)
run_name = run_name(n1:n2)

anfdatname = trim(ANFDATNAME)
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

#if (defined(YEAR_ZERO))
year_zero  = YEAR_ZERO
#else
year_zero  = 2000.0_dp   ! default value 2000 CE
#endif

time_init0 = TIME_INIT0
time_end0  = TIME_END0
dtime_ser0 = DTIME_SER0

#if (OUTPUT==1 || OUTPUT==3)
dtime_out0 = DTIME_OUT0
#endif

#if (OUTPUT==2 || OUTPUT==3)

#if (N_OUTPUT<=100)
n_output = N_OUTPUT
#else
errormsg = ' >>> sico_init: N_OUTPUT > 100 not allowed!'
call error(errormsg)
#endif

#if (defined(TIME_OUT0))

time_output0 = TIME_OUT0

#else   /* !defined(TIME_OUT0), legacy mode */

#if (N_OUTPUT>= 1)
time_output0( 1) = TIME_OUT0_01
#endif
#if (N_OUTPUT>= 2)
time_output0( 2) = TIME_OUT0_02
#endif
#if (N_OUTPUT>= 3)
time_output0( 3) = TIME_OUT0_03
#endif
#if (N_OUTPUT>= 4)
time_output0( 4) = TIME_OUT0_04
#endif
#if (N_OUTPUT>= 5)
time_output0( 5) = TIME_OUT0_05
#endif
#if (N_OUTPUT>= 6)
time_output0( 6) = TIME_OUT0_06
#endif
#if (N_OUTPUT>= 7)
time_output0( 7) = TIME_OUT0_07
#endif
#if (N_OUTPUT>= 8)
time_output0( 8) = TIME_OUT0_08
#endif
#if (N_OUTPUT>= 9)
time_output0( 9) = TIME_OUT0_09
#endif
#if (N_OUTPUT>=10)
time_output0(10) = TIME_OUT0_10
#endif
#if (N_OUTPUT>=11)
time_output0(11) = TIME_OUT0_11
#endif
#if (N_OUTPUT>=12)
time_output0(12) = TIME_OUT0_12
#endif
#if (N_OUTPUT>=13)
time_output0(13) = TIME_OUT0_13
#endif
#if (N_OUTPUT>=14)
time_output0(14) = TIME_OUT0_14
#endif
#if (N_OUTPUT>=15)
time_output0(15) = TIME_OUT0_15
#endif
#if (N_OUTPUT>=16)
time_output0(16) = TIME_OUT0_16
#endif
#if (N_OUTPUT>=17)
time_output0(17) = TIME_OUT0_17
#endif
#if (N_OUTPUT>=18)
time_output0(18) = TIME_OUT0_18
#endif
#if (N_OUTPUT>=19)
time_output0(19) = TIME_OUT0_19
#endif
#if (N_OUTPUT>=20)
time_output0(20) = TIME_OUT0_20
#endif

#endif

#endif

!-------- Write log file --------

shell_command = 'if [ ! -d'
Ralf Greve's avatar
Ralf Greve committed
590
shell_command = trim(shell_command)//' '//OUT_PATH
591
shell_command = trim(shell_command)//' '//'] ; then mkdir'
Ralf Greve's avatar
Ralf Greve committed
592
shell_command = trim(shell_command)//' '//OUT_PATH
593
594
shell_command = trim(shell_command)//' '//'; fi'
call system(trim(shell_command))
Ralf Greve's avatar
Ralf Greve committed
595
     ! Check whether directory OUT_PATH exists. If not, it is created.
596

597
filename_with_path = trim(OUT_PATH)//'/'//trim(run_name)//'.log'
598
599
600
601
602
603
604
605
606
607
608
609

open(10, iostat=ios, file=trim(filename_with_path), status='new')

if (ios /= 0) then
   errormsg = ' >>> sico_init: Error when opening the log file!'
   call error(errormsg)
end if

write(10, fmt=trim(fmt1)) 'Computational domain:'
write(10, fmt=trim(fmt1)) trim(ch_domain_long)
write(10, fmt=trim(fmt1)) ' '

610
write(10, fmt=trim(fmt2)) 'GRID = ', GRID
611
612
write(10, fmt=trim(fmt1)) ' '

613
614
615
616
617
write(10, fmt=trim(fmt2)) 'imax  = ', IMAX
write(10, fmt=trim(fmt2)) 'jmax  = ', JMAX
write(10, fmt=trim(fmt2)) 'kcmax = ', KCMAX
write(10, fmt=trim(fmt2)) 'ktmax = ', KTMAX
write(10, fmt=trim(fmt2)) 'krmax = ', KRMAX
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
write(10, fmt=trim(fmt1)) ' '

write(10, fmt=trim(fmt3)) 'a =', aa
write(10, fmt=trim(fmt1)) ' '

#if (GRID==0 || GRID==1)
write(10, fmt=trim(fmt3)) 'x0      =', X0
write(10, fmt=trim(fmt3)) 'y0      =', Y0
write(10, fmt=trim(fmt3)) 'dx      =', DX
#elif (GRID==2)
errormsg = ' >>> sico_init: GRID==2 not allowed for this application!'
call error(errormsg)
#endif
write(10, fmt=trim(fmt1)) ' '

633
634
635
636
637
#if (defined(CHECK_RES_IMAX_JMAX))
write(10, fmt=trim(fmt2)) 'CHECK_RES_IMAX_JMAX = ', CHECK_RES_IMAX_JMAX
write(10, fmt=trim(fmt1)) ' '
#endif

638
639
640
641
642
643
644
645
646
647
write(10, fmt=trim(fmt3)) 'year_zero  =', year_zero
write(10, fmt=trim(fmt3)) 'time_init  =', time_init0
write(10, fmt=trim(fmt3)) 'time_end   =', time_end0
write(10, fmt=trim(fmt3)) 'dtime      =', dtime0
write(10, fmt=trim(fmt3)) 'dtime_temp =', dtime_temp0
#if (REBOUND==2)
write(10, fmt=trim(fmt3)) 'dtime_wss  =', dtime_wss0
#endif
write(10, fmt=trim(fmt1)) ' '

648
write(10, fmt=trim(fmt2)) 'ANF_DAT = ', ANF_DAT
649
650
651
652
653
654
655
656
657
write(10, fmt=trim(fmt1)) 'zs_present file   = '//ZS_PRESENT_FILE
#if (ANF_DAT==1)
#if (defined(ZB_PRESENT_FILE))
write(10, fmt=trim(fmt1)) 'zb_present file   = '//ZB_PRESENT_FILE
#endif
write(10, fmt=trim(fmt1)) 'zl_present file   = '//ZL_PRESENT_FILE
#endif
write(10, fmt=trim(fmt1)) 'zl0 file          = '//ZL0_FILE
write(10, fmt=trim(fmt1)) 'mask_present file = '//MASK_PRESENT_FILE
658
659
660
661
662
663
#if (defined(MASK_REGION_FILE))
if ( trim(adjustl(MASK_REGION_FILE)) /= 'none' ) then
   write(10, fmt=trim(fmt1)) 'mask_region file = '//MASK_REGION_FILE
   write(10, fmt=trim(fmt1)) ' '
end if
#endif
664
#if (ANF_DAT==1 && defined(TEMP_INIT))
665
write(10, fmt=trim(fmt2)) 'TEMP_INIT = ', TEMP_INIT
666
667
668
#endif
#if (ANF_DAT==3 || (ANF_DAT==1 && TEMP_INIT==5))
write(10, fmt=trim(fmt1)) 'Initial-value file = '//ANFDATNAME
Ralf Greve's avatar
Ralf Greve committed
669
write(10, fmt=trim(fmt1)) 'Path to initial-value file = '//ANF_DAT_PATH
670
671
672
673
674
675
676
#endif
write(10, fmt=trim(fmt1)) ' '

write(10, fmt=trim(fmt1)) 'Physical-parameter file = '//PHYS_PARA_FILE
write(10, fmt=trim(fmt1)) ' '

#if (defined(THK_EVOL))
677
write(10, fmt=trim(fmt2)) 'THK_EVOL = ', THK_EVOL
678
679
680
681
682
#else
errormsg = ' >>> sico_init: Define THK_EVOL in header file!'
call error(errormsg)
#endif
#if (defined(CALCTHK))
683
write(10, fmt=trim(fmt2)) 'CALCTHK = ', CALCTHK
684
685
686
687
#else
errormsg = ' >>> sico_init: Define CALCTHK in header file!'
call error(errormsg)
#endif
688
#if (defined(OCEAN_CONNECTIVITY))
689
write(10, fmt=trim(fmt2)) 'OCEAN_CONNECTIVITY = ', OCEAN_CONNECTIVITY
690
#endif
691
692
693
694
695
696
697
698
699
#if (defined(H_ISOL_MAX))
write(10, fmt=trim(fmt3)) 'H_isol_max =', H_ISOL_MAX
#endif

#if (CALCTHK==2 || CALCTHK==3 || CALCTHK==5 || CALCTHK==6)
write(10, fmt=trim(fmt3))  'ovi_weight   =', OVI_WEIGHT
#if (CALCTHK==2 || CALCTHK==5)
write(10, fmt=trim(fmt3))  'omega_sor    =', OMEGA_SOR
#if (ITER_MAX_SOR>0)
700
write(10, fmt=trim(fmt2)) 'iter_max_sor = ', ITER_MAX_SOR
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
#endif
#endif
#endif

write(10, fmt=trim(fmt1)) ' '

write(10, fmt=trim(fmt1)) 'temp_mm_present file = '//TEMP_MM_PRESENT_FILE
#if (TSURFACE==1)
write(10, fmt=trim(fmt3)) 'delta_ts0      =', DELTA_TS0
write(10, fmt=trim(fmt1)) 'temp_ma file	   = '//TEMP_MA_PRESENT_FILE
write(10, fmt=trim(fmt3)) 'temp_ma fact	   = ', TEMP_MA_PRESENT_FACT
#elif (TSURFACE==3)
write(10, fmt=trim(fmt3)) 'sine_amplit    =', SINE_AMPLIT
write(10, fmt=trim(fmt3)) 'sine_period    =', SINE_PERIOD
#elif (TSURFACE==4)
write(10, fmt=trim(fmt1)) 'GRIP file      = '//GRIP_TEMP_FILE
write(10, fmt=trim(fmt3)) 'grip_temp_fact =', GRIP_TEMP_FACT
#elif (TSURFACE==5)
write(10, fmt=trim(fmt1)) 'Glacial-index file = '//GLAC_IND_FILE
write(10, fmt=trim(fmt1)) 'temp_mm_anom file  = '//TEMP_MM_ANOM_FILE
write(10, fmt=trim(fmt3)) 'temp_mm_anom fact  = ', TEMP_MM_ANOM_FACT
#endif

write(10, fmt=trim(fmt1)) 'precip_mm_present file = '//PRECIP_MM_PRESENT_FILE
#if (ACCSURFACE==1)
write(10, fmt=trim(fmt3)) 'accfact        =', ACCFACT
#elif (ACCSURFACE==2 || ACCSURFACE==3)
write(10, fmt=trim(fmt3)) 'gamma_s        =', GAMMA_S
#elif (ACCSURFACE==5)
write(10, fmt=trim(fmt1)) 'precip_mm_anom file    = '//PRECIP_MM_ANOM_FILE
write(10, fmt=trim(fmt3)) 'precip_mm_anom fact    = ', PRECIP_MM_ANOM_FACT
#endif
#if (ACCSURFACE <= 3)
734
write(10, fmt=trim(fmt2)) 'ELEV_DESERT = ', ELEV_DESERT
735
736
737
738
739
740
741
742
743
744
745
#if (ELEV_DESERT == 1)
write(10, fmt=trim(fmt3)) 'gamma_p     =', GAMMA_P
write(10, fmt=trim(fmt3)) 'zs_thresh   =', ZS_THRESH
#endif
#endif

#if (ABLSURFACE==3)
write(10, fmt=trim(fmt3)) 'lambda_lti     =', LAMBDA_LTI
write(10, fmt=trim(fmt3)) 'temp_lti       =', TEMP_LTI
#endif

746
write(10, fmt=trim(fmt2)) 'SEA_LEVEL  = ', SEA_LEVEL
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
#if (SEA_LEVEL==1)
write(10, fmt=trim(fmt3)) 'z_sl0          =', Z_SL0
#elif (SEA_LEVEL==3)
write(10, fmt=trim(fmt1)) 'sea-level file = '//SEA_LEVEL_FILE
#endif
write(10, fmt=trim(fmt1)) ' '

#if (MARGIN==2)
#if (MARINE_ICE_CALVING==2 || MARINE_ICE_CALVING==3)
write(10, fmt=trim(fmt3)) 'z_mar          =', Z_MAR
write(10, fmt=trim(fmt1)) ' '
#elif (MARINE_ICE_CALVING==4 || MARINE_ICE_CALVING==5 \
       || MARINE_ICE_CALVING==6 || MARINE_ICE_CALVING==7)
write(10, fmt=trim(fmt3)) 'fact_z_mar     =', FACT_Z_MAR
write(10, fmt=trim(fmt1)) ' '
#elif (MARINE_ICE_FORMATION==2 && MARINE_ICE_CALVING==9)
write(10, fmt=trim(fmt3)) 'calv_uw_coeff  =', CALV_UW_COEFF
write(10, fmt=trim(fmt3)) 'r1_calv_uw     =', R1_CALV_UW
write(10, fmt=trim(fmt3)) 'r2_calv_uw     =', R2_CALV_UW
write(10, fmt=trim(fmt1)) ' '
#endif
#elif (MARGIN==3)
#if (ICE_SHELF_CALVING==2)
write(10, fmt=trim(fmt3)) 'H_calv          =', H_CALV
write(10, fmt=trim(fmt1)) ' '
#endif
#endif

#if (defined(BASAL_HYDROLOGY))
776
write(10, fmt=trim(fmt2)) 'BASAL_HYDROLOGY = ', BASAL_HYDROLOGY
777
778
779
#if (BASAL_HYDROLOGY==1 && defined(MELT_DRAIN))
write(10, fmt=trim(fmt2)) 'MELT_DRAIN = ', MELT_DRAIN
#endif
780
781
#endif

782
write(10, fmt=trim(fmt2)) 'SLIDE_LAW = ', SLIDE_LAW
783
784

#if (defined(N_SLIDE_REGIONS))
785
write(10, fmt=trim(fmt2)) 'N_SLIDE_REGIONS = ', N_SLIDE_REGIONS
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
#if (N_SLIDE_REGIONS>1)
write(10, fmt=trim(fmt1)) 'SLIDE_REGIONS_FILE = '//SLIDE_REGIONS_FILE
#endif
#endif

#if (!defined(N_SLIDE_REGIONS) || N_SLIDE_REGIONS<=1)
n_slide_regions = 1
#else
n_slide_regions = N_SLIDE_REGIONS
#endif

c_slide_aux = C_SLIDE
gamma_slide_aux = GAMMA_SLIDE
p_weert_aux = P_WEERT
q_weert_aux = Q_WEERT

write(10, fmt=trim(fmt3)) 'c_slide =', c_slide_aux(1)
803
#if (N_SLIDE_REGIONS>1)
804
805
806
do n=2, n_slide_regions
   write(10, fmt=trim(fmt3)) '         ', c_slide_aux(n)
end do
807
#endif
808
809

write(10, fmt=trim(fmt3)) 'gamma_slide =', gamma_slide_aux(1)
810
#if (N_SLIDE_REGIONS>1)
811
812
813
do n=2, n_slide_regions
   write(10, fmt=trim(fmt3)) '             ', gamma_slide_aux(n)
end do
814
#endif
815

816
write(10, fmt=trim(fmt2)) 'p_weert = ', p_weert_aux(1)
817
#if (N_SLIDE_REGIONS>1)
818
do n=2, n_slide_regions
819
   write(10, fmt=trim(fmt2)) '          ', p_weert_aux(n)
820
end do
821
#endif
822

823
write(10, fmt=trim(fmt2)) 'q_weert = ', q_weert_aux(1)
824
#if (N_SLIDE_REGIONS>1)
825
do n=2, n_slide_regions
826
   write(10, fmt=trim(fmt2)) '          ', q_weert_aux(n)
827
end do
828
#endif
829
830
831
832
833
834
835
836
837
838

#if (defined(TIME_RAMP_UP_SLIDE))
write(10, fmt=trim(fmt3)) 'time_ramp_up_slide =', TIME_RAMP_UP_SLIDE
#endif
#if (SLIDE_LAW==2 || SLIDE_LAW==3)
write(10, fmt=trim(fmt3)) 'red_pres_limit_fact =', RED_PRES_LIMIT_FACT
#endif
#if (BASAL_HYDROLOGY==1 \
       && defined(HYDRO_SLIDE_SAT_FCT) \
       && defined(C_HW_SLIDE) && defined(HW0_SLIDE))
839
write(10, fmt=trim(fmt2)) 'HYDRO_SLIDE_SAT_FCT = ', HYDRO_SLIDE_SAT_FCT
840
841
842
843
844
write(10, fmt=trim(fmt3)) 'c_Hw_slide  =', C_HW_SLIDE
write(10, fmt=trim(fmt3)) 'Hw0_slide   =', HW0_SLIDE
#endif
write(10, fmt=trim(fmt1)) ' '

845
write(10, fmt=trim(fmt2)) 'Q_GEO_MOD = ', Q_GEO_MOD
846
847
848
849
850
851
852
853
#if (Q_GEO_MOD==1)
write(10, fmt=trim(fmt3)) 'q_geo =', Q_GEO
#elif (Q_GEO_MOD==2)
write(10, fmt=trim(fmt1)) 'q_geo file = '//Q_GEO_FILE
#endif
write(10, fmt=trim(fmt1)) ' '

#if (defined(MARINE_ICE_BASAL_MELTING))
854
write(10, fmt=trim(fmt2)) 'MARINE_ICE_BASAL_MELTING = ', MARINE_ICE_BASAL_MELTING
855
856
857
858
859
860
861
#if (MARINE_ICE_BASAL_MELTING==2 || MARINE_ICE_BASAL_MELTING==3)
write(10, fmt=trim(fmt3)) 'qbm_marine               =', QBM_MARINE
#endif
write(10, fmt=trim(fmt1)) ' '
#endif

#if (MARGIN==3)
862
write(10, fmt=trim(fmt2)) 'FLOATING_ICE_BASAL_MELTING = ', FLOATING_ICE_BASAL_MELTING
863
864
865
866
867
868
869
870
871
872
873
874
875
876
#if (FLOATING_ICE_BASAL_MELTING==1)
write(10, fmt=trim(fmt3)) 'qbm_float_1 =', QBM_FLOAT_1
#endif
write(10, fmt=trim(fmt3)) 'qbm_float_3 =', QBM_FLOAT_3
write(10, fmt=trim(fmt3)) 'z_abyss =', Z_ABYSS
#if (FLOATING_ICE_BASAL_MELTING==4)
write(10, fmt=trim(fmt3)) 'temp_ocean =', TEMP_OCEAN
write(10, fmt=trim(fmt3)) 'Omega_qbm  =', OMEGA_QBM
write(10, fmt=trim(fmt3)) 'alpha_qbm  =', ALPHA_QBM
#endif
write(10, fmt=trim(fmt3)) 'H_w_0 =', H_W_0
write(10, fmt=trim(fmt1)) ' '
#endif

877
write(10, fmt=trim(fmt2)) 'REBOUND       = ', REBOUND
878
879
880
881
#if (REBOUND==1)
write(10, fmt=trim(fmt3)) 'frac_llra     =', FRAC_LLRA
#endif
#if (REBOUND==1 || REBOUND==2)
882
write(10, fmt=trim(fmt2)) 'TIME_LAG_MOD  = ', TIME_LAG_MOD
883
884
885
886
887
888
889
890
891
892
#if (TIME_LAG_MOD==1)
write(10, fmt=trim(fmt3)) 'time_lag      =', TIME_LAG
#elif (TIME_LAG_MOD==2)
write(10, fmt=trim(fmt1)) 'time_lag_file = '//TIME_LAG_FILE
#else
errormsg = ' >>> sico_init: TIME_LAG_MOD must be either 1 or 2!'
call error(errormsg)
#endif
#endif
#if (REBOUND==2)
893
write(10, fmt=trim(fmt2)) 'FLEX_RIG_MOD  = ', FLEX_RIG_MOD
894
895
896
897
898
899
900
901
902
#if (FLEX_RIG_MOD==1)
write(10, fmt=trim(fmt3)) 'flex_rig      =', FLEX_RIG
#elif (FLEX_RIG_MOD==2)
write(10, fmt=trim(fmt1)) 'flex_rig_file = '//FLEX_RIG_FILE
#else
errormsg = ' >>> sico_init: FLEX_RIG_MOD must be either 1 or 2!'
call error(errormsg)
#endif
#endif
903
write(10, fmt=trim(fmt2)) 'Q_LITHO       = ', Q_LITHO
904
905
906
907
908
909
910
911
912
913
914
write(10, fmt=trim(fmt1)) ' '

#if (FLOW_LAW==2)
write(10, fmt=trim(fmt3)) 'gr_size   =', GR_SIZE
write(10, fmt=trim(fmt1)) ' '
#endif
#if (FIN_VISC==2)
write(10, fmt=trim(fmt3)) 'sigma_res =', SIGMA_RES
write(10, fmt=trim(fmt1)) ' '
#endif

915
write(10, fmt=trim(fmt2)) 'ENHMOD = ', ENHMOD
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
#if (ENHMOD==1 || ENHMOD==2 || ENHMOD==3)
write(10, fmt=trim(fmt3)) 'enh_fact    =', ENH_FACT
#endif
#if (ENHMOD==2 || ENHMOD==3)
write(10, fmt=trim(fmt3)) 'enh_intg    =', ENH_INTG
#endif
#if (ENHMOD==2)
write(10, fmt=trim(fmt3)) 'age_trans   =', AGE_TRANS_0
#endif
#if (ENHMOD==3)
write(10, fmt=trim(fmt3)) 'date_trans1 =', DATE_TRANS1_0
write(10, fmt=trim(fmt3)) 'date_trans2 =', DATE_TRANS2_0
write(10, fmt=trim(fmt3)) 'date_trans3 =', DATE_TRANS3_0
#endif
#if (ENHMOD==4 || ENHMOD==5)
write(10, fmt=trim(fmt3)) 'enh_compr   =', ENH_COMPR
write(10, fmt=trim(fmt3)) 'enh_shear   =', ENH_SHEAR
#endif
934
935
936
937
#if (DYNAMICS==2 && defined(ENH_STREAM))
if (ENH_STREAM >= 0.0_dp) &
   write(10, fmt=trim(fmt3)) 'enh_stream =', ENH_STREAM
#endif
938
939
940
941
942
#if ((ENHMOD==1 || ENHMOD==2 || ENHMOD==3 || ENHMOD==4) && MARGIN==3)
write(10, fmt=trim(fmt3)) 'enh_shelf   =', ENH_SHELF
#endif
write(10, fmt=trim(fmt1)) ' '

943
write(10, fmt=trim(fmt2)) 'DYNAMICS = ', DYNAMICS
Ralf Greve's avatar
Ralf Greve committed
944
945
946
#if (DYNAMICS==2 && defined(HYB_MODE))
write(10, fmt=trim(fmt2)) 'HYB_MODE = ', HYB_MODE
#endif
947
948
949
950
951
952
953
954
#if ((DYNAMICS==1 && MARGIN==3) || DYNAMICS==2)
#if (defined(LIS_OPTS))
write(10, fmt=trim(fmt1)) 'lis_opts = '//LIS_OPTS
#endif
#if (defined(TOL_ITER_SSA))
write(10, fmt=trim(fmt3)) 'tol_iter_ssa =', TOL_ITER_SSA
#endif
#if (defined(N_ITER_SSA))
955
write(10, fmt=trim(fmt2)) 'n_iter_ssa = ', N_ITER_SSA
956
#endif
957
958
959
#if (defined(N_ITER_SSA_MIN))
write(10, fmt=trim(fmt2)) 'n_iter_ssa_min = ', N_ITER_SSA_MIN
#endif
960
#if (defined(ITER_INIT_SSA))
961
write(10, fmt=trim(fmt2)) 'iter_init_ssa = ', ITER_INIT_SSA
962
963
964
965
966
#endif
#if (defined(VISC_INIT_SSA))
write(10, fmt=trim(fmt3)) 'visc_init_ssa =', VISC_INIT_SSA
#endif
#if (defined(N_VISC_SMOOTH))
967
write(10, fmt=trim(fmt2)) 'n_visc_smooth = ', N_VISC_SMOOTH
968
969
970
971
972
973
974
975
#endif
#if (defined(VISC_SMOOTH_DIFF))
write(10, fmt=trim(fmt3)) 'visc_smooth_diff =', VISC_SMOOTH_DIFF
#endif
#if (defined(RELAX_FACT_SSA))
write(10, fmt=trim(fmt3)) 'relax_fact_ssa =', RELAX_FACT_SSA
#endif
#endif
Ralf Greve's avatar
Ralf Greve committed
976
#if (DYNAMICS==2 && HYB_MODE==0 && defined(RATIO_SL_THRESH))
977
978
write(10, fmt=trim(fmt3)) 'ratio_sl_thresh =', RATIO_SL_THRESH
#endif
Ralf Greve's avatar
Ralf Greve committed
979
#if (DYNAMICS==2 && HYB_MODE==0 && defined(SSTA_SIA_WEIGH_FCT))
980
write(10, fmt=trim(fmt2)) 'SSTA_SIA_WEIGH_FCT = ', SSTA_SIA_WEIGH_FCT
981
#endif
Ralf Greve's avatar
Ralf Greve committed
982
983
984
#if (DYNAMICS==2 && HYB_MODE==1 && defined(HYB_REF_SPEED))
write(10, fmt=trim(fmt3)) 'hyb_ref_speed =', HYB_REF_SPEED
#endif
985
986
write(10, fmt=trim(fmt1)) ' '

987
write(10, fmt=trim(fmt2)) 'CALCMOD    = ', CALCMOD
988
989
990
991
992
993
994
#if (CALCMOD==-1 && defined(TEMP_CONST))
write(10, fmt=trim(fmt3)) 'TEMP_CONST =', TEMP_CONST
#endif
#if (CALCMOD==-1 && defined(AGE_CONST))
write(10, fmt=trim(fmt3)) 'AGE_CONST  =', AGE_CONST
#endif
#if (CALCMOD==1 && defined(CTS_MELTING_FREEZING))
995
write(10, fmt=trim(fmt2)) 'CTS_MELTING_FREEZING = ', CTS_MELTING_FREEZING
996
#endif
997
998
999
write(10, fmt=trim(fmt2)) 'FLOW_LAW   = ', FLOW_LAW
write(10, fmt=trim(fmt2)) 'FIN_VISC   = ', FIN_VISC
write(10, fmt=trim(fmt2)) 'MARGIN     = ', MARGIN
1000
#if (MARGIN==2)
For faster browsing, not all history is shown. View entire blame