|
| 1 | +module ocn_comp_mct |
| 2 | + |
| 3 | +!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| 4 | +!BOP |
| 5 | +! !MODULE: ocn_comp_mct |
| 6 | +! !INTERFACE: |
| 7 | + |
| 8 | +! !DESCRIPTION: |
| 9 | +! This is the main driver for the MOM6 in CIME |
| 10 | +! |
| 11 | +! !REVISION HISTORY: |
| 12 | +! |
| 13 | +! !USES: |
| 14 | + use esmf |
| 15 | + use seq_cdata_mod |
| 16 | + use mct_mod |
| 17 | + |
| 18 | + ! From MOM6 |
| 19 | + use ocean_model_mod, only: ocean_state_type, ocean_public_type |
| 20 | + use ocean_model_mod, only: ocean_model_init |
| 21 | + use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP |
| 22 | + use MOM_domains, only: MOM_infra_init, num_pes, root_pe, pe_here |
| 23 | + |
| 24 | +! |
| 25 | +! !PUBLIC MEMBER FUNCTIONS: |
| 26 | + implicit none |
| 27 | + public :: ocn_init_mct |
| 28 | + public :: ocn_run_mct |
| 29 | + public :: ocn_final_mct |
| 30 | + private ! By default make data private |
| 31 | + |
| 32 | +! |
| 33 | +! ! PUBLIC DATA: |
| 34 | +! |
| 35 | +! !REVISION HISTORY: |
| 36 | +! Author: Mariana Vertenstein |
| 37 | +! |
| 38 | +!EOP |
| 39 | +! !PRIVATE MODULE FUNCTIONS: |
| 40 | + |
| 41 | +! |
| 42 | +! !PRIVATE MODULE VARIABLES |
| 43 | + type(ocean_state_type), pointer :: ocn_state => NULL() ! Private state of ocean |
| 44 | + type(ocean_public_type), pointer :: ocn_surface => NULL() ! Public surface state of ocean |
| 45 | + |
| 46 | +!======================================================================= |
| 47 | + |
| 48 | +contains |
| 49 | + |
| 50 | +!*********************************************************************** |
| 51 | +!BOP |
| 52 | +! |
| 53 | +! !IROUTINE: ocn_init_mct |
| 54 | +! |
| 55 | +! !INTERFACE: |
| 56 | + subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename ) |
| 57 | +! |
| 58 | +! !DESCRIPTION: |
| 59 | +! Initialize POP |
| 60 | +! |
| 61 | +! !INPUT/OUTPUT PARAMETERS: |
| 62 | + |
| 63 | + type(ESMF_Clock) , intent(inout) :: EClock |
| 64 | + type(seq_cdata) , intent(inout) :: cdata_o |
| 65 | + type(mct_aVect) , intent(inout) :: x2o_o, o2x_o |
| 66 | + character(len=*), optional , intent(in) :: NLFilename ! Namelist filename |
| 67 | +! |
| 68 | +! !REVISION HISTORY: |
| 69 | +! Author: Mariana Vertenstein |
| 70 | +!EOP |
| 71 | +!----------------------------------------------------------------------- |
| 72 | +! |
| 73 | +! local variables |
| 74 | +! |
| 75 | +!----------------------------------------------------------------------- |
| 76 | + type(time_type) :: time_init ! Start time of coupled model's calendar |
| 77 | + type(time_type) :: time_in ! Start time for ocean model at initialization |
| 78 | + type(ESMF_time) :: current_time |
| 79 | + integer :: year, month, day, hour, minute, seconds, rc |
| 80 | + character(len=128) :: errMsg |
| 81 | + integer :: mpicom |
| 82 | + integer :: npes, pe0 |
| 83 | + integer :: i |
| 84 | + |
| 85 | + mpicom = cdata_o%mpicom |
| 86 | + |
| 87 | + call MOM_infra_init(mpicom) |
| 88 | + call ESMF_ClockGet(EClock, currTime=current_time, rc=rc) |
| 89 | + call ESMF_TimeGet(current_time, yy=year, mm=month, dd=day, h=hour, m=minute, s=seconds, rc=rc) |
| 90 | + ! we need to confirm this: |
| 91 | + call set_calendar_type(NOLEAP) |
| 92 | + |
| 93 | + time_init = set_date(year, month, day, hour, minute, seconds, err_msg=errMsg) |
| 94 | + time_in = set_date(year, month, day, hour, minute, seconds, err_msg=errMsg) |
| 95 | + |
| 96 | + npes = num_pes() |
| 97 | + pe0 = root_pe() |
| 98 | + |
| 99 | + allocate(ocn_surface) |
| 100 | + ocn_surface%is_ocean_PE = .true. |
| 101 | + allocate(ocn_surface%pelist(npes)) |
| 102 | + ocn_surface%pelist(:) = (/(i,i=pe0,pe0+npes)/) |
| 103 | + |
| 104 | + call ocean_model_init(ocn_surface, ocn_state, time_init, time_in) |
| 105 | + |
| 106 | +!----------------------------------------------------------------------- |
| 107 | +!EOC |
| 108 | + |
| 109 | + end subroutine ocn_init_mct |
| 110 | + |
| 111 | +!*********************************************************************** |
| 112 | +!BOP |
| 113 | +! |
| 114 | +! !IROUTINE: ocn_run_mct |
| 115 | +! |
| 116 | +! !INTERFACE: |
| 117 | + subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o) |
| 118 | +! |
| 119 | +! !DESCRIPTION: |
| 120 | +! Run POP for a coupling interval |
| 121 | +! |
| 122 | +! !INPUT/OUTPUT PARAMETERS: |
| 123 | + type(ESMF_Clock) , intent(inout) :: EClock |
| 124 | + type(seq_cdata) , intent(inout) :: cdata_o |
| 125 | + type(mct_aVect) , intent(inout) :: x2o_o |
| 126 | + type(mct_aVect) , intent(inout) :: o2x_o |
| 127 | + |
| 128 | +! |
| 129 | +! !REVISION HISTORY: |
| 130 | +! Author: Mariana Vertenstein |
| 131 | +!EOP |
| 132 | +!----------------------------------------------------------------------- |
| 133 | +! |
| 134 | +! local variables |
| 135 | +! |
| 136 | +!----------------------------------------------------------------------- |
| 137 | + |
| 138 | +!----------------------------------------------------------------------- |
| 139 | +!EOC |
| 140 | + |
| 141 | + end subroutine ocn_run_mct |
| 142 | + |
| 143 | +!*********************************************************************** |
| 144 | +!BOP |
| 145 | +! |
| 146 | +! !IROUTINE: ocn_final_mct |
| 147 | +! |
| 148 | +! !INTERFACE: |
| 149 | + subroutine ocn_final_mct( EClock, cdata_o, x2o_o, o2x_o) |
| 150 | +! |
| 151 | +! !DESCRIPTION: |
| 152 | +! Finalize POP |
| 153 | +! |
| 154 | +! !USES: |
| 155 | +! !ARGUMENTS: |
| 156 | + type(ESMF_Clock) , intent(inout) :: EClock |
| 157 | + type(seq_cdata) , intent(inout) :: cdata_o |
| 158 | + type(mct_aVect) , intent(inout) :: x2o_o |
| 159 | + type(mct_aVect) , intent(inout) :: o2x_o |
| 160 | +! |
| 161 | +! !REVISION HISTORY: |
| 162 | +! Author: Fei Liu |
| 163 | +!EOP |
| 164 | +!BOC |
| 165 | +!----------------------------------------------------------------------- |
| 166 | +! |
| 167 | +! local variables |
| 168 | +! |
| 169 | +!----------------------------------------------------------------------- |
| 170 | + |
| 171 | + end subroutine ocn_final_mct |
| 172 | + |
| 173 | + |
| 174 | +end module ocn_comp_mct |
| 175 | + |
| 176 | +!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
0 commit comments