Package ComboCode :: Package cc :: Package modeling :: Package physics :: Module EnergyBalance :: Class EnergyBalance
[hide private]
[frames] | no frames]

Class EnergyBalance

source code


The energy balance class.

Author: R. Lombaert, H. Olofsson & M. Maercker (Chalmers, Sweden)

For the use of the EnergyBalance module, please contact one of the three authors listed here.

Calculates energy balance and provides tools for reading and writing I/O, and setting input physics.

For now limited to the energy balance from the dust formation radius up to the outer radius.

An example for calculating the energy balance (see the respective functions for in-depth information): >>> from cc.modeling.physics import EnergyBalance as EB >>> eb = EB.EnergyBalance() >>> eb.iterT() >>> eb.plotT() >>> eb.plotRates() This calculates and plots the temperature profiles and heating/cooling rates across all iterations using the default settings given in cc.path.aux/inputEnergyBalance_standard.dat

Default in the inputEnergyBalance_standard file can be adapted through keywords passed to EnergyBalance. A few examples: >>> eb = EB.EnergyBalance(a=[0.005,0.25,300,1]) which creates a grain-size grid from 0.005 to 0.25 micron with 300 points distributed in log scale.

>>> eb = EB.EnergyBalance(hterms=['dg','dt'])
adds dust-gas collisional heating and heat exchange to the adiabatic 
cooling as heat/cool terms.
>>> eb = EB.EnergyBalance(template='gastronoom')
uses the input template to reproduce the GASTRoNOoM settings.
>>> eb = EB.EnergyBalance(gamma='h2')
calculates the adiabatic coefficient from the temperature-dependent measured
coefficient of molecular hydrogen.
>>> eb = EB.EnergyBalance(heatmode='gs2014')
calculates the heating and cooling terms from dust-gas interaction based on 
the formalism of Gail & Sedlmayr 2014 as opposed to the classical 
implementations of Decin et al. 2006 and Schoïer et al. 2001.

Furthermore, the iterative procedure can be adapted to user-specific needs: >>> eb.iterT(conv=0.005,imax=200,step_size=0.05) sets the relative convergence criterion to 0.005 from default 0.01, the maximum iterations to 200, and the step_size of the gradual maximum allowed temperature change between iterations to 5%.

Instance Methods [hide private]
 
__init__(self, fn=None, template='standard', **kwargs)
Creating an EnergyBalance object used to calculate the energy balance.
source code
list[str,dict]
formatInput(self, ilst)
Format an input keyword list for a variable.
source code
 
readInputParameters(self, **kwargs)
Read the input parameters for the energy balance.
source code
 
setGrids(self, r=None, a=None, l=None)
Initialise the coordinate grids: radius (cm), grain size (cm), wavelength (cm).
source code
 
setStar(self, rstar=None, Tstar=None, Ltype=None)
Set the stellar properties.
source code
 
setProfiles(self, opac=None, mdot=None, mdot_dust=None, T=None, Td=None, mu=None)
Initialise the independent profiles:opacity, mass-loss rate, initial temperature, dust temperature
source code
 
setGamma(self, gamma=None)
Set the adiabatic coefficient.
source code
 
setVelocity(self, v=None)
Set the velocity profile, based on the requested function.
source code
 
setLineCooling(self, m)
Set the line cooling parameters.
source code
 
setPopInitial(self, m)
Set an initial set of level populations.
source code
 
setAbundance(self, m)
Set the abundance profile for a molecule.
source code
 
setTexc(self, m)
Calculate the excitation temperature for the level populations given in self.pop.
source code
array
getTexc(self, m, indices=None, lup=None, llow=None)
Return the excitation temperature profile as a function of impact parameter for given transition indices of a given molecule.
source code
 
__reset(self)
Reset all variables that depend on the radius, velocity, etc.
source code
 
__next_iter(self)
Reset some of the properties that depend on temperature so they can be calculated anew.
source code
 
setDrift(self)
Calculate the drift velocity profile.
source code
 
setVdust(self)
Set the dust velocity profile.
source code
 
setDensity(self, dtype)
Calculate the density profile for gas or dust.
source code
 
updatePop(self, m, fn='', updateLC=0)
Update the level populations.
source code
 
__setT(self)
Set the current temperature profile for this iteration.
source code
 
