Gilbert, Fall 2011

Biotransport Phenomena: Comsol Multiphysics Intro Rey/Gilbert, Fall 2011 Access to COMSOL Multyphysics for this Class • Download from: https://rc.u...
Author: Lynne Underwood
6 downloads 2 Views 1MB Size
Biotransport Phenomena: Comsol Multiphysics Intro Rey/Gilbert, Fall 2011

Access to COMSOL Multyphysics for this Class

• Download from: https://rc.usf.edu/isos/ • Request a license from: http://rc.usf.edu – Log in with your NetID – Faculty Sponsor NetID =  gilbert – Send Dr. Gilbert an email  immediatelly so he  knows you have  requested the software

COMSOL in the Past • FEMLAB – Partial Differential Equations Solver  for Finite Elements • Comsol Multiphysics – Gradually separating  from MATLAB • Today’s COMSOL Multiphysics completely  independent.  BUT, you can still use the  MATLAB interface to run.

Finite Analysis Methods • Finite Element Method  (FEM).   – Used by COMSOL (just  about everything) – FEM also good for  Structural Analysis

• Finite Differences.  Used  in High Frequency   Electromagnetics (FDTD) • Others: Combine Finite  with integration,  differences, fast,  moments, etc.

Alternatives to COMSOL Multiphysics Proprietary: • ANSYS • ADINA Multiphysics • Pumplix (CFD) • I.D.E.A.S (CFD + struct.)

Open Source: • ELMER Multiphysics • OpenFOAM (CFD) • SALOME Multiphysics

COMSOL Multiphysics 1. Define Dimensions (1D,  2D, 3D, or 2.5D) 2. Add Physics (Set  Equation System) 3. Define  Constants/Variables 4. Create Geometry 5. Choose Materials  (subdomain properties) 6. Boundary properties 7. Mesh (divide model into  finite elements) 8. Choose Solver 9. Plot Results

Tutorial Model (Navier‐Stokes) • CFD (Computational  Fluid Dynamics) • Backstep Model • C:\COMSOL42\models\ CFD_Module\Single‐ Phase_Tutorials • Intro to CFD: Pages 7‐26

cfd_introduction.book Page 7 Friday, April 29, 2011 8:50 AM

Tutorial Example - Backstep This tutorial model solves the incompressible Navier-Stokes equations in a backstep geometry. A characteristic feature of fluid flow in geometries of this kind is the recirculation region that forms where the flow exits the narrow inlet region. The model demonstrates the modeling procedure for laminar flows in the CFD Module. Model Geometry The model consists of a pipe connected to a block-shaped duct; see the figure below. Due to symmetry, it is sufficient to model one eighth of the full geometry. Outlet Wall Symmetry Wall

Symmetry

Inlet

Model geometry.

Domain Equation and Boundary Conditions The flow in the system is laminar and we can therefore use the Laminar Flow interface. The inlet flow is fully developed laminar flow, described by the corresponding inlet boundary condition. This boundary condition computes the flow profile for fully develop laminar flow in channels of arbitrary cross section. The boundary condition at the outlet sets a constant relative pressure. Fur thermore, the ver tical and inclined boundaries along the length of the geometry are symmetry boundaries. All other boundaries are solid walls described by a non-slip boundary condition.

Tutorial Example - Backstep

|7

cfd_introduction.book Page 8 Friday, April 29, 2011 8:50 AM

Results The figure below shows a combined surface and arrow plot of the flow velocity. This plot does not reveal the recirculation region in the duct immediately beyond the inlet pipe’s end. For this purpose, a streamline plot is more useful, as demonstrated in the next figure.

The velocity field in the backstep geometry.

8 | Tutorial Example - Backstep

cfd_introduction.book Page 9 Friday, April 29, 2011 8:50 AM

The recirculation region visualized using a velocity streamline plot.

The instructions below show how to formulate, solve and reproduce the plots above using the CFD Module.

M O D E L W I Z A RD The first step is to select the space dimension and the Laminar Flow interface for stationary studies. We can do this in the Model Wizard. 1 Go to the Model Wizard window. 2 Click Next

.

3 In the Add physics tree, select Fluid Flow>Single-Phase Flow>Laminar Flow (spf). 4 Click Next

.

5 In the Studies tree, select Preset Studies>Stationary

.

Tutorial Example - Backstep

|9

cfd_introduction.book Page 10 Friday, April 29, 2011 8:50 AM

6 Click Finish

.

We are now ready to star t the model set up.

GLOBAL DEFINITIONS

Parameters

Let us first define a parameter for the inlet velocity. We can use this parameter to run parametric studies. 1 In the Model Builder, right-click Global Definitions

