Skip to content

Commit eed0685

Browse files
authored
Merge pull request #4 from jimmielin/pumas_round3
Update clamp_number_concentrations.F90,meta to address review comments.
2 parents ba38ac4 + 8e28317 commit eed0685

2 files changed

Lines changed: 12 additions & 33 deletions

File tree

schemes/utilities/clamp_number_concentrations.F90

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,27 @@ module clamp_number_concentrations
4040

4141
!> \section arg_table_clamp_number_concentrations_init Argument Table
4242
!! \htmlinclude clamp_number_concentrations_init.html
43-
subroutine clamp_number_concentrations_init(const_props, errmsg, errflg)
43+
subroutine clamp_number_concentrations_init(errmsg, errflg)
44+
use ccpp_scheme_utils, only: ccpp_constituent_index
4445

45-
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
46-
use ccpp_const_utils, only: ccpp_const_get_idx
47-
48-
type(ccpp_constituent_prop_ptr_t), &
49-
intent(in) :: const_props(:)
50-
character(len=512), intent(out) :: errmsg
51-
integer, intent(out) :: errflg
46+
character(len=*), intent(out) :: errmsg
47+
integer, intent(out) :: errflg
5248

5349
! Local variables
5450
integer :: ix_species(num_species)
5551
integer :: n
56-
character(len=512) :: local_errmsg
57-
integer :: local_errflg
5852

5953
errmsg = ''
6054
errflg = 0
6155

6256
ix_species(:) = -1
6357
! Look up constituent indices. A missing species is skipped
6458
do n = 1, num_species
65-
call ccpp_const_get_idx(const_props, trim(std_names(n)), &
66-
ix_species(n), local_errmsg, local_errflg)
67-
if (local_errflg /= 0) then
68-
! Constituent not found — mark as inactive, reset error
59+
call ccpp_constituent_index(trim(std_names(n)), ix_species(n), errmsg=errmsg, errcode=errflg)
60+
if(errflg /= 0) return
61+
if (ix_species(n) < 0) then
62+
! Constituent not found — mark as inactive
6963
ix_species(n) = -1
70-
local_errflg = 0
71-
local_errmsg = ''
7264
end if
7365
end do
7466

@@ -83,16 +75,15 @@ end subroutine clamp_number_concentrations_init
8375
!> \section arg_table_clamp_number_concentrations_run Argument Table
8476
!! \htmlinclude clamp_number_concentrations_run.html
8577
subroutine clamp_number_concentrations_run( &
86-
ncol, pver, dt, &
78+
ncol, pver, &
8779
const_q, const_tend, &
8880
errmsg, errflg)
8981

9082
integer, intent(in) :: ncol
9183
integer, intent(in) :: pver
92-
real(kind_phys), intent(in) :: dt ! physics timestep [s]
9384
real(kind_phys), intent(inout) :: const_q(:, :, :) ! constituent mixing ratios
9485
real(kind_phys), intent(inout) :: const_tend(:, :, :) ! constituent tendencies
95-
character(len=512), intent(out) :: errmsg
86+
character(len=*), intent(out) :: errmsg
9687
integer, intent(out) :: errflg
9788

9889
! Local variables

schemes/utilities/clamp_number_concentrations.meta

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@
55
[ccpp-arg-table]
66
name = clamp_number_concentrations_init
77
type = scheme
8-
[ const_props ]
9-
standard_name = ccpp_constituent_properties
10-
units = none
11-
type = ccpp_constituent_prop_ptr_t
12-
dimensions = (number_of_ccpp_constituents)
13-
intent = in
148
[ errmsg ]
159
standard_name = ccpp_error_message
1610
units = none
17-
type = character | kind = len=512
11+
type = character | kind = len=*
1812
dimensions = ()
1913
intent = out
2014
[ errflg ]
@@ -39,12 +33,6 @@
3933
type = integer
4034
dimensions = ()
4135
intent = in
42-
[ dt ]
43-
standard_name = timestep_for_physics
44-
units = s
45-
type = real | kind = kind_phys
46-
dimensions = ()
47-
intent = in
4836
[ const_q ]
4937
standard_name = ccpp_constituents
5038
units = none
@@ -60,7 +48,7 @@
6048
[ errmsg ]
6149
standard_name = ccpp_error_message
6250
units = none
63-
type = character | kind = len=512
51+
type = character | kind = len=*
6452
dimensions = ()
6553
intent = out
6654
[ errflg ]

0 commit comments

Comments
 (0)