[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 fixedValue, where the value is calculated by a function of other patch fields, time, geometric information, etc. Some other conditions derived from mixed/directionMixed switch between fixedValue and fixedGradient (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 fields and vector fields, respectively. For example, for scalar fields, 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 fluid flows out of the domain at a patch face, and fixedValue, when the fluid is flowing into the domain. For inflow, the inlet value is specified 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 outflow, the condition is well posed, where there is inflow, the phase fraction is fixed with a value of 0, corresponding to 100% air.
17
18internalField uniform 0;
19
20boundaryField
21{
22 leftWall
23 {
24 type zeroGradient;
25 }
26
27 rightWall
28 {
29 type zeroGradient;
30 }
31
32 lowerWall
33 {
34 type zeroGradient;
35 }
36
37 atmosphere
38 {
39 type inletOutlet;
40 inletValue uniform 0;
41 value uniform 0;
42 }
43
44 defaultFaces
45 {
46 type empty;
47 }
48}
49
50// ************************************************************************* //
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 inflow occurs and the inlet flow 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 flow reversal may occur, and where flow 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 outflow, but for inflow the normal velocity is allowed to find 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 inflow velocity increases.
The totalPressure condition specifies:
|
(6.2) |
|
(6.3) |
The pressureInletOutletVelocity condition specifies zeroGradient at all times, except on the tangential component which is set to fixedValue for inflow, with the tangentialVelocity defaulting to 0.
The specification of these boundary conditions in the U and p_rgh files, in the damBreak case, are shown below.
17dimensions [0 1 -1 0 0 0 0];
18
19internalField uniform (0 0 0);
20
21boundaryField
22{
23 leftWall
24 {
25 type noSlip;
26 }
27 rightWall
28 {
29 type noSlip;
30 }
31 lowerWall
32 {
33 type noSlip;
34 }
35 atmosphere
36 {
37 type pressureInletOutletVelocity;
38 value uniform (0 0 0);
39 }
40 defaultFaces
41 {
42 type empty;
43 }
44}
45
46
47// ************************************************************************* //
17
18internalField uniform 0;
19
20boundaryField
21{
22 leftWall
23 {
24 type fixedFluxPressure;
25 value uniform 0;
26 }
27
28 rightWall
29 {
30 type fixedFluxPressure;
31 value uniform 0;
32 }
33
34 lowerWall
35 {
36 type fixedFluxPressure;
37 value uniform 0;
38 }
39
40 atmosphere
41 {
42 type prghTotalPressure;
43 p0 uniform 0;
44 }
45
46 defaultFaces
47 {
48 type empty;
49 }
50}
51
52// ************************************************************************* //
6.4.3 Fixed flux pressure
In the above example, it can be seen that all the wall boundaries use a boundary condition named fixedFluxPressure. 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 Time-varying boundary conditions
There are several boundary conditions for which some input parameters are specified by a function of time (using Function1 functionality) class. They can be searched by the following command.
find $FOAM_SRC/finiteVolume/fields/fvPatchFields -type f -name "*.H" |\
xargs grep -l Function1 | xargs dirname | sort
The Function1 is specified by a keyword following the uniformValue entry, followed by parameters that relate to the particular function. The Function1 options are list below.
- constant: constant value.
- table: inline list of (time value) pairs; interpolates values linearly between times.
- tableFile: as above, but with data supplied in a separate file.
- square: square-wave function.
- squarePulse: single square pulse.
- sine: sine function.
- one and zero: constant one and zero values.
- polynomial: polynomial function using a list (coeff exponent) pairs.
- coded: function specified by user coding.
- 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 specified duration.
- reverseRamp: reverses the values of a ramp function, e.g. from 1 to 0.
Examples or a time-varying inlet for a scalar are shown below.
{
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)))
);
#};
}