Subsections


22.5 Opacity

The Opacity unit, which resides in physics/materialProperties/Opacity, exists to provide opacities for multigroup radiation diffusion to the RadTrans unit. Thus, the Opacity unit does not have an API for providing continuous opacities. The group structure is specified using parameters which are described in chp:RadTrans. Opacities are accessed by the RadTrans unit using the Opacity subroutine.  

call Opacity(soln, ngrp, opacityAbsorption, opacityEmission, opacityTransport)

The first argument is an input and provides the complete state within a cell as provided by the routine Grid_getBlPtr. The second input argument is the group number. The last three arguments are outputs which return the absorption, emission, and transport opacities in units of $ 1/cm$ using the conditions provided by the soln argument. See chp:RadTrans for a description of these three opacities. There are currently two Opacity implementations: Constant and Multispecies which are described below.


22.5.1 Constant Implementation

The Constant implementation is very simple and is useful for running test problems. It sets the absorption, emission, and transport opacities to constant values that are specified using the runtime parameters op_absorbConst, op_emissConst, and op_transConst. Users can provide custom implementations of the Constant Opacity subroutine to test different formulas for opacities in FLASH.

The Constant opacity implementation can be included with the following setup option:  

-with-unit=physics/materialProperties/Opacity/OpacityMain/Constant


22.5.2 Constcm2g Implementation

The Constcm2g implementation is also very simple and is useful for running test problems. It sets the absorption, emission, and transport opacities, in units of $ \ifmmode\mathord{\mathrm{cm}}\else cm\xspace\fi ^2/\ifmmode\mathord{{\mathrm g}}\else g\xspace\fi $, to constant values that are specified using the runtime parameters op_absorbConst, op_emissConst, and op_transConst. Users can provide custom implementations of the Constcm2g Opacity subroutine to test different formulas for opacities in FLASH.

The Constcm2g opacity implementation can be included with the following setup option:  

-with-unit=physics/materialProperties/Opacity/OpacityMain/Constcm2g


22.5.3 BremsstrahlungAndThomson Implementation

The BremsstrahlungAndThomson Opacity implementation assumes that the free-free Bremsstrahlung process is responsible for the coupling between radiation and matter (the emit_opac and absorb_opac terms) and that simple Thomson scattering dominates the diffusion of radiation through matter (the trans_opac term). Therefore, the emission and absorption opacities are given by the following formula, in units of $ \ifmmode\mathord{\mathrm{cm}}\else cm\xspace\fi ^{-1}$:

$\displaystyle \kappa_{emit, absorb} = 3.68 \times 10^{22} g_{ff} (1-Z)(1+X) T^{-3.5} \rho^{2},$ (22.8)

where $ g_{ff}$ is the Gaunt factor ($ \simeq$ 1), $ Z$ the fractional abundance of elements heavier than hydrogen, $ X$ the fractional abundance of hydrogen, $ T$ the temperature and $ \rho $ the temperature.

For the transport opacity, dominated by Thompson scattering, we have, in units of $ \ifmmode\mathord{\mathrm{cm}}\else cm\xspace\fi ^{-1}$:

$\displaystyle \kappa_{trans} = 0.2 (1+X) \rho.$ (22.9)

The parameters op_absorbScale, op_emitScale, op_transScale are also introduced allowing the user to scale the three opacities accordingly.

This is a gray opacity implementation. The ngrp argument in Opacity calls has to be supplied but will be ignored.

The BremsstrahlungAndThomson opacity implementation can be included with the following setup option:  

-with-unit=physics/materialProperties/Opacity/OpacityMain/BremsstrahlungAndThomson


22.5.4 OPAL Implementation

The OPAL Opacity implementation in Opacity/OpacityMain/OPAL uses a table lookup scheme to read realistic stellar opacities from the OPAL database of Lawrence Livermore National Lab (LLNL). OPAL opacities are functions of density, temperature and composition and are stored in two different datasets: one for high temperature ( $ 3.75<{\tt logT}<8.7$) based on Grevesse & Sauval (1998) and one for low temperature ( $ 2.7< {\tt logT}<4.5$) based on Ferguson, Alexander, et al (2005), where $ {\tt logT} = \log_{10}(T/{\mathrm K})$. Each dataset includes files corresponding to different hydrogen mass fractions ($ X$). Both datasets assume solar metallicity ($ Z = 0.02$). The database we use is exactly the same used by the Modules for Experiments in Stellar Astrophysics (MESA) code (Paxton et al. 2011; 2013; 2015) and the SuperNova Explosion Code (SNEC; Morozova et al. 2015). The radflaHD/SupernovaRad1D setup is utilizing the new OPAL implementation to compute the light curve of a supernova (SN) explosion using a progenitor model computed with MESA.

