# Boundary Conditions

## General boundary conditions

The following inputs are defined using the prefix `bc`:

| Description | Type | Default
--- | --- | --- | ---
regions | Regions used to define boundary conditions. | String | None

The type of the boundary conditions in the BC region must be defined.

| Description | Type | Default
--- | --- | --- | ---
[region] | Used to define boundary condition type. Available options include: ‘pi’ for pressure inflow BC type ‘po’ for pressure outflow BC type ‘mi’ for mass inflow BC type ‘nsw’ for no-slip wall BC type ‘eb’ for inhomogeneous Dirichlet BCs of temperature or fluid velocity (mass inflow) on the contained EBs | String | None
po_no_par_out | Let particles exit (default) or bounce-back at pressure outflows | Int | 0

### Fluid settings

For each boundary condition region, the fluid inputs are defined using the prefix `bc.[region].[fluid]`:

| Description | Type | Default
--- | --- | --- | ---
volfrac | Volume fraction [required if bc_region_type=’mi’] | Real | 0
density | Fluid density [required if bc_region_type=’mi’ or ‘pi’] | Real | 0
pressure | Fluid pressure [required if bc_region_type=’po’ or ‘pi’] | Real | 0
temperature | Fluid temperature [required if bc_region_type=’mi’ or ‘pi’] | Real | 0
velocity | Velocity components [required if bc_region_type=’mi’ and `volflow` or `massflow` not specified] | Reals | 0 0 0
volflow | Volumetric flow rate [required if bc_region_type=’mi’ and `velocity` or `massflow` not specified] | Real | 0
massflow | Mass flow rate [required if bc_region_type=’mi’ and `velocity` or `volflow` not specified] | Real | 0
delp_dir | Direction for specified pressure drop. Note that this direction should also be periodic. | Int | 0
delp | Pressure drop (Pa) | Real | 0
species.[species0] | Species ‘species0’ mass fraction [required if solve_species=1 and bc_region_type=’mi’ or ‘pi’]. | Real | 0

Note that for a `mi` only one of `velocity` or `volflow` or `massflow` should be specified. Additionally, velocity can be specified as a vector or a scalar, the latter of which is applied normal to the inflow plane, as with volflow and massflow.

Below is an example for specifying boundary conditions for fluid (`fluid`).

    bc.regions = inflow outflow

    bc.inflow = mi
    bc.inflow.fluid.volfrac     =  1.0
    bc.inflow.fluid.density     =  1.0
    bc.inflow.fluid.velocity    =  0.015  0.0  0.0
    bc.inflow.fluid.temperature =  300
    bc.inflow.fluid.species.O2  =  0.0
    bc.inflow.fluid.species.CO  =  0.5
    bc.inflow.fluid.species.CO2 =  0.5

    bc.outflow = po

    bc.outflow.fluid.pressure =  0.0

## Transient boundary conditions

Velocity, temperature, and pressure boundary conditions may also be specified as a function of time simply by adding a new column. The time value is entered in the new first column. We can make the mi boundary condition above time-dependent by replacing:

    bc.inflow.fluid.velocity    =  0.0  0.0    0.0  0.0
    bc.inflow.fluid.velocity    =  3.0  0.015  0.0  0.0

    bc.inflow.fluid.temperature =  0.0  300
    bc.inflow.fluid.temperature =  2.99 300
    bc.inflow.fluid.temperature =  3.0  500
    bc.inflow.fluid.temperature =  4.0  500
    bc.inflow.fluid.temperature =  4.01 300

In the above example, the inflow velocity is accelerated from zero to its final value over a period of three seconds. Linear interpolation is used in between discrete time values and held constant at the last time value. The temperature sees an abrupt spike from 300 up to 500 at t = 3s and then back down again after 4s. Note that the timestep is not adjusted to sync with transient BCs.

## Embedded boundary options

In MFIX-Exa it is possible to set boundary conditions on the embedded boundaries. For instance, it is possible to set inhomogeneous Dirichlet boundary conditions for the fluid temperature variable on the subpart of the embedded boundaries which is contained in the BC region (which in this case has to be tridimensional). We recall that, on the remaining part of the EBs, homogeneous Neumann boundary conditions are assumed by default.

In the following table there is a list of the possible entries for EB boundary conditions. Each entry must be preceded by bc.[region0].

| Description | Type | Default
--- | --- | --- | ---
eb.temperature | Inhomogeneous Dirichlet BC value for temperature on EBs contained in the (tridimensional) region [required if advect_enthalpy=1 and bc_region_type=’eb’]. | Real | 0.0

Below is an example for specifying boundary conditions for a fluid myfluid.

    bc.regions = hot-wall

    bc.hot-walls = eb
    bc.hot-walls.eb.temperature = 800

In addition to the temperature, it is possible to set an inflow condition for fluid on an embedeed boundary. We recall that, on the remaining part of the EBs, no slip velocity conditions are assumed by default.

In the following table there is a list of the possible entries for inflow EB boundary conditions. Each entry must be preceded by bc.[region0]. Like traditional mass inflows, the fluid temperature, pressure, and species composition must be provided when appropriate.

| Description | Type | Default
--- | --- | --- | ---
fluid.velocity | (Required if not volflow or massflow) Inflow fluid velocity on EB faces contained in the (tridimensional) region. Note that if only one value is specified, that is assumed to be the magnitude in the direction of the EB face’s normal. | Reals | 0 0 0
fluid.volflow | (Required if not velocity or massflow) Inflow BC for fluid volumetric flow rate in the (tridimensional) region. The flow is assumed to be normal to the EB surface in the region. | Real | 0
fluid.massflow | (Required if not velocity or volflow) Inflow BC for fluid mass flow rate in the (tridimensional) region. The flow is assumed to be normal to the EB surface in the region. | Real | 0
fluid.volfrac | (Required) Volume fraction. | Real | 0
eb.normal | (Optional) When specified, only cells with EB face normal that is parallel and opposite in direction to the specified values are imposed with the inflow velocity. | Reals | 0 0 0
eb.normal_tol | (Optional) Used in conjunction with eb.normal. It determines the tolerance (in degrees) for choosing cells with a specific normal. | Real | 0

Note that only one of `velocity` or `volflow` or `massflow` should be specified.

Below is an example for specifying a normal inflow velocity magnitude for a region eb-flow.

    bc.regions = eb-flow

    bc.eb-flow = eb

    bc.eb-flow.my_fluid.volfrac  = 1.0
    bc.eb-flow.my_fluid.velocity = 0.1

Below is an example where only specific cells are imposed a velocity in the x-direction.

    bc.regions = eb-flow

    bc.eb-flow = eb

    bc.eb-flow.eb.normal_tol = 3.0
    bc.eb-flow.eb.normal =  0.9848  0.0000  0.1736  # 10 deg

    bc.eb-flow.my_fluid.volfrac  = 1.0
    bc.eb-flow.my_fluid.velocity = 0.1  0.0  0.0