ESCOMP / ESCOMP/atmospheric_physics

Utilize constituent object const_index routine

Open
#137 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Fortran
Stars
12
Forks
38
Avg merge
11h 16m
Merged PRs (30d)
5

Description

Once we have exposed the full constituent (`ccpp_model_constituents_t`) object via metadata (https://github.com/NCAR/ccpp-framework/issues/597), we should update the following schemes to use the `const_index` method to grab a constituent index by its standard name (instead of what we're doing now, which is looping over all the constituents to get the index):

- sima_diagnostics/sima_state_diagnostics.F90
- remove `const_std_names` and `const_diag_names`
- grab the index using the newly exposed interface
- if the constituent is present, call history_out_field/history_add_field
- any scheme that uses `ccpp_const_get_idx`
- possible candidates: check_energy_chng, zm_diagnostics

const_index routine in the constituents object (in the CCPP framework):
```
subroutine ccp_model_const_index(this, index, standard_name, errcode, errmsg)
! Return index of metadata matching .
! must be locked to execute this function

! Dummy arguments
class(ccpp_model_constituents_t), intent(in) :: this
character(len=*), intent(in) :: standard_name
integer, intent(out) :: index
integer, optional, intent(out) :: errcode
character(len=*), optional, intent(out) :: errmsg
! Local variables
type(ccpp_constituent_properties_t), pointer :: cprop => NULL()
character(len=*), parameter :: subname = "ccp_model_const_index"

if (this%const_props_locked(errcode=errcode, errmsg=errmsg, warn_func=subname)) then
cprop => this%find_const(standard_name)
if (associated(cprop)) then
index = cprop%const_index()
else
index = int_unassigned
end if
else
index = int_unassigned
end if

end subroutine ccp_model_const_index
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.