# Fluids, Inlets, and Outlets¶

## Fluid Models¶

### Basic Concepts¶

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.

Turbulent fluid flows in M-Star CFD are typically filtered using large eddy simulation (LES). The effects of the filtering are controlled by the user-defined Smagorinsky Coefficient. Additional theoretical details related to the LES model are provided in the Theory and Implementation section of this manual.

### General Fluid Parameters¶

- Density
Density of fluid, [kg/m^3]

- Surface Tension, [N/m]
Surface tension of the fluid in air.

Only relevant for free surface or immiscible fluid simulations.

Turbulence Model, [Auto, DNS, ILES, LES]

DNS: Direct Numerical Simulation. DNS simulations attempt to capture all fluid motion across all eddy scales. DNS simulations will diverge if the eddy size approaches the lattice spacing. ILES: Implicit Large Eddy Simulations. These models use a larger (27-vector) lattice stencil and a cumulant-based momentum integrator to maintain stability at higher Reynolds numbers. LES: Large Eddy Simulations. These models compute a local eddy viscosity using the local shear rate to capture the effects of sub-grid turbulence. LES models tend to be stable at arbitrary Reynolds numbers. Auto: If maximum Reynolds number detected by the simulation is below 5000, the codes runs a DNS simulation. Above the Reynolds number, an LES model with static Smagorinsky coefficient of 0.10 is applied.

### Newtonian Fluid¶

A Newtonian fluid has a constant viscosity, such that the viscous stresses arising from flow are linearly proportional to the local strain rate.

- Kinematic Viscosity
Kinematic viscosity of fluid, [m^2/s]

- Max User Shear Rate
Max allowable shear rate, [1/s]

Shear rates above and below these will use a constant viscosity equal to that realized at these maximum and minimum rates

- Min User Shear Rate
Min allowable shear rate, [1/s]

Shear rates above and below these will use a constant viscosity equal to that realized at these maximum and minimum rates

- Viscosity At Max Shear
Viscosity that corresponds to the MaxUserShearRate, [m^2/s]

- Viscosity At Min Shear
Viscosity that corresponds to the MinUserShearRate, [m^2/s]

### Power Law Fluid¶

A power law fluid is generalized Newtonian fluid where the shear stress, \(\tau\), is related to the shear rate, \(\dot{\gamma}\) , such that:

where \(\rho\) is the fluid density, \(K\) is the flow consistency, and \(n\) is the fluid behavior index. The units on \(\rho\) are taken to be \(kg/m^3\) , the units on \(K\) are taken to be \(m^2/s^{2-n}\) and \(n\) is dimensionless.

From this constitutive relationship, the apparent viscosity \(\nu_a\) of a power-law fluid is then defined as:

where the units \(\nu_a\) are \(m^2/s\).

This definition of apparent viscosity is used to calculate the spatiotemporal variation in viscosity across the fluid volume due to spatiotemporal variations in strain rate.

- Power Law K
Flow consistency index, [\(m^2/s^{2-n}\)]

- Power Law N
Flow behavior index “n”, [-]

When a yield stress is added to a power law fluid, we have a Herschel-Bulkley fluid. The Herschel-Bulkley model describes the behavior of non-Newtonian yield stress fluids:

where \(\tau\) is the shear stress, \(\dot{\gamma}\) the shear rate, \(\tau_{0}\) the yield stress, \(n\) the consistency index, and \(k\) the flow index.

Like the power law expression, the effective viscosity is then defined as:

- Yield Stress
Yield shear stress, [N / m^2]

- Power Law K
Flow consistency index, [\(m^2/s^{2-n}\)]

- Power Law N
Flow behavior index “n”, [-]

Important

-Users should specify the fluid behavior index in anticipation that `1`

will be subtracted from the specified value when evaluating the
local viscosity.

### Carreau Fluid¶

A Carreau fluid is a generalized Newtonian fluid with an effetive viscosity, \(\mu_{\operatorname{eff}}\) , defined by:

- Carreau Vinf
Viscosity at infinite shear, [m^2/s]

- Carreau V0
Viscosity at zero shear, [m^2/s]

