Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update to gfdl 20200909 commit #35

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2fe5224
updates to clean up differences between nems and cmeps for restarts
Mar 24, 2020
1a6411f
added changes to unify cap with EMC changes
Apr 7, 2020
e089a15
bug fix for cesm when restart_option is none
Apr 7, 2020
0a2bb50
uncomment omp directive for KPP_compute_BLD
alperaltuntas Apr 12, 2020
01f7c45
uncomment omp in barotropic solver
alperaltuntas Apr 13, 2020
2aa1091
optimize barotropic timestepping openmp
alperaltuntas Apr 14, 2020
3dd70fe
remove unnecessary kOBL computation
alperaltuntas Apr 15, 2020
6cf28bf
Add option to scale AH via a biharmonic Reynolds #
gustavo-marques Apr 15, 2020
65f36d7
Add diags for Lapl. and Bihar grid Reynolds #s
gustavo-marques Apr 16, 2020
49ab54a
move pass_var in KPP smoothing outside the do-loop
alperaltuntas Apr 17, 2020
b609dea
Fix indices in KE calculation
gustavo-marques Apr 17, 2020
3fb86e3
Avoid division by zero
gustavo-marques Apr 21, 2020
e955c6d
Fix openmp directives
gustavo-marques Apr 21, 2020
e3cbcbb
Fix openmp directives
gustavo-marques Apr 21, 2020
cd00022
Fix OMP calls
gustavo-marques Apr 21, 2020
1e7fa51
add KPP timing clocks and omp directives
alperaltuntas Apr 22, 2020
e5fcc69
remove OMP enclosing get_BLD call
alperaltuntas Apr 22, 2020
e47e8b7
uncomment KPP clocks
alperaltuntas Apr 22, 2020
1165a61
further refactor smoothing subroutine
alperaltuntas Apr 22, 2020
98f5a8d
add omp directives to int_density_dz_generic_plm
alperaltuntas Apr 23, 2020
48310e3
eliminate omp parallel open/close in to int_density_dz_generic_plm
alperaltuntas Apr 23, 2020
c53525e
Clean QG_Leith
gustavo-marques Apr 22, 2020
b412fde
Fix Leith_Ah
gustavo-marques May 1, 2020
7d228f7
Add missing OMP directives
gustavo-marques May 4, 2020
933b09a
Remove OMP directive that came with cherry-picking
gustavo-marques May 4, 2020
c06515f
Add tidal diffusivities (Kd_tidal) into Kd_int
gustavo-marques May 6, 2020
4e54ad5
Merge pull request #147 from gustavo-marques/biharmonic_grid_Re
alperaltuntas May 6, 2020
809593c
Merge branch 'dev/ncar' into leith_improvements
gustavo-marques May 6, 2020
c42d104
Merge pull request #148 from gustavo-marques/leith_improvements
alperaltuntas May 7, 2020
02f5a8c
Merge pull request #149 from gustavo-marques/fix_tidal_mixing
alperaltuntas May 8, 2020
6d5a5f9
Merge branch 'dev-master-candidate-2020-05-15' into merge-dev-master-…
gustavo-marques May 18, 2020
fab21a7
Fixes an integer-kind mismatch in MOM_random, seed_from_time()
adcroft May 19, 2020
4755458
Merge branch 'dev-master-candidate-2020-05-15-patch1' into merge-dev-…
gustavo-marques May 19, 2020
85f4dc0
Merge pull request #150 from NCAR/omp_performance
gustavo-marques May 19, 2020
81805cc
Merge branch 'dev/ncar' into merge-dev-master-candidate-2020-05-15
alperaltuntas May 19, 2020
2f44ca7
correct conflict resolve in KPP
alperaltuntas May 19, 2020
b344788
undo indent change from conflict resolve
alperaltuntas May 19, 2020
532e65a
undo OMP changes in MOM_EOS
alperaltuntas May 19, 2020
9754742
Fix OMP directives broken by merge
alperaltuntas May 19, 2020
fd68ffa
Merge pull request #151 from gustavo-marques/merge-dev-master-candida…
alperaltuntas May 19, 2020
4041cc9
Fix bug when applying ND only in the interior
gustavo-marques May 25, 2020
a69aea9
Add new diagnostics
gustavo-marques May 28, 2020
473c3f4
Remove unused module
gustavo-marques Jun 9, 2020
abb10ed
Add calls to time_interp_external_init
gustavo-marques Jun 9, 2020
aed316c
Merge branch 'dev/ncar' into restart_nuopc
gustavo-marques Jun 9, 2020
7f478aa
Add option to apply linear decay at the base of hbl
gustavo-marques May 25, 2020
8fdcd90
Improve documentation and changed default method
gustavo-marques Jun 10, 2020
ca86bad
Remove trailing space
gustavo-marques Jun 10, 2020
bb222c8
Merge pull request #152 from gustavo-marques/add_diagnostics
alperaltuntas Jun 10, 2020
0c98fa9
Merge pull request #153 from gustavo-marques/add_calls_time_interp_ex…
alperaltuntas Jun 10, 2020
3698c40
Merge pull request #154 from gustavo-marques/restart_nuopc
alperaltuntas Jun 11, 2020
388b100
Fix default zeta_bot values
gustavo-marques Jun 17, 2020
330d7c4
Merge pull request #155 from gustavo-marques/LBD_improvements_jun2020
alperaltuntas Jun 22, 2020
2fe90f2
retrieve num_rest_files from save_restart
alperaltuntas Aug 4, 2020
ff27ad5
add num_rest_files to ocean_model_restart
alperaltuntas Aug 4, 2020
4c60900
read/write multiple restart filenames from/to rpointer files
alperaltuntas Aug 4, 2020
7a2256c
correct restart file suffix index
alperaltuntas Aug 5, 2020
4c91ae3
add filename length check
alperaltuntas Aug 5, 2020
0a5515b
increase restart filename lengths
alperaltuntas Aug 5, 2020
bba3e91
increase nuopc cap restart filename length
alperaltuntas Aug 5, 2020
829aade
make mct cap be able to write multiple restart files to rpointer
alperaltuntas Aug 5, 2020
648bb1c
make mct cap be able to read multiple restart files from rpointer
alperaltuntas Aug 5, 2020
aa8ce21
Merge pull request #156 from NCAR/fix_multi_restart
alperaltuntas Aug 7, 2020
608f4bf
Merge branch 'dev/master' into dev-master-candidate-ncar-2020-08-11
gustavo-marques Aug 11, 2020
6331da1
Remove (:,:) after 2-d variable declariation
gustavo-marques Aug 13, 2020
287281c
Remove unnecessary present(num_rest_files) condition
gustavo-marques Aug 13, 2020
ab9386c
In do-loops, use uppercase K index for variables discretized on inter…
gustavo-marques Aug 13, 2020
17936f3
Add modifications suggested by Bob Hallberg
gustavo-marques Aug 24, 2020
e3bc47a
Fix letter case to follow MOM6 convention
gustavo-marques Aug 26, 2020
2946903
Fix one more letter case to follow MOM6 convention
gustavo-marques Aug 26, 2020
eb57e51
Merge pull request #1176 from gustavo-marques/dev-master-candidate-nc…
Hallberg-NOAA Sep 9, 2020
fbfa05b
Merge commit 'eb57e51f5ed2287e593c6de3a1e986735335ca55' into feature/…
jiandewang Sep 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 53 additions & 50 deletions config_src/mct_driver/mom_ocean_model_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,57 @@ module MOM_ocean_model_mct
! This code is a stop-gap wrapper of the MOM6 code to enable it to be called
! in the same way as MOM4.

