Contrib icoBlockedCellFoam
1 Introduction
The current example is desired to show how the matrix coefficients of the linear system of equations are modified from user-side. The specific aim of the presented test case is to exclude single cell from the flow and pressure field calculations. The application of such approach can be found e.g. when modeling solidification processes where fully solidified regions should not produce neither flow nor pressure sources. Also it can be used for simulating obstacles immersed in the flow etc.
- Disclaimer: this example is not claimed to be perfect and also physics behind can be discussed. So please consider it as a guide for the future steps.
To exclude one cell of the domain from calculations a following technique will be used: we set diagonal coefficient to the identity value and remove the influence of the neighboring cells. Latest is done by canceling the off-diagonal coefficients. Thereby matrix coefficients are adjusted in such manner for the system
that for the "blocked" cell (indexed as k) the diagonal element equals 1, and all off-diagonal coefficients are zeroed along with the source term . The consequence of the described operations with the system (1) is that
In accordance to (2) the solution for the cell value is trivial one. Hereby if one applies the condition (2) for the momentum and pressure matrices in the PISO algorithm, that results in zero velocity and pressure values automatically for the general solution of the full system (1). To get the solution in the cell different from the zero one, the source term can be adjusted to the corresponding value.
The source code example supplemented with the test case is a modification of the incompressible viscous flow solver icoFoam Further the required additions are described.
2 Mods to createFields.C file
The following modification should be applied to the initial createFields.C file. First for the allocation of the blocked cell it is required to define its position:
// Read the position of the excluded cell vector position_ ( transportProperties.lookup("exclude") );
Then exclude parameter should be defined in the transportProperties
file in the case folder.
nu nu [ 0 2 -1 0 0 0 0 ] 0.01; exclude (0.05 0.05 0.005);
In the above example the position vector will correspond to the center of the driven cavity.