iterT(self, conv=0.01, imax=50, step_size=0.0, dTmax=0.1, warn=1, *args, **kwargs)
Iterate the temperature profile until convergence criterion is reached.
source code
 
calcT(self, dTmax=1, warn=1, ode_kwargs={}, *args, **kwargs)
Calculate the temperature profile based on the differential equation given by Goldreich & Scoville (1976).
source code
 
Cad(self)
Calculate the adiabatic cooling rate.
source code
 
Hdg(self)
Calculate the heating rate by dust-gas collisions.
source code
 
Hdt(self)
Calculate the heating rate by dust-gas heat exchange.
source code
 
Hpe(self)
Calculate the heating rate by the photoelectric effect.
source code
 
Hcr(self)
Calculate the heating rate by cosmic rays.
source code
 
Ch2(self)
Calculate the line cooling rate by vibrational excitation of H_2.
source code
 
Clc(self, m, update_pop=1)
Calculate the radiative line cooling rate for a molecule.
source code
 
plotRateIterations(self, iterations=[], dTsign='C', mechanism='ad', scale=1, fn=None, cfg=None, **kwargs)
Plot the heating or cooling rates for several iterations of a given mechanism and heat exchange sign (cooling or heating).
source code
 
plotRates(self, scale=1, fn=None, iteration=None, cfg=None, join=0, **kwargs)
Plot the heating and cooling rates for a single iteration.
source code
 
plotT(self, fn=None, iterations=[], cfg=None, **kwargs)
Plot the temperature profiles of the different iterations.
source code
 
plotHCTerm(self, fn=None, iterations=[], dTsign='C', cfg=None, **kwargs)
Plot the total heating and cooling term (excluding adiabatic cooling) calculated by calcT before the differential equation is solved.
source code
 
plotTexc(self, m, indices=None, llow=None, lup=None, fn=None, cfg=None, **kwargs)
Plot the excitation temperature as a function of impact parameter for a selection of radiative transitions, given by either the transition indices or the upper and/or lower level indices.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fn=None, template='standard', **kwargs)
(Constructor)

source code 

Creating an EnergyBalance object used to calculate the energy balance.

Can work in conjunction with iteration with a RT code.

Takes into account several contributors to the heating and cooling of an outflow:

  • Adiabatic cooling
  • dust-gas collisional indirect heating (elastic collisions)
  • dust-gas direct heat exchange (accommodation)

Not yet implemented:

  • Radiative line cooling and heating (for H2, CO, H2O, ...)
  • Photoelectric heating
  • Heating by cosmic rays

An instance of EnergyBalance contains three types of properties:

  • basic input parameters given by the inputfile
  • independent variables and basic profiles set before calculations
  • profiles calculated from the basic parameters, variables, and profiles, reset whenever any of the previous two properties are changed.

First set is given in aux/inputEnergyBalance.dat.

Second set includes: radius, grain size, gas velocity, gas/dust mass-loss rates, dust opacities, dust temperature, stellar radiance.

Third set includes: gas temperature, gas/dust density, drift velocity.

Note that for now line cooling parameters are fixed. Hence after a new RT model was calculated, a new energy balance must be calculated. In the future, the level pops will be updateable.

Parameters:
  • fn (str) - The parameter inputfile filename. If not given, a default inputfile is read from aux/inputEnergyBalance.dat.

    (default: aux/inputEnergyBalance.dat)

  • template (str) - The inputfile template used for initializing the energy balance. Default is the standard, with as much consistency as possible. Alternatives are 'mcp' and 'gastronoom' to reproduce the respective code's results. Templates cannot be changed, but inputfiles given by fn overwrite any input given there.

    (default: 'standard')

  • kwargs (dict) - Input parameters listed in the default inputEnergyBalance file can also be passed through the initialisation of this instance. They will replace the values given in the inputfile.

    (default: {})

Overrides: object.__init__

formatInput(self, ilst)

source code 

Format an input keyword list for a variable.

Can be given as a string, split by spaces, or as the list output from str.split().

Assumes the first element is the requested function or a constant, followed by key=value pairs that serve as the input keyword arguments for the function if the first element is not a constant. The first element thus does not contain a '=' sign.

The key=value pairs are formatted into a dictionary.

Example str: 'read_opacity species=AMCDHSPREI index=1 order=5' Example list: ['read_opacity','species=AMCDHSPREI','index=1','order=5']

