# Scalar and Thermal Fields¶

## Scalar Fields¶

### Basic Concepts¶

Scalar fields represent a continuous scalar value defined at all points across the fluid domain (e.g. species concentration). Scalar fields are defined by a name, diffusion coefficient, and reaction rate. Scalars enter the domain via (i) an initial background concentration, (ii) an injection box, (iii) a non-zero concentration at an inlet, or (iv) a reaction rate that drives scalar production. Scalars can be removed from a system by specifying (i) an outlet, or (ii) a reaction rate that drives scalar consumption.

The scalar field is advanced using a high-resolution van Leer scheme. This approach links the time-varying fluid flow to the advection term in the advection-diffusion equation. Chemical reactions are advanced at each time-step using a fourth order Runge-Kutta solver.

Scalar field output files are created for each species, and record the time-evolution of the mean species concentration, the standard deviation of the species concentration across the tank volume, and the species exposure. The concentrations of each species at each inlet and outlet are recorded in the inletOutletData files.

Scalar fields are characterized by a parent-child relationship. Within this relationship, the parent defines the properties of the scalar field. The children define the shape/geometry/topology of these boundary conditions.

### Parent Properties¶

- Name
Variable name used in reaction expressions. Name has the following restrictions:

Some names are reserved for other quantities:

*s*,*t*, and*T*are reserved for strain, time, and temperature.First character must be a letter

Must not contain spaces or special characters

Must only contain letters, numbers, and under score

- Background Spec Type
Indicates how the initial background concentration is defined.

Molarity: Define the initial condition as a molarity

Number Of Moles: Define the initial condition as a total number of moles

- Background Initial Concentration
Initial background concentration [mol/L] This is the uniform background concentration of the species at the start of the simulation.

- Background Initial Moles
Initial background concentration in units [mol]

- Diffusion Coefficient
Diffusion coefficient [m^2/s]

Diffusion coefficient of the scalar through the base fluid.

- Reaction Implementation Type
NONE: Reactions are either disabled or defined by a separate Reaction component

Custom Expression: Reaction is defined by the

`Reaction Chemistry`

. (CPU Only)Plugin: Reaction is defined by a custom C++ plugin loaded at run-time. (CPU Only)

- Reaction Chemistry (CPU Only)
Reaction kinetics function for species [mol/s].

Can be specified with either an expression as described below or using the C++ plugin functionality described in User Plugins.

Function of other scalar field variables defined in the system and temperature

*T*. For example, if a system contains four species named*S*,*C*,*I*, and*P*with reaction rates given by:\[\begin{split}\frac{dS}{dt}=10[I] - 500[S][C] \\ \frac{dC}{dt}=110[I] - 500[S][C] \\ \frac{dI}{dt}=500[S][C] - 110[I] \\ \frac{dP}{dt}=100[I],\end{split}\]the reaction chemistry for

*S*,*C*,*I*, and*P*would then be written as the following in each of the Scalar Field variables “Reaction Chemistry” input10*I - 500*S*C 110*I - 500*S*C 500*S*C - 110*I 100*I

Should a temperature field be defined, reaction rates can also include temperature, such as:

10*exp(0.001*T)*I - 500*exp(0.002*T)*S*C

- Injection Geometry
Inject In Volume: the scalar boundary condition is imposed on all points contained inside the geometry.

Inject At Surface: the scalar boundary condition is imposed on the surface of the child geometry.

These conditions are identical for children geometries that are thin relative to the lattice spacing.

- Scalar Injection Amount Spec Type
Molarity: Input from

`Initial Concentration Expr`

is used with units molarityNumber Of Moles: Input from

`Initial Moles Expr`

is used with units molesMolar Rate: Input from

`Initial Moles Rate Expr`

is used with units moles/s

- Initial Concentration Expr
Injection into the geometry is defined as an expression that may be a function of time ‘t’.

[molarity]

- Initial Moles Expr
Injection into the geometry is defined as an expression that may be a function of time ‘t’

[moles]

