!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module initial !BOP ! !MODULE: initial ! !DESCRIPTION: ! This module contains routines for initializing a TIMCOM simulation, ! mostly by calling individual initialization routines for each ! TIMCOM module. ! ! !REVISION HISTORY: ! SVN:$Id: initial.F90 44694 2013-03-12 19:58:14Z mlevy@ucar.edu $ ! ! !USES: use TIMCOM_KindsMod use TIMCOM_ErrorMod use TIMCOM_IOUnitsMod ! use POP_SolversMod ! use POP_ReductionsMod use kinds_mod, only: i4, i8, r8, int_kind, log_kind, char_len use blocks, only: block, nx_block, ny_block, get_block use domain_size use domain, only: nblocks_clinic, blocks_clinic, init_domain_blocks, & init_domain_distribution, distrb_clinic use constants, only: radian, delim_fmt, blank_fmt, field_loc_center, blank_fmt, & c0, ppt_to_salt, mpercm, c1, field_type_scalar, init_constants, & stefan_boltzmann, latent_heat_vapor_mks, vonkar, emissivity, & latent_heat_fusion, t0_kelvin, pi, ocn_ref_salinity, & sea_ice_salinity, radius, cp_sw, grav, omega,cp_air, & rho_fw, sound, rho_air, rho_sw, ndelim_fmt use communicate, only: my_task, master_task, init_communicate ! use budget_diagnostics, only: init_budget_diagnostics use broadcast, only: broadcast_array, broadcast_scalar use prognostic, only: init_prognostic!, max_blocks_clinic, nx_global, & ! ny_global, km, nt, TRACER, curtime, RHO, newtime, oldtime use grid, only: init_grid1, init_grid2, kmt, kmt_g, n_topo_smooth, zt, & fill_points, sfc_layer_varthick, sfc_layer_type, TLON, TLAT, partial_bottom_cells ! use io ! use io_tools ! use baroclinic, only: init_baroclinic ! use barotropic, only: init_barotropic ! use pressure_grad, only: init_pressure_grad ! use surface_hgt, only: init_surface_hgt ! use vertical_mix, only: init_vertical_mix, vmix_itype, vmix_type_kpp ! use vmix_kpp, only: bckgrnd_vdc2, linertial ! use horizontal_mix, only: init_horizontal_mix ! use advection, only: init_advection ! use diagnostics, only: init_diagnostics ! use state_mod, only: init_state, state, state_itype, state_type_mwjf, state_range_iopt, & ! state_range_enforce use time_management, only: first_step, init_time1, init_time2!, & ! dttxcel, dtuxcel, check_time_flag_int, & ! get_time_flag_id, freq_opt_nhour ! use topostress, only: init_topostress use ice ! use output, only: init_output ! use tavg, only: ltavg_restart, tavg_id, set_in_tavg_contents,n_tavg_streams, tavg_streams !use hydro_sections !use current_meters !use drifters ! use forcing, only: init_forcing ! use forcing_sfwf, only: sfwf_formulation, lms_balance, sfwf_data_type, lfw_as_salt_flx ! use forcing_shf, only: luse_cpl_ifrac, OCN_WGT, shf_formulation, shf_data_type ! use forcing_ws, only: ws_data_type ! use sw_absorption, only: init_sw_absorption ! use passive_tracers, only: init_passive_tracers, ecosys_on ! use ecosys_mod, only: ecosys_qsw_distrb_const ! use exit_mod, only: sigAbort, exit_pop, flushm ! use restart, only: read_restart, restart_fmt, read_restart_filename ! use ms_balance, only: init_ms_balance use forcing_coupled, only: timcom_init_coupled!, pop_init_partially_coupled, & ! qsw_distrb_iopt, qsw_distrb_iopt_const, ncouple_per_day, coupled_freq_iopt ! use global_reductions, only: init_global_reductions, global_sum ! use timers, only: init_timers ! use registry ! use qflux_mod, only: init_qflux ! use niw_mixing ! use tidal_mixing ! use step_mod, only: init_step ! use gather_scatter !#ifdef CCSMCOUPLED ! use shr_ncread_mod ! use shr_map_mod !#endif ! use overflows ! use overflow_type implicit none private save ! !PUBLIC MEMBER FUNCTIONS: public :: timcom_init_phase1!, pop_init_phase2 !EOP !BOC !----------------------------------------------------------------------- ! ! module variables ! !----------------------------------------------------------------------- character (char_len) :: & init_ts_file_fmt, &! format (bin or nc) for input file exit_string ! exit_TIMCOM message string logical (log_kind), public :: &! context variables lcoupled, &! T ==> timcom is coupled to another system lccsm, &! T ==> timcom is being run in the ccsm context b4b_flag, &! T ==> timcom is being run in the "bit-for-bit" mode lccsm_control_compatible ! T ==> timcom is being run with code that is b4b with the ccsm4 control run ! this is a temporary flag that will be removed in ccsm4_0_1 !EOC !*********************************************************************** contains !*********************************************************************** !BOP ! !IROUTINE: timcom_init_phase1 ! !INTERFACE: subroutine timcom_init_phase1(infodata,errorCode) use seq_infodata_mod ! !DESCRIPTION: ! This routine is the first of a two-phase initialization process for ! a TIMCOM run. It calls various module initialization routines and sets up ! the initial temperature and salinity ! ! !REVISION HISTORY: ! same as module ! ! !OUTPUT PARAMETERS: type(seq_infodata_type),intent(in) :: infodata integer (i4), intent(out) :: & errorCode ! returned error code !EOP !BOC !----------------------------------------------------------------------- ! ! local variables ! !----------------------------------------------------------------------- integer (int_kind) :: & k, &! dummy vertical level index ier ! error flag !----------------------------------------------------------------------- ! ! initialize message-passing or other communication protocol ! !----------------------------------------------------------------------- ! errorCode = POP_Success call init_communicate !----------------------------------------------------------------------- ! ! initialize registry, which keeps track of which initialization ! routines have been called. This feature is used for error checking ! in routines whose calling order is important ! !----------------------------------------------------------------------- ! call init_registry !----------------------------------------------------------------------- ! ! initialize constants and i/o stuff ! !----------------------------------------------------------------------- ! call init_io !#ifdef CCSMCOUPLED !----------------------------------------------------------------------- ! ! temporary synching of old and new pop2 infrastructure for CCSM ! !----------------------------------------------------------------------- ! POP_stdout = stdout ! POP_stderr = stderr ! POP_stdin = stdin !#endif !----------------------------------------------------------------------- ! ! initialize context in which pop is being run ! !----------------------------------------------------------------------- ! call init_context !----------------------------------------------------------------------- ! ! write version information to output log after output redirection ! !----------------------------------------------------------------------- ! if (my_task == master_task) then ! write(stdout,blank_fmt) ! write(stdout,ndelim_fmt) ! write(stdout,blank_fmt) ! write(stdout,'(a)') ' Parallel Ocean Program (POP) ' ! write(stdout,'(a)') ' Based on Version 2.1alpha Jan 2005' ! write(stdout,'(a)') ' Modified for CESM 2005-2010' ! write(stdout,blank_fmt) ! call POP_IOUnitsFlush(POP_stdout) ; call POP_IOUnitsFlush(stdout) ! endif call init_constants !----------------------------------------------------------------------- ! ! initialize timers ! !----------------------------------------------------------------------- ! call init_timers !----------------------------------------------------------------------- ! ! initialize additional communication routines ! !----------------------------------------------------------------------- ! call init_global_reductions ! call POP_initReductions !----------------------------------------------------------------------- ! ! initialize overflows, part I ! !----------------------------------------------------------------------- ! call init_overflows1 !----------------------------------------------------------------------- ! ! initialize domain and grid ! !----------------------------------------------------------------------- call init_domain_blocks call init_grid1 call init_domain_distribution(KMT_G) !----------------------------------------------------------------------- ! ! initialize overflows, part II. placed here so KMT_G scatter to ! KMT can be done (and NOT in init_grid2) for possible KMT mods; then ! finish with domain and grid initialization ! !----------------------------------------------------------------------- ! call init_overflows2 call init_grid2(errorCode) if (errorCode /= TIMCOM_Success) then call TIMCOM_ErrorSet(errorCode, & 'init_phase1: error initializing grid 2') return endif !----------------------------------------------------------------------- ! ! compute time step and initialize time-related quantities ! !----------------------------------------------------------------------- call init_time1(infodata) !----------------------------------------------------------------------- ! ! initialize equation of state ! !----------------------------------------------------------------------- ! call init_state !----------------------------------------------------------------------- ! ! calculate topographic stress (maximum entropy) velocities ! !----------------------------------------------------------------------- ! call init_topostress(errorCode) ! if (errorCode /= POP_Success) then ! call POP_ErrorSet(errorCode, & ! 'init_phase1: error in init_topostress') ! return ! endif !----------------------------------------------------------------------- ! ! initialize niw driven mixing ! !----------------------------------------------------------------------- ! call init_niw_mixing !----------------------------------------------------------------------- ! ! initialize tidally driven mixing ! !----------------------------------------------------------------------- ! call init_tidal_mixing ! if ( overflows_interactive .and. .not.ltidal_mixing ) then ! exit_string = 'FATAL ERROR: overflow code is validated only with tidal mixing' ! call document ('pop_init_phase1', exit_string) ! call exit_POP (sigAbort,exit_string,out_unit=stdout) ! endif !----------------------------------------------------------------------- ! ! initialize barotropic elliptic solver ! !----------------------------------------------------------------------- ! call POP_SolversInit(errorCode) ! if (errorCode /= POP_Success) then ! call POP_ErrorSet(errorCode, & ! 'POP_Init: error initializing solvers') ! return ! endif !----------------------------------------------------------------------- ! ! modify 9pt coefficients for barotropic solver for overflow use ! !----------------------------------------------------------------------- ! call init_overflows3 !----------------------------------------------------------------------- ! ! initialize pressure gradient (pressure averaging) ! initialize baroclinic (reset to freezing) ! initialize barotropic (barotropic-related diagnostics) ! initialize surface_hgt (ssh-related diagnostics) ! !----------------------------------------------------------------------- ! call init_pressure_grad ! call init_baroclinic ! call init_barotropic ! call init_surface_hgt !----------------------------------------------------------------------- ! ! initialize prognostic fields ! !----------------------------------------------------------------------- call init_prognostic !----------------------------------------------------------------------- ! ! initialize ice module ! !----------------------------------------------------------------------- call init_ice !----------------------------------------------------------------------- ! ! set initial temperature and salinity profiles (includes read of ! restart file ! !----------------------------------------------------------------------- ! call init_ts(errorCode) ! if (errorCode /= POP_Success) then ! call POP_ErrorSet(errorCode, & ! 'init_phase1: error in init_ts') ! return ! endif !----------------------------------------------------------------------- ! ! finish computing time-related quantities after restart info ! available ! !----------------------------------------------------------------------- call init_time2 !----------------------------------------------------------------------- ! ! initialize fields for surface forcing ! o init_ws ! o init_shf ! o init_sfwf ! o init_pt_interior ! o init_s_interior ! o init_ap ! !----------------------------------------------------------------------- ! call init_forcing !----------------------------------------------------------------------- ! ! initialize generic aspects of coupled forcing (no coupling-specific ! references) ! !----------------------------------------------------------------------- call timcom_init_coupled !----------------------------------------------------------------------- !EOC end subroutine timcom_init_phase1 end module initial !|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||