[version 12][version 11][version 10][version 9][version 8][version 7][version 6]
6.4 Derived boundary conditions
There are numerous more complex boundary conditions derived from the basic conditions. For example, many complex conditions are derived from ﬁxedValue, where the value is calculated by a function of other patch ﬁelds, time, geometric information, etc. Some other conditions derived from mixed/directionMixed switch between ﬁxedValue and ﬁxedGradient (usually with a zero gradient).
The available boundary conditions can be listed with foamToC using the scalarBCs and vectorBCs options, corresponding to boundary conditions for scalar ﬁelds and vector ﬁelds, respectively. For example, for scalar ﬁelds, boundary conditions are listed by
foamToC scalarBCs
foamInfo totalPressure
6.4.1 The inlet/outlet condition
The inletOutlet condition is one derived from mixed, which switches between zeroGradient when the ﬂuid ﬂows out of the domain at a patch face, and ﬁxedValue, when the ﬂuid is ﬂowing into the domain. For inﬂow, the inlet value is speciﬁed by an inletValue entry. A good example of its use can be seen in the damBreakLaminar tutorial, where it is applied to the phase fraction on the upper atmosphere boundary. Where there is outﬂow, the condition is well posed, where there is inﬂow, the phase fraction is ﬁxed with a value of 0, corresponding to 100% air.
16 17dimensions []; 18 19internalField uniform 0; 20 21boundaryField 22{ 23 #includeEtc "caseDicts/setConstraintTypes" 24 25 wall 26 { 27 type zeroGradient; 28 } 29 30 atmosphere 31 { 32 type inletOutlet; 33 inletValue $internalField; 34 value $internalField; 35 } 36} 37 38 39// ************************************************************************* //
6.4.2 Entrainment boundary conditions
The combination of the totalPressure condition on pressure and pressureInletOutletVelocity on velocity is extremely common for patches where some inﬂow occurs and the inlet ﬂow velocity is not known. The conditions are used on the atmosphere boundary in the damBreak tutorial, inlet conditions where only pressure is known, outlets where ﬂow reversal may occur, and where ﬂow in entrained, e.g. on boundaries surrounding a jet through a nozzle.
The idea behind this combination is that the condition is a standard combination in the case of outﬂow, but for inﬂow the normal velocity is allowed to ﬁnd its own value. Under these circumstances, a rapid rise in velocity presents a risk of instability, but the rise is moderated by the reduction of inlet pressure, and hence driving pressure gradient, as the inﬂow velocity increases.
The totalPressure condition speciﬁes:
(6.2) 
The entrainmentPressure condition also exists which is arguably more robust than totalPressure by using the normal component of velocity in the calculation for inﬂow, i.e.
(6.3) 
Solver applications which include buoyancy eﬀects, though a gravitational force (per unit volume) source term, tend to solve for a pressure ﬁeld , where the hydrostatic component is subtracted based on a height above some reference. For such solvers, e.g. interFoam, an equivalent prghTotalPressure condition is applied which speciﬁes:
(6.4) 
The pressureInletOutletVelocity condition speciﬁes zeroGradient at all times, except on the tangential component which is set to ﬁxedValue for inﬂow, with the tangentialVelocity defaulting to 0.
The speciﬁcation of these boundary conditions in the U and p_rgh ﬁles, in the damBreak case, are shown below.
16 17dimensions [0 1 1 0 0 0 0]; 18 19internalField uniform (0 0 0); 20 21boundaryField 22{ 23 #includeEtc "caseDicts/setConstraintTypes" 24 25 wall 26 { 27 type noSlip; 28 } 29 30 atmosphere 31 { 32 type pressureInletOutletVelocity; 33 value $internalField; 34 } 35} 36 37 38// ************************************************************************* //
16 17dimensions [1 1 2 0 0 0 0]; 18 19internalField uniform 0; 20 21boundaryField 22{ 23 #includeEtc "caseDicts/setConstraintTypes" 24 25 wall 26 { 27 type fixedFluxPressure; 28 value $internalField; 29 } 30 31 atmosphere 32 { 33 type prghTotalPressure; 34 p0 $internalField; 35 } 36} 37 38 39// ************************************************************************* //
6.4.3 Fixed ﬂux pressure
In the above example, it can be seen that all the wall boundaries use a boundary condition named ﬁxedFluxPressure. This boundary condition is used for pressure in situations where zeroGradient is generally used, but where body forces such as gravity and surface tension are present in the solution equations. The condition adjusts the gradient accordingly.
6.4.4 Timevarying boundary conditions
There are several boundary conditions for which some input parameters are speciﬁed by a function of time (using Function1 functionality) class. The available functions from the Function1 can be listed by the following command.
find $FOAM_SRC/finiteVolume/fields/fvPatchFields type f name "*.H" \
xargs grep l Function1  xargs dirname  sort
The Function1 is speciﬁed by a keyword following the uniformValue entry, followed by parameters that relate to the particular function. The Function1 options can be listed by foamToC by
foamToC table scalarFunction1
foamToC table scalarFunction1  grep OpenFOAM

table: inline list of (time value) pairs; interpolates values linearly between times.

tableFile: as above, but with data supplied in a separate ﬁle.

polynomial: polynomial function using a list (coeff exponent) pairs.

scale: scales a given value function by a scalar scale function; both entries can be themselves Function1; scale function is often a ramp function (below), with value controlling the ramp value.

linearRamp, quadraticRamp, exponentialSqrRamp, halfCosineRamp, quarterCosineRamp and quarterSineRamp: monotonic ramp functions which ramp from 0 to 1 over speciﬁed duration.

reverseRamp: reverses the values of a ramp function, e.g. from 1 to 0.
Examples or a timevarying inlet for a scalar are shown below.
inlet { type uniformFixedValue; uniformValue constant 2; } inlet { type uniformFixedValue; uniformValue table ((0 0) (10 2)); } inlet { type uniformFixedValue; uniformValue polynomial ((1 0) (2 2)); // = 1*t^0 + 2*t^2 } inlet { type uniformFixedValue; uniformValue { type tableFile; format csv; nHeaderLine 4; // number of header lines refColumn 0; // time column index componentColumns (1); // data column index separator ","; // optional (defaults to ",") mergeSeparators no; // merge multiple separators file "dataTable.csv"; } } inlet { type uniformFixedValue; uniformValue { type square; frequency 10; amplitude 1; scale 2; // Scale factor for wave level 1; // Offset } } inlet { type uniformFixedValue; uniformValue { type sine; frequency 10; amplitude 1; scale 2; // Scale factor for wave level 1; // Offset } } input // ramp from 0 > 2, from t = 0 > 0.4 { type uniformFixedValue; uniformValue { type scale; scale linearRamp; start 0; duration 0.4; value 2; } } input // ramp from 2 > 0, from t = 0 > 0.4 { type uniformFixedValue; uniformValue { type scale; scale reverseRamp; ramp linearRamp; start 0; duration 0.4; value 2; } } inlet // pulse with value 2, from t = 0 > 0.4 { type uniformFixedValue; uniformValue { type scale; scale squarePulse start 0; duration 0.4; value 2; } } inlet { type uniformFixedValue; uniformValue coded; name pulse; codeInclude #{ #include "mathematicalConstants.H" #}; code #{ return scalar ( 0.5*(1  cos(constant::mathematical::twoPi*min(x/0.3, 1))) ); #}; }