Está en la página 1de 29

Tutorial: 2D Adiabatic Compression (Remeshing and Spring

Smoothing)

Introduction
This tutorial illustrates the setup and solution of a basic deforming mesh in FLUENT 6.2
using the remeshing and spring-based smoothing approaches.
In this tutorial you will learn how to:
• Set up a problem for a dynamic mesh

• Specify dynamic mesh modeling parameters

• Specify the motion of dynamic zones

• Preview the dynamic mesh before starting the calculation

• Perform basic dynamic mesh calculations with residual plotting

• Examine the temperature and density fields using graphics

The dynamic mesh model in FLUENT can be used to model flows where the shape of the
domain changes with time due to motion on the domain boundaries. The motion can be
either a prescribed motion (e.g., you can specify the linear and angular velocities about the
center of gravity of a solid body with time), or an unprescribed motion where the subsequent
motion is determined by a user-defined function (UDF). The update of the volume mesh
is handled automatically by FLUENT at each time step based on the new positions of the
boundaries. To use the dynamic mesh model, you need to provide a starting volume mesh
and the description of the motion of any moving zone in the model.
In this tutorial, you will use the spring-based smoothing and remeshing mesh motion meth-
ods to update the volume mesh in the deforming region. For zones with a triangular or
tetrahedral mesh, spring-based smoothing can be used to adjust the interior node locations
based on known displacements at the boundary nodes. The spring-based smoothing method
updates the volume mesh without changing the mesh connectivity.
When the boundary displacement is large compared to the local cell sizes, the cell quality
may deteriorate or the cells may become degenerate. This leads to convergence problems
when the solution is updated to the next time step. To circumvent this problem, FLU-
ENT agglomerates poor-quality cells (cells that are too large, too small, or are excessively
stretched) and locally remeshes the agglomeration.


c Fluent Inc. June 17, 2005 1
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Prerequisites
This tutorial assumes that you are familiar with the FLUENT interface and that you have
a good understanding of the basic setup and solution procedures. In this tutorial, you will
use the dynamic mesh model. If you have not used this model before, refer to Section 10.6:
Dynamic Meshes in the FLUENT 6.2 User’s Guide.

Problem Description
The problem to be considered is shown schematically in Figure 1. A simplified 2D geom-
etry consisting of a box is used. The bottom wall of the box represents the piston which
moves upward from the bottom dead center position (BDC), slowly compressing the fluid
adiabatically. After reaching the top dead center (TDC), the piston moves back downward
to the initial position, to complete a cycle.

Figure 1: Schematic of the Problem

Preparation

1. Copy the file, box2d remesh.msh to your working directory.

2. Start the 2D version of FLUENT.

2
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Setup and Solution


Step 1: Grid

1. Read the mesh file (box2d remesh.msh.gz).


File −→ Read −→Case...
As the mesh file is read in, messages appear in the console window reporting the
progress of the reading.

2. Check the grid.


Grid −→Check
FLUENT performs various checks on the mesh and reports the progress in the console
window. Pay attention to the reported minimum volume and make sure this is a
positive number.

3. Display the grid (Figure 2).


Display −→Grid...

(a) Under Surfaces, select all the surface zones.


(b) Click Display and close the panel.
Extra: Use the right mouse button to check the zone number corresponding to
each boundary. When you click the right mouse button on one of the bound-
aries in the graphics window, its zone number, name, and type are printed
in the FLUENT console window. This feature is especially useful when you
have several zones of the same type and you want to distinguish between them
quickly.


c Fluent Inc. June 17, 2005 3
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Grid
FLUENT 6.2 (2d, segregated, lam)

Figure 2: Grid Display

4
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Step 2: Models

1. Enable a time-dependent calculation.


Define −→ Models −→Solver...

(a) Under Time, select Unsteady.


(b) Retain the default Unsteady Formulation of 1st-Order Implicit.
Dynamic mesh simulations currently work only with first-order time advance-
ment.


c Fluent Inc. June 17, 2005 5
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Step 3: Materials
The only material property you need to modify is density. The default values for all other
properties are acceptable.

1. Specify that the flow is compressible.


Define −→Materials...

(a) Select ideal-gas in the drop-down list for Density.


(b) Click Change/Create and close the panel.
FLUENT automatically enables the energy equation when the ideal-gas law is
selected, so you need not visit the Energy panel.

Step 4: Boundary Conditions

In this tutorial, you need not visit the Boundary Conditions panel to set any conditions.
You will use the default adiabatic thermal conditions for all walls. No inlets or outlets are
present. Dynamic mesh motion and other related parameters are specified using the items
in the Define/Dynamic Mesh submenu, not through the Boundary Conditions panel. You will
set these conditions in the next step.

