chapter 9: use of udf in moving deforming mesh dof of using udf in...chapter 9: use of udf in moving...

20
Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled ones, so the flow reacted upon the structured motion. This tutorial illustrates how to handle a case where the flow influences the motion of an element.To do so, it requires the use of a 6DOF (Degrees of Freedom) UDF (User Defined Function) that takes into account the forces & momentums acting on the solid in motion. This tutorial shows how to set up a case using this kind of model. This tutorial is written with the assumption that you are familiar with the ANSYS Fluent tree and menu structure. Some steps in the setup and solution procedure will not be shown explicitly. 9.1. Preparation 9.2. Reading and Checking the Mesh 9.3. Specifying Solver and Analysis Type 9.4. Specifying Dynamic Mesh Settings 9.5. Run the Simulation 9.6. Summary 9.1. Preparation 1. Copy the files (pipe-vane1DOF-inflation.cas/dat.gz and XDOF-vane.c) to your working folder. 2. Launch Fluent. a. Select 3D under Dimension in the Fluent Launcher dialog box. b. Ensure that Display Mesh After Reading is enabled under Display Options in the Fluent Launcher dialog box.This will ensure that the mesh is displayed automatically after reading. c. Disable the option Workbench Color Scheme under Display Options. d. Retain the option of Serial under Processing Options. e. Make sure you have set the correct working directory in the General Options tab. f. Click OK to start Fluent. Note Double Precision is recommended when moving deforming mesh is handling very thin cells (about the width of micron - µm). Use of Parallel Processing Options (associated with a number of processors) is recommended if you want to speed up your simulation. 1 Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

Upload: others

Post on 11-Mar-2020

82 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

Chapter 9: Use of UDF in Moving Deforming Mesh DOF

In the previous workshops, all the motions were imposed or controlled ones, so the flow reacted uponthe structured motion. This tutorial illustrates how to handle a case where the flow influences the motionof an element. To do so, it requires the use of a 6DOF (Degrees of Freedom) UDF (User Defined Function)that takes into account the forces & momentums acting on the solid in motion. This tutorial shows howto set up a case using this kind of model.

This tutorial is written with the assumption that you are familiar with the ANSYS Fluent tree and menustructure. Some steps in the setup and solution procedure will not be shown explicitly.

9.1. Preparation9.2. Reading and Checking the Mesh9.3. Specifying Solver and Analysis Type9.4. Specifying Dynamic Mesh Settings9.5. Run the Simulation9.6. Summary

9.1. Preparation

1. Copy the files (pipe-vane1DOF-inflation.cas/dat.gz and XDOF-vane.c) to your workingfolder.

2. Launch Fluent.

a. Select 3D under Dimension in the Fluent Launcher dialog box.

b. Ensure that Display Mesh After Reading is enabled under Display Options in the FluentLauncher dialog box. This will ensure that the mesh is displayed automatically after reading.

c. Disable the option Workbench Color Scheme under Display Options.

d. Retain the option of Serial under Processing Options.

e. Make sure you have set the correct working directory in the General Options tab.

f. Click OK to start Fluent.

Note

• Double Precision is recommended when moving deforming mesh is handlingvery thin cells (about the width of micron - µm).

• Use of Parallel Processing Options (associated with a number of processors) isrecommended if you want to speed up your simulation.

1Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Page 2: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

9.2. Reading and Checking the Mesh

1. Read the case file and data pipe-vane1DOF-inflation.cas/dat.gz.

File → Read → Case & Data...

2. Check the mesh.

Setup → General → Check

ANSYS Fluent will perform various checks on the mesh and will report the progress in the console. Ensurethat the reported minimum volume is a positive number.

3. In the mesh display check each surface of the geometry so that you know which surface corresponds towhich name.

a. Open the Mesh Display dialog box.

Display → Mesh...

b. Retain the selection of Edges and select Faces list of Options.

c. Deselect all from the list of Surfaces.

d. Select wall-vane and click Display.

e. Select other surfaces one by one and click Display to check which displayed surface represents whichname.

4. Create an isosurface.

Surface → Iso-Surface...

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.2

Use of UDF in Moving Deforming Mesh DOF

Page 3: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

a. In the Iso-Surface dialog box select Mesh... and Z-Coordinate from the Surfaces of Constant drop-down lists.

b. Retain 0 for Iso-Values.

c. Enter z-0 for New Surface Name.

d. Click Create.

5. Display the isosurface z-0 along with the surface wall-vane.

Display → Mesh...

3Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Reading and Checking the Mesh

Page 4: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

6. Save the view for the animation.

Display → Views...

