Skip to content
Merged
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: 10 additions & 19 deletions schemes/utilities/clamp_number_concentrations.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,27 @@ module clamp_number_concentrations

!> \section arg_table_clamp_number_concentrations_init Argument Table
!! \htmlinclude clamp_number_concentrations_init.html
subroutine clamp_number_concentrations_init(const_props, errmsg, errflg)
subroutine clamp_number_concentrations_init(errmsg, errflg)
use ccpp_scheme_utils, only: ccpp_constituent_index

use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
use ccpp_const_utils, only: ccpp_const_get_idx

type(ccpp_constituent_prop_ptr_t), &
intent(in) :: const_props(:)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
integer :: ix_species(num_species)
integer :: n
character(len=512) :: local_errmsg
integer :: local_errflg

errmsg = ''
errflg = 0

ix_species(:) = -1
! Look up constituent indices. A missing species is skipped
do n = 1, num_species
call ccpp_const_get_idx(const_props, trim(std_names(n)), &
ix_species(n), local_errmsg, local_errflg)
if (local_errflg /= 0) then
! Constituent not found — mark as inactive, reset error
call ccpp_constituent_index(trim(std_names(n)), ix_species(n), errmsg=errmsg, errcode=errflg)
if(errflg /= 0) return
if (ix_species(n) < 0) then
! Constituent not found — mark as inactive
ix_species(n) = -1
local_errflg = 0
local_errmsg = ''
end if
end do

Expand All @@ -83,16 +75,15 @@ end subroutine clamp_number_concentrations_init
!> \section arg_table_clamp_number_concentrations_run Argument Table
!! \htmlinclude clamp_number_concentrations_run.html
subroutine clamp_number_concentrations_run( &
ncol, pver, dt, &
ncol, pver, &
const_q, const_tend, &
errmsg, errflg)

integer, intent(in) :: ncol
integer, intent(in) :: pver
real(kind_phys), intent(in) :: dt ! physics timestep [s]
real(kind_phys), intent(inout) :: const_q(:, :, :) ! constituent mixing ratios
real(kind_phys), intent(inout) :: const_tend(:, :, :) ! constituent tendencies
character(len=512), intent(out) :: errmsg
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
Expand Down
16 changes: 2 additions & 14 deletions schemes/utilities/clamp_number_concentrations.meta
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
[ccpp-arg-table]
name = clamp_number_concentrations_init
type = scheme
[ const_props ]
standard_name = ccpp_constituent_properties
units = none
type = ccpp_constituent_prop_ptr_t
dimensions = (number_of_ccpp_constituents)
intent = in
[ errmsg ]
standard_name = ccpp_error_message
units = none
type = character | kind = len=512
type = character | kind = len=*
dimensions = ()
intent = out
[ errflg ]
Expand All @@ -39,12 +33,6 @@
type = integer
dimensions = ()
intent = in
[ dt ]
standard_name = timestep_for_physics
units = s
type = real | kind = kind_phys
dimensions = ()
intent = in
[ const_q ]
standard_name = ccpp_constituents
units = none
Expand All @@ -60,7 +48,7 @@
[ errmsg ]
standard_name = ccpp_error_message
units = none
type = character | kind = len=512
type = character | kind = len=*
dimensions = ()
intent = out
[ errflg ]
Expand Down
Loading