6
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Step 5: Mesh Motion Setup

1. Enable dynamic mesh motion and specify the associated parameters.


Define −→ Dynamic Mesh −→Parameters...

(a) Under Models, enable Dynamic Mesh.


The panel expands to show additional inputs.

(b) Under Models, enable In-Cylinder.


Enabling the In-Cylinder option allows input for IC-specific needs, including valve
and piston motion.
(c) Under Mesh Methods, enable Smoothing and Remeshing.
Make sure the Layering option is disabled.
(d) Retain the default settings for the smoothing parameters.
(e) Click the Remeshing tab.
The Remeshing parameters are displayed.


c Fluent Inc. June 17, 2005 7
2D Adiabatic Compression (Remeshing and Spring Smoothing)

i. Under Options, retain the default settings for Size Function and Must Improve
Skewness.
By default, the Size Function option is disabled and the Must Improve Skew-
ness option is enabled.
ii. Specify the Minimum Length Scale and the Maximum Length Scale.
If a cell exceeds these limits, the cell is marked for remeshing. Hence, you
need to specify problem-specific values for these remeshing parameters.
A. Click Mesh Scale Info....
The Mesh Scale Info panel opens. The values displayed for minimum and
maximum length scale, and maximum cell skewness are obtained from
the initial mesh.
B. Specify the values for Minimum Length Scale and Maximum Length Scale
as obtained from the Mesh Scale Info panel.
For a uniform mesh as in this problem, the values obtained from the
Mesh Scale Info panel are sufficient. For a non-uniform mesh, you can
use these values as an initial approximation and later modify the values
to improve the mesh quality.
iii. Set the Maximum Cell Skewness to 0.5.
A value of 0.6 to 0.7 is recommended for Maximum Cell Skewness for 2D
problems. Smaller values of maximum skew result in improved grid quality
at increased computational cost.

8
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(f) Set the In-Cylinder parameters.


i. Click the In-Cylinder tab.
The In-Cylinder parameters are displayed.

ii. Set the Crank Shaft Speed to 10 rpm.


This simulation is run at low speed to approximate the ideal process.
iii. Set the Starting Crank Angle to 180 degrees.
The piston is currently at the bottom dead center (BDC) position. The BDC
position is defined as 180 degrees crank angle, while the top dead center
(TDC) position is defined as 0 degrees crank angle.
iv. Retain the default Crank Period of 720 degrees.
A value of 720 degrees is used for four-stroke engines, while a value of 360
degrees is used for two-stroke engines. This governs the periodicity associated
with valve events and valve lift profiles.
v. Set the Crank Angle Step Size to 0.5 degrees.
This value is used along with the crankshaft speed to determine the timestep.
vi. Set the Piston Stroke to 8 m.
vii. Set the Connecting Rod Length to 14 m.
viii. Set both the Piston Stroke Cutoff and Minimum Valve Lift to 0 m.
These two parameters are not utilized in the current simulation.
ix. Click OK.


c Fluent Inc. June 17, 2005 9
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(g) Plot the piston motion profile using the text command interface as shown.
You may need to press the <Enter> key to get the > prompt.

> define/models/dynamic-mesh-controls

/define/models/dynamic-mesh-controls> icp

/define/models/dynamic-mesh-controls/in-cylinder-parameter> ppl
#f
Lift Profile:(1) [()] **piston-full**
Lift Profile:(2) [()] <Enter>
Start: [180] 0
End: [720] <Enter>
Increment: [10] 5
Plot lift? [yes] <Enter>

/define/models/dynamic-mesh-controls/in-cylinder-parameter>

The **piston-full** profile (Figure 3) describes piston motion in terms of the


Piston Stroke and Connecting Rod Length parameters defined previously.

8.00e+00

7.00e+00

6.00e+00

5.00e+00

4.00e+00

3.00e+00

2.00e+00

1.00e+00

0.00e+00
0 100 200 300 400 500 600 700 800

Crank Angle (deg)

Valve Lifts (Time=0.0000e+00)


FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 3: The **piston-full** Profile

10
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

2. Specify the motion of the piston and the deforming wall.


Define −→ Dynamic Mesh −→Zones...

(a) Specify the motion of the piston.

i. In the Zone Names drop-down list, select moving wall.


ii. Under Type, retain the default selection of Rigid Body.
iii. Under the Motion Attributes tab, set the following:
A. In the Motion UDF/Profile drop-down list, select **piston-full**.
B. Set the Valve/Piston Axis to (0, 1).
iv. Click the Meshing Options tab and set the following:
A. Set the Cell Height to 1.0 m.
B. Click Create.


