SlideShare une entreprise Scribd logo
1  sur  34
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
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.
In main function the cases are printed for each side left, right,
top and bottom.
The cases are to be chosen by the user.
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
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
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
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];
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);
The function reads the data given after colon :
Example. Number of lattice units in x direction: 300
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.
In some places we need only integer value and
in those places we take only integer value from
the double value.
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.
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
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.
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
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
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
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
poiseuille flow with fully
developed flow
poiseuille flow with fully
developed flow at 10000
time step
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
Perturbation
Lattice units
 L = 200
 H = 200
 Tau=1
 Viscosity=0.1667
Tr = 0.59
RhoLiq = 5.83
Rhovap = 0.83
Time step = 50000
Left- Periodic
Right- Periodic
Top- Wall
Bottom- Wall
Boundary conditions
T = 0 T = 10000
T =
50000
T =
30000
Couette Flow- (Single phase)
Lattice units
 L = 300
 H = 150
 Tau=1
 Viscosity=0.1667
Tr = 0.8
RhoLiq = 7.2
Time step = 20000
Left- Periodic
Right- Periodic
Top- Wall moving at velocity +0.01
Bottom- Wall moving at velocity -0.01
Boundary conditions
Couette flow at
T = 20000
-0.015
-0.01
-0.005
0
0.005
0.01
0.015
0 20 40 60 80 100 120 140 160
Series1
Velocity profile in couette flow after
20000 time steps
Couette Flow- (Vapour bubble shear)
Lattice units
 L = 300
 H = 150
 Tau=1
 Viscosity=0.1667
 U = 2e-3
Tr = 0.9
RhoLiq = 5.83
Rhovap = 0.58
Radius of bubble initiated
= 30
Time step = 10000
Left- Periodic
Right- Periodic
Top- Wall moving at velocity +0.01
Bottom- Wall moving at velocity -0.01
Boundary conditions
Couette flow at T
= 50000
Vapour bubble shear
at T = 0
Vapour bubble shear
at T = 10000
Wall contact
Lattice units
 L = 120
 H = 120
 Tau=1
 Viscosity=0.1667
Tr = 0.9
RhoLiq = 5.83
Rhovap = 0.58
Radius of bubble initiated
= 40
Bubble centre = (150,30)
Wall adhesion parameter
= 0
Gravity = 0
Time step = 10000
Left- Pressure = Periodic
Right- Pressure = Periodic
Top- Wall
Bottom- Wall
Boundary conditions
T = 0
T = 8000
T = 1500
T = 4000
 Similarly verified for wall adhesion parameter
gw = 0.1, 0.3
 Presently, we are verifying for the pressure boundary
conditions in cavitation problem.

Contenu connexe

Tendances (8)

expression in cpp
expression in cppexpression in cpp
expression in cpp
 
Loops in Visual Basic Programming
Loops in Visual Basic ProgrammingLoops in Visual Basic Programming
Loops in Visual Basic Programming
 
Welcome vibrant-technology-navimumbai
Welcome vibrant-technology-navimumbaiWelcome vibrant-technology-navimumbai
Welcome vibrant-technology-navimumbai
 
Welcome vibrant-technology-navimumbai
Welcome vibrant-technology-navimumbaiWelcome vibrant-technology-navimumbai
Welcome vibrant-technology-navimumbai
 
Vbscript
VbscriptVbscript
Vbscript
 
Test expressions
Test expressionsTest expressions
Test expressions
 
PRBS generation
PRBS generationPRBS generation
PRBS generation
 
Loops (1)
Loops (1)Loops (1)
Loops (1)
 

Similaire à LBM 1

Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3Ibrahim Reda
 
Hands on with smart contracts 2. Presentation for the Blockchain Applications...
Hands on with smart contracts 2. Presentation for the Blockchain Applications...Hands on with smart contracts 2. Presentation for the Blockchain Applications...
Hands on with smart contracts 2. Presentation for the Blockchain Applications...Gene Leybzon
 
Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constantsTAlha MAlik
 
A High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda MultiplierA High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda MultiplierIJRES Journal
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++Manzoor ALam
 
Mechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfMechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfRajaSekaran923497
 
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docx
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docxECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docx
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docxjack60216
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming NeedsRaja Sekhar
 