and choose Parameters

.

2 Go to the Settings window for Parameters. 3 Locate the Parameters section, see the figure below. In the Parameters table, enter the following settings: NAME

EXPRESSION

DESCRIPTION

v0

1[cm/s]

Inlet velocity

10 | Tutorial Example - Backstep

cfd_introduction.book Page 11 Friday, April 29, 2011 8:50 AM

GEOMETRY 1 This section describes the details in the geometry definition. We can star t by defining the cylinder. Cylinder 1

1 In the Model Builder, right-click Model 1>Geometry 1

and choose Cylinder

.

2 Go to the Settings window for Cylinder. 3 Locate the Size and Shape section. In the Radius edit field, enter 2.5e-3. Tutorial Example - Backstep

| 11

cfd_introduction.book Page 12 Friday, April 29, 2011 8:50 AM

4 In the Height edit field, enter 1.5e-2. 5 Locate the Position section. In the x edit field, enter 0. 6 Locate the Axis section. In the z edit field, enter 0. 7 In the x edit field, enter 1.

8 Click the Build Selected button

.

Let us continue by defining the outlet section. Block 1

1 In the Model Builder, right-click Geometry 1

and choose Block

.

2 Go to the Settings window for Block. 3 Locate the Size and Shape section. In the Width edit field, enter 3e-2. 4 In the Depth edit field, enter 1e-2. 5 In the Height edit field, enter 1e-2. 6 Locate the Position section. In the x edit field, enter 1.5e-2. 7 In the y edit field, enter -5e-3.

12 | Tutorial Example - Backstep

cfd_introduction.book Page 13 Friday, April 29, 2011 8:50 AM

8 In the z edit field, enter -5e-3.

9 Click the Build Selected button

.

10Click the Zoom Extents button

on the Graphics toolbar.

We are now ready to form the composite geometry of the inlet and outlet channel. Union 1

1 In the Model Builder, right-click Geometry 1

and choose Boolean Operations>Union

.

2 Select the objects cyl1 and blk1 only. 3 Go to the Settings window for Union.

Tutorial Example - Backstep

| 13

cfd_introduction.book Page 14 Friday, April 29, 2011 8:50 AM

4 Locate the Union section. Clear the Keep interior boundaries check box.

5 Click the Build Selected button

14 | Tutorial Example - Backstep

.

cfd_introduction.book Page 15 Friday, April 29, 2011 8:50 AM

Due to symmetry, we can cut out one eighth of the geometry to represent the full solution. We can do this by first creating a prism of one eighth of a box around the geometry above, and then using the intersection Boolean operation. Work Plane 1

1 In the Model Builder, right-click Geometry 1

and choose Work Plane

.

2 Go to the Settings window for Work Plane. 3 Locate the Work Plane section. From the Plane list, select yz-plane . 4 From the 3D projection list, select Entire 3D geometry.

5 Click the Build Selected button

.

Bézier Polygon 1

1 In the Model Builder, click the Geometry node (below the Work Plane 1 node) and then the Zoom Extents button on the Graphics toolbar. 2 Right-click Geometry

(below the Work Plane 1 node) and choose Bézier Polygon

.

3 Go to the Settings window for Bézier Polygon. 4 Locate the Polygon Segments section. Click the Add Linear button. 5 Find the Control points subsection. In row 2, set y to 5e-3. 6 Click the Add Linear button. 7 In row 2, set x to 5e-3. 8 Click the Add Linear button. 9 Click the Close Curve button.

Tutorial Example - Backstep

| 15

cfd_introduction.book Page 16 Friday, April 29, 2011 8:50 AM

10Click the Build Selected button

16 | Tutorial Example - Backstep

.

cfd_introduction.book Page 17 Friday, April 29, 2011 8:50 AM

We can see below that the triangle that we have created, using the polygon tool, overlaps with one eighth of a fictive box around the geometry. We will use this to create the prism for the intersection Boolean operation.

Extrude 1

1 In the Model Builder, right-click Work Plane 1

and choose Extrude

.

2 Go to the Settings window for Extrude.

Tutorial Example - Backstep

| 17

cfd_introduction.book Page 18 Friday, April 29, 2011 8:50 AM

3 Locate the Distances from Work Plane section. In the associated table, enter the following settings: DISTANCES (M)

4.5e-2

4 Click the Build Selected button

18 | Tutorial Example - Backstep

.

cfd_introduction.book Page 19 Friday, April 29, 2011 8:50 AM

5 Click the Zoom Extents button

on the Graphics toolbar.

Intersection 1

