Tutorial: Projectile Moving Inside a Barrel Introduction The purpose of this tutorial is to illustrate how to set up and solve a problem using the following two features in FLUENT. • Moving Deforming Mesh (MDM) using the layering algorithm. • User-defined real gas law. The problem involves a projectile moving through a barrel and out of the muzzle. The flow is assumed to be inviscid. In this tutorial you will learn how to: • Read a mesh file for performing an MDM calculation. • Compile a UDF for the projectile motion and the Abel-Nobel real gas law. • Set up the moving zones and hook the UDF in FLUENT. • Run an unsteady calculation for the problem using coupled solver and axisymmetry. • Create animations. Prerequisites This tutorial assumes that you are familiar with the FLUENT interface and have completed Tutorial 1 from the FLUENT 6.1 Tutorial Guide. Some of the basic steps in the setup and solution procedures will not be shown explicitly. You should be familiar with the dynamic mesh model. If you are not, please review Section 9.6: Dynamic Meshes in the FLUENT User’s Guide. Note: Assuming that you are using a single processor machine with a clock speed of 2 GHz, this tutorial will take: • One hour to work through it. • An additional 6 hours for the calculations up to the uncorking of the projectile. • An additional 43.5 hours for the calculations until the projectile leaves the field of view. c Fluent Inc. March 27, 2006 1
25
Embed
Tutorial: Projectile Moving Inside a Barrelread.pudn.com/downloads651/doc/2648722/Fluent 6DOF/FLUENT_-_Tutorial... · Tutorial: Projectile Moving Inside a Barrel Introduction The
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Tutorial: Projectile Moving Inside a Barrel
Introduction
The purpose of this tutorial is to illustrate how to set up and solve a problem using thefollowing two features in FLUENT.
• Moving Deforming Mesh (MDM) using the layering algorithm.
• User-defined real gas law.
The problem involves a projectile moving through a barrel and out of the muzzle. The flowis assumed to be inviscid.
In this tutorial you will learn how to:
• Read a mesh file for performing an MDM calculation.
• Compile a UDF for the projectile motion and the Abel-Nobel real gas law.
• Set up the moving zones and hook the UDF in FLUENT.
• Run an unsteady calculation for the problem using coupled solver and axisymmetry.
• Create animations.
Prerequisites
This tutorial assumes that you are familiar with the FLUENT interface and have completedTutorial 1 from the FLUENT 6.1 Tutorial Guide. Some of the basic steps in the setup andsolution procedures will not be shown explicitly. You should be familiar with the dynamicmesh model. If you are not, please review Section 9.6: Dynamic Meshes in the FLUENTUser’s Guide.
Note: Assuming that you are using a single processor machine with a clock speed of 2 GHz,this tutorial will take:
• One hour to work through it.
• An additional 6 hours for the calculations up to the uncorking of the projectile.
• An additional 43.5 hours for the calculations until the projectile leaves the fieldof view.
A projectile weighing 120 grams is initially at rest inside a 20 mm caliber barrel. The gasinside the chamber is patched at a high pressure of 3000 atm and a temperature of 2700 K,and the projectile is released.
The motion of the projectile is computed using a UDF based on FLUENT’s Six Degree ofFreedom UDF. In this case, only the pressure forces are considered, while drag and me-chanical friction are neglected. The projectile is released at t=0. The Abel-Nobel equationof state is implemented using the user-defined real gas model.
Figure 1: Problem Schematic
Preparation
1. Copy the mesh file, projectile.msh.gz and the UDF source files, aneos.c andsix dof property.c, to your working directory.
This grid was created using GAMBIT. The region inside the barrel (on both sides of theprojectile) and the region forming the extension of the muzzle are meshed with quadsand lumped into one fluid zone called fluid-mdm.
The rest of the domain consists of one face that is disconnected from the other faces,and the corresponding zone is called fluid-static-outer. Thus, there are two setsof edges where the two fluid regions meet. Each set is turned into an interface zoneand allows you to define a non-conformal interface at a later stage. Boundary layersare attached to the interface edge at the bottom of fluid-static-outer. This portionof the zone is meshed using quads.
The entire zone, default-interior slides to the right, while keepingdefault-interior:001 stationary. At the same time, cells are created on the left (atthe edge labeled breech in Figure 5), and destroyed on the right (at the edge labeledp-out-destruct in Figure 3).
7. Zoom in near the breech and projectile (Figure 5).
Figure 5 shows the default-interior zone, which will move to the right. By specify-ing the rigid body motion of default-interior you are also specifying the rigid bodymotion of the walls belonging to the projectile (w-proj-base and w-proj-front).
New quad cells are created at the left wall labeled breech. Conversely, quad cells aredestroyed at the edge labeled p-out-destruct.
The combination of moving one zone as a rigid body while creating and destroyingcells is called “layering”.
8. View the zones, interface-inner and interface-outer (Figure 6).
(a) Zoom out and under Surfaces, deselect default-interior, default-interior:001, andinterface-outer to see where interface-inner is located.
(b) Deselect interface-inner and select interface-outer.
Figure 6: Definition of the Non-Conformal Interface
In Figure 6, the three red, dotted line segments represent the interface-outer zoneand the seven blue line segments (including the bottoms of the muzzle brakes) representthe interface-inner zone.
This setting is usually used with the coupled solver, to avoid confusion between absoluteand gauge pressures. With the operating pressure set to zero, the static and absolutepressures will be equivalent.
Step 3: Compile the UDF
This UDF (based on FLUENT’s 6DOF UDF) is parallelized and has a restart capability,where previous velocities and Euler angles are written to a file. Although the UDF seems tobe complicated, very few changes have been made to customize it for this tutorial.
The Abel-Nobel Equation Of State (ANEOS) is implemented using FLUENT’s user-definedreal gas model. ANEOS is a truncated version of the Van der Waals equation of state;ANEOS is defined as:
p(v − b) = RT (1)
where v is the specific volume and b is the covolume term, that represents the volume occupiedby the molecules themselves.
For this case, the initial specific volume is 0.00382 m3/kg, while the covolume term is0.001265 m3/kg, indicating that about a fourth of the volume is occupied by the moleculesthemselves.
With regard to the motion of the projectile, the UDF computes the total force (viscous pluspressure) acting on the projectile base and on the projectile nose, and then Newton’s SecondLaw is used to compute the acceleration. The new velocity is then calculated using a finitedifference.
(b) In the Select File panel, select the source files, aneos.c and six dof property.
(c) Under Library Name, enter libudf-6dof-real.
(d) Click Build (do not click Load yet).
FLUENT will set up the appropriate directory structure, and will compile thecode for you. The progress of the compilation is shown on the FLUENT consolewindow. Monitor the progress for compilation and linking errors. You can alsosee the ‘log’ file in the working directory for the compilation history.
(e) Load the library using text user interface (TUI) commands.
> /define/user-defined/real-gas/user-defined-real-gas-modeluse real gas? [no] y
User Defined Realgas Library Name [""] libudf-6dof-real
Opening user-defined realgas library "libudf-6dof-real"...Library "libudf-6dof-real/lnx86/2d/libudf.so" opened
Setting material "air" to a real-gas...
Loading Real-Ideal Library:
(f) In the Compiled UDFs panel, click Load.
For more information on compiled UDFs, refer Section 7.3, Compiling a Source FileUsing the Compiled UDFs Panel, in the UDF Manual.
Note: The Materials panel is no longer available, because the real gas law is now enabled.
iii. Set Gauge Pressure to 1 atm and retain Backflow Total Temperature at 300 K.
(e) Retain the default settings for all the walls, i.e., tangency for momentum andzero heat flux for thermal and close the Boundary Conditions panel.
2. Define the non-conformal interface.
Define −→Grid Interfaces...
(a) Under Grid Interface, enter interface.
(b) Under Interface Zone 1, select interface-inner and under Interface Zone 2, selectinterface-outer
(c) Click Create.
Step 5: Dynamic Mesh Setup
1. Activate dynamic mesh motion and specify the associated parameters.
Define −→ Dynamic Mesh −→Parameters...
(a) Under Models, enable Dynamic Mesh and Six DOF Solver.
The panel will expand to show additional parameters.
(b) Under Mesh Methods, deselect Smoothing and select Layering.
(c) Click on the Layering tab and set the Split Factor and Collapse Factor to 0.4.
These factors indicate that a new layer of cells is created when the preceding layerhas stretched beyond 1.4 times the ideal height, and that a layer is destroyed whenthe last layer has shrunk to a height less than 0.6 times the ideal height.
2. Specify the rigid body motion for the projectile and surrounding fluid.
By specifying the motion of the fluid zone, fluid-mdm, you are specifying the motionof the quad cells and of the projectile itself (i.e., the two zones w-proj-base and w-proj-front).
Define −→ Dynamic Mesh −→Zones...
(a) In the Zone Names list, select fluid-mdm.
(b) Retain Rigid Body as the motion Type.
(c) In the Motion Attributes tab, ensure that under Six DOF Solver Options, On isenabled.
(d) Ensure that under Six DOF UDF, projectile::libudf-6dof-real is selected. and clickCreate.
The six dof::libudf-6dof-real UDF defines the rigid body motion. This will movethe face that hosts the quad cells, together with the edges (wall-object and default-interior).
5. Display contours of pressure, temperature, and density to verify the patching andconfirm the density of 262 kg/m3 in the chamber.
6. Save the case and data files as, gun-6dof-real-init.cas.gz.
Step 7: Mesh Motion Preview
The mesh motion preview utility is useful for verifying that the mesh motion parametersyield the desired mesh motion.
Because the initialized flow includes a patch, the projectile is driven by the patched pressuredifferential. The preview is driven at a constant acceleration, based on that initial pressureforce, because the flow is not computed during the preview.
1. Display the grid for the entire domain.
2. Specify the mesh motion.
Solve −→Mesh Motion...
(a) Set the Time Step Size to 1e-6 seconds.
(b) Set Number of Time Steps to 40 and click Preview.
Study the mesh motion. Observe the chamber and the projectile.
3. Zoom in to see the chamber and the projectile and click Preview again.
You can see how cells are being created, initially at a rate of one new layer for everythirty time steps.
4. Zoom in near the zone, p-out-destruct on the far right and click Preview and see howthe cells are being destroyed.
At the beginning of each new time step, messages from the UDF will appear in theTUI.
UDF message follows:UDF messageUDF message: Flow time (sec) is .......... : 0.000157UDF message: Axial velocity (m/s) is ..... : 125.631042
UDF messageUDF message: Change in axial position (mm) : 0.125631UDF message: Axial position (m): 0.009988UDF message: Net axial force (N) is ...... : 95416.828125UDF messageUDF message: Axial force on base is 95448.804688UDF message: Axial force on nose is -31.982697UDF message
5. Exit FLUENT without saving.
After verifying the correct behavior of the dynamic mesh, you can start again withthe projectile at its starting point. Because the mesh has deformed and the projectilehas moved, it is required to exit FLUENT without saving to revert to the original meshposition.
Step 8: Postprocessing Setup
1. Start the 2D version of FLUENT and read the saved case and data files,projectile-6dof-real-init.cas.gz.
File −→ Read −→Case & Data...
Note: If you have parallel licenses, you can also run parallel at this point, but youwill have to recompile the fully parallelized UDF. This tutorial has been tested inparallel mode.
2. Display contours of velocity.
Display −→Contours...
(a) Under Contours Of, select Velocity and Velocity Magnitude.
(b) Under Options, select Filled and deselect Global Range, Auto Range, and Clip toRange.
(c) Increase the Levels to 50.
(d) Set the value of Min to 0.001 and Max to 1000.
(e) Click Display and close the panel.
3. Define a surface monitor for absolute pressure (monitor-1).
Solve −→ Monitors −→Surface...
(a) Increase Surface Monitors to 1.
(b) Enable Plot, Print, and Write.
(c) Under Every, select Time Step and click Define....
i. In the Define Surface Monitor panel, under Report Type, select Area-WeightedAverage.
(a) Set the Time Step Size to 1e-06 and the Number of Time Steps to 960.
(b) Set the Maximum Iterations per Time Step to 25 and click Iterate.
After about five time steps, the pressure monitor becomes nearly flat at the endof each time step. This indicates convergence within each time step. The residu-als for axial velocity, continuity, and energy are dropping well within each timestep. The radial velocity is less responsive because the flow is essentially one-dimensional, causing the y-residual to be normalized by a small number.
Note: The 960 time steps will take about 5.75 hours on a single processor witha clock speed of 2 GHz. At this time, you may choose to close this sessionof FLUENT, and resume from the instant the projectile leaves the muzzle. Ifyou choose to exit, you will not be able to produce a complete animation.
At the end of 960 time steps, the base of the projectile is just short of exiting themuzzle, i.e., just short of shot exit (uncorking). At this point, it is traveling atabout 154 m/s, and the pressure inside the barrel is about 82 atmospheres. Theflow time is near 0.96 milliseconds, and the maximum flow velocities are about270 m/s. The contours of velocity are shown in Figure 9.
6. Solve until the projectile reaches the end of the muzzle.
(a) Solve for 960 time steps, with 25 iterations per time step.
Figure 9: Velocity Contours at the Instant of Uncorking
(b) Save the current case and data files as projectile-6dof-real-960msec.cas.gzand projectile-6dof-real-960msec.dat.gz.
7. Solve until the projectile is placed well beyond the second muzzle brake.
(a) In the Iterate panel, set the Time Step Size to 1e-07 seconds (smaller by a factorof ten).
(b) In the Execute Commands panel, change Every from 10 to 100 for the two definedcommands.
(c) Set the Number of Time Steps to 6400 and click Iterate.
This calculation will take about 43.5 hours on a single processor with a clockspeed of 2 GHz. This will place the projectile well to the right of the secondmuzzle brake. The final flow time will be about 1.60 msec.
Note: If you do not want to run the iterations, you can read the final case and data files,projectile-6dof-real-final.cas.gz and projectile-6dof-real-final.dat.gzand proceed with the postprocessing.
Step 10: Postprocessing
1. Display the Velocity Magnitude (Figure 10).
Display −→Contours...
(a) Display velocity contours as described in Step 8-2.
2. Display the animation by entering the command animate *.tiff in the folder tiff-files.