The Environment Class#

The Environment class forms the basis of the simulation setup in particula; it is in particula/environment.py. In summary, we use it to describe the environment in which particles and condensing vapors exist and interact. For now, we define an environment by properties (via attributes) such as temperature and pressure with derived properties (via methods) such as the dynamic viscosity and mean free path of the medium gas.

The Environment class can be imported from particula.environment,

from particula.environment import Environment

and then it can be initiated with (some of) the following attributes.

Environment attributes#

attribute

unit

default value

coagulation_approx...

"hardsphere"

dilution_rate_cons...

1 / s

0

temperature

K

298.15

pressure

Pa

101325

dynamic_viscosity

Pa s

util.dynamic_viscosity

molecular_weight

kg / mol

constants.MOLECULAR_WEIGHT_AIR

reference_viscosity

Pa s

constants.REF_VISCOSITY_AIR_STP

reference_temperature

K

constants.REF_TEMPERATURE_STP

sutherland_constant

K

constants.SUTHERLAND_CONSTANT

gas_constant

J / mol / K

constants.GAS_CONSTANT

For example, Environment(temperature=300) initiates the class with a temperature of 300 K and the above defaults. Note that, particula will assign K if the input is scalar like temperature=300. However, it will raise an error if the input has the wrong units. All attributes can be accessed by .<attr> after Environment like below, where <attr> is one of the above.

Note that we also pass global attributes to the Environment class, for example, the type of coagulation approximation and the dilution rate constant, which will be documented later.

from particula import u
from particula.environment import Environment

EnvOne = Environment(temperature=300) 
print("temperature is ", EnvOne.temperature) # will print 300 K
print("pressure is ", EnvOne.pressure) # will print 101325 Pa (kg/m/s^2)
temperature is  300 kelvin
pressure is  101325 kilogram / meter / second ** 2
from particula import u
from particula.environment import Environment

EnvTwo = Environment(temperature=300*u.K) 
print("temperature is ", EnvTwo.temperature) # will print 300 K as well
temperature is  300 kelvin
from particula import u
from particula.environment import Environment

EnvThree = Environment()
print("temperature is ", EnvThree.temperature) # will print 298.15 K (the default value)
temperature is  298.15 kelvin
from particula import u
from particula.environment import Environment

# EnvWrong = Environment(temperature=300*u.m) # will raise an error

In the table above, a variety of attributes have default values from particula.constants, like the gas constant and Sutherland constant. This is to allow the user flexibility, but, if not provided, they all fall on default values from the literature as discussed below.

Finally, one attribute has a default value from particula.util. As explained below, we calculate the dynamic viscosity via the Sutherland formula using the temperature (as well as the reference values of temperature, viscosity, and Sutherland constant). The user can override this calculating by offering a different dynamic viscosity with the attribute dynamic_viscosity.

Environment methods#

As discussed above, the Environment class enables us to calculate the dynamic viscosity as well as the mean free path.

Environment.dynamic_viscosity()#

from particula.environment import Environment
Environment().dynamic_viscosity() # will produce approx 1.84e-5 kg/m/s
1.8371493734583912×10-5 kilogram/(meter second)

Environment.mean_free_path()#

from particula.environment import Environment
print("mean free path is ", Environment().mean_free_path()) # will produce approx 66.5 nm
mean free path is  6.647984929145103e-08 meter

Notes#

  • While technically allowed, we discourage the users from using vectored temperature and pressure quantities for now. We design particula with the intention of having each point in time (calculation) having a unique set of conditions.

  • Attributes are called without parentheses, e.g. Environment().temperature.

  • Methods are called with parentheses, e.g. Environment().mean_free_path().