# Fluid Configuration¶

## Conceptual Overview¶

Fluids are gases and liquids that flow when subject to an applied shear stress. For single-phase fluids, momentum transport is governed by the fluid density and viscosity. For multi-phase systems, the surface tension must also be defined to describe dynamics at the interface between two phases.

M-Star CFD can handle both Newtonian and non-Newtonian fluid rheology. The available fluid models, along with the relevant simulation parameters, are described in the sections that follow.

Laminar and transitional flows are typically modeled via direct numerical simulation. Turbulent fluid flows in M-Star CFD are modeled using implicit large eddy simulations (ILES) or large eddy simulation (LES). Additional theoretical details related to the LES model are provided in the Theory and Implementation section of this manual.

Users must select a fluid configuration. Five configurations are available:

Single phase

Free surface

Two-fluid miscible

Two-fluid immiscible

None

In the sections that follow, each of these configurations are discussed in detail.

## Single Phase¶

Single phase models, as the name suggests, are simulations involving a single base fluid with Newtonian or non-Newtonian rheology. Common applications include pipe flow simulations, well-baffled agitated tanks, jet mixing systems, and pumps. Within this configuration, users must specify the fluid density and define the constitutive relationship between fluid stress and fluid strain. As discussed in particleFields, additional phases (such as discrete bubbles and discrete solid particle) can be added to the system and one- or two-way coupled to the fluid. Thermal fields and scalar fields can also be superimposed on the single phase fluid, as discussed in Basic Concepts and Scalar Fields.

Within the single phase model, users can chose from one of five constitutive relationships:

Newtonian

Power law (with or without a yield stress)

Carreau

Custom expression

C++ Plug-in

Briefly speaking, relationships (1)-(3) are familiar Newtonian and non-Newtonian rheology models. Relationships (4) and (5) represent custom expressions that may be more complex functions of strain, age, species concentration, and temperature. Currently, users can define the relationship in terms of the following reserved variables:

s: the norm of strain rate tensor (no sqrt(2) factor), seconds^-1

ss: shear stress (defined as strain rate x kinematic viscosity x density, again not multiplied by sqrt(2)), Pascal

t: the current simulation time, seconds

T: the instantaneous local temperature, Kelvin

age: the instantaneous local mean-age, seconds [Only available if mean-age calculation is active]

scalarName: the instantaneous local concentration of any named scalar field the system, molarity. [Only available if scalar fields are active].

Additional details for each of these relationships are provided in _fluidModels

In single phase models, the entire interior zone of the lattice domain is assumed to be filled with the fluid.

## Free Surface¶

Free surface models are simulations involving a moving free surface with a single Newtonian or non-Newtonian rheology. Common applications include filling/draining simulations, jet sprays, sloshing, vortex formation, and coating processes. Within this configuration, users must specify the fluid density, surface tension and define the constitutive relationship between fluid stress and fluid strain. As discussed in particleFields, additional phases (such as discrete bubbles and discrete solid particle) can be added to the system and one- or two-way coupled to the fluid. Thermal fields and scalar fields can also be superimposed on the single phase fluid, as discussed in Basic Concepts and Scalar Fields.

Within free surface model, users can chose from one of five constitutive relationships:

Newtonian

Power law (with or without a yield stress)

Carreau

Custom expression

C++ Plug-in

Briefly speaking, relationships (i)-(iii) are familiar Newtonian and non-Newtonian rheology models. Relationships (iv) and (v) represent custom expressions that may be more complex functions of strain, age, species concentration, and temperature. Currently, users can define the relationship in terms of the following reserved variables:

s: the norm of strain rate tensor (no sqrt(2) factor), seconds^-1

ss: shear stress (defined as strain rate x kinematic viscosity x density, again not multiplied by sqrt(2)), Pascal

t: the current simulation time, seconds

T: the instantaneous local temperature, Kelvin

age: the instantaneous local mean-age, seconds [Only available if mean-age calculation is active]

scalarName: the instantaneous local concentration of any named scalar field the system, molarity. [Only available if scalar fields are active].

Additional details for each of these relationships are provided in _fluidModels

