1. TWO PHASE LBM CODE
Generalising Boundary conditions
Declaring global variables
Code for reading the input data given in the
text file
Flow of program
Verification of Generalised code
2. Generalised boundary conditions
Define boundary condition function.
1. Boundaryconditionf()
2. Boundaryconditiong()
each consists of four different functions
1. Leftf() 1. Leftg()
2. Rightf() 2. Rightg()
3. Topf() 3. Topg()
4. Bottomf() 4. Bottomg()
Define all 8 functions with different cases using switch function.
3. In main function the cases are printed for each side left, right,
top and bottom.
The cases are to be chosen by the user.
4. When program is compiled, The cases are displayed on the
output window for each boundary
User must enter the type of boundary condition on left side
5. Store the number entered by the user in a global
variable.
This variable is used in switch function for selecting the
cases displayed in the output window.
The same method is used for all other boundary
conditions
6. Declaring global Variables
Global variables are used for storing the user
input.
Int choice,Choice,Choice,Choice,CHOice;
They will store the type of case selected by user
and,
Also the value of velocity in case of velocity
boundary condition and the value of pressure in
case of pressure boundary condition are asked
and stored in the global variables
7. As they are Global variables they can be
accessed any where in the function.
Also, we Declare an array globally to store the
values read from the data file.
double Values[500];
8. Code for reading the input data given in
the text file
Declare a function which is used to read data from input
file.
void fReadData(double values[], int No_of_input);
9. The function reads the data given after colon :
Example. Number of lattice units in x direction: 300
10. The input values are stored in pre-declared
array values[]
From now , we can use this array value where
ever we are using the input variable previously.
As the array value is global variable we can use
it anywhere and in any function.
11. In some places we need only integer value and
in those places we take only integer value from
the double value.
12. Flow of the program
1. Compiler will read the data file and store the input in an array
2. Input values are passed into a bubble function as parameters.
3. User will choose the boundary conditions displayed on output
window
4. Choices given are stored in the global variables
5. Initialisation function is called and executed.
6. Then, time loop starts executing.
13. 7. At every time step the following functions are called and executed
Density function
Calculate psi function
Force Interaction function
Macro variables calculation (
U,V,T )function
Equilibrium computation
function
Deltaf3 function
Collision function
Streaming function
Boundary conditions function
Save data function
7. Delete elements function is called and executed
14. Flow of Boundary conditions function.
1. At every time step the Boundary conditions function is called.
2. In the boundary conditions function left function is called.
3. In the function, switch statement is used and cases (which are chosen
before) will be executed.
4. Similarly, all other functions Right, Top, Bottom will be executed.
15. Verification of Generalised code
1. The code is checked for the following type of
flows.
Poiseuille flow
Perturbation
Couette flow
- single phase
- Vapour bubble shear
Wall contact flow
16. Verification of Generalised code
1. The code is checked for the following type of
flows.
Poiseuille flow
Perturbation
Couette flow
- single phase
- Vapour bubble shear
Wall contact flow
17. Poiseuille flow
Real units
L = 3 mm
H = 0.3 mm
Viscosity=1.19e-7
m2/s
dx = 1e-5 m
dt = 1.4006e-4 s
U = 1.4286e-4 m/s
T = 582.3 K
Lattice units
L = 300
H = 30
Tau=1
Viscosity=0.1667
U = 2e-3
Re = 0.36
Tr = 0.9
RhoLiq = 5.83
Time step = 10000
18. Left- Fully developed flow
( Velocity max = 0.003 in lattice units )
Right- pressure in terms of Rho(5.83 lu )
Top-Wall
Bottom- Wall
Boundary conditions
19. poiseuille flow with fully
developed flow
poiseuille flow with fully
developed flow at 10000
time step
20. 0
0.2
0.4
0.6
0.8
1
1.2
0 0.2 0.4 0.6 0.8 1 1.2
U/Umax
Y/Yh
Series1 Series2
Velocity profile in poiseuille flow after
10000 time steps
21. Perturbation
Lattice units
L = 200
H = 200
Tau=1
Viscosity=0.1667
Tr = 0.59
RhoLiq = 5.83
Rhovap = 0.83
Time step = 50000
34. Similarly verified for wall adhesion parameter
gw = 0.1, 0.3
Presently, we are verifying for the pressure boundary
conditions in cavitation problem.