Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
8274de6
Merge branch 'master' of github.com:NOAA-GFDL/MOM6 into dev/master
May 6, 2016
f68578f
Merge branch 'dev/master' of github.com:ashao/MOM6 into dev/master
Jun 16, 2016
f1460df
Need to figure out why Kd values change
Jun 16, 2016
31b50e3
Works storing fields offline with Baltic_ALE_z testcase with THICKNES…
Jun 27, 2016
ae78ec3
Offline tracer transport reproduces bitwise identical results in the …
Jul 8, 2016
d335eac
Renamed offline file name variables read from MOM_input to avoid conf…
Jul 8, 2016
3776e9c
Commiting modified solo driver which allows step_MOM to be bypassed
Jul 8, 2016
f2087ee
Merge branch 'dev/master' of github.com:ashao/MOM6 into dev/master
Jul 8, 2016
eedef37
Misplaced endif was accidentally setting T and S to 0 when .not. diab…
Jul 8, 2016
168141e
Commiting local changes
Jul 12, 2016
8adb700
More local changes
Jul 12, 2016
86e1ba8
Merge branch 'dev/master' of github.com:ashao/MOM6 into dev/master
Jul 12, 2016
0e7fefb
Initialize some fields to make sure that checksums reproduce
Jul 13, 2016
107756b
SIS2 global test case now reproduces exactly offline
Jul 14, 2016
fee50bc
MOM6 offline now does staggered offline advection and diffusion by sp…
Jul 15, 2016
5bc35fa
Recalculation of h_end after all mass fluxes matches h_end to within …
Jul 27, 2016
ca08319
Convergence improved to 6 digits of accuracy
Aug 2, 2016
79dfab0
Rewrote advection step using a flux limited and added Strang time split
Aug 8, 2016
c28bf42
Found one small indexing error. Tracer now conserving to within algor…
Aug 9, 2016
7477725
Working out which halo updates aneed to be done.
Aug 9, 2016
33836c6
Extended calculation slightly into the halo region
Aug 9, 2016
378c623
Confirmed working convergence with online/offline global
Aug 9, 2016
d9533d5
Started cleaning up the code, but now it no longer converges. Need to…
Aug 9, 2016
0839324
Cleaned up some merge
Aug 9, 2016
331e26d
Updated indexing to extend one point into the halo and added necessar…
Aug 15, 2016
a927d7c
Updated indexing to extend one point into the halo and added necessar…
Aug 15, 2016
80b86dd
Resolved conflict with MOM6 master with MOM_tracer_hor_diff.F90 and M…
Aug 15, 2016
c30adb7
Added an update to eb so that when water is fluxed out of the ocean f…
Aug 18, 2016
e5bfdc4
Merge branch 'dev/master' of https://github.com/NOAA-GFDL/MOM6 into d…
Aug 18, 2016
a2bbd68
Syncing to git repository
Aug 24, 2016
cb898b0
Fixed a bug that led to nonconservation of passive tracers in ALE mode
Aug 24, 2016
e7116f1
Resolved conflict
Aug 24, 2016
65b4f21
Changed so that update to ea is based on dThickness
Aug 24, 2016
87cf480
Sync development between laptop and Github
Aug 30, 2016
b40b43e
Tracer conservation with Baltic_ALE_z test case, however convergence …
Sep 1, 2016
dd32324
Continued work on figuring out how to get convergence quicker when in…
Sep 2, 2016
d70327b
Started work on a more aggressive limiter
Sep 6, 2016
ac2d32d
Testing new direction aware flux limiter for offline transport
Sep 9, 2016
2ade26d
Merge branch 'dev/master' of github.com:NOAA-GFDL/MOM6 into dev/master
Sep 9, 2016
529d1b8
Further testing of flux limiter needed
Sep 10, 2016
f83f3f5
Syncing before switching brnach
Sep 14, 2016
87c20d8
Fixed conflicts with dev/master
Sep 22, 2016
2c953cb
Merge branch 'dev/master' of github.com:NOAA-GFDL/MOM6 into dev/master
Sep 26, 2016
48d6ad1
Convergence occurs faster when FIRST_DIRECTION=1, meridional first, c…
Sep 27, 2016
756175f
Added compile time option to change how often the ALE remapping is do…
Sep 28, 2016
bda7606
Fixed a bug, tracer conserves
Sep 29, 2016
8ecb2c2
Number of iterations might be limited by CFL, need to play around wit…
Sep 30, 2016
db3309f
Forgot to add MOM.F90
Sep 30, 2016
89a47b8
Rewrote the ALE section of tracers. Eliminated calls to separate flux…
Sep 30, 2016
1bfabc0
Code ready for testing in OM4
Oct 3, 2016
b21e331
Tracer now conserves perfectly in ALE-z mode in the Baltic case
Oct 5, 2016
724dc3e
Answers do not change across PE counts
Oct 6, 2016
1209161
Cleaned up and commented in the code. Answers do not change across PE…
Oct 7, 2016
e298f41
Tested with OM4. Ready for merge
Oct 7, 2016
fd3f1dd
Fixed a conflict in .DoxygenLayout.xml
Oct 7, 2016
d9f8b85
Added some brief instructions of use to the end of MOM_offline_contro…
Oct 7, 2016
966814f
Removed one unnecessary temporary file
Oct 7, 2016
e175527
Doxygenized comments in MOM_offline_control.F90 and responded to requ…
Oct 10, 2016
039baf5
Revert changes to .DoxygenLayout.xml
Oct 10, 2016
e84577a
Removed unused declaration of do_online from step_MOM in core/MOM.F90.
Oct 10, 2016
4513996
Removed references to MOM_CSp%do_online from step_tracers routine. Th…
Oct 10, 2016
3010d0f
Added in checks to ensure that contained within non-associated contro…
Oct 11, 2016
7808bfd
Reorganized readin of offline mode runtime parameters to ensure that …
Oct 12, 2016
43a738c
Add a scheme to redistribute remaining flux into water column
Oct 13, 2016
44d71c9
Need to figure out why answers changed
Oct 13, 2016
ecdde94
Fixed conflict
Oct 13, 2016
cb796e0
Need to figure otu why answers are changing
Oct 13, 2016
f837dc5
Answer changes were due to aggressive compiler optimizations on works…
Oct 13, 2016
ecd412e
Test routine to redistribute the remaining horizontal fluxes
Oct 14, 2016
6e6ab58
Test routine to redistribute the remaining horizontal fluxes
Oct 14, 2016
56a7685
Merge branch 'origin/offline_tracers' of github.com:ashao/MOM6 into d…
Oct 14, 2016
73c5b15
Redistribution of residual fluxes works in Baltic_ALE_z, now test in OM4
Oct 14, 2016
af2c6b8
Beginning work on second option of redistributing fluxes more locally
Oct 19, 2016
54eea3b
Added redistrubtion of fluxes up the column for u-direction, need to …
Oct 20, 2016
8fd4475
Merge branch 'origin/offline_tracers' of https://github.com/ashao/MOM…
adcroft Oct 21, 2016
2dc1be6
Corrected cell_method for h_preale diagnostic
adcroft Oct 21, 2016
50b145a
Reverse logic so that (online) dynamics is the normal mode
adcroft Oct 21, 2016
0190b7b
Ready to test the two vertical redistribution methods on OM4_05
Oct 24, 2016
8fc1698
Tested both barotropic and upwards options for redistributing residua…
Oct 24, 2016
7319c0f
Merged in commits from dev/offline_tracers which introduce two differ…
Oct 24, 2016
cd1f4db
Merge branch 'origin/offline_tracers' of https://github.com/ashao/MOM…
adcroft Oct 24, 2016
4a728ca
Make sure that logical flag 'converged' is initialized to .false. eve…
Oct 24, 2016
fe2e8f3
Merge pull request #1 from adcroft/ashao-origin/offline_tracers
ashao Oct 24, 2016
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
63 changes: 44 additions & 19 deletions config_src/solo_driver/MOM_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ program MOM_main
use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end
use MOM, only : initialize_MOM, step_MOM, MOM_control_struct, MOM_end
use MOM, only : calculate_surface_state, finish_MOM_initialization
use MOM, only : step_tracers
use MOM_domains, only : MOM_infra_init, MOM_infra_end
use MOM_error_handler, only : MOM_error, MOM_mesg, WARNING, FATAL, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
Expand Down Expand Up @@ -134,6 +135,7 @@ program MOM_main
! representation of time_step.
real :: time_step ! The time step of a call to step_MOM in seconds.
real :: dt ! The baroclinic dynamics time step, in seconds.
real :: dt_off ! Offline time step in seconds
integer :: ntstep ! The number of baroclinic dynamics time steps
! within time_step.

