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 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.
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
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 , 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
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 :
(23.8) |
where is the Gaunt factor ( 1), the fractional abundance of elements heavier than hydrogen, the fractional abundance of hydrogen, the temperature and the temperature.
For the transport opacity, dominated by Thompson scattering, we have, in units of :
(23.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
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 ( ) based on Grevesse & Sauval (1998) and one for low temperature ( ) based on Ferguson, Alexander, et al (2005), where . Each dataset includes files corresponding to different hydrogen mass fractions (). Both datasets assume solar metallicity (). 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.
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 discrete density points and 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 inside the grid,
the code determines the quadrant corners
and
and the corresponding four opacities
and performs the
bilinear interpolation:
(23.10) | |||
(23.11) | |||
(23.12) | |||
(23.13) | |||
(23.14) |
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 . 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.
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 23.1. The symbol
Runtime Parameter | Description | |
---|---|---|
op_ |
Model to use for the absorption opacity | |
op_ |
Model to use for the emission opacity | |
op_ |
Model to use for the transport opacity | |
op_ |
Constant value to use for absorption opacity | |
op_ |
Constant value to use for emission opacity | |
op_ |
Constant value to use for transport opacity | |
op_ |
Name of IONMIX file for tabulated opacity | |
op_ |
Tabulated opacity file type, either “IONMIX” or “IONMIX4” |
The opacity models for each species are specified using the
op_
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
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.
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)