Immersed Boundary Training Slides OFW7
Immersed Boundary Training Slides OFW7
Immersed Boundary Training Slides OFW7
OpenFOAM
Hrvoje Jasak
Zeljko
Tukovic,
[email protected]
Outline
Objective
Show current state of Immersed Boundary Method
implementation in OpenFOAM-1.6-ext
Demonstrate application of the immersed boundary method with few tutorial cases
Topics
Immersed Boundary Method (IBM) in general
Selected IBM approach
Imposition of Dirichlet and Neumann boundary conditions
Treatment of pressure equation
Implementation details
Tutorial cases
Fluid
IB
Solid
Fluid cells
Solid cells
IB cells
n
IB points
(1)
11
00
00011
111
0011
00
000
111
00
11
00
11
00011
111
0011
00
00
11
000
111
00
11
000
111
111
000
00
11
000
111
00
11
Fluid cells
Solid cells
IB cells
IB points
ib
Extended stencil
2
P = C0 + [nib ()ib ] xP + C1 yP
+ C2 xP yP
+ C3 (xP )2 + C4 (yP
)
nib
(2)
Fluid cells
Solid cells
IB cells
IB points
ib
1
ri2
(3)
(4)
Fluid cells
Solid cells
i
ri
rmax
IB cells
IB points
ib
111
000
000
111
Extended stencil
(5)
ib
Fluid cells
P
fib
IB cells
Nib
IB faces
Fluid cells
P
fib
IB cells
Nib
IB faces
vfib =
1
(vP
2
+ vNib )
Implementation details
Immersed boundary implementation is based on three classes:
class immersedBoundaryPolyPatch
class immersedBoundaryFvPatch
class immersedBoundaryFvPatchField
Implementation details
class immersedBoundaryPolyPatch
:
public polyPatch
{
...
// Member Functions
// Access
//- Return immersed boundary surface mesh
const triSurfaceMesh& ibMesh() const
{
return ibMesh_;
}
//- Return true if solving for flow inside the IB
bool internalFlow() const
{
return internalFlow_;
}
//- Return triSurface search object
const triSurfaceSearch& triSurfSearch() const;
};
Implementation details
Including immersedBoundaryPolyPatch into boundary mesh of a polyMesh by
modifying constant/polyMesh/boundary dictionary
6
(
ibCylinder // constant/triSurface/ibCylinder.ftr
{
type
immersedBoundary;
nFaces
0;
startFace
3650;
internalFlow
no;
type
nFaces
startFace
patch;
25;
3650;
}
in
{
}
...
)
Implementation details
class immersedBoundaryFvPatch
:
public fvPatch
{
// Private data
//- Reference to processor patch
const immersedBoundaryPolyPatch& ibPolyPatch_;
//- Finite volume mesh reference
const fvMesh& mesh_;
// Member Functions
// Immersed boundary data access
//- Get fluid cells indicator, marking only live fluid cells
const volScalarField& gamma() const;
//- Return list of fluid cells next to immersed boundary (IB cel
const labelList& ibCells() const;
//- Return list of faces for which one neighbour is an IB cell
// and another neighbour is a live fluid cell (IB faces)
const labelList& ibFaces() const;
};
Immersed boundary method in OpenFOAM p. 15
Implementation details
class immersedBoundaryFvPatch
:
public fvPatch
{
...
//- Return IB points
const vectorField& ibPoints() const;
//- Return IB cell extended stencil
const labelListList& ibCellCells() const;
//- Return dead cells
const labelList& deadCells() const;
//- Return live cells
const labelList& liveCells() const;
//- Get inverse Dirichlet interpolation matrix
const PtrList<scalarRectangularMatrix>&
invDirichletMatrices() const;
//- Get inverse Neumann interpolation matrix
const PtrList<scalarRectangularMatrix>&
invNeumannMatrices() const;
};
Immersed boundary method in OpenFOAM p. 16
Implementation details
template<class Type>
class immersedBoundaryFvPatchField
:
public fvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const immersedBoundaryFvPatch& ibPatch_;
//- Local reference to fvMesh
const fvMesh& mesh_;
//- Defining value field
Field<Type> refValue_;
//- Defining normal gradient field
Field<Type> refGrad_;
//- Does the boundary condition fix the value
Switch fixesValue_;
...
};
Implementation details
template<class Type>
class immersedBoundaryFvPatchField
:
public fvPatchField<Type>
{
...
// Private Member Functions
Implementation details
template<class Type>
class immersedBoundaryFvPatchField
:
public fvPatchField<Type>
{
...
// Evaluation functions
//- Update the coefficients associated with the patch field
void updateCoeffs();
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType = Pstream::blocking
);
//- Manipulate matrix
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
...
};
Implementation details
Including immersedBoundaryFvPatchField into boundary of a volVectorField
boundaryField
{
ibCylinder
{
type immersedBoundary;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
fixesValue yes;
setDeadCellValue
deadCellValue
yes;
(0 0 0);
Implementation details
Example of solver source code - icoIbFoam
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
...
// Pressure-velocity corrector
int oCorr = 0;
do
{
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
UEqn.boundaryManipulate(U.boundaryField());
solve(UEqn == -cellIbMask*fvc::grad(p));
...
}
...
}
Immersed boundary method in OpenFOAM p. 21
Dam break VOF interface capturing simulation with circular bump at the bottom
boundary
Case setup data:
Domain dimension: 2 2 m
Bump diameter: 0.5 m
Water-air multi-phase system