Expand Down Expand Up @@ -169,6 +171,14 @@ program MOM_main
logical :: unit_in_use
integer :: initClock, mainClock, termClock

logical :: offline_tracer_mode ! If false, use the model in prognostic mode where
! the barotropic and baroclinic dynamics, thermodynamics,
! etc. are stepped forward integrated in time.
! If true, then all of the above are bypassed with all
! fields necessary to integrate only the tracer advection
! and diffusion equation are read in from files stored from
! a previous integration of the prognostic model

type(MOM_control_struct), pointer :: MOM_CSp => NULL()
type(surface_forcing_CS), pointer :: surface_forcing_CSp => NULL()
type(sum_output_CS), pointer :: sum_output_CSp => NULL()
Expand Down Expand Up @@ -250,17 +260,18 @@ program MOM_main
else
Start_time = set_time(0,days=0)
endif

if (sum(date) >= 0) then
! In this case, the segment starts at a time fixed by ocean_solo.res
segment_start_time = set_date(date(1),date(2),date(3),date(4),date(5),date(6))
Time = segment_start_time
call initialize_MOM(Time, param_file, dirs, MOM_CSp, segment_start_time)
! Note the not before CS%d
call initialize_MOM(Time, param_file, dirs, MOM_CSp, segment_start_time, offline_tracer_mode = offline_tracer_mode)
else
! In this case, the segment starts at a time read from the MOM restart file
! or left as Start_time by MOM_initialize.
Time = Start_time
call initialize_MOM(Time, param_file, dirs, MOM_CSp)
call initialize_MOM(Time, param_file, dirs, MOM_CSp, offline_tracer_mode=offline_tracer_mode)
endif
fluxes%C_p = MOM_CSp%tv%C_p ! Copy the heat capacity for consistency.

