Skip to content
Open

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions rose-stem/app/check_global_variables/file/dirtylist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ science/physics_schemes/source/convection/comorph/control/comorph_constants_mod.
science/physics_schemes/source/convection/comorph/control/fields_type_mod.F90
science/physics_schemes/source/convection/comorph/control/cloudfracs_type_mod.F90
science/physics_schemes/source/convection/comorph/control/fields_2d_mod.F90
science/physics_schemes/source/convection/comorph/control/parcel_type_mod.F90
science/physics_schemes/source/convection/comorph/control/res_source_type_mod.F90
science/physics_schemes/source/convection/comorph/plume_model/sublevs_mod.F90
science/physics_schemes/source/convection/comorph/interface/standalone/qsat_data.F90
science/physics_schemes/source/convection/comorph/interface/um/comorph_diags_scm_mod.F90
science/physics_schemes/source/convection/cv_dependent_switch_mod.F90
science/physics_schemes/source/convection/cv_run_mod.F90
science/physics_schemes/source/convection/wtrac_conv.F90
Expand Down
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure I follow this - can you explain?

  • how does this not change answers in existing tests where cca/ccw are inputs to Comorph, or are they just not used if so?
  • I'm not sure you need to set them in comorph_kernel above n_conv_levs every timestep - they should just stay at their originally initialised value of 0 here
  • if Comorph sets every point below this, then I'm not sure this pre-initialisation is needed at all?
  • For the current implicit_bl placement things should be okay, as it's working on the output of the convection anyway. If this setting to 0 needs to happen in the implicit_bl before convection case, would it be better as part of my branch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi thanks Ian, that was quick! (maybe I was meant to open this in "draft mode" so I could finish documenting it before reviews begin!) I'll try and scribble some more explanations:

  • CoMorph itself doesn't have any dependence on cca, ccw; it just sets them (on levels 1, n_conv_levels only).
  • The issue is that under the rearrangements, the cca, ccw passed into CoMorph are now just local arrays (cca_3d, ccw_3d) which have not been pre-populated with the input values of the prognostics (as cca_3d0, ccw_3d0 are). Subroutine comorph_conv_cloud_extras then sets cca_3d0, ccw_3d0 to the max out of their existing input values and the cca_3d, ccw_3d output by CoMorph. It does this on all levels, so the local arrays cca_3d, ccw_3d need to be set on all levels, but CoMorph doesn't set anything on the top level.
  • Under this arrangement, the prognostics need to be initialised to zero somewhere in the timestep, otherwise any conv cloud created by either comorph or forced cu will just hang around for the next timestep and forevermore!
  • Removing the initialisation to zero (currently in fast_physics_alg) from my branch will make conv cloud persist forever, changing answers, so needs to be in my branch.

The point of the rearrangement (making CoMorph set local copies instead of setting the prognostics directly) is to make CoMorph agnostic to whether another scheme has already added contributions to the cca, ccw prognostics before it. CoMorph should supplement them not overwrite them.

Cheers!
Mike

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - that makes sense. In which case, I wonder if it's worth wrapping this code inside an "if-comorph" test, so that it's not being done for the 6A scheme where it isn't really needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep no problem, I've put the cca, ccw initialisation in fast_physics_alg inside an if test on comorph as suggested: fast_physics_alg_mod.X90

Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ contains
type( field_type ), pointer :: dtheta_stph => null()
type( field_type ), pointer :: dmv_stph => null()

type( field_type), pointer :: cca => null()
type( field_type), pointer :: ccw => null()

type( field_type ), pointer :: departure_exner_wth
#endif
type( field_type), pointer :: theta_star => null()
Expand Down Expand Up @@ -222,6 +225,14 @@ contains
evap_condense_done = .false.

#ifdef UM_PHYSICS

! Initialise convective cloud fields to zero
! (both comorph and implicit BL may update them only at some grid-points)
call convection_fields%get_field('cca', cca)
call convection_fields%get_field('ccw', ccw)
call invoke( setval_c(cca, 0.0_r_def), &
setval_c(ccw, 0.0_r_def) )

! Balance cloud before the rest of fast physics
if (cloud_call_b4_conv) then
call derived_fields%get_field('theta_star', theta_star)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ module add_res_source_mod

