mod_species_registry Module

Species-name registry helpers shared by chemistry, boundaries, radiation, and diagnostics.

The solver may use a Cantera-discovered species ordering internally. User inputs and radiation model selections should therefore be resolved by name, not by hard-coded numeric indices. This small module keeps that name lookup behavior consistent across subsystems.



Derived Types

type, public ::  species_registry_t

Object-oriented species registry container for cleaner access.

Components

Type Visibility Attributes Name Initial
character(len=name_len), public, allocatable :: name(:)
integer, public :: nspecies = 0

Type-Bound Procedures

procedure, public :: index_of => registry_index_of
procedure, public :: require_index => registry_require_index

Functions

public function species_index_of(names, nspecies, target) result(idx)

Searches the name array for a target name and returns its 1-based index, or 0 if not found.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: names(:)
integer, intent(in) :: nspecies

Size of the names array to search.

character(len=*), intent(in) :: target

The target name to search for.

Return Value integer

public function species_names_match(a, b)

Returns true if two species names are identical (case-insensitive, whitespace-trimmed).

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a

First name.

character(len=*), intent(in) :: b

Second name.

Return Value logical

public function species_require_index(names, nspecies, target, owner) result(idx)

Searches for a target name and returns its index, or halts simulation with a fatal error if not found.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: names(:)
integer, intent(in) :: nspecies

Size of the names array.

character(len=*), intent(in) :: target

The target name to require.

character(len=*), intent(in) :: owner

The calling subsystem module name for traceback.

Return Value integer

private function registry_index_of(this, target) result(idx)

Bound procedure to find the index of a species from the registry instance.

Arguments

Type IntentOptional Attributes Name
class(species_registry_t), intent(in) :: this

The species registry instance.

character(len=*), intent(in) :: target

The target species name to lookup.

Return Value integer

private function registry_require_index(this, target, owner) result(idx)

Bound procedure to find the index of a species, raising a fatal error if it is missing.

Arguments

Type IntentOptional Attributes Name
class(species_registry_t), intent(in) :: this

The species registry instance.

character(len=*), intent(in) :: target

The target species name to require.

character(len=*), intent(in) :: owner

The calling subsystem module name.

Return Value integer