1 In the Model Builder, right-click Geometry 1 Operations>Intersection .

and choose Boolean

2 Select the objects uni1 and ext1. You can do this by clicking one object in the graphics window to highlight it (red) , for example uni1 that is the union of the cylinder and the

Tutorial Example - Backstep

| 19

cfd_introduction.book Page 20 Friday, April 29, 2011 8:50 AM

block, and then right-clicking on it (it changes color to blue) to add it to the selection list. Repeat this for the second object.

3 Click the Build Selected button

.

4 Click the Zoom Extents button

on the Graphics toolbar.

20 | Tutorial Example - Backstep

cfd_introduction.book Page 21 Friday, April 29, 2011 8:50 AM

Form Union

1 In the Model Builder, right-click Form Union geometry is now complete.

and choose Build Selected

. The model

MATERIALS 1 In the Model Builder, right-click Model 1>Materials .

and choose Open Material Browser

2 Go to the Material Browser window. 3 Locate the Materials section. In the Materials tree, select Built-In>Water, liquid.

4 Right-click and choose Add Material to Model

from the menu.

We have now the physical proper ties that we need for our CFD simulation. This also defines the domain settings and we only need to specify the boundary conditions, which we will do below.

Tutorial Example - Backstep

| 21

cfd_introduction.book Page 22 Friday, April 29, 2011 8:50 AM

L A M I N A R F L OW

Inlet 1

1 In the Model Builder, right-click Model 1>Laminar Flow

and choose Inlet

.

2 Select Boundary 1 only, which represents the inlet. 3 Go to the Settings window for Inlet. 4 Locate the Boundary Condition section. From the Boundary condition list, select Laminar inflow. 5 Locate the Laminar Inflow section. In the Uav edit field, enter v0 (which we previously defined as a Global Parameter).

22 | Tutorial Example - Backstep

cfd_introduction.book Page 23 Friday, April 29, 2011 8:50 AM

Symmetry 1

1 In the Model Builder, right-click Laminar Flow

and choose Symmetry

.

2 Select Boundaries 2 and 3 only. Outlet 1

1 In the Model Builder, right-click Laminar Flow

and choose Outlet

.

The default outlet condition specifies a zero relative pressure. 2 Select Boundary 7 only. All other boundaries have now the default wall condition.

MESH 1 1 In the Model Builder, click Model 1>Mesh 1

.

2 Go to the Settings window for Mesh. 3 Locate the Mesh Settings section. From the Element size list, select Coarse .

The physics induced mesh will automatically introduce a mesh that is a bit finer on the walls compared to the free stream mesh. The close-up figure below shows the boundary layer mesh at the walls.

Tutorial Example - Backstep

| 23

cfd_introduction.book Page 24 Friday, April 29, 2011 8:50 AM

4 Click the Build All button

.

ST UD Y 1 1 In the Model Builder, right-click Study 1

and choose Compute

.

When we select Compute, COMSOL will automatically use a suitable solver for our problem.

RESULTS Two postprocessing plots are automatically created, one slice plot for the velocity and one pressure contour plot on the wall. We can proceed as follows to reproduce the first result plot. Velocity (spf)

1 In the Model Builder, expand the Velocity (spf) 2 Right-click Slice 1

and choose Delete.

24 | Tutorial Example - Backstep

node.

cfd_introduction.book Page 25 Friday, April 29, 2011 8:50 AM

3 Click Yes to confirm. UNTITLED.MPH

1 In the Model Builder, right-click Velocity (spf) 2 Right-click Velocity (spf)

and choose Surface

and choose Arrow Surface

.

.

3 Go to the Settings window for Arrow Surface. 4 Locate the Coloring and Style section. From the Arrow length list, select Logarithmic. 5 From the Color list, select Yellow. 6 Click the Zoom Extents button

on the Graphics toolbar.

To see the recirculation effects, create a streamline plot of the velocity field. 3D Plot Group 3

1 In the Model Builder, right-click Results 2 Right-click Results>3D Plot Group 3

and choose 3D Plot Group and choose Streamline

.

.

3 In the Graphics window, select Boundary 1 only and right-click it to add this boundary to the selection list in the Settings window for Streamline. The streamlines will now start at this boundary. 4 Go to the Settings window for Streamline. 5 Locate the Coloring and Style section. From the Line type list, select Tube. 6 Right-click Streamline 1

and choose Color Expression

. Tutorial Example - Backstep

| 25

cfd_introduction.book Page 26 Friday, April 29, 2011 8:50 AM

7 Click the Plot button

.

Now we can clearly see the wake formed behind the expansion section.

26 | Tutorial Example - Backstep