You are on page 1of 10

Created in COMSOL Multiphysics 5.

3a

Gravity and Boundary Conditions

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

Figure 1: A simple example of flow with gravity volume force.

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.

2 | GRAVITY AND BOUNDAR Y CONDITIONS


Pressure Profile
In a column of fluid, there is a hydrostatic pressure equal to −ρg(y − y0) where y0 is a
horizontal reference location (m). In this case y0 = 0. To specify this pressure profile at the
outlet, select the Pressure boundary condition for the Outlet feature and use the pressure
setting p0 = −gρ y (Pa).

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.

Integral Constraint for the Pressure


If you do not want to prescribe a pressure profile at the outlet, you can alternatively
prescribe vanishing viscous stresses at the outlet and combine them with an integral
constraint at the outlet. To do so, add an Open Boundary feature and select No viscous
stress as the boundary condition at the outlet. Also add an integral coupling variable and
a global constraint specifying

p = 0

3 | GRAVITY AND BOUNDARY CONDITIONS


The result is almost identical to the result in Figure 2 except that the pressure field has
shifted so that it is between -2500 Pa and +2500 Pa.

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

4 | GRAVITY AND BOUNDAR Y CONDITIONS


does not have any significant impact on small models where a direct solver can be applied,
but it can be of importance for larger models.

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.

Application Library path: CFD_Module/Single-Phase_Tutorials/


gravity_tutorial

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).

5 | GRAVITY AND BOUNDARY CONDITIONS


3 Click Add.
4 Click Study.
5 In the Select Study tree, select Preset Studies>Stationary.
6 Click Done.

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:

Property Variable Value Unit Property group


Density rho 1000[kg/m^3] kg/m³ Basic
Dynamic viscosity mu 1[Pa*s] Pa·s Basic

LAMINAR FLOW (SPF)

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 | GRAVITY AND BOUNDAR Y CONDITIONS


2 Select Boundary 1 only.
3 In the Settings window for Inlet, locate the Velocity section.
4 Click the Velocity field button.
5 Specify the u0 vector as

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.

7 | GRAVITY AND BOUNDARY CONDITIONS


RESULTS

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.

LAMINAR FLOW (SPF)


In the Model Builder window’s toolbar, click the Show button and select
Advanced Physics Options in the menu.

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.

8 | GRAVITY AND BOUNDAR Y CONDITIONS


Open Boundary 1
1 On the Physics toolbar, click Boundaries and choose Open Boundary.
2 Select Boundary 4 only.
3 In the Settings window for Open Boundary, locate the Boundary Condition section.
4 From the Boundary condition list, choose No viscous stress.
5 In the Model Builder window’s toolbar, click the Show button and clear
Advanced Physics Options in the menu.

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.

LAMINAR FLOW (SPF)


1 In the Model Builder window, under Component 1 (comp1) click Laminar Flow (spf).
2 In the Settings window for Laminar Flow, locate the Physical Model section.
3 Select the Include gravity check box.
4 Select the Use reduced pressure check box.
When Include gravity is selected a Gravity feature is automatically added. In this model the
default direction for the gravity vector can be used.

The manually added Volume fource feature can be disabled.

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

9 | GRAVITY AND BOUNDARY CONDITIONS


Global Constraint 1
In the Model Builder window, under Component 1 (comp1)>Laminar Flow (spf) right-click
Global Constraint 1 and choose Disable.

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

10 | GRAVITY AND BOUNDARY CONDITIONS

You might also like