Expand Down Expand Up @@ -298,8 +309,12 @@ program MOM_main
call get_param(param_file, mod, "DT_FORCING", time_step, &
"The time step for changing forcing, coupling with other \n"//&
"components, or potentially writing certain diagnostics. \n"//&
"The default value is given by DT.", units="s", default=dt)

"The default value is given by DT.", units="s", default=dt)
if (offline_tracer_mode) then
call get_param(param_file, mod, "DT_OFFLINE", time_step, &
"Time step for the offline time step")
dt = time_step
endif
ntstep = MAX(1,ceiling(time_step/dt - 0.001))

Time_step_ocean = set_time(int(floor(time_step+0.5)))
Expand Down Expand Up @@ -350,6 +365,7 @@ program MOM_main
"The interval in units of TIMEUNIT between saves of the \n"//&
"energies of the run and other globally summed diagnostics.", &
default=set_time(int(time_step+0.5)), timeunit=Time_unit)

call log_param(param_file, mod, "ELAPSED TIME AS MASTER", elapsed_time_master)

! Close the param_file. No further parsing of input is possible after this.
Expand Down Expand Up @@ -399,8 +415,10 @@ program MOM_main
call callTree_enter("Main loop, MOM_driver.F90",n)

! Set the forcing for the next steps.
call set_forcing(state, fluxes, Time, Time_step_ocean, grid, &
if (.not. offline_tracer_mode) then
call set_forcing(state, fluxes, Time, Time_step_ocean, grid, &
surface_forcing_CSp)
endif
if (MOM_CSp%debug) then
call MOM_forcing_chksum("After set forcing", fluxes, grid, haloshift=0)
endif
Expand All @@ -423,10 +441,14 @@ program MOM_main

! This call steps the model over a time time_step.
Time1 = Master_Time ; Time = Master_Time
call step_MOM(fluxes, state, Time1, time_step, MOM_CSp)
if (offline_tracer_mode) then
call step_tracers(fluxes, state, Time1, time_step, MOM_CSp)
else
call step_MOM(fluxes, state, Time1, time_step, MOM_CSp)
endif

! Time = Time + Time_step_ocean
! This is here to enable fractional-second time steps.
! Time = Time + Time_step_ocean
! This is here to enable fractional-second time steps.
elapsed_time = elapsed_time + time_step
if (elapsed_time > 2e9) then
! This is here to ensure that the conversion from a real to an integer
Expand All @@ -450,15 +472,17 @@ program MOM_main
surface_forcing_CSp%handles)
call disable_averaging(MOM_CSp%diag)