Parameters:
  • ilst (list[str]/str) - The input line, arguments split by spaces
Returns: list[str,dict]

readInputParameters(self, **kwargs)

source code 

Read the input parameters for the energy balance.

If a filename is not given, the one set upon initialisation is used. If none was given upon initialisation the default one from aux/ is read.

Resets any variables that depend on independent variables.

Parameters:
  • fn (str) - The parameter inputfile filename. If None, a default inputfile is read from aux/

    (default: None)

  • kwargs (dict) - Input parameters listed in the default inputEnergyBalance file can also be passed through the initialisation of this instance. They will replace the values given in the inputfile.

    (default: {})

setGrids(self, r=None, a=None, l=None)

source code 

Initialise the coordinate grids: radius (cm), grain size (cm), wavelength (cm).

The grids can be given as lists, which are used as input for Gridding.makeGrid. If not given, they are taken from the inputfile.

Parameters:
  • r (list) - The radius grid (cm). [rmin,rmax,nsteps,log?]

    (default: None)

  • a (list/float) - The grain size grid (cm). [amin,amax,nsteps,log?] Can be single value in case of one average grain size.

    (default: None)

  • l (list) - The wavelength grid (cm). [lmin,lmax,nsteps,log?]

    (default: None)

setStar(self, rstar=None, Tstar=None, Ltype=None)

source code 

Set the stellar properties.

If any of these are None, they are taken from the inputEnergyBalance.dat file.

Defines the Radiance profile based on these properties.

Parameters:
  • rstar (float) - The stellar radius (cm)

    (default: None)

  • Tstar (float) - The stellar effective temperature (K)

    (default: None)

  • Ltype (float) - The type of stellar radiance profile (blackbody, ...)

    (default: None)

setProfiles(self, opac=None, mdot=None, mdot_dust=None, T=None, Td=None, mu=None)

source code 

Initialise the independent profiles:opacity, mass-loss rate, initial temperature, dust temperature

The grids can be given as a 1- or 2-item list, which are used as input for the respective Profiler classes. If not given, they are taken from the inputfile.

Format of the input lists:

  • [constant value]
  • [func/str,{kwargs}]
Parameters:
  • opac ([func,dict]) - The opacity profiles (l, cm^2/g). [func,{pars}]

    (default: None)

  • mdot ([func,dict]) - The mass-loss rate profile (r, Msun/yr) [func,{pars}] or constant.

    (default: None)

  • mdot_dust ([func,dict]) - The dust mass-loss rate profile (r, Msun/yr) [func,{pars}] or constant.

    (default: None)

  • T ([func,dict]) - The initial temperature profile (r, K). [func,{pars}] The first arg is the function, followed by T0 and r0. Can be string Td as well to set it to the dust temperature.

    (default: None)

  • Td ([func,dict]) - The dust temperature profile (r, K). [func,{pars}] The first arg is the function.

    (default: None)

  • mu (float) - The mean molecular weight if nonstandard. Otherwise calculated from fH and fHe. Could be specified in case, e.g., some sort of dissociation is ongoing in the inner wind.

    (default: None)

setGamma(self, gamma=None)

source code 

Set the adiabatic coefficient.

Three options:

  • Constant value
  • Step function at 350K (going 7/5 => 5/3 at lower T, MCP model)
  • T-dependent gamma for H2 gas
Parameters:
  • gamma (float/str) - The adiabatic coefficient profile (K, /). Is either a constant (float), or 'h2' in which case the adiabatic coefficient is read from a file as a function of T, or h2_mcp in which case gamma is a step function: 7./5. for T>350 K, 5./3. otherwise.

    (default: None)

setVelocity(self, v=None)

source code 

Set the velocity profile, based on the requested function.

Done separately from other profiles, because this can depend on the temperature at the inner radius (independent), and on the adiabatic coefficient (for the sound velocity).

This is done before the line cooling term is set.

Parameters:
  • v ([func,dict] or [cst]) - The velocity profile (r, cm/s). [func,{pars}]

    (default: None)

setLineCooling(self, m)

source code 

Set the line cooling parameters.

This includes reading the collision rates and level populations.

This is done per molecule, and upon initialisation of the EnergyBalance.

A distinction is made between the source of the spectroscopy/level pops:

  • GASTRoNOoM: The info is taken from the MlineReader and CollisReader
  • ALI: The info is taken from the LamdaReader, PopReader and .par output file
