Fluent Dynamic Mesh Training
Fluent Dynamic Mesh Training
com
2-1
Agenda
9:00 Overview of Dynamic Mesh (DM) 9:30 Global Controls 10:00 Dynamic Zones 10:30 Motion Specification 11:00 Step-by-Step Procedure 11:15 Tutorial 1 12:00 Lunch 1:00 Step-by-Step Procedure 1:30 Tutorial 2 2:30 Examples 3:00 Tips-and-Tricks and Technical Discussion Session
2-2 Fluent Inc. 11/7/2005
Overview of DM
2-3
Built-in, no additional fee IC engines Valves Fuel injectors HVAC modules and much much more
Can also be used for steady-state parametric studies Compatible with all physical models and solver types in FLUENT 6.1 Compatible with any pre-processor Fully parallelized
2-4
Mesh motion may be applied to individual zones Different zones may use different schemes for mesh motion Connectivity between adjacent deforming zones may be nonconformal
2-5
Spring Analogy
Interior nodes behave like a spring or sponge Connectivity remains unchanged Limited to relatively small deformation when used as a standalone meshing scheme Available for tri, tet, quad, hex and wedge mesh element types
2-6
Local Remeshing
As user-specified skewness and size limits are exceeded, local nodes and cells are added or deleted As cells are added or deleted, connectivity changes Available only for tri and tet mesh elements
2-7
Dynamic Layering
Cells are added or deleted as the zone grows and shrinks As cells are added or deleted, connectivity changes Available for quad, hex and wedge mesh elements
2-8
Combination of Approaches
Remeshing
z
2-9
Combination of Approaches
2 - 10
Motion Specification
Internal node positions are automatically calculated based on user specified boundary motion Mesh motion scheme in each zone is automatically chosen based on element type in that zone Prescribed mesh motion
z z
Position or velocity versus time i.e. profile text file UDF with expression for position or velocity Mesh motion is coupled with the flow solution through a UDF Can integrate forces (pressure, gravity and viscous etc) Six degree of freedom UDF provided UDF readily customized for desired mesh motion
2 - 11 Fluent Inc. 11/7/2005
Mesh Preview
Allows user to quickly check mesh quality throughout the simulation cycle Applicable to any dynamic mesh simulation
2 - 12
Global Controls
2 - 13
Overview
Methods
toggle spring analogy, layering, remeshing approaches GUI dynamically changes to reflect selected methods
Dynamic Mesh model enables generic functionality In-Cylinder option adds specific functionality
definition of RPM, starting crank angle, crank period, etc... option enables IC specific profile format for valve motion
2 - 14
Overview
Layering parameters
z
Remeshing parameters
z z
2 - 15
Smoothing
Edges between any two mesh nodes are idealized as a network of interconnected springs. A set of linear equations are derived based on force balance at the nodes. The node positions at each time-step are solved iteratively. By default smoothing is applied on tet/tri mesh. To apply smoothing for all type of mesh use: (rpsetvar 'dynamesh/spring/all-element-type? #t) Spring Constant Factor: It adds damping to the springs [1,0] Boundary Node Relaxation: Under-relaxation used for the boundary nodes. Use a value of 0 if no smoothing on the boundaries
Convergence Tolerance: Used when solving for node positions. Number of Iterations: Max number of iterations.
2 - 16 Fluent Inc. 11/7/2005
Smoothing
2 - 17
Smoothing
2 - 18
Smoothing
2 - 19
Smoothing
2 - 20
Smoothing
Smoothing on Quads
2 - 21
Smoothing
The rpsetvar command is not used here. Smoothing is not applied automatically on quad/hex meshes.
2 - 22
Layering
Constant Height
z
Useful for uniform layer height Maintain a constant ratio of cell heights between layers Useful when layering is done in curved domains (e.g. cylindrical geometry).
Constant Ratio:
z
2 - 23
Layering
2 - 24
Layering
2 - 25
Remeshing
Sizing Function Controls: Resolution: determines the size of the background bins used to evaluate the size distribution with respect to the minimum characteristic length of the current mesh. Sizing Function Variation Rate: How the background mesh increases in size (from the boundary to the interior) [1,+inf] Distance Threshold: Is the degree of polynomial that handles the size variation of the background cell size. (values in [-1,1]). Size Remesh Interval: How often the remeshing is done based on min and max cell volume.
2 - 26
Remeshing
Meaning of Variation Rate: A value of -0.5 means that the minimum mesh size (cell edge length) in the interior is half of the mesh size at the boundary, A value of 50 means that the maximum mesh size in the interior can be 50 times higher than the mesh size at the boundary. Meaning of Distance Threshold: The higher the value, the slower the change of the mesh size close to the boundary. A threshold value of 0 corresponds to linear in-/de-crease from the boundary. Negative threshold values enforce a faster (than linear) in-/de-crease at the boundary. Default Values work fine most of the time.
2 - 27 Fluent Inc. 11/7/2005
Remeshing
Minimum Cell Volume: mark cells for remeshing if their size gets smaller than this value Maximum Cell Volume: mark cells for remeshing if their size gets larger than this value Maximum Skewness: mark cells if their skewness increases this value
z z
2 - 28
Remeshing
2 - 29
Remeshing
2 - 30
Dynamic Zones
2 - 31
Sets the nodes on a zone (either fluid or face zone) as stationary. Cell height:
z z
Used for face zones For the remeshing of tet/tri, this height is used for boundary node distance. If layering, it will be used for ideal height. It should be roughly the same size as the initial mesh
2 - 32
Moves all nodes associated with that zone (cell or face zone) Nodes do not move relative to each other Motion Attributes: Motion can be specified by Profile or UDF. Center of Gravity (CG) and its location: specify if
z
Profile uses position x, y, z. The position is measured relative to the CG location. Profile/UDF uses rotation
2 - 33
For the remeshing of tet/tri, this height is used for boundary node distance. For layering, it will be used for ideal height. It should be roughly the same size as the initial mesh
2 - 34
Geometry Definition
z z
Required for remeshing and smoothing A simple Cylinder and Plane is built in.
Cylinder requires Origin and Axis Plane requires any point on the plane and a normal vector
2 - 35
Meshing Options
z z z z
Smooth: If smoothing is required Remeshing: If remeshing is required Expand until Contract until
2 - 36
deforming
2 - 37
Smoothing is not selected Only Remeshing is applied. This looks much better. In some 2d cases, like this one, it may be necessary not to select Smoothing. In 3d cases, Maximum Skewness is also used, which prevents this problem.
2 - 38 Fluent Inc. 11/7/2005
2 - 39
Motion Specification
2 - 40
In-Cylinder Motion
For any simple sinusoidal (singledegree, rigid-body, and prescribed) motion, we can use the built-in piston motion: L
ps
Valve/Piston Axis
A 2 - 41 Fluent Inc. 11/7/2005
Table Profile
For any type of rigid-body, single-degree, and prescribed motion, you can use a profile table having the following format:
((profile_name_1 3 point) (time 0 1 2) (x 2 3 4) (v_y 0 -5 0)) ((profile_name_2 3 point) (time 0 1 2) (omega_x 2 3 4))
where, {time,angle}; { "x", "y", "z"}; {"v_x", "v_y", "v_z"}; {"theta_x", "theta_y", "theta_z"}; {"omega_x", "omega_y", "omega_z"};
Angle = crank angle
2 - 42
UDFs
2 - 43
DEFINE_CG_MOTION Macro
Used to define the motion of the center of gravity for rigid body motion
z z
Macro: DEFINE_CG_MOTION ( name, dt, vel, omega, time, dtime) Argument types:
z z z z z
void *dt (dynamic thread pointer; common in all macros) real vel[] (array that returns the CG velocity) real omega[] (array that returns the of the CG) real time (time) real dtime (time step)
2 - 44
DEFINE_CG_MOTION Example
#include "udf.h" #include "dynamesh_tools.h" static real v_prev = 0.0; DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime) { Thread *t; face_t f; real NV_VEC (A); real force, dv; /* reset velocities */ NV_S (vel, =, 0.0); NV_S (omega, =, 0.0); if (!Data_Valid_P ()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD ((Dynamic_Thread *)dt); } /* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop (f, t) { F_AREA (A, f, t); force += F_P (f, t) * NV_MAG (A); } end_f_loop (f, t) /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit euler formula */ dv = dtime * force / 50.0; v_prev += dv; Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force); /* set x-component of velocity */ vel[0] = v_prev;
2 - 45
DEFINE_GEOM Macro
The DEFINE_GEOM macro is used to define geometry in a deforming zone Macro: DEFINE_GEOM ( name, d, dt, position) Argument types:
z z z z
char name Domain *d void *dt real *position (this matrix is overwritten with the node position on the boundary)
2 - 46
DEFINE_GEOM Example
/************************************************************ * * defining parabola through points (0, 1), (1/2, 5/4), (1, 1) * ************************************************************/ #include "udf.h" DEFINE_GEOM(parabola, domain, dt, position) { /* set y = -x^2 + x + 1 */ position[1] = - position[0]*position[0] + position[0] + 1; }
The new position (after projection to the geometry defining the zone) is returned to FLUENT by overwriting the position array
2 - 47
DEFINE_GRID_MOTION Macro
Useful when defining the position of the nodes individually, e.g. fluidstructure interaction. DEFINE_GRID_MOTION ( name, d, dt, time, dtime) Argument types:
z z z z z
2 - 48
DEFINE_GRID_MOTION Example
Case: Specify the deflection of a beam based on local coordinate x and time t according to
( x, t ) = {
10 .4 x sin( 27 .178 t ), x > 0.02 0, x < 0.02
r n +1 = r n + r n t
2 - 49
DEFINE_GRID_MOTION Example
/********************************************************** * * node motion based on simple beam deflection equation * compiled UDF * **********************************************************/ #include "udf.h" DEFINE_GRID_MOTION(beam, domain, dt, time, dtime) { Thread *tf = DT_THREAD (dt); face_t f; Node *v; real NV_VEC (omega), NV_VEC (axis), NV_VEC (dx); real NV_VEC (origin), NV_VEC (rvec); real sign; int n; /* set deforming flag on adjacent cell zone */ SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf)); sign = -5.0 * sin (26.178 * time); Message ("time = %f, omega = %f\n", time, sign); } } end_f_loop (f, tf); } } NV_S (omega, =, 0.0); NV_D (axis, =, 0.0, 1.0, 0.0); NV_D (origin, =, 0.0, 0.0, 0.152); begin_f_loop (f, tf) { f_node_loop (f, tf, n) { v = F_NODE (f, tf, n); /* update node if x position is greater than 0.02 and that the current node has not been previously visited when looping through previous faces */ if (NODE_X (v) > 0.020 && NODE_POS_NEED_UPDATE (v)) { /* indicate that node position has been update so that it's not updated more than once */ NODE_POS_UPDATED (v); omega[1] = sign * pow (NODE_X (v)/0.230, 0.5); NV_VV (rvec, =, NODE_COORD (v), -, origin); NV_CROSS (dx, omega, rvec); NV_S (dx, *=, dtime); NV_V (NODE_COORD (v), +=, dx);
2 - 50
Summary
If there is relative motion between the boundary and its adjacent cell zone, Fluent will automatically choose the appropriate mesh scheme
z z
If the adjacent cell type is hex/quad, or wedge, it will use layering. If the adjacent cell type is tet/tri, it will use Spring Smoothing and Remeshing
The initial mesh needs to be decomposed according to the mesh scheme desired. Motion can be specified to face zones as well as to cell zones. Motion can be defined using profile, built-in in-cylinder piston profile, or UDF Motion can be prescribed or un-prescribe
2 - 51
2 - 52
2 - 53
sides
1
V_y (m/s)
0 1cm -1
0 .02
.005
.015
V_y
cells-tri bot
2 - 54
0.07cm
2 - 55
2 - 56
V_y (m/s)
0 -1
.005
.015
.02
Define Profile
2 - 57
V_y cells-tri
bot
2 - 58
sides
2 - 59
2 - 60
2 - 61
sides y x
1cm
V_y (m/s)
0 -1 .07cm
cells-tri
V_y
int
.005
.015
.02
cells-quad
.033cm
0.1cm
2 - 62
2 - 63
Rigid Body Motion applied to the interface between tri and quad.
y x
.07cm
cells-tri cells-quad
0.033
V_y
.033cm
int
2 - 64 Fluent Inc. 11/7/2005
sides y x
.07cm
2 - 65
2 - 66
How to setup up when layering starts from bottom wall? This requires motion of quad cells and use of stationary on the bottom wall.
2 - 67
y x
V_y
cells-quad
2 - 68 Fluent Inc. 11/7/2005
ALL nodes on quad moves unless declared as stationary. When declared as stationary, there will be relative motion between boundaries of the quad; therefore, layering will take place. y x
cells-quad
.033cm 2 - 69
bot
Fluent Inc. 11/7/2005
IF control of height for the tri is desired, specify Rigid Body motion to the interface and specify ideal height.
y x
.07cm
V_y
cells-tri cells-quad int
2 - 70
sides-tri y x
.07cm
2 - 71
2 - 72
How to setup if layering and remeshing starts and stops at different times? This requires two profiles, one for the quad and another one for the interface.
2 - 73
cells_quad 0 (m/s)
-1 0 .02 -1 .005 .01 Time (s) .015 ((cells-quad 5 point) (time 0 .005 .01 .015 .02) (v_y 0 -1 0 1 0)) -0 ((int 7 point) (time 0 .005 .005 .01 .015 .015 .02) -1 0 .02 Time (s) 2 - 74 .005 .01 .015 (v_y 0 -1 0 0 0 1 0))
cells-quad
int (m/s)
Profile File
Simple Non-Conformal
2 - 75
Simple Non-Conformal
DefineGrid Interfaces
z z z z
Select int_quad under Interface Zone 1 Select int_tri under Interface Zone 2 Specify name under Grid Interface Click on Create
cells-quad
cells-tri
int-quad
int-tri
2 - 76
Simple Non-Conformal
Only the sides that is part of the tri should be declared as Deforming.
cells-quad
cells-tri
int-quad
2 - 77
int-tri
Simple Non-Conformal
cells-tri
side-tri
2 - 78
2 - 79
Events is used to insert layering at crank-angle of 40 degrees and removed at crank angle of 40 (320 degrees).
cyl-side: deforming
2 - 81
The most common method is to delete non-conformal interface. Changing cell type from fluid to solid.
The above can be performed via the Events (DefineDynamic Mesh Events) But since events were implemented mainly to open and close valves in IC applications, it is in terms of Crank Angle! But it is easy to translate or transform our time into Crank Angle.
2 - 82
How to close a valve as shown on the right? You need to create the mesh with the non-conformal interface as shown.
-1
valve
v_ y
interface-1 interface-2
v_y (m/s)
-0
Low pressure
Fluent Inc. 11/7/2005
Define Global Controls and Motion Specification For ease, get 1-to-1 correspondence between Crank Angle (degrees) and time (seconds).
z
Specify the period for the oscillation, which is 0.02 seconds, as Crank Period = 0.02 deg The simulation will be run at time step size of 5e-5, so enter 5e-5 for Crank Angle Step Size Put any number > 0 for Piston Stroke and Connecting Rod Length
2 - 84
After setting up Global Parameters and defined Dynamic Zones, you need to define events in DefineDynamic MeshEvents In this example, at initial mesh, the valve is assumed closed, so enter 0 under At Crank Angle (deg) We will keep it closed for about 0.0001 second to make sure we get at least one step while it is closed.
2 - 85 Fluent Inc. 11/7/2005
2 - 86
2 - 87
2 - 88
Select Min and Max roughly as shown on the right figure. But this will give plot of all cells zones.
2 - 89
Min
Max
Fluent Inc. 11/7/2005
z z
Select the cell zone under Zones Name in Dynamic Zones panel Click on Zone Size Info.. But dont click on create!
For Minimum Volume in the remeshing parameters use a value slightly larger than reported above. For Maximum Volume in the remeshing parameters use a value slightly smaller that reported above.
2 - 90
Current Limitations
Cant have two deforming face zones attached. For deforming face zone, one need to have complete edge-loop You may also need to use deforming on a face zone if the adjacent cell zone is only being smoothed.
2 - 91
Examples
2 - 92
Passing Cars
2 - 93
Passing Cars
Prism layers move with the car.
2 - 94
Check Valves
Fluid-structure interaction Spring loaded valve. Determine ball position as a function of flow forces
z
2 - 95
Check Valves
The max displacement of the ball was known to be small. So only smoothing is used.
2 - 96
2 - 97
Fuel Injectors
Pure Layering
2 - 98
Fuel Injectors
Fuel Injectors
Velocity Contours
2 - 99
Compressors
Spring loaded valves Valve motion coupled to the flow solution via a UDF
2 - 100
Compressors
As the piston moves to BDC, intake valve opens and exhaust valve closes As the piston moves to TDC, intake valve closes and exhaust valve opens
2 - 101
2-Stroke Engines
Premixed combustion
Mesh motion
2 - 102
4-Stroke Engines
2 - 103
2 - 104
Gear Pumps
2 - 105
Volumetric Pump
All-hex grid
z
2 - 106
Volumetric Pump
2 - 107
Volumetric Pump
Pressure contours
2 - 108
Vibromixer
Contours of Velocity
2 - 109
Vibromixer
Pure Layering
2 - 110
Store Separation
2 - 111
Store Separation
2 - 112
Swimming Dolphin!
Flying Fly!