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

Some minor cleanups following #308 #310

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 14 additions & 15 deletions FV3/atmos_cubed_sphere/tools/coarse_grained_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,7 @@ subroutine fv_coarse_diag(Atm, Time, zvir)
call get_need_nd_work_array(3, need_3d_work_array)
call get_need_mass_array(Atm(tile_count)%coarse_graining%strategy, need_mass_array)
call get_need_height_array(need_height_array)

if (trim(Atm(tile_count)%coarse_graining%strategy) .eq. PRESSURE_LEVEL) then
call get_need_masked_area_array(need_masked_area_array)
else
need_masked_area_array = .false.
endif
call get_need_masked_area_array(Atm(tile_count)%coarse_graining%strategy, need_masked_area_array)

call get_fine_array_bounds(is, ie, js, je)
call get_coarse_array_bounds(is_coarse, ie_coarse, js_coarse, je_coarse)
Expand Down Expand Up @@ -1014,17 +1009,18 @@ subroutine get_need_mass_array(coarsening_strategy, need_mass_array)
character(len=64), intent(in) :: coarsening_strategy
logical, intent(out) :: need_mass_array

logical :: valid_axes, valid_id, valid_reduction_method, valid_strategy
integer :: index

need_mass_array = .false.
valid_strategy = trim(coarsening_strategy) .eq. MODEL_LEVEL
if (.not. valid_strategy) return
do index = 1, DIAG_SIZE
if ((coarse_diagnostics(index)%axes == 3) .and. &
(trim(coarse_diagnostics(index)%reduction_method) .eq. MASS_WEIGHTED) .and. &
(coarse_diagnostics(index)%id > 0) .and. &
(trim(coarsening_strategy) .eq. MODEL_LEVEL)) then
need_mass_array = .true.
exit
endif
valid_axes = coarse_diagnostics(index)%axes .eq. 3
valid_id = coarse_diagnostics(index)%id .gt. 0
valid_reduction_method = trim(coarse_diagnostics(index)%reduction_method) .eq. MASS_WEIGHTED
need_mass_array = valid_axes .and. valid_id .and. valid_reduction_method
if (need_mass_array) exit
enddo
end subroutine get_need_mass_array

Expand All @@ -1046,13 +1042,16 @@ subroutine get_need_height_array(need_height_array)
enddo
end subroutine get_need_height_array

subroutine get_need_masked_area_array(need_masked_area_array)
subroutine get_need_masked_area_array(coarsening_strategy, need_masked_area_array)
character(len=64), intent(in) :: coarsening_strategy
logical, intent(out) :: need_masked_area_array

logical :: valid_axes, valid_id
logical :: valid_axes, valid_id, valid_strategy
integer :: index

need_masked_area_array = .false.
valid_strategy = trim(coarsening_strategy) .eq. PRESSURE_LEVEL
if (.not. valid_strategy) return
do index = 1, DIAG_SIZE
valid_axes = coarse_diagnostics(index)%axes .eq. 3
valid_id = coarse_diagnostics(index)%id .gt. 0
Expand Down
2 changes: 0 additions & 2 deletions FV3/atmos_cubed_sphere/tools/coarse_grained_restart_files.F90
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,11 @@ subroutine coarse_grain_fv_tracer_restart_data_on_pressure_levels( &
real, intent(in), dimension(is:ie,js:je,1:npz) :: masked_area_weights

real, allocatable :: remapped(:,:,:)
character(len=64) :: tracer_name
integer :: n_tracer

allocate(remapped(is:ie,js:je,1:npz))

do n_tracer = 1, n_prognostic_tracers
call get_tracer_names(MODEL_ATMOS, n_tracer, tracer_name)
call vertically_remap_field(phalf(is:ie,js:je,1:npz+1), &
Atm%q(is:ie,js:je,1:npz,n_tracer), coarse_phalf_on_fine, Atm%ptop, remapped)
call weighted_block_average(masked_area_weights, &
Expand Down