Wiki
Clone wikiKROME / photoUser
List of photochemistry user functions
KROME has several user functions to interface your framework code with the photochemistry.
(Do not forget that python list_user_functions.py
list all the user functions, run with -h
for details).
More details can be found in this general section on photochemistry.
krome_calc_photobins()
Precompute rates and tables. Note that this is usually automatically done by KROME: this subroutine is for debug.
krome_set_photoBinJ(phbin)
Set the radiance in each photobin, eV/cm2/sr. phbin
is a double of size krome_nPhotoBins
.
krome_set_photobinE_lr(phbinleft,phbinright,Tgas)
Set photobinning using two arrays with the left and right energy limits of each bin, in eV.
These arrays have size krome_nPhotoBins
. Tgas
is optional and sets the temperature for line broadening.
krome_set_photobinE_limits(phbinLimits,Tgas)
Set photobinning using a single array of size krome_nPhotoBins+1
with all the energy limits, eV.
Tgas
is optional and sets the temperature for line broadening.
subroutine krome_set_photobinE_moc(binPos,binWidth,Tgas)
Set photobinning using an array with bin midpoints and one with bin widths. Both have sizekrome_nPhotoBins
, in eV.
Tgas
is optional and sets the temperature for line broadening.
krome_set_photobinE_lin(lower,upper,Tgas)
Automatically set a linear spacing in the energy range lower
to upper
, in eV.
Tgas
is optional and sets the temperature for line broadening.
krome_set_photobinE_log(lower,upper,Tgas)
Same as krome_set_photobinE_lin
, but log-spaced.
krome_get_photoBinJ()
Returns an array of size krome_nPhotoBins
containing the radiance in each bin, in eV/cm2/sr.
krome_get_photoBinE_left()
Returns an array of size krome_nPhotoBins
containing the left position of each bin, in eV.
krome_get_photoBinE_right()
see krome_get_photoBinE_left
krome_get_photoBinE_mid()
Returns an array of size krome_nPhotoBins
containing the mid points of each bin, in eV.
Note that both for log-spacing and linear-spacing these are linear averaged, i.e. (energyLeft+energyRight)/2
krome_get_photoBinE_delta()
Returns an array of size krome_nPhotoBins
containing the span of each bin, in eV.
krome_get_photoBinE_idelta()
Same as krome_get_photoBinE_delta
, but the inverse, in 1/eV.
krome_get_photoBin_rates()
Returns an array of size krome_nPhotoRea
containing the computed rate coefficients, in 1/s.
krome_get_xsec(idx)
Returns an array of size krome_nPhotoBins
containing the cross-section of the idx
-th photoreaction, in cm2.
krome_get_photoBin_heats()
Returns an array of size krome_nPhotoRea
containing the heating per photoreaction, in erg/s.
krome_photoBin_scale(xscale)
Scale the flux in all bins by the same factor xscale
.
krome_photoBin_scale_array(xscale)
Scale the flux in each bins by the an array xscale
of size krome_nPhotoBins
.
Each array element corresponds to a photobin.
krome_photoBin_store()
Store the flux to be restored later with krome_photoBin_restore
. This is e.g. to restore flux after scaling is applied.
krome_photoBin_restore()
Restore the flux to be stored with krome_photoBin_store
.
krome_load_photoBin_file(fname)
Load radiation binning from the file fname
. Data should be a 3-column file with energy Left (eV), energy Right (eV), intensity (eV/cm2/sr).
This subroutine sets also the binning.
krome_set_photoBin_HMlog(lower_in,upper_in)
Sets Hardt and Madau flux in the range lower_in
, upper_in
, both eV.
Note that these are optional, where default is lower_in=0.1237d0
and upper_in=4.997d7
.
Redshift is taken internally from KROME, set by using krome_set_phys_zredhift
function.
krome_set_photoBin_BBlin(lower,upper,Tbb)
Set the binning and the flux of a black-body with temperature Tbb
(K), in the range lower
to upper
, in eV. Binning is linear here.
krome_set_photoBin_BBlog(lower,upper,Tbb)
As krome_set_photoBin_BBlin
but log-spaced.
krome_set_photoBin_BBlog_auto(Tbb)
Automatically sets intensity and binning for a black-body with temperature Tbb
.
Use with caution, not much tested!
krome_get_ratioFluxDraine()
Returns the ratio between a Draine's flux and the current flux.
krome_set_photoBin_draineLin(lower,upper)
Sets Draine's flux in the energy range lower
to upper
, in eV.
Linear spacing. Note that this is defined in the range 5<E<13.6, zero elsewhere.
krome_set_photoBin_draineLog(lower,upper)
As krome_set_photoBin_draineLin
, but log-spaced.
krome_set_photoBin_draineCustom()
Sets Draine's flux using the current binning.
krome_set_photoBin_J21lin(lower,upper)
Sets linear binning and flux using a J21 power-law in the range lower
to upper
, in eV.
krome_set_photoBin_J21log(lower,upper)
As krome_set_photoBin_J21log
, but log-spaced.
krome_get_opacity(x,Tgas)
Returns the opacity for the x(:)
gas composition, where the array x
has size krome_nmols
.
Geometry is inferred by the num2col
expression defined with -columnDensityMethod
option.
Returned opacity is for photobin, so that the returned array has size krome_nPhotoBins
.
krome_get_opacity_size(x,Tgas,csize)
Returns the opacity as in krome_get_opacity
, but assuming a cell size of csize
.
krome_get_opacity_size_d2g(x,Tgas,csize,d2g)
Returns the opacity as in krome_get_opacity_size
, but using dust with dust to gas mass ratio d2g
.
Opacity table can be loaded with krome_load_dust_opacity
.
krome_load_opacity_table(fname,unitEnergy)
Loads opacity tables from file fname
. Optional argument unitEnergy
can be either eV
(default) or micron
.
krome_dump_Jflux(nfile)
Dumps energy mid point and radiation intensity for each bin in the file with unit number nfile
.
krome_set_lineBroadeningVturb(vturb)
Sets turbulence velocity for line broadening, in cm/s.
Updated