• In the Views dialog box select view-0 and click Apply.

7. To improve the display lighting select Lights... from the Display menu.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.4

Use of UDF in Moving Deforming Mesh DOF

Page 5: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

a. Select Flat from the Lighting Method drop-down list.

b. Enable Headlight On in the Lights dialog box.

c. Click Apply and close the Lights dialog box.

Note

As you can see the mesh is of a pipe. Inside the pipe you have the vane. The vane willbe moved inside the pipe. The vane will be rotating along the Z axis.

8. Check the UDF by opening the file XDOF-vane.c, in a text editor. You will be adding some values tothe files to make it work right for the tutorial.

5Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Reading and Checking the Mesh

Page 6: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

a. Enter 0.1 for prop[SDOF_MASS], which will be 100 g.

b. To set up the moment of inertia enter 2.48e-5 for prop[SDOF_IXX],3.645e-5 for prop[SDOF_IYY],and 2.48e-5 for prop[SDOF_IZZ]

c. The actual vane definition (or properties) shows that all the motions are blocked (the three transla-tional and rotational values are set to TRUE). So, remove the line prop[SDOF_ZERO_ROT_Z] = TRUE;.This will allow you to move (in a rotation mode) the vane along the Z axis.

d. Save the UDF as 1-DOF-vane.c.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.6

Use of UDF in Moving Deforming Mesh DOF

Page 7: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

9. Compile the UDF.

Define → User-Defined → Functions → Compiled...

a. Click Add... under Source Files dialog box to open the Select File dialog box.

b. Select the 1-DOF-vane.c file in the Select File dialog box and click OK.

c. Click Build.

Click OK in the Question dialog box that appears.

Note

Check that there are no errors reported in the console while compiling.

7Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Reading and Checking the Mesh

Page 8: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

d. Click Load and then close the Compiled UDFs dialog box.

9.3. Specifying Solver and Analysis Type

For moving deforming mesh you require the transient solver. Select Transient under Time in theSolver group box.

9.4. Specifying Dynamic Mesh Settings

Setup → Dynamic Mesh

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.8

Use of UDF in Moving Deforming Mesh DOF

Page 9: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

1. In the Dynamic Mesh task page enable Dynamic Mesh.

2. Enable Remeshing and retain Smoothing in the Mesh Methods group box.

3. Click Settings... to open the Mesh Method Settings dialog box.

4. In the Smoothing tab enter 50 for Number of Iterations.

5. Click the Remeshing tab.

Note

Since the vane is not in contact with anything you will retain the selection of Local Cellin the Remeshing Methods group box.

9Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Specifying Dynamic Mesh Settings

Page 10: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

a. Click Use Defaults.

b. Enter 0.0003 for Minimum Length Scale.

c. Enter 0.005 for Maximum Length Scale.

d. Enter 0.9 for Maximum Cell Skewness.

e. Enter 1 for Size Remeshing Interval.

f. Click OK to close the Mesh Method Settings dialog box.

6. Enable Six DOF in the Options group box in the Dynamic Mesh task page.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.10

Use of UDF in Moving Deforming Mesh DOF

Page 11: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

7. Click Settings to open the Options dialog box.

11Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Specifying Dynamic Mesh Settings

Page 12: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

a. In the Six DOF tab of the Options group box enter -10 for X.

b. Enable Write Motion History.

c. For File Name enter report-6dof-vane-motion.

d. Click OK to close the Options dialog box.

8. To set the motion to the object you need to define the dynamic mesh zones. Click Create/Edit... underthe Dynamic Mesh Zones group box.

a. In the Dynamic Mesh Zones dialog box select fluid-pipe:010 from the Zone Names drop-downlist.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.12

Use of UDF in Moving Deforming Mesh DOF

Page 13: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

Note

If you zoom in on one end of the vane you can see that this layer will correspondto the prism layer around the vane. The vane moves as a rigid body, according tothe fluid flow behavior. So, you want this fluid zone ( prism layer) to move with thevane but not deformed.

13Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Specifying Dynamic Mesh Settings

Page 14: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

i. Retain the selection of Rigid Body in the Type group box.

ii. Retain the selection of rota_vane::libudf from the Motion UDF/Profile drop-down list.

Note

The name rota_vane should be same as that in the UDF.

iii. Enable Passive in the Six DOF Options group box.

Note

You need to enable Passive option for the fluid zone, as you do not want totake into account the effort and momentum exerted in this latter. Only theeffort applied on the vane itself is valuable.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.14

Use of UDF in Moving Deforming Mesh DOF

Page 15: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

iv. Enter 0.008 for X and 0.06117 for Y in the Center of Gravity Location group box.