if (fluxes%fluxes_used) then
call enable_averaging(fluxes%dt_buoy_accum, Time, MOM_CSp%diag)
call forcing_diagnostics(fluxes, state, fluxes%dt_buoy_accum, grid, &
MOM_CSp%diag, surface_forcing_CSp%handles)
call accumulate_net_input(fluxes, state, fluxes%dt_buoy_accum, grid, sum_output_CSp)
call disable_averaging(MOM_CSp%diag)
else
call MOM_error(FATAL, "The solo MOM_driver is not yet set up to handle "//&
"thermodynamic time steps that are longer than the couping timestep.")
if (.not. offline_tracer_mode) then
if (fluxes%fluxes_used) then
call enable_averaging(fluxes%dt_buoy_accum, Time, MOM_CSp%diag)
call forcing_diagnostics(fluxes, state, fluxes%dt_buoy_accum, grid, &
MOM_CSp%diag, surface_forcing_CSp%handles)
call accumulate_net_input(fluxes, state, fluxes%dt_buoy_accum, grid, sum_output_CSp)
call disable_averaging(MOM_CSp%diag)
else
call MOM_error(FATAL, "The solo MOM_driver is not yet set up to handle "//&
"thermodynamic time steps that are longer than the coupling timestep.")
endif
endif

! See if it is time to write out the energy.
Expand Down Expand Up @@ -502,7 +526,8 @@ program MOM_main
if (Restart_control>=0) then
if (MOM_CSp%dt_trans > 0.0) call MOM_error(WARNING, "End of MOM_main reached "//&
"with a non-zero dt_trans. Additional restart fields are required.")
if (.not.fluxes%fluxes_used) call MOM_error(FATAL, "End of MOM_main reached "//&
if (.not.fluxes%fluxes_used .and. .not. offline_tracer_mode) call MOM_error(FATAL, &
"End of MOM_main reached "//&
"with unused buoyancy fluxes. For conservation, the ocean restart "//&
"files can only be created after the buoyancy forcing is applied.")

Expand Down
118 changes: 115 additions & 3 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,17 @@ module MOM_ALE
integer, dimension(:), allocatable :: id_tracer_remap_tendency !< diagnostic id
integer, dimension(:), allocatable :: id_Htracer_remap_tendency !< diagnostic id
integer, dimension(:), allocatable :: id_Htracer_remap_tendency_2d !< diagnostic id
logical, dimension(:), allocatable :: do_tendency_diag !< flag for doing diagnostics
logical, dimension(:), allocatable :: do_tendency_diag !< flag for doing diagnostics
integer :: id_dzRegrid

end type

! Publicly available functions
public ALE_init
public ALE_end
public ALE_main
public ALE_main
public ALE_main_offline
public ALE_offline_tracer_final
public ALE_build_grid
public ALE_remap_scalar
public pressure_gradient_plm
Expand Down Expand Up @@ -282,6 +285,9 @@ subroutine ALE_register_diags(Time, G, diag, C_p, Reg, CS)
CS%id_Htracer_remap_tendency(:) = -1
CS%id_Htracer_remap_tendency_2d(:) = -1

CS%id_dzRegrid = register_diag_field('ocean_model','dzRegrid',diag%axesTi,Time, &
'Change in interface height due to ALE regridding', 'meter')

if(ntr > 0) then

do m=1,ntr
Expand Down Expand Up @@ -375,7 +381,6 @@ subroutine ALE_main( G, GV, h, u, v, tv, Reg, CS, dt)
type(tracer_registry_type), pointer :: Reg !< Tracer registry structure
type(ALE_CS), pointer :: CS !< Regridding parameters and options
real, optional, intent(in) :: dt !< Time step between calls to ALE_main()

! Local variables
real, dimension(SZI_(G), SZJ_(G), SZK_(GV)+1) :: dzRegrid ! The change in grid interface positions
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)) :: h_new ! New 3D grid obtained after last time step (m or Pa)
Expand All @@ -399,6 +404,7 @@ subroutine ALE_main( G, GV, h, u, v, tv, Reg, CS, dt)
if (CS%show_call_tree) call callTree_waypoint("new grid generated (ALE_main)")

! Remap all variables from old grid h onto new grid h_new

call remap_all_state_vars( CS%remapCS, CS, G, GV, h, h_new, -dzRegrid, Reg, &
u, v, CS%show_call_tree, dt )

Expand All @@ -414,8 +420,114 @@ subroutine ALE_main( G, GV, h, u, v, tv, Reg, CS, dt)
enddo

if (CS%show_call_tree) call callTree_leave("ALE_main()")

if (CS%id_dzRegrid>0 .and. present(dt)) call post_data(CS%id_dzRegrid, dzRegrid, CS%diag)


end subroutine ALE_main

