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

Remove calls to no-op routines in ensemble manager #637

Merged
merged 13 commits into from
Mar 13, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module assim_tools_mod

use ensemble_manager_mod, only : ensemble_type, get_my_num_vars, get_my_vars, &
compute_copy_mean_var, get_var_owner_index, &
prepare_to_update_copies, map_pe_to_task
map_pe_to_task

use mpi_utilities_mod, only : my_task_id, broadcast_send, broadcast_recv, &
sum_across_tasks, task_count, start_mpi_timer, &
Expand Down Expand Up @@ -496,10 +496,6 @@ subroutine filter_assim(ens_handle, obs_ens_handle, obs_seq, keys, &
my_state_loc( ens_handle%my_num_vars))
! end alloc

! we are going to read/write the copies array
call prepare_to_update_copies(ens_handle)
call prepare_to_update_copies(obs_ens_handle)

! Initialize assim_tools_module if needed
if (.not. module_initialized) call assim_tools_init()

Expand Down
16 changes: 4 additions & 12 deletions assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ module filter_mod
compute_copy_mean, compute_copy_mean_sd, &
compute_copy_mean_var, duplicate_ens, get_copy_owner_index, &
get_ensemble_time, set_ensemble_time, broadcast_copy, &
map_pe_to_task, prepare_to_update_copies, &
copies_in_window, set_num_extra_copies, get_allow_transpose, &
all_copies_to_all_vars, allocate_single_copy, allocate_vars, &
get_single_copy, put_single_copy, deallocate_single_copy, &
print_ens_handle
map_pe_to_task, copies_in_window, set_num_extra_copies, &
get_allow_transpose, all_copies_to_all_vars, &
allocate_single_copy, allocate_vars, get_single_copy, &
put_single_copy, deallocate_single_copy, print_ens_handle

use adaptive_inflate_mod, only : do_ss_inflate, mean_from_restart, sd_from_restart, &
inflate_ens, adaptive_inflate_init, &
Expand Down Expand Up @@ -806,7 +805,6 @@ subroutine filter_main()
call trace_message('Before prior inflation damping and prep')

if (inf_damping(PRIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(PRIOR_INF_COPY, :) = 1.0_r8 + &
inf_damping(PRIOR_INF) * (state_ens_handle%copies(PRIOR_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -907,7 +905,6 @@ subroutine filter_main()
call trace_message('Before posterior inflation damping')

if (inf_damping(POSTERIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(POST_INF_COPY, :) = 1.0_r8 + &
inf_damping(POSTERIOR_INF) * (state_ens_handle%copies(POST_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -1549,9 +1546,6 @@ subroutine filter_ensemble_inflate(ens_handle, inflate_copy, inflate, ENS_MEAN_C

integer :: j, group, grp_bot, grp_top, grp_size

! Assumes that the ensemble is copy complete
call prepare_to_update_copies(ens_handle)

! Inflate each group separately; Divide ensemble into num_groups groups
grp_size = ens_size / num_groups

Expand Down Expand Up @@ -2827,8 +2821,6 @@ subroutine update_observations_radar(obs_ens_handle, ens_size, seq, keys, prior_
! for quiet execution, set it to false.
verbose = .true.

call prepare_to_update_copies(obs_ens_handle)

do j = 1, obs_ens_handle%my_num_vars
! get the key number associated with each of my subset of obs
! then get the obs and extract info from it.
Expand Down
14 changes: 4 additions & 10 deletions assimilation_code/modules/assimilation/filter_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ module filter_mod
compute_copy_mean, compute_copy_mean_sd, &
compute_copy_mean_var, duplicate_ens, get_copy_owner_index, &
get_ensemble_time, set_ensemble_time, broadcast_copy, &
map_pe_to_task, prepare_to_update_copies, &
copies_in_window, set_num_extra_copies, get_allow_transpose, &
all_copies_to_all_vars, allocate_single_copy, allocate_vars, &
get_single_copy, put_single_copy, deallocate_single_copy, &
print_ens_handle
map_pe_to_task, copies_in_window, set_num_extra_copies, &
get_allow_transpose, all_copies_to_all_vars, &
allocate_single_copy, allocate_vars, get_single_copy, &
put_single_copy, deallocate_single_copy, print_ens_handle

use adaptive_inflate_mod, only : do_ss_inflate, mean_from_restart, sd_from_restart, &
inflate_ens, adaptive_inflate_init, &
Expand Down Expand Up @@ -809,7 +808,6 @@ subroutine filter_main()
call trace_message('Before prior inflation damping and prep')

if (inf_damping(PRIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(PRIOR_INF_COPY, :) = 1.0_r8 + &
inf_damping(PRIOR_INF) * (state_ens_handle%copies(PRIOR_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -910,7 +908,6 @@ subroutine filter_main()
call trace_message('Before posterior inflation damping')

if (inf_damping(POSTERIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(POST_INF_COPY, :) = 1.0_r8 + &
inf_damping(POSTERIOR_INF) * (state_ens_handle%copies(POST_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -1566,9 +1563,6 @@ subroutine filter_ensemble_inflate(ens_handle, inflate_copy, inflate, ENS_MEAN_C
real(r8) :: lower_bound, upper_bound
integer :: dist_type

! Assumes that the ensemble is copy complete
call prepare_to_update_copies(ens_handle)

! Inflate each group separately; Divide ensemble into num_groups groups
grp_size = ens_size / num_groups

Expand Down
6 changes: 2 additions & 4 deletions assimilation_code/modules/assimilation/obs_model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module obs_model_mod
operator(/=), operator(>), operator(-), &
operator(/), operator(+), operator(<), operator(==), &
operator(<=), operator(>=)
use ensemble_manager_mod, only : get_ensemble_time, ensemble_type, map_task_to_pe, &
prepare_to_update_vars
use ensemble_manager_mod, only : get_ensemble_time, ensemble_type, map_task_to_pe

use mpi_utilities_mod, only : my_task_id, task_sync, block_task, &
sum_across_tasks, shell_execute, my_task_id
use io_filenames_mod, only : file_info_type
Expand Down Expand Up @@ -348,8 +348,6 @@ subroutine advance_state(ens_handle, ens_size, target_time, async, adv_ens_comma
! Ok, this task does need to advance something.
need_advance = 1

call prepare_to_update_vars(ens_handle)

! Increment number of ensemble member copies I have.
my_num_state_copies = my_num_state_copies + 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module forward_operator_mod
use obs_kind_mod, only : assimilate_this_type_of_obs, evaluate_this_type_of_obs

use ensemble_manager_mod, only : ensemble_type, compute_copy_mean_var, &
prepare_to_read_from_vars, &
prepare_to_write_to_vars, &
get_my_num_copies, copies_in_window, &
get_allow_transpose, all_vars_to_all_copies, &
all_copies_to_all_vars, allocate_single_copy, &
Expand Down Expand Up @@ -127,11 +125,6 @@ subroutine get_obs_ens_distrib_state(ens_handle, obs_fwd_op_ens_handle, &
istatus = 999123
expected_obs = MISSING_R8

! FIXME: these no longer do anything?
! call prepare_to_write_to_vars(obs_fwd_op_ens_handle)
! call prepare_to_write_to_vars(qc_ens_handle)
! call prepare_to_read_from_vars(ens_handle)

! Set up access to the state
call create_state_window(ens_handle, obs_fwd_op_ens_handle, qc_ens_handle)

Expand Down
Loading