armi.utils.units module

The units module contains unit conversion functions and constants.

armi.utils.units.getTk(Tc=None, Tk=None)[source]

Return a temperature in Kelvin, given a temperature in Celsius or Kelvin.

Returns

T – temperature in Kelvin

Return type

float

Raises

TypeError – The temperature was not provided as an int or float.

armi.utils.units.getTc(Tc=None, Tk=None)[source]

Return a temperature in Celsius, given a temperature in Celsius or Kelvin.

Returns

T – temperature in Celsius

Return type

float

Raises

TypeError – The temperature was not provided as an int or float.

armi.utils.units.getTf(Tc=None, Tk=None)[source]

Return a temperature in Fahrenheit, given a temperature in Celsius or Kelvin.

Returns

T – temperature in Fahrenheit

Return type

float

Raises

TypeError – The temperature was not provided as an int or float.

armi.utils.units.getTemperature(Tc=None, Tk=None, tempUnits=None)[source]

Returns the temperature in the prescribed temperature units.

Parameters
  • Tc (float) – temperature in Celsius

  • Tk (float) – temperature in Kelvin

  • tempUnits (str) – a flag for the temperature units of the correlation ‘Tk’, ‘K’, ‘Kelvin’, ‘Tc’, ‘C’, or ‘Celsius’ are acceptable.

Returns

T – temperature in units defined by the tempUnits flag

Return type

float

Raises

ValueError – When an invalid tempUnits input is provided.

armi.utils.units.getTmev(Tc=None, Tk=None)[source]
armi.utils.units.convertMmhgToPascal(mmhg)[source]

Converts pressure from mmhg to pascal.

Parameters

mmhg (float) – pressure in mmhg

Returns

pascal – pressure in pascal

Return type

float

armi.utils.units.convertBarToPascal(pBar)[source]

Converts pressure from bar to pascal.

Parameters

pBar (float) – pressure in bar

Returns

pascal – pressure in pascal

Return type

float

armi.utils.units.convertAtmToPascal(pAtm)[source]

Converts pressure from atomspheres to pascal.

Parameters

pAtm (float) – pressure in atomspheres

Returns

pascal – pressure in pascal

Return type

float

armi.utils.units.sanitizeAngle(theta)[source]

Returns an angle between 0 and 2pi.

Parameters

theta (float) – an angle

Returns

theta – an angle between 0 and 2*pi

Return type

float

armi.utils.units.getXYLineParameters(theta, x=0, y=0)[source]

returns parameters A B C D for a plane in the XY direction.

Parameters
  • theta (float) – angle above x-axis in radians

  • x (float) – x coordinate

  • y (float) – y coordinate

Returns

  • A (float) – line coefficient

  • B (float) – line coefficient

  • C (float) – line coefficient

  • D (float) – line coefficient

Notes

the line is in the form of A*x + B*y + C*z - D = 0 – this corresponds to a MCNP arbitrary line equation