use MOM, only : initialize_MOM, step_MOM, MOM_control_struct, MOM_end
use MOM, only : extract_surface_state, allocate_surface_state, finish_MOM_initialization
use MOM, only : get_MOM_state_elements, MOM_state_is_synchronized
use MOM, only : get_ocean_stocks, step_offline
use MOM_constants, only : CELSIUS_KELVIN_OFFSET, hlf
use MOM_diag_mediator, only : diag_ctrl, enable_averaging, disable_averaging
use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end
use MOM_domains, only : pass_var, pass_vector, AGRID, BGRID_NE, CGRID_NE
use MOM_domains, only : TO_ALL, Omit_Corners
use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave
use MOM_file_parser, only : get_param, log_version, close_param_file, param_file_type
use MOM_forcing_type, only : allocate_forcing_type
use MOM_forcing_type, only : forcing, mech_forcing
use MOM_forcing_type, only : forcing_accumulate, copy_common_forcing_fields
use MOM_forcing_type, only : copy_back_forcing_fields, set_net_mass_forcing
use MOM_forcing_type, only : set_derived_forcing_fields
use MOM_forcing_type, only : forcing_diagnostics, mech_forcing_diags
use MOM_get_input, only : Get_MOM_Input, directories
use MOM_grid, only : ocean_grid_type
use MOM_io, only : close_file, file_exists, read_data, write_version_number
use MOM_marine_ice, only : iceberg_forces, iceberg_fluxes, marine_ice_init, marine_ice_CS
use MOM_restart, only : MOM_restart_CS, save_restart
use MOM_string_functions, only : uppercase
use MOM_surface_forcing_mct, only : surface_forcing_init, convert_IOB_to_fluxes
use MOM_surface_forcing_mct, only : convert_IOB_to_forces, ice_ocn_bnd_type_chksum
use MOM_surface_forcing_mct, only : ice_ocean_boundary_type, surface_forcing_CS
use MOM_surface_forcing_mct, only : forcing_save_restart
use MOM_time_manager, only : time_type, get_time, set_time, operator(>)
use MOM_time_manager, only : operator(+), operator(-), operator(*), operator(/)
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=)
use MOM_time_manager, only : operator(<), real_to_time_type, time_type_to_real
use MOM_tracer_flow_control, only : call_tracer_register, tracer_flow_control_init
use MOM_tracer_flow_control, only : call_tracer_flux_init
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : surface
use MOM_verticalGrid, only : verticalGrid_type
use MOM_ice_shelf, only : initialize_ice_shelf, shelf_calc_flux, ice_shelf_CS
use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
use fms_mod, only : stdout
use mpp_mod, only : mpp_chksum
use MOM_EOS, only : gsw_sp_from_sr, gsw_pt_from_ct
use MOM_wave_interface, only: wave_parameters_CS, MOM_wave_interface_init
use MOM_wave_interface, only: MOM_wave_interface_init_lite, Update_Surface_Waves
use MOM, only : initialize_MOM, step_MOM, MOM_control_struct, MOM_end
use MOM, only : extract_surface_state, allocate_surface_state, finish_MOM_initialization
use MOM, only : get_MOM_state_elements, MOM_state_is_synchronized
use MOM, only : get_ocean_stocks, step_offline
use MOM_constants, only : CELSIUS_KELVIN_OFFSET, hlf
use MOM_diag_mediator, only : diag_ctrl, enable_averaging, disable_averaging
use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end
use MOM_domains, only : pass_var, pass_vector, AGRID, BGRID_NE, CGRID_NE
use MOM_domains, only : TO_ALL, Omit_Corners
use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave
use MOM_file_parser, only : get_param, log_version, close_param_file, param_file_type
use MOM_forcing_type, only : allocate_forcing_type
use MOM_forcing_type, only : forcing, mech_forcing
use MOM_forcing_type, only : forcing_accumulate, copy_common_forcing_fields
use MOM_forcing_type, only : copy_back_forcing_fields, set_net_mass_forcing
use MOM_forcing_type, only : set_derived_forcing_fields
use MOM_forcing_type, only : forcing_diagnostics, mech_forcing_diags
use MOM_get_input, only : Get_MOM_Input, directories
use MOM_grid, only : ocean_grid_type
use MOM_io, only : close_file, file_exists, read_data, write_version_number
use MOM_marine_ice, only : iceberg_forces, iceberg_fluxes, marine_ice_init, marine_ice_CS
use MOM_restart, only : MOM_restart_CS, save_restart
use MOM_string_functions, only : uppercase
use MOM_surface_forcing_mct, only : surface_forcing_init, convert_IOB_to_fluxes
use MOM_surface_forcing_mct, only : convert_IOB_to_forces, ice_ocn_bnd_type_chksum
use MOM_surface_forcing_mct, only : ice_ocean_boundary_type, surface_forcing_CS
use MOM_surface_forcing_mct, only : forcing_save_restart
use MOM_time_manager, only : time_type, get_time, set_time, operator(>)
use MOM_time_manager, only : operator(+), operator(-), operator(*), operator(/)
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=)
use MOM_time_manager, only : operator(<), real_to_time_type, time_type_to_real
use MOM_tracer_flow_control, only : call_tracer_register, tracer_flow_control_init
use MOM_tracer_flow_control, only : call_tracer_flux_init
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : surface
use MOM_verticalGrid, only : verticalGrid_type
use MOM_ice_shelf, only : initialize_ice_shelf, shelf_calc_flux, ice_shelf_CS
use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
use fms_mod, only : stdout
use mpp_mod, only : mpp_chksum
use MOM_EOS, only : gsw_sp_from_sr, gsw_pt_from_ct
use MOM_wave_interface, only : wave_parameters_CS, MOM_wave_interface_init
use MOM_wave_interface, only : MOM_wave_interface_init_lite, Update_Surface_Waves
use time_interp_external_mod, only : time_interp_external_init