Parameters:
  • m (str) - The molecule name from the input molecules list.

setPopInitial(self, m)

source code 

Set an initial set of level populations.

Based on the Boltzmann distribution for a given excitation temperature. The kinetic temperature is taken for now. Should likely be scalable in the future.

Solves the set of equations:

  • Sum(n_i) = 1
  • n_i = n_0 * (g_l/g_0) exp((E_0 - E_l)/Tkin)
Parameters:
  • m (str) - The molecule name from the input molecules list.

setAbundance(self, m)

source code 

Set the abundance profile for a molecule.

Two possibilities:

  • Level populations are given, which include molecular abundance profiles as well, and are RT code dependent
  • No level pops are given, so use the default abundance profile

The second possibility requires a read method and a filename to be given in the molecule definition, e.g. molecule=12C16O np.loadtxt fname=waql.par usecols=[1,4] skiprows=9 unpack=1 Alternatively, a constant value can be given as well (not advised).

Parameters:
  • m (str) - The molecule name from the input molecules list.

setTexc(self, m)

source code 

Calculate the excitation temperature for the level populations given in self.pop. This method is called when the pops are read for the first time (or set by setInitialPop), and when the level populations are updated.

The excitation temperature is set as an array of dimensions (number of transition indices, number of impact parameter), hence for a given transition index, you can retrieve the excitation temperature as self.Texc[m][i-1,:] as a function of impact parameter. Alternatively, you can access Texc by calling getTexc and passing either the indices or the lup/llow.

The impact parameter grid can be retrieved from self.pop[m].getP().

Note that the excitation temperature is calculated for all radiative transitions included in the molecular spectroscopy; not for all collisional transitions.

Parameters:
  • m (str) - The molecule tag

getTexc(self, m, indices=None, lup=None, llow=None)

source code 

Return the excitation temperature profile as a function of impact parameter for given transition indices of a given molecule.

Can also take upper and/or lower level indices to determine the transition indices.

The excitation temperature is returned as an array of dimensions (number of transition indices, number of impact parameters).

Parameters:
  • m (str) - The molecule tag
  • indices (list/array) - The transition indices. Can be indirectly given through upper and/or lower level indices. If default and no llow/lup are given, all Texc are returned for this molecule.

    (default: None)

  • lup (list/array) - The upper level indices used to extract the transition indices. If this or llow are defined, the keyword indices is overwritten.

    (default: None)

  • llow (list/array) - The upper level indices used to extract the transition indices. If this or lup are defined, the keyword indices is overwritten.

    (default: None)

Returns: array
The excitation temperature, with array shape (n_index,n_p)

setDrift(self)

source code 

Calculate the drift velocity profile.

This assumes a stellar radiance profile is given, of which the wavelength grid is used to integrate Q_l * L_l, thereby interpolating the opacity.

The two available modes are standard and beta:

  • standard: Calculates the drift velocity based on the balance between the radiation pressure and the drag force.
  • vbeta: Follows MCP, where the terminal drift velocity is calculated from the terminal gas velocity, based on the balance between radiation pressure and drag force, with a beta law going to that max velocity.

Note that the vbeta mode follows the F mode for dust velocity in MCP.

setVdust(self)

source code 

Set the dust velocity profile. The drift is averaged over grain size.

setDensity(self, dtype)

source code 

Calculate the density profile for gas or dust.

The dust density profile is not dependent on grain size, since the drift averaged over grain size.

Parameters:
  • dtype (str) - The density profile type, being 'gas' or 'dust'.

updatePop(self, m, fn='', updateLC=0)

source code 

Update the level populations.

This reads the level populations from the same file as listed upon creation of the EnergyBalance and assumes those level populations are appropriate for the temperature profile of the iteration number self.i.

This is done per molecule.

Parameters:
  • m (str) - The molecule name from the input molecules list.
  • fn (str) - The filename of a populations file, in case it changes or is added anew after default populations have been used. Ignored if the file does not exist.

    (default: '')

  • updateLC (bool) - The flag that moves the self.ipop to the current (or next) iteration, so that calcClc knows a new line cooling term must be updated. This is always set to 1 if the populations are updated. Setting this to 1 upon function call, tells calcClc the LC term must be calculated anew regardless of reading new pops (and thus uses the old pops with the new T profile of this iteration). This key can be set in the inputfile.

    (default: 0)