!> Takes care of (1) building a new grid and (2) remapping all variables between
!! the old grid and the new grid. The creation of the new grid can be based
!! on z coordinates, target interface densities, sigma coordinates or any
!! arbitrary coordinate system.
subroutine ALE_main_offline( G, GV, h, tv, Reg, CS, dt)
type(ocean_grid_type), intent(in) :: G !< Ocean grid informations
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(inout) :: h !< Current 3D grid obtained after last time step (m or Pa)
type(thermo_var_ptrs), intent(inout) :: tv !< Thermodynamic variable structure
type(tracer_registry_type), pointer :: Reg !< Tracer registry structure
type(ALE_CS), pointer :: CS !< Regridding parameters and options
real, optional, intent(in) :: dt !< Time step between calls to ALE_main()
! Local variables
real, dimension(SZI_(G), SZJ_(G), SZK_(GV)+1) :: dzRegrid ! The change in grid interface positions
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)) :: h_new ! New 3D grid obtained after last time step (m or Pa)
integer :: nk, i, j, k, isc, iec, jsc, jec

nk = GV%ke; isc = G%isc; iec = G%iec; jsc = G%jsc; jec = G%jec

if (CS%show_call_tree) call callTree_enter("ALE_main_offline(), MOM_ALE.F90")

if (present(dt)) then
call ALE_update_regrid_weights( dt, CS )
endif
dzRegrid(:,:,:) = 0.0

! Build new grid. The new grid is stored in h_new. The old grid is h.
! Both are needed for the subsequent remapping of variables.
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid )

call check_grid( G, GV, h, 0. )

if (CS%show_call_tree) call callTree_waypoint("new grid generated (ALE_main)")

! Remap all variables from old grid h onto new grid h_new

call remap_all_state_vars( CS%remapCS, CS, G, GV, h, h_new, -dzRegrid, Reg, &
debug=CS%show_call_tree, dt=dt )

if (CS%show_call_tree) call callTree_waypoint("state remapped (ALE_main)")

! Override old grid with new one. The new grid 'h_new' is built in
! one of the 'build_...' routines above.
!$OMP parallel do default(none) shared(isc,iec,jsc,jec,nk,h,h_new,CS)
do k = 1,nk
do j = jsc-1,jec+1 ; do i = isc-1,iec+1
h(i,j,k) = h_new(i,j,k)
enddo ; enddo
enddo

if (CS%show_call_tree) call callTree_leave("ALE_main()")
if (CS%id_dzRegrid>0 .and. present(dt)) call post_data(CS%id_dzRegrid, dzRegrid, CS%diag)

end subroutine ALE_main_offline

!> Remaps all tracers from h onto h_target. This is intended to be called when tracers
!! are done offline. In the case where transports don't quite conserve, we still want to
!! make sure that layer thicknesses offline do not drift too far away from the online model
subroutine ALE_offline_tracer_final( G, GV, h, h_target, Reg, CS)
type(ocean_grid_type), intent(in) :: G !< Ocean grid informations
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(inout) :: h !< Current 3D grid obtained after last time step (m or Pa)
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h_target !< Current 3D grid obtained after last time step (m or Pa)
type(tracer_registry_type), pointer :: Reg !< Tracer registry structure
type(ALE_CS), pointer :: CS !< Regridding parameters and options
! Local variables

real, dimension(SZI_(G), SZJ_(G), SZK_(GV)+1) :: dzRegrid ! The change in grid interface positions
integer :: nk, i, j, k, isc, iec, jsc, jec

nk = GV%ke; isc = G%isc; iec = G%iec; jsc = G%jsc; jec = G%jec

if (CS%show_call_tree) call callTree_enter("ALE_offline_tracer_final(), MOM_ALE.F90")

! It does not seem that remap_all_state_vars uses dzRegrid for tracers, only for u, v
dzRegrid(:,:,:) = 0.0

call check_grid( G, GV, h, 0. )
call check_grid( G, GV, h_target, 0. )

if (CS%show_call_tree) call callTree_waypoint("Source and target grids checked (ALE_offline_tracer)")

! Remap all variables from old grid h onto new grid h_new

call remap_all_state_vars( CS%remapCS, CS, G, GV, h, h_target, -dzRegrid, Reg, &
debug=CS%show_call_tree )

if (CS%show_call_tree) call callTree_waypoint("state remapped (ALE_offline_tracer)")

! Override old grid with new one. The new grid 'h_new' is built in
! one of the 'build_...' routines above.
!$OMP parallel do default(none) shared(isc,iec,jsc,jec,nk,h,h_target,CS)
do k = 1,nk
do j = jsc-1,jec+1 ; do i = isc-1,iec+1
h(i,j,k) = h_target(i,j,k)
enddo ; enddo
enddo

if (CS%show_call_tree) call callTree_leave("ALE_offline_tracer()")

end subroutine ALE_offline_tracer_final

!> Check grid for negative thicknesses
subroutine check_grid( G, GV, h, threshold )
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
Expand Down
Loading