! MCT specfic routines
use MOM_domains, only : MOM_infra_end
Expand Down Expand Up @@ -265,6 +266,8 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
OS%is_ocean_pe = Ocean_sfc%is_ocean_pe
if (.not.OS%is_ocean_pe) return

call time_interp_external_init

OS%Time = Time_in
call initialize_MOM(OS%Time, Time_init, param_file, OS%dirs, OS%MOM_CSp, &
OS%restart_CSp, Time_in, offline_tracer_mode=OS%offline_tracer_mode, &
Expand Down
44 changes: 38 additions & 6 deletions config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
integer :: year, month, day, hour, minute, seconds, seconds_n, seconds_d, rc
character(len=240) :: runid !< Run ID
character(len=32) :: runtype !< Run type
character(len=240) :: restartfile !< Path/Name of restart file
character(len=512) :: restartfile !< Path/Name of restart file
character(len=2048) :: restartfiles !< Path/Name of restart files.
!! (same as restartfile if a single restart file is to be read in)
integer :: nu !< i/o unit to read pointer file
character(len=240) :: restart_pointer_file !< File name for restart pointer file
character(len=240) :: restartpath !< Path of the restart file
Expand Down Expand Up @@ -164,6 +166,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
!logical :: lsend_precip_fact !< If T,send precip_fact to cpl for use in fw balance
!! (partially-coupled option)
character(len=128) :: err_msg !< Error message
integer :: iostat

! set the cdata pointers:
call seq_cdata_setptrs(cdata_o, id=MOM_MCT_ID, mpicom=mpicom_ocn, &
Expand Down Expand Up @@ -296,15 +299,27 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
nu = shr_file_getUnit()
restart_pointer_file = trim(glb%pointer_filename)
if (is_root_pe()) write(glb%stdout,*) 'Reading ocn pointer file: ',restart_pointer_file
restartfile = ""; restartfiles = "";
open(nu, file=restart_pointer_file, form='formatted', status='unknown')
read(nu,'(a)') restartfile
do
read(nu,'(a)', iostat=iostat) restartfile
if (len(trim(restartfiles))>1 .and. iostat<0) then
exit ! done reading restart files list.
else if (iostat/=0) then
call MOM_error(FATAL, 'Error reading rpointer.ocn')
endif
! check if the length of restartfiles variable is sufficient:
if (len(restartfiles)-len(trim(restartfiles)) < len(trim(restartfile))) then
call MOM_error(FATAL, "Restart file name(s) too long.")
endif
restartfiles = trim(restartfiles) // " " // trim(restartfile)
enddo
close(nu)
!restartfile = trim(restartpath) // trim(restartfile)
if (is_root_pe()) then
write(glb%stdout,*) 'Reading restart file: ',trim(restartfile)
write(glb%stdout,*) 'Reading restart file(s): ',trim(restartfiles)
end if
call shr_file_freeUnit(nu)
call ocean_model_init(glb%ocn_public, glb%ocn_state, time0, time_start, input_restart_file=trim(restartfile))
call ocean_model_init(glb%ocn_public, glb%ocn_state, time0, time_start, input_restart_file=trim(restartfiles))
endif
if (is_root_pe()) then
write(glb%stdout,'(/12x,a/)') '======== COMPLETED MOM INITIALIZATION ========'
Expand Down Expand Up @@ -434,6 +449,9 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
integer :: ocn_cpl_dt !< one ocn coupling interval in seconds. (to be received from cesm)
real (kind=8) :: mom_cpl_dt !< one ocn coupling interval in seconds. (internal)
integer :: ncouple_per_day !< number of ocean coupled call in one day (non-dim)
integer :: num_rest_files !< number of restart files written
integer :: i
character(len=8) :: suffix

! reset shr logging to ocn log file:
if (is_root_pe()) then
Expand Down Expand Up @@ -534,14 +552,28 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
write(restartname,'(A,".mom6.r.",I4.4,"-",I2.2,"-",I2.2,"-",I5.5)') trim(runid), year, month, day, seconds

call save_restart(glb%ocn_state%dirs%restart_output_dir, glb%ocn_state%Time, glb%grid, &
glb%ocn_state%restart_CSp, .false., filename=restartname, GV=glb%ocn_state%GV)
glb%ocn_state%restart_CSp, .false., filename=restartname, GV=glb%ocn_state%GV, &
num_rest_files=num_rest_files)

! write name of restart file in the rpointer file
nu = shr_file_getUnit()
if (is_root_pe()) then
restart_pointer_file = trim(glb%pointer_filename)
open(nu, file=restart_pointer_file, form='formatted', status='unknown')
write(nu,'(a)') trim(restartname) //'.nc'

if (num_rest_files > 1) then
! append i.th restart file name to rpointer
do i=1, num_rest_files-1
if (i < 10) then
write(suffix,'("_",I1)') i
else
write(suffix,'("_",I2)') i
endif
write(nu,'(a)') trim(restartname) // trim(suffix) // '.nc'
enddo
endif

close(nu)
write(glb%stdout,*) 'ocn restart pointer file written: ',trim(restartname)
endif
Expand Down
5 changes: 3 additions & 2 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module MOM_cap_mod
use mpp_mod, only: stdlog, stdout, mpp_root_pe, mpp_clock_id
use mpp_mod, only: mpp_clock_begin, mpp_clock_end, MPP_CLOCK_SYNC
use mpp_mod, only: MPP_CLOCK_DETAILED, CLOCK_COMPONENT, MAXPES
use time_interp_external_mod, only: time_interp_external_init
use time_manager_mod, only: set_calendar_type, time_type, increment_date
use time_manager_mod, only: set_time, set_date, get_time, get_date, month_name
use time_manager_mod, only: GREGORIAN, JULIAN, NOLEAP, THIRTY_DAY_MONTHS, NO_CALENDAR
Expand Down Expand Up @@ -1559,6 +1558,7 @@ subroutine ModelAdvance(gcomp, rc)
return
endif
write(writeunit,'(a)') trim(restartname)//'.nc'

if (num_rest_files > 1) then
! append i.th restart file name to rpointer
do i=1, num_rest_files-1
Expand Down Expand Up @@ -1737,7 +1737,6 @@ subroutine ModelSetRunClock(gcomp, rc)
line=__LINE__, file=__FILE__, rcToReturn=rc)
return
endif