Note

This will define the axis around which you want to rotate the vane. The axis isoff-centered.

v. Click Create.

b. Select wall-vane from the Zone Names drop-down list.

i. Retain the selection of Rigid Body in the Type group box.

ii. Retain the selection of rota_vane::libudf from the Motion UDF/Profile drop-down list.

iii. Disable Passive in the Six DOF Options group box.

Note

Passive is disabled for this because you want to take into account the effortand momentum that will be exerted on the vane to make it work properly.

iv. Retain 0.008 for X and 0.06117 for Y in the Center of Gravity Location group box.

v. Click Create.

c. Select interior-geom_solid:004 from the Zone Names drop-down list.

Note

You need to move this interior zone like a rigid body. This interior zone is at theedge of the two fluid zones, the one which moves with the vane and the one inthe pipe which deforms.

i. Retain the selection of Rigid Body in the Type group box.

ii. Retain the selection of rota_vane::libudf from the Motion UDF/Profile drop-down list.

iii. Enable Passive in the Six DOF Options group box.

Note

As you do not want to take into account the effort and momentum you willenable Passive.

iv. Retain 0.008 for X and 0.06117 for Y in the Center of Gravity Location group box.

15Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Specifying Dynamic Mesh Settings

Page 16: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

v. Click Create.

d. Close the Dynamic Mesh Zones dialog box.

9. Save the case file,pipe-vane1DOF-inflation-mdm.cas.gz.

File → Write → Case...

Note

Using the 6DOF UDF, requires to have efforts and momentums, or eventually external forces(which is not the case) to move the vane. Therefore, it is not so simple to check the motionof the vane via the Preview. To do so, an imposed motion would be necessary, but for thepurpose of the tutorial we assume that this is correct.

9.5. Run the Simulation

You can save the mesh picture at each time step so that after the run is over you can make an animationwhich will show how the mesh changes in the process.

Calculation Activities

1. In the Calculation Activities task page click Create/Edit....

a. In the Execute Commands dialog box enter 2 for Defined Commands.

b. Select Time Step from the When drop-down list for both commands.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.16

Use of UDF in Moving Deforming Mesh DOF

Page 17: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

c. For command- 1 enter /display/surface-mesh wall-vane z-0 ().

Note

This command will display the mesh of wall-vane at every time step.

d. For command- 2 enter /display/save-picture "mesh-%i.jpeg".

Note

This command will save the picture of the mesh at every time step. You can makea movie after this of all the saved pictures.

e. Enable Active for both commands.

f. Click OK to close the Execute Commands dialog box.

2. Save the case and data files together by using Autosave. Save them according to a defined number oftime steps.

Setup → Calculation Activities

a. Click Edit... in the Calculation Activities task page next to Autosave Every (Time Steps).

b. Enter the required value for Save Data File Every (Time Steps).

c. Give a generic name for the case and data files, vane-1DOF-timestep.

17Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Run the Simulation

Page 18: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

d. Click OK to validate and close the window.

Note

To keep the execution time of this tutorial short, you will not enable this option, so retain0 for Save Data File Every (Time Steps).

3. Now you can start the calculation.

Run Calculation

a. Enter 0.002 for Time Step Size.

b. Enter 20 for Number of Time Steps.

c. Click Calculate.

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.18

Use of UDF in Moving Deforming Mesh DOF

Page 19: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

4. Open the Dynamic Mesh Zones dialog box and you can see that the value of Theta_Z has under Centerof Gravity Orientation and Omega_Z has under Center of Gravity Angular Velocity, has changed. Thisalso confirms that the vane has moved.

Note

• Run the tutorial for a longer time to get a more detailed picture of how the vane moves.

• You can make an animation of the saved images.

9.6. Summary

In this tutorial you have learned one more step in the process of setting up a moving deforming mesh,how to move an object according to fluid flow influence.

To run such an application, you need to use the 6DOF UDF.

• First write the appropriate UDF by defining the properties of the 6DOF and compile it.

• Next enable the Six DOF option in the Dynamic Mesh model and define the Gravitational Acceleration.

• Lastly define correctly which zones are actively involved in the evaluation of the forces and momentums.

19Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information

of ANSYS, Inc. and its subsidiaries and affiliates.

Summary

Page 20: Chapter 9: Use of UDF in Moving Deforming Mesh DOF of Using UDF in...Chapter 9: Use of UDF in Moving Deforming Mesh DOF In the previous workshops, all the motions were imposed or controlled

Release 16.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential informationof ANSYS, Inc. and its subsidiaries and affiliates.20