This is a gray opacity implementation. The ngrp argument in Opacity calls has to be supplied but will be ignored.


22.5.5 Multispecies Implementation

In general, the opacity is a strong function of the material (or species in FLASH parlance), frequency (or group number), and state of the fluid. The Multispecies Opacity unit implementation provides the flexibility to specify different opacities to use as a function of species and opacity type (either absorption, emission, or transport). It can be included in the simulation using the following setup option:  

-with-unit=physics/materialProperties/Opacity/OpacityMain/Multispecies

The opacities for each species are averaged together based on the relative number densities to produce an average opacity of each type for a given cell. For each species and type, the Multispecies implementation allows the user must specify an opacity model to use. There are currently three commonly used opacity models in FLASH:

The first two opacity models, constant and constcm2g, are fairly self-explanatory. The tabulated opacity model is useful for modeling realistic opacities in a general way. Each table is tabulates an opacity at $ N_D$ discrete density points and $ N_T$ discreet electron temperature points. The table for each species and opacity type can have different a temperature/density grid. However, each table must use the same energy group structure which is consistent with the group structure used by the RadTrans unit.

Extraction (interpolation) of opacities from the stored tables is currently done using the bilinear form. For a temperature/density pair $ (t,d)$ inside the grid, the code determines the quadrant corners $ T_1\leq t\leq T_2$ and $ D_1\leq d\leq D_2$ and the corresponding four opacities $ \kappa_{xy} = \kappa(T_x,D_y);x,y=1,2$ and performs the bilinear interpolation:

$\displaystyle \tau_1$ $\displaystyle =$ $\displaystyle {T_2-t\over T_2-T_1}$ (22.10)
$\displaystyle \tau_2$ $\displaystyle =$ $\displaystyle {t-T_1\over T_2-T_1}$ (22.11)
$\displaystyle \delta_1$ $\displaystyle =$ $\displaystyle {D_2-d\over D_2-D_1}$ (22.12)
$\displaystyle \delta_2$ $\displaystyle =$ $\displaystyle {d-D_1\over D_2-D_1}$ (22.13)
$\displaystyle \kappa (t,d)$ $\displaystyle =$ $\displaystyle \sum_{i=1}^2\sum_{j=1}^2 \tau_i\delta_j\kappa_{ij}.$ (22.14)

In case the target $ (t,d)$ lays outside the grid boundaries, the corresponding boundary value(s) is(are) taken. This is a temporary solution and will be supplemented with options for calculating more accurate opacities, especially for lower cell temperatures. Two possible options are provided for performing the interpolation: i) on the original tabulated opacities or ii) on the logarthmically (base 10) transformed tabulated opacities.

Currently, the tables must be stored in either the IONMIX or IONMIX4 formats. The exact specification of this format can be found in Sec:OpacityIonmix. The IONMIX4 format is the most general since it allows for arbitrary temperature/density points. Users who wish to use their own tabulated opacities may convert their files into the IONMIX4 format for use in FLASH. As Sec:OpacityIonmix describes, IONMIX4 files contain group opacities in units of $ \ifmmode\mathord{\mathrm{cm}}\else cm\xspace\fi ^2/\ifmmode\mathord{{\mathrm g}}\else g\xspace\fi $. Each file contains three different group opacities: a Planck Absorption, a Planck Emission, and a Rosseland opacity. The user must specify which of these opacities to use for each species/opacity type in FLASH.


22.5.5.1 Runtime Parameters for the Multispecies Opacity

Use of the Multispecies opacity implementation requires the Multispecies unit. At least one species must be defined in the simulation to use the Multispecies opacity. Furthermore, the species must all be specified using the species setup variable and cannot be defined using the SPECIES keyword in a Config file. Please see Sec:DefineSpecies2 for more details.

Once the species are specified, the Multispecies opacity implementation will automatically create a set of runtime parameters to allow users to control how the opacity is computed for each species and opacity type. These runtime parameters are shown in Table 22.1. The symbol in the table should be replaced by the species names as specified using the species setup variable.


Table 22.1: Multispecies Opacity Runtime Parameters
Runtime Parameter Description  
op_Absorb Model to use for the absorption opacity  
op_Emiss Model to use for the emission opacity  
op_Trans Model to use for the transport opacity  
op_AbsorbConstant Constant value to use for absorption opacity  
op_EmissConstant Constant value to use for emission opacity  
op_TransConstant Constant value to use for transport opacity  
op_FileName Name of IONMIX file for tabulated opacity  
op_FileType Tabulated opacity file type, either “IONMIX” or “IONMIX4”  

The opacity models for each species are specified using the op_[Absorb,Emiss,Trans] runtime parameters. These parameters can be set to the following string values:

