SICOPOLIS V3.2
 All Classes Files Functions Variables Macros
sico_init.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : s i c o _ i n i t
4 !
5 !> @file
6 !!
7 !! Initialisations for SICOPOLIS.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2016 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Initialisations for SICOPOLIS.
34 !<------------------------------------------------------------------------------
35 subroutine sico_init(delta_ts, glac_index, &
36  mean_accum, &
37  dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser, &
38  time, time_init, time_end, time_output, &
39  dxi, deta, dzeta_c, dzeta_t, dzeta_r, &
40  z_sl, dzsl_dtau, z_mar, &
41  ii, jj, nn, &
42  ndat2d, ndat3d, n_output, &
43  runname)
44 
45 use sico_types
47 use sico_vars
51 
52 implicit none
53 
54 integer(i4b), intent(out) :: ii((imax+1)*(jmax+1)), &
55  jj((imax+1)*(jmax+1)), &
56  nn(0:jmax,0:imax)
57 integer(i4b), intent(out) :: ndat2d, ndat3d
58 integer(i4b), intent(out) :: n_output
59 real(dp), intent(out) :: delta_ts, glac_index
60 real(dp), intent(out) :: mean_accum
61 real(dp), intent(out) :: dtime, dtime_temp, dtime_wss, &
62  dtime_out, dtime_ser
63 real(dp), intent(out) :: time, time_init, time_end, time_output(100)
64 real(dp), intent(out) :: dxi, deta, dzeta_c, dzeta_t, dzeta_r
65 real(dp), intent(out) :: z_sl, dzsl_dtau, z_mar
66 character(len=100), intent(out) :: runname
67 
68 integer(i4b) :: i, j, kc, kt, kr, m, n, ir, jr
69 integer(i4b) :: ios, ios1, ios2, ios3, ios4
70 integer(i4b) :: ierr
71 real(dp) :: dtime0, dtime_temp0, dtime_wss0, dtime_out0, dtime_ser0
72 real(dp) :: time_init0, time_end0, time_output0(100)
73 real(dp) :: d_dummy
74 character (len=100) :: anfdatname
75 character (len=256) :: shell_command
76 character :: ch_dummy
77 logical :: flag_3d_output
78 
79 character(len=64), parameter :: fmt1 = '(a)', &
80  fmt2 = '(a,i4)', &
81  fmt3 = '(a,es12.4)'
82 
83 !-------- Name of the computational domain --------
84 
85 #if defined(ANT)
86 ch_domain_long = 'Antarctica'
87 ch_domain_short = 'ant'
88 
89 #elif defined(ASF)
90 ch_domain_long = 'Austfonna'
91 ch_domain_short = 'asf'
92 
93 #elif defined(EMTP2SGE)
94 ch_domain_long = 'EISMINT Phase 2 Simplified Geometry Experiment'
95 ch_domain_short = 'emtp2sge'
96 
97 #elif defined(GRL)
98 ch_domain_long = 'Greenland'
99 ch_domain_short = 'grl'
100 
101 #elif defined(NHEM)
102 ch_domain_long = 'Northern hemisphere'
103 ch_domain_short = 'nhem'
104 
105 #elif defined(SCAND)
106 ch_domain_long = 'Scandinavia and Eurasia'
107 ch_domain_short = 'scand'
108 
109 #elif defined(TIBET)
110 ch_domain_long = 'Tibet'
111 ch_domain_short = 'tibet'
112 
113 #elif defined(NMARS)
114 ch_domain_long = 'North polar cap of Mars'
115 ch_domain_short = 'nmars'
116 
117 #elif defined(SMARS)
118 ch_domain_long = 'South polar cap of Mars'
119 ch_domain_short = 'smars'
120 
121 #elif (defined(XYZ))
122 ch_domain_long = 'XYZ'
123 ch_domain_short = 'xyz'
124 #if (defined(HEINO))
125 ch_domain_long = trim(ch_domain_long)//'/ISMIP HEINO'
126 #endif
127 
128 #else
129 stop ' sico_init: No valid domain specified!'
130 #endif
131 
132 !-------- Some initial values --------
133 
134 n_output = 0
135 
136 dtime = 0.0_dp
137 dtime_temp = 0.0_dp
138 dtime_wss = 0.0_dp
139 dtime_out = 0.0_dp
140 dtime_ser = 0.0_dp
141 
142 time = 0.0_dp
143 time_init = 0.0_dp
144 time_end = 0.0_dp
145 time_output = 0.0_dp
146 
147 !-------- Initialisation of the Library of Iterative Solvers Lis,
148 ! if required --------
149 
150 #if (CALCZS==4 || MARGIN==3 || DYNAMICS==2)
151 
152 #include "lisf.h"
153 call lis_initialize(ierr)
154 
155 #endif
156 
157 !-------- Read physical parameters --------
158 
159 call phys_para()
160 
161 call ice_mat_eqs_pars(rf, r_t, kappa, c, -190, 10)
162 
163 #if (!defined(SURFACE_FORCING) || SURFACE_FORCING==1)
164 
165 temp_min = temp_min ! deg C
166 s_t = s_t *1.0e-03_dp ! K/km -> K/m
167 x_hat = x_hat *1.0e+03_dp ! km -> m
168 y_hat = y_hat *1.0e+03_dp ! km -> m
169 b_max = b_max /year_sec ! m/a -> m/s
170 s_b = s_b *1.0e-03_dp/year_sec ! m/(a*km) -> 1/s
171 eld = eld *1.0e+03_dp ! km -> m
172 
173 #elif (SURFACE_FORCING==2)
174 
175 temp_0 = temp_0 ! deg C
176 gamma_t = gamma_t *1.0e-03_dp ! K/km -> K/m
177 s_0 = s_0 /year_sec ! m/a -> m/s
178 m_0 = m_0 *1.0e-03_dp/year_sec ! m/(a*km) -> 1/s
179 ela = ela *1.0e+03_dp ! km -> m
180 
181 #else
182 stop ' sico_init: SURFACE_FORCING must be either 1 or 2!'
183 #endif
184 
185 ! ------ Some auxiliary quantities required for the enthalpy method
186 
187 call calc_c_int_table(c, -190, 10, l)
189 
190 !-------- Compatibility check of the SICOPOLIS version with the header file
191 
192 if ( trim(version) /= trim(sico_version) ) &
193  stop ' sico_init: SICOPOLIS version not compatible with header file!'
194 
195 !-------- Check whether the dynamics and thermodynamics modes are defined
196 
197 #if ( !defined(DYNAMICS) )
198 stop ' sico_init: DYNAMICS not defined in the header file!'
199 #endif
200 
201 #if ( !defined(CALCMOD) )
202 stop ' sico_init: CALCMOD not defined in the header file!'
203 #endif
204 
205 #if ( defined(ENTHMOD) )
206 write(6, fmt='(a)') ' sico_init: ENTHMOD must not be defined any more.'
207 write(6, fmt='(a)') ' Please update your header file!'
208 stop
209 #endif
210 
211 !-------- Compatibility check of the horizontal resolution with the
212 ! number of grid points --------
213 
214 #if GRID==0
215 
216 if (abs(dx-5.0_dp) < eps) then
217 
218  if ((imax /= 300).or.(jmax /= 300)) then
219  stop ' sico_init: IMAX and/or JMAX wrong!'
220  end if
221 
222 else if (abs(dx-10.0_dp) < eps) then
223 
224  if ((imax /= 150).or.(jmax /= 150)) then
225  stop ' sico_init: IMAX and/or JMAX wrong!'
226  end if
227 
228 else if (abs(dx-25.0_dp) < eps) then
229 
230  if ((imax /= 60).or.(jmax /= 60)) then
231  stop ' sico_init: IMAX and/or JMAX wrong!'
232  end if
233 
234 else if (abs(dx-75.0_dp) < eps) then
235 
236  if ((imax /= 20).or.(jmax /= 20)) then
237  stop ' sico_init: IMAX and/or JMAX wrong!'
238  end if
239 
240 else
241  stop ' sico_init: DX wrong!'
242 end if
243 
244 #elif GRID==1
245 
246 stop ' sico_init: GRID==1 not allowed for this application!'
247 
248 #elif GRID==2
249 
250 stop ' sico_init: GRID==2 not allowed for this application!'
251 
252 #endif
253 
254 !-------- Compatibility check of the thermodynamics mode
255 ! (cold vs. polythermal vs. enthalpy method)
256 ! and the number of grid points in the lower (kt) ice domain --------
257 
258 #if (CALCMOD==0 || CALCMOD==2 || CALCMOD==3 || CALCMOD==-1)
259 
260 if (ktmax /= 1) then
261  write(6, fmt='(a)') ' sico_init: For options CALCMOD==0, 2, 3 or -1,'
262  write(6, fmt='(a)') ' the separate kt domain is redundant.'
263  write(6, fmt='(a)') ' Therefore, consider setting KTMAX to 1.'
264  write(6, fmt='(a)') ' '
265 end if
266 
267 #endif
268 
269 !-------- Compatibility check of discretization schemes for the horizontal and
270 ! vertical advection terms in the temperature and age equations --------
271 
272 #if (ADV_HOR==1)
273 stop ' sico_init: Option ADV_HOR==1 (central differences) not defined!'
274 #endif
275 
276 !-------- Check whether for the shallow shelf
277 ! or shelfy stream approximation
278 ! the chosen grid is Cartesian coordinates
279 ! without distortion correction (GRID==0) --------
280 
281 #if ((MARGIN==3 && DYNAMICS==1) || DYNAMICS==2) /* requires SSA or SStA */
282 #if (GRID != 0)
283 write(6, fmt='(a)') ' sico_init: Distortion correction not implemented'
284 write(6, fmt='(a)') ' for the shallow shelf approximation (SSA)'
285 write(6, fmt='(a)') ' or the shelfy stream approximation (SStA)'
286 write(6, fmt='(a)') ' -> GRID==0 required!'
287 stop
288 #endif
289 #endif
290 
291 !-------- Setting of forcing flag --------
292 
293 forcing_flag = 1 ! forcing by delta_ts
294 
295 !-------- Initialization of numerical time steps --------
296 
297 dtime0 = dtime0
298 dtime_temp0 = dtime_temp0
299 
300 !-------- Further initializations --------
301 
302 dzeta_c = 1.0_dp/real(kcmax,dp)
303 dzeta_t = 1.0_dp/real(ktmax,dp)
304 dzeta_r = 1.0_dp/real(krmax,dp)
305 
306 ndat2d = 1
307 ndat3d = 1
308 
309 !-------- General abbreviations --------
310 
311 ! ------ kc domain
312 
313 if (deform >= eps) then
314 
315  flag_aa_nonzero = .true. ! non-equidistant grid
316 
317  aa = deform
318  ea = exp(aa)
319 
320  kc=0
321  zeta_c(kc) = 0.0_dp
322  eaz_c(kc) = 1.0_dp
323  eaz_c_quotient(kc) = 0.0_dp
324 
325  do kc=1, kcmax-1
326  zeta_c(kc) = kc*dzeta_c
327  eaz_c(kc) = exp(aa*zeta_c(kc))
328  eaz_c_quotient(kc) = (eaz_c(kc)-1.0_dp)/(ea-1.0_dp)
329  end do
330 
331  kc=kcmax
332  zeta_c(kc) = 1.0_dp
333  eaz_c(kc) = exp(aa)
334  eaz_c_quotient(kc) = 1.0_dp
335 
336 else
337 
338  flag_aa_nonzero = .false. ! equidistant grid
339 
340  aa = 0.0_dp
341  ea = 1.0_dp
342 
343  kc=0
344  zeta_c(kc) = 0.0_dp
345  eaz_c(kc) = 1.0_dp
346  eaz_c_quotient(kc) = 0.0_dp
347 
348  do kc=1, kcmax-1
349  zeta_c(kc) = kc*dzeta_c
350  eaz_c(kc) = 1.0_dp
351  eaz_c_quotient(kc) = zeta_c(kc)
352  end do
353 
354  kc=kcmax
355  zeta_c(kc) = 1.0_dp
356  eaz_c(kc) = 1.0_dp
357  eaz_c_quotient(kc) = 1.0_dp
358 
359 end if
360 
361 ! ------ kt domain
362 
363 kt=0
364 zeta_t(kt) = 0.0_dp
365 
366 do kt=1, ktmax-1
367  zeta_t(kt) = kt*dzeta_t
368 end do
369 
370 kt=ktmax
371 zeta_t(kt) = 1.0_dp
372 
373 ! ------ kr domain
374 
375 kr=0
376 zeta_r(kr) = 0.0_dp
377 
378 do kr=1, krmax-1
379  zeta_r(kr) = kr*dzeta_r
380 end do
381 
382 kr=krmax
383 zeta_r(kr) = 1.0_dp
384 
385 !-------- Construction of a vector (with index n) from a 2-d array
386 ! (with indices i, j) by diagonal numbering --------
387 
388 n=1
389 
390 do m=0, imax+jmax
391  do i=m, 0, -1
392  j = m-i
393  if ((i <= imax).and.(j <= jmax)) then
394  ii(n) = i
395  jj(n) = j
396  nn(j,i) = n
397  n=n+1
398  end if
399  end do
400 end do
401 
402 !-------- Specification of current simulation --------
403 
404 runname = runname
405 anfdatname = anfdatname
406 
407 #if defined(YEAR_ZERO)
408 year_zero = year_zero
409 #else
410 year_zero = 2000.0_dp ! default value 2000 CE
411 #endif
412 
413 time_init0 = time_init0
414 time_end0 = time_end0
415 dtime_ser0 = dtime_ser0
416 
417 #if ( OUTPUT==1 || OUTPUT==3 )
418 dtime_out0 = dtime_out0
419 #endif
420 
421 #if ( OUTPUT==2 || OUTPUT==3 )
422 n_output = n_output
423 time_output0( 1) = time_out0_01
424 time_output0( 2) = time_out0_02
425 time_output0( 3) = time_out0_03
426 time_output0( 4) = time_out0_04
427 time_output0( 5) = time_out0_05
428 time_output0( 6) = time_out0_06
429 time_output0( 7) = time_out0_07
430 time_output0( 8) = time_out0_08
431 time_output0( 9) = time_out0_09
432 time_output0(10) = time_out0_10
433 time_output0(11) = time_out0_11
434 time_output0(12) = time_out0_12
435 time_output0(13) = time_out0_13
436 time_output0(14) = time_out0_14
437 time_output0(15) = time_out0_15
438 time_output0(16) = time_out0_16
439 time_output0(17) = time_out0_17
440 time_output0(18) = time_out0_18
441 time_output0(19) = time_out0_19
442 time_output0(20) = time_out0_20
443 #endif
444 
445 !-------- Write log file --------
446 
447 shell_command = 'if [ ! -d'
448 shell_command = trim(shell_command)//' '//outpath
449 shell_command = trim(shell_command)//' '//'] ; then mkdir'
450 shell_command = trim(shell_command)//' '//outpath
451 shell_command = trim(shell_command)//' '//'; fi'
452 call system(trim(shell_command))
453  ! Check whether directory OUTPATH exists. If not, it is created.
454 
455 open(10, iostat=ios, &
456  file=outpath//'/'//trim(runname)//'.log', &
457  status='new')
458 if (ios /= 0) &
459  stop ' sico_init: Error when opening the log file!'
460 
461 write(10, fmt=trim(fmt1)) 'Computational domain:'
462 write(10, fmt=trim(fmt1)) trim(ch_domain_long)
463 write(10, fmt=trim(fmt1)) ' '
464 
465 write(10, fmt=trim(fmt2)) 'imax =', imax
466 write(10, fmt=trim(fmt2)) 'jmax =', jmax
467 write(10, fmt=trim(fmt2)) 'kcmax =', kcmax
468 write(10, fmt=trim(fmt2)) 'ktmax =', ktmax
469 write(10, fmt=trim(fmt2)) 'krmax =', krmax
470 write(10, fmt=trim(fmt1)) ' '
471 
472 write(10, fmt=trim(fmt3)) 'a =', aa
473 write(10, fmt=trim(fmt1)) ' '
474 
475 #if (GRID==0 || GRID==1)
476 write(10, fmt=trim(fmt3)) 'x0 =', x0
477 write(10, fmt=trim(fmt3)) 'y0 =', y0
478 write(10, fmt=trim(fmt3)) 'dx =', dx
479 #elif GRID==2
480 write(10, fmt=trim(fmt3)) 'dlambda =', dlambda
481 write(10, fmt=trim(fmt3)) 'dphi =', dphi
482 #endif
483 write(10, fmt=trim(fmt1)) ' '
484 
485 write(10, fmt=trim(fmt3)) 'year_zero =', year_zero
486 write(10, fmt=trim(fmt3)) 'time_init =', time_init0
487 write(10, fmt=trim(fmt3)) 'time_end =', time_end0
488 write(10, fmt=trim(fmt3)) 'dtime =', dtime0
489 write(10, fmt=trim(fmt3)) 'dtime_temp =', dtime_temp0
490 #if ( OUTPUT==1 || OUTPUT==3 )
491 write(10, fmt=trim(fmt3)) 'dtime_out =', dtime_out0
492 #endif
493 write(10, fmt=trim(fmt3)) 'dtime_ser =', dtime_ser0
494 write(10, fmt=trim(fmt1)) ' '
495 
496 write(10, fmt=trim(fmt2)) 'ANF_DAT =', anf_dat
497 #if (ANF_DAT==1 && defined(TEMP_INIT))
498 write(10, fmt=trim(fmt2)) 'TEMP_INIT =', temp_init
499 #endif
500 #if (ANF_DAT==3)
501 write(10, fmt=trim(fmt1)) 'Initial-value file = '//anfdatname
502 write(10, fmt=trim(fmt1)) 'Path to initial-value file = '//anfdatpath
503 #endif
504 write(10, fmt=trim(fmt1)) ' '
505 
506 write(10, fmt=trim(fmt1)) 'Physical-parameter file = '//phys_para_file
507 write(10, fmt=trim(fmt1)) ' '
508 
509 #if (CALCZS==3 || CALCZS==4)
510 write(10, fmt=trim(fmt3)) 'ovi_weight =', ovi_weight
511 #if CALCZS==3
512 write(10, fmt=trim(fmt3)) 'omega_sor =', omega_sor
513 #endif
514 write(10, fmt=trim(fmt1)) ' '
515 #endif
516 
517 #if (defined(SURFACE_FORCING))
518 write(10, fmt=trim(fmt2)) 'SURFACE_FORCING =', surface_forcing
519 #endif
520 #if (!defined(SURFACE_FORCING) || SURFACE_FORCING==1)
521 write(10, fmt=trim(fmt3)) 'temp_min =', temp_min
522 write(10, fmt=trim(fmt3)) 's_t =', s_t
523 write(10, fmt=trim(fmt3)) 'x_hat =', x_hat
524 write(10, fmt=trim(fmt3)) 'y_hat =', y_hat
525 write(10, fmt=trim(fmt3)) 'b_max =', b_max
526 write(10, fmt=trim(fmt3)) 's_b =', s_b
527 write(10, fmt=trim(fmt3)) 'eld =', eld
528 #elif (SURFACE_FORCING==2)
529 write(10, fmt=trim(fmt3)) 'temp_0 =', temp_0
530 write(10, fmt=trim(fmt3)) 'gamma_t =', gamma_t
531 write(10, fmt=trim(fmt3)) 's_0 =', s_0
532 write(10, fmt=trim(fmt3)) 'm_0 =', m_0
533 write(10, fmt=trim(fmt3)) 'ela =', ela
534 #endif
535 write(10, fmt=trim(fmt1)) ' '
536 
537 #if TSURFACE==1
538 write(10, fmt=trim(fmt3)) 'delta_ts0 =', delta_ts0
539 #elif TSURFACE==3
540 write(10, fmt=trim(fmt3)) 'sine_amplit =', sine_amplit
541 write(10, fmt=trim(fmt3)) 'sine_period =', sine_period
542 #elif TSURFACE==4
543 write(10, fmt=trim(fmt1)) 'GRIP file = '//grip_temp_file
544 write(10, fmt=trim(fmt3)) 'grip_temp_fact =', grip_temp_fact
545 #endif
546 
547 #if (SEA_LEVEL==1)
548 write(10, fmt=trim(fmt3)) 'z_sl0 =', z_sl0
549 #elif (SEA_LEVEL==3)
550 write(10, fmt=trim(fmt1)) 'sea-level file = '//sea_level_file
551 #endif
552 write(10, fmt=trim(fmt1)) ' '
553 
554 #if (MARGIN==2)
555 #if ( MARINE_ICE_CALVING==2 || MARINE_ICE_CALVING==3 )
556 write(10, fmt=trim(fmt3)) 'z_mar =', z_mar
557 write(10, fmt=trim(fmt1)) ' '
558 #elif ( MARINE_ICE_CALVING==4 || MARINE_ICE_CALVING==5 \
559  || marine_ice_calving==6 || marine_ice_calving==7 )
560 write(10, fmt=trim(fmt3)) 'fact_z_mar =', fact_z_mar
561 write(10, fmt=trim(fmt1)) ' '
562 #elif ( ( MARINE_ICE_FORMATION==2 ) && ( MARINE_ICE_CALVING==9 ) )
563 write(10, fmt=trim(fmt3)) 'calv_uw_coeff =', calv_uw_coeff
564 write(10, fmt=trim(fmt3)) 'r1_calv_uw =', r1_calv_uw
565 write(10, fmt=trim(fmt3)) 'r2_calv_uw =', r2_calv_uw
566 write(10, fmt=trim(fmt1)) ' '
567 #endif
568 #elif (MARGIN==3)
569 #if ICE_SHELF_CALVING==2
570 write(10, fmt=trim(fmt3)) 'H_calv =', h_calv
571 write(10, fmt=trim(fmt1)) ' '
572 #endif
573 #endif
574 
575 write(10, fmt=trim(fmt3)) 'c_slide =', c_slide
576 write(10, fmt=trim(fmt3)) 'gamma_slide =', gamma_slide
577 write(10, fmt=trim(fmt2)) 'p_weert =', p_weert
578 write(10, fmt=trim(fmt2)) 'q_weert =', q_weert
579 #if SLIDE_LAW==2
580 write(10, fmt=trim(fmt3)) 'red_pres_limit_fact =', red_pres_limit_fact
581 #endif
582 write(10, fmt=trim(fmt1)) ' '
583 
584 #if Q_GEO_MOD==1
585 write(10, fmt=trim(fmt3)) 'q_geo =', q_geo
586 write(10, fmt=trim(fmt1)) ' '
587 #endif
588 
589 write(10, fmt=trim(fmt2)) 'REBOUND =', rebound
590 #if (REBOUND==1)
591 write(10, fmt=trim(fmt3)) 'frac_llra =', frac_llra
592 #endif
593 #if (REBOUND==1 || REBOUND==2)
594 write(10, fmt=trim(fmt2)) 'TIME_LAG_MOD =', time_lag_mod
595 #if (TIME_LAG_MOD==1)
596 write(10, fmt=trim(fmt3)) 'time_lag =', time_lag
597 #elif (TIME_LAG_MOD==2)
598 write(10, fmt=trim(fmt1)) 'time_lag_file = '//time_lag_file
599 #else
600 stop ' sico_init: TIME_LAG_MOD must be either 1 or 2!'
601 #endif
602 #endif
603 #if (REBOUND==2)
604 write(10, fmt=trim(fmt2)) 'FLEX_RIG_MOD =', flex_rig_mod
605 #if (FLEX_RIG_MOD==1)
606 write(10, fmt=trim(fmt3)) 'flex_rig =', flex_rig
607 #elif (FLEX_RIG_MOD==2)
608 write(10, fmt=trim(fmt1)) 'flex_rig_file = '//flex_rig_file
609 #else
610 stop ' sico_init: FLEX_RIG_MOD must be either 1 or 2!'
611 #endif
612 #endif
613 write(10, fmt=trim(fmt2)) 'Q_LITHO =', q_litho
614 write(10, fmt=trim(fmt1)) ' '
615 
616 #if FLOW_LAW==2
617 write(10, fmt=trim(fmt3)) 'gr_size =', gr_size
618 write(10, fmt=trim(fmt1)) ' '
619 #endif
620 #if FIN_VISC==2
621 write(10, fmt=trim(fmt3)) 'sigma_res =', sigma_res
622 write(10, fmt=trim(fmt1)) ' '
623 #endif
624 
625 write(10, fmt=trim(fmt2)) 'ENHMOD =', enhmod
626 #if (ENHMOD==1 || ENHMOD==2 || ENHMOD==3)
627 write(10, fmt=trim(fmt3)) 'enh_fact =', enh_fact
628 #endif
629 #if (ENHMOD==2 || ENHMOD==3)
630 write(10, fmt=trim(fmt3)) 'enh_intg =', enh_intg
631 #endif
632 #if (ENHMOD==2)
633 write(10, fmt=trim(fmt3)) 'age_trans =', age_trans_0
634 #endif
635 #if (ENHMOD==3)
636 write(10, fmt=trim(fmt3)) 'date_trans1 =', date_trans1_0
637 write(10, fmt=trim(fmt3)) 'date_trans2 =', date_trans2_0
638 write(10, fmt=trim(fmt3)) 'date_trans3 =', date_trans3_0
639 #endif
640 #if (ENHMOD==4 || ENHMOD==5)
641 write(10, fmt=trim(fmt3)) 'enh_compr =', enh_compr
642 write(10, fmt=trim(fmt3)) 'enh_shear =', enh_shear
643 #endif
644 #if ((ENHMOD==1 || ENHMOD==2 || ENHMOD==3 || ENHMOD==4) && MARGIN==3)
645 write(10, fmt=trim(fmt3)) 'enh_shelf =', enh_shelf
646 #endif
647 write(10, fmt=trim(fmt1)) ' '
648 
649 write(10, fmt=trim(fmt3)) 'numdiff_H_t =', numdiff_h_t
650 write(10, fmt=trim(fmt3)) 'tau_cts =', tau_cts
651 write(10, fmt=trim(fmt3)) 'H_min =', h_min
652 write(10, fmt=trim(fmt3)) 'vh_max =', vh_max
653 write(10, fmt=trim(fmt3)) 'hd_min =', hd_min
654 write(10, fmt=trim(fmt3)) 'hd_max =', hd_max
655 #if defined(QBM_MIN)
656 write(10, fmt=trim(fmt3)) 'qbm_min =', qbm_min
657 #elif defined(QB_MIN) /* obsolete */
658 write(10, fmt=trim(fmt3)) 'qb_min =', qb_min
659 #endif
660 #if defined(QBM_MAX)
661 write(10, fmt=trim(fmt3)) 'qbm_max =', qbm_max
662 #elif defined(QB_MAX) /* obsolete */
663 write(10, fmt=trim(fmt3)) 'qb_max =', qb_max
664 #endif
665 write(10, fmt=trim(fmt3)) 'age_min =', age_min
666 write(10, fmt=trim(fmt3)) 'age_max =', age_max
667 write(10, fmt=trim(fmt3)) 'mean_accum =', mean_accum
668 #if ADV_VERT==1
669 write(10, fmt=trim(fmt3)) 'age_diff =', agediff
670 #endif
671 write(10, fmt=trim(fmt1)) ' '
672 
673 write(10, fmt=trim(fmt2)) 'GRID =', grid
674 write(10, fmt=trim(fmt2)) 'DYNAMICS =', dynamics
675 #if (DYNAMICS==2 && defined(RATIO_SL_THRESH))
676 write(10, fmt=trim(fmt3)) 'ratio_sl_thresh =', ratio_sl_thresh
677 #endif
678 write(10, fmt=trim(fmt2)) 'CALCMOD =', calcmod
679 #if ( CALCMOD==-1 && defined(TEMP_CONST) )
680 write(10, fmt=trim(fmt3)) 'TEMP_CONST =', temp_const
681 #endif
682 #if ( CALCMOD==-1 && defined(AGE_CONST) )
683 write(10, fmt=trim(fmt3)) 'AGE_CONST =', age_const
684 #endif
685 #if ( CALCMOD==1 && defined(CTS_MELTING_FREEZING) )
686 write(10, fmt=trim(fmt2)) 'CTS_MELTING_FREEZING =', cts_melting_freezing
687 #endif
688 write(10, fmt=trim(fmt2)) 'FLOW_LAW =', flow_law
689 write(10, fmt=trim(fmt2)) 'FIN_VISC =', fin_visc
690 write(10, fmt=trim(fmt2)) 'MARGIN =', margin
691 #if (MARGIN==2)
692 write(10, fmt=trim(fmt2)) 'MARINE_ICE_FORMATION =', marine_ice_formation
693 write(10, fmt=trim(fmt2)) 'MARINE_ICE_CALVING =', marine_ice_calving
694 #elif (MARGIN==3)
695 write(10, fmt=trim(fmt2)) 'ICE_SHELF_CALVING =', ice_shelf_calving
696 #endif
697 write(10, fmt=trim(fmt2)) 'ZS_EVOL =', zs_evol
698 write(10, fmt=trim(fmt2)) 'CALCZS =', calczs
699 write(10, fmt=trim(fmt2)) 'ADV_HOR =', adv_hor
700 write(10, fmt=trim(fmt2)) 'ADV_VERT =', adv_vert
701 write(10, fmt=trim(fmt2)) 'TOPOGRAD =', topograd
702 write(10, fmt=trim(fmt2)) 'TSURFACE =', tsurface
703 write(10, fmt=trim(fmt2)) 'SEA_LEVEL =', sea_level
704 write(10, fmt=trim(fmt2)) 'SLIDE_LAW =', slide_law
705 write(10, fmt=trim(fmt2)) 'Q_GEO_MOD =', q_geo_mod
706 write(10, fmt=trim(fmt1)) ' '
707 
708 #if defined(OUT_TIMES)
709 write(10, fmt=trim(fmt2)) 'OUT_TIMES =', out_times
710 #endif
711 write(10, fmt=trim(fmt2)) 'OUTPUT =', output
712 write(10, fmt=trim(fmt2)) 'OUTSER =', outser
713 #if defined(OUTSER_V_A)
714 write(10, fmt=trim(fmt2)) 'OUTSER_V_A =', outser_v_a
715 #endif
716 #if ( OUTPUT==1 || OUTPUT==2 )
717 write(10, fmt=trim(fmt2)) 'ERGDAT =', ergdat
718 #endif
719 write(10, fmt=trim(fmt2)) 'NETCDF =', netcdf
720 write(10, fmt=trim(fmt1)) ' '
721 #if ( OUTPUT==2 || OUTPUT==3 )
722 write(10, fmt=trim(fmt2)) 'n_output =', n_output
723 do n=1, n_output
724  write(10, fmt=trim(fmt3)) 'time_output =', time_output0(n)
725 end do
726 write(10, fmt=trim(fmt1)) ' '
727 #endif
728 
729 write(10, fmt=trim(fmt1)) 'Program version and date: '//version//' / '//date
730 
731 close(10, status='keep')
732 
733 !-------- Conversion of time quantities --------
734 
735 year_zero = year_zero*year_sec ! a --> s
736 time_init = time_init0*year_sec ! a --> s
737 time_end = time_end0*year_sec ! a --> s
738 dtime = dtime0*year_sec ! a --> s
739 dtime_temp = dtime_temp0*year_sec ! a --> s
740 dtime_ser = dtime_ser0*year_sec ! a --> s
741 #if ( OUTPUT==1 || OUTPUT==3 )
742 dtime_out = dtime_out0*year_sec ! a --> s
743 #endif
744 #if ( OUTPUT==2 || OUTPUT==3 )
745 do n=1, n_output
746  time_output(n) = time_output0(n)*year_sec ! a --> s
747 end do
748 #endif
749 
750 if (abs(dtime_temp/dtime-nint(dtime_temp/dtime)) > eps) &
751  stop ' sico_init: dtime_temp must be a multiple of dtime!'
752 
753 time = time_init
754 
755 !-------- Mean accumulation --------
756 
757 mean_accum = mean_accum*(1.0e-03_dp/year_sec)*(rho_w/rho)
758 ! ! mm/a water equiv. --> m/s ice equiv.
759 
760 !-------- Set present topography mask --------
761 
762 maske_help = 1
763 
764 maske_help(0,:) = 2
765 maske_help(jmax,:) = 2
766 
767 maske_help(:,0) = 2
768 maske_help(:,imax) = 2
769 
770 !-------- Read data for delta_ts --------
771 
772 #if TSURFACE==4
773 
774 open(21, iostat=ios, &
775  file=inpath//'/general/'//grip_temp_file, &
776  status='old')
777 if (ios /= 0) &
778  stop ' sico_init: Error when opening the data file for delta_ts!'
779 
780 read(21, fmt=*) ch_dummy, grip_time_min, grip_time_stp, grip_time_max
781 
782 if (ch_dummy /= '#') then
783  write(6, fmt=*) ' sico_init: grip_time_min, grip_time_stp, grip_time_max'
784  write(6, fmt=*) ' not defined in data file for delta_ts!'
785  stop
786 end if
787 
788 ndata_grip = (grip_time_max-grip_time_min)/grip_time_stp
789 
790 allocate(griptemp(0:ndata_grip))
791 
792 do n=0, ndata_grip
793  read(21, fmt=*) d_dummy, griptemp(n)
794 end do
795 
796 close(21, status='keep')
797 
798 #endif
799 
800 !-------- Read data for z_sl --------
801 
802 #if (SEA_LEVEL==3)
803 
804 open(21, iostat=ios, &
805  file=inpath//'/general/'//sea_level_file, &
806  status='old')
807 if (ios /= 0) &
808  stop ' sico_init: Error when opening the data file for z_sl!'
809 
810 read(21, fmt=*) ch_dummy, specmap_time_min, specmap_time_stp, specmap_time_max
811 
812 if (ch_dummy /= '#') then
813  write(6, fmt=*) ' sico_init: specmap_time_min, specmap_time_stp, specmap_time_max'
814  write(6, fmt=*) ' not defined in data file for z_sl!'
815  stop
816 end if
817 
818 ndata_specmap = (specmap_time_max-specmap_time_min)/specmap_time_stp
819 
820 allocate(specmap_zsl(0:ndata_specmap))
821 
822 do n=0, ndata_specmap
823  read(21, fmt=*) d_dummy, specmap_zsl(n)
824 end do
825 
826 close(21, status='keep')
827 
828 #endif
829 
830 !-------- Determination of the geothermal heat flux --------
831 
832 #if Q_GEO_MOD==1
833 
834 ! ------ Constant value
835 
836 do i=0, imax
837 do j=0, jmax
838  q_geo(j,i) = q_geo *1.0e-03_dp ! mW/m2 -> W/m2
839 end do
840 end do
841 
842 #elif Q_GEO_MOD==2
843 
844 stop ' sico_init: Option Q_GEO_MOD==2 not available for this application!'
845 
846 #endif
847 
848 !-------- Determination of the time lag
849 ! of the relaxing asthenosphere --------
850 
851 #if (REBOUND==1 || REBOUND==2)
852 
853 #if (TIME_LAG_MOD==1)
854 
855 time_lag_asth = time_lag*year_sec ! a -> s
856 
857 #elif (TIME_LAG_MOD==2)
858 
859 open(29, iostat=ios, &
860  file=inpath//'/'//trim(ch_domain_short)//'/'//time_lag_file, &
861  recl=8192, status='old')
862 
863 if (ios /= 0) stop ' sico_init: Error when opening the time-lag file!'
864 
865 do n=1, 6; read(29, fmt='(a)') ch_dummy; end do
866 
867 do j=jmax, 0, -1
868  read(29, fmt=*) (time_lag_asth(j,i), i=0,imax)
869 end do
870 
871 close(29, status='keep')
872 
873 time_lag_asth = time_lag_asth*year_sec ! a -> s
874 
875 #endif
876 
877 #elif (REBOUND==0)
878 
879 time_lag_asth = 0.0_dp ! dummy values
880 
881 #endif
882 
883 !-------- Determination of the flexural rigidity of the lithosphere --------
884 
885 #if (REBOUND==2)
886 
887 #if (FLEX_RIG_MOD==1)
888 
889 flex_rig_lith = flex_rig
890 
891 #elif (FLEX_RIG_MOD==2)
892 
893 open(29, iostat=ios, &
894  file=inpath//'/'//trim(ch_domain_short)//'/'//flex_rig_file, &
895  recl=8192, status='old')
896 
897 if (ios /= 0) stop ' sico_init: Error when opening the flex-rig file!'
898 
899 do n=1, 6; read(29, fmt='(a)') ch_dummy; end do
900 
901 do j=jmax, 0, -1
902  read(29, fmt=*) (flex_rig_lith(j,i), i=0,imax)
903 end do
904 
905 close(29, status='keep')
906 
907 #endif
908 
909 #elif (REBOUND==0 || REBOUND==1)
910 
911 flex_rig_lith = 0.0_dp ! dummy values
912 
913 #endif
914 
915 !-------- Definition of initial values --------
916 
917 ! ------ Present topography
918 
919 #if (ANF_DAT==1)
920 
921 stop ' sico_init: ANF_DAT==1 not allowed for this application!'
922 
923 ! ------ Ice-free, relaxed bedrock
924 
925 #elif (ANF_DAT==2)
926 
927 call topography2(dxi, deta)
928 
929 z_sl = -1.11e+11_dp ! dummy value for initial call of subroutine boundary
930 
931 call boundary(time_init, dtime, dxi, deta, &
932  delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
933 
934 q_bm = 0.0_dp
935 q_tld = 0.0_dp
936 q_b_tot = 0.0_dp
937 
938 p_b_w = 0.0_dp
939 h_w = 0.0_dp
940 
941 call init_temp_water_age()
942 
943 call calc_enhance(time_init)
944 
945 ! ------ Read initial state from output of previous simulation
946 
947 #elif (ANF_DAT==3)
948 
949 #if (NETCDF==1)
950 call topography3(dxi, deta, z_sl, anfdatname)
951 #elif (NETCDF==2)
952 call topography3_nc(dxi, deta, z_sl, anfdatname)
953 #else
954 stop ' sico_init: Parameter NETCDF must be either 1 or 2!'
955 #endif
956 
957 call boundary(time_init, dtime, dxi, deta, &
958  delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
959 
960 q_b_tot = q_bm + q_tld
961 
962 #endif
963 
964 !-------- Grounding line and calving front flags --------
965 
966 flag_grounding_line_1 = .false.
967 flag_grounding_line_2 = .false.
968 
969 flag_calving_front_1 = .false.
970 flag_calving_front_2 = .false.
971 
972 #if (MARGIN==1 || MARGIN==2)
973 
974 continue
975 
976 #elif (MARGIN==3)
977 
978 do i=1, imax-1
979 do j=1, jmax-1
980 
981  if ( (maske(j,i)==0_i2b) & ! grounded ice
982  .and. &
983  ( (maske(j,i+1)==3_i2b) & ! with
984  .or.(maske(j,i-1)==3_i2b) & ! one
985  .or.(maske(j+1,i)==3_i2b) & ! neighbouring
986  .or.(maske(j-1,i)==3_i2b) ) & ! floating ice point
987  ) &
988  flag_grounding_line_1(j,i) = .true.
989 
990  if ( (maske(j,i)==3_i2b) & ! floating ice
991  .and. &
992  ( (maske(j,i+1)==0_i2b) & ! with
993  .or.(maske(j,i-1)==0_i2b) & ! one
994  .or.(maske(j+1,i)==0_i2b) & ! neighbouring
995  .or.(maske(j-1,i)==0_i2b) ) & ! grounded ice point
996  ) &
997  flag_grounding_line_2(j,i) = .true.
998 
999  if ( (maske(j,i)==3_i2b) & ! floating ice
1000  .and. &
1001  ( (maske(j,i+1)==2_i2b) & ! with
1002  .or.(maske(j,i-1)==2_i2b) & ! one
1003  .or.(maske(j+1,i)==2_i2b) & ! neighbouring
1004  .or.(maske(j-1,i)==2_i2b) ) & ! ocean point
1005  ) &
1006  flag_calving_front_1(j,i) = .true.
1007 
1008  if ( (maske(j,i)==2_i2b) & ! ocean
1009  .and. &
1010  ( (maske(j,i+1)==3_i2b) & ! with
1011  .or.(maske(j,i-1)==3_i2b) & ! one
1012  .or.(maske(j+1,i)==3_i2b) & ! neighbouring
1013  .or.(maske(j-1,i)==3_i2b) ) & ! floating ice point
1014  ) &
1015  flag_calving_front_2(j,i) = .true.
1016 
1017 end do
1018 end do
1019 
1020 do i=1, imax-1
1021 
1022  j=0
1023  if ( (maske(j,i)==2_i2b) & ! ocean
1024  .and. (maske(j+1,i)==3_i2b) & ! with one neighbouring
1025  ) & ! floating ice point
1026  flag_calving_front_2(j,i) = .true.
1027 
1028  j=jmax
1029  if ( (maske(j,i)==2_i2b) & ! ocean
1030  .and. (maske(j-1,i)==3_i2b) & ! with one neighbouring
1031  ) & ! floating ice point
1032  flag_calving_front_2(j,i) = .true.
1033 
1034 end do
1035 
1036 do j=1, jmax-1
1037 
1038  i=0
1039  if ( (maske(j,i)==2_i2b) & ! ocean
1040  .and. (maske(j,i+1)==3_i2b) & ! with one neighbouring
1041  ) & ! floating ice point
1042  flag_calving_front_2(j,i) = .true.
1043 
1044  i=imax
1045  if ( (maske(j,i)==2_i2b) & ! ocean
1046  .and. (maske(j,i-1)==3_i2b) & ! with one neighbouring
1047  ) & ! floating ice point
1048  flag_calving_front_2(j,i) = .true.
1049 
1050 end do
1051 
1052 #else
1053 stop ' sico_init: MARGIN must be either 1, 2 or 3!'
1054 #endif
1055 
1056 !-------- Distance between grid points with delta_i=ir, delta_j=jr --------
1057 
1058 #if (GRID==0 || GRID==1)
1059 
1060 do ir=-imax, imax
1061 do jr=-jmax, jmax
1062  dist_dxdy(jr,ir) = sqrt( (real(ir,dp)*dxi)**2 + (real(jr,dp)*deta)**2 )
1063  ! distortion due to stereographic projection not accounted for
1064 end do
1065 end do
1066 
1067 #endif
1068 
1069 !-------- Initial velocities --------
1070 
1071 call calc_temp_melt()
1072 
1073 #if (DYNAMICS==1 || DYNAMICS==2)
1074 
1075 call calc_vxy_b_sia(time, z_sl)
1076 call calc_vxy_sia(dzeta_c, dzeta_t)
1077 
1078 #if (MARGIN==3 || DYNAMICS==2)
1079 call calc_vxy_ssa(z_sl, dxi, deta, dzeta_c, dzeta_t, ii, jj, nn)
1080 #endif
1081 
1082 call calc_vz_sia(dxi, deta, dzeta_c, dzeta_t)
1083 
1084 #if (MARGIN==3)
1085 call calc_vz_ssa(z_sl, dxi, deta, dzeta_c)
1086 #endif
1087 
1088 #elif (DYNAMICS==0)
1089 
1090 call calc_vxy_static()
1091 call calc_vz_static()
1092 
1093 #else
1094  stop ' sico_init: DYNAMICS must be either 0, 1 or 2!'
1095 #endif
1096 
1097 call calc_dxyz(dxi, deta, dzeta_c, dzeta_t)
1098 
1099 !-------- Initial enthalpies --------
1100 
1101 #if (CALCMOD==0 || CALCMOD==-1)
1102 
1103 do i=0, imax
1104 do j=0, jmax
1105 
1106  do kc=0, kcmax
1107  enth_c(kc,j,i) = enth_fct_temp_omega(temp_c(kc,j,i), 0.0_dp)
1108  end do
1109 
1110  do kt=0, ktmax
1111  enth_t(kt,j,i) = enth_c(0,j,i)
1112  end do
1113 
1114 end do
1115 end do
1116 
1117 #elif (CALCMOD==1)
1118 
1119 do i=0, imax
1120 do j=0, jmax
1121 
1122  do kc=0, kcmax
1123  enth_c(kc,j,i) = enth_fct_temp_omega(temp_c(kc,j,i), 0.0_dp)
1124  end do
1125 
1126  if ( (maske(j,i) == 0_i2b).and.(n_cts(j,i) == 1_i2b) ) then
1127  do kt=0, ktmax
1128  enth_t(kt,j,i) = enth_fct_temp_omega(temp_t_m(kt,j,i), omega_t(kt,j,i))
1129  end do
1130  else
1131  do kt=0, ktmax
1132  enth_t(kt,j,i) = enth_c(0,j,i)
1133  end do
1134  end if
1135 
1136 end do
1137 end do
1138 
1139 #elif (CALCMOD==2 || CALCMOD==3)
1140 
1141 do i=0, imax
1142 do j=0, jmax
1143 
1144  do kc=0, kcmax
1145  enth_c(kc,j,i) = enth_fct_temp_omega(temp_c(kc,j,i), omega_c(kc,j,i))
1146  end do
1147 
1148  do kt=0, ktmax
1149  enth_t(kt,j,i) = enth_c(0,j,i)
1150  end do
1151 
1152 end do
1153 end do
1154 
1155 #else
1156 
1157 stop ' sico_init: Parameter CALCMOD must be either -1, 0, 1, 2 or 3!'
1158 
1159 #endif
1160 
1161 !-------- Initialize time-series files --------
1162 
1163 ! ------ Time-series file for the ice sheet on the whole
1164 
1165 open(12, iostat=ios, &
1166  file=outpath//'/'//trim(runname)//'.ser', &
1167  status='new')
1168 if (ios /= 0) &
1169  stop ' sico_init: Error when opening the ser file!'
1170 
1171 write(12,1102)
1172 write(12,1103)
1173 
1174 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
1175 
1176  1102 format(' t(a) D_Ts(deg C) z_sl(m)',/, &
1177  ' H_max(m) zs_max(m) V_g(m^3)', &
1178  ' V_t(m^3) V_fw(m^3/a) V_sle(m)',/, &
1179  ' A_g(m^2) A_t(m^2) V_bm(m^3/a)', &
1180  ' V_tld(m^3/a) H_t_max(m) vs_max(m/a)')
1181  1103 format('----------------------------------------------------', &
1182  '---------------------------------------')
1183 
1184 #elif OUTSER_V_A==2
1185 
1186  1102 format(' t(a) D_Ts(deg C) z_sl(m)',/, &
1187  ' V(m^3) V_g(m^3) V_f(m^3)', &
1188  ' A(m^2) A_g(m^2) A_f(m^2)',/, &
1189  ' H_max(m) zs_max(m)', &
1190  ' V_t(m^3) V_fw(m^3/a) V_sle(m)',/, &
1191  ' A_t(m^2) V_bm(m^3/a)', &
1192  ' V_tld(m^3/a) H_t_max(m) vs_max(m/a)')
1193  1103 format('----------------------------------------------------', &
1194  '---------------------------------------')
1195 
1196 #else
1197  stop ' sico_init: OUTSER_V_A must be either 1 or 2!'
1198 #endif
1199 
1200 ! ------ Time-series file for the ice-thickness field
1201 
1202 #if OUTSER==2
1203 
1204 open(13, iostat=ios, &
1205  file=outpath//'/'//trim(runname)//'.thk', &
1206  status='new')
1207 if (ios /= 0) stop ' sico_init: Error when opening the thk file!'
1208 
1209 write(13,1104)
1210 write(13,1105)
1211 
1212 1104 format(' t(a) D_Ts(deg C) z_sl(m)',/, &
1213  ' H(m): JMAX+1 records [j = JMAX (-1) 0] with',/, &
1214  ' IMAX+1 values [i = 0 (1) IMAX] in each record')
1215 1105 format('----------------------------------------------------')
1216 
1217 #endif
1218 
1219 ! ------ Time-series file for selected positions ("deep boreholes")
1220 
1221 #if OUTSER==3
1222 
1223 n_core = 2 ! central dome, position halfway to coast
1224 
1225 allocate(lambda_core(n_core), phi_core(n_core), &
1226  x_core(n_core), y_core(n_core))
1227 
1228 lambda_core(1) = 0.0_dp ! dummy
1229 phi_core(1) = 0.0_dp ! dummy
1230 x_core(1) = 750.0_dp *1.0e+03_dp ! Position of the central dome
1231 y_core(1) = 750.0_dp *1.0e+03_dp ! (750 km, 750 km),
1232  ! conversion km -> m
1233 
1234 lambda_core(2) = 0.0_dp ! dummy
1235 phi_core(2) = 0.0_dp ! dummy
1236 x_core(2) = 750.0_dp *1.0e+03_dp ! Position halfway to the coast
1237 y_core(2) = 1125.0_dp *1.0e+03_dp ! (750 km, 1125 km),
1238  ! conversion km -> m
1239 
1240 open(14, iostat=ios, &
1241  file=outpath//'/'//trim(runname)//'.core', &
1242  status='new')
1243 if (ios /= 0) stop ' sico_init: Error when opening the core file!'
1244 
1245 if (forcing_flag == 1) then
1246 
1247  write(14,1106)
1248  write(14,1107)
1249 
1250  1106 format(' t(a) D_Ts(C) z_sl(m)',/, &
1251  ' H_P1(m) H_P2(m)',/, &
1252  ' v_P1(m/a) v_P2(m/a)',/, &
1253  ' T_P1(C) T_P2(C)',/, &
1254  ' Rb_P1(W/m2) Rb_P2(W/m2)')
1255  1107 format('---------------------------------------')
1256 
1257 end if
1258 
1259 #endif
1260 
1261 !-------- Output of the initial state --------
1262 
1263 #if OUTPUT==1
1264 
1265 #if ERGDAT==0
1266  flag_3d_output = .false.
1267 #elif ERGDAT==1
1268  flag_3d_output = .true.
1269 #else
1270  stop ' sico_init: ERGDAT must be either 0 or 1!'
1271 #endif
1272 
1273 #if NETCDF==1
1274  call output1(runname, time_init, delta_ts, glac_index, z_sl, &
1275  flag_3d_output, ndat2d, ndat3d)
1276 #elif NETCDF==2
1277  call output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
1278  flag_3d_output, ndat2d, ndat3d)
1279 #else
1280  stop ' sico_init: Parameter NETCDF must be either 1 or 2!'
1281 #endif
1282 
1283 #elif OUTPUT==2
1284 
1285 if (time_output(1) <= time_init+eps) then
1286 
1287 #if ERGDAT==0
1288  flag_3d_output = .false.
1289 #elif ERGDAT==1
1290  flag_3d_output = .true.
1291 #else
1292  stop ' sico_init: ERGDAT must be either 0 or 1!'
1293 #endif
1294 
1295 #if NETCDF==1
1296  call output1(runname, time_init, delta_ts, glac_index, z_sl, &
1297  flag_3d_output, ndat2d, ndat3d)
1298 #elif NETCDF==2
1299  call output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
1300  flag_3d_output, ndat2d, ndat3d)
1301 #else
1302  stop ' sico_init: Parameter NETCDF must be either 1 or 2!'
1303 #endif
1304 
1305 end if
1306 
1307 #elif OUTPUT==3
1308 
1309  flag_3d_output = .false.
1310 
1311 #if NETCDF==1
1312  call output1(runname, time_init, delta_ts, glac_index, z_sl, &
1313  flag_3d_output, ndat2d, ndat3d)
1314 #elif NETCDF==2
1315  call output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
1316  flag_3d_output, ndat2d, ndat3d)
1317 #else
1318  stop ' sico_init: Parameter NETCDF must be either 1 or 2!'
1319 #endif
1320 
1321 if (time_output(1) <= time_init+eps) then
1322 
1323  flag_3d_output = .true.
1324 
1325 #if NETCDF==1
1326  call output1(runname, time_init, delta_ts, glac_index, z_sl, &
1327  flag_3d_output, ndat2d, ndat3d)
1328 #elif NETCDF==2
1329  call output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
1330  flag_3d_output, ndat2d, ndat3d)
1331 #else
1332  stop ' sico_init: Parameter NETCDF must be either 1 or 2!'
1333 #endif
1334 
1335 end if
1336 
1337 #else
1338  stop ' sico_init: OUTPUT must be either 1, 2 or 3!'
1339 #endif
1340 
1341 call output2(time_init, dxi, deta, delta_ts, glac_index, z_sl)
1342 #if OUTSER==2
1343 call output3(time_init, delta_ts, glac_index, z_sl)
1344 #endif
1345 #if OUTSER==3
1346 call output4(time_init, dxi, deta, delta_ts, glac_index, z_sl)
1347 #endif
1348 
1349 end subroutine sico_init
1350 !
subroutine calc_vz_ssa(z_sl, dxi, deta, dzeta_c)
Computation of the vertical velocity vz in the shallow shelf approximation.
Definition: calc_vz_ssa.F90:35
subroutine calc_vxy_static()
Computation of the horizontal velocity vx, vy, the horizontal volume flux qx, qy etc. for static ice.
subroutine calc_vxy_sia(dzeta_c, dzeta_t)
Computation of the shear stresses txz, tyz, the effective shear stress sigma, the depth-averaged flui...
subroutine, public ice_mat_eqs_pars(RF_table, R_T_val, KAPPA_table, C_table, n_temp_min, n_temp_max, RHO_I_val, RHO_C_val, KAPPA_C_val, C_C_val)
Setting of required physical parameters.
subroutine output2(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data on file in ASCII format.
Definition: output2.F90:35
subroutine phys_para()
Reading of physical parameters.
Definition: phys_para.F90:35
Declarations of kind types for SICOPOLIS.
Definition: sico_types.F90:35
subroutine topography3(dxi, deta, z_sl, anfdatname)
Definition of the initial surface and bedrock topography (including gradients) and of the horizontal ...
Definition: topography3.F90:39
subroutine output3(time, delta_ts, glac_index, z_sl)
Writing of time-series data of the ice thickness field on file in ASCII format.
Definition: output3.F90:38
subroutine topography3_nc(dxi, deta, z_sl, anfdatname)
Definition of the initial surface and bedrock topography (including gradients) and of the horizontal ...
subroutine calc_temp_melt()
Computation of the melting temperatures.
subroutine output_nc(runname, time, delta_ts, glac_index, z_sl, flag_3d_output, ndat2d, ndat3d)
Writing of time-slice files in NetCDF format.
Definition: output_nc.F90:35
subroutine calc_vxy_ssa(z_sl, dxi, deta, dzeta_c, dzeta_t, ii, jj, nn)
Computation of the horizontal velocity vx, vy, the horizontal volume flux qx, qy and the flux across ...
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars.F90:35
subroutine topography2(dxi, deta)
Definition of the initial surface and bedrock topography (including gradients) and of the horizontal ...
Definition: topography2.F90:39
subroutine calc_vz_static()
Computation of the vertical velocity vz for static ice.
subroutine calc_dxyz(dxi, deta, dzeta_c, dzeta_t)
Computation of all components of the strain-rate tensor, the full effective strain rate and the shear...
Definition: calc_dxyz.F90:37
subroutine calc_enhance(time)
Computation of the flow enhancement factor.
subroutine, public calc_c_int_table(c_table, n_tmp_min, n_tmp_max, L_val)
Computation of the temperature integral of the specific heat of ice as a table (c_int_table). Further, definition of the latent heat of ice.
subroutine calc_vxy_b_sia(time, z_sl)
Computation of the basal horizontal velocity vx_b, vy_b in the shallow ice approximation.
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, z_sl, dzsl_dtau, z_mar, ii, jj, nn, ndat2d, ndat3d, n_output, runname)
Initialisations for SICOPOLIS.
Definition: sico_init.F90:35
subroutine boundary(time, dtime, dxi, deta, delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
Computation of the surface temperature (must be less than 0 deg C!) and of the accumulation-ablation ...
Definition: boundary.F90:37
subroutine init_temp_water_age()
Initial temperature, water content and age.
Material quantities of ice: Rate factor, heat conductivity, specific heat (heat capacity).
subroutine output4(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data of the deep ice cores on file in ASCII format.
Definition: output4.F90:35
Declarations of global variables for SICOPOLIS.
subroutine, public calc_c_int_inv_table()
Computation of the inverse of the temperature integral of the specific heat of ice as a table (c_int_...
Conversion from temperature (temp) and water content (omega) to enthalpy (enth) and vice versa...
subroutine calc_vz_sia(dxi, deta, dzeta_c, dzeta_t)
Computation of the vertical velocity vz in the shallow ice approximation.
Definition: calc_vz_sia.F90:35
subroutine output1(runname, time, delta_ts, glac_index, z_sl, flag_3d_output, ndat2d, ndat3d)
Writing of time-slice files in binary format.
Definition: output1.F90:35
real(dp) function, public enth_fct_temp_omega(temp_val, omega_val)
Enthalpy as a function of temperature and water content.