- Carreau Lambda
Relaxation time, [s]

- Carreau N
Power index, [-]

### Herschel-Bulkley Fluid¶

The Herschel-Bulkley model describes the behavior of non-Newtonian yield stress fluids:

where \(\tau\) is the shear stress, \(\dot{\gamma}\) the shear rate, \(\tau_{0}\) the yield stress, \(n\) the consistency index, and \(k\) the flow index.

The effective viscosity is then defined as:

- Yield Stress
Yield shear stress, [N / m^2]

- K
Flow consistency index, [m^2 / s]

- N
Flow behavior index ‘n’ [dimensionless]

### Custom Fluid¶

- Custom Expression
Analytic expression F(s) for the kinematic viscosity in units [m^2/s]. Can be a function of local shear rate ‘s’ with units [1/s], global time ‘t’ with units [s], local temperature ‘T’ with units [K], and the local concentration of any user-defined scalar field [mol].

Additional examples of entering formulas are presented in - User Defined Expression Syntax

## Inlet and Outlet Boundary Conditions¶

### Basic Concepts¶

Boundary conditions are openings in the outer geometry through which fluid, particles, species, and energy can enter or exit a system.

Boundary conditions may be defined in the following ways on the Inlet Setup Form:

On Bounding Box - Pick a point on the domain boundary

On Surfaces - Select existing surfaces

Constructed by Edges - Select edges to construct a new surface

**On Bounding Box**

On the outer domain boundary where a pipe or hole connects to the outer extents box

In this mode, users should design their models such that their geometry inlets and outlets are hollow and extend to the bounding box of their geometry. For example, a cylindrical tank must have hollow pipes defined in the CAD geometry going from the cylindrical tank wall to the outer flat bounding box wall. An example is shown in the image below.

Important

Users should allocate at least 10 lattice points to inlets and outlets.

A disagreement between the total mass flow into a system and total mass flow out of a system (e.g. a violation of mass conservation) are often due to excessively large Courant numbers.

**On Surfaces**

On surfaces inside the domain. For example if a pipe comes into the geometry, you may select the capped surface of that pipe to use as a boundary condition.

**Constructed by edges**

With this method, you may construct surfaces by selecting any number of connected edges. For example if a pipe comes into the geometry which does not have a solid cap, you may select the edges of the pipe to define the boundary condition geometry.

### Velocity¶

Used for inlets with specified velocities (Dirichlet velocity boundary, unconstrained pressure at inlet)

- Velocity Unit Vector
Inlet velocity vector. A muparser expression that may be a function of space and time. Variables x,y,z,t.

- Velocity Magnitude
Inlet velocity magnitude [m/s]. A muparser expression that may be a function of space and time. Variables x,y,z,t.

For exampleThese expressions follow conventional (ternary) conditional operator logic. For example, to step change the velocity from 0 m/s to to 2 m/s after 0.5 s of simulation, define:

t < 0.5 ? 0 : 2

Additional examples of specifying time-varying inlet velocities are presented in - User Defined Expression Syntax

The velocity at an inlet our outlet is defined relative to the global reference frame.

### Pressure¶

Used for inlets with specified pressures (Dirichlet pressure boundary, unconstrained velocity at inlet)

- Pressure
Inlet/Outlet pressure [Pa] . A muparser expression that may be a function of time. Variables: t.

These expressions follow conventional (ternary) conditional operator logic. For example, to step change the pressure from 100,000 Pa to to 110,000 Pa after 0.5 s of simulation, define:

t < 0.5?100000:110000

### Outflow¶

Used for to model outlets (Neumann pressure boundary, unconstrained velocity)

### Recirculation Inlet¶

Recirculates fluid, particles, and scalar field from a linked outlet into the inlet following a user-defined time delay

- Velocity Unit Vector
Inlet velocity vector. A muparser expression that may be a function of space and time. Variables x,y,z,t.

- Recirc Link
Name of outlet boundary condition that connects to this recirculation inlet.

Note that the opening feeding the recirculation loop should be defined as constant velocity boundary with a flow velocity pointing out of the system.

- Recirc Link Delay
Number of seconds of transit time the recirculation loop represents