! Subroutine to add resolved-scale source terms for a given
! convective draft onto compressed copies of the full fields.
subroutine add_res_source( n_points_super, n_fields_tot, &
n_conv_types, n_conv_layers, &
subroutine add_res_source( n_points_super, n_points_res, n_fields_tot, &
ij_first, ij_last, index_ic_k, &
res_source_k, &
res_source_cmpr, res_source_super, &
res_source_fields, &
fields_k_super, layer_mass_k )

use comorph_constants_mod, only: real_cvprec, comorph_timestep, nx_full
use res_source_type_mod, only: res_source_type, i_ent, i_det
use comorph_constants_mod, only: real_cvprec, min_float, &
comorph_timestep, nx_full
use cmpr_type_mod, only: cmpr_type
use res_source_type_mod, only: n_res, i_ent, i_det

implicit none

! Max number of convective points on one level (dimensions super)
integer, intent(in) :: n_points_super
! Size of res_source arrays
integer, intent(in) :: n_points_res
! Total number of model-fields to update
integer, intent(in) :: n_fields_tot
! Number of convection types
integer, intent(in) :: n_conv_types
! Number of distinct convecting layers
integer, intent(in) :: n_conv_layers

! First and last ij-indices on the current segment
integer, intent(in) :: ij_first
Expand All @@ -42,9 +42,14 @@ subroutine add_res_source( n_points_super, n_fields_tot, &
! common array for referencing from res_source compression list
integer, intent(in) :: index_ic_k(ij_first:ij_last)

! Structure containing resolved-scale source terms to be added
type(res_source_type), intent(in) :: res_source_k &
( n_conv_types, n_conv_layers )
! Structure containing source term compression indices
type(cmpr_type), intent(in) :: res_source_cmpr

! Resolved-scale source term arrays to be added
real(kind=real_cvprec), intent(in) :: res_source_super &
( n_points_res, n_res )
real(kind=real_cvprec), intent(in) :: res_source_fields &
( n_points_res, n_fields_tot )

! Super-array containing fields to be incremented
real(kind=real_cvprec), intent(in out) :: fields_k_super &
Expand All @@ -58,47 +63,31 @@ subroutine add_res_source( n_points_super, n_fields_tot, &
integer :: ic_any( n_points_super )

! Loop counters
integer :: i_type, i_layr, i_field, i, j, ij, ic


! Loop over convecting layers and convection types
do i_layr = 1, n_conv_layers
do i_type = 1, n_conv_types

! If there are any resolved-scale source terms
! for this convection layer / type at the current level
if ( res_source_k(i_type,i_layr) % cmpr % n_points > 0 ) then

! Extract the cmpr_any compression list index from the grid
do ic = 1, res_source_k(i_type,i_layr) % cmpr % n_points
i = res_source_k(i_type,i_layr) % cmpr % index_i(ic)
j = res_source_k(i_type,i_layr) % cmpr % index_j(ic)
ij = nx_full*(j-1)+i
ic_any(ic) = index_ic_k(ij)
end do

! Increment the layer-mass with detrainment - entrainment
do ic = 1, res_source_k(i_type,i_layr) % cmpr % n_points
layer_mass_k(ic_any(ic)) = layer_mass_k(ic_any(ic)) &
+ ( res_source_k(i_type,i_layr) &
% res_super(ic,i_det) &
- res_source_k(i_type,i_layr) &
% res_super(ic,i_ent) &
) * comorph_timestep
end do

! Increment the primary fields with the source terms
do i_field = 1, n_fields_tot
do ic = 1, res_source_k(i_type,i_layr) % cmpr % n_points
fields_k_super(ic_any(ic),i_field) &
= fields_k_super(ic_any(ic),i_field) &
+ res_source_k(i_type,i_layr) &
% fields_super(ic,i_field) * comorph_timestep
end do
end do

end if
integer :: i_field, i, j, ij, ic


! Extract the cmpr_any compression list index from the grid
do ic = 1, res_source_cmpr % n_points
i = res_source_cmpr % index_i(ic)
j = res_source_cmpr % index_j(ic)
ij = nx_full*(j-1)+i
ic_any(ic) = index_ic_k(ij)
end do

! Increment the layer-mass with detrainment - entrainment
do ic = 1, res_source_cmpr % n_points
layer_mass_k(ic_any(ic)) = layer_mass_k(ic_any(ic)) &
+ ( res_source_super(ic,i_det) &
- res_source_super(ic,i_ent) &
) * comorph_timestep
end do

! Increment the primary fields with the source terms
do i_field = 1, n_fields_tot
do ic = 1, res_source_cmpr % n_points
fields_k_super(ic_any(ic),i_field) &
= fields_k_super(ic_any(ic),i_field) &
+ res_source_fields(ic,i_field) * comorph_timestep
end do
end do

Expand Down
Loading