7 !! Initialisations for SICOPOLIS.
11 !! Copyright 2009-2013 Ralf Greve
15 !! This file is part of SICOPOLIS.
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.
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.
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/>.
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 !> Initialisations for SICOPOLIS.
34 !<------------------------------------------------------------------------------
36 sum_accum, mean_accum, mean_accum_inv, &
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, &
42 ndat2d, ndat3d, n_output, &
49 integer(i4b) :: i, j, kc, kt, kr, m, n, ir, jr
50 integer(i4b) :: ios, ios1, ios2, ios3, ios4
51 integer(i4b) :: ndat2d, ndat3d
52 integer(i4b) :: n_output
54 integer(i4b) :: ii((imax+1)*(jmax+1)), jj((imax+1)*(jmax+1)), nn(0:jmax,0:imax)
55 real(dp) :: delta_ts, glac_index
56 real(dp) :: sum_accum, mean_accum, mean_accum_inv
57 real(dp) :: dtime0, dtime_temp0, dtime_wss0, dtime_out0, dtime_ser0
58 real(dp) :: dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser
59 real(dp) :: time_init0, time_end0, time_output0(100)
60 real(dp) :: time, time_init, time_end, time_output(100)
61 real(dp) :: dxi, deta, dzeta_c, dzeta_t, dzeta_r
62 real(dp) :: z_sl, dzsl_dtau, z_mar
64 character (len=100) :: runname, anfdatname
65 character (len=256) :: shell_command
67 logical :: flag_3d_output
72 #if (CALCZS==4 || MARGIN==3)
75 call lis_initialize(ierr)
85 x_hat = x_hat *1.0e+03_dp
86 y_hat = y_hat *1.0e+03_dp
87 b_max = b_max /year_sec
88 s_b = s_b *1.0e-03_dp/year_sec
93 if ( trim(version) /= trim(sico_version) ) &
94 stop
' sico_init: SICOPOLIS version not compatible with header file!'
101 if (abs(dx-25.0_dp).lt.eps)
then
103 if ((imax /= 60).or.(jmax /= 60))
then
104 stop
' sico_init: IMAX and/or JMAX wrong!'
107 else if (abs(dx-75.0_dp).lt.eps)
then
109 if ((imax /= 20).or.(jmax /= 20))
then
110 stop
' sico_init: IMAX and/or JMAX wrong!'
114 stop
' sico_init: DX wrong!'
119 stop
' sico_init: GRID==1 not allowed for this application!'
123 stop
' sico_init: GRID==2 not allowed for this application!'
131 stop
' sico_init: Option ADV_HOR==1 (central differences) not defined!'
134 #if ((ADV_HOR == 3) && (ADV_VERT != 3))
135 stop
' sico_init: Options ADV_HOR==3 and ADV_VERT==3 must be used together!'
138 #if ((ADV_HOR != 3) && (ADV_VERT == 3))
139 stop
' sico_init: Options ADV_HOR==3 and ADV_VERT==3 must be used together!'
149 dtime_temp0 = dtime_temp0
153 dzeta_c = 1.0_dp/
real(kcmax,dp)
154 dzeta_t = 1.0_dp/
real(ktmax,dp)
155 dzeta_r = 1.0_dp/
real(krmax,dp)
168 if ((i.le.imax).and.(j.le.jmax))
then
180 anfdatname = anfdatname
182 #if defined(YEAR_ZERO)
183 year_zero = year_zero
185 year_zero = 2000.0_dp
188 time_init0 = time_init0
189 time_end0 = time_end0
190 dtime_ser0 = dtime_ser0
192 #if ( OUTPUT==1 || OUTPUT==3 )
193 dtime_out0 = dtime_out0
196 #if ( OUTPUT==2 || OUTPUT==3 )
198 time_output0( 1) = time_out0_01
199 time_output0( 2) = time_out0_02
200 time_output0( 3) = time_out0_03
201 time_output0( 4) = time_out0_04
202 time_output0( 5) = time_out0_05
203 time_output0( 6) = time_out0_06
204 time_output0( 7) = time_out0_07
205 time_output0( 8) = time_out0_08
206 time_output0( 9) = time_out0_09
207 time_output0(10) = time_out0_10
208 time_output0(11) = time_out0_11
209 time_output0(12) = time_out0_12
210 time_output0(13) = time_out0_13
211 time_output0(14) = time_out0_14
212 time_output0(15) = time_out0_15
213 time_output0(16) = time_out0_16
214 time_output0(17) = time_out0_17
215 time_output0(18) = time_out0_18
216 time_output0(19) = time_out0_19
217 time_output0(20) = time_out0_20
222 shell_command =
'if [ ! -d'
223 shell_command = trim(shell_command)//
' '//outpath
224 shell_command = trim(shell_command)//
' '//
'] ; then mkdir'
225 shell_command = trim(shell_command)//
' '//outpath
226 shell_command = trim(shell_command)//
' '//
'; fi'
227 call system(trim(shell_command))
230 open(10, iostat=ios, &
231 file=outpath//
'/'//trim(runname)//
'.log', &
234 stop
' sico_init: Error when opening the log file!'
236 write(10,1000)
'Computational domain:'
238 write(10,1000)
'Antarctica'
240 write(10,1000)
'Greenland'
242 write(10,1000)
'Scandinavia and Eurasia'
244 write(10,1000)
'Northern hemisphere'
245 #elif defined(EMTP2SGE)
246 write(10,1000)
'EISMINT Phase 2 Simplified Geometry Experiment'
248 write(10,1000)
'North polar cap of Mars'
250 write(10,1000)
'South polar cap of Mars'
252 stop
' sico_init: No valid domain specified!'
256 write(10,1001)
'imax =', imax
257 write(10,1001)
'jmax =', jmax
258 write(10,1001)
'kcmax =', kcmax
259 write(10,1001)
'ktmax =', ktmax
260 write(10,1001)
'krmax =', krmax
263 write(10,1002)
'a =', deform
266 #if (GRID==0 || GRID==1)
267 write(10,1002)
'x0 =', x0
268 write(10,1002)
'y0 =', y0
269 write(10,1002)
'dx =', dx
271 write(10,1002)
'dlambda =', dlambda
272 write(10,1002)
'dphi =', dphi
276 write(10,1002)
'year_zero =', year_zero
277 write(10,1002)
'time_init =', time_init0
278 write(10,1002)
'time_end =', time_end0
279 write(10,1002)
'dtime =', dtime0
280 write(10,1002)
'dtime_temp =', dtime_temp0
281 #if ( OUTPUT==1 || OUTPUT==3 )
282 write(10,1002)
'dtime_out =', dtime_out0
284 write(10,1002)
'dtime_ser =', dtime_ser0
287 write(10,1000)
'Physical-parameter file = '//phys_para_file
290 #if (CALCZS==3 || CALCZS==4)
291 write(10,1002)
'ovi_weight =', ovi_weight
293 write(10,1002)
'omega_sor =', omega_sor
298 write(10,1002)
'temp_min =', temp_min
299 write(10,1002)
's_t =', s_t
300 write(10,1002)
'x_hat =', x_hat
301 write(10,1002)
'y_hat =', y_hat
302 write(10,1002)
'b_max =', b_max
303 write(10,1002)
's_b =', s_b
304 write(10,1002)
'eld =', eld
308 write(10,1002)
'delta_ts0 =', delta_ts0
310 write(10,1002)
'sine_amplit =', sine_amplit
311 write(10,1002)
'sine_period =', sine_period
313 write(10,1000)
'GRIP file = '//grip_temp_file
314 write(10,1002)
'grip_temp_fact =', grip_temp_fact
318 write(10,1002)
'z_sl0 =', z_sl0
320 write(10,1000)
'sea-level file = '//sea_level_file
325 #if ( MARINE_ICE_CALVING==2 || MARINE_ICE_CALVING==3 )
326 write(10,1002)
'z_mar =', z_mar
328 #elif ( MARINE_ICE_CALVING==4 || MARINE_ICE_CALVING==5 \
329 || marine_ice_calving==6 || marine_ice_calving==7 )
330 write(10,1002)
'fact_z_mar =', fact_z_mar
332 #elif ( ( MARINE_ICE_FORMATION==2 ) && ( MARINE_ICE_CALVING==9 ) )
333 write(10,1002)
'calv_uw_coeff =', calv_uw_coeff
334 write(10,1002)
'r1_calv_uw =', r1_calv_uw
335 write(10,1002)
'r2_calv_uw =', r2_calv_uw
339 #if ICE_SHELF_CALVING==2
340 write(10,1002)
'H_calv =', h_calv
345 write(10,1002)
'c_slide =', c_slide
346 write(10,1002)
'gamma_slide =', gamma_slide
347 write(10,1001)
'p_weert =', p_weert
348 write(10,1001)
'q_weert =', q_weert
350 write(10,1002)
'red_pres_limit_fact =', red_pres_limit_fact
355 write(10,1002)
'q_geo =', q_geo
360 write(10,1002)
'frac_llra =', frac_llra
365 write(10,1002)
'gr_size =', gr_size
369 write(10,1002)
'sigma_res =', sigma_res
373 write(10,1001)
'ENHMOD =', enhmod
374 write(10,1002)
'enh_fact =', enh_fact
375 #if ( ENHMOD==2 || ENHMOD==3 )
376 write(10,1002)
'enh_intg =', enh_intg
379 write(10,1002)
'age_trans =', age_trans_0
382 write(10,1002)
'date_trans1 =', date_trans1_0
383 write(10,1002)
'date_trans2 =', date_trans2_0
384 write(10,1002)
'date_trans3 =', date_trans3_0
387 write(10,1002)
'enh_shelf =', enh_shelf
391 write(10,1002)
'numdiff_H_t =', numdiff_h_t
392 write(10,1002)
'tau_cts =', tau_cts
393 write(10,1002)
'H_min =', h_min
394 write(10,1002)
'vh_max =', vh_max
395 write(10,1002)
'hd_min =', hd_min
396 write(10,1002)
'hd_max =', hd_max
398 write(10,1002)
'qbm_min =', qbm_min
399 #elif defined(QB_MIN) /* obsolete */
400 write(10,1002)
'qb_min =', qb_min
403 write(10,1002)
'qbm_max =', qbm_max
404 #elif defined(QB_MAX) /* obsolete */
405 write(10,1002)
'qb_max =', qb_max
407 write(10,1002)
'age_min =', age_min
408 write(10,1002)
'age_max =', age_max
409 write(10,1002)
'mean_accum =', mean_accum
411 write(10,1002)
'age_diff =', agediff
412 write(10,1002)
'm_age =', m_age
416 write(10,1001)
'GRID =', grid
417 write(10,1001)
'CALCMOD =', calcmod
418 write(10,1001)
'FLOW_LAW =', flow_law
419 write(10,1001)
'FIN_VISC =', fin_visc
420 write(10,1001)
'MARGIN =', margin
422 write(10,1001)
'MARINE_ICE_FORMATION =', marine_ice_formation
423 write(10,1001)
'MARINE_ICE_CALVING =', marine_ice_calving
425 write(10,1001)
'ICE_SHELF_CALVING =', ice_shelf_calving
427 write(10,1001)
'ANF_DAT =', anf_dat
428 write(10,1001)
'REBOUND =', rebound
429 write(10,1001)
'Q_LITHO =', q_litho
430 write(10,1001)
'ZS_EVOL =', zs_evol
431 write(10,1001)
'CALCZS =', calczs
432 write(10,1001)
'ADV_HOR =', adv_hor
433 write(10,1001)
'ADV_VERT =', adv_vert
434 write(10,1001)
'TOPOGRAD =', topograd
435 write(10,1001)
'TSURFACE =', tsurface
436 write(10,1001)
'SEA_LEVEL =', sea_level
437 write(10,1001)
'SLIDE_LAW =', slide_law
438 write(10,1001)
'Q_GEO_MOD =', q_geo_mod
441 #if defined(OUT_TIMES)
442 write(10,1001)
'OUT_TIMES =', out_times
444 write(10,1001)
'OUTPUT =', output
445 write(10,1001)
'OUTSER =', outser
446 #if defined(OUTSER_V_A)
447 write(10,1001)
'OUTSER_V_A =', outser_v_a
449 #if ( OUTPUT==1 || OUTPUT==2 )
450 write(10,1001)
'ERGDAT =', ergdat
452 write(10,1001)
'NETCDF =', netcdf
454 #if ( OUTPUT==2 || OUTPUT==3 )
455 write(10,1001)
'n_output =', n_output
457 write(10,1002)
'time_output =', time_output0(n)
462 write(10,1000)
'Program version and date: '//version//
' / '//date
466 1002 format(a,es12.4)
468 close(10, status=
'keep')
472 year_zero = year_zero*year_sec
473 time_init = time_init0*year_sec
474 time_end = time_end0*year_sec
475 dtime = dtime0*year_sec
476 dtime_temp = dtime_temp0*year_sec
477 dtime_ser = dtime_ser0*year_sec
478 #if ( OUTPUT==1 || OUTPUT==3 )
479 dtime_out = dtime_out0*year_sec
481 #if ( OUTPUT==2 || OUTPUT==3 )
483 time_output(n) = time_output0(n)*year_sec
487 if (abs(dtime_temp/dtime-nint(dtime_temp/dtime)).gt.eps) &
488 stop
' sico_init: dtime_temp must be a multiple of dtime!'
492 mean_accum = mean_accum*(1.0e-03_dp/year_sec)*(rho_w/rho)
495 mean_accum_inv = 1.0_dp/mean_accum
502 maske_help(jmax,:) = 2
505 maske_help(:,imax) = 2
511 open(21, iostat=ios, &
512 file=inpath//
'/general/'//grip_temp_file, &
515 stop
' sico_init: Error when opening the data file for delta_ts!'
517 read(21,*) ch_dummy, grip_time_min, grip_time_stp, grip_time_max
519 if (ch_dummy /=
'#')
then
520 write(6,*)
' sico_init: grip_time_min, grip_time_stp, grip_time_max'
521 write(6,*)
' not defined in data file for delta_ts!'
525 ndata_grip = (grip_time_max-grip_time_min)/grip_time_stp
527 allocate(griptemp(0:ndata_grip))
530 read(21,*) d_dummy, griptemp(n)
533 close(21, status=
'keep')
541 open(21, iostat=ios, &
542 file=inpath//
'/general/'//sea_level_file, &
545 stop
' sico_init: Error when opening the data file for z_sl!'
547 read(21,*) ch_dummy, specmap_time_min, specmap_time_stp, specmap_time_max
549 if (ch_dummy /=
'#')
then
550 write(6,*)
' sico_init: specmap_time_min, specmap_time_stp, specmap_time_max'
551 write(6,*)
' not defined in data file for z_sl!'
555 ndata_specmap = (specmap_time_max-specmap_time_min)/specmap_time_stp
557 allocate(specmap_zsl(0:ndata_specmap))
559 do n=0, ndata_specmap
560 read(21,*) d_dummy, specmap_zsl(n)
563 close(21, status=
'keep')
575 q_geo(j,i) = q_geo *1.0e-03_dp
581 stop
' sico_init: Option Q_GEO_MOD==2 not available for this application!'
591 stop
' sico_init: ANF_DAT==1 not allowed for this application!'
601 call
boundary(time_init, dtime, dxi, deta, &
602 delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
609 q_b_tot(j,i) = 0.0_dp
615 temp_c(kc,j,i) = temp_s(j,i)
616 age_c(kc,j,i) = 15000.0_dp*year_sec
620 omega_t(kt,j,i) = 0.0_dp
621 age_t(kt,j,i) = 15000.0_dp*year_sec
625 temp_r(kr,j,i) = temp_s(j,i)+q_geo(j,i)*h_r/kappa_r &
626 *(1.0_dp-
real(kr,dp)/
real(krmax,dp))
645 stop
' sico_init: Parameter NETCDF must be either 1 or 2!'
648 call
boundary(time_init, dtime, dxi, deta, &
649 delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
651 q_b_tot = q_bm + q_tld
659 #if (GRID==0 || GRID==1)
663 dist_dxdy(jr,ir) = sqrt( (
real(ir,dp)*dxi)**2 + (
real(jr,dp)*deta)**2 )
675 zeta_c(kc) = kc*dzeta_c
676 eaz_c(kc) = exp(deform*zeta_c(kc))
677 eaz_c_quotient(kc) = (eaz_c(kc)-1.0_dp)/(ea-1.0_dp)
681 zeta_t(kt) = kt*dzeta_t
705 open(12, iostat=ios, &
706 file=outpath//
'/'//trim(runname)//
'.ser', &
709 stop
' sico_init: Error when opening the ser file!'
714 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
716 1102 format(
' t(a) D_Ts(deg C) z_sl(m)',/, &
717 ' H_max(m) zs_max(m) V_g(m^3)', &
718 ' V_t(m^3) V_fw(m^3/a) V_sle(m)',/, &
719 ' A_g(m^2) A_t(m^2) V_bm(m^3/a)', &
720 ' V_tld(m^3/a) H_t_max(m) vs_max(m/a)')
721 1103 format(
'----------------------------------------------------', &
722 '---------------------------------------')
726 1102 format(
' t(a) D_Ts(deg C) z_sl(m)',/, &
727 ' V(m^3) V_g(m^3) V_f(m^3)', &
728 ' A(m^2) A_g(m^2) A_f(m^2)',/, &
729 ' H_max(m) zs_max(m)', &
730 ' V_t(m^3) V_fw(m^3/a) V_sle(m)',/, &
731 ' A_t(m^2) V_bm(m^3/a)', &
732 ' V_tld(m^3/a) H_t_max(m) vs_max(m/a)')
733 1103 format(
'----------------------------------------------------', &
734 '---------------------------------------')
737 stop
' sico_init: OUTSER_V_A must be either 1 or 2!'
744 open(13, iostat=ios, &
745 file=outpath//
'/'//trim(runname)//
'.thk', &
747 if (ios /= 0) stop
' sico_init: Error when opening the thk file!'
752 1104 format(
' t(a) D_Ts(deg C) z_sl(m)',/, &
753 ' H(m): JMAX+1 records [j = JMAX (-1) 0] with',/, &
754 ' IMAX+1 values [i = 0 (1) IMAX] in each record')
755 1105 format(
'----------------------------------------------------')
765 allocate(lambda_core(n_core), phi_core(n_core), &
766 x_core(n_core), y_core(n_core))
768 lambda_core(1) = 0.0_dp
770 x_core(1) = 750.0_dp *1.0e+03_dp
771 y_core(1) = 750.0_dp *1.0e+03_dp
774 lambda_core(2) = 0.0_dp
776 x_core(2) = 750.0_dp *1.0e+03_dp
777 y_core(2) = 1125.0_dp *1.0e+03_dp
780 open(14, iostat=ios, &
781 file=outpath//
'/'//trim(runname)//
'.core', &
783 if (ios /= 0) stop
' sico_init: Error when opening the core file!'
785 if (forcing_flag == 1)
then
790 1106 format(
' t(a) D_Ts(C) z_sl(m)',/, &
791 ' H_P1(m) H_P2(m)',/, &
792 ' v_P1(m/a) v_P2(m/a)',/, &
793 ' T_P1(C) T_P2(C)',/, &
794 ' Rb_P1(W/m2) Rb_P2(W/m2)')
795 1107 format(
'---------------------------------------')
806 flag_3d_output = .false.
808 flag_3d_output = .true.
810 stop
' sico_init: ERGDAT must be either 0 or 1!'
814 call
output1(runname, time_init, delta_ts, glac_index, z_sl, &
815 flag_3d_output, ndat2d, ndat3d)
817 call
output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
818 flag_3d_output, ndat2d, ndat3d)
820 stop
' sico_init: Parameter NETCDF must be either 1 or 2!'
825 if (time_output(1) <= time_init+eps)
then
828 flag_3d_output = .false.
830 flag_3d_output = .true.
832 stop
' sico_init: ERGDAT must be either 0 or 1!'
836 call
output1(runname, time_init, delta_ts, glac_index, z_sl, &
837 flag_3d_output, ndat2d, ndat3d)
839 call
output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
840 flag_3d_output, ndat2d, ndat3d)
842 stop
' sico_init: Parameter NETCDF must be either 1 or 2!'
849 flag_3d_output = .false.
852 call
output1(runname, time_init, delta_ts, glac_index, z_sl, &
853 flag_3d_output, ndat2d, ndat3d)
855 call
output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
856 flag_3d_output, ndat2d, ndat3d)
858 stop
' sico_init: Parameter NETCDF must be either 1 or 2!'
861 if (time_output(1) <= time_init+eps)
then
863 flag_3d_output = .true.
866 call
output1(runname, time_init, delta_ts, glac_index, z_sl, &
867 flag_3d_output, ndat2d, ndat3d)
869 call
output_nc(runname, time_init, delta_ts, glac_index, z_sl, &
870 flag_3d_output, ndat2d, ndat3d)
872 stop
' sico_init: Parameter NETCDF must be either 1 or 2!'
878 stop
' sico_init: OUTPUT must be either 1, 2 or 3!'
881 call
output2(time_init, dxi, deta, delta_ts, glac_index, z_sl)
883 call
output3(time_init, delta_ts, glac_index, z_sl)
886 call
output4(time_init, dxi, deta, delta_ts, glac_index, z_sl)