Skip to content

Commit

Permalink
Merge branch 'dev/master' into user/ksh/open_bc
Browse files Browse the repository at this point in the history
  • Loading branch information
kshedstrom committed Jun 28, 2016
2 parents 8e10ec5 + f9613a8 commit 2861388
Show file tree
Hide file tree
Showing 27 changed files with 600 additions and 396 deletions.
54 changes: 29 additions & 25 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,15 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
call diag_mediator_infrastructure_init()
call MOM_io_init(param_file)
call MOM_grid_init(G, param_file)

call create_dyn_horgrid(dG, G%HI)
dG%first_direction = G%first_direction
dG%bathymetry_at_vel = G%bathymetry_at_vel
call clone_MOM_domain(G%Domain, dG%Domain)

call verticalGridInit( param_file, CS%GV )
GV => CS%GV
dG%g_Earth = GV%g_Earth

! Read relevant parameters and write them to the model log.
call log_version(param_file, "MOM", version, "")
Expand Down Expand Up @@ -1657,20 +1664,20 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
"MOM: ADIABATIC and BULKMIXEDLAYER can not both be defined.")

! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
if (CS%debug .or. G%symmetric) &
call clone_MOM_domain(G%Domain, G%Domain_aux, symmetric=.false.)
if (CS%debug .or. dG%symmetric) &
call clone_MOM_domain(dG%Domain, dG%Domain_aux, symmetric=.false.)

call MOM_timing_init(CS)

call tracer_registry_init(param_file, CS%tracer_Reg)

! Copy a common variable from the vertical grid to the horizontal grid.
! Consider removing this later?
G%ke = GV%ke
! G%ke = GV%ke

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB
is = dG%isc ; ie = dG%iec ; js = dG%jsc ; je = dG%jec ; nz = GV%ke
isd = dG%isd ; ied = dG%ied ; jsd = dG%jsd ; jed = dG%jed
IsdB = dG%IsdB ; IedB = dG%IedB ; JsdB = dG%JsdB ; JedB = dG%JedB

! Allocate and initialize space for primary MOM variables.
ALLOC_(CS%u(IsdB:IedB,jsd:jed,nz)) ; CS%u(:,:,:) = 0.0
Expand Down Expand Up @@ -1785,17 +1792,28 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
call callTree_waypoint("restart registration complete (initialize_MOM)")

call cpu_clock_begin(id_clock_MOM_init)
call MOM_initialize_fixed(G, CS%OBC, param_file, write_geom_files, dirs%output_directory)
call MOM_initialize_fixed(dG, CS%OBC, param_file, write_geom_files, dirs%output_directory)
call callTree_waypoint("returned from MOM_initialize_fixed() (initialize_MOM)")
call MOM_initialize_coord(GV, param_file, write_geom_files, &
dirs%output_directory, CS%tv, G%max_depth)
dirs%output_directory, CS%tv, dG%max_depth)
call callTree_waypoint("returned from MOM_initialize_coord() (initialize_MOM)")

if (CS%use_ALE_algorithm) then
call ALE_init(param_file, GV, G%max_depth, CS%ALE_CSp)
call ALE_init(param_file, GV, dG%max_depth, CS%ALE_CSp)
call callTree_waypoint("returned from ALE_init() (initialize_MOM)")
endif

! Shift from using the temporary dynamic grid type to using the final (potentially
! static) ocean grid type.
! call clone_MOM_domain(dG%Domain, CS%G%Domain)
! call MOM_grid_init(CS%G, param_file)

call copy_dyngrid_to_MOM_grid(dg, G)
! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
if (CS%debug .or. G%symmetric) &
call clone_MOM_domain(G%Domain, G%Domain_aux, symmetric=.false.)
G%ke = GV%ke

call MOM_initialize_state(CS%u, CS%v, CS%h, CS%tv, Time, G, GV, param_file, &
dirs, CS%restart_CSp, CS%ALE_CSp, CS%tracer_Reg, &
CS%sponge_CSp, CS%ALE_sponge_CSp, CS%OBC, Time_in)
Expand All @@ -1805,20 +1823,6 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
! From this point, there may be pointers being set, so the final grid type
! that will persist through the run has to be used.

! Shift from using the temporary dynamic grid type to using the final (potentially
! static) ocean grid type.
! call clone_MOM_domain(dG%Domain, CS%G%Domain)
! call MOM_grid_init(CS%G, param_file)
! call copy_dyngrid_to_MOM_grid(dg, CS%G)
! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
! if (CS%debug .or. CS%G%symmetric) &
! call clone_MOM_domain(CS%G%Domain, CS%G%Domain_aux, symmetric=.false.)

