11.3 Specifying Constituent Elements of a Species

A species can represent a specific isotope or a single element or a more complex material. Some units in FLASH require information about the elements that constitute a single species. For example, water is comprised of two elements: Hydrogen and Oxygen. The Multispecies database can store a list of the atomic numbers, mass numbers, and relative number fractions of each of the elements within a given species. This information is stored in the array properties MS_ZELEMS, MS_AELEMS, and MS_FRACTIONS respectively. The property MS_NUMELEMS contains the total number of elements for a species (MS_NUMELEMS would be two for water since water is made of Hydrogen and Oxygen). There is an upper bound on the number of elements for a single species which is defined using the preprocessor symbol MS_MAXELEMS in the “Flash.h” header file and defaults to six. The value of MS_MAXELEMS can be changed using the ms_maxelems setup variable. Figure 11.5 shows an example of how the constituent elements for water can be set using the Simulation_initSpecies subroutine.

The constituent element information is optional and is only needed if a particular unit of interest requires it. At present, only the analytic cold opacities used in the Opacity unit make use of the constituent element information.

Figure 11.5: A Simulation_initSpecies.F90 file showing Multispecies initialization
 
#include "Flash.h"
#include "Multispecies.h"


! Create arrays to store constituent element data. Note that these
! arrays are always of length MS_MAXELEMS.
real :: aelems(MS_MAXELEMS)
real :: fractions(MS_MAXELEMS)
integer :: zelems(MS_MAXELEMS)


call Multispecies_setProperty(H2O_SPEC, A, 18.0/3.0) ! Set average mass number
call Multispecies_setProperty(H2O_SPEC, Z, 10.0/3.0) ! Set average atomic number
call Multispecies_setProperty(H2O_SPEC, GAMMA, 5.0/3.0)
call Multispecies_setProperty(H2O_SPEC, MS_NUMELEMS, 2)


aelems(1) =  1.0 ! Hydrogen
aelems(2) = 16.0 ! Oxygen
call Multispecies_setProperty(H2O_SPEC, MS_AELEMS, aelems)


zelems(1) = 1 ! Hydrogen
zelems(2) = 8 ! Oxygen
call Multispecies_setProperty(H2O_SPEC, MS_ZELEMS, zelems)  


fractions(1) = 2.0/3.0 ! Two parts Hydrogen
fractions(2) = 1.0/3.0 ! One part Oxygen
call Multispecies_setProperty(H2O_SPEC, MS_FRACTIONS, fractions)