__setT(self)

source code 

Set the current temperature profile for this iteration. When i == 0, this is the initial guess.

This is done explicitly, because upon initialisation the state of the object depends on self.T being None or not.

iterT(self, conv=0.01, imax=50, step_size=0.0, dTmax=0.1, warn=1, *args, **kwargs)

source code 

Iterate the temperature profile until convergence criterion is reached.

Extra arguments are passed on to the spline1d interpolation of the total cooling and heating terms through the calcT() call.

Parameters:
  • conv (float) - The maximum relative allowed change in T for convergence.

    (default: 0.01)

  • imax (int) - Maximum number of allowed iterations. Code stops when this number is reached, but not before dTmax = 1.

    (default: 50)

  • step_size (float) - The minimum step size in maximum allowed relative temperature change. The code decides dynamically based on how close the iteration is to convergence which multiple of this step size the next iteration allows. If T change percentage grows to fast, decrease this number. Default is 0, in which case the maximum allowed T change is kept constant at dTmax.

    (default: 0)

  • dTmax (float) - The starting value for the maximum allowed relative temperature change between iterations. This maximum increases as the code reaches convergences, through a set multiple of step_size. If step_size is 0, dTmax stays constant

    (default: 0.10)

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

calcT(self, dTmax=1, warn=1, ode_kwargs={}, *args, **kwargs)

source code 

Calculate the temperature profile based on the differential equation given by Goldreich & Scoville (1976). The function is defined in dTdr.

The initial temperature is taken to be the second argument of the initial temperature profile given by T in inputEnergyBalance.dat. This is typically the condensation temperature.

Additionals arguments are passed on to the spline1d interpolation of the total cooling and heating terms, e.g. k=3, ext=0 are defaults.

Parameters:
  • dTmax (float) - The maximum allowed relative temperature change for this T calculation. Set to 100% by default.

    (default: 1)

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

  • ode_kwargs (dict) - Extra arguments for the ODE solver. They are added to the dict ode_args made by the function, and hence overwrites any defaults. In principle, the defaults are fine, but can be overwritten if needed

    (default: {})

Cad(self)

source code 

Calculate the adiabatic cooling rate. This is not used by the solver of the dTdr differential equation, and is only for plotting purposes.

Uses the latest calculation of the T-profile.

Equation derived from Decin et al. 2006 and Danilovich 2016.

Hdg(self)

source code 

Calculate the heating rate by dust-gas collisions.

Note that this term evaluates to zero for the inner wind at r<r0, if the dust density is 0 there. This can be enforced by choosing an mdot_step function.

Sputtering is applied if a grain size distribution is used. For a constant grain size, this is not done, since it's not realistic to remove all dust if the drift becomes too large.

The equation is derived from Goldreich & Scoville 1976, based on Schoier et al 2001, and Decin et al. 2006:

General case: Hdg = n_d sigma_d w x 1/2 rho_g w^2 => Hdg = pi/2 n_H2 m_H (fH+2) (1+4fHe) (1-P)^(2/3) Int(n_d w^3 a^2 da)

MCP/ALI case (average grain size a): Hdg = pi n_H2 m_H n_d w^3 a^2

GASTRoNOoM case (MRN): Hdg = pi/2 A n_H2^2 m_H (fH+2)^2 (1+4fHe) Int(w^3 a^-1.5 da)

Hdt(self)

source code 

Calculate the heating rate by dust-gas heat exchange.

The equation is derived from Burke & Hollenbach 1983, based on Groenewegen 1994, Schoier et al. 2001, and Decin et al. 2006:

Note that this term evaluates to zero for the inner wind at r<r0, if the dust density is 0 there. This can be enforced by choosing an mdot_step function.

Sputtering is applied if a grain size distribution is used. For a constant grain size, this is not done, since it's not realistic to remove all dust if the drift becomes too large.

The older implementations used by MCP/ALI and GASTRoNOoM follow Burke & Hollenbach 1983 and Groenwegen 1994. The general-case implementation follows the more recent work of Gail & Sedlmayr, adding in proper vT and drift terms. The GS2014 is not yet fully implemented, but the Hdt term is already available here.