c Fluent Inc. June 17, 2005 11
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(b) Specify the motion of the deforming wall (side walls).


The declaration of the deforming boundary zones is necessary only for boundary
zones adjacent to the cell zones that are remeshed.
i. In the Zone Names drop-down list, select side walls.

ii. Under Type, select Deforming.


iii. Click the Geometry Definition tab and set the following:
A. Select cylinder in the Definition drop-down list.
B. Enter a Cylinder Radius of 4 m.
C. Set the Cylinder Origin to (4, 0).
D. Set the Cylinder Axis to (0, 1).

12
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

iv. Click the Meshing Options tab and set the following:

To determine the Minimum Length Scale and the Maximum Length Scale, you
need to know the approximate average length scale. The average length scale
can be calculated using the length scale values in the Zone Scale Info panel.
Click Zone Scale Info... to open the Zone Scale Info panel. For this case, the
average length scale is 0.65.
A. Specify the Minimum Length Scale as 0.26.
The Minimum Length Scale is recommended to be (0.4 × 0.65) where 0.65
is the average length scale.
B. Specify the Maximum Length Scale as 0.91.
The Maximum Length Scale is recommended to be (1.4 × 0.65) where 0.65
is the average length scale.
C. Click Create.
v. Close the Dynamic Mesh Zones panel.


c Fluent Inc. June 17, 2005 13
2D Adiabatic Compression (Remeshing and Spring Smoothing)

3. Preview the zone motion.


The zone motion preview utility is useful for quickly checking the rigid body motion set-
tings. The mesh coordinates are not actually modified during this procedure. Instead,
dynamic zones with rigid body motion settings are simply translated in the display
window to emulate the actual grid motion. User errors such as an improperly scaled
mesh or valve lift profile, incorrect valve/piston axis definition, etc., can be quickly
identified using this procedure. Only the motion of zones with rigid body motion is
represented, remeshing on deforming zones is not depicted.
(a) Display the grid outline.
Display −→Grid...
i. Deselect all surfaces.
ii. Click the Outline button to select the outline surfaces.
iii. Click Display to display the grid outline.
iv. Close the Grid Display panel.
(b) Initiate the zone motion.
Display −→Zone Motion...

i. Retain the settings for Motion History Integration and click Integrate.
This allows FLUENT to create a table of surface positions in time.

14
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

The Preview Controls are highlighted.


ii. Retain the default settings for Preview Controls and click Preview.
If the case is set up properly, you should see the piston move through two
complete cycles.
iii. Close the Zone Motion panel.

Step 6: Solution Setup

1. Enable the plotting of volume-averaged temperature in the domain during the calcu-
lation by defining a volume monitor.
Solve −→ Monitors −→Volume...
The Volume Monitors panel is displayed.
(a) Increase the number of Volume Monitors to 1.
(b) Enable Plot, Print, and Write for the first monitor (vol-mon-1).
When the Write option is enabled, the volume-averaged temperature history is
written to a file. If you do not select the Write option, the history information
will be lost when you exit FLUENT.
(c) In the Every drop-down list, select Time Step for the monitor frequency.
(d) Click Define... to define the monitor.
The Define Volume Monitor panel opens automatically.


c Fluent Inc. June 17, 2005 15
2D Adiabatic Compression (Remeshing and Spring Smoothing)

i. Select Volume-Average in the Report Type drop-down list.


ii. Select Flow Time in the X Axis drop-down list.
iii. Select Temperature... and Static Temperature in the Field Variable drop-down
lists.
iv. Under Cell Zones, select fluid.
v. In the File Name field, enter vol-monitor-1.out.
vi. Click OK in the Define Volume Monitor panel, and then in the Volume Mon-
itors panel.

16
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

2. Enable the plotting of residuals during the calculation.


Solve −→ Monitors −→Residual...

(a) Under Options, enable Plot.


(b) Under Plotting, set Iterations to 100.
To avoid a cluttered residual plot in transient simulations, it is useful to display
only the most recent iterations.
(c) Click OK to close the Residual Monitors panel.


c Fluent Inc. June 17, 2005 17
2D Adiabatic Compression (Remeshing and Spring Smoothing)

3. Initialize the solution.


Solve −→ Initialize −→Initialize...

The solution is initialized at this point in the problem setup so that the contours for
setting up the view for the animation can be displayed.
(a) Retain the default values for all variables, including an initial Temperature value
of 300 K.
(b) Click Apply.
The Apply button does not initialize the flow field data. It only allows you to
save the initialization parameters for later use. You need to use the Init button
to initialize the solution.
(c) Click Init to initialize the solution.
(d) Click Close.

