Avity Tutorial
Avity Tutorial
3a
This model is licensed under the COMSOL Software License Agreement 5.3a.
All trademarks are the property of their respective owners. See www.comsol.com/trademarks.
Introduction
The setup of fluid-flow models involving gravity requires some careful manipulation of the
boundary conditions. Presented in the form of an example model included in the
Application Libraries, the following section contains a discussion about this specific type
of problem, which is relevant for, among other things, the modeling of free convection.
The influence of gravity on the flow pattern is often an important issue when modeling
flow in fluids with variable density. You can account for this influence in the model
equations by adding to the momentum balances the volume force ρg, where ρ denotes
density (SI unit: kg/m3) and g the gravity vector (SI unit: m/s2). To do this manually in
any of the CFD Module’s physics interfaces for free fluid flow, enter the components of
this vector in the Volume force text fields in the Settings window for Volume Force.
Alternatively, for automatic inclusion of the gravity volume force, you can also select the
Include gravity property available in the Single-Phase Flow interfaces.
When adding gravity, you have to be careful when setting up boundary conditions at the
outlets. The following example demonstrates some possible boundary settings for this type
of problems.
Model Geometry
Consider a horizontal channel of width 0.5 m and length 2 m (see Figure 1).The gravity
vector g is aligned in the negative y direction, that is, Fy = −ρg. In this case, the fluid has
a dynamic viscosity, μ, of 1.0 Pa·s and a density, ρ, of 1000 kg/m3.
Wall
Fy = −(9.81m/s2)·ρ Outlet
1 m/s
Wall
Assume that the channel continues on the outlet side, which means that the fluid leaves
the domain following horizontal streamlines. Three alternatives to simulate this behavior
are discussed below: an outlet pressure profile, an integral pressure constraint also at the
outlet, or a pressure shift.
Figure 2 shows the simulated result, where p = 0 at y = 0 and where flow exits straight out
of the domain as expected.
Figure 2: The pressure and velocity field with a prescribed pressure profile at the outlet.
p = 0
This approach can be useful for advanced body forces where it can be difficult to find the
correct pressure profile to prescribe at the outlet. It does however result in a less robust
equation system, so it should be regarded as a last resort rather than a standard method.
Pressure Shift
Much of the pressure gradient is present only to balance the hydrostatic pressure. For
incompressible flows, as is the case here, you can use this knowledge to introduce a shift
in the pressure variable. The theory, described in the sections Gravity and Boundary
Conditions in the CFD Module User’s Guide, implies that the pressure, p, is replaced by
a new pressure variable called reduced pressure.
The result appears in Figure 3, which shows that the hydrostatic pressure gradient has
been removed and only the pressure gradient necessary to drive the flow remains. In
addition to making it easier to prescribe the outlet pressure, this method also results in
equation systems with better condition numbers compared to including the gravity. This
Figure 3: Solution to the problem outlined in Figure 1 with a shift in the pressure variable and
zero normal stress prescribed on the outlet.
Modeling Instructions
From the File menu, choose New.
NEW
In the New window, click Model Wizard.
MODEL WIZARD
1 In the Model Wizard window, click 2D.
2 In the Select Physics tree, select Fluid Flow>Single-Phase Flow>Laminar Flow (spf).
GEOMETRY 1
Rectangle 1 (r1)
1 On the Geometry toolbar, click Primitives and choose Rectangle.
2 In the Settings window for Rectangle, locate the Size and Shape section.
3 In the Width text field, type 2.
4 In the Height text field, type 0.5.
5 Click Build All Objects.
MATERIALS
Material 1 (mat1)
1 In the Model Builder window, under Component 1 (comp1) right-click Materials and
choose Blank Material.
2 Right-click Material 1 (mat1) and choose Rename.
3 In the Rename Material dialog box, type Fluid in the New label text field.
4 Click OK.
5 In the Settings window for Material, locate the Material Contents section.
6 In the table, enter the following settings:
Fluid Properties 1
Because you have added a material to the model, you can leave the default settings in the
Fluid Properties section.
Inlet 1
1 On the Physics toolbar, click Boundaries and choose Inlet.
6*s*(1-s)*1 x
0 y
First account for gravity by adding a Volume Force feature, and manually specifying the
volume force components.
Volume Force 1
1 On the Physics toolbar, click Domains and choose Volume Force.
2 Click in the Graphics window and then press Ctrl+A to select all domains.
3 In the Settings window for Volume Force, locate the Volume Force section.
4 Specify the F vector as
0 x
-g_const*spf.rho y
Due to gravity the pressure along the outlet boundary varies. Account for this by applying
a corresponding hydrostatic pressure profile.
Outlet 1
1 On the Physics toolbar, click Boundaries and choose Outlet.
2 Select Boundary 4 only.
3 In the Settings window for Outlet, locate the Pressure Conditions section.
4 In the p0 text field, type -g_const*spf.rho*y.
Here, the quantity spf.rho is the density variable defined by the Single-Phase Flow
interface with tag spf.
MESH 1
1 In the Model Builder window, under Component 1 (comp1) click Mesh 1.
2 In the Settings window for Mesh, click Build All.
STUDY 1
On the Home toolbar, click Compute.
Surface
1 In the Model Builder window, expand the Results>Velocity (spf) node, then click Surface.
2 In the Settings window for Surface, click Replace Expression in the upper-right corner of
the Expression section. From the menu, choose Model>Component 1>Laminar Flow>
Velocity and pressure>p - Pressure.
Streamline 1
1 In the Model Builder window, under Results right-click Velocity (spf) and choose
Streamline.
2 Select Boundary 1 only.
3 On the Velocity (spf) toolbar, click Plot.
4 Click the Zoom Extents button on the Graphics toolbar.
The resulting pressure and velocity streamlines should look like Figure 2.
To avoid prescribing the pressure profile on the outlet, an integral constraint for the
pressure can instead be used.
DEFINITIONS
Integration 1 (intop1)
1 On the Definitions toolbar, click Component Couplings and choose Integration.
2 In the Settings window for Integration, locate the Source Selection section.
3 From the Geometric entity level list, choose Boundary.
4 Select Boundary 4 only.
Global Constraint 1
1 On the Physics toolbar, click Global and choose Global Constraint.
2 In the Settings window for Global Constraint, locate the Global Constraint section.
3 In the Constraint expression text field, type intop1(p).
Combine the integral constraint for the pressure with an Open boundary node, prescribing
vanishing viscous stress (but applying no pressure condition) at the outlet.
STUDY 1
1 On the Home toolbar, click Compute.
Now, enable gravity using the Include gravity property. Also select Reduced pressure to
introduce a pressure shift. The computed pressure now consist of the pressure relative to
the hydrostatic pressure.
Volume Force 1
1 In the Model Builder window, under Component 1 (comp1)>Laminar Flow (spf) right-click
Volume Force 1 and choose Disable.
Solving for the Reduced pressure, a constant pressure level (relative to the hydrostatic
pressure) can be prescribed at the outlet.
Outlet 1
1 In the Model Builder window, under Component 1 (comp1)>Laminar Flow (spf) click
Outlet 1.
2 In the Settings window for Outlet, locate the Pressure Conditions section.
3 In the p0 text field, type 0.
Also disable The Global Constraint 1, and the Open boundary 1 nodes
Open Boundary 1
In the Model Builder window, under Component 1 (comp1)>Laminar Flow (spf) right-click
Open Boundary 1 and choose Disable.
STUDY 1
On the Home toolbar, click Compute.
RESULTS
Velocity (spf)
1 Click the Zoom Extents button on the Graphics toolbar.
The results should now look as in Figure 3