General case (following Gail & Sedlmayr 2014, see Eq 15.19): Hdt = alpha pi k_b n_h2 (fH+2.)(1.-P)^(-2./3.) Int(n_d a^2 da) (T_d - T) sqrt(8*vT^2+drift^2) (1/(gamma-1))

MCP/ALI case (n_d: dust number density, average grain size a): Hdt = 2 alpha pi k_b n_h2 (n_d a^2) (T_d - T) vT

GASTRoNOoM case (n_d: distribution following MRN): Hdt = 2 alpha pi k_b n_h2 (fH+2.) Int(n_d a^2 da) (T_d - T) vT

In all cases, alpha is the accommodation coefficient (from Groenewegen 1994): alpha = 0.35 exp(-sqrt(0.002*(T_d + T)))+0.1

and vT is the thermal velocity: vT = sqrt(8 k_b t/(mu pi m_H))

Hpe(self)

source code 

Calculate the heating rate by the photoelectric effect.

Two methods are available at present: 1) Following Draine 1978 and Huggins et al. 1988, as used by MCP (see also Crosas & Menten 1997) 2) Following Bakes & Tielens 1994., as implemented by Decin et al. 2006 in GASTRoNOoM.

No options to tweak these methods has been implemented yet, but a lot of consistency checks should be done, and some of the assumptions can be improved on with a consistent calculation (e.g. Av in method 2).

Photoelectric heating as derived by Bakes & Tielens is maybe a good basis for further development of the heating term, but see also Woitke 2015 (2015EPJWC.10200011W) for recent developments.

The derivation in method 2 makes a lot of assumptions and are applied specifically to the case of GASTRoNOoM (e.g. fixed grain size distribution). Hence, the implementation is considered appropriate for the default settings in the inputEnergyBalance_gastronoom.dat file. Any deviations from that must be treated carefully.

No sputtering is applied. Small grains are the most relevant for Hpe, and any sputtering would reduce the size of existing dust grains, thus increasing the amount of small grains. Since we cannot have Hpe directly depend on the grain size distribution (and instead work with a scaling factor amin_scale), we do not apply sputtering to the photoelectric heating.

Hcr(self)

source code 

Calculate the heating rate by cosmic rays.

The rate is taken from Goldsmith & Langer 1978, and is also used by Groenwegen 1994 and Decin et al 2006. This is a very approximate formula and will need updating in the future.

Two modes are available: The standard one, using n(H2), and the one used by Groenewegen 1994 and Decin et al. 2006 (where all gas mass is placed into H2, even if fH or fHe are non-zero). Controlled through the keyword cr_method == 'groenewegen' or cr_method == 'standard' in the inputfile.

Ch2(self)

source code 

Calculate the line cooling rate by vibrational excitation of H_2.

Two modes are available (used by MCP/ALI and GASTRoNOoM, respectively): 1) Following Groenewegen 1994, based on Hartquist et al 1980. Based on fitting of tabulated data of H2 cooling under LTE conditions 2) Following Decin et al 2006, based on GS1976, Hollenbach & McKee 1979 and Hollenbach & McKee 1989.

The keyword h2_method (groenewegen, or decin) determines which of the two is used.

Clc(self, m, update_pop=1)

source code 

Calculate the radiative line cooling rate for a molecule.

For GS2014, no correction term yet for the excitation temperature per level.

Follows Sahai 1990.

Cubic spline interpolation for the level populations. Linear interpolation and extrapolation for the collision rates (as for GASTRoNOoM).

Currently not yet implemented to use a sqrt(T/T0) extrapolation at lower boundary as is done by MCP/ALI.

Note that EnergyBalance will internally call this function with the molecule tag tacked onto the Clc function name.

Parameters:
  • m (str) - The molecule name from the input molecules list.
  • update_pop (bool) - Check if the level populations have been updated

    (default: 1)

plotRateIterations(self, iterations=[], dTsign='C', mechanism='ad', scale=1, fn=None, cfg=None, **kwargs)

source code 

Plot the heating or cooling rates for several iterations of a given mechanism and heat exchange sign (cooling or heating).