18
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

4. Set up an animation for temperature.


(a) Display filled contours of temperature (Figure 4).
Display −→Contours ...

i. Select Temperature... and Static Temperature in the Contours of drop-down


lists.
ii. Under Options, select only Filled and Node Values.
iii. Enter 300 for Min and 500 for Max.
iv. Click Display.
v. Close the Contours panel.


c Fluent Inc. June 17, 2005 19
2D Adiabatic Compression (Remeshing and Spring Smoothing)

5.00e+02
4.90e+02
4.80e+02
4.70e+02
4.60e+02
4.50e+02
4.40e+02
4.30e+02
4.20e+02
4.10e+02
4.00e+02
3.90e+02
3.80e+02
3.70e+02
3.60e+02
3.50e+02
3.40e+02
3.30e+02
3.20e+02
3.10e+02
3.00e+02

Contours of Static Temperature (k) (Time=0.0000e+00)


FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 4: Contours of Static Temperature

(b) Save the current view.


Display −→Views...

i. Click Save to save the current view as view-0.


ii. Close the Views panel.

20
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(c) Specify the commands for animation.


Solve −→Execute Commands...

i. Set Defined Commands to 1.


ii. Select the On checkbox for command-1.
iii. Under Every, specify 10.
iv. Select Time Step in the When drop-down list.
v. Under Command, enter the following commands sequentially (in a single
line):
/di/sw 2
/di/view/restore-view view-0
/di/cont temp 300 570
/di/hc temperature%t.tiff
It is possible to specify multiple text commands in a single entry. Be sure to
maintain at least a single space between commands. The above command will
first activate ‘window 2’, restore the saved view ‘view-0’, display contours of
static temperature and then make a hardcopy of the resulting image. The
‘%t’ appended to the file name instructs FLUENT to append the timestep
index to the filename.
vi. Click OK.


c Fluent Inc. June 17, 2005 21
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(d) Set hardcopy settings.


File −→Hardcopy...
The Graphics Hardcopy panel is displayed.
i. Under Format, select TIFF.
ii. Under Coloring, select Color.
iii. Click Apply and close the panel.

5. Request saving of case and data files every 90 time steps.


File −→ Write −→Autosave...

(a) Set the Autosave Case File Frequency and Autosave Data File Frequency to 90.
Since the mesh changes during the simulation, you must save both the case and
data files.
(b) In the Filename field, enter box2d remesh and click OK.
When FLUENT saves a file, it appends the time step value to the file name prefix
(box2d remesh). The standard extensions (.cas and .dat) are also appended.

22
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

6. Set the solution parameters.


Solve −→ Controls −→Solution...

(a) Set the Under-Relaxation Factors for Pressure and Momentum to 0.6 and 0.9
respectively.
(b) Under Discretization, select PRESTO! for Pressure.
(c) Under Pressure-Velocity Coupling, select PISO.
i. Set the Skewness Correction to 0.
ii. Retain the default settings for the other parameters.
(d) Click OK.


c Fluent Inc. June 17, 2005 23
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Step 7: Mesh Preview

1. Save the case file.


Since the mesh changes during the preview, ensure that you save the case before mesh
preview.

2. Display the grid.


Display −→Grid...

(a) Select all the surfaces.


(b) Click Display.
(c) Close the Grid Display panel.

3. Set up the mesh preview.


Solve −→Mesh Motion...

The Time Step Size displayed in the read-only text field (0.008333333) corresponds to
1
2 degree crank angle and is based on the crankshaft speed and crank angle increment
parameters defined earlier.
(a) Specify the Number of Time Steps as 720.
This corresponds to one full revolution of the crankshaft.
(b) Click Preview to preview the mesh motion.
As the mesh is updated by FLUENT, messages appear in the console window
reporting the progress of the update.

24
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Step 8: Solution

1. Read the case file back into FLUENT.


File −→ Read −→Case...

2. Initialize the solution.


Solve −→ Initialize −→Initialize...
(a) Click Init.
(b) Close the Solution Initialization panel.

3. Start the calculation.


Solve −→Iterate...

(a) Set the Number of Time Steps to 720.


(b) Set the Max Iterations per Time Step to 10.
(c) Click Iterate.
The plot for volume-averaged temperature is shown in Figure 5. The values may be
different for different computers. Hence, the plot that appears on your screen may not
be exactly the same as the one shown here.


c Fluent Inc. June 17, 2005 25
2D Adiabatic Compression (Remeshing and Spring Smoothing)