- Initial Moles Rate Expr
Injection into the geometry is defined as an expression that may be a function of time ‘t’

[moles/s]

- Start Time
Injection start time [s].

Time at which to begin adding scalar into child geometry

- Stop Time
Scalar box stop time [s].

Time at which to stop adding scalar into the defined box. Between the Start and Stop times, the scalar field inside the box will be maintained at the user-defined concentration. To mimic the effects of an instantaneous scalar dump, set the Start Time equal to the Stop Time.

- Stencil
Stencil used to define advection [Lattice, Finite Volume] The finite volume stencil considers fluxes in the +/- x,y, and z-directions. The lattice stencil

- Limiter
Flux limiter used to contain convection [VanLeer, Minmod, MUSCL, Superbee, DonorCell, LaxWendroff, DonorCell]

The Donor Cell is an upwind difference technique valid for systems with a Peclet number greater than 2 (a condition typically satisfied in turbulent systems). The other schemes are total variation diminishing, and necessary in laminar systems.

- Visible
Enable/disable the visibility of this component

**Boundary Conditions**

For each boundary condition present in the simulation, the following inputs are available

- BC Type
Specified Value: Enables use of

`Value`

InputZero Gradient

- Value
Specified value of scalar field at boundary condition

## Thermal Field¶

### Basic Concepts¶

Thermal fields, which are an extension of the scalar field, are used to describe the time-evolution of a temperature field across the flow domain. When evoking the thermal field, users specify the initial temperature of the fluid, the thermal diffusivity, the specific heat and, if desired, the fluid expansion coefficient and viscosity activation energy. The thermal diffusivity and specific heat influence the rate of thermal transport through the fluid, and temperature increase associated with thermal viscous dissipation. The fluid expansion coefficient, which informs natural convection, describes the link between temperature and density. The viscosity activation energy links the local viscosity to the local temperature field.

Tank walls can be either insulating or assume a constant surface temperature. Likewise, tank internals can be either insulating or assume a constant surface temperature. The temperature at each inlet can likewise be specified independently. The time-evolution of the fluid temperature is recorded in the output file thermodynamics.dat.

For tank internals defined with a constant surface temperature, the time-evolution of the surface heat flux into the fluid is printed to the internalsN.dat file. From this heat flux data, users can predict convective heat transfer coefficients using a representative temperature difference and the surface area. The average temperature across each inlet and outlet is recorded in the inletOutletDataN.dat files. With the temperature field activated, the solver automatically accounts for the effects of viscous dissipation on temperature rise, thereby satisfying the first law of thermodynamics.

### Properties¶

- Minimum Temperature
Minimum allowable temperature in the system [K]

- Maximum Temperature
Maximum allowable temperature in the system [K]

- Global Heating
Adds a global volumetric heating rate to the thermal field. [W/m^3]. May be an expression as function of time ‘t’

- Dissipation Heating
Enable or disable heating from EDR

- Limiter
Flux limiter for convective term

- Advection Algorithm Option
Lattice: Use LBM algorithm to solve thermal field

Finite Volume: Use conventional finite volume method to propogate thermal field

- Initial Temperature
Fluid Initial Temperature (K)

- Input Option
Change thermal properties

Constant: Use this whenever possible. Thermal properties are all constant

CPU MuParser: Thermal properties may be function of temperature ‘T’. Enables MuParser expression inputs for each property.

GPU CUDA Code: Thermal properties may be function of temperature ‘T’. Enables CUDA code inputs for each property.

- Specific Heat
Specific heat of the base fluid (J/kg-K)

- Conductivity
Thermal conductivity (W/(m*K))

- Expansion Coefficient
Fluid Thermal Expansion (1/K)

- Boundary Conditions
This section lists out all available boundary conditions that can be configured with the thermal field Each boundary may be configured with a boundary condition type

Constant Temperature: Holds temperature of surface constant at specified temperature [K]

Adiabatic: Enforces a zero gradient boundary condition on the surface

Heat Flux: Specify the heat flux at a boundary condition with a constant, CPU, or GPU code.