forked from mom-ocean/MOM6
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from gustavo-marques/temp_salt_z_init_file
Adds option to read initial temp and salt from separate files
- Loading branch information
Showing
3 changed files
with
195 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
module ocn_comp_mct | ||
|
||
!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | ||
!BOP | ||
! !MODULE: ocn_comp_mct | ||
! !INTERFACE: | ||
|
||
! !DESCRIPTION: | ||
! This is the main driver for the MOM6 in CIME | ||
! | ||
! !REVISION HISTORY: | ||
! | ||
! !USES: | ||
use esmf | ||
use seq_cdata_mod | ||
use mct_mod | ||
|
||
! From MOM6 | ||
use ocean_model_mod, only: ocean_state_type, ocean_public_type | ||
use ocean_model_mod, only: ocean_model_init | ||
use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP | ||
use MOM_domains, only: MOM_infra_init, num_pes, root_pe, pe_here | ||
|
||
! | ||
! !PUBLIC MEMBER FUNCTIONS: | ||
implicit none | ||
public :: ocn_init_mct | ||
public :: ocn_run_mct | ||
public :: ocn_final_mct | ||
private ! By default make data private | ||
|
||
! | ||
! ! PUBLIC DATA: | ||
! | ||
! !REVISION HISTORY: | ||
! Author: Mariana Vertenstein | ||
! | ||
!EOP | ||
! !PRIVATE MODULE FUNCTIONS: | ||
|
||
! | ||
! !PRIVATE MODULE VARIABLES | ||
type(ocean_state_type), pointer :: ocn_state => NULL() ! Private state of ocean | ||
type(ocean_public_type), pointer :: ocn_surface => NULL() ! Public surface state of ocean | ||
|
||
!======================================================================= | ||
|
||
contains | ||
|
||
!*********************************************************************** | ||
!BOP | ||
! | ||
! !IROUTINE: ocn_init_mct | ||
! | ||
! !INTERFACE: | ||
subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename ) | ||
! | ||
! !DESCRIPTION: | ||
! Initialize POP | ||
! | ||
! !INPUT/OUTPUT PARAMETERS: | ||
|
||
type(ESMF_Clock) , intent(inout) :: EClock | ||
type(seq_cdata) , intent(inout) :: cdata_o | ||
type(mct_aVect) , intent(inout) :: x2o_o, o2x_o | ||
character(len=*), optional , intent(in) :: NLFilename ! Namelist filename | ||
! | ||
! !REVISION HISTORY: | ||
! Author: Mariana Vertenstein | ||
!EOP | ||
!----------------------------------------------------------------------- | ||
! | ||
! local variables | ||
! | ||
!----------------------------------------------------------------------- | ||
type(time_type) :: time_init ! Start time of coupled model's calendar | ||
type(time_type) :: time_in ! Start time for ocean model at initialization | ||
type(ESMF_time) :: current_time | ||
integer :: year, month, day, hour, minute, seconds, rc | ||
character(len=128) :: errMsg | ||
integer :: mpicom | ||
integer :: npes, pe0 | ||
integer :: i | ||
|
||
mpicom = cdata_o%mpicom | ||
|
||
call MOM_infra_init(mpicom) | ||
call ESMF_ClockGet(EClock, currTime=current_time, rc=rc) | ||
call ESMF_TimeGet(current_time, yy=year, mm=month, dd=day, h=hour, m=minute, s=seconds, rc=rc) | ||
! we need to confirm this: | ||
call set_calendar_type(NOLEAP) | ||
|
||
time_init = set_date(year, month, day, hour, minute, seconds, err_msg=errMsg) | ||
time_in = set_date(year, month, day, hour, minute, seconds, err_msg=errMsg) | ||
|
||
npes = num_pes() | ||
pe0 = root_pe() | ||
|
||
allocate(ocn_surface) | ||
ocn_surface%is_ocean_PE = .true. | ||
allocate(ocn_surface%pelist(npes)) | ||
ocn_surface%pelist(:) = (/(i,i=pe0,pe0+npes)/) | ||
|
||
call ocean_model_init(ocn_surface, ocn_state, time_init, time_in) | ||
|
||
!----------------------------------------------------------------------- | ||
!EOC | ||
|
||
end subroutine ocn_init_mct | ||
|
||
!*********************************************************************** | ||
!BOP | ||
! | ||
! !IROUTINE: ocn_run_mct | ||
! | ||
! !INTERFACE: | ||
subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o) | ||
! | ||
! !DESCRIPTION: | ||
! Run POP for a coupling interval | ||
! | ||
! !INPUT/OUTPUT PARAMETERS: | ||
type(ESMF_Clock) , intent(inout) :: EClock | ||
type(seq_cdata) , intent(inout) :: cdata_o | ||
type(mct_aVect) , intent(inout) :: x2o_o | ||
type(mct_aVect) , intent(inout) :: o2x_o | ||
|
||
! | ||
! !REVISION HISTORY: | ||
! Author: Mariana Vertenstein | ||
!EOP | ||
!----------------------------------------------------------------------- | ||
! | ||
! local variables | ||
! | ||
!----------------------------------------------------------------------- | ||
|
||
!----------------------------------------------------------------------- | ||
!EOC | ||
|
||
end subroutine ocn_run_mct | ||
|
||
!*********************************************************************** | ||
!BOP | ||
! | ||
! !IROUTINE: ocn_final_mct | ||
! | ||
! !INTERFACE: | ||
subroutine ocn_final_mct( EClock, cdata_o, x2o_o, o2x_o) | ||
! | ||
! !DESCRIPTION: | ||
! Finalize POP | ||
! | ||
! !USES: | ||
! !ARGUMENTS: | ||
type(ESMF_Clock) , intent(inout) :: EClock | ||
type(seq_cdata) , intent(inout) :: cdata_o | ||
type(mct_aVect) , intent(inout) :: x2o_o | ||
type(mct_aVect) , intent(inout) :: o2x_o | ||
! | ||
! !REVISION HISTORY: | ||
! Author: Fei Liu | ||
!EOP | ||
!BOC | ||
!----------------------------------------------------------------------- | ||
! | ||
! local variables | ||
! | ||
!----------------------------------------------------------------------- | ||
|
||
end subroutine ocn_final_mct | ||
|
||
|
||
end module ocn_comp_mct | ||
|
||
!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters