Outlet boundary conditions are the most common source of divergence in OpenFOAM simulations that beginners overlook. Picking the wrong BC type, placing the outlet too close to a recirculation zone, or failing to handle backflow correctly can destabilize an otherwise well-configured case. This guide covers every outlet BC type and when to use each one.
Most OpenFOAM outlet configurations use a pressure-velocity pair. The pressure outlet sets the reference pressure; the velocity outlet must be compatible with whatever flow exits naturally.
The standard incompressible outlet pair:
// 0/p
outlet
{
type fixedValue;
value uniform 0; // gauge pressure = 0 Pa
}
// 0/U
outlet
{
type zeroGradient;
}
This assumes the flow exits cleanly with no recirculation at the outlet face. The pressure is fixed at zero gauge, and the velocity is extrapolated from the interior — whatever is leaving, leaves freely.
This pair works well when the outlet is placed far enough downstream. When there is recirculation or the flow is not fully developed at the outlet, this pair breaks down and the simulation diverges.
zeroGradient tells the solver: assume the gradient of this field in the direction normal to the boundary is zero. This means the value at the boundary face is extrapolated from the last interior cell. For velocity at outlets, this is physically correct for fully developed flow — the velocity profile is not changing as it leaves.
fixedValue imposes a specific value at the boundary, regardless of what the interior solution is doing. For pressure at outlets, this sets the reference pressure level for the whole simulation. For velocity, fixedValue at outlets is rarely appropriate — it forces a specific velocity profile that may conflict with the global mass balance.
A common mistake is using fixedValue for both velocity and pressure at an outlet. This overconstrains the problem — you have set both the pressure level and the velocity, leaving the mass balance nowhere to adjust, which causes divergence.
pressureInletOutletVelocity is a smarter version of zeroGradient for velocity at outlets. It works as follows:
// 0/U
outlet
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
This BC prevents the simulation from blowing up when a small amount of backflow occurs at the outlet. The backflowing fluid enters with zero velocity rather than with whatever the extrapolated exterior value would be (which is numerically undefined). Use this instead of zeroGradient whenever there is any risk of backflow.
inletOutlet is the general-purpose backflow-handling BC for scalar fields (k, epsilon, omega, T, nut, etc.):
// 0/k at outlet
outlet
{
type inletOutlet;
inletValue uniform 0.01; // value when flow enters
value uniform 0.01;
}
When flow exits, inletOutlet applies zeroGradient. When flow enters (backflow), it applies fixedValue with the inletValue. This prevents unphysical values of k, epsilon, or omega from entering the domain through the outlet.
The inletValue for turbulent quantities should be set to a physically reasonable value — the free-stream turbulence intensity value or a small positive number. Setting it to zero can cause division-by-zero in the turbulence model.
For a complete incompressible RANS outlet with proper backflow handling:
// p
outlet { type fixedValue; value uniform 0; }
// U
outlet { type pressureInletOutletVelocity; value uniform (0 0 0); }
// k
outlet { type inletOutlet; inletValue uniform 0.1; value uniform 0.1; }
// epsilon
outlet { type inletOutlet; inletValue uniform 0.01; value uniform 0.01; }
// nut
outlet { type calculated; value uniform 0; }
Compressible solvers (rhoSimpleFoam, rhoPimpleFoam) require different outlet treatment because pressure and density are coupled.
// p (absolute pressure)
outlet { type fixedValue; value uniform 101325; }
// U
outlet { type pressureInletOutletVelocity; value uniform (0 0 0); }
// T or h
outlet { type inletOutlet; inletValue uniform 300; value uniform 300; }
// rho
outlet { type zeroGradient; }
For aeroacoustics or cases where pressure waves should leave the domain without reflection:
outlet
{
type waveTransmissive;
field p;
psi thermo:psi;
gamma 1.4;
fieldInf 101325;
lInf 1.0; // characteristic length
value uniform 101325;
}
Backflow instability manifests as oscillating residuals, warnings like Negative flux at outlet in the log, or divergence starting from the outlet region. The root cause is almost always backflow — reversed flow entering the domain through the outlet patch.
In the log, look for:
// OpenFOAM prints this when backflow occurs
Reversing flux at X faces on outlet
In ParaView, visualize the velocity field at the outlet patch. Any blue (negative x-velocity for a streamwise outlet) cells indicate backflow.
This is the cleanest fix. Extend the domain 5–15 diameters downstream of the last flow disturbance (bluff body, diffuser, junction). The boundary condition assumptions (fully developed, no backflow) are only valid where the flow has reattached and is moving uniformly toward the outlet.
Switch from zeroGradient to pressureInletOutletVelocity for velocity and use inletOutlet for all scalar fields. These BCs handle the occasional backflow without destabilizing the simulation.
For complex geometries where outlet placement is constrained, add a short buffer region of simplified geometry (straight duct extension) before the outlet boundary. This forces the flow to become more uniform before hitting the boundary condition.
In VOF simulations with interFoam, backflow instability is particularly severe because the phase fraction field is affected. Use outletPhaseMeanVelocity which adjusts the mean velocity to maintain phase balance while allowing the profile to vary.
For channel flows, pipe flows, or any geometry with translational periodicity, you can replace the inlet/outlet pair with a cyclic patch pair. This is the most accurate approach — there is no inlet or outlet at all, just periodic repetition:
// In constant/polyMesh/boundary
left
{
type cyclic;
neighbourPatch right;
}
right
{
type cyclic;
neighbourPatch left;
}
Add a body force in fvOptions to drive the flow at the desired mean velocity or pressure gradient. This eliminates all outlet BC issues by construction.
zeroGradient extrapolates the field value from the interior — appropriate for velocity at outlets where the flow exits freely. fixedValue imposes a specific value regardless of the interior solution — appropriate for pressure at outlets to set the reference pressure. Never use fixedValue for both U and p at the same outlet patch.
Use pressureInletOutletVelocity at pressure-fixed outlets. It applies zeroGradient for outflow and a fixed zero value for any backflow. This is more stable than pure zeroGradient when there is any risk of flow reversal at the outlet.
Use inletOutlet for velocity and all scalar fields (k, epsilon, T). inletOutlet switches between zeroGradient (outflow) and fixedValue with a physically reasonable backflow value. Also extend the domain to push the outlet further from recirculation zones.
At least 10–15 diameters downstream of any flow disturbance (bluff body, bend, junction). The flow should be as close to fully developed and unidirectional as possible at the outlet. Large recirculation zones at the outlet boundary cause backflow and divergence.
Most likely cause is backflow — reversed flow entering through the outlet patch. Fix by switching to pressureInletOutletVelocity for U and inletOutlet for scalar fields, extending the domain, or adding a straight duct extension before the outlet.
For incompressible solvers, use fixedValue uniform 0 (gauge pressure). For compressible solvers, use fixedValue with the absolute pressure in Pascals. For buoyancy-driven flows with buoyantSimpleFoam, set fixedValue on p_rgh, not p.
Upload your case and CFDpilot flags backflow issues, pressure-velocity coupling errors, and wrong outlet types.
Check my outlet BCs →