11.6 Example Usage

In general, to use Multispecies properties in a simulation, the user must only properly initialize the species as described above in the Simulation_init routine. But to program with the Multispecies properties, you must do three things:

The example below shows a snippet of code to calculate the electron density.  
...
#include Flash.h
#include Multispecies.h


USE Multispecies_interface, ONLY:  Multispecies_getSumInv, Multispecies_getSumFrac
...
    do k=blkLimitsGC(LOW,KAXIS),blkLimitsGC(HIGH,KAXIS)
        do j=blkLimitsGC(LOW,JAXIS),blkLimitsGC(HIGH,JAXIS)
           do i=blkLimitsGC(LOW,IAXIS),blkLimitsGC(HIGH,IAXIS)
              call Multispecies_getSumInv(A,abar_inv)
              abar = 1.e0 / abar_inv
              call Multispecies_getSumFrac(Z,zbar)
              zbar = abar * zbar
              ye(i,j,k) = abar_inv*zbar
           enddo
        enddo
     enddo
...