Sie sind auf Seite 1von 7

reversed_flow_sbs.

book Page 6 Thursday, December 4, 2008 1:32 PM

terminates; otherwise the new design-variable values are used in the next calculation of
the flow problem.

Setting up this kind of model with a general optimization routine would require quite
a bit of work, but as you will discover, solving this problem with the built-in tools for
optimization in COMSOL Multiphysics is easy.

Model Library path: COMSOL_Multiphysics/Fluid_Dynamics/reversed_flow

Modeling Using the Graphical User Interface

MODE L NAVIGATOR
1 In the Model Navigator begin by clicking the Multiphysics button.
2 Select COMSOL Multiphysics>Fluid Dynamics>Incompressible Navier-Stokes, then click
Add.
3 Select COMSOL Multiphysics>Optimization and Sensitivity>Optimization, then click
Add.
4 Click OK to close the Model Navigator.

GEOMETRY MODELING
1 Create three rectangles according to the following table. For each rectangle,
Shift-click the Rectangle/Square button on the Draw toolbar; then specify width,
height, and corner position; and finally click OK.

WIDTH HEIGHT CORNER

2.5e-3 1e-3 (0, 0)


5e-3 1e-3 (2.5e-3, 0)
2.5e-3 1e-3 (7.5e-3, 0)

2 Click the Zoom Extents button to fit the model geometry to the drawing area.
3 Draw a point at the center of the channel by shift-clicking the Point button and then
entering 5e-3 and 0.5e-3 in the x and y edit fields, respectively.

The geometry should now look like that in Figure 1.

CONSTANTS AND EXPRESSIONS


1 From the Options menu, open the Constants dialog box.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 6
reversed_flow_sbs.book Page 7 Thursday, December 4, 2008 1:32 PM

2 Define constants according to the following table (the descriptions are optional):

NAME EXPRESSION DESCRIPTION

q 1 Optimization parameter
Da 1e-5 Darcy number
L 1[mm] Inlet height
rho 1e3[kg/m^3] Density of water
eta 1e-3[Pa*s] Viscosity of water
u0 10[mm/s] Flow velocity scale

The purpose of the constant u0 is to introduce a rough velocity scale that you can
use to make the objective function dimensionless with a value of the order 1.
3 Click OK to close the dialog box.
4 Choose Options>Expressions>Subdomain Expressions.
5 Select Subdomain 2, then enter names and expressions according to the following
table:

NAME EXPRESSION

alpha_max eta_ns/(Da*L^2)
alpha alpha_max*q*(1-gamma)/(q+gamma)

6 Click OK.

PHYSICS SETTINGS

Subdomain Settings—Incompressible Navier-Stokes


1 From the Model Tree or the Multiphysics menu, select the Incompressible
Navier-Stokes (ns) application mode.
2 From the Physics menu, open the Subdomain Settings dialog box.
3 Select all subdomains, and type rho in the Density edit field and eta in the Dynamic
viscosity edit field.
4 Select Subdomain 2, and type -alpha*u in the Volume force, x dir. edit field and
-alpha*v in the Volume force, y dir. edit field.

5 Click OK.

Boundary Conditions—Incompressible Navier-Stokes


In the next steps, you specify the pressure drop along the channel length by prescribing
the pressure at the inlet and at the outlet. The resulting pressure gradient drives the
flow in the channel.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 7
reversed_flow_sbs.book Page 8 Thursday, December 4, 2008 1:32 PM

1 From the Physics menu, open the Boundary Settings dialog box.
2 Enter the boundary conditions according to the following table:

SETTINGS BOUNDARY 1 BOUNDARY 10

Boundary type Inlet Outlet


Boundary condition Pressure, no viscous stress Pressure, no viscous stress
p0 2 0

Keep all other boundaries at the default condition, which is the no-slip condition.
3 Click OK.

Subdomain Settings—Optimization
1 From the Model Tree, select Optimization (opt).
2 Open the Subdomain Settings dialog box.
Only the center part of the channel geometry is needed in the optimization, so you
can deactivate the other subdomains.
3 Select Subdomains 1 and 3, and then clear the Active in this domain check box.
4 Select Subdomain 2 and go to the Variables page.
5 Edit the fields according to the following table:

VARIABLE INIT ELEMENT

gamma 1 Lagrange - Linear

This defines shape functions for gamma, which is the design variable used in the
optimization. The initial value 1 corresponds to a channel free from porous material.
In the next step, you constrain the design variable to the range [0, 1].
6 Click the Pointwise Constraints tab.
7 Type 0 in the lb field, gamma in the Expression field, and 1 in the ub field.
8 Click OK.

Point Settings—Optimization
1 Choose Physics>Point Settings.
2 Select Point 5 from the list. On the Objective page, type u/u0 in the q0 edit field.
This defines the objective function to be proportional to the x-component of the
velocity at the center and normalized by the velocity-scale constant u0.
3 Click OK.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 8
reversed_flow_sbs.book Page 9 Thursday, December 4, 2008 1:32 PM

