Translate a namelist string into a PV_VARIANT_* code.
An unrecognised string returns PV_VARIANT_INVALID (PR-6:
fail-loud — a typo must NOT silently degrade to SADOURNY,
which is a materially different conservation law). "al81"
still maps to PV_VARIANT_AL81 (the reservation), but that
code is rejected by pv_variant_is_implemented at configure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
pure function parse_pv_variant(name) result(code) !! Translate a namelist string into a `PV_VARIANT_*` code. !! An unrecognised string returns `PV_VARIANT_INVALID` (PR-6: !! fail-loud — a typo must NOT silently degrade to `SADOURNY`, !! which is a materially different conservation law). `"al81"` !! still maps to `PV_VARIANT_AL81` (the reservation), but that !! code is rejected by `pv_variant_is_implemented` at configure. character(len=*), intent(in) :: name integer :: code select case (trim(adjustl(name))) case ("sadourny", "SADOURNY") code = PV_VARIANT_SADOURNY case ("sadourny_hk", "SADOURNY_HK", "hk", "HK") code = PV_VARIANT_SADOURNY_HK case ("sadourny_energy", "SADOURNY_ENERGY", "energy", "ENERGY") code = PV_VARIANT_SADOURNY_ENERGY case ("al81", "AL81") code = PV_VARIANT_AL81 case default code = PV_VARIANT_INVALID end select end function parse_pv_variant