11.1 Defining Species

The names and properties of fluids are accessed by using their constant integer values defined in the Flash.h header file. The species names are defined in a Config file. The names of the species, for example AIR, NI56, are given in the Config file with keyword SPECIES.

In the traditional method for defining species, this Config would typically be the application's Config file in the Simulation unit. In the alternative method described below in Sec:DefineSpecies2, SPECIES are normally not listed explicitly in the Simulation unit Config, but instead are automatically generated by Multispecies/MultispeciesMain/Config based on the contents of the species setup variable. Either way, the setup procedure transforms those names into accessor integers with the appended description _SPEC.

These names are stored in the Flash.h file. The total number of species defined is also defined within Flash.h as NSPECIES, and the integer range of their definition is given by SPECIES_BEGIN and SPECIES_END. To access the species in your code, use the index listed in Flash.h, for example AIR_SPEC, NI56_SPEC.

Note that NSPECIES, SPECIES_BEGIN, and SPECIES_END are always defined, whether a simulation uses multiple species or not (and whehter the simulation includes the Multispecies unit or not). However, if NSPECIES$ =0$, SPECIES_END will be less than SPECIES_BEGIN, and then neither of them should be used as an index into solution vectors.

As an illustration, Figures Figure 11.2 and Figure 11.3 are snippets from a configuration file and the corresponding section of the FLASH header file, respectively. For more information on Config files, see Sec:Config; for more information on the setup procedure, see Chp:The FLASH configuration script; for more information on the structure of the main header file Flash.h, see Chp:Flash.h.

Figure 11.2: Sample Config file showing how to define required fluid species.
 
# Portion of a Config file for a Simulation
SPECIES AIR
SPECIES SF6

Figure 11.3: Sample excerpt from header file Flash.h showing integer definition of fluid species.
 
#define SPECIES_BEGIN (NPROP_VARS + CONSTANT_ONE)
#define AIR_SPEC 11
#define SF6_SPEC 12
#define NSPECIES 2
#define SPECIES_END (SPECIES_BEGIN + NSPECIES - CONSTANT_ONE)

FLASH3 Transition: In FLASH2, you found the integer index of a species by using find_fluid_index. In FLASH4, the species index is always available because it is defined in Flash.h. Use the index directory, as in xIn(NAME_SPEC - SPECIES_BEGIN + 1) = solnData(NAME_SPEC,i,j,k).

But be careful that the species name is really defined in your simulation! You can test with  

if (NAME_SPEC /= NONEXISTENT) then
    okVariable = solnData(NAME_SPEC,i,j,k)
endif

The available properties of an individual fluid are listed in Table 11.1 and are defined in file Multispecies.h. In order to reference the properties in code, you must #include the file Multispecies.h. The initialization of properties is described in the following section.


Table 11.1: Properties available through the Multispecies unit.
Property Name Description Data type
A Number of protons and neutrons in nucleus real
Z Atomic number real
N Number of neutrons real
E Number of electrons real
BE Binding Energy real
GAMMA Ratio of heat capacities real
MS_ZMIN Minimum allowed average ionization real
MS_EOSTYPE EOS type to use for MTMMMT EOS integer
MS_EOSSUBTYPE EOS subtype to use for MTMMMT EOS integer
MS_EOSZFREEFILE Name of file with ionization data string
MS_EOSENERFILE Name of file with internal energy data string
MS_EOSPRESFILE Name of file with pressure data string
MS_NUMELEMS Number of elements comprising this species integer
MS_ZELEMS Atomic number of each species element array(integer)
MS_AELEMS Mass number of each species element array(real)
MS_FRACTIONS Number fraction of each species element array(real)
MS_OPLOWTEMP Temperature at which cold opacities are used real