When any of the models for a species is set to “op_tabpa”, “op_tabpe”, or “op_tabro”, FLASH will attempt to read a file which contains the tabulated opacities. The file name, for each species, is given by the runtime parameter op_FileName. The type of the file is set using the parameter op_FileType. Currently, FLASH only supports reading opacity files in the IONMIX or IONMIX4 format, but this will likely change in the future.

The code segment below shows an example of how one would specify the runtime parameters for the Multispecies opacity in a simulation with two species named cham and targ (this simulation would have been set up using the species=cham,targ setup argument):  

# Specify opacity models for the species cham:
op_chamAbsorb   = "op_tabpa"       # Use tabulated Planck Absorption opacity for
                                   # the absorption term
op_chamEmiss    = "op_tabpe"       # Use the Planck Emission opacity for the emission 
                                   # term
op_chamTrans    = "op_tabro"       # Use the Rosseland opacity for the transport term
op_chamFileName = "he-imx-005.cn4" # Specify tabulated opacity file name
op_chamFileType = "ionmix4"        # Set tabulated opacity file type to IONMIX4


# Specify opacity models for the species targ:
op_targAbsorb      = "op_constcm2g" # Use a constant opacity for the absorption term
op_targEmiss       = "op_constcm2g" # Use a constant opacity for the emission term
op_targTrans       = "op_constcm2g" # Use a constant opacity for the transport term
op_targAbsorbConst = 10.0           # Set targ species absorption opacity to 10 cm^2/g
op_targEmissConst  =  0.0           # Set targ species absorption opacity to zero 
                                    # This species won't emit radiation
op_targTransConst  = 1.0e+06        # Set targ species transport opacity to a large 
                                    # value Radiation will diffuse very slowly through 
                                    # this material
In this example species cham uses a tabulated opacity while species targ uses constant opacities. The opacities for targ are chosen so that the material will not emit any radiation, and to suppress the transport of radiation. The LaserSlab simulation shows a comprehensive example of how the Multispecies opacity is used in a realistic HEDP simulation.


22.5.6 The IONMIX EOS/Opacity Format

FLASH reads tabulated opacity and Equation Of State (EOS) files in the IONMIX, IONMIX4, and IONMIX6 formats. The IONMIX4 and IONMIX6 formats are very similar and are more flexible than the IONMIX format. Thus, only the IONMIX4 and IONMIX6 formats will be documented here. These three formats are not particularly user friendly and future FLASH releases will likely include support for EOS and opacity file formats which are easier to handle. Nevertheless, by manipulating their data into the IONMIX4 or IONMIX6 formats, users can use their own EOS/opacity data in FLASH simulations. Each file contains information for a single material. All EOS/opacity information is defined on a temperature/density grid. The densities are actually ion number densities.

Below, the IONMIX4 and IONMIX6 formats are defined. They are very similar: the latter is identical to the former but also includes electron specific entropy information. Certain information is ignored by FLASH, meaning that it is read in, but not used for any calculations (right now). Other information is used by the EOS unit alone, or by the opacity unit alone.

  1. Number of temperature points
  2. Number of ion number density points
  3. Line containing information about the atomic number of each element in this material (ignored by FLASH)
  4. Line containing information about the relative fraction of each element in this material (ignored by FLASH)
  5. Number of radiation energy groups
  6. List of temperatures
  7. List of ion number densities
  8. Average ionization ($ \bar z$) for each temperature/density (only used for tabulated EOS in FLASH)
  9. $ d\bar z/dT_e$ [$ 1/eV$] for each temperature/density (ignored by FLASH)
  10. Ion pressure ($ P_i$) [$ J/cm^3$] for each temperature/density (only used for tabulated EOS in FLASH)
  11. Electron pressure ($ P_e$) [$ J/cm^3$] for each temperature/density (only used for tabulated EOS in FLASH)
  12. $ dP_i/dT_i$ [$ J/cm^3/eV$] for each temperature/density (ignored by FLASH)
  13. $ dP_e/dT_e$ [$ J/cm^3/eV$] for each temperature/density (ignored by FLASH)
  14. Ion specific internal energy $ e_i$ [$ J/g$] for each temperature/density (only used for tabulated EOS in FLASH)
  15. Electron specific internal energy $ e_e$ [$ J/g$] for each temperature/density (only used for tabulated EOS in FLASH)
  16. $ de_i/dT_i$ [$ J/g/eV$] for each temperature/density point (ignored by FLASH)
  17. $ de_e/dT_e$ [$ J/g/eV$] for each temperature/density point (ignored by FLASH)
  18. $ de_i/dn_i$ [$ J/g/cm^3$] for each temperature/density point (ignored by FLASH)
  19. $ de_e/dn_i$ [$ J/g/cm^3$] for each temperature/density point (ignored by FLASH)
  20. ONLY INCLUDE FOR IONMIX6 FORMAT
    Electron specific entropy [$ J/g/eV$] for each temperature/density point.
  21. Each energy group boundary [eV]. There are $ g+1$ boundaries for a simulation with $ g$ groups.
  22. Rosseland opacity [$ cm^2/g$] for each density/temperature/energy group (only used for tabulated opacity in FLASH)
  23. Planck absorption opacity [$ cm^2/g$] for each density/temperature/energy group (only used for tabulated opacity in FLASH)
  24. Planck emission opacity [$ cm^2/g$] for each density/temperature/energy group (only used for tabulated opacity in FLASH)