MESH GENERATION
This model is naturally highly dependent on the mesh size. In this example, choose a
dense mesh; note, however, that this mesh can be further improved.

1 From the Mesh menu, open the Free Mesh Parameters dialog box.
2 On the Global page, click the Custom mesh size button.
3 In the Element growth rate edit field, type 1.1.
4 Click the Subdomain tab. Select all three subdomains.
5 In the Subdomain mesh parameters area, select Triangle from the Method list.
6 Select Subdomain 2 only, then set the Maximum element size to 0.12e-3.
7 On the Point page, select Point 5 and set the Maximum element size to 0.03e-3.
8 Click the Remesh button to generate the mesh.
9 When the mesher has finished, click OK to close the Free Mesh Parameters dialog box.

Computing the Solution—Static Flow


First solve the model for an empty channel (that is, with no porous material) to check
that the initial solution looks reasonable. Once you have established that this is the
case, you can use this solution as a starting point for the optimization. Note that, as an
alternative, it is possible to solve the full optimization problem in one go.

1 Click the Solver Parameters button on the Main toolbar.


2 From the Linear system solver list, select Direct (PARDISO).

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 9
reversed_flow_sbs.book Page 10 Thursday, December 4, 2008 1:32 PM

3 Make sure that Optimization/Sensitivity is not selected.

4 Click OK to close the Solver Parameters dialog box.


5 Click the Solve button to compute the solution.

The default plot shows the velocity field in the channel.

COMPUTING THE SOLUTION—OPTIMIZATION


1 Open the Solver Parameters dialog box.
2 Select the Optimization/Sensitivity check box, then click the Optimization/Sensitivity
tab.
3 From the Analysis list, select Optimization.
4 On the Stationary page, clear the Highly nonlinear problem check box. The reason
behind this setting is that the model already has the correct solution for the starting
point of the optimization. It assumes that at each optimization step the solution
from the previous step is a good initial guess of the solution. If this assumption is
not correct, it may be necessary to select the Highly nonlinear problem check box.
5 Click OK to close the Solver Parameters dialog box.
6 Open the Solver Manager.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 10
reversed_flow_sbs.book Page 11 Thursday, December 4, 2008 1:32 PM

7 On the Initial Value page, click the Current solution button in the Initial value area,
then click OK.
8 Click the Solve button on the Main toolbar to solve the model.

The optimization routine requires approximately 90 steps requiring about 150 model
evaluations and takes about 10 to 15 minutes depending on the computer.

PO S T P RO C E S S I N G A N D V I S U A L I ZAT I O N
The default plot shows the velocity field. To evaluate the horizontal velocity in the
center of the channel, follow these steps:

1 Choose Postprocessing>Point Evaluation.


2 Select Point 5 from the list.
3 In the Expression edit field, enter u.
4 Click OK.

The value appears in the lower part of the interface and should be about −0.013 m/s.

To plot the design variable, γ, as seen in Figure 2, do the following:

1 Click the Plot Parameters button on the Main toolbar.


2 Click the Surface tab. Type gamma in the Expression edit field on the Surface Data page
or select Optimization (opt)>gamma from the Predefined quantities list.
3 Click Apply to generate the plot.
4 Click the Zoom In button on the Main toolbar twice to zoom in on the geometry.

To generate the pressure plot in Figure 4 proceed as follows:

1 Still on the Surface Data page, change the text in the Expression edit field to p.
2 Click Apply.

Finally, generate Figure 3 with the following instructions:

1 Change the text in the Expression edit field to u (or select Incompressible
Navier-Stokes (ns)>x-velocity from the Predefined quantities list).
2 From the Unit list, select mm/s.
3 Click the Contour tab and select the Contour plot check box.
4 On the Contour Data page, type gamma in the Expression edit field.
5 In the Contour levels area, click the Vector with isolevels option button and then type
0.5 in the associated edit field.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 11
reversed_flow_sbs.book Page 12 Thursday, December 4, 2008 1:32 PM

6 In the Contour color area, click first the Uniform color option button and then the
Color button.
7 In the Contour Color dialog box select black, then click OK.
8 Clear the Color legend check box.
9 Click the Streamline tab and select the Streamline plot check box.
10 Leave the default selection (Velocity field) on the Streamline Data page.
11 From the Streamline plot type list, select Magnitude controlled.
12 On the Density page, set the Density to 10.
13 On the Line Color tab, click the Color button.
14 In the Streamline Color dialog box select white, then click OK.
15 In the Plot Parameters dialog box, click OK to close the dialog box and generate the
plot.

E X A M P L E — M I N I M I Z I N G T H E F L O W VE L O C I T Y I N A M I C R O C H A N N E L | 12

Das könnte Ihnen auch gefallen