Unlike the single phase fluid, which is assumed to fill the entire interior zone of the lattice, users must specify which portions of the interior zone (if any) are initially filled with the fluid. Any initial fluid configuration can be specified using any combination of parametric geometry and/or user-imported geometry. By default, the initial condition is a parametric “Fluid Height Box”. This cuboid geometry is anchored to the main lattice domain, but the height of the box aligned with the “UP-direction” can be adjusted.

## Two Fluid: Miscible¶

Two fluid miscible simulations involve two miscible fluids with user defined rheology. Common applications include fluid dilution, miscible fluid blending, and simulations of cleaning/washing. As discussed in particleFields, additional phases (such as discrete bubbles and discrete solid particle) can be added to the system and one- or two-way coupled to the fluid. Thermal fields and scalar fields can also be superimposed on the single phase fluid, as discussed in Basic Concepts and Scalar Fields.

Within this configuration, users must specify the density of each fluid and a constitutive relationship between fluid stress and fluid strain. This constitutive relationship will typically be a function of the relative concentrations of each fluid. This relationship may also be a function of other fluid variables, including strain, energy dissipation rate, species concentration, time, temperature, age, etc. At each simulation time step, the solver uses this user-provided constitutive relationship to calculate the local viscosity at each point within the lattice domain. Users can enter this expression directly into the graphical interface, or write a C++ plug-in to be executed at runtime.

We now present multiple examples for defining constitutive relationship expression directly into the graphical interface. Consider two miscible Newtonian fluids, f1 and f2, with a kinematic viscosity of 1e-6 m^2/s and 1e-4 m^2/s, respectively. Assume the mixture viscosity is calculated using a weighted average concentration. The appropriate constitutive relationship to specify would be:

```
f1/(f1+f2)*1e-6+f2/(f1+f2)*1e-4
```

In regions of the lattice where f1 (the instantaneous, relative concentration of fluid 1) is 1 and f2 (the instantaneous, relative concentration of fluid 2) is zero, the local fluid viscosity will be 1e-6 m^2/s. In regions of the lattice where f1 is zero, f2 is 1, the local fluid viscosity will be 1e-4 m^2/s. In regions of the lattice where f1 is 0.5, f2 is 0.5, the local fluid viscosity will be 5e-5 m^2/s.

Next, consider two miscible power law fluids, f1 and f2, with a kinematic viscosity of 1e-3*s^0.9 m^2/s and 1e-4*s^0.8 m^2/s, respectively. Note that the rheology of each fluid is a function of strain, s, and assume the mixture viscosity is calculated using a weighted average concentration.

The appropriate constitutive relationship to specify would be:

```
f1/(f1+f2)*(1e-3*s^0.9)+f2/(f1+f2)*(1e-4*s^0.8)
```

In regions of the lattice where f1 (the instantaneous, relative concentration of fluid 1) is 1, f2 (the instantaneous, relative concentration of fluid 2) is zero, and s (the instantaneous, local strain) is 0.5 1/s, the local fluid viscosity will be 5.35e-4 m^2/s. In regions of the lattice where f1 is zero, f2 is 1, and s is 0.5 1/s, the local fluid viscosity will be 3.74e-5 m^2/s. In regions of the lattice where f1 is 0.5, f2 is 0.5, and s is 0.5 1/s, the local fluid viscosity will be 2.97e-4 m^2/s.

To reemphasize, the local viscosity at each point in the lattice domain is calculated at each time step according to the user-defined constitutive relationship. The functional form of these constitutive relationships can be arbitrarily complex or arbitrary simple. In fact, for two miscible fluids with an identical viscosities (4e-5 m^2/s, for example), the appropriate constitutive relationship to specify would simply be:

```
4e-5
```

In regions of the lattice where f1 (the instantaneous, relative concentration of fluid 1) is 1 and f2 (the instantaneous, relative concentration of fluid 2) is zero, the local fluid viscosity will be 4e-5 m^2/s. In regions of the lattice where f1 is zero, f2 is 1, the local fluid viscosity will be 4e-5 m^2/s. In regions of the lattice where f1 is 0.5, f2 is 0.5, the local fluid viscosity will be 4e-5 m^2/s.

This single valued approach is useful for stratified fluids with very similar viscosities, but different densities.

