Slide 0 - Classes - Oregon State University

advertisement
Introduction to COMSOL
Travis Campbell
Developed for CHE 331 – Fall 2012
Oregon State University
School of Chemical, Biological and Environmental Engineering
What is COMSOL?
• Course requirement
• Modeling and simulation software
• Tool for system design/optimization
• Method for checking work
A Brief History of Modeling Software
• “A computer model refers to the algorithms and equations
used to capture the behavior of the system being modeled.
However, a computer simulation refers to the actual running of
the program which contains these equations or algorithms.”1
http://en.wikipedia.org/wiki/Computer_model
• Developed rapidly with computers
• Influencing research
The General Idea Behind Numerical Modeling
• User builds a model with significant variables
• User builds a model mesh
• COMSOL solves the model numerically at
every mesh intersection
• Intersections are connected to provide
“continuous” data
How is the model solved at every intersection?
• Several methods exist - one example is the Finite Element
Method:
𝑑𝑦
π‘†π‘œπ‘™π‘£π‘’
= 2π‘₯ π‘€π‘–π‘‘β„Žπ‘œπ‘’π‘‘ π‘π‘Žπ‘™π‘π‘’π‘™π‘’π‘ !
𝑑π‘₯
1. 𝐿𝑒𝑑 𝑑𝑦 = 𝑦2 − 𝑦1
2. 𝐿𝑒𝑑 𝑑π‘₯ = π‘₯2 − π‘₯1
3. π‘†π‘œπ‘™π‘£π‘’ π‘“π‘œπ‘Ÿ 𝑦2
πΊπ‘’π‘œπ‘šπ‘’π‘‘π‘Ÿπ‘¦
𝐡𝐢
𝑦2 = 2π‘₯1 (π‘₯2 − π‘₯1 ) + 𝑦1
4. 𝑃𝑙𝑒𝑔 𝑖𝑛 π‘₯1 , π‘₯2 , 𝑦1
5. π‘…π‘’π‘π‘’π‘Žπ‘‘ 𝑛 π‘‘π‘–π‘šπ‘’π‘  π‘π‘Žπ‘ π‘’π‘‘ π‘œπ‘› π‘šπ‘’π‘ β„Ž 𝑠𝑖𝑧𝑒
Finite Element Method Results
y = x2
40
35
30
25
y
20
15
10
5
0
0
1
2
3
4
5
6
x
Analytical
delta x = 1
delta x = 2
delta x = 3
7
COMSOL Step by Step for 4 Models
•
•
•
•
•
Model 1 – Laminar Flow in a Pipe
Model 2 – Turbulent Flow in a Pipe
Model 3 – Laminar Flow between Parallel Plates
Model 4 – Flow of a Falling Film
These notes apply to Version 4.2, only!
COMSOL Model 1 – Laminar Flow in a Pipe
1.
2.
3.
4.
5.
Open COMSOL
Select Space Dimension 2D, click
Add Physics Laminar Flow,
click
Select Study Type Stationary, click
In Main Menu, select View > Desktop Layout > Reset
Desktop
MAIN MENU
MODEL BUILDER
MENU
MODEL
SUB MENU
GRAPHICS
COMSOL Model 1 – Laminar Flow in a Pipe
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
In Model Builder Menu, right-click Geometry 1 and select Rectangle
Select Rectangle 1
In Model Sub Menu, enter Width: 5 m, Height: 0.1 m
Click Build Selected
In Model Builder Menu, right-click Materials and select Open Material
Browser
In Model Sub Menu, select Liquids and Gases > Liquids > Water
Click Add Material to Model (click twice)
In Model Builder Menu, click Laminar Flow
In Model Sub Menu, select Physical Model > Compressibility >
Incompressible flow
In Model Builder Menu, right-click Laminar Flow and select Inlet
Select Inlet 1
COMSOL Model 1 – Laminar Flow in a Pipe
17. Define first Boundary Condition by describing the inlet velocity
(average velocity). On the Graphic, select the left boundary
18. In Model Sub Menu, click Add to Selection
19. In Model Sub Menu, select Boundary Condition > Velocity. Click
Normal Inflow Velocity. Enter Uo = 0.001 m/s.
20. In Model Builder Menu, right click Laminar Flow and select Outlet
21. Select Outlet 1
22. Define second Boundary Condition by describing the outlet
pressure. On the Graphic, select the right boundary
23. In Model Sub Menu, click Add to Selection
24. In Model Sub Menu, select Boundary Condition > Pressure, no
viscous stress. Enter po = 0 Pa.
COMSOL Model 1 – Laminar Flow in a Pipe
25. Add no slip conditions at the pipe walls. In Model Builder
Menu, click Laminar Flow > Wall 1
26. In Model Sub Menu, confirm that Boundaries 2, 3 only are
selected
27. In Model Sub Menu, select Boundary Condition > No slip
28. In Model Builder Menu, click Mesh
29. Select Physics-controlled mesh, Normal Element size
30. In Model Builder Menu, right-click Study 1 and select
Compute to simulate your model. Note the Reynolds
number:
πœŒπ‘’π‘™
𝑅𝑒 =
=
πœ‡
(1000
π‘˜π‘”
π‘š
)(0.001
𝑠 )(0.1 π‘š)
π‘š3
= 𝟏𝟎𝟎 (π‘™π‘Žπ‘šπ‘–π‘›π‘Žπ‘Ÿ π‘“π‘™π‘œπ‘€)
π‘˜π‘”
(0.001 π‘š βˆ™ 𝑠)
COMSOL Model 1 – Laminar Flow in a Pipe
Time required to run your simulation depends on many factors:
•
•
•
•
Processor speed
Connection speed
Model size
Mesh granularity
Results can be analyzed in many ways. We will find the velocity
profile as a function of pipe cross-section.
COMSOL Model 1 – Laminar Flow in a Pipe
31. In Model Builder Menu, expand Results. Right-click Data Sets and select Cut
Line 2D.
32. Select Cut Line 2D 1
33. In Model Sub Menu, select Data set > Solution 1 and enter Line Data:
x:
31.
32.
33.
34.
35.
36.
37.
38.
39.
Point 1:
Point 2:
y:
2.5
2.5
0
0.1
Click Plot
In Model Builder Menu, right-click Results and select 1D Plot Group
Select 1D Plot Group 1
In Model Sub Menu, select Data > Data set > Cut Line 2D 1
In Model Builder Menu, right-click 1D Plot Group 1 and select Line Graph
Select Line Graph 1
In Model Sub Menu, select Data > Data set > From parent
Confirm that the y-Axis Data is velocity, spf.U [m/s]
Click Plot
Result
COMSOL Step by Step Models to be completed
•
•
•
•
Model 1 – Laminar Flow in a Pipe
Model 2 – Turbulent Flow in a Pipe
Model 3 – Laminar Flow between Parallel Plates
Model 4 – Flow of a Falling Film
COMSOL Model 2 - Turbulent Flow in a Pipe
• Similar to Laminar Flow in a Pipe
• Differences:
•
•
•
•
3. Turbulent Flow (k-ε)
19. Enter Uo = 10 m/s
27. In Model Sub Menu, select Boundary Condition > Wall Functions
Re = 1e6
COMSOL Model 2 - Turbulent Flow in a Pipe
COMSOL Step by Step Models to be completed
•
•
•
•
Model 1 – Laminar Flow in a Pipe
Model 2 – Turbulent Flow in a Pipe
Model 3 – Laminar Flow between Parallel Plates
Model 4 – Flow of a Falling Film
COMSOL Model 3 – Laminar Flow between Parallel Plates
• Also similar to Laminar Flow in a Pipe
• Differences:
• 19. In Model Sub Menu, select Boundary Condition > Pressure, no viscous
stress. Enter po = 0 Pa. Note that both Inlet and Outlet Boundary Conditions
are zero pressure. What does this mean?
• After 19:
• In Model Builder Menu, right click Laminar Flow and select Wall
• Select Wall 2
• Define third Boundary Condition by describing the upper plate velocity. On the
Graphic, select the top boundary
• In Model Sub Menu, click Add to Selection
• In Model Sub Menu, select Boundary Condition > Moving Wall. Enter uw = (0.001, 0)
Pa.
• 26. In Model Sub Menu, confirm that Boundary 2 only is selected
COMSOL Model 3 – Laminar Flow between Parallel Plates
COMSOL Step by Step Models to be completed
•
•
•
•
Model 1 – Laminar Flow in a Pipe
Model 2 – Turbulent Flow in a Pipe
Model 3 – Laminar Flow between Parallel Plates
Model 4 – Flow of a Falling Film
COMSOL Model 4 – Flow of a Falling Film
• Most similar to Laminar Flow between Parallel Plates
• Differences:
• Make rectangle tall and skinny (W: 0.001 m, H: 0.05 m)
• Boundary conditions:
•
•
•
•
Wall 1 – No Slip
Wall 2 – Outlet, zero pressure
Wall 3 – Inlet, zero velocity
Wall 4 – Open boundary, zero normal stress
• Add Volume Force to Laminar Flow with -9810 N/m3 in the y-direction
• Make a horizontal cut line near the bottom of your geometry, to capture
the “fully developed” film flow
COMSOL Model 4 – Flow of a Falling Film
Download