# 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 ﬁelds using graphics The dynamic mesh model in FLUENT can be used to model ﬂows 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-deﬁned 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 methods 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, FLUENT 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 simpliﬁed 2D geometry 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 ﬂuid 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 ﬁle, box2d remesh.msh to your working directory. 2. Start the 2D version of FLUENT.

2

c Fluent Inc. June 17, 2005

. 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. June 17. Pay attention to the reported minimum volume and make sure this is a positive number. Display the grid (Figure 2). select all the surface zones. Grid −→Check FLUENT performs various checks on the mesh and reports the progress in the console window.. (a) Under Surfaces.2D Adiabatic Compression (Remeshing and Spring Smoothing) Setup and Solution Step 1: Grid 1. Display −→Grid. When you click the right mouse button on one of the boundaries in the graphics window. (b) Click Display and close the panel. 2005 3 .msh. messages appear in the console window reporting the progress of the reading. 3.. Check the grid.. its zone number. 2. Extra: Use the right mouse button to check the zone number corresponding to each boundary. c Fluent Inc. Read the mesh ﬁle (box2d remesh.gz). name. File −→ Read −→Case. As the mesh ﬁle is read in.

segregated.2D Adiabatic Compression (Remeshing and Spring Smoothing) Grid FLUENT 6. lam) Figure 2: Grid Display 4 c Fluent Inc.2 (2d. 2005 . June 17.

2005 5 .. Deﬁne −→ Models −→Solver. c Fluent Inc. June 17. (a) Under Time. select Unsteady..2D Adiabatic Compression (Remeshing and Spring Smoothing) Step 2: Models 1. (b) Retain the default Unsteady Formulation of 1st-Order Implicit. Enable a time-dependent calculation. Dynamic mesh simulations currently work only with ﬁrst-order time advancement.

6 c Fluent Inc. not through the Boundary Conditions panel.. 2005 . You will set these conditions in the next step.. (a) Select ideal-gas in the drop-down list for Density.2D Adiabatic Compression (Remeshing and Spring Smoothing) Step 3: Materials The only material property you need to modify is density. Dynamic mesh motion and other related parameters are speciﬁed using the items in the Deﬁne/Dynamic Mesh submenu. Deﬁne −→Materials. so you need not visit the Energy panel. Specify that the ﬂow is compressible. No inlets or outlets are present. Step 4: Boundary Conditions In this tutorial. FLUENT automatically enables the energy equation when the ideal-gas law is selected. June 17. you need not visit the Boundary Conditions panel to set any conditions. (b) Click Change/Create and close the panel. The default values for all other properties are acceptable. 1. You will use the default adiabatic thermal conditions for all walls.

Make sure the Layering option is disabled. enable Dynamic Mesh. The Remeshing parameters are displayed. (a) Under Models. (c) Under Mesh Methods. c Fluent Inc. including valve and piston motion. The panel expands to show additional inputs.. 2005 7 . (e) Click the Remeshing tab. Enabling the In-Cylinder option allows input for IC-speciﬁc needs.. enable In-Cylinder. June 17. enable Smoothing and Remeshing.2D Adiabatic Compression (Remeshing and Spring Smoothing) Step 5: Mesh Motion Setup 1. Deﬁne −→ Dynamic Mesh −→Parameters. (d) Retain the default settings for the smoothing parameters. (b) Under Models. Enable dynamic mesh motion and specify the associated parameters.

Hence. ii. and maximum cell skewness are obtained from the initial mesh. Under Options.6 to 0. the Size Function option is disabled and the Must Improve Skewness option is enabled. The Mesh Scale Info panel opens. A. you can use these values as an initial approximation and later modify the values to improve the mesh quality. The values displayed for minimum and maximum length scale. For a non-uniform mesh.5..7 is recommended for Maximum Cell Skewness for 2D problems. the values obtained from the Mesh Scale Info panel are suﬃcient. retain the default settings for Size Function and Must Improve Skewness.2D Adiabatic Compression (Remeshing and Spring Smoothing) i. By default. the cell is marked for remeshing.. Smaller values of maximum skew result in improved grid quality at increased computational cost.. Set the Maximum Cell Skewness to 0. Specify the values for Minimum Length Scale and Maximum Length Scale as obtained from the Mesh Scale Info panel. A value of 0. 8 c Fluent Inc. Click Mesh Scale Info. For a uniform mesh as in this problem. iii. B. June 17. 2005 . Specify the Minimum Length Scale and the Maximum Length Scale. you need to specify problem-speciﬁc values for these remeshing parameters. If a cell exceeds these limits.

Set the Piston Stroke to 8 m. ii. The piston is currently at the bottom dead center (BDC) position. 2005 9 . v.2D Adiabatic Compression (Remeshing and Spring Smoothing) (f) Set the In-Cylinder parameters. These two parameters are not utilized in the current simulation. viii. A value of 720 degrees is used for four-stroke engines. The BDC position is deﬁned as 180 degrees crank angle. while a value of 360 degrees is used for two-stroke engines. Set the Crank Shaft Speed to 10 rpm. This governs the periodicity associated with valve events and valve lift proﬁles. while the top dead center (TDC) position is deﬁned as 0 degrees crank angle. Set the Crank Angle Step Size to 0. i. This value is used along with the crankshaft speed to determine the timestep. iv. The In-Cylinder parameters are displayed. Set the Starting Crank Angle to 180 degrees. Click the In-Cylinder tab. This simulation is run at low speed to approximate the ideal process. vii. c Fluent Inc. June 17. Set the Connecting Rod Length to 14 m. vi. Click OK.5 degrees. iii. Set both the Piston Stroke Cutoﬀ and Minimum Valve Lift to 0 m. ix. Retain the default Crank Period of 720 degrees.

00e+00 5.00e+00 0. > 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** proﬁle (Figure 3) describes piston motion in terms of the Piston Stroke and Connecting Rod Length parameters deﬁned previously. lam. dynamesh.00e+00 2. June 17.00e+00 4. unsteady) Figure 3: The **piston-full** Proﬁle 10 c Fluent Inc.2D Adiabatic Compression (Remeshing and Spring Smoothing) (g) Plot the piston motion proﬁle using the text command interface as shown.00e+00 6. 2005 .00e+00 7.00e+00 0 100 200 300 400 500 600 700 800 Crank Angle (deg) Valve Lifts (Time=0.0000e+00) FLUENT 6.00e+00 1. You may need to press the <Enter> key to get the > prompt.00e+00 3. 8.2 (2d. segregated.

1). set the following: A. (a) Specify the motion of the piston. iv. Deﬁne −→ Dynamic Mesh −→Zones.. select **piston-full**. retain the default selection of Rigid Body. Under Type. iii. select moving wall. June 17. 2005 11 . Set the Valve/Piston Axis to (0.. B. c Fluent Inc. Click the Meshing Options tab and set the following: A. Specify the motion of the piston and the deforming wall. ii.2D Adiabatic Compression (Remeshing and Spring Smoothing) 2. Under the Motion Attributes tab. In the Motion UDF/Proﬁle drop-down list. i.0 m. In the Zone Names drop-down list. Click Create. B. Set the Cell Height to 1.

0). select Deforming. D. In the Zone Names drop-down list. C. select side walls. iii. Set the Cylinder Axis to (0. 1). i. Enter a Cylinder Radius of 4 m. 12 c Fluent Inc. Set the Cylinder Origin to (4. ii.2D Adiabatic Compression (Remeshing and Spring Smoothing) (b) Specify the motion of the deforming wall (side walls). Select cylinder in the Deﬁnition drop-down list. The declaration of the deforming boundary zones is necessary only for boundary zones adjacent to the cell zones that are remeshed. 2005 . Click the Geometry Deﬁnition tab and set the following: A. June 17. B. Under Type.

Click the Meshing Options tab and set the following: To determine the Minimum Length Scale and the Maximum Length Scale.65 is the average length scale. c Fluent Inc.. The Maximum Length Scale is recommended to be (1. Specify the Minimum Length Scale as 0. The average length scale can be calculated using the length scale values in the Zone Scale Info panel.65 is the average length scale.26. C.65) where 0.2D Adiabatic Compression (Remeshing and Spring Smoothing) iv. Click Create.. Specify the Maximum Length Scale as 0. The Minimum Length Scale is recommended to be (0.65.4 × 0. the average length scale is 0.4 × 0.65) where 0. to open the Zone Scale Info panel. For this case. v. 2005 13 . A. Click Zone Scale Info. Close the Dynamic Mesh Zones panel. you need to know the approximate average length scale. June 17.91. B.

can be quickly identiﬁed using this procedure. i. incorrect valve/piston axis deﬁnition. iii. i. remeshing on deforming zones is not depicted. The zone motion preview utility is useful for quickly checking the rigid body motion settings.. Preview the zone motion. This allows FLUENT to create a table of surface positions in time.. Retain the settings for Motion History Integration and click Integrate. User errors such as an improperly scaled mesh or valve lift proﬁle.. ii. Click the Outline button to select the outline surfaces. 2005 . Close the Grid Display panel. Display −→Zone Motion. Only the motion of zones with rigid body motion is represented. 14 c Fluent Inc. Display −→Grid. June 17. Deselect all surfaces. Instead.. The mesh coordinates are not actually modiﬁed during this procedure. iv. etc. (a) Display the grid outline.2D Adiabatic Compression (Remeshing and Spring Smoothing) 3.. Click Display to display the grid outline. dynamic zones with rigid body motion settings are simply translated in the display window to emulate the actual grid motion. (b) Initiate the zone motion.

iii.2D Adiabatic Compression (Remeshing and Spring Smoothing) The Preview Controls are highlighted. ii. the volume-averaged temperature history is written to a ﬁle. Step 6: Solution Setup 1. 2005 15 . c Fluent Inc. Enable the plotting of volume-averaged temperature in the domain during the calculation by deﬁning a volume monitor. Retain the default settings for Preview Controls and click Preview. to deﬁne the monitor. (a) Increase the number of Volume Monitors to 1. (d) Click Deﬁne. the history information will be lost when you exit FLUENT.. Print. you should see the piston move through two complete cycles. When the Write option is enabled.. Close the Zone Motion panel. Solve −→ Monitors −→Volume. The Deﬁne Volume Monitor panel opens automatically. (c) In the Every drop-down list. The Volume Monitors panel is displayed. and Write for the ﬁrst monitor (vol-mon-1). select Time Step for the monitor frequency... (b) Enable Plot. If the case is set up properly. If you do not select the Write option. June 17.

Click OK in the Deﬁne Volume Monitor panel. 2005 . and then in the Volume Monitors panel.2D Adiabatic Compression (Remeshing and Spring Smoothing) i. Select Temperature. iv. Select Flow Time in the X Axis drop-down list. v.out. vi... and Static Temperature in the Field Variable drop-down lists. ii. select ﬂuid. iii. In the File Name ﬁeld. June 17. 16 c Fluent Inc. Under Cell Zones. Select Volume-Average in the Report Type drop-down list. enter vol-monitor-1.

(b) Under Plotting.. enable Plot. Solve −→ Monitors −→Residual. (a) Under Options. it is useful to display only the most recent iterations. To avoid a cluttered residual plot in transient simulations.. c Fluent Inc. set Iterations to 100. 2005 17 . June 17. Enable the plotting of residuals during the calculation. (c) Click OK to close the Residual Monitors panel.2D Adiabatic Compression (Remeshing and Spring Smoothing) 2.

The Apply button does not initialize the ﬂow ﬁeld data. (b) Click Apply. 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. Initialize the solution. June 17. 18 c Fluent Inc. (c) Click Init to initialize the solution. (d) Click Close. Solve −→ Initialize −→Initialize.. It only allows you to save the initialization parameters for later use. You need to use the Init button to initialize the solution.2D Adiabatic Compression (Remeshing and Spring Smoothing) 3. including an initial Temperature value of 300 K. 2005 ..

Display −→Contours . iv. c Fluent Inc. Click Display. (a) Display ﬁlled contours of temperature (Figure 4).. Select Temperature.. i. iii. 2005 19 . v... Set up an animation for temperature. ii. select only Filled and Node Values. Close the Contours panel. and Static Temperature in the Contours of drop-down lists.2D Adiabatic Compression (Remeshing and Spring Smoothing) 4. Under Options. Enter 300 for Min and 500 for Max. June 17.

10e+02 3.00e+02 4.50e+02 4.70e+02 3.40e+02 4. dynamesh. ii.2 (2d.80e+02 4.90e+02 4.10e+02 4.20e+02 4.. Click Save to save the current view as view-0. June 17.00e+02 3.40e+02 3.20e+02 3.70e+02 4.80e+02 3.0000e+00) FLUENT 6.60e+02 4. i. Close the Views panel. lam. unsteady) Figure 4: Contours of Static Temperature (b) Save the current view.90e+02 3.30e+02 3. 20 c Fluent Inc.2D Adiabatic Compression (Remeshing and Spring Smoothing) 5. 2005 . segregated. Display −→Views.60e+02 3.50e+02 3.30e+02 4.00e+02 Contours of Static Temperature (k) (Time=0..

The ‘%t’ appended to the ﬁle name instructs FLUENT to append the timestep index to the ﬁlename. 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. ii. Set Deﬁned Commands to 1. Under Command. Click OK.tiff It is possible to specify multiple text commands in a single entry. specify 10.. Solve −→Execute Commands. June 17. i. Select the On checkbox for command-1. Select Time Step in the When drop-down list. Be sure to maintain at least a single space between commands. iii. The above command will ﬁrst activate ‘window 2’. restore the saved view ‘view-0’. 2005 21 .2D Adiabatic Compression (Remeshing and Spring Smoothing) (c) Specify the commands for animation. Under Every. iv. display contours of static temperature and then make a hardcopy of the resulting image. vi.. c Fluent Inc. v.

. (b) In the Filename ﬁeld. enter box2d remesh and click OK. The standard extensions (. File −→Hardcopy.dat) are also appended.. The Graphics Hardcopy panel is displayed. you must save both the case and data ﬁles. select TIFF.cas and . File −→ Write −→Autosave.. ii. it appends the time step value to the ﬁle name preﬁx (box2d remesh).. Under Format.2D Adiabatic Compression (Remeshing and Spring Smoothing) (d) Set hardcopy settings. 5. select Color. When FLUENT saves a ﬁle. Click Apply and close the panel. Since the mesh changes during the simulation. (a) Set the Autosave Case File Frequency and Autosave Data File Frequency to 90. i. 2005 . Under Coloring. 22 c Fluent Inc. iii. Request saving of case and data ﬁles every 90 time steps. June 17.

2D Adiabatic Compression (Remeshing and Spring Smoothing) 6. Retain the default settings for the other parameters.. c Fluent Inc.9 respectively. ii.. Set the Skewness Correction to 0. (c) Under Pressure-Velocity Coupling. i. June 17. (d) Click OK. Solve −→ Controls −→Solution. Set the solution parameters. (b) Under Discretization. 2005 23 . select PISO.6 and 0. select PRESTO! for Pressure. (a) Set the Under-Relaxation Factors for Pressure and Momentum to 0.

Display −→Grid. Save the case ﬁle. 2005 . Solve −→Mesh Motion. (b) Click Display.008333333) corresponds to 1 2 degree crank angle and is based on the crankshaft speed and crank angle increment parameters deﬁned earlier. As the mesh is updated by FLUENT..2D Adiabatic Compression (Remeshing and Spring Smoothing) Step 7: Mesh Preview 1. 3. (b) Click Preview to preview the mesh motion. messages appear in the console window reporting the progress of the update. June 17. Set up the mesh preview. 24 c Fluent Inc.. (a) Specify the Number of Time Steps as 720... Display the grid. ensure that you save the case before mesh preview. (a) Select all the surfaces. (c) Close the Grid Display panel. This corresponds to one full revolution of the crankshaft. 2. Since the mesh changes during the preview. The Time Step Size displayed in the read-only text ﬁeld (0.

. The plot for volume-averaged temperature is shown in Figure 5. 2005 25 . Read the case ﬁle back into FLUENT. Hence. (b) Close the Solution Initialization panel. 2. Initialize the solution. File −→ Read −→Case... (b) Set the Max Iterations per Time Step to 10.. Solve −→Iterate.2D Adiabatic Compression (Remeshing and Spring Smoothing) Step 8: Solution 1. The values may be diﬀerent for diﬀerent computers. (a) Set the Number of Time Steps to 720. c Fluent Inc. 3. Solve −→ Initialize −→Initialize... (a) Click Init. (c) Click Iterate. June 17. the plot that appears on your screen may not be exactly the same as the one shown here. Start the calculation.

iii. select only Filled and Node Values.0000 550. i. select only Filled and Node Values.0000 6.0000 0. ii.0000 5. segregated. iv. Click Display. (a) Display ﬁlled contours of static temperature (Figure 6). dynamesh.00(deg) FLUENT 6. and Density in the Contours of drop-down lists. 26 c Fluent Inc.0000 1.0000 4. unsteady) Figure 5: Convergence History of Static Temperature Step 9: Postprocessing 1. Under Options..0000 300.0000 Flow Time Convergence history of Static Temperature on fluid (Time=6. Select Temperature..2D Adiabatic Compression (Remeshing and Spring Smoothing) Monitors vol-mon-1 600.0000 350. and Static Temperature in the Contours of drop-down lists. Click Display. Enter 300 for Min and 500 for Max.18 for Min and 5. Inspect the solution at the bottom dead center (ﬁnal time step). Under Options.0000 Volume Weighted Average (k) 400. iv. Display −→Contours.2 (2d.0000e+00) Crank Angle=540. iii.88 for Max.0000 500.0000 250.... 2005 .0000 450. i. The temperature and density at the end of one full cycle closely replicate those at the beginning of the simulation.. Select Density. (b) Display ﬁlled contours of density (Figure 7). ii.0000 2. lam. Enter 1. June 17.0000 3.

2D Adiabatic Compression (Remeshing and Spring Smoothing) 5.47e+00 4.50e+02 3.00(deg) FLUENT 6.60e+02 3.90e+02 4.60e+02 4.53e+00 3.00e+02 3.40e+02 3.24e+00 4.20e+02 4.88e+00 5.2 (2d. segregated.2 (2d.94e+00 4.90e+02 3.30e+02 3.64e+00 5.00e+00 3.50e+02 4.10e+02 3.80e+02 4.00e+02 4.65e+00 1. lam. dynamesh.40e+02 4.70e+00 4.70e+02 4.00e+02 Contours of Static Temperature (k) (Time=6.30e+00 3.18e+00 Contours of Density (kg/m3) (Time=6.18e+00 4.80e+02 3.00(deg) FLUENT 6. segregated. unsteady) Figure 7: Contours of Density at Bottom Dead Center (ﬁnal time step) c Fluent Inc.12e+00 1.41e+00 5.0000e+00) Crank Angle=540.06e+00 2.30e+02 4.59e+00 2.77e+00 3.41e+00 1.88e+00 1. dynamesh.83e+00 2. June 17.36e+00 2. lam.20e+02 3.0000e+00) Crank Angle=540.70e+02 3. unsteady) Figure 6: Contours of Static Temperature at Bottom Dead Center (ﬁnal time step) 5.10e+02 4. 2005 27 .

59e+00 2.2D Adiabatic Compression (Remeshing and Spring Smoothing) 2. 28 c Fluent Inc.18e+00 4. June 17. (a) Read in the case and data ﬁles corresponding to the TDC position (box2d remesh0360.0000e+00) Crank Angle=360.2 (2d.18e+00 Contours of Density (kg/m3) (Time=3.41e+00 1. Under Options.77e+00 3. File −→ Read −→Case & Data.88e+00 1.dat).06e+00 2. i. unsteady) Figure 8: Contours of Static Temperature at Top Dead Center The temperature very closely obeys the analytical result for a reversible. ii.88e+00 5.83e+00 2.36e+00 2. dynamesh..65e+00 1. iii.70e+00 4.94e+00 4. 2005 . Enter 300 for Min and 500 for Max. lam.4 and a compression ratio of 5:1.12e+00 1.47e+00 4.00(deg) FLUENT 6.64e+00 5. Click Display.53e+00 3. 5. Inspect the solution at the top dead center.30e+00 3.24e+00 4. the theoretical temperature at the top dead center is 571 K.cas and box2d remesh0360. adiabatic compression: T2 = T1 ρ2 ρ1 γ−1 For γ = 1. (b) Display ﬁlled contours of static temperature (Figure 8).00e+00 3. segregated..41e+00 5. select only Filled and Node Values.

00e+02 Contours of Static Temperature (k) (Time=3.50e+02 3. i.18 for Min and 5.00(deg) FLUENT 6. Enter 1.20e+02 4.88 for Max.30e+02 4. June 17.00e+02 4. 5.10e+02 4. dynamesh. select only Filled and Node Values. lam.60e+02 4.2 (2d. you learned how to use the dynamic mesh feature in FLUENT. Click Display. unsteady) Figure 9: Contours of Density at Top Dead Center Summary In this tutorial.30e+02 3.40e+02 4.50e+02 4.40e+02 3.20e+02 3. 2005 29 .0000e+00) Crank Angle=360. If you have to set up and solve real-life simulations that involve valve movement as well as piston movement.70e+02 4. c Fluent Inc.80e+02 4.80e+02 3.90e+02 3.90e+02 4. you will need to perform some additional steps that could not be illustrated with the geometry in this problem.00e+02 3.2D Adiabatic Compression (Remeshing and Spring Smoothing) (c) Display ﬁlled contours of density (Figure 9).70e+02 3. ii.60e+02 3. segregated.10e+02 3. iii. Under Options.