! not used in nems
call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, &
isPresent=isPresent, isSet=isSet, rc=rc)
Expand Down Expand Up @@ -1811,6 +1810,8 @@ subroutine ocean_model_finalize(gcomp, rc)
type(TIME_TYPE) :: Time
type(ESMF_Clock) :: clock
type(ESMF_Time) :: currTime
type(ESMF_Alarm), allocatable :: alarmList(:)
integer :: alarmCount
character(len=64) :: timestamp
logical :: write_restart
character(len=*),parameter :: subname='(MOM_cap:ocean_model_finalize)'
Expand Down
3 changes: 3 additions & 0 deletions config_src/nuopc_driver/mom_ocean_model_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module MOM_ocean_model_nuopc
use MOM_time_manager, only : operator(+), operator(-), operator(*), operator(/)
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=)
use MOM_time_manager, only : operator(<), real_to_time_type, time_type_to_real
use time_interp_external_mod,only : time_interp_external_init
use MOM_tracer_flow_control, only : call_tracer_register, tracer_flow_control_init
use MOM_tracer_flow_control, only : call_tracer_flux_init
use MOM_unit_scaling, only : unit_scale_type
Expand Down Expand Up @@ -267,6 +268,8 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
OS%is_ocean_pe = Ocean_sfc%is_ocean_pe
if (.not.OS%is_ocean_pe) return

call time_interp_external_init

OS%Time = Time_in
call initialize_MOM(OS%Time, Time_init, param_file, OS%dirs, OS%MOM_CSp, &
OS%restart_CSp, Time_in, offline_tracer_mode=OS%offline_tracer_mode, &
Expand Down
Loading