Skip to content

Commit 155ef57

Browse files
committed
Move use statements to the smallest scope possible
... Also for kind and length parameters.
1 parent a9c253f commit 155ef57

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

src/dynamics/mpas/driver/dyn_mpas_subdriver.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module dyn_mpas_subdriver
1717
#endif
1818
! Module(s) from MPAS.
1919
use mpas_derived_types, only: core_type, domain_type
20-
use mpas_kind_types, only: rkind, r4kind, r8kind, strkind
20+
use mpas_kind_types, only: rkind, strkind
2121

2222
implicit none
2323

@@ -1897,6 +1897,7 @@ subroutine dyn_mpas_check_variable_status(self, var_is_present, var_is_tkr_compa
18971897
use mpas_derived_types, only: field0dchar, field1dchar, &
18981898
field0dinteger, field1dinteger, field2dinteger, field3dinteger, &
18991899
field0dreal, field1dreal, field2dreal, field3dreal, field4dreal, field5dreal
1900+
use mpas_kind_types, only: r4kind, r8kind
19001901
use mpas_pool_routines, only: mpas_pool_get_field
19011902

19021903
class(mpas_dynamical_core_type), intent(in) :: self

src/dynamics/mpas/dyn_comp.F90

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module dyn_comp
2-
! Module(s) from CESM Share.
3-
use shr_kind_mod, only: kind_r8 => shr_kind_r8, &
4-
len_cs => shr_kind_cs
52
! Module(s) from MPAS.
63
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind, mpas_dynamical_core_type
74

@@ -99,6 +96,7 @@ subroutine dyn_readnl(namelist_path)
9996
use time_manager, only: get_start_date, get_stop_date, get_run_duration, timemgr_get_calendar_cf
10097
! Module(s) from CESM Share.
10198
use shr_file_mod, only: shr_file_getunit
99+
use shr_kind_mod, only: len_cs => shr_kind_cs
102100
use shr_pio_mod, only: shr_pio_getiosys
103101
! Module(s) from external libraries.
104102
use pio, only: iosystem_desc_t
@@ -312,6 +310,8 @@ subroutine check_topography_data(pio_file)
312310
use cam_field_read, only: cam_read_field
313311
use cam_logfile, only: debug_output, debugout_none
314312
use dynconst, only: constant_g => gravit
313+
! Module(s) from CESM Share.
314+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
315315
! Module(s) from external libraries.
316316
use pio, only: file_desc_t, pio_file_is_open
317317

@@ -376,6 +376,9 @@ end subroutine check_topography_data
376376
!> Set analytic initial condition for MPAS.
377377
!> (KCW, 2024-05-22)
378378
subroutine set_analytic_initial_condition()
379+
! Module(s) from CESM Share.
380+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
381+
379382
character(*), parameter :: subname = 'dyn_comp::set_analytic_initial_condition'
380383
integer, allocatable :: global_grid_index(:)
381384
real(kind_r8), allocatable :: buffer_2d_real(:, :), buffer_3d_real(:, :, :)
@@ -845,6 +848,8 @@ subroutine dyn_exchange_constituent_states(direction, exchange, conversion)
845848
! Module(s) from CCPP.
846849
use cam_ccpp_cap, only: cam_constituents_array
847850
use ccpp_kinds, only: kind_phys
851+
! Module(s) from CESM Share.
852+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
848853

849854
character(*), intent(in) :: direction
850855
logical, intent(in) :: exchange
@@ -1156,6 +1161,9 @@ end subroutine dyn_variable_dump
11561161
!> Helper function for reversing the order of elements in `array`.
11571162
!> (KCW, 2024-07-17)
11581163
pure function reverse(array)
1164+
! Module(s) from CESM Share.
1165+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
1166+
11591167
real(kind_r8), intent(in) :: array(:)
11601168
real(kind_r8) :: reverse(size(array))
11611169

src/dynamics/mpas/dyn_coupling.F90

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
module dyn_coupling
2-
! Module(s) from CESM Share.
3-
use shr_kind_mod, only: kind_r8 => shr_kind_r8, &
4-
len_cx => shr_kind_cx
5-
! Module(s) from MPAS.
6-
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
7-
82
implicit none
93

104
private
@@ -18,6 +12,10 @@ module dyn_coupling
1812
subroutine dynamics_to_physics_coupling()
1913
! Module(s) from CAM-SIMA.
2014
use dyn_comp, only: dyn_debug_print, dyn_exchange_constituent_states, ncells_solve
15+
! Module(s) from CESM Share.
16+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
17+
! Module(s) from MPAS.
18+
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
2119

2220
character(*), parameter :: subname = 'dyn_coupling::dynamics_to_physics_coupling'
2321
integer :: column_index
@@ -308,6 +306,8 @@ subroutine set_physics_state_external()
308306
use geopotential_temp, only: geopotential_temp_run
309307
use qneg, only: qneg_run
310308
use static_energy, only: update_dry_static_energy_run
309+
! Module(s) from CESM Share.
310+
use shr_kind_mod, only: len_cx => shr_kind_cx
311311

312312
character(*), parameter :: subname = 'dyn_coupling::dynamics_to_physics_coupling::set_physics_state_external'
313313
character(len_cx) :: cerr
@@ -411,6 +411,10 @@ end subroutine dynamics_to_physics_coupling
411411
subroutine physics_to_dynamics_coupling()
412412
! Module(s) from CAM-SIMA.
413413
use dyn_comp, only: dyn_exchange_constituent_states
414+
! Module(s) from CESM Share.
415+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
416+
! Module(s) from MPAS.
417+
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
414418

415419
character(*), parameter :: subname = 'dyn_coupling::physics_to_dynamics_coupling'
416420
integer, pointer :: index_qv

src/dynamics/mpas/dyn_grid.F90

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
module dyn_grid
22
! Module(s) from CAM-SIMA.
33
use cam_grid_support, only: max_hcoordname_len
4-
use cam_map_utils, only: kind_imap => imap
5-
use physics_column_type, only: kind_pcol
6-
! Module(s) from CESM Share.
7-
use shr_kind_mod, only: kind_r8 => shr_kind_r8
8-
! Module(s) from MPAS.
9-
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
104

115
implicit none
126

@@ -115,6 +109,10 @@ subroutine init_reference_pressure()
115109
use std_atm_profile, only: std_atm_pres
116110
use string_utils, only: stringify
117111
use vert_coord, only: pver, pverp
112+
! Module(s) from CESM Share.
113+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
114+
! Module(s) from MPAS.
115+
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
118116

119117
character(*), parameter :: subname = 'dyn_grid::init_reference_pressure'
120118
! Number of pure pressure levels at model top.
@@ -221,10 +219,14 @@ subroutine init_physics_grid()
221219
use cam_abortutils, only: check_allocate
222220
use dyn_comp, only: mpas_dynamical_core, ncells_global, ncells_solve, sphere_radius
223221
use dynconst, only: constant_pi => pi, rad_to_deg
224-
use physics_column_type, only: physics_column_t
222+
use physics_column_type, only: kind_pcol, physics_column_t
225223
use physics_grid, only: phys_grid_init
226224
use spmd_utils, only: iam
227225
use string_utils, only: stringify
226+
! Module(s) from CESM Share.
227+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
228+
! Module(s) from MPAS.
229+
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
228230

229231
character(*), parameter :: subname = 'dyn_grid::init_physics_grid'
230232
character(max_hcoordname_len), allocatable :: dyn_attribute_name(:)
@@ -311,12 +313,17 @@ subroutine define_cam_grid()
311313
use cam_abortutils, only: check_allocate
312314
use cam_grid_support, only: cam_grid_attribute_register, cam_grid_register, &
313315
horiz_coord_create, horiz_coord_t
316+
use cam_map_utils, only: kind_imap => imap
314317
use dyn_comp, only: dyn_debug_print, mpas_dynamical_core, &
315318
ncells_global, nedges_global, nvertices_global, &
316319
ncells_solve, nedges_solve, nvertices_solve, &
317320
sphere_radius
318321
use dynconst, only: constant_pi => pi, rad_to_deg
319322
use string_utils, only: stringify
323+
! Module(s) from CESM Share.
324+
use shr_kind_mod, only: kind_r8 => shr_kind_r8
325+
! Module(s) from MPAS.
326+
use dyn_mpas_subdriver, only: kind_dyn_mpas => mpas_dynamical_core_real_kind
320327

321328
character(*), parameter :: subname = 'dyn_grid::define_cam_grid'
322329
integer :: i

src/dynamics/mpas/stepon.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module stepon
2-
! Module(s) from CCPP.
3-
use ccpp_kinds, only: kind_phys
4-
52
implicit none
63

74
private
@@ -31,6 +28,8 @@ subroutine stepon_timestep_init(dtime_phys, cam_runtime_opts, phys_state, phys_t
3128
use physics_types, only: physics_state, physics_tend
3229
use runtime_obj, only: runtime_options
3330
use time_manager, only: get_step_size
31+
! Module(s) from CCPP.
32+
use ccpp_kinds, only: kind_phys
3433

3534
real(kind_phys), intent(out) :: dtime_phys
3635
type(runtime_options), intent(in) :: cam_runtime_opts
@@ -69,6 +68,8 @@ subroutine stepon_run3(dtime_phys, cam_runtime_opts, cam_out, phys_state, dyn_in
6968
use dyn_comp, only: dyn_export_t, dyn_import_t, dyn_run
7069
use physics_types, only: physics_state
7170
use runtime_obj, only: runtime_options
71+
! Module(s) from CCPP.
72+
use ccpp_kinds, only: kind_phys
7273

7374
real(kind_phys), intent(in) :: dtime_phys
7475
type(runtime_options), intent(in) :: cam_runtime_opts

0 commit comments

Comments
 (0)