Below, the exact format of the IONMIX4 file is defined. This is done by providing code listing which shows how the data can be read in using FORTRAN read statements. Users can use this information to convert their own data into the IONMIX4 format so that it can be used by FLASH.

 

! *** Write the header ***
! Write the number of temperature and density points:
write (header,923)  ntemp, ndens


! Write the atomic number of each element in this material:
write (headr2,921) (izgas(l),l=1,ngases)


! Write the fraction (by number of ions) of each element in this material:
write (headr3,922) (fracsp(l),l=1,ngases)


write (10,980) header
write (10,980) headr2
write (10,980) headr3


! Write the number of radiation energy groups:
write (10,982) ngrups


! Write the temperature points (in eV):
write (10,991) (tplsma(it),it=1,ntemp)


! Write the number density points (in cm^-3):
write (10,991) (densnn(id),id=1,ndens)


! Write out the zbar at each temperature/density point (nele/nion):
write (10,991) ((densne(it,id)/densnn(id),it=1,ntemp),id=1,ndens)


! Write d(zbar)/dT:
write (10,991) ((dzdt(it,id),it=1,ntemp),id=1,ndens)


! Write the ion pressure (in Joules/cm^3):
write (10,991) ((densnn(id)*tplsma(it)*1.602E-19_idk,it=1,ntemp),id=1,ndens)


! Write the electron pressure (in Joules/cm^3):
write (10,991) ((tplsma(it)*densne(it,id)*1.602E-19_idk,it=1,ntemp),id=1,ndens)


! Write out d(pion)/dT (in Joules/cm^3/eV):
write (10,991) ((densnn(id)*1.602E-19_idk,it=1,ntemp),id=1,ndens)


! Write out d(pele)/dT (in Joules/cm^3/eV):
write (10,991) &
  (((tplsma(it)*densnn(id)*dzdt(it,id) + densne(it,id))*1.602E-19_idk,it=1,ntemp),id=1,ndens)


! Write out the ion specific internal energy (in Joules/gram):
write (10,991) ((enrgyion(it,id),it=1,ntemp),id=1,ndens)


! Write out the electron specific internal energy (in Joules/gram):
write (10,991) ((enrgy(it,id)-enrgyion(it,id),it=1,ntemp),id=1,ndens)


! Write out the ion specific heat (in Joules/gram/eV):
write (10,991) ((heatcpion(it,id),it=1,ntemp),id=1,ndens)  


! Write out the electron specific heat (in Joules/gram/eV):
write (10,991) ((heatcp(it,id)-heatcpion(it,id),it=1,ntemp),id=1,ndens)                     


! Write out d(eion)/d(nion) (I think, but I'm not sure...)
write (10,991) ((dedden_ion(it,id)*condd*densnn(id)/tplsma(it)**2, it=1,ntemp),id=1,ndens)  


! Write out d(eele)/d(nele) (I think, but I'm not sure...)
write (10,991) &
  (((dedden(it,id)-dedden_ion(it,id))*condd*densnn(id)/tplsma(it)**2, it=1,ntemp),id=1,ndens)           


! ONLY FOR IONMIX6 FORMAT, IONMIX4 FORMAT DOES NOT INCLUDE ELECTRON
! SPECIFIC ENTROPY:
!
! Write out electron specific entropy
write (10,991) ((entrele(it,id),it=1,ntemp),id=1,ndens)


! Write out the energy group boundaries (in eV):
write (10,991) (engrup(ig),ig=1,ngrups+1)                      


! Write the Rosseland group opacities
write (10,991) (((orgp(it,id,ig),it=1,ntemp),id=1,ndens),ig=1,ngrups)


! Write the Planck absorption opacities
write (10,991) (((opgpa(it,id,ig),it=1,ntemp),id=1,ndens),ig=1,ngrups)


! Write the Planck emission opacities
write (10,991) (((opgpe(it,id,ig),it=1,ntemp),id=1,ndens),ig=1,ngrups)


921 format (' atomic #s of gases: ',5i10)
922 format (' relative fractions: ',1p5e10.2)
923 format (2i10)
980 format (a80)
981 format (4e12.6,i12)
982 format (i12)
991 format (4e12.6)