Parameters:
  • iterations (list) - The iteration indices to be plotted. If default, all iterations are plotted

    (default: [])

  • dTsign (str) - The dT type: heating (H) or cooling (C).

    (default: 'C')

  • mechanism (type) - The cooling/heating mechanism to be plotted.

    (default: 'ad')

  • scale (bool) - Scale the heating and cooling rates with r^4/1e14cm.

    (default: 1)

  • fn (str) - The filename and path of the plot (without extension). If default, a filename can be given in a cfg file, and if that is not the case, the plot is simply shown but not saved.

    (default: None)

  • cfg (str) - The filename to the cfg file for this plot with extra settings.

    (default: None)

  • kwargs (dict) - Additional keywords passed to the plotting method. Overwrites any keys given in the cfg file.

    (default: {})

plotRates(self, scale=1, fn=None, iteration=None, cfg=None, join=0, **kwargs)

source code 

Plot the heating and cooling rates for a single iteration.

Parameters:
  • scale (bool) - Scale the heating and cooling rates with r^4/1e14cm.

    (default: 1)

  • fn (str) - The filename and path of the plot (without extension). If default, a filename can be given in a cfg file, and if that is not the case, the plot is simply shown but not saved.

    (default: None)

  • iteration (int) - The iteration for which to plot the rates. Default is the last iteration.

    (default: None)

  • cfg (str) - The filename to the cfg file for this plot with extra settings.

    (default: None)

  • join (bool) - Join together the plot for heating and cooling terms.

    (default: 0)

  • kwargs (dict) - Additional keywords passed to the plotting method. Overwrites any keys given in the cfg file.

    (default: {})

plotT(self, fn=None, iterations=[], cfg=None, **kwargs)

source code 

Plot the temperature profiles of the different iterations.

Parameters:
  • fn (str) - The filename and path of the plot (without extension). If default, a filename can be given in a cfg file, and if that is not the case, the plot is simply shown but not saved.

    (default: None)

  • iterations (list) - The iteration indices to be plotted. If default, all iterations are plotted. The first and last iterations are always plotted.

    (default: [])

  • cfg (str) - The filename to the cfg file for this plot with extra settings.

    (default: None)

  • kwargs (dict) - Additional keywords passed to the plotting method. Overwrites any keys given in the cfg file.

    (default: {})

plotHCTerm(self, fn=None, iterations=[], dTsign='C', cfg=None, **kwargs)

source code 

Plot the total heating and cooling term (excluding adiabatic cooling) calculated by calcT before the differential equation is solved.

This includes the density factor that enters, and so is essentially (H - C)/rho. The velocity does not enter here, since that is calculated explicitly in dTdr. Hence the y-axis units K/s.

Parameters:
  • fn (str) - The filename and path of the plot (without extension). If default, a filename can be given in a cfg file, and if that is not the case, the plot is simply shown but not saved.

    (default: None)

  • iterations (list) - The iteration indices to be plotted. If default, all iterations are plotted. The first and last iteration is always plotted.

    (default: [])

  • dTsign (str) - The dT type: heating (H) or cooling (C). Either the positive (C) or the negative (H) sum is plotted.

    (default: 'C')

  • cfg (str) - The filename to the cfg file for this plot with extra settings.

    (default: None)

  • kwargs (dict) - Additional keywords passed to the plotting method. Overwrites any keys given in the cfg file.

    (default: {})

plotTexc(self, m, indices=None, llow=None, lup=None, fn=None, cfg=None, **kwargs)

source code 

Plot the excitation temperature as a function of impact parameter for a selection of radiative transitions, given by either the transition indices or the upper and/or lower level indices.

Retrieves the excitation temperature from self.Texc. They are appropriate for the level populations used by the current iteration, and are updated when the level populations are updated.

At this time, plotting Texc for other iterations is not possible.

Parameters:
  • m (str) - The molecule tag
  • indices (list/array) - The transition indices. Can be indirectly given through upper and/or lower level indices. If default and no llow/lup are given, all Texc are returned for this molecule.

    (default: None)

  • lup (list/array) - The upper level indices used to extract the transition indices. If this or llow are defined, the keyword indices is overwritten.

    (default: None)

  • llow (list/array) - The upper level indices used to extract the transition indices. If this or lup are defined, the keyword indices is overwritten.

    (default: None)

  • fn (str) - The filename and path of the plot (without extension). If default, a filename can be given in a cfg file, and if that is not the case, the plot is simply shown but not saved.

    (default: None)

  • cfg (str) - The filename to the cfg file for this plot with extra settings.

    (default: None)

  • kwargs (dict) - Additional keywords passed to the plotting method. Overwrites any keys given in the cfg file.

    (default: {})