Monitors
vol-mon-1
600.0000

550.0000

500.0000

450.0000

Volume
Weighted 400.0000
Average
(k)
350.0000

300.0000

250.0000
0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000

Flow Time

Convergence history of Static Temperature on fluid (Time=6.0000e+00)


Crank Angle=540.00(deg) FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 5: Convergence History of Static Temperature

Step 9: Postprocessing

1. Inspect the solution at the bottom dead center (final time step).
(a) Display filled contours of static temperature (Figure 6).
Display −→Contours...
i. Select Temperature... and Static Temperature in the Contours of drop-down
lists.
ii. Under Options, select only Filled and Node Values.
iii. Enter 300 for Min and 500 for Max.
iv. Click Display.
(b) Display filled contours of density (Figure 7).
i. Select Density... and Density in the Contours of drop-down lists,
ii. Under Options, select only Filled and Node Values.
iii. Enter 1.18 for Min and 5.88 for Max.
iv. Click Display.
The temperature and density at the end of one full cycle closely replicate those
at the beginning of the simulation.

26
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

5.00e+02
4.90e+02
4.80e+02
4.70e+02
4.60e+02
4.50e+02
4.40e+02
4.30e+02
4.20e+02
4.10e+02
4.00e+02
3.90e+02
3.80e+02
3.70e+02
3.60e+02
3.50e+02
3.40e+02
3.30e+02
3.20e+02
3.10e+02
3.00e+02

Contours of Static Temperature (k) (Time=6.0000e+00)


Crank Angle=540.00(deg) FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 6: Contours of Static Temperature at Bottom Dead Center (final time step)

5.88e+00
5.64e+00
5.41e+00
5.18e+00
4.94e+00
4.70e+00
4.47e+00
4.24e+00
4.00e+00
3.77e+00
3.53e+00
3.30e+00
3.06e+00
2.83e+00
2.59e+00
2.36e+00
2.12e+00
1.88e+00
1.65e+00
1.41e+00
1.18e+00

Contours of Density (kg/m3) (Time=6.0000e+00)


Crank Angle=540.00(deg) FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 7: Contours of Density at Bottom Dead Center (final time step)


c Fluent Inc. June 17, 2005 27
2D Adiabatic Compression (Remeshing and Spring Smoothing)

2. Inspect the solution at the top dead center.


(a) Read in the case and data files corresponding to the TDC position (box2d remesh0360.cas
and box2d remesh0360.dat).
File −→ Read −→Case & Data...
(b) Display filled contours of static temperature (Figure 8).
i. Under Options, select only Filled and Node Values.
ii. Enter 300 for Min and 500 for Max.
iii. Click Display.

5.88e+00
5.64e+00
5.41e+00
5.18e+00
4.94e+00
4.70e+00
4.47e+00
4.24e+00
4.00e+00
3.77e+00
3.53e+00
3.30e+00
3.06e+00
2.83e+00
2.59e+00
2.36e+00
2.12e+00
1.88e+00
1.65e+00
1.41e+00
1.18e+00

Contours of Density (kg/m3) (Time=3.0000e+00)


Crank Angle=360.00(deg) FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 8: Contours of Static Temperature at Top Dead Center

The temperature very closely obeys the analytical result for a reversible, adiabatic
compression:
γ−1
T2 ρ2

=
T1 ρ1

For γ = 1.4 and a compression ratio of 5:1, the theoretical temperature at the
top dead center is 571 K.

28
c Fluent Inc. June 17, 2005
2D Adiabatic Compression (Remeshing and Spring Smoothing)

(c) Display filled contours of density (Figure 9).


i. Under Options, select only Filled and Node Values.
ii. Enter 1.18 for Min and 5.88 for Max.
iii. Click Display.

5.00e+02
4.90e+02
4.80e+02
4.70e+02
4.60e+02
4.50e+02
4.40e+02
4.30e+02
4.20e+02
4.10e+02
4.00e+02
3.90e+02
3.80e+02
3.70e+02
3.60e+02
3.50e+02
3.40e+02
3.30e+02
3.20e+02
3.10e+02
3.00e+02

Contours of Static Temperature (k) (Time=3.0000e+00)


Crank Angle=360.00(deg) FLUENT 6.2 (2d, segregated, dynamesh, lam, unsteady)

Figure 9: Contours of Density at Top Dead Center

Summary
In this tutorial, you learned how to use the dynamic mesh feature in FLUENT. If you
have to set up and solve real-life simulations that involve valve movement as well as piston
movement, you will need to perform some additional steps that could not be illustrated
with the geometry in this problem.


c Fluent Inc. June 17, 2005 29