Skip to content

Commit

Permalink
Prevent unallocated/unassociated actual arguments
Browse files Browse the repository at this point in the history
In a few places, an array will be allocated or a pointer associated
depending on a logical flag. These subroutines then call another
subroutine, passing the array/pointer and the flag. However, the dummy
argument to this second subroutine doesn't have the allocatable or
pointer attributes. Depending on the flag, we may be passing an
unallocated array or unassociated pointer to a bare dummy argument,
which is not allowed. To be compliant, we should specify these
attributes, even for intent(in) dummy arguments, where the
allocated/associated status is not allowed to change (this is a
Fortran 2003-ism in the case of pointers).
  • Loading branch information
angus-g committed Jan 20, 2020
1 parent 4b3e1a0 commit 23ef5b2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assemble/Momentum_CG.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ subroutine add_advection_element_cg(ele, test_function, u, oldu_val, nu, ug, de
type(scalar_field), intent(in) :: nvfrac
real, dimension(ele_loc(u, ele), ele_ngi(u, ele), u%dim), intent(in) :: du_t
real, dimension(ele_loc(u, ele), ele_ngi(u, ele), u%dim), intent(in) :: dug_t
real, dimension(:, :, :), intent(in) :: dnvfrac_t
real, dimension(:, :, :), allocatable, intent(in) :: dnvfrac_t
real, dimension(ele_ngi(u, ele)), intent(in) :: detwei
real, dimension(u%dim, u%dim, ele_ngi(u,ele)) :: J_mat, diff_q
real, dimension(u%dim, u%dim, ele_loc(u, ele), ele_loc(u, ele)), intent(inout) :: big_m_tensor_addto
Expand Down
4 changes: 2 additions & 2 deletions assemble/Multiphase.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ subroutine add_fluid_particle_drag_element(ele, test_function, u_shape, &

type(scalar_field), intent(in) :: vfrac_fluid, vfrac_particle
type(scalar_field), intent(in) :: density_fluid, density_particle
type(scalar_field), intent(in) :: d_field ! Scalar field representing particle diameter
type(scalar_field), pointer, intent(in) :: d_field ! Scalar field representing particle diameter
type(vector_field), intent(in) :: nu_fluid, nu_particle
type(vector_field), intent(in) :: oldu_fluid, oldu_particle
type(tensor_field), intent(in) :: viscosity_fluid
Expand Down Expand Up @@ -900,7 +900,7 @@ subroutine add_heat_transfer_element(ele, test_function, internal_energy_shape,

type(scalar_field), intent(in) :: vfrac_fluid, vfrac_particle
type(scalar_field), intent(in) :: density_fluid, density_particle
type(scalar_field), intent(in) :: d_field ! Scalar field representing particle diameter
type(scalar_field), pointer, intent(in) :: d_field ! Scalar field representing particle diameter
type(vector_field), intent(in) :: nu_fluid, nu_particle
type(scalar_field), intent(in) :: internal_energy_fluid, internal_energy_particle
type(scalar_field), intent(in) :: old_internal_energy_fluid, old_internal_energy_particle
Expand Down
4 changes: 2 additions & 2 deletions horizontal_adaptivity/Extrude.F90
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ subroutine compute_z_nodes_wrapper(z_mesh, xy, min_bottom_layer_frac, &
real, intent(in) :: map_depth, min_depth
real, intent(in) :: depth, constant_sizing
character(len=*), intent(in) :: depth_function, sizing_function
real, dimension(:), intent(in) :: sizing_vector
real, dimension(:), allocatable, intent(in) :: sizing_vector
integer, intent(in) :: number_sigma_layers
logical, intent(in) :: radial_extrusion

Expand Down Expand Up @@ -569,7 +569,7 @@ logical function skip_column_extrude(horizontal_mesh, column, &
integer, intent(in) :: column
logical, intent(in) :: apply_region_ids
logical, intent(inout) :: column_visited
integer, dimension(:), intent(in) :: region_ids
integer, dimension(:), allocatable, intent(in) :: region_ids
integer, intent(inout), optional :: visited_count

integer, dimension(:), pointer :: eles
Expand Down
2 changes: 1 addition & 1 deletion parameterisation/k_epsilon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ subroutine assemble_rhs_ele(src_abs_terms, k, eps, scalar_eddy_visc, u, density,
integer :: term, ngi, dim, gi, i

type(vector_field), intent(in) :: bc_value
integer, dimension(:,:), intent(in) :: bc_type
integer, dimension(:,:), allocatable, intent(in) :: bc_type

real, dimension(:, :, :), allocatable :: dshape_u

Expand Down
4 changes: 2 additions & 2 deletions population_balance/DQMOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ subroutine dqmom_calculate_source_term_ele(abscissa, weight, s_weighted_abscissa
&X, singular_option, perturb_val, cond, ele)

type(scalar_field), dimension(:), intent(in) :: abscissa, weight
type(scalar_field), intent(in) :: turbulent_dissipation
type(tensor_field), intent(in) :: viscosity_continuous
type(scalar_field), pointer, intent(in) :: turbulent_dissipation
type(tensor_field), pointer, intent(in) :: viscosity_continuous
type(scalar_field_pointer), dimension(:), intent(inout) :: s_weighted_abscissa, s_weight
type(tensor_field), pointer, intent(in) :: D
type(vector_field), pointer, intent(in) :: X
Expand Down

0 comments on commit 23ef5b2

Please sign in to comment.