! ! Copy a common variable from the vertical grid to the horizontal grid.
! ! Consider removing this later?
! CS%G%ke = GV%ke
! G => CS%G

if (test_grid_copy) then
! Copy the data from the temporary grid to the dyn_hor_grid to CS%G.
call create_dyn_horgrid(dG, G%HI)
Expand Down Expand Up @@ -1885,12 +1889,12 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)

diag => CS%diag
! Initialize the diag mediator.
call diag_mediator_init(G, param_file, diag, doc_file_dir=dirs%output_directory)
call diag_mediator_init(G, GV%ke, param_file, diag, doc_file_dir=dirs%output_directory)

! Initialize the diagnostics mask arrays.
! This step has to be done after call to MOM_initialize_state
! and before MOM_diagnostics_init
call diag_masks_set(G, CS%missing, diag)
call diag_masks_set(G, GV%ke, CS%missing, diag)

! Set up a pointers h within diag mediator control structure,
! this needs to occur _after_ CS%h has been allocated.
Expand Down
4 changes: 3 additions & 1 deletion src/core/MOM_transcribe_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG)
oG%south_lat = dG%south_lat ; oG%west_lon = dG%west_lon
oG%len_lat = dG%len_lat ; oG%len_lon = dG%len_lon
oG%Rad_Earth = dG%Rad_Earth ; oG%max_depth = dG%max_depth
oG%g_Earth = dG%g_Earth

! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(oG%areaT, oG%Domain)
Expand Down Expand Up @@ -288,7 +289,8 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG)
dG%areaT_global = oG%areaT_global ; dG%IareaT_global = oG%IareaT_global
dG%south_lat = oG%south_lat ; dG%west_lon = oG%west_lon
dG%len_lat = oG%len_lat ; dG%len_lon = oG%len_lon
dG%Rad_Earth = oG%Rad_Earth ; dG%max_depth = oG%max_depth
dG%Rad_Earth = oG%Rad_Earth ; dG%max_depth = oG%max_depth
dG%g_Earth = oG%g_Earth

! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(dG%areaT, dG%Domain)
Expand Down
8 changes: 4 additions & 4 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, fluxes, &

! volume mean potential temperature
if (CS%id_thetaoga>0) then
thetaoga = global_volume_mean(tv%T, h, G)
thetaoga = global_volume_mean(tv%T, h, G, GV)
call post_data(CS%id_thetaoga, thetaoga, CS%diag)
endif

Expand All @@ -341,7 +341,7 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, fluxes, &

! volume mean salinity
if (CS%id_soga>0) then
soga = global_volume_mean(tv%S, h, G)
soga = global_volume_mean(tv%S, h, G, GV)
call post_data(CS%id_soga, soga, CS%diag)
endif

Expand All @@ -356,13 +356,13 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, fluxes, &

! layer mean potential temperature
if (CS%id_temp_layer_ave>0) then
temp_layer_ave = global_layer_mean(tv%T, h, G)
temp_layer_ave = global_layer_mean(tv%T, h, G, GV)
call post_data_1d_k(CS%id_temp_layer_ave, temp_layer_ave, CS%diag)
endif

! layer mean salinity
if (CS%id_salt_layer_ave>0) then
salt_layer_ave = global_layer_mean(tv%S, h, G)
salt_layer_ave = global_layer_mean(tv%S, h, G, GV)
call post_data_1d_k(CS%id_salt_layer_ave, salt_layer_ave, CS%diag)
endif

Expand Down
3 changes: 2 additions & 1 deletion src/diagnostics/MOM_sum_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ subroutine write_energy(u, v, h, tv, day, n, G, GV, CS, tracer_CSp)
energypath_nc = trim(CS%energyfile) // ".nc"
if (day > CS%Start_time) then
call reopen_file(CS%fileenergy_nc, trim(energypath_nc), vars, &
num_nc_fields, G, CS%fields, SINGLE_FILE, CS%timeunit, GV=GV)
num_nc_fields, CS%fields, SINGLE_FILE, CS%timeunit, &
G=G, GV=GV)
else
call create_file(CS%fileenergy_nc, trim(energypath_nc), vars, &
num_nc_fields, CS%fields, SINGLE_FILE, CS%timeunit, &
Expand Down
Loading

0 comments on commit 2861388

Please sign in to comment.