-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCICE_InitMod.F90
303 lines (263 loc) · 9.63 KB
/
CICE_InitMod.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
!=======================================================================
!
!BOP
!
! !MODULE: CICE_InitMod - performs CICE initialization
!
! !DESCRIPTION:
!
! This module contains the CICE initialization routine that sets model
! parameters and initializes the grid and CICE state variables.
!
! !REVISION HISTORY:
! SVN:$Id: CICE_InitMod.F90 138 2008-07-08 20:39:37Z eclare $
!
! authors Elizabeth C. Hunke, LANL
! William H. Lipscomb, LANL
! Philip W. Jones, LANL
!
! 2006: Converted to free form source (F90) by Elizabeth Hunke
! 2008: E. Hunke moved ESMF code to its own driver
!
! !INTERFACE:
!
module CICE_InitMod
!
! !USES:
!
use ice_age
use ice_calendar
use ice_communicate
use ice_diagnostics
use ice_domain
use ice_dyn_evp
use ice_exit
use ice_fileunits
use ice_flux
use ice_forcing
use ice_grid
use ice_history
use ice_restart
use ice_init
use ice_itd
use ice_kinds_mod
use ice_mechred
use ice_meltpond
use ice_ocean
use ice_orbital
use ice_shortwave
use ice_therm_itd
use ice_therm_vertical
use ice_timers
use ice_transport_driver
use ice_transport_remap
use ice_work
#ifdef popcice
use drv_forcing, only: sst_sss
#endif
#ifdef AusCOM
use cpl_parameters
use cpl_forcing_handler
use cpl_interface
#endif
implicit none
private
save
#ifdef AusCOM
integer :: nrec
#endif
! !PUBLIC MEMBER FUNCTIONS:
public :: CICE_Initialize, cice_init
!
!EOP
!
!=======================================================================
contains
!=======================================================================
!BOP
!
! !ROUTINE: CICE_Initialize - initialize CICE model
!
! !DESCRIPTION:
!
! Initialize the basic state, grid and all necessary parameters for
! running the CICE model. Return the initial state in routine
! export state.
! Note: This initialization driver is designed for standalone and
! CCSM-coupled applications. For other
! applications (e.g., standalone CAM), this driver would be
! replaced by a different driver that calls subroutine cice_init,
! where most of the work is done.
!
! !REVISION HISTORY: same as module
!
! !INTERFACE:
!
subroutine CICE_Initialize
!
!EOP
!BOC
!
!--------------------------------------------------------------------
! model initialization
!--------------------------------------------------------------------
call cice_init
!
!EOC
!
end subroutine CICE_Initialize
!=======================================================================
!BOP
!
! !ROUTINE: cice_init - initialize CICE model
!
! !DESCRIPTION:
!
! Initialize CICE model.
!
! !REVISION HISTORY: same as module
!
! !INTERFACE:
!
subroutine cice_init
#ifdef AusCOM
integer(kind=int_kind) :: idate_save
#endif
!
!EOP
!
call init_communicate ! initial setup for message passing
#ifdef AusCOM
call prism_init ! called in init_communicate
MPI_COMM_ICE = il_commlocal
! call init_cpl ! initialize message passing
call get_cpl_timecontrol
#endif
call init_fileunits ! unit numbers
call input_data ! namelist variables
call init_work ! work arrays
call init_domain_blocks ! set up block decomposition
call init_grid1 ! domain distribution
#ifdef AusCOM
! call prism_init ! called in init_communicate
! MPI_COMM_ICE = il_commlocal
call init_cpl ! initialize message passing
! call get_cpl_timecontrol
#endif
call init_ice_timers ! initialize all timers
call ice_timer_start(timer_total) ! start timing entire run
call init_grid2 ! grid variables
call init_transport ! initialize horizontal transport
call init_calendar ! initialize some calendar stuff
call init_hist (dt) ! initialize output history file
call init_evp (dt) ! define evp dynamics parameters, variables
call init_coupler_flux ! initialize fluxes exchanged with coupler
#ifdef popcice
call sst_sss ! POP data for CICE initialization
#endif
call init_thermo_vertical ! initialize vertical thermodynamics
call init_itd ! initialize ice thickness distribution
call calendar(time) ! determine the initial date
#ifdef AusCOM
idate_save = idate !save for late re-set in case 'restart' is used for jobnum=1
if (runtype == 'initial') then
nrec = month - 1 !month is from calendar
if (nrec == 0) nrec = 12
call get_time0_sstsss(trim(inputdir)//'/monthly_sstsss.nc', nrec)
endif
!the read in sst/sss determines the initial ice state (in init_state)
#else
call init_forcing_ocn(dt) ! initialize sss and sst from data
#endif
call init_state ! initialize the ice state
if (runtype == 'continue') then ! start from core restart file
call restartfile() ! given by pointer in ice_in
else if (restart) then ! ice_ic = core restart file
call restartfile (ice_ic) ! or 'default' or 'none'
endif
if (jobnum == 1 ) then
time = 0.0 !NOTE, the first job must be set back to 0 and
idate = idate_save !idate back to the 'initial' value, in any case
endif
! tracers
if (tr_iage) call init_age ! ice age tracer
if (tr_pond) call init_meltponds ! melt ponds
call init_diags ! initialize diagnostic output points
call init_history_therm ! initialize thermo history variables
call init_history_dyn ! initialize dynamic history variables
! Initialize shortwave components using swdn from previous timestep
! if restarting. These components will be scaled to current forcing
! in prep_radiation.
if (runtype == 'continue' .or. restart) &
call init_shortwave ! initialize radiative transfer
istep = istep + 1 ! update time step counters
istep1 = istep1 + 1
time = time + dt ! determine the time and date
#ifndef AusCOM
call calendar(time) ! at the end of the first timestep
#else
call calendar(time-runtime0)
print *, 'CICE4 (cice_init): time, runtime0, idate = ',&
time, runtime0, idate
#endif
!--------------------------------------------------------------------
! coupler communication or forcing data initialization
!--------------------------------------------------------------------
call init_forcing_atmo ! initialize atmospheric forcing (standalone)
#ifndef coupled
call get_forcing_atmo ! atmospheric forcing from data
call get_forcing_ocn(dt) ! ocean forcing from data
#endif
if (runtype == 'initial' .and. .not. restart) &
call init_shortwave ! initialize radiative transfer using current swdn
!20091020"!"
!#ifndef AusCOM
call init_flux_atm ! initialize atmosphere fluxes sent to coupler
call init_flux_ocn ! initialize ocean fluxes sent to coupler
!#endif
!dhb599 20111128: this call is moved here from 'downstair', because it *re-initilaise*
! the o2i fileds read in from o2i.nc (e.g., sst=>-1.84 sss=>34.) !!!
call ice_write_hist(dt) ! write initial conditions if write_ic = T
#ifdef AusCOM
write(il_out,*)' calling init_mocn_fields_4_i2a at time_sec = ',0
!call initialize_mice_fields_4_i2a
call initialize_mocn_fields_4_i2a
! for continue runs, need restart o2i forcing fields and time-averaged ice
! variables ('mice')saved at the end of last run from ice models;
! for initial run, pre-processed o2i (and maybe mice) fields are required.
! call get_restart_o2i('o2i.nc')
call get_restart_o2i('o2i.nc')
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!if no lag for ice to atm coupling, then cice has to read restart file i2a.nc and
!put the data to atm. the call is not needed if there is lag for ice2atm coupling
!must call after get_restart_o2i(), by which the ocn_sst ect are read in and re-used by put_restart_i2a()
! call put_restart_i2a('i2a.nc', 0)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (runtype == 'continue') then
if ( file_exist(trim(inputdir)//'/mice.nc') ) then
! for continue runs, mice data MUST be available.
call get_restart_mice(trim(inputdir)//'/mice.nc')
else
write(6,*) 'CICE ERROR: mice.nc not found at:', &
trim(inputdir)//'/mice.nc'
call abort_ice ('Cannot find mice.nc in input dir.')
endif
endif
if (use_core_runoff) then
call get_core_runoff(trim(inputdir)//'/core_runoff_regrid.nc',&
'runoff',1)
endif
write(il_out,*)' calling ave_ocn_fields_4_i2a at time_sec = ',0 !time_sec
call time_average_ocn_fields_4_i2a !accumulate/average ocn fields needed for IA coupling
!get a2i fields and then set up initial SBC for ice
!call from_atm(0)
!call get_sbc_ice
!now "most of" the IC of this run are 'proper' for "call ice_write_hist"
#endif
!dhb599: 20111128: the following call is moved 'upstair':-----------------------
! call ice_write_hist(dt) ! write initial conditions if write_ic = T
!-------------------------------------------------------------------------------
end subroutine cice_init
!=======================================================================
end module CICE_InitMod
!=======================================================================