re:mobidyc the overview
re:mobidyc the overviewre:mobidyc the overview
re:mobidyc the overviewESUG
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 FunctionDeepak Singh
 
Write a function prototype for each of the following functions (Jus.pdf
Write a function prototype for each of the following functions (Jus.pdfWrite a function prototype for each of the following functions (Jus.pdf
Write a function prototype for each of the following functions (Jus.pdffashionfolionr
 
Dss
Dss Dss
Dss nil65
 
Operators loops conditional and statements
Operators loops conditional and statementsOperators loops conditional and statements
Operators loops conditional and statementsVladislav Hadzhiyski
 
Java Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type ConversionJava Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type ConversionSvetlin Nakov
 
solidity programming.pptx
solidity programming.pptxsolidity programming.pptx
solidity programming.pptxRohiniBagul4
 

Similaire à LBM 1 (20)

Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3
 
Hands on with smart contracts 2. Presentation for the Blockchain Applications...
Hands on with smart contracts 2. Presentation for the Blockchain Applications...Hands on with smart contracts 2. Presentation for the Blockchain Applications...
Hands on with smart contracts 2. Presentation for the Blockchain Applications...
 
Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constants
 
A High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda MultiplierA High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
 
functions
functionsfunctions
functions
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Mechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdfMechatronics study material-Question Bank.pdf
Mechatronics study material-Question Bank.pdf
 
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docx
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docxECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docx
ECS 40 Program #3 (50 points, my time 1.5 hours) Spring 2015 .docx
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
re:mobidyc the overview
re:mobidyc the overviewre:mobidyc the overview
re:mobidyc the overview
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Write a function prototype for each of the following functions (Jus.pdf
Write a function prototype for each of the following functions (Jus.pdfWrite a function prototype for each of the following functions (Jus.pdf
Write a function prototype for each of the following functions (Jus.pdf
 
Dss
Dss Dss
Dss
 
Function in C++
Function in C++Function in C++
Function in C++
 
Operators loops conditional and statements
Operators loops conditional and statementsOperators loops conditional and statements
Operators loops conditional and statements
 
Java Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type ConversionJava Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type Conversion
 
solidity programming.pptx
solidity programming.pptxsolidity programming.pptx
solidity programming.pptx
 

LBM 1

  • 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
  • 22. Left- Periodic Right- Periodic Top- Wall Bottom- Wall Boundary conditions
  • 23. T = 0 T = 10000 T = 50000 T = 30000
  • 24. Couette Flow- (Single phase) Lattice units  L = 300  H = 150  Tau=1  Viscosity=0.1667 Tr = 0.8 RhoLiq = 7.2 Time step = 20000
  • 25. Left- Periodic Right- Periodic Top- Wall moving at velocity +0.01 Bottom- Wall moving at velocity -0.01 Boundary conditions
  • 26. Couette flow at T = 20000
  • 27. -0.015 -0.01 -0.005 0 0.005 0.01 0.015 0 20 40 60 80 100 120 140 160 Series1 Velocity profile in couette flow after 20000 time steps
  • 28. Couette Flow- (Vapour bubble shear) Lattice units  L = 300  H = 150  Tau=1  Viscosity=0.1667  U = 2e-3 Tr = 0.9 RhoLiq = 5.83 Rhovap = 0.58 Radius of bubble initiated = 30 Time step = 10000
  • 29. Left- Periodic Right- Periodic Top- Wall moving at velocity +0.01 Bottom- Wall moving at velocity -0.01 Boundary conditions
  • 30. Couette flow at T = 50000 Vapour bubble shear at T = 0 Vapour bubble shear at T = 10000
  • 31. Wall contact Lattice units  L = 120  H = 120  Tau=1  Viscosity=0.1667 Tr = 0.9 RhoLiq = 5.83 Rhovap = 0.58 Radius of bubble initiated = 40 Bubble centre = (150,30) Wall adhesion parameter = 0 Gravity = 0 Time step = 10000
  • 32. Left- Pressure = Periodic Right- Pressure = Periodic Top- Wall Bottom- Wall Boundary conditions
  • 33. T = 0 T = 8000 T = 1500 T = 4000
  • 34.  Similarly verified for wall adhesion parameter gw = 0.1, 0.3  Presently, we are verifying for the pressure boundary conditions in cavitation problem.