As demonstrated above, the user-defined constitutive relationship expressions can be a function of various fluid variables. Currently, users can define the relationship in terms of the following reserved variables:

f1: the instantaneous relative concentration of fluid 1

f2: the instantaneous relative concentration of fluid 2

s: the norm of strain rate tensor (no sqrt(2) factor), seconds^-1

ss: shear stress (defined as strain rate x kinematic viscosity x density, again not multiplied by sqrt(2)), Pascal

t: the current simulation time, seconds

T: the instantaneous local temperature, Kelvin

age: the instantaneous local mean-age, seconds [Only available if mean-age calculation is active]

scalarName: the instantaneous local concentration of any named scalar field the system, molarity. [Only available if scalar fields are active].

Note that, if other fluid properties are required to describe viscosity or the constitutive relationship is too complex to recast as an equation, users can write a C++ plug-in to support complex functions with intermediate variables. More information about writing C++ plug-ins is presented in User Plugins.

Important

The quality of the simulation prediction will be directly correlated to the quality of the user-specified constitutive relationship

The examples above are illustrative; most miscible fluid mixtures do not follow a weighted average concentration

Within the context of the solver, constitutive relationship expressions and constitutive relationship plug-ins are mutually exclusive. If the user specifies “Plug-in” as the Rheology Specification, the equation field will disappear.

The local fluid density, which is also calculated at each point within the lattice domain at each time step, is found from arithmetic average density:

```
rho=f1/(f1+f2)*rho1+f2/(f1+f2)*rho2
```

If more complex relationship are needed, users and write a C++ plug-in to support arbitrary density mixing rules.

Unlike the single phase fluid, which is assumed to fill the entire interior zone of the lattice, users must specify which portions of the interior zone are initially filled with each fluid. The “Background Fluid” describes the primary fluid in the tank. This background is typically defined as fluid1, but can be redefined by the user. The initial distribution of the secondary fluid (which is typically fluid2) can be specified using any combination of parametric geometry and/or user-imported geometry. By default, the secondary fluid condition is a parametric “Fluid Height Box”. This cuboid geometry is anchored to the main lattice domain, but the height of the box aligned with the “UP-direction” can be adjusted.

## Two Fluid: Immiscible¶

Immiscible fluid models, as the name suggests, are simulations involving a two immiscible fluids with Newtonian or non-Newtonian rheology. Common applications include two-phase gas flow simulations, colloid suspensions, and oil-water systems, Users must specify, for each fluid, the density and the constitutive relationship between fluid stress and fluid strain. Users must also specify a surface tension between the two fluids. As discussed in particleFields, additional phases (such as discrete bubbles and discrete solid particle) can be added to the system and one- or two-way coupled to the fluid. Thermal fields and scalar fields can also be superimposed on the single phase fluid, as discussed in Basic Concepts and Scalar Fields.

Newtonian

Power law (with or without a yield stress)

Carreau

Custom expression

C++ Plug-in

Briefly speaking, relationships (1)-(3) are familiar Newtonian and non-Newtonian rheology models. Relationships (4) and (5) represent custom expressions that may be more complex functions of strain, age, species concentration, and temperature. Currently, users can define the relationship in terms of the following reserved variables:

s: the norm of strain rate tensor (no sqrt(2) factor), seconds^-1

t: the current simulation time, seconds

T: the instantaneous local temperature, Kelvin

age: the instantaneous local mean-age, seconds [Only available if mean-age calculation is active]

The two immiscible fluids do not need to have the same constitutive relationships.

Unlike the single phase fluid, which is assumed to fill the entire interior zone of the lattice, users must specify which portions of the interior zone are initially filled with each fluid. The “Background Fluid” describes the primary fluid in the tank. This background is typically defined as fluid1, but can be redefined by the user. The initial distribution of the secondary fluid (which is typically fluid2) can be specified using any combination of parametric geometry and/or user-imported geometry. By default, the secondary fluid condition is a parametric “Fluid Height Box”. This cuboid geometry is anchored to the main lattice domain, but the height of the box aligned with the “UP-direction” can be adjusted.

## No Fluid¶

In this set-up, which is typically paired with particle discrete element modeling (DEM), no fluid is modeled explicitly. Instead, the effects of any fluid on particle dynamics are modeled via a implicit damping functions.