00001
00002 program ccsm_driver
00003
00004 #define NEW_BUDGET
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 use shr_kind_mod, only: r8 => SHR_KIND_R8
00027 use shr_kind_mod, only: cs => SHR_KIND_CS
00028 use shr_kind_mod, only: cl => SHR_KIND_CL
00029 use shr_sys_mod, only: shr_sys_abort, shr_sys_flush
00030 use shr_const_mod, only: shr_const_cday
00031 use shr_file_mod, only: shr_file_setLogLevel, shr_file_setLogUnit
00032 use shr_file_mod, only: shr_file_setIO, shr_file_getUnit
00033 use shr_scam_mod, only: shr_scam_checkSurface
00034 use shr_map_mod, only: shr_map_setDopole
00035 use shr_mpi_mod, only: shr_mpi_min, shr_mpi_max
00036 use shr_mem_mod, only: shr_mem_init, shr_mem_getusage
00037 use mct_mod
00038 use perf_mod
00039 use ESMF_Mod
00040
00041
00042
00043
00044 use atm_comp_mct, only: atm_init_mct, atm_run_mct, atm_final_mct
00045 use lnd_comp_mct, only: lnd_init_mct, lnd_run_mct, lnd_final_mct
00046 use ocn_comp_mct, only: ocn_init_mct, ocn_run_mct, ocn_final_mct
00047 use ice_comp_mct, only: ice_init_mct, ice_run_mct, ice_final_mct
00048 use glc_comp_mct, only: glc_init_mct, glc_run_mct, glc_final_mct
00049 #ifdef ESMF_INTERFACE
00050 use atm_comp_mct, only: atm_register
00051 use lnd_comp_mct, only: lnd_register
00052 use ocn_comp_mct, only: ocn_register
00053 use ice_comp_mct, only: ice_register
00054 use glc_comp_mct, only: glc_register
00055 #endif
00056
00057
00058
00059
00060
00061
00062 use seq_avdata_mod
00063 use seq_diag_mct
00064
00065
00066 use seq_flds_indices
00067 use seq_comm_mct
00068 use seq_timemgr_mod
00069 use seq_infodata_mod
00070 use seq_cdata_mod
00071 use seq_domain_mct
00072 use seq_flux_mct
00073 use seq_frac_mct
00074 use seq_rest_mod
00075 use seq_hist_mod
00076 use seq_io_mod
00077
00078
00079 use mrg_x2a_mct
00080 use mrg_x2l_mct
00081 use mrg_x2o_mct
00082 use mrg_x2i_mct
00083 use mrg_x2g_mct
00084 use mrg_x2s_mct
00085
00086
00087 use map_atmlnd_mct
00088 use map_atmice_mct
00089 use map_atmocn_mct
00090 use map_iceocn_mct
00091 use map_rofocn_mct
00092 use map_snoglc_mct
00093 use map_ocnocn_mct
00094 use map_iceice_mct
00095 use map_lndlnd_mct
00096 use map_rofrof_mct
00097 use map_atmatm_mct
00098 use map_glcglc_mct
00099 use map_snosno_mct
00100
00101 implicit none
00102
00103 #include <mpif.h>
00104
00105
00106
00107
00108
00109
00110 type(mct_gsMap) :: gsMap_aa
00111 type(mct_gsMap) :: gsMap_ll
00112 type(mct_gsMap) :: gsMap_oo
00113 type(mct_gsMap) :: gsMap_ii
00114 type(mct_gsMap) :: gsMap_rr
00115 type(mct_gsMap) :: gsMap_gg
00116 type(mct_gsMap) :: gsMap_ss
00117
00118 type(mct_gsMap) :: gsMap_ax
00119 type(mct_gsMap) :: gsMap_lx
00120 type(mct_gsMap) :: gsMap_ox
00121 type(mct_gsMap) :: gsMap_ix
00122 type(mct_gsMap) :: gsMap_rx
00123 type(mct_gsMap) :: gsMap_gx
00124 type(mct_gsMap) :: gsMap_sx
00125
00126
00127 real(r8),pointer :: drv2mdl_aa(:), mdl2drv_aa(:)
00128 real(r8),pointer :: drv2mdl_ll(:), mdl2drv_ll(:)
00129 real(r8),pointer :: drv2mdl_ii(:), mdl2drv_ii(:)
00130 real(r8),pointer :: drv2mdl_oo(:), mdl2drv_oo(:)
00131 real(r8),pointer :: drv2mdl_rr(:), mdl2drv_rr(:)
00132 real(r8),pointer :: drv2mdl_gg(:), mdl2drv_gg(:)
00133 real(r8),pointer :: drv2mdl_ss(:), mdl2drv_ss(:)
00134
00135
00136 integer :: atm_nx, atm_ny
00137 integer :: lnd_nx, lnd_ny
00138 integer :: ice_nx, ice_ny
00139 integer :: ocn_nx, ocn_ny
00140 integer :: rof_nx, rof_ny
00141 integer :: glc_nx, glc_ny
00142 integer :: sno_nx, sno_ny
00143
00144
00145
00146
00147
00148 type (seq_timemgr_type) :: seq_SyncClock
00149 type (ESMF_Clock) :: EClock_d
00150 type (ESMF_Clock) :: EClock_a
00151 type (ESMF_Clock) :: EClock_l
00152 type (ESMF_Clock) :: EClock_o
00153 type (ESMF_Clock) :: EClock_i
00154 type (ESMF_Clock) :: EClock_g
00155
00156 logical :: restart_alarm
00157 logical :: history_alarm
00158 logical :: histavg_alarm
00159 logical :: stop_alarm
00160 logical :: atmrun_alarm
00161 logical :: lndrun_alarm
00162 logical :: icerun_alarm
00163 logical :: ocnrun_alarm
00164 logical :: ocnnext_alarm
00165 logical :: glcrun_alarm
00166 logical :: tprof_alarm
00167 logical :: t1hr_alarm
00168 logical :: t2hr_alarm
00169 logical :: t3hr_alarm
00170 logical :: t6hr_alarm
00171 logical :: t12hr_alarm
00172 logical :: t24hr_alarm
00173
00174 real(r8) :: days_per_year = 365.0
00175
00176 integer :: dtime
00177 integer :: ncpl
00178 integer :: ymd
00179 integer :: tod
00180
00181
00182 character( 8) :: dstr
00183 character(10) :: tstr
00184 integer :: begStep, endStep
00185 real(r8) :: simDays
00186 real(r8) :: SYPD
00187 real(r8) :: Time_begin
00188 real(r8) :: Time_end
00189 real(r8) :: Time_bstep
00190 real(r8) :: Time_estep
00191 real(r8) :: dtstep
00192 real(r8) :: dtstep_acc
00193 integer :: dtstep_cnt
00194 character(CL) :: timing_file
00195 character(CL) :: timing_dir
00196 character(CL) :: tchkpt_dir
00197
00198
00199
00200
00201
00202 logical :: atm_present
00203 logical :: lnd_present
00204 logical :: ice_present
00205 logical :: ocn_present
00206 logical :: rof_present
00207 logical :: glc_present
00208 logical :: sno_present
00209
00210 logical :: atm_prognostic
00211 logical :: lnd_prognostic
00212 logical :: ice_prognostic
00213 logical :: ocn_prognostic
00214 logical :: ocnrof_prognostic
00215 logical :: glc_prognostic
00216 logical :: sno_prognostic
00217
00218 logical :: dead_comps
00219
00220 logical :: single_column
00221 real(r8) :: scmlon
00222 real(r8) :: scmlat
00223 logical :: aqua_planet
00224 real(r8) :: nextsw_cday
00225 logical :: atm_aero
00226
00227 logical :: ocean_tight_coupling
00228 logical :: skip_ocean_run
00229 logical :: cpl2ocn_first
00230 character(CS) :: aoflux_grid
00231
00232 logical :: read_restart
00233 character(CL) :: rest_file
00234
00235 logical :: domain_check
00236 logical :: shr_map_dopole
00237
00238
00239 logical :: do_budgets
00240 logical :: do_histinit
00241 logical :: do_histavg
00242 logical :: do_hist_r2x
00243 logical :: do_hist_l2x
00244 logical :: do_hist_a2x24hr
00245 logical :: do_hist_a2x
00246 logical :: do_hist_a2x3hrp
00247 logical :: do_hist_a2x3hr
00248
00249
00250 character(CL) :: hist_a2x_flds = 'Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf'
00251
00252 character(CL) :: hist_a2x3hrp_flds = 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl'
00253 character(CL) :: hist_a2x3hr_flds = 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_dens:Sa_pbot:Sa_pslv:Faxa_lwdn'
00254 integer :: budget_inst
00255 integer :: budget_daily
00256 integer :: budget_month
00257 integer :: budget_ann
00258 integer :: budget_ltann
00259 integer :: budget_ltend
00260
00261
00262 integer :: k1,k2,k3
00263 integer :: ocnrun_count
00264 logical :: exists
00265 integer :: ierr
00266 integer :: rc
00267 logical :: cdf64
00268
00269 character(*), parameter :: NLFileName = "drv_in"
00270
00271 integer :: info_debug = 0
00272
00273
00274
00275
00276 real(r8) :: msize,msize0,msize1
00277 real(r8) :: mrss ,mrss0 ,mrss1
00278
00279
00280
00281
00282 integer :: nthreads_GLOID
00283 integer :: nthreads_CPLID
00284 integer :: nthreads_ATMID
00285 integer :: nthreads_LNDID
00286 integer :: nthreads_ICEID
00287 integer :: nthreads_OCNID
00288 integer :: nthreads_GLCID
00289
00290 integer :: pethreads_GLOID
00291
00292 integer :: nthreads_CPLATMID
00293 integer :: nthreads_CPLLNDID
00294 integer :: nthreads_CPLICEID
00295 integer :: nthreads_CPLOCNID
00296 integer :: nthreads_CPLGLCID
00297
00298 logical :: drv_threading
00299
00300
00301
00302
00303 integer :: mpicom_GLOID
00304 integer :: mpicom_CPLID
00305 integer :: mpicom_ATMID
00306 integer :: mpicom_LNDID
00307 integer :: mpicom_ICEID
00308 integer :: mpicom_OCNID
00309 integer :: mpicom_GLCID
00310
00311 integer :: mpicom_CPLATMID
00312 integer :: mpicom_CPLLNDID
00313 integer :: mpicom_CPLICEID
00314 integer :: mpicom_CPLOCNID
00315 integer :: mpicom_CPLGLCID
00316
00317 logical :: iamroot_GLOID
00318 logical :: iamroot_CPLID
00319 logical :: iamroot_ATMID
00320 logical :: iamroot_LNDID
00321 logical :: iamroot_ICEID
00322 logical :: iamroot_OCNID
00323 logical :: iamroot_GLCID
00324
00325 logical :: iamin_CPLID
00326 logical :: iamin_ATMID
00327 logical :: iamin_LNDID
00328 logical :: iamin_ICEID
00329 logical :: iamin_OCNID
00330 logical :: iamin_GLCID
00331
00332 logical :: iamin_CPLATMID
00333 logical :: iamin_CPLLNDID
00334 logical :: iamin_CPLICEID
00335 logical :: iamin_CPLOCNID
00336 logical :: iamin_CPLGLCID
00337
00338 character(CL) :: complist
00339 integer :: iam_GLOID
00340 integer, pointer :: atm_petlist(:), lnd_petlist(:), ice_petlist(:), ocn_petlist(:), glc_petlist(:)
00341
00342
00343
00344
00345 character(*), parameter :: subname = '(seq_mct_drv)'
00346 character(*), parameter :: F00 = "('"//subname//" : ', 4A )"
00347 character(*), parameter :: F0L = "('"//subname//" : ', A, L6 )"
00348 character(*), parameter :: F0I = "('"//subname//" : ', A, 2i8 )"
00349 character(*), parameter :: F0R = "('"//subname//" : ', A, 2g23.15 )"
00350 character(*), parameter :: FormatA = '(A,": =============== ", A41, " ===============")'
00351 character(*), parameter :: FormatD = '(A,": =============== ", A20,2I8,5x, " ===============")'
00352 character(*), parameter :: FormatR = '(A,": =============== ", A31,F9.3,1x, " ===============")'
00353 character(*), parameter :: FormatQ = '(A,": =============== ", A20,2F10.2,1x," ===============")'
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 call seq_comm_init(NLFileName, atm_petlist=atm_petlist, lnd_petlist=lnd_petlist, &
00364 ice_petlist=ice_petlist, ocn_petlist=ocn_petlist, glc_petlist=glc_petlist)
00365
00366
00367 call seq_comm_setptrs(GLOID,pethreads=pethreads_GLOID,iam=iam_GLOID)
00368 call seq_comm_setnthreads(pethreads_GLOID)
00369
00370
00371 call seq_comm_setptrs(GLOID,mpicom=mpicom_GLOID,iamroot=iamroot_GLOID,nthreads=nthreads_GLOID)
00372 call seq_comm_setptrs(CPLID,mpicom=mpicom_CPLID,iamroot=iamroot_CPLID,nthreads=nthreads_CPLID)
00373 call seq_comm_setptrs(ATMID,mpicom=mpicom_ATMID,iamroot=iamroot_ATMID,nthreads=nthreads_ATMID)
00374 call seq_comm_setptrs(LNDID,mpicom=mpicom_LNDID,iamroot=iamroot_LNDID,nthreads=nthreads_LNDID)
00375 call seq_comm_setptrs(ICEID,mpicom=mpicom_ICEID,iamroot=iamroot_ICEID,nthreads=nthreads_ICEID)
00376 call seq_comm_setptrs(OCNID,mpicom=mpicom_OCNID,iamroot=iamroot_OCNID,nthreads=nthreads_OCNID)
00377 call seq_comm_setptrs(GLCID,mpicom=mpicom_GLCID,iamroot=iamroot_GLCID,nthreads=nthreads_GLCID)
00378 call seq_comm_setptrs(CPLATMID,mpicom=mpicom_CPLATMID,nthreads=nthreads_CPLATMID)
00379 call seq_comm_setptrs(CPLLNDID,mpicom=mpicom_CPLLNDID,nthreads=nthreads_CPLLNDID)
00380 call seq_comm_setptrs(CPLICEID,mpicom=mpicom_CPLICEID,nthreads=nthreads_CPLICEID)
00381 call seq_comm_setptrs(CPLOCNID,mpicom=mpicom_CPLOCNID,nthreads=nthreads_CPLOCNID)
00382 call seq_comm_setptrs(CPLGLCID,mpicom=mpicom_CPLGLCID,nthreads=nthreads_CPLGLCID)
00383 iamin_CPLID = seq_comm_iamin(CPLID)
00384 iamin_ATMID = seq_comm_iamin(ATMID)
00385 iamin_LNDID = seq_comm_iamin(LNDID)
00386 iamin_ICEID = seq_comm_iamin(ICEID)
00387 iamin_OCNID = seq_comm_iamin(OCNID)
00388 iamin_GLCID = seq_comm_iamin(GLCID)
00389 iamin_CPLATMID = seq_comm_iamin(CPLATMID)
00390 iamin_CPLLNDID = seq_comm_iamin(CPLLNDID)
00391 iamin_CPLICEID = seq_comm_iamin(CPLICEID)
00392 iamin_CPLOCNID = seq_comm_iamin(CPLOCNID)
00393 iamin_CPLGLCID = seq_comm_iamin(CPLGLCID)
00394
00395 complist = " "
00396 if (iamin_CPLID) complist = trim(complist)//' cpl'
00397 if (iamin_OCNID) complist = trim(complist)//' ocn'
00398 if (iamin_ATMID) complist = trim(complist)//' atm'
00399 if (iamin_LNDID) complist = trim(complist)//' lnd'
00400 if (iamin_ICEID) complist = trim(complist)//' ice'
00401 if (iamin_GLCID) complist = trim(complist)//' glc'
00402
00403
00404
00405
00406
00407 if (iamroot_CPLID) then
00408 inquire(file='cpl_modelio.nml',exist=exists)
00409 if (exists) then
00410 logunit = shr_file_getUnit()
00411 call shr_file_setIO('cpl_modelio.nml',logunit)
00412 call shr_file_setLogUnit(logunit)
00413 loglevel = 1
00414 call shr_file_setLogLevel(loglevel)
00415 endif
00416 else
00417 loglevel = 0
00418 call shr_file_setLogLevel(loglevel)
00419 endif
00420
00421
00422
00423
00424
00425 if (iamroot_CPLID) then
00426 #ifdef USE_ESMF_LIB
00427 write(logunit,'(2A)') subname,' USE_ESMF_LIB is set'
00428 #else
00429 write(logunit,'(2A)') subname,' USE_ESMF_LIB is NOT set, using esmf_wrf_timemgr'
00430 #endif
00431 #ifdef MCT_INTERFACE
00432 write(logunit,'(2A)') subname,' MCT_INTERFACE is set'
00433 #endif
00434 #ifdef ESMF_INTERFACE
00435 write(logunit,'(2A)') subname,' ESMF_INTERFACE is set'
00436 #endif
00437 endif
00438
00439 call ESMF_Initialize()
00440 #ifdef ESMF_INTERFACE
00441 call atm_register(atm_petlist)
00442 call lnd_register(lnd_petlist)
00443 call ice_register(ice_petlist)
00444 call ocn_register(ocn_petlist)
00445 call glc_register(glc_petlist)
00446 #endif
00447
00448
00449
00450
00451
00452 if (iamroot_CPLID) call seq_ccsm_printlogheader()
00453
00454
00455
00456
00457
00458 call t_initf(NLFileName, LogPrint=.false., mpicom=mpicom_GLOID, &
00459 MasterTask=iamroot_GLOID)
00460
00461
00462
00463
00464 if (iamin_CPLID) then
00465 call seq_io_init(NLFileName)
00466 endif
00467
00468
00469 call t_startf('DRIVER_INIT')
00470
00471
00472
00473
00474 call shr_mem_init(prt=.true.)
00475
00476
00477
00478
00479
00480 call seq_flds_set()
00481 call seq_flds_indices_set( )
00482
00483
00484
00485
00486
00487 call seq_infodata_init(infodata,nlfilename,GLOID)
00488 if (iamroot_CPLID) then
00489 write(logunit,*) ' '
00490 write(logunit,'(2A)') 'Status of infodata after seq_infodata_init'
00491 call seq_infodata_print( infodata )
00492 write(logunit,*) ' '
00493 endif
00494
00495 call seq_infodata_GetData(infodata,read_restart=read_restart, restart_file=rest_file, &
00496 timing_dir=timing_dir, tchkpt_dir=tchkpt_dir)
00497 call seq_infodata_GetData(infodata, info_debug=info_debug, atm_present=atm_present, &
00498 lnd_present=lnd_present, ice_present=ice_present, ocn_present=ocn_present, &
00499 glc_present=glc_present, sno_present=sno_present, &
00500 single_column=single_column, aqua_planet=aqua_planet, &
00501 ocean_tight_coupling=ocean_tight_coupling, drv_threading=drv_threading)
00502 call seq_infodata_GetData(infodata, do_histinit=do_histinit)
00503 call seq_infodata_GetData(infodata, do_budgets=do_budgets, budget_inst=budget_inst, &
00504 budget_daily=budget_daily, budget_month=budget_month, budget_ann=budget_ann, &
00505 budget_ltann=budget_ltann, budget_ltend=budget_ltend)
00506 call seq_infodata_GetData(infodata, &
00507 histaux_a2x =do_hist_a2x , histaux_a2x3hr =do_hist_a2x3hr , &
00508 histaux_a2x3hrp=do_hist_a2x3hrp, histaux_a2x24hr=do_hist_a2x24hr, &
00509 histaux_l2x =do_hist_l2x , histaux_r2x =do_hist_r2x )
00510
00511 call seq_infodata_GetData(infodata, aoflux_grid=aoflux_grid)
00512 if (trim(aoflux_grid) == 'ocn') then
00513
00514 elseif (trim(aoflux_grid) == 'atm') then
00515 if (iamroot_CPLID) write(logunit,'(2A)') 'aoflux_grid = ',trim(aoflux_grid)
00516 call shr_sys_abort(' aoflux_grid atm not supported yet')
00517 else
00518 write(logunit,*) 'ERROR in aoflux_grid = ',trim(aoflux_grid)
00519 call shr_sys_abort('aoflux_grid error')
00520 endif
00521
00522 call seq_infodata_GetData(infodata, shr_map_dopole=shr_map_dopole)
00523 call shr_map_setDopole(shr_map_dopole)
00524
00525
00526
00527
00528
00529 if (drv_threading) then
00530 if (iamroot_GLOID) write(logunit,*) ' '
00531 if (iamroot_GLOID) write(logunit,'(2A) ') subname,' Test Threading in driver'
00532 call seq_comm_setnthreads(nthreads_GLOID)
00533 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_GLOID = ',nthreads_GLOID,seq_comm_getnthreads()
00534 call seq_comm_setnthreads(nthreads_CPLID)
00535 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_CPLID = ',nthreads_CPLID,seq_comm_getnthreads()
00536 call seq_comm_setnthreads(nthreads_ATMID)
00537 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ATMID = ',nthreads_ATMID,seq_comm_getnthreads()
00538 call seq_comm_setnthreads(nthreads_LNDID)
00539 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_LNDID = ',nthreads_LNDID,seq_comm_getnthreads()
00540 call seq_comm_setnthreads(nthreads_OCNID)
00541 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_OCNID = ',nthreads_OCNID,seq_comm_getnthreads()
00542 call seq_comm_setnthreads(nthreads_ICEID)
00543 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ICEID = ',nthreads_ICEID,seq_comm_getnthreads()
00544 if (iamroot_GLOID) write(logunit,*) ' '
00545 call seq_comm_setnthreads(nthreads_GLCID)
00546 if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_GLCID = ',nthreads_GLCID,seq_comm_getnthreads()
00547 if (iamroot_GLOID) write(logunit,*) ' '
00548
00549 call seq_comm_setnthreads(nthreads_GLOID)
00550 endif
00551
00552
00553
00554
00555
00556
00557 call seq_cdata_init(cdata_ax, CPLID, dom_ax, gsMap_ax, infodata, 'cdata_ax' )
00558 call seq_cdata_init(cdata_lx, CPLID, dom_lx, gsMap_lx, infodata, 'cdata_lx' )
00559 call seq_cdata_init(cdata_rx, CPLID, dom_rx, gsMap_rx, infodata, 'cdata_rx' )
00560 call seq_cdata_init(cdata_ix, CPLID, dom_ix, gsMap_ix, infodata, 'cdata_ix' )
00561 call seq_cdata_init(cdata_ox, CPLID, dom_ox, gsMap_ox, infodata, 'cdata_ox' )
00562 call seq_cdata_init(cdata_gx, CPLID, dom_gx, gsMap_gx, infodata, 'cdata_gx' )
00563 call seq_cdata_init(cdata_sx, CPLID, dom_sx, gsMap_sx, infodata, 'cdata_sx' )
00564
00565 call seq_cdata_init(cdata_aa, ATMID, dom_aa, gsMap_aa, infodata, 'cdata_aa')
00566 call seq_cdata_init(cdata_ll, LNDID, dom_ll, gsMap_ll, infodata, 'cdata_ll')
00567 call seq_cdata_init(cdata_rr, LNDID, dom_rr, gsMap_rr, infodata, 'cdata_rr')
00568 call seq_cdata_init(cdata_ss, LNDID, dom_ss, gsMap_ss, infodata, 'cdata_ss')
00569 call seq_cdata_init(cdata_ii, ICEID, dom_ii, gsMap_ii, infodata, 'cdata_ii')
00570 call seq_cdata_init(cdata_oo, OCNID, dom_oo, gsMap_oo, infodata, 'cdata_oo')
00571 call seq_cdata_init(cdata_gg, GLCID, dom_gg, gsMap_gg, infodata, 'cdata_gg')
00572
00573
00574
00575
00576
00577 call seq_timemgr_clockInit(seq_SyncClock,nlfilename,read_restart,rest_file,mpicom_gloid, &
00578 EClock_d, EClock_a, EClock_l, EClock_o, EClock_i, Eclock_g)
00579 if (iamroot_CPLID) then
00580 call seq_timemgr_clockPrint(seq_SyncClock)
00581 endif
00582
00583 call seq_infodata_putData(infodata,atm_phase=1,lnd_phase=1,ocn_phase=1,ice_phase=1,glc_phase=1)
00584
00585
00586
00587
00588
00589
00590
00591 if (.not.aqua_planet .and. single_column) then
00592 call seq_infodata_getData( infodata, scmlon=scmlon, scmlat=scmlat)
00593 call shr_scam_checkSurface(scmlon, scmlat, OCNID, mpicom_OCNID, &
00594 lnd_present=lnd_present, ice_present=ice_present, ocn_present=ocn_present)
00595 call seq_infodata_putData( infodata, &
00596 lnd_present=lnd_present, ocn_present=ocn_present, ice_present=ocn_present)
00597 endif
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610 call t_startf('driver_init_comps')
00611 if ( iamroot_CPLID )then
00612 write(logunit,*) ' '
00613 write(logunit,F00) 'Initialize each component: atm, lnd, ocn, and ice'
00614 call shr_sys_flush(logunit)
00615 endif
00616
00617
00618
00619
00620
00621 call t_adj_detailf(+2)
00622
00623 if (iamin_CPLATMID) then
00624 call seq_infodata_exchange(infodata,CPLATMID,'cpl2atm_init')
00625 endif
00626 if (iamin_ATMID .and. atm_present) then
00627 if (seq_comm_iamroot(ATMID)) write(logunit,F00) 'Initialize atm component'
00628 call shr_sys_flush(logunit)
00629 if (drv_threading) call seq_comm_setnthreads(nthreads_ATMID)
00630 call atm_init_mct( EClock_a, cdata_aa, x2a_aa, a2x_aa, NLFilename=NLFilename )
00631 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00632 endif
00633 if (iamin_CPLATMID) then
00634 call seq_infodata_exchange(infodata,CPLATMID,'atm2cpl_init')
00635 endif
00636
00637
00638
00639
00640
00641 if (iamin_CPLLNDID) then
00642 call seq_infodata_exchange(infodata,CPLLNDID,'cpl2lnd_init')
00643 endif
00644 if (iamin_LNDID .and. lnd_present) then
00645 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
00646 if (seq_comm_iamroot(LNDID)) write(logunit,F00) 'Initialize lnd component'
00647 call shr_sys_flush(logunit)
00648 call lnd_init_mct( EClock_l, cdata_ll, x2l_ll, l2x_ll, &
00649 cdata_rr, r2x_rr, &
00650 cdata_ss, x2s_ss, s2x_ss, NLFilename=NLFilename )
00651 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00652 endif
00653 if (iamin_CPLLNDID) then
00654 call seq_infodata_exchange(infodata,CPLLNDID,'lnd2cpl_init')
00655 endif
00656
00657
00658
00659
00660
00661 if (iamin_CPLOCNID) then
00662 call seq_infodata_exchange(infodata,CPLOCNID,'cpl2ocn_init')
00663 endif
00664 if (iamin_OCNID .and. ocn_present) then
00665 if (drv_threading) call seq_comm_setnthreads(nthreads_OCNID)
00666 if (seq_comm_iamroot(OCNID)) write(logunit,F00) 'Initialize ocn component'
00667 call shr_sys_flush(logunit)
00668 call ocn_init_mct( EClock_o, cdata_oo, x2o_oo, o2x_oo, NLFilename=NLFilename )
00669 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00670 endif
00671 if (iamin_CPLOCNID) then
00672 call seq_infodata_exchange(infodata,CPLOCNID,'ocn2cpl_init')
00673 endif
00674
00675
00676
00677
00678
00679 if (iamin_CPLICEID) then
00680 call seq_infodata_exchange(infodata,CPLICEID,'cpl2ice_init')
00681 endif
00682 if (iamin_ICEID .and. ice_present) then
00683 if (drv_threading) call seq_comm_setnthreads(nthreads_ICEID)
00684 if (seq_comm_iamroot(ICEID)) write(logunit,F00) 'Initialize ice component'
00685 call shr_sys_flush(logunit)
00686 call ice_init_mct( EClock_i, cdata_ii, x2i_ii, i2x_ii, NLFilename=NLFilename )
00687 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00688 endif
00689 if (iamin_CPLICEID) then
00690 call seq_infodata_exchange(infodata,CPLICEID,'ice2cpl_init')
00691 endif
00692
00693
00694
00695
00696
00697 if (iamin_CPLGLCID) then
00698 call seq_infodata_exchange(infodata,CPLGLCID,'cpl2glc_init')
00699 endif
00700 if (iamin_GLCID .and. glc_present) then
00701 if (drv_threading) call seq_comm_setnthreads(nthreads_GLCID)
00702 if (seq_comm_iamroot(GLCID)) write(logunit,F00) 'Initialize glc component'
00703 call shr_sys_flush(logunit)
00704 call glc_init_mct( EClock_g, cdata_gg, x2g_gg, g2x_gg, NLFilename=NLFilename )
00705 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00706 endif
00707 if (iamin_CPLGLCID) then
00708 call seq_infodata_exchange(infodata,CPLGLCID,'glc2cpl_init')
00709 endif
00710
00711 call t_adj_detailf(-2)
00712
00713 call t_stopf ('driver_init_comps')
00714
00715
00716
00717
00718
00719 if (iamin_CPLATMID) then
00720 call seq_infodata_exchange(infodata,CPLATMID,'cpl2atm_init')
00721 endif
00722 if (iamin_CPLLNDID) then
00723 call seq_infodata_exchange(infodata,CPLLNDID,'cpl2lnd_init')
00724 endif
00725 if (iamin_CPLOCNID) then
00726 call seq_infodata_exchange(infodata,CPLOCNID,'cpl2ocn_init')
00727 endif
00728 if (iamin_CPLICEID) then
00729 call seq_infodata_exchange(infodata,CPLICEID,'cpl2ice_init')
00730 endif
00731 if (iamin_CPLGLCID) then
00732 call seq_infodata_exchange(infodata,CPLGLCID,'cpl2glc_init')
00733 endif
00734
00735 if ( iamroot_CPLID) then
00736 write(logunit,F00) 'Determine final settings for presence of surface components'
00737 call shr_sys_flush(logunit)
00738 endif
00739
00740 call seq_infodata_getData(infodata, &
00741 atm_present=atm_present, &
00742 lnd_present=lnd_present, &
00743 rof_present=rof_present, &
00744 ice_present=ice_present, &
00745 ocn_present=ocn_present, &
00746 glc_present=glc_present, &
00747 sno_present=sno_present, &
00748 atm_prognostic=atm_prognostic, &
00749 lnd_prognostic=lnd_prognostic, &
00750 ice_prognostic=ice_prognostic, &
00751 ocn_prognostic=ocn_prognostic, &
00752 ocnrof_prognostic=ocnrof_prognostic, &
00753 glc_prognostic=glc_prognostic, &
00754 sno_prognostic=sno_prognostic, &
00755 dead_comps=dead_comps, &
00756 atm_nx=atm_nx, atm_ny=atm_ny, &
00757 lnd_nx=lnd_nx, lnd_ny=lnd_ny, &
00758 rof_nx=rof_nx, rof_ny=rof_ny, &
00759 ice_nx=ice_nx, ice_ny=ice_ny, &
00760 glc_nx=glc_nx, glc_ny=glc_ny, &
00761 sno_nx=sno_nx, sno_ny=sno_ny, &
00762 ocn_nx=ocn_nx, ocn_ny=ocn_ny, &
00763 cpl_cdf64=cdf64, &
00764 atm_aero=atm_aero )
00765
00766 if (.not. atm_present) then
00767 call shr_sys_abort('atm must be present')
00768 endif
00769 if (ocnrof_prognostic .and. .not.rof_present) then
00770 if (iamroot_CPLID) then
00771 write(logunit,F00) 'WARNING: ocnrof_prognostic is TRUE but rof_present is FALSE'
00772 call shr_sys_flush(logunit)
00773 endif
00774 endif
00775 if (ocn_prognostic .and. .not.ocn_present) then
00776 call shr_sys_abort('if prognostic ocn must also have ocn present')
00777 endif
00778 if (lnd_prognostic .and. .not.lnd_present) then
00779 call shr_sys_abort('if prognostic lnd must also have lnd present')
00780 endif
00781 if (ice_prognostic .and. .not.ice_present) then
00782 call shr_sys_abort('if prognostic ice must also have ice present')
00783 endif
00784 if (glc_prognostic .and. .not.glc_present) then
00785 call shr_sys_abort('if prognostic glc must also have glc present')
00786 endif
00787 if (sno_prognostic .and. .not.sno_present) then
00788 call shr_sys_abort('if prognostic sno must also have sno present')
00789 endif
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 domain_check = .true.
00803 if (single_column ) domain_check = .false.
00804 if (dead_comps ) domain_check = .false.
00805
00806
00807
00808
00809 skip_ocean_run = .true.
00810 if ( read_restart) skip_ocean_run = .false.
00811 ocnrun_count = 0
00812 cpl2ocn_first = .true.
00813
00814 do_histavg = .true.
00815 if (seq_timemgr_histavg_type == seq_timemgr_type_never) then
00816 do_histavg = .false.
00817 endif
00818
00819
00820
00821
00822
00823
00824
00825 if (iamroot_CPLID) then
00826 write(logunit,* )' '
00827 write(logunit,F00)'After component initialization:'
00828 write(logunit,F0L)'atm model present = ',atm_present
00829 write(logunit,F0L)'lnd model present = ',lnd_present
00830 write(logunit,F0L)'ocn model present = ',ocn_present
00831 write(logunit,F0L)'ice model present = ',ice_present
00832 write(logunit,F0L)'glc model present = ',glc_present
00833 write(logunit,F0L)'sno model present = ',sno_present
00834 write(logunit,F0L)'atm model prognostic = ',atm_prognostic
00835 write(logunit,F0L)'lnd model prognostic = ',lnd_prognostic
00836 write(logunit,F0L)'ocn model prognostic = ',ocn_prognostic
00837 write(logunit,F0L)'ice model prognostic = ',ice_prognostic
00838 write(logunit,F0L)'glc model prognostic = ',glc_prognostic
00839 write(logunit,F0L)'sno model prognostic = ',sno_prognostic
00840 write(logunit,F0L)'lnd rof present = ',rof_present
00841 write(logunit,F0L)'ocn rof prognostic = ',ocnrof_prognostic
00842 write(logunit,F0L)'dead components = ',dead_comps
00843 write(logunit,F0L)'domain_check = ',domain_check
00844 write(logunit,F0I)'atm_nx,atm_ny = ',atm_nx,atm_ny
00845 write(logunit,F0I)'lnd_nx,lnd_ny = ',lnd_nx,lnd_ny
00846 write(logunit,F0I)'rof_nx,rof_ny = ',rof_nx,rof_ny
00847 write(logunit,F0I)'ice_nx,ice_ny = ',ice_nx,ice_ny
00848 write(logunit,F0I)'ocn_nx,ocn_ny = ',ocn_nx,ocn_ny
00849 write(logunit,F0I)'glc_nx,glc_ny = ',glc_nx,glc_ny
00850 write(logunit,F0I)'sno_nx,sno_ny = ',sno_nx,sno_ny
00851 write(logunit,F0L)'skip init ocean run = ',skip_ocean_run
00852 write(logunit,F0L)'ocean tight coupling = ',ocean_tight_coupling
00853 write(logunit,F0L)'cpl_cdf64 = ',cdf64
00854 write(logunit,F0L)'do_histavg = ',do_histavg
00855 write(logunit,F0L)'atm_aero = ',atm_aero
00856 write(logunit,* )' '
00857 call shr_sys_flush(logunit)
00858 endif
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868 if (iamin_ATMID .and. atm_present) then
00869 if (drv_threading) call seq_comm_setnthreads(nthreads_ATMID)
00870 k1 = mct_aVect_indexRa(cdata_aa%dom%data,"area" ,perrWith='aa area ')
00871 k2 = mct_aVect_indexRa(cdata_aa%dom%data,"aream" ,perrWith='aa aream')
00872 k3 = mct_aVect_indexRa(cdata_aa%dom%data,"ascale",perrWith='aa ascale')
00873 cdata_aa%dom%data%rAttr(k2,:) = cdata_aa%dom%data%rAttr(k1,:)
00874 cdata_aa%dom%data%rAttr(k3,:) = 1.0_r8
00875 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00876 endif
00877
00878 if (iamin_LNDID .and. lnd_present) then
00879 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
00880 k1 = mct_aVect_indexRa(cdata_ll%dom%data,"area" ,perrWith='ll area ')
00881 k2 = mct_aVect_indexRa(cdata_ll%dom%data,"aream" ,perrWith='ll aream')
00882 k3 = mct_aVect_indexRa(cdata_ll%dom%data,"ascale",perrWith='ll ascale')
00883 cdata_ll%dom%data%rAttr(k2,:) = cdata_ll%dom%data%rAttr(k1,:)
00884 cdata_ll%dom%data%rAttr(k3,:) = 1.0_r8
00885 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00886 endif
00887
00888 if (iamin_LNDID .and. rof_present) then
00889 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
00890 k1 = mct_aVect_indexRa(cdata_rr%dom%data,"area" ,perrWith='rr area ')
00891 k2 = mct_aVect_indexRa(cdata_rr%dom%data,"aream" ,perrWith='rr aream')
00892 k3 = mct_aVect_indexRa(cdata_rr%dom%data,"ascale",perrWith='rr ascale')
00893 cdata_rr%dom%data%rAttr(k2,:) = cdata_rr%dom%data%rAttr(k1,:)
00894 cdata_rr%dom%data%rAttr(k3,:) = 1.0_r8
00895 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00896 endif
00897
00898 if (iamin_LNDID .and. sno_present) then
00899 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
00900 k1 = mct_aVect_indexRa(cdata_ss%dom%data,"area" ,perrWith='ss area ')
00901 k2 = mct_aVect_indexRa(cdata_ss%dom%data,"aream" ,perrWith='ss aream')
00902 k3 = mct_aVect_indexRa(cdata_ss%dom%data,"ascale",perrWith='ss ascale')
00903 cdata_ss%dom%data%rAttr(k2,:) = cdata_ss%dom%data%rAttr(k1,:)
00904 cdata_ss%dom%data%rAttr(k3,:) = 1.0_r8
00905 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00906 endif
00907
00908 if (iamin_OCNID .and. ocn_present) then
00909 if (drv_threading) call seq_comm_setnthreads(nthreads_OCNID)
00910 k1 = mct_aVect_indexRa(cdata_oo%dom%data,"area" ,perrWith='oo area ')
00911 k2 = mct_aVect_indexRa(cdata_oo%dom%data,"aream" ,perrWith='oo aream')
00912 k3 = mct_aVect_indexRa(cdata_oo%dom%data,"ascale",perrWith='oo ascale')
00913 cdata_oo%dom%data%rAttr(k2,:) = cdata_oo%dom%data%rAttr(k1,:)
00914 cdata_oo%dom%data%rAttr(k3,:) = 1.0_r8
00915 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00916 endif
00917
00918 if (iamin_ICEID .and. ice_present) then
00919 if (drv_threading) call seq_comm_setnthreads(nthreads_ICEID)
00920 k1 = mct_aVect_indexRa(cdata_ii%dom%data,"area" ,perrWith='ii area ')
00921 k2 = mct_aVect_indexRa(cdata_ii%dom%data,"aream" ,perrWith='ii aream')
00922 k3 = mct_aVect_indexRa(cdata_ii%dom%data,"ascale",perrWith='ii ascale')
00923 cdata_ii%dom%data%rAttr(k2,:) = cdata_ii%dom%data%rAttr(k1,:)
00924 cdata_ii%dom%data%rAttr(k3,:) = 1.0_r8
00925 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00926 endif
00927
00928 if (iamin_GLCID .and. glc_present) then
00929 if (drv_threading) call seq_comm_setnthreads(nthreads_GLCID)
00930 k1 = mct_aVect_indexRa(cdata_gg%dom%data,"area" ,perrWith='gg area ')
00931 k2 = mct_aVect_indexRa(cdata_gg%dom%data,"aream" ,perrWith='gg aream')
00932 k3 = mct_aVect_indexRa(cdata_gg%dom%data,"ascale",perrWith='gg ascale')
00933 cdata_gg%dom%data%rAttr(k2,:) = cdata_gg%dom%data%rAttr(k1,:)
00934 cdata_gg%dom%data%rAttr(k3,:) = 1.0_r8
00935 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
00936 endif
00937
00938
00939
00940
00941
00942
00943 call t_startf('driver_init_xxx2xxx')
00944
00945 if (iamin_CPLATMID .and. atm_present) then
00946 call map_atm2atm_init_mct(cdata_aa, x2a_aa, a2x_aa, ATMID, &
00947 cdata_ax, x2a_ax, a2x_ax, CPLID, CPLATMID)
00948 call mct_avect_zero(x2a_aa)
00949 call map_atma2atmx_mct(cdata_aa, x2a_aa, cdata_ax, x2a_ax)
00950 endif
00951
00952 if (iamin_CPLLNDID .and. lnd_present) then
00953 call map_lnd2lnd_init_mct(cdata_ll, x2l_ll, l2x_ll, LNDID, &
00954 cdata_lx, x2l_lx, l2x_lx, CPLID, CPLLNDID)
00955 call mct_avect_zero(x2l_ll)
00956 call map_lndl2lndx_mct(cdata_ll, x2l_ll, cdata_lx, x2l_lx)
00957 endif
00958
00959 if (iamin_CPLLNDID .and. rof_present) then
00960 call map_rof2rof_init_mct(cdata_rr, r2x_rr, LNDID, &
00961 cdata_rx, r2x_rx, CPLID, CPLLNDID)
00962 call mct_avect_init(r2xacc_rx%data, r2x_rx, mct_aVect_lsize(r2x_rx))
00963 call mct_accum_zero(r2xacc_rx)
00964 r2xacc_rx_cnt = 0
00965 endif
00966
00967 if (iamin_CPLLNDID .and. sno_present) then
00968 call map_sno2sno_init_mct(cdata_ss, x2s_ss, s2x_ss, LNDID, &
00969 cdata_sx, x2s_sx, s2x_sx, CPLID, CPLLNDID)
00970 call mct_avect_zero(x2s_ss)
00971 call map_snos2snox_mct(cdata_ss, x2s_ss, cdata_sx, x2s_sx)
00972 endif
00973
00974 if (iamin_CPLICEID .and. ice_present) then
00975 call map_ice2ice_init_mct(cdata_ii, x2i_ii, i2x_ii, ICEID, &
00976 cdata_ix, x2i_ix, i2x_ix, CPLID, CPLICEID)
00977 call mct_avect_zero(x2i_ii)
00978 call map_icei2icex_mct(cdata_ii, x2i_ii, cdata_ix, x2i_ix)
00979 endif
00980
00981 if (iamin_CPLGLCID .and. glc_present) then
00982 call map_glc2glc_init_mct(cdata_gg, x2g_gg, g2x_gg, GLCID, &
00983 cdata_gx, x2g_gx, g2x_gx, CPLID, CPLGLCID)
00984 call mct_avect_zero(x2g_gg)
00985 call map_glcg2glcx_mct(cdata_gg, x2g_gg, cdata_gx, x2g_gx)
00986 endif
00987
00988 if (iamin_CPLOCNID .and. ocn_present) then
00989 call map_ocn2ocn_init_mct(cdata_oo, x2o_oo, o2x_oo, OCNID, &
00990 cdata_ox, x2o_ox, o2x_ox, CPLID, CPLOCNID)
00991 call mct_avect_zero(x2o_oo)
00992 call map_ocno2ocnx_mct(cdata_oo, x2o_oo, cdata_ox, x2o_ox)
00993
00994 call mct_avect_init(x2oacc_ox%data, x2o_ox, mct_aVect_lsize(x2o_ox))
00995 call mct_accum_zero(x2oacc_ox)
00996 x2oacc_ox_cnt = 0
00997 endif
00998
00999 call t_stopf ('driver_init_xxx2xxx')
01000
01001
01002
01003
01004
01005 if (iamin_CPLID) then
01006 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01007
01008
01009
01010
01011
01012 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing merge components'
01013 call mrg_x2a_init_mct( cdata_ax, l2x_ax, o2x_ax, i2x_ax, xao_ax )
01014 if (ice_present) call mrg_x2i_init_mct( cdata_ix, a2x_ix, o2x_ix )
01015 if (ocn_present) call mrg_x2o_init_mct( cdata_ox, a2x_ox, i2x_ox, r2x_ox )
01016 if (lnd_present) call mrg_x2l_init_mct( cdata_lx, a2x_lx)
01017 if (glc_present) call mrg_x2g_init_mct( cdata_gx, s2x_gx)
01018 if (sno_present) call mrg_x2s_init_mct( cdata_sx, g2x_sx)
01019
01020
01021
01022
01023
01024
01025 call t_startf('driver_init_maps')
01026
01027 if (ocn_present) then
01028 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing atm/ocn mapping'
01029 call map_atm2ocn_init_mct(cdata_ax, cdata_ox)
01030 call map_ocn2atm_init_mct(cdata_ox, cdata_ax)
01031 endif
01032 if (ice_present .and. ocn_present) then
01033 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing ocn/ice mapping'
01034 call map_ocn2ice_init_mct(cdata_ox, cdata_ix)
01035 call map_ice2ocn_init_mct(cdata_ix, cdata_ox)
01036 endif
01037 if (ice_present) then
01038 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing atm/ice mapping'
01039
01040 call map_ice2atm_init_mct(cdata_ix, cdata_ax)
01041 endif
01042 if (rof_present .and. ocnrof_prognostic) then
01043 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing rof/ocn mapping'
01044 call map_rof2ocn_init_mct(cdata_rx, cdata_ox)
01045 endif
01046 if (lnd_present) then
01047 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing atm/lnd mapping'
01048 call map_atm2lnd_init_mct(cdata_ax, cdata_lx)
01049 call map_lnd2atm_init_mct(cdata_lx, cdata_ax)
01050 endif
01051 if (sno_present .and. glc_present) then
01052 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing sno/glc mapping'
01053 call map_sno2glc_init_mct(cdata_sx, cdata_gx)
01054 call map_glc2sno_init_mct(cdata_gx, cdata_sx)
01055 endif
01056
01057 call t_stopf ('driver_init_maps')
01058
01059
01060
01061
01062
01063
01064
01065 if (domain_check) then
01066 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Performing domain checking'
01067 call seq_domain_check_mct( cdata_ax, cdata_ix, cdata_lx, cdata_ox, &
01068 cdata_rx, cdata_gx, cdata_sx)
01069 endif
01070
01071 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01072 endif
01073
01074
01075
01076
01077
01078
01079
01080
01081 if (iamin_CPLATMID .and. atm_present) then
01082 call map_atmx2atma_mct( cdata_ax, dom_ax%data, cdata_aa, dom_aa%data)
01083 if (iamin_ATMID) then
01084 call domain_areafactinit_mct(cdata_aa,mdl2drv_aa,drv2mdl_aa,'areafact_a')
01085 call mct_avect_vecmult(a2x_aa,mdl2drv_aa,seq_flds_a2x_fluxes)
01086 endif
01087 call map_atma2atmx_mct(cdata_aa, a2x_aa, cdata_ax, a2x_ax)
01088 endif
01089
01090 if (iamin_CPLLNDID .and. lnd_present) then
01091 call map_lndx2lndl_mct( cdata_lx, dom_lx%data, cdata_ll, dom_ll%data)
01092 if (iamin_LNDID) then
01093 call domain_areafactinit_mct(cdata_ll,mdl2drv_ll,drv2mdl_ll,'areafact_l')
01094 call mct_avect_vecmult(l2x_ll,mdl2drv_ll,seq_flds_l2x_fluxes)
01095 endif
01096 call map_lndl2lndx_mct(cdata_ll, l2x_ll, cdata_lx, l2x_lx)
01097 endif
01098
01099 if (iamin_CPLLNDID .and. rof_present) then
01100 call map_rofx2rofr_mct( cdata_rx, dom_rx%data, cdata_rr, dom_rr%data)
01101 if (iamin_LNDID) then
01102 call domain_areafactinit_mct(cdata_rr,mdl2drv_rr,drv2mdl_rr,'areafact_r')
01103 call mct_avect_vecmult(r2x_rr,mdl2drv_rr,seq_flds_r2x_fluxes)
01104 endif
01105 call map_rofr2rofx_mct(cdata_rr, r2x_rr, cdata_rx, r2x_rx)
01106 endif
01107
01108 if (iamin_CPLLNDID .and. sno_present) then
01109 call map_snox2snos_mct( cdata_sx, dom_sx%data, cdata_ss, dom_ss%data)
01110 if (iamin_LNDID) then
01111 call domain_areafactinit_mct(cdata_ss,mdl2drv_ss,drv2mdl_ss,'areafact_s')
01112 call mct_avect_vecmult(s2x_ss,mdl2drv_ss,seq_flds_s2x_fluxes)
01113 endif
01114 call map_snos2snox_mct(cdata_ss, s2x_ss, cdata_sx, s2x_sx)
01115 endif
01116
01117 if (iamin_CPLOCNID .and. ocn_present) then
01118 call map_ocnx2ocno_mct( cdata_ox, dom_ox%data, cdata_oo, dom_oo%data)
01119 if (iamin_OCNID) then
01120 call domain_areafactinit_mct(cdata_oo,mdl2drv_oo,drv2mdl_oo,'areafact_o')
01121 call mct_avect_vecmult(o2x_oo,mdl2drv_oo,seq_flds_o2x_fluxes)
01122 endif
01123 call map_ocno2ocnx_mct(cdata_oo, o2x_oo, cdata_ox, o2x_ox)
01124 endif
01125
01126 if (iamin_CPLICEID .and. ice_present) then
01127 call map_icex2icei_mct( cdata_ix, dom_ix%data, cdata_ii, dom_ii%data)
01128 if (iamin_ICEID) then
01129 call domain_areafactinit_mct(cdata_ii,mdl2drv_ii,drv2mdl_ii,'areafact_i')
01130 call mct_avect_vecmult(i2x_ii,mdl2drv_ii,seq_flds_i2x_fluxes)
01131 endif
01132 call map_icei2icex_mct(cdata_ii, i2x_ii, cdata_ix, i2x_ix)
01133 endif
01134
01135 if (iamin_CPLGLCID .and. glc_present) then
01136 call map_glcx2glcg_mct( cdata_gx, dom_gx%data, cdata_gg, dom_gg%data)
01137 if (iamin_GLCID) then
01138 call domain_areafactinit_mct(cdata_gg,mdl2drv_gg,drv2mdl_gg,'areafact_g')
01139 call mct_avect_vecmult(g2x_gg,mdl2drv_gg,seq_flds_g2x_fluxes)
01140 endif
01141 call map_glcg2glcx_mct(cdata_gg, g2x_gg, cdata_gx, g2x_gx)
01142 endif
01143
01144
01145
01146
01147 if (iamin_CPLID .and. info_debug > 1) then
01148 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01149 if (atm_present) call seq_diag_avect_mct(cdata_ax,a2x_ax,'recv atm IC')
01150 if (ice_present) call seq_diag_avect_mct(cdata_ix,i2x_ix,'recv ice IC')
01151 if (lnd_present) call seq_diag_avect_mct(cdata_lx,l2x_lx,'recv lnd IC')
01152 if (rof_present) call seq_diag_avect_mct(cdata_rx,r2x_rx,'recv roff IC')
01153 if (sno_present) call seq_diag_avect_mct(cdata_sx,s2x_sx,'recv sno IC')
01154 if (ocn_present) call seq_diag_avect_mct(cdata_ox,o2x_ox,'recv ocn IC')
01155 if (glc_present) call seq_diag_avect_mct(cdata_gx,g2x_gx,'recv glc IC')
01156 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01157 end if
01158
01159
01160
01161
01162
01163 if (iamin_CPLID) then
01164 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01165 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing fractions'
01166 call seq_frac_init(cdata_ax, cdata_ix, cdata_lx, cdata_ox, cdata_gx, &
01167 ice_present, ocn_present, lnd_present, glc_present, &
01168 dead_comps, &
01169 fractions_ax, fractions_ix, fractions_lx, fractions_ox, &
01170 fractions_gx)
01171 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Setting fractions '
01172 call seq_frac_set(i2x_ix, &
01173 cdata_ax, cdata_ix, cdata_lx, cdata_ox, cdata_gx, &
01174 ice_present, ocn_present, lnd_present, glc_present, &
01175 fractions_ax, fractions_ix, fractions_lx, fractions_ox, &
01176 fractions_gx)
01177
01178
01179
01180
01181 if (ocn_present) then
01182 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Initializing atm/ocn flux component'
01183 call seq_flux_init_mct( cdata_ox, xao_ox)
01184
01185 if (trim(aoflux_grid) == 'ocn') then
01186 call seq_flux_atmocn_mct( cdata_ox, a2x_ox, o2x_ox, xao_ox, fractions_ox, albedo_only=.true. )
01187 elseif (trim(aoflux_grid) == 'atm') then
01188 call seq_flux_atmocn_mct( cdata_ax, a2x_ax, o2x_ax, xao_ax, fractions_ox, albedo_only=.true. )
01189 endif
01190 endif
01191
01192 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01193 endif
01194
01195
01196
01197
01198
01199
01200 call t_startf('driver_init_atminit')
01201
01202 if (atm_prognostic) then
01203 if (iamin_CPLID) then
01204 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01205 if (lnd_present) then
01206 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling map_lnd2atm_mct'
01207 call map_lnd2atm_mct( cdata_lx, l2x_lx, cdata_ax, l2x_ax, &
01208 fractions_l=fractions_lx, fractions_a=fractions_ax, &
01209 fluxlist=seq_flds_l2x_fluxes, statelist=seq_flds_l2x_states )
01210 endif
01211 if (ocn_present) then
01212 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling map_ocn2atm_mct for mapping o2x_ox to o2x_ax'
01213 call map_ocn2atm_mct( cdata_ox, o2x_ox, cdata_ax, o2x_ax, &
01214 fractions_o=fractions_ox, fractions_a=fractions_ax, &
01215 statelist=seq_flds_o2x_states )
01216 call map_ocn2atm_mct( cdata_ox, o2x_ox, cdata_ax, o2x_ax, &
01217 fluxlist=seq_flds_o2x_fluxes )
01218 if (trim(aoflux_grid) == 'ocn') then
01219 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling map_ocn2atm_mct for mapping xao_ox to xao_ax'
01220 call map_ocn2atm_mct( cdata_ox, xao_ox, cdata_ax, xao_ax, &
01221 fractions_o=fractions_ox, fractions_a=fractions_ax, &
01222 fluxlist=seq_flds_xao_fluxes, statelist=seq_flds_xao_states )
01223 endif
01224 endif
01225 if (ice_present) then
01226 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling map_ice2atm_mct for mapping i2x_ix to i2x_ax'
01227 call map_ice2atm_mct( cdata_ix, i2x_ix, cdata_ax, i2x_ax, &
01228 fractions_i=fractions_ix, fractions_a=fractions_ax, &
01229 fluxlist=seq_flds_i2x_fluxes, statelist=seq_flds_i2x_states )
01230 endif
01231 if (lnd_present .or. ocn_present) then
01232 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling mrg_x2a_run_mct'
01233 call mrg_x2a_run_mct( cdata_ax, l2x_ax, o2x_ax, xao_ax, i2x_ax, fractions_ax, x2a_ax )
01234 endif
01235
01236 if (info_debug > 1) call seq_diag_avect_mct(cdata_ax,x2a_ax,'send atm IC2')
01237 if ( seq_comm_iamroot(CPLID)) write(logunit,F00) 'Calling atm_init_mct'
01238
01239 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01240 endif
01241
01242 if (iamin_CPLATMID) then
01243 call map_atmx2atma_mct( cdata_ax, x2a_ax, cdata_aa, x2a_aa)
01244 call seq_infodata_exchange(infodata,CPLATMID,'cpl2atm_init')
01245 endif
01246 endif
01247
01248
01249
01250
01251
01252
01253
01254 if (iamin_ATMID) then
01255 call t_adj_detailf(+2)
01256 if (drv_threading) call seq_comm_setnthreads(nthreads_ATMID)
01257 call seq_infodata_putData(infodata,atm_phase=2)
01258 call mct_avect_vecmult(x2a_aa,drv2mdl_aa,seq_flds_x2a_fluxes)
01259 call atm_init_mct( EClock_a, cdata_aa, x2a_aa, a2x_aa)
01260 call mct_avect_vecmult(a2x_aa,mdl2drv_aa,seq_flds_a2x_fluxes)
01261 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01262 call t_adj_detailf(-2)
01263 endif
01264
01265 if (iamin_CPLATMID) then
01266 call map_atma2atmx_mct( cdata_aa, a2x_aa, cdata_ax, a2x_ax)
01267 call seq_infodata_exchange(infodata,CPLATMID,'atm2cpl_init')
01268 endif
01269
01270 if (iamin_CPLID) then
01271 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01272 if (info_debug > 1) call seq_diag_avect_mct(cdata_ax,a2x_ax,'recv atm IC2')
01273 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01274 endif
01275
01276 call t_stopf ('driver_init_atminit')
01277
01278
01279
01280
01281
01282 call t_startf('driver_init_readrestart')
01283 call seq_diag_zero_mct(mode='all')
01284 if (read_restart) call seq_rest_read(rest_file)
01285 call t_stopf ('driver_init_readrestart')
01286
01287 if (do_histinit) then
01288 if (iamin_CPLID) then
01289 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01290 if (iamroot_CPLID) then
01291 call seq_timemgr_EClockGetData( EClock_d, curr_ymd=ymd, curr_tod=tod )
01292 write(logunit,104) ' Write history file at ',ymd,tod
01293 call shr_sys_flush(logunit)
01294 endif
01295 call seq_hist_write(EClock_d)
01296 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01297 endif
01298 endif
01299
01300 if ( iamroot_CPLID )then
01301 write(logunit,*) ' '
01302 write(logunit,F00) 'Model initialization complete '
01303 write(logunit,*) ' '
01304 call shr_sys_flush(logunit)
01305 endif
01306
01307
01308
01309
01310
01311 call seq_infodata_putData(infodata,atm_phase=1,lnd_phase=1,ocn_phase=1,ice_phase=1)
01312 call seq_timemgr_EClockGetData( EClock_d, stepno=begstep)
01313 call seq_timemgr_EClockGetData( EClock_d, dtime=dtime)
01314 ncpl = 86400/dtime
01315 dtstep_acc = 0._r8
01316 dtstep_cnt = 0
01317 stop_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_stop)
01318 if (seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_datestop)) then
01319 if (iamroot_CPLID) then
01320 write(logunit,*) ' '
01321 write(logunit,103) subname,' NOTE: Stopping from alarm STOP DATE'
01322 write(logunit,*) ' '
01323 endif
01324 stop_alarm = .true.
01325 endif
01326 call t_stopf ('DRIVER_INIT')
01327 call t_startf ('DRIVER_RUN_LOOP_BSTART')
01328 call mpi_barrier(mpicom_GLOID,ierr)
01329 call t_stopf ('DRIVER_RUN_LOOP_BSTART')
01330 Time_begin = mpi_wtime()
01331 Time_bstep = mpi_wtime()
01332 do while ( .not. stop_alarm)
01333
01334 call t_startf('DRIVER_RUN_LOOP')
01335 call t_drvstartf ('DRIVER_CLOCK_ADVANCE',cplrun=.true.)
01336
01337
01338
01339
01340
01341
01342 call seq_timemgr_clockAdvance( seq_SyncClock)
01343 call seq_timemgr_EClockGetData( EClock_d, curr_ymd=ymd, curr_tod=tod )
01344 stop_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_stop)
01345 atmrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_atmrun)
01346 lndrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_lndrun)
01347 icerun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_icerun)
01348 glcrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_glcrun)
01349 ocnrun_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_ocnrun)
01350 ocnnext_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_ocnnext)
01351 restart_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_restart)
01352 history_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_history)
01353 histavg_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_histavg)
01354 tprof_alarm = seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_tprof)
01355
01356
01357 t1hr_alarm = .false.
01358 t2hr_alarm = .false.
01359 t3hr_alarm = .false.
01360 t6hr_alarm = .false.
01361 t12hr_alarm = .false.
01362 t24hr_alarm = .false.
01363 if (mod(tod, 3600) == 0) t1hr_alarm = .true.
01364 if (mod(tod, 7200) == 0) t2hr_alarm = .true.
01365 if (mod(tod,10800) == 0) t3hr_alarm = .true.
01366 if (mod(tod,21600) == 0) t6hr_alarm = .true.
01367 if (mod(tod,43200) == 0) t12hr_alarm = .true.
01368 if (tod == 0) t24hr_alarm = .true.
01369
01370 call seq_infodata_putData(infodata, glcrun_alarm=glcrun_alarm)
01371
01372 if (seq_timemgr_alarmIsOn(EClock_d,seq_timemgr_alarm_datestop)) then
01373 if (iamroot_CPLID) then
01374 write(logunit,*) ' '
01375 write(logunit,103) subname,' NOTE: Stopping from alarm STOP DATE'
01376 write(logunit,*) ' '
01377 endif
01378 stop_alarm = .true.
01379 endif
01380
01381
01382
01383
01384
01385
01386 if (ocnrun_alarm) ocnrun_count = ocnrun_count + 1
01387 if (ocnrun_count > 1) skip_ocean_run = .false.
01388 if (skip_ocean_run) then
01389 ocnrun_alarm = .false.
01390 ocnnext_alarm = .false.
01391 endif
01392
01393 if (iamroot_CPLID) then
01394 if (loglevel > 1) then
01395 write(logunit,102) ' Alarm_state: model date = ',ymd,tod, &
01396 ' aliog run alarms = ', atmrun_alarm, lndrun_alarm, &
01397 icerun_alarm, ocnrun_alarm, glcrun_alarm
01398 write(logunit,102) ' Alarm_state: model date = ',ymd,tod, &
01399 ' 1.2.3.6.12 run alarms = ', t1hr_alarm, t2hr_alarm, &
01400 t3hr_alarm, t6hr_alarm, t12hr_alarm, t24hr_alarm
01401 call shr_sys_flush(logunit)
01402 endif
01403 endif
01404
01405 call t_drvstopf ('DRIVER_CLOCK_ADVANCE',cplrun=.true.)
01406
01407
01408
01409
01410
01411
01412 if (iamin_CPLID .and. (ice_present.or.ocn_present)) then
01413 call t_drvstartf ('DRIVER_OCNPREP',cplrun=.true.,barrier=mpicom_CPLID)
01414 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01415 call t_drvstartf ('driver_ocnprep_atm2ocn',barrier=mpicom_CPLID)
01416 call map_atm2ocn_mct( cdata_ax, a2x_ax, cdata_ox, a2x_ox, &
01417 fluxlist=seq_flds_a2x_fluxes, statelist=seq_flds_a2x_states )
01418 call t_drvstopf ('driver_ocnprep_atm2ocn')
01419 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01420 call t_drvstopf ('DRIVER_OCNPREP',cplrun=.true.)
01421 endif
01422
01423
01424
01425
01426
01427 if (ocn_present .and. ocnrun_alarm) then
01428
01429
01430
01431
01432
01433 if (iamin_CPLOCNID .and. cpl2ocn_first) then
01434
01435
01436
01437 if (iamin_OCNID) call t_drvstartf ('DRIVER_C2O_INITWAIT')
01438 call mpi_barrier(mpicom_CPLOCNID,ierr)
01439 if (iamin_OCNID) call t_drvstopf ('DRIVER_C2O_INITWAIT')
01440 cpl2ocn_first = .false.
01441 endif
01442
01443
01444
01445
01446
01447 if (iamin_CPLID .and. ocn_prognostic) then
01448 call t_drvstartf ('DRIVER_OCNPREP',cplrun=.true.,barrier=mpicom_CPLID)
01449 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01450 call t_drvstartf ('driver_ocnprep_avg',barrier=mpicom_CPLID)
01451
01452
01453 if (x2oacc_ox_cnt > 0) then
01454 x2oacc_ox%data%rAttr = x2oacc_ox%data%rAttr / (x2oacc_ox_cnt*1.0_r8)
01455 endif
01456 x2oacc_ox_cnt = 0
01457 call t_drvstopf ('driver_ocnprep_avg')
01458 if (rof_present .and. ocnrof_prognostic) then
01459
01460 if (r2xacc_rx_cnt > 0) then
01461 call t_drvstartf ('driver_ocnprep_ravg',barrier=mpicom_CPLID)
01462 r2xacc_rx%data%rAttr = r2xacc_rx%data%rAttr / (r2xacc_rx_cnt*1.0_r8)
01463 r2xacc_rx_cnt = 0
01464 call t_drvstopf ('driver_ocnprep_ravg')
01465 call t_drvstartf ('driver_ocnprep_rof2ocn',barrier=mpicom_CPLID)
01466 call map_rof2ocn_mct( cdata_rx, r2xacc_rx%data, cdata_ox, r2x_ox )
01467 if (do_hist_r2x) then
01468 call seq_hist_writeaux(EClock_d,'r2xacc','domr',cdata_rx,r2xacc_rx%data, &
01469 rof_nx,rof_ny,1)
01470 endif
01471 call t_drvstopf ('driver_ocnprep_rof2ocn')
01472 call t_drvstartf ('driver_ocnprep_rofcopy',barrier=mpicom_CPLID)
01473 call mct_aVect_copy(aVin=r2x_ox, aVout=x2oacc_ox%data)
01474 call t_drvstopf ('driver_ocnprep_rofcopy')
01475 endif
01476 endif
01477 if (info_debug > 1) then
01478 call t_drvstartf ('driver_ocnprep_diagav',barrier=mpicom_CPLID)
01479 call seq_diag_avect_mct(cdata_ox,x2oacc_ox%data,'send ocn')
01480 call t_drvstopf ('driver_ocnprep_diagav')
01481 endif
01482 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01483 call t_drvstopf ('DRIVER_OCNPREP',cplrun=.true.)
01484 endif
01485
01486
01487
01488
01489
01490 if (iamin_CPLOCNID .and. ocn_prognostic) then
01491 call t_drvstartf ('DRIVER_C2O',barrier=mpicom_CPLOCNID)
01492 call t_drvstartf ('driver_c2o_ocnx2ocno',barrier=mpicom_CPLOCNID)
01493 call map_ocnx2ocno_mct( cdata_ox, x2oacc_ox%data, cdata_oo, x2o_oo)
01494 call t_drvstopf ('driver_c2o_ocnx2ocno')
01495 call t_drvstartf ('driver_c2o_infoexch',barrier=mpicom_CPLOCNID)
01496 call seq_infodata_exchange(infodata,CPLOCNID,'cpl2ocn_run')
01497 call t_drvstopf ('driver_c2o_infoexch')
01498 call t_drvstopf ('DRIVER_C2O')
01499 endif
01500
01501 endif
01502
01503
01504
01505
01506
01507 if (lnd_present .and. lndrun_alarm) then
01508
01509
01510
01511
01512
01513 if (iamin_CPLID) then
01514 call t_drvstartf ('DRIVER_LNDPREP',cplrun=.true.,barrier=mpicom_CPLID)
01515 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01516
01517 if (lnd_prognostic) then
01518 call t_drvstartf ('driver_lndprep_atm2lnd',barrier=mpicom_CPLID)
01519 call map_atm2lnd_mct( cdata_ax, a2x_ax, cdata_lx, a2x_lx )
01520 call t_drvstopf ('driver_lndprep_atm2lnd')
01521 call t_drvstartf ('driver_lndprep_mrgx2l',barrier=mpicom_CPLID)
01522 call mrg_x2l_run_mct( cdata_lx, a2x_lx, x2l_lx )
01523 call t_drvstopf ('driver_lndprep_mrgx2l')
01524 if (info_debug > 1) then
01525 call t_drvstartf ('driver_lndprep_diagav',barrier=mpicom_CPLID)
01526 call seq_diag_avect_mct(cdata_lx,x2l_lx,'send lnd')
01527 call t_drvstopf ('driver_lndprep_diagav')
01528 endif
01529 endif
01530
01531 if (glc_present .and. sno_prognostic) then
01532 if (info_debug > 1) then
01533 call t_drvstartf ('driver_lndprep_diagav',barrier=mpicom_CPLID)
01534 call seq_diag_avect_mct(cdata_sx,x2s_sx,'send sno')
01535 call t_drvstopf ('driver_lndprep_diagav')
01536 endif
01537 endif
01538
01539 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01540 call t_drvstopf ('DRIVER_LNDPREP',cplrun=.true.)
01541 endif
01542
01543
01544
01545
01546
01547 if (iamin_CPLLNDID) then
01548 call t_drvstartf ('DRIVER_C2L',barrier=mpicom_CPLLNDID)
01549 if (lnd_prognostic) then
01550 call t_drvstartf ('driver_c2l_lndx2lndl',barrier=mpicom_CPLLNDID)
01551 call map_lndx2lndl_mct( cdata_lx, x2l_lx, cdata_ll, x2l_ll)
01552 call t_drvstopf ('driver_c2l_lndx2lndl')
01553 endif
01554 if (glc_present .and. sno_prognostic) then
01555 call t_drvstartf ('driver_c2l_snox2snos',barrier=mpicom_CPLLNDID)
01556 call map_snox2snos_mct( cdata_sx, x2s_sx, cdata_ss, x2s_ss)
01557 call t_drvstopf ('driver_c2l_snox2snos')
01558 endif
01559 if (lnd_prognostic .or. sno_prognostic) then
01560 call t_drvstartf ('driver_c2l_infoexch',barrier=mpicom_CPLLNDID)
01561 call seq_infodata_exchange(infodata,CPLLNDID,'cpl2lnd_run')
01562 call t_drvstopf ('driver_c2l_infoexch')
01563 endif
01564 call t_drvstopf ('DRIVER_C2L')
01565 endif
01566
01567 endif
01568
01569
01570
01571
01572
01573
01574
01575
01576 if (ice_present .and. icerun_alarm) then
01577
01578
01579
01580
01581
01582 if (iamin_CPLID .and. ice_prognostic) then
01583 call t_drvstartf ('DRIVER_ICEPREP',cplrun=.true.,barrier=mpicom_CPLID)
01584 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01585 call t_drvstartf ('driver_iceprep_ocn2ice',barrier=mpicom_CPLID)
01586 call map_ocn2ice_mct( cdata_ox, o2x_ox, cdata_ix, o2x_ix )
01587 call t_drvstopf ('driver_iceprep_ocn2ice')
01588
01589 call t_drvstartf ('driver_iceprep_atm2ice',barrier=mpicom_CPLID)
01590 call map_ocn2ice_mct( cdata_ox, a2x_ox, cdata_ix, a2x_ix )
01591
01592 call t_drvstopf ('driver_iceprep_atm2ice')
01593
01594 call t_drvstartf ('driver_iceprep_mrgx2i',barrier=mpicom_CPLID)
01595 call mrg_x2i_run_mct( cdata_ix, a2x_ix, o2x_ix, x2i_ix )
01596 call t_drvstopf ('driver_iceprep_mrgx2i')
01597
01598 if (info_debug > 1) then
01599 call t_drvstartf ('driver_iceprep_diagav',barrier=mpicom_CPLID)
01600 call seq_diag_avect_mct(cdata_ix,x2i_ix,'send ice')
01601 call t_drvstopf ('driver_iceprep_diagav')
01602 endif
01603 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01604 call t_drvstopf ('DRIVER_ICEPREP',cplrun=.true.)
01605 endif
01606
01607
01608
01609
01610
01611 if (iamin_CPLICEID .and. ice_prognostic) then
01612 call t_drvstartf ('DRIVER_C2I',barrier=mpicom_CPLICEID)
01613 call t_drvstartf ('driver_c2i_icex2icei',barrier=mpicom_CPLICEID)
01614 call map_icex2icei_mct( cdata_ix, x2i_ix, cdata_ii, x2i_ii)
01615 call t_drvstopf ('driver_c2i_icex2icei')
01616 call t_drvstartf ('driver_c2i_infoexch',barrier=mpicom_CPLICEID)
01617 call seq_infodata_exchange(infodata,CPLICEID,'cpl2ice_run')
01618 call t_drvstopf ('driver_c2i_infoexch')
01619 call t_drvstopf ('DRIVER_C2I')
01620 endif
01621
01622 endif
01623
01624
01625
01626
01627
01628 if (ocn_present .and. ocnrun_alarm .and. iamin_OCNID) then
01629 call t_drvstartf ('DRIVER_OCN_RUN',barrier=mpicom_OCNID)
01630 if (drv_threading) call seq_comm_setnthreads(nthreads_OCNID)
01631 if (ocn_prognostic) call mct_avect_vecmult(x2o_oo,drv2mdl_oo,seq_flds_x2o_fluxes)
01632 call ocn_run_mct( EClock_o, cdata_oo, x2o_oo, o2x_oo)
01633 call mct_avect_vecmult(o2x_oo,mdl2drv_oo,seq_flds_o2x_fluxes)
01634 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01635 call t_drvstopf ('DRIVER_OCN_RUN')
01636 endif
01637
01638
01639
01640
01641
01642 if (ice_present .and. icerun_alarm .and. iamin_ICEID) then
01643 call t_drvstartf ('DRIVER_ICE_RUN',barrier=mpicom_ICEID)
01644 if (drv_threading) call seq_comm_setnthreads(nthreads_ICEID)
01645 if (ice_prognostic) call mct_avect_vecmult(x2i_ii,drv2mdl_ii,seq_flds_x2i_fluxes)
01646 call ice_run_mct( EClock_i, cdata_ii, x2i_ii, i2x_ii)
01647 call mct_avect_vecmult(i2x_ii,mdl2drv_ii,seq_flds_i2x_fluxes)
01648 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01649 call t_drvstopf ('DRIVER_ICE_RUN')
01650 endif
01651
01652
01653
01654
01655
01656 if ((lnd_present.or.rof_present.or.sno_present) .and. &
01657 lndrun_alarm .and. iamin_LNDID) then
01658 call t_drvstartf ('DRIVER_LND_RUN',barrier=mpicom_LNDID)
01659 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
01660 if (lnd_prognostic) then
01661 call mct_avect_vecmult(x2l_ll,drv2mdl_ll,seq_flds_x2l_fluxes)
01662 endif
01663 if (sno_prognostic) then
01664 call mct_avect_vecmult(x2s_ss,drv2mdl_ss,seq_flds_x2s_fluxes)
01665 endif
01666 call lnd_run_mct( EClock_l, cdata_ll, x2l_ll, l2x_ll, &
01667 cdata_rr, r2x_rr, &
01668 cdata_ss, x2s_ss, s2x_ss)
01669 call mct_avect_vecmult(l2x_ll,mdl2drv_ll,seq_flds_l2x_fluxes)
01670 if (rof_present) then
01671 call mct_avect_vecmult(r2x_rr,mdl2drv_rr,seq_flds_r2x_fluxes)
01672 endif
01673 if (sno_present) then
01674 call mct_avect_vecmult(s2x_ss,mdl2drv_ss,seq_flds_s2x_fluxes)
01675 endif
01676 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01677 call t_drvstopf ('DRIVER_LND_RUN')
01678 endif
01679
01680
01681
01682
01683
01684 if (ocean_tight_coupling) then
01685 if (ocn_present .and. ocnnext_alarm) then
01686 if (iamin_CPLOCNID) then
01687 call t_drvstartf ('DRIVER_O2C',barrier=mpicom_CPLOCNID)
01688 call t_drvstartf ('driver_o2c_ocno2ocnx',barrier=mpicom_CPLOCNID)
01689 call map_ocno2ocnx_mct( cdata_oo, o2x_oo, cdata_ox, o2x_ox)
01690 call t_drvstopf ('driver_o2c_ocno2ocnx')
01691 call t_drvstartf ('driver_o2c_infoexch',barrier=mpicom_CPLOCNID)
01692 call seq_infodata_exchange(infodata,CPLOCNID,'ocn2cpl_run')
01693 call t_drvstopf ('driver_o2c_infoexch')
01694 call t_drvstopf ('DRIVER_O2C')
01695 endif
01696 if (iamin_CPLID) then
01697 call t_drvstartf ('DRIVER_OCNPOST',cplrun=.true.,barrier=mpicom_CPLID)
01698 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01699 if (info_debug > 1) then
01700 call t_drvstartf ('driver_ocnpost_diagav',barrier=mpicom_CPLID)
01701 call seq_diag_avect_mct(cdata_ox,o2x_ox,'recv ocn')
01702 call t_drvstopf ('driver_ocnpost_diagav')
01703 endif
01704 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01705 call t_drvstopf ('DRIVER_OCNPOST',cplrun=.true.)
01706 endif
01707 endif
01708 endif
01709
01710
01711
01712
01713
01714 if (ocn_present .and. iamin_CPLID) then
01715 call t_drvstartf ('DRIVER_ATMOCNP',cplrun=.true.,barrier=mpicom_CPLID)
01716 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01717 if (ocn_prognostic) then
01718
01719
01720 if (ice_present) then
01721 call t_drvstartf ('driver_atmocnp_ice2ocn',barrier=mpicom_CPLID)
01722 call map_ice2ocn_mct( cdata_ix, i2x_ix, cdata_ox, i2x_ox)
01723 call t_drvstopf ('driver_atmocnp_ice2ocn')
01724 endif
01725
01726
01727 if (trim(aoflux_grid) == 'atm') then
01728 call t_drvstartf ('driver_atmocnp_atm2ocn',barrier=mpicom_CPLID)
01729 call map_atm2ocn_mct( cdata_ax, xao_ax, cdata_ox, xao_ox, &
01730 fluxlist=seq_flds_xao_fluxes, statelist=seq_flds_xao_states )
01731 call t_drvstopf ('driver_atmocnp_atm2ocn')
01732 endif
01733
01734
01735 call t_drvstartf ('driver_atmocnp_mrgx2o',barrier=mpicom_CPLID)
01736 call mrg_x2o_run_mct( cdata_ox, a2x_ox, i2x_ox, xao_ox, fractions_ox, x2o_ox )
01737 call t_drvstopf ('driver_atmocnp_mrgx2o')
01738
01739
01740
01741 call t_drvstartf ('driver_atmocnp_accum',barrier=mpicom_CPLID)
01742
01743 if (x2oacc_ox_cnt == 0) then
01744 x2oacc_ox%data%rAttr = x2o_ox%rAttr
01745 else
01746 x2oacc_ox%data%rAttr = x2oacc_ox%data%rAttr + x2o_ox%rAttr
01747 endif
01748 x2oacc_ox_cnt = x2oacc_ox_cnt + 1
01749 call t_drvstopf ('driver_atmocnp_accum')
01750 endif
01751
01752
01753 if (trim(aoflux_grid) == 'ocn') then
01754 call t_drvstartf ('driver_atmocnp_flux',barrier=mpicom_CPLID)
01755 call seq_flux_atmocn_mct( cdata_ox, a2x_ox, o2x_ox, xao_ox, fractions_ox )
01756 call t_drvstopf ('driver_atmocnp_flux')
01757 endif
01758
01759 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01760 call t_drvstopf ('DRIVER_ATMOCNP',cplrun=.true.)
01761 endif
01762
01763
01764
01765
01766
01767 if ((lnd_present.or.rof_present.or.sno_present) .and. lndrun_alarm) then
01768
01769 if (iamin_CPLLNDID) then
01770 call t_drvstartf ('DRIVER_L2C',barrier=mpicom_CPLLNDID)
01771 if (lnd_present) then
01772 call t_drvstartf ('driver_l2c_lndl2lndx',barrier=mpicom_CPLLNDID)
01773 call map_lndl2lndx_mct( cdata_ll, l2x_ll, cdata_lx, l2x_lx)
01774 call t_drvstopf ('driver_l2c_lndl2lndx')
01775 endif
01776 if (rof_present) then
01777 call t_drvstartf ('driver_l2c_rofr2rofx',barrier=mpicom_CPLLNDID)
01778 call map_rofr2rofx_mct( cdata_rr, r2x_rr, cdata_rx, r2x_rx)
01779 call t_drvstopf ('driver_l2c_rofr2rofx')
01780 endif
01781 if (sno_present .and. glc_prognostic .and. glcrun_alarm) then
01782 call t_drvstartf ('driver_l2c_snos2snox',barrier=mpicom_CPLLNDID)
01783 call map_snos2snox_mct( cdata_ss, s2x_ss, cdata_sx, s2x_sx)
01784 call t_drvstopf ('driver_l2c_snos2snox')
01785 endif
01786 call t_drvstartf ('driver_l2c_infoexch',barrier=mpicom_CPLLNDID)
01787 call seq_infodata_exchange(infodata,CPLLNDID,'lnd2cpl_run')
01788 call t_drvstopf ('driver_l2c_infoexch')
01789 call t_drvstopf ('DRIVER_L2C')
01790 endif
01791
01792 if (iamin_CPLID) then
01793 call t_drvstartf ('DRIVER_LNDPOST',cplrun=.true.,barrier=mpicom_CPLID)
01794 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01795 if (info_debug > 1) then
01796 call t_drvstartf ('driver_lndpost_diagav',barrier=mpicom_CPLID)
01797 if (lnd_present) then
01798 call seq_diag_avect_mct(cdata_lx,l2x_lx,'recv lnd')
01799 endif
01800 if (rof_present) then
01801 call seq_diag_avect_mct(cdata_rx,r2x_rx,'recv roff')
01802 endif
01803 if (sno_present .and. glc_prognostic .and. glcrun_alarm) then
01804 call seq_diag_avect_mct(cdata_sx,s2x_sx,'recv sno')
01805 endif
01806 call t_drvstopf ('driver_lndpost_diagav')
01807 endif
01808 if (rof_present .and. ocnrof_prognostic) then
01809 call t_drvstartf ('driver_lndpost_raccum',barrier=mpicom_CPLID)
01810 if (r2xacc_rx_cnt == 0) then
01811 r2xacc_rx%data%rAttr = r2x_rx%rAttr
01812 else
01813 r2xacc_rx%data%rAttr = r2xacc_rx%data%rAttr + r2x_rx%rAttr
01814 endif
01815 r2xacc_rx_cnt = r2xacc_rx_cnt + 1
01816 call t_drvstopf ('driver_lndpost_raccum')
01817 endif
01818 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01819 call t_drvstopf ('DRIVER_LNDPOST',cplrun=.true.)
01820 endif
01821
01822 endif
01823
01824
01825
01826
01827
01828 if (sno_present .and. glcrun_alarm) then
01829 if (iamin_CPLID .and. glc_prognostic) then
01830 call t_drvstartf ('DRIVER_GLCPREP',cplrun=.true.,barrier=mpicom_CPLID)
01831 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01832
01833
01834 call t_drvstartf ('driver_glcprep_sno2glc',barrier=mpicom_CPLID)
01835 call map_sno2glc_mct( cdata_sx, s2x_sx, cdata_gx, s2x_gx )
01836 call t_drvstopf ('driver_glcprep_sno2glc')
01837
01838
01839 call t_drvstartf ('driver_glcprep_mrgx2g',barrier=mpicom_CPLID)
01840 call mrg_x2g_run_mct( cdata_gx, s2x_gx, x2g_gx)
01841 call t_drvstopf ('driver_glcprep_mrgx2g')
01842
01843 if (info_debug > 1) then
01844 call t_drvstartf ('driver_glcprep_diagav',barrier=mpicom_CPLID)
01845 call seq_diag_avect_mct(cdata_gx,x2g_gx,'send glc')
01846 call t_drvstopf ('driver_glcprep_diagav')
01847 endif
01848
01849 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01850 call t_drvstopf ('DRIVER_GLCPREP',cplrun=.true.)
01851 endif
01852
01853
01854
01855
01856
01857 if (iamin_CPLGLCID .and. glc_prognostic) then
01858 call t_drvstartf ('DRIVER_C2G',barrier=mpicom_CPLGLCID)
01859 call t_drvstartf ('driver_c2g_glcx2glcg',barrier=mpicom_CPLGLCID)
01860 call map_glcx2glcg_mct( cdata_gx, x2g_gx, cdata_gg, x2g_gg)
01861 call t_drvstopf ('driver_c2g_glcx2glcg')
01862 call t_drvstartf ('driver_c2g_infoexch',barrier=mpicom_CPLGLCID)
01863 call seq_infodata_exchange(infodata,CPLGLCID,'cpl2glc_run')
01864 call t_drvstopf ('driver_c2g_infoexch')
01865 call t_drvstopf ('DRIVER_C2G')
01866 endif
01867 endif
01868
01869
01870
01871
01872
01873 #if (defined NEW_BUDGET)
01874 if (iamin_CPLID .and. do_budgets) then
01875 call t_drvstartf ('DRIVER_BUDGET1',cplrun=.true.,budget=.true.,barrier=mpicom_CPLID)
01876 if (lnd_present) then
01877 call seq_diag_lnd_mct(dom_lx, fractions_lx, l2x_l=l2x_lx, x2l_l=x2l_lx)
01878 endif
01879 if (rof_present) then
01880 call seq_diag_rtm_mct(dom_rx, r2x_r=r2x_rx)
01881 endif
01882 if (ocn_present) then
01883
01884 call seq_diag_ocn_mct(dom_ox, fractions_ox, o2x_o=o2x_ox, x2o_o=x2o_ox, xao_o=xao_ox, r2x_o=r2x_ox)
01885 endif
01886 if (ice_present) then
01887 call seq_diag_ice_mct(dom_ix, fractions_ix, x2i_i=x2i_ix)
01888 endif
01889 call t_drvstopf ('DRIVER_BUDGET1',cplrun=.true.,budget=.true.)
01890 endif
01891 #endif
01892
01893
01894
01895
01896
01897 if (ice_present .and. icerun_alarm) then
01898 if (iamin_CPLICEID) then
01899 call t_drvstartf ('DRIVER_I2C',barrier=mpicom_CPLICEID)
01900 call t_drvstartf ('driver_i2c_icei2icex',barrier=mpicom_CPLICEID)
01901 call map_icei2icex_mct( cdata_ii, i2x_ii, cdata_ix, i2x_ix)
01902 call t_drvstopf ('driver_i2c_icei2icex')
01903 call t_drvstartf ('driver_i2c_infoexch',barrier=mpicom_CPLICEID)
01904 call seq_infodata_exchange(infodata,CPLICEID,'ice2cpl_run')
01905 call t_drvstopf ('driver_i2c_infoexch')
01906 call t_drvstopf ('DRIVER_I2C')
01907 endif
01908
01909 if (iamin_CPLID) then
01910 call t_drvstartf ('DRIVER_ICEPOST',cplrun=.true.,barrier=mpicom_CPLID)
01911 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01912 if (info_debug > 1) then
01913 call t_drvstartf ('driver_icepost_diagav',barrier=mpicom_CPLID)
01914 call seq_diag_avect_mct(cdata_ix,i2x_ix,'recv ice')
01915 call t_drvstopf ('driver_icepost_diagav')
01916 endif
01917 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01918 call t_drvstopf ('DRIVER_ICEPOST',cplrun=.true.)
01919 endif
01920
01921 endif
01922
01923
01924
01925
01926
01927 if (iamin_CPLID) then
01928 call t_drvstartf ('DRIVER_FRACSET',cplrun=.true.,barrier=mpicom_CPLID)
01929 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01930 call t_drvstartf ('driver_fracset_fracset',barrier=mpicom_CPLID)
01931 call seq_frac_set(i2x_ix, &
01932 cdata_ax, cdata_ix, cdata_lx, cdata_ox, cdata_gx, &
01933 ice_present, ocn_present, lnd_present, glc_present, &
01934 fractions_ax, fractions_ix, fractions_lx, fractions_ox, &
01935 fractions_gx)
01936 call t_drvstopf ('driver_fracset_fracset')
01937 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
01938 call t_drvstopf ('DRIVER_FRACSET',cplrun=.true.)
01939 endif
01940
01941
01942
01943
01944
01945 if (atm_present .and. atmrun_alarm) then
01946
01947
01948
01949
01950
01951 if (iamin_CPLID) then
01952 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
01953 call t_drvstartf ('DRIVER_ATMPREP',cplrun=.true.,barrier=mpicom_CPLID)
01954 if (atm_prognostic .or. trim(aoflux_grid) == 'atm') then
01955 if (ocn_present) then
01956 call t_drvstartf ('driver_atmprep_ocn2atm1',barrier=mpicom_CPLID)
01957
01958 call map_ocn2atm_mct( cdata_ox, o2x_ox, cdata_ax, o2x_ax, &
01959 fractions_o=fractions_ox, fractions_a=fractions_ax, &
01960 statelist=seq_flds_o2x_states )
01961 call map_ocn2atm_mct( cdata_ox, o2x_ox, cdata_ax, o2x_ax, &
01962 fluxlist=seq_flds_o2x_fluxes )
01963 call t_drvstopf ('driver_atmprep_ocn2atm1')
01964 if (trim(aoflux_grid) == 'atm') then
01965 call t_drvstartf ('driver_atmprep_flux',barrier=mpicom_CPLID)
01966 call seq_flux_atmocn_mct( cdata_ax, a2x_ax, o2x_ax, xao_ax, fractions_ox )
01967 call t_drvstopf ('driver_atmprep_flux')
01968 endif
01969 endif
01970 endif
01971 if (atm_prognostic) then
01972 if (ocn_present) then
01973 if (trim(aoflux_grid) == 'ocn') then
01974 call t_drvstartf ('driver_atmprep_ocn2atm2',barrier=mpicom_CPLID)
01975 call map_ocn2atm_mct( cdata_ox, xao_ox, cdata_ax, xao_ax, &
01976 fractions_o=fractions_ox, fractions_a=fractions_ax, &
01977 fluxlist=seq_flds_xao_fluxes, statelist=seq_flds_xao_states )
01978 call t_drvstopf ('driver_atmprep_ocn2atm2')
01979 endif
01980 endif
01981 if (ice_present) then
01982 call t_drvstartf ('driver_atmprep_ice2atm',barrier=mpicom_CPLID)
01983 call map_ice2atm_mct( cdata_ix, i2x_ix, cdata_ax, i2x_ax, &
01984 fractions_i=fractions_ix, fractions_a=fractions_ax, &
01985 fluxlist=seq_flds_i2x_fluxes, statelist=seq_flds_i2x_states )
01986 call t_drvstopf ('driver_atmprep_ice2atm')
01987 endif
01988 if (lnd_present) then
01989 call t_drvstartf ('driver_atmprep_lnd2atm',barrier=mpicom_CPLID)
01990 call map_lnd2atm_mct( cdata_lx, l2x_lx, cdata_ax, l2x_ax , &
01991 fractions_l=fractions_lx, fractions_a=fractions_ax, &
01992 fluxlist=seq_flds_l2x_fluxes, statelist=seq_flds_l2x_states )
01993 call t_drvstopf ('driver_atmprep_lnd2atm')
01994 endif
01995 call t_drvstartf ('driver_atmprep_mrgx2a',barrier=mpicom_CPLID)
01996 call mrg_x2a_run_mct( cdata_ax, l2x_ax, o2x_ax, xao_ax, i2x_ax, fractions_ax, x2a_ax )
01997 call t_drvstopf ('driver_atmprep_mrgx2a')
01998
01999 if (info_debug > 1) then
02000 call t_drvstartf ('driver_atmprep_diagav',barrier=mpicom_CPLID)
02001 call seq_diag_avect_mct(cdata_ax,x2a_ax,'send atm')
02002 call t_drvstopf ('driver_atmprep_diagav')
02003 endif
02004 endif
02005 call t_drvstopf ('DRIVER_ATMPREP',cplrun=.true.)
02006 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02007 endif
02008
02009
02010
02011
02012
02013 if (iamin_CPLATMID .and. atm_prognostic) then
02014 call t_drvstartf ('DRIVER_C2A',barrier=mpicom_CPLATMID)
02015 call t_drvstartf ('driver_c2a_atmx2atma',barrier=mpicom_CPLATMID)
02016 call map_atmx2atma_mct( cdata_ax, x2a_ax, cdata_aa, x2a_aa)
02017 call t_drvstopf ('driver_c2a_atmx2atma')
02018 call t_drvstartf ('driver_c2a_infoexch',barrier=mpicom_CPLATMID)
02019 call seq_infodata_exchange(infodata,CPLATMID,'cpl2atm_run')
02020 call t_drvstopf ('driver_c2a_infoexch')
02021 call t_drvstopf ('DRIVER_C2A')
02022 endif
02023
02024 endif
02025
02026
02027
02028
02029
02030 if (atm_present .and. atmrun_alarm .and. iamin_ATMID) then
02031 call t_drvstartf ('DRIVER_ATM_RUN',barrier=mpicom_ATMID)
02032 if (drv_threading) call seq_comm_setnthreads(nthreads_ATMID)
02033 if (atm_prognostic) call mct_avect_vecmult(x2a_aa,drv2mdl_aa,seq_flds_x2a_fluxes)
02034 call atm_run_mct( EClock_a, cdata_aa, x2a_aa, a2x_aa)
02035 call mct_avect_vecmult(a2x_aa,mdl2drv_aa,seq_flds_a2x_fluxes)
02036 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02037 call t_drvstopf ('DRIVER_ATM_RUN')
02038 endif
02039
02040
02041
02042
02043
02044 if (glc_present .and. glcrun_alarm .and. iamin_GLCID) then
02045 call t_drvstartf ('DRIVER_GLC_RUN',barrier=mpicom_GLCID)
02046 if (drv_threading) call seq_comm_setnthreads(nthreads_GLCID)
02047 if (glc_prognostic) call mct_avect_vecmult(x2g_gg,drv2mdl_gg,seq_flds_x2g_fluxes)
02048 call glc_run_mct( EClock_g, cdata_gg, x2g_gg, g2x_gg)
02049 call mct_avect_vecmult(g2x_gg,mdl2drv_gg,seq_flds_g2x_fluxes)
02050 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02051 call t_drvstopf ('DRIVER_GLC_RUN')
02052 endif
02053
02054
02055
02056
02057
02058 if (glc_present .and. sno_prognostic .and. glcrun_alarm) then
02059
02060 if (iamin_CPLGLCID) then
02061 call t_drvstartf ('DRIVER_G2C',barrier=mpicom_CPLGLCID)
02062 call t_drvstartf ('driver_g2c_glcg2glcx',barrier=mpicom_CPLGLCID)
02063 call map_glcg2glcx_mct( cdata_gg, g2x_gg, cdata_gx, g2x_gx)
02064 call t_drvstopf ('driver_g2c_glcg2glcx')
02065 call t_drvstartf ('driver_g2c_infoexch',barrier=mpicom_CPLGLCID)
02066 call seq_infodata_exchange(infodata,CPLGLCID,'glc2cpl_run')
02067 call t_drvstopf ('driver_g2c_infoexch')
02068 call t_drvstopf ('DRIVER_G2C')
02069 endif
02070
02071 if (iamin_CPLID) then
02072 call t_drvstartf ('DRIVER_GLCPOST',cplrun=.true.,barrier=mpicom_CPLID)
02073 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
02074 if (info_debug > 1) then
02075 call t_drvstartf ('driver_glcpost_diagav',barrier=mpicom_CPLID)
02076 call seq_diag_avect_mct(cdata_gx,g2x_gx,'recv glc')
02077 call t_drvstopf ('driver_glcpost_diagav')
02078 endif
02079 call t_drvstartf ('driver_glcpost_glc2sno',barrier=mpicom_CPLID)
02080 call map_glc2sno_mct( cdata_gx, g2x_gx, cdata_sx, g2x_sx )
02081 call t_drvstopf ('driver_glcpost_glc2sno')
02082 call t_drvstartf ('driver_glcpost_mrgx2s',barrier=mpicom_CPLID)
02083 call mrg_x2s_run_mct( cdata_sx, g2x_sx, x2s_sx )
02084 call t_drvstopf ('driver_glcpost_mrgx2s')
02085 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02086 call t_drvstopf ('DRIVER_GLCPOST',cplrun=.true.)
02087 endif
02088
02089 endif
02090
02091
02092
02093
02094
02095 if (atm_present .and. atmrun_alarm) then
02096 if (iamin_CPLATMID) then
02097 call t_drvstartf ('DRIVER_A2C',barrier=mpicom_CPLATMID)
02098 call t_drvstartf ('driver_a2c_atma2atmx',barrier=mpicom_CPLATMID)
02099 call map_atma2atmx_mct( cdata_aa, a2x_aa, cdata_ax, a2x_ax)
02100 call t_drvstopf ('driver_a2c_atma2atmx')
02101 call t_drvstartf ('driver_a2c_infoexch',barrier=mpicom_CPLATMID)
02102 call seq_infodata_exchange(infodata,CPLATMID,'atm2cpl_run')
02103 call t_drvstopf ('driver_a2c_infoexch')
02104 call t_drvstopf ('DRIVER_A2C')
02105 endif
02106
02107 if (iamin_CPLID) then
02108 call t_drvstartf ('DRIVER_ATMPOST',cplrun=.true.,barrier=mpicom_CPLID)
02109 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
02110 if (info_debug > 1) then
02111 call t_drvstartf ('driver_atmpost_diagav',barrier=mpicom_CPLID)
02112 call seq_diag_avect_mct(cdata_ax,a2x_ax,'recv atm')
02113 call t_drvstopf ('driver_atmpost_diagav')
02114 endif
02115 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02116 call t_drvstopf ('DRIVER_ATMPOST',cplrun=.true.)
02117 endif
02118
02119 endif
02120
02121
02122
02123
02124
02125 #if (defined NEW_BUDGET)
02126 if (iamin_CPLID .and. do_budgets) then
02127 call t_drvstartf ('DRIVER_BUDGET2',cplrun=.true.,budget=.true.,barrier=mpicom_CPLID)
02128 if (atm_present) then
02129 call seq_diag_atm_mct(dom_ax, fractions_ax, a2x_a=a2x_ax, x2a_a=x2a_ax)
02130 endif
02131 if (ice_present) then
02132 call seq_diag_ice_mct(dom_ix, fractions_ix, i2x_i=i2x_ix)
02133 endif
02134 call t_drvstopf ('DRIVER_BUDGET2',cplrun=.true.,budget=.true.)
02135 endif
02136 if (iamin_CPLID .and. do_budgets) then
02137 call t_drvstartf ('DRIVER_BUDGET3',cplrun=.true.,budget=.true.,barrier=mpicom_CPLID)
02138 call seq_diag_accum_mct()
02139 call t_drvstopf ('DRIVER_BUDGET3',cplrun=.true.,budget=.true.)
02140 endif
02141 if (iamin_CPLID .and. do_budgets) then
02142 call t_drvstartf ('DRIVER_BUDGETF',cplrun=.true.,budget=.true.,barrier=mpicom_CPLID)
02143 if (.not. dead_comps) call seq_diag_print_mct(EClock_d,stop_alarm,budget_inst, &
02144 budget_daily, budget_month, budget_ann, budget_ltann, budget_ltend)
02145 call seq_diag_zero_mct(EClock=EClock_d)
02146 call t_drvstopf ('DRIVER_BUDGETF',cplrun=.true.,budget=.true.)
02147 endif
02148 #endif
02149
02150
02151
02152
02153
02154 if (.not.ocean_tight_coupling) then
02155 if (ocn_present .and. ocnnext_alarm) then
02156 if (iamin_CPLOCNID) then
02157 call t_drvstartf ('DRIVER_O2C',barrier=mpicom_CPLOCNID)
02158 call t_drvstartf ('driver_o2c_ocno2ocnx',barrier=mpicom_CPLOCNID)
02159 call map_ocno2ocnx_mct( cdata_oo, o2x_oo, cdata_ox, o2x_ox)
02160 call t_drvstopf ('driver_o2c_ocno2ocnx')
02161 call t_drvstartf ('driver_o2c_infoexch',barrier=mpicom_CPLOCNID)
02162 call seq_infodata_exchange(infodata,CPLOCNID,'ocn2cpl_run')
02163 call t_drvstopf ('driver_o2c_infoexch')
02164 call t_drvstopf ('DRIVER_O2C')
02165 endif
02166 if (iamin_CPLID) then
02167 call t_drvstartf ('DRIVER_OCNPOST',cplrun=.true.,barrier=mpicom_CPLID)
02168 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
02169 if (info_debug > 1) then
02170 call t_drvstartf ('driver_ocnpost_diagav',barrier=mpicom_CPLID)
02171 call seq_diag_avect_mct(cdata_ox,o2x_ox,'recv ocn')
02172 call t_drvstopf ('driver_ocnpost_diagav')
02173 endif
02174 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02175 call t_drvstopf ('DRIVER_OCNPOST',cplrun=.true.)
02176 endif
02177 endif
02178 endif
02179
02180
02181
02182
02183
02184 if ( restart_alarm .and. iamin_CPLID) then
02185 call t_drvstartf ('DRIVER_RESTART',cplrun=.true.,barrier=mpicom_CPLID)
02186 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
02187 if (iamroot_CPLID) then
02188 write(logunit,104) ' Write restart file at ',ymd,tod
02189 call shr_sys_flush(logunit)
02190 endif
02191 call seq_rest_write(EClock_d,seq_SyncClock)
02192 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02193 call t_drvstopf ('DRIVER_RESTART',cplrun=.true.)
02194 endif
02195
02196
02197
02198
02199
02200 if (iamin_CPLID) then
02201
02202 call t_drvstartf ('DRIVER_HISTORY',cplrun=.true.,barrier=mpicom_CPLID)
02203 if ( history_alarm) then
02204 if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
02205 if (iamroot_CPLID) then
02206 write(logunit,104) ' Write history file at ',ymd,tod
02207 call shr_sys_flush(logunit)
02208 endif
02209 call seq_hist_write(EClock_d)
02210 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02211 endif
02212
02213 if (do_histavg) then
02214 call seq_hist_writeavg(EClock_d,histavg_alarm)
02215 endif
02216
02217 if (do_hist_a2x) then
02218 if (trim(hist_a2x_flds) == 'all') then
02219 call seq_hist_writeaux(EClock_d,'a2x','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,ncpl)
02220 else
02221 call seq_hist_writeaux(EClock_d,'a2x','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,ncpl,&
02222 flds=hist_a2x_flds)
02223 endif
02224 endif
02225 if (do_hist_a2x3hr) then
02226 if (trim(hist_a2x3hr_flds) == 'all') then
02227 call seq_hist_writeaux(EClock_d,'a2x3h','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,8,t3hr_alarm)
02228 else
02229 call seq_hist_writeaux(EClock_d,'a2x3h','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,8,t3hr_alarm,&
02230 flds=hist_a2x3hr_flds)
02231 end if
02232 endif
02233 if (do_hist_a2x3hrp) then
02234 if (trim(hist_a2x3hrp_flds) == 'all') then
02235 call seq_hist_writeaux(EClock_d,'a2x3h_prec','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,8,t3hr_alarm)
02236 else
02237 call seq_hist_writeaux(EClock_d,'a2x3h_prec','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,8,t3hr_alarm,&
02238 flds=hist_a2x3hrp_flds)
02239 end if
02240 endif
02241 if (do_hist_a2x24hr) then
02242 call seq_hist_writeaux(EClock_d,'a2x1d','doma',cdata_ax,a2x_ax,atm_nx,atm_ny,1,t24hr_alarm)
02243 endif
02244 if (do_hist_l2x) then
02245 call seq_hist_writeaux(EClock_d,'l2x','doml',cdata_lx,l2x_lx,lnd_nx,lnd_ny,ncpl)
02246 endif
02247 call t_drvstopf ('DRIVER_HISTORY',cplrun=.true.)
02248
02249 end if
02250
02251
02252 call t_drvstartf ('DRIVER_TSTAMP_WRITE',cplrun=.true.)
02253 if (tod == 0 .or. info_debug > 1) then
02254 if (iamroot_CPLID) then
02255 call date_and_time(dstr,tstr)
02256 Time_estep = mpi_wtime()
02257 dtstep = time_estep-time_bstep
02258 dtstep_acc = dtstep_acc + dtstep
02259 dtstep_cnt = dtstep_cnt + 1
02260 write(logunit,101) ' tStamp_write: model date = ',ymd,tod, &
02261 ' wall clock = ',dstr(1:4),'-',dstr(5:6),'-',dstr(7:8),' ',&
02262 tstr(1:2),':',tstr(3:4),':',tstr(5:6), &
02263 ' avg dt = ',dtstep_acc/dtstep_cnt,' dt = ',dtstep
02264 Time_bstep = mpi_wtime()
02265 call shr_sys_flush(logunit)
02266 endif
02267 endif
02268 if (tod == 0) then
02269 if (iamroot_CPLID .or. iamroot_OCNID .or. iamroot_ATMID .or. &
02270 iamroot_LNDID .or. iamroot_ICEID .or. iamroot_GLCID) then
02271 call shr_mem_getusage(msize,mrss)
02272 write(logunit,105) ' memory_write: model date = ',ymd,tod, &
02273 ' memory = ',mrss,' MB (highwater) ',msize,' MB (usage)', &
02274 ' (pe=',iam_GLOID,' comps=',trim(complist)//')'
02275 endif
02276 endif
02277 if (info_debug > 1) then
02278 if (iamroot_CPLID) then
02279 call seq_infodata_GetData(infodata,nextsw_cday=nextsw_cday)
02280
02281 write(logunit,*) ' nextsw_cday = ',nextsw_cday
02282 endif
02283 endif
02284 call t_drvstopf ('DRIVER_TSTAMP_WRITE',cplrun=.true.)
02285
02286 call t_stopf ('DRIVER_RUN_LOOP')
02287
02288 call t_drvstartf ('DRIVER_TPROF_WRITE',cplrun=.true.)
02289 if (tprof_alarm) then
02290 call t_startf("sync1_tprof")
02291 call mpi_barrier(mpicom_GLOID,ierr)
02292 call t_stopf("sync1_tprof")
02293
02294 write(timing_file,'(a,i8.8,a1,i5.5)') trim(tchkpt_dir)//"/ccsm_timing_",ymd,"_",tod
02295 call t_prf(filename=trim(timing_file), mpicom=mpicom_GLOID, &
02296 num_outpe=1)
02297
02298 call t_startf("sync2_tprof")
02299 call mpi_barrier(mpicom_GLOID,ierr)
02300 call t_stopf("sync2_tprof")
02301 endif
02302 call t_drvstopf ('DRIVER_TPROF_WRITE',cplrun=.true.)
02303
02304 end do
02305 call t_startf ('DRIVER_RUN_LOOP_BSTOP')
02306 call mpi_barrier(mpicom_GLOID,ierr)
02307 call t_stopf ('DRIVER_RUN_LOOP_BSTOP')
02308
02309 101 format( A, 2i8, 12A, A, F8.2, A, F8.2 )
02310 102 format( A, 2i8, A, 5L3 )
02311 103 format( 5A )
02312 104 format( A, 2i8)
02313 105 format( A, 2i8, A, f10.2, A, f10.2, A, A, i5, A, A)
02314 106 format( A, f23.12)
02315
02316 call t_barrierf ('DRIVER_FINAL_BARRIER', mpicom_GLOID)
02317 call t_startf ('DRIVER_FINAL')
02318
02319 Time_end = mpi_wtime()
02320 call seq_timemgr_EClockGetData( EClock_d, stepno=endstep)
02321 call shr_mem_getusage(msize,mrss)
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333 if (iamin_ATMID) then
02334 if (drv_threading) call seq_comm_setnthreads(nthreads_ATMID)
02335 call atm_final_mct( )
02336 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02337 endif
02338 if (iamin_LNDID) then
02339 if (drv_threading) call seq_comm_setnthreads(nthreads_LNDID)
02340 call lnd_final_mct( )
02341 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02342 endif
02343 if (iamin_ICEID) then
02344 if (drv_threading) call seq_comm_setnthreads(nthreads_ICEID)
02345 call ice_final_mct( )
02346 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02347 endif
02348 if (iamin_OCNID) then
02349 if (drv_threading) call seq_comm_setnthreads(nthreads_OCNID)
02350 call ocn_final_mct( )
02351 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02352 endif
02353 if (iamin_GLCID) then
02354 if (drv_threading) call seq_comm_setnthreads(nthreads_GLCID)
02355 call glc_final_mct( )
02356 if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
02357 endif
02358
02359
02360
02361
02362
02363 call shr_mpi_min(msize,msize0,mpicom_GLOID,'driver msize0',all=.true.)
02364 call shr_mpi_max(msize,msize1,mpicom_GLOID,'driver msize1',all=.true.)
02365 call shr_mpi_min(mrss,mrss0,mpicom_GLOID,'driver mrss0',all=.true.)
02366 call shr_mpi_max(mrss,mrss1,mpicom_GLOID,'driver mrss1',all=.true.)
02367 if ( iamroot_CPLID )then
02368 call seq_timemgr_EClockGetData( EClock_d, curr_ymd=ymd, curr_tod=tod, dtime=dtime)
02369 write(logunit,'(//)')
02370 write(logunit,FormatA) subname, 'SUCCESSFUL TERMINATION OF CPL7-CCSM'
02371 write(logunit,FormatD) subname, ' at YMD,TOD = ',ymd,tod
02372 simDays = (endStep-begStep)*dtime/(24._r8*3600._r8)
02373 write(logunit,FormatR) subname, '# simulated days (this run) = ', simDays
02374 write(logunit,FormatR) subname, 'compute time (hrs) = ', (Time_end-Time_begin)/3600._r8
02375 if ( (Time_end /= Time_begin) .and. (simDays /= 0.0_r8) )then
02376 SYPD = shr_const_cday*simDays/(days_per_year*(Time_end-Time_begin))
02377 write(logunit,FormatR) subname, '# simulated years / cmp-day = ', SYPD
02378 endif
02379 write(logunit,FormatR) subname,' pes min memory highwater (MB) = ',mrss0
02380 write(logunit,FormatR) subname,' pes max memory highwater (MB) = ',mrss1
02381 write(logunit,FormatR) subname,' pes min memory last usage (MB) = ',msize0
02382 write(logunit,FormatR) subname,' pes max memory last usage (MB) = ',msize1
02383 write(logunit,'(//)')
02384 close(logunit)
02385 endif
02386
02387 call t_stopf ('DRIVER_FINAL')
02388 call t_prf(trim(timing_dir)//'/ccsm_timing', mpicom_GLOID)
02389 call t_finalizef()
02390 call ESMF_Finalize( )
02391
02392
02393 contains
02394
02395
02396 subroutine t_drvstartf(string,cplrun,budget,barrier)
02397
02398 implicit none
02399
02400 character(len=*),intent(in) :: string
02401 logical,intent(in),optional :: cplrun
02402 logical,intent(in),optional :: budget
02403 integer,intent(in),optional :: barrier
02404
02405 character(len=128) :: strbar
02406 character(len=*),parameter :: strcpl = 'DRIVER_CPL_RUN'
02407 character(len=*),parameter :: strbud = 'DRIVER_BUDGET'
02408 logical :: lcplrun,lbudget
02409
02410
02411
02412 lcplrun = .false.
02413 lbudget = .false.
02414 if (present(cplrun)) then
02415 lcplrun = cplrun
02416 endif
02417 if (present(budget)) then
02418 lbudget = budget
02419 endif
02420
02421 if (present(barrier)) then
02422 strbar = trim(string)//'_BARRIER'
02423 call t_barrierf (trim(strbar), barrier)
02424 endif
02425
02426 if (lcplrun) then
02427 call t_startf (trim(strcpl))
02428 endif
02429
02430 if (lbudget) then
02431 call t_startf (trim(strbud))
02432 endif
02433
02434 call t_startf (trim(string))
02435
02436 end subroutine t_drvstartf
02437
02438
02439
02440 subroutine t_drvstopf(string,cplrun,budget)
02441
02442 implicit none
02443
02444 character(len=*),intent(in) :: string
02445 logical,intent(in),optional :: cplrun
02446 logical,intent(in),optional :: budget
02447
02448 character(len=128) :: strbar
02449 character(len=*),parameter :: strcpl = 'DRIVER_CPL_RUN'
02450 character(len=*),parameter :: strbud = 'DRIVER_BUDGET'
02451 logical :: lcplrun,lbudget
02452
02453
02454
02455 lcplrun = .false.
02456 lbudget = .false.
02457 if (present(cplrun)) then
02458 lcplrun = cplrun
02459 endif
02460 if (present(budget)) then
02461 lbudget = budget
02462 endif
02463
02464
02465
02466 call t_stopf (trim(string))
02467
02468 if (lbudget) then
02469 call t_stopf (trim(strbud))
02470 endif
02471
02472 if (lcplrun) then
02473 call t_stopf (trim(strcpl))
02474 endif
02475
02476 end subroutine t_drvstopf
02477
02478
02479
02480 subroutine seq_ccsm_printlogheader()
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491 implicit none
02492
02493 character(len=8) :: cdate
02494 character(len=8) :: ctime
02495 integer :: values(8)
02496 character :: date*8, time*10, zone*5
02497
02498
02499
02500 call date_and_time (date, time, zone, values)
02501 cdate(1:2) = date(5:6)
02502 cdate(3:3) = '/'
02503 cdate(4:5) = date(7:8)
02504 cdate(6:6) = '/'
02505 cdate(7:8) = date(3:4)
02506 ctime(1:2) = time(1:2)
02507 ctime(3:3) = ':'
02508 ctime(4:5) = time(3:4)
02509 ctime(6:6) = ':'
02510 ctime(7:8) = time(5:6)
02511 write(logunit,F00) '------------------------------------------------------------'
02512 write(logunit,F00) ' NCAR CPL7 Community Climate System Model (CCSM) '
02513 write(logunit,F00) '------------------------------------------------------------'
02514 write(logunit,F00) ' (Online documentation is available on the CCSM '
02515 write(logunit,F00) ' Models page: http://www.ccsm.ucar.edu/models/ '
02516 write(logunit,F00) ' License information is available as a link from above '
02517 write(logunit,F00) '------------------------------------------------------------'
02518 write(logunit,F00) ' DATE ',cdate, ' TIME ', ctime
02519 write(logunit,F00) '------------------------------------------------------------'
02520 write(logunit,*)' '
02521 write(logunit,*)' '
02522
02523 end subroutine seq_ccsm_printlogheader
02524
02525
02526
02527 end program ccsm_driver