### Poiseuille¶

An inlet boundary condition that defines a Poiseuille velocity profile across the inlet geometry.

- Velocity Unit Vector
Inlet velocity vector. A muparser expression that may be a function of space and time. Variables x,y,z,t.

- Velocity Magnitude
Inlet velocity magnitude [m/s]. A muparser expression that may be a function of space and time. Variables x,y,z,t.

### Volume Flow Rate¶

A specified velocity type boundary condition that defines a volume flow rate.

- Velocity Unit Vector
- Volume Flow Rate
Volume flow rate with cubic meters per second units. May be an expression as a function of time. Variables: t

### Mass Flow Rate¶

A specified velocity type boundary condition that defines a mass flow rate.

- Velocity Unit Vector
- Mass Flow Rate
Mass flow rate with kg/s units. May be an expression as a function of time. Variables: t

### Inlet Single Pulse¶

A boundary condition that pulses exactly one time for the specified duration. This is a basically a specifed velocity boundary condition.

- Velocity Unit Vector
- Pulse Velocity
Velocity pulse with m/s units.

- Pulse Time
The time at which to start the pulse

- Pulse Duration
Defines the pulse duration

### Inlet Multi Pulse¶

A boundary condition that pulses repeatedly throughout the simulation. Input variables are described in the below diagram.

- Velocity Unit Vector

### Boundary Condition Options¶

- Geometry Mode (READ ONLY)
Indicates if a boundary condition is considered “On Lattice” or “Off Lattice”.

On Lattice: The boundary condition is defined by specifying a seed point. Inlet orientation must be parallel to the world X, Y, or Z axis.

Off Lattice: May be defined using arbitrary geometry and orientation.

- Fill Orientation (READ ONLY)
Indicates fill direction for on lattice boundary conditions.

This can be easily flipped by running the “Flip” command on the inlet.

- Point
Seed point for inlet/outlet

Inlet/outlet seed points are located on one of the six sides of the domain bounding box. This is consistent with the requirement that all inlets and outlets are required to intersect the bounding box.

The inlet/outlet seed point should be positioned inside the opening of the inlet/outlet. It does not need to be precisely centered inside the opening, but the point does need to be a “wet” point, as shown below.

- Characteristic Diameter
Equivalent hydraulic diameter [Template Units]

The hydraulic diameter characterizes the length scale off the inlet. This value is used for scaling in the solver, and does not strongly influence simulation precision. For cylindrical pipes, the hydraulic diameter is the inside diameter of the pipes. For other geometries, it is equal to the 4 times the area, divided by the perimeter.

Buffer Length Option

Auto: Buffer length is automatically set as the coarse dx spacing for the system

Specified Value: Allows you to specify your own value for the buffer length

- Buffer Length
Buffer length for inlet and outlet conditions

A buffer is a region near the inlet/outlet wherein the fluid viscosity is artificially inflated to decrease small-scale variations in the flow field. This smoothing of the flow field helps to maintain the stability of the boundary condition at larger timesteps.

For systems with inlet/outlet diameters that are small compared to the tank diameter, flow through the orifice will typically be one- dimensional and boundary conditions are generally stable. In systems with large openings, however, the flow field interacting with the opening may be more complex and a buffer may be required to maintain overall stability.

- Enabled
Enable or disable export of the boundary condition. This effectively turns the boundary condition on and off, therby sealing the orifice. Useful for multi-purpose models where a given outer boundary is used for different processes where inlets/outlets are used differently based on operating condition.

- Ramp Time
Ramp time for inlet [Seconds]

For constant velocity boundary conditions, the interval over which inlet velocity will be increased from zero to the user-defined constant velocity via a quarter sine wave.

For constant pressure boundary conditions, the interval over which the inlet pressure will be increased from the minimum system pressure (keep reading) to the user-defined constant inlet pressure via a quarter sine wave.

Note

The purpose of the ramp is to limit the propgation of “shock waves” throught the system, associated with a step-increase in boundary velocity or pressure.

The duration of the ramp time, in terms of time-steps, should be comparable to the number of lattice points across the system domain.

- Visible
Enable/disable the visibility of this component in the GUI