Proprietary
UDF와 Dynamic Mesh를 이용한
Coupled motion의 구현
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Outline
 Controlling Inlet velocity using DEFINE_PROFILE
 Controlling Rigid Body Motion using DEFINE_CG_MOTION
 Overview of the Dynamic Mesh (DM) Model
 Layering for Linear Motion
 Local Remeshing for Large, General Motion
 Coupled Mesh Motion via the 6 DOF Solver
 Coupled Mesh Motion via the 2 DOF User Defined Function
Lecture 1: Controlling
Inlet velocity using
DEFINE_PROFILE
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Introduction
 What is a User Defined Function?
 A UDF is a routine (programmed by the user) written in C which can be
dynamically linked with the solver.
 Standard C functions
s Trigonometric, exponential, control blocks, do-loops, file i/o, etc.
 Pre-Defined Macros
s Allows access to field variable, material property, and cell geometry
data.
 Why build UDF‟s?
 Standard interface cannot be programmed to anticipate all needs.
 Customization of boundary conditions, source terms, reaction rates,
material properties, etc.
 Adjust functions (once per iteration)
 Execute on Demand functions
 Solution Initialization
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
User-Defined Properties
User-Defined BCs
User Defined
INITIALIZE
Segregated PBCS
Exit Loop
Repeat
Check Convergence
Update Properties
Solve Turbulence Equation(s)
Solve Species
Solve Energy
Initialize Begin Loop
DBCS
Solve Other Transport Equations as required
Solver?
Solve Mass Continuity;
Update Velocity
Solve U-Momentum
Solve V-Momentum
Solve W-Momentum
Solve Mass
& Momentum
Solve Mass,
Momentum,
Energy,
Species
User-
defined
Source terms
Source terms
Source terms
Source
terms
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
UDF Basics
 UDF‟s assigns values (e.g., boundary data,
source terms) to individual cells and cell
faces
in fluid and boundary zones
 In a UDF, zones are referred to as threads
 A looping macro is used to access individual
cells belonging to a thread.
 For example, a face-loop macro visits 563
faces on face zone 3 (named inlet).
s Position of each face is available to
calculate and assign spatially varying
properties
 Thread and variable references are
automatically passed to the UDF when
assigned to a boundary zone in the GUI.
 Values returned to the solver by UDFs must
be in SI units.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Using UDFs in the Solvers
 The basic steps for using UDFs in FLUENT are as follows:
1. Create a file containing the UDF source code
2. Start the solver and read in your case/data files
3. Interpret or Compile the UDF
4. Assign the UDF to the appropriate variable and zone in BC panel.
5. Set the UDF update frequency in the Iterate panel
6. Run the calculation
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Example – Parabolic Inlet Velocity Profile
 We would like to impose a parabolic inlet velocity to the 2D elbow
shown.
 The x velocity is to be specified as
(
(
¸
(

¸

|
.
|

\
|
÷ =
2
0745 . 0
1 20 ) (
y
y u
0 = y
) ( y u
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Step 1 – Prepare the Source Code
 The DEFINE_PROFILE macro allows the function
inlet_x_velocity to
be defined.
 All UDFs begin with a DEFINE_
macro.
 inlet_x_velocity will be
identifiable in solver GUI.
 thread and nv are arguments of
the DEFINE_PROFILE macro,
which are used to identify the zone
and variable being defined,
respectively.
 The macro begin_f_loop loops over all faces f, pointed by thread
 The F_CENTROID macro assigns cell position vector to x[]
 The F_PROFILE macro applies the velocity component to face f
#include "udf.h“
{
float x[3]; /* Position vector*/
float y;
face_t f;
{
y = x[1];
= 20.*(1.- y*y/(.0745*.0745));
}
}
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
 Compiled UDF
 Add the UDF source code to the Source
Files list.
 Click Build to create UDF library.
 Click Load to load the library.
 You can also unload a library if needed.
 Interpreted UDF
 Add the UDF source code to the Source
File Name list.
 Click Interpret.
 The assembly language code will
display in the FLUENT console.
Step 3 – Interpret or Compile the UDF
Define User-Defined Functions Interpreted… Define User-Defined Functions Compiled…
Define User-Defined Functions Manage…
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Interpreted vs. Compiled UDFs
 Functions can either be read and interpreted at run time or compiled
and grouped into a shared library that is linked with the standard
FLUENT executable.
 Interpreted code vs. compiled code
 Interpreted
 Interpreter is a large program that sits in the computer‟s memory.
 Executes code on a “line by line” basis instantaneously
 Advantage – Does not require a third-party compiler.
 Disadvantage – Interpreter is slow and takes up memory.
 Compiled (refer to the FLUENT User‟s Guide for instructions)
 UDF code is translated once into machine language (object modules).
 Efficient way to run UDFs.
 Creates shared libraries which are linked with the rest of the solver
 Overcomes many interpreter limitations such as mixed mode arithmetic,
structure references, etc.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Step 4 – Activate the UDF
 Open the boundary condition
panel for the surface to which
you would like to apply the
UDF.
 Switch from Constant to the
UDF function in the X-Velocity
drop-down list.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Steps 5 and 6 – Run the Calculations
 You can change the UDF Profile Update Interval in the Iterate panel
(default value is 1).
 This setting controls how often (either iterations or time steps if unsteady)
the UDF profile is updated.
 Run the calculation as usual.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Macros
 Macros are functions defined by FLUENT.
 DEFINE_ macros allows definitions of UDF functionality.
 Variable access macros allow access to field variables and cell
information.
 Utility macros provide looping capabilities, thread identification, vector
and numerous other functions.
 Macros are defined in header files.
 The udf.h header file must be included in your source code.
#include “udf.h”
 The header files must be accessible in your path.
 Typically stored in Fluent.Inc/src/ directory.
 A list of often used macros is provided in the UDF User‟s Guide.
Help More Documentation…
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DEFINE Macros
 Any UDF you write must begin with a DEFINE_ macro:
 18 „general purpose‟ macros and 13 DPM and multiphase related macros
(not listed):
DEFINE_ADJUST(name,domain); general purpose UDF called every iteration
DEFINE_INIT(name,domain); UDF used to initialize field variables
DEFINE_ON_DEMAND(name); defines an „execute-on-demand‟ function
DEFINE_RW_FILE(name,fp); customize reads/writes to case/data files
DEFINE_PROFILE(name,thread,index); defines boundary profiles
DEFINE_SOURCE(name,cell,thread,dS,index); defines source terms
DEFINE_HEAT_FLUX(name,face,thread,c0,t0,cid,cir); defines heat flux
DEFINE_PROPERTY(name,cell,thread); defines material properties
DEFINE_DIFFUSIVITY(name,cell,thread,index); defines UDS and species diffusivities
DEFINE_UDS_FLUX(name,face,thread,index); defines UDS flux terms
DEFINE_SR_RATE(name,face,thread,r,mw,yi,rr); defines surface reaction rates
DEFINE_VR_RATE(name,cell,thread,r,mw,yi,rr,rr_t); defines vol. reaction rates
DEFINE_SCAT_PHASE_FUNC(name,cell,face); defines scattering phase function for DOM
DEFINE_DELTAT(name,domain); defines variable time step size for unsteady problems
DEFINE_TURBULENT_VISCOSITY(name,cell,thread); defines procedure for calculating turbulent viscosity
DEFINE_TURB_PREMIX_SOURCE(name,cell,thread,turbflamespeed,source); defines turb. flame speed
DEFINE_NOX_RATE(name,cell,thread,nox); defines NOx production and destruction rates
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Numerical Solution of the Example
 The figure at right shows the velocity field through
the 2D elbow.
 The bottom figure shows the velocity vectors at the
inlet. Notice the imposed parabolic profile.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Thread and Looping Utility Macros
cell_t c; Defines c as a cell thread index
face_t f; Defines f as a face thread index
Thread *t; t is a pointer to a thread
Domain *d; d is a pointer to collection of all threads
thread_loop_c(t, d){} Loop that visits all cell threads t in domain d
thread_loop_f(t, d){} Loop that visits all face threads t in domain d
begin_c_loop(c, ct) {} end_c_loop(c, ct)
Loop that visits all cells c in cell thread ct
begin_f_loop(f, ft) {} end_f_loop(f, ft)
Loop that visits all faces f in a face thread ft
c_face_loop(c, t, n){} Loop that visits all faces of cell c in thread t
Thread *tf = Lookup_Thread(domain, ID); Returns the thread pointer of zone ID
ID = THREAD_ID(tf); Returns the zone integer ID of thread pointer tf
Domain are part of FLUENT
UDF data structure
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Geometry and Time Macros
C_NNODES(c,t); Returns nodes/cell
C_NFACES(c,t); Returns faces/cell
F_NNODES(f,t); Returns nodes/face
C_CENTROID(x,c,t); Returns coordinates of cell centroid
in array x[]
F_CENTROID(x,f,t); Returns coordinates of face centroid
in array x[]
F_AREA(A,f,t); Returns area vector in array A[]
C_VOLUME(c,t); Returns cell volume
C_VOLUME_2D(c,t); Returns cell volume (axisymmetric domain)
real flow_time(); Returns actual time
int time_step; Returns time step number
RP_Get_Real(“physical-time-step”); Returns time step size
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Cell Field Variable Macros
C_R(c,t); Density
C_P(c,t); Pressure
C_U(c,t); U-velocity
C_V(c,t); V-velocity
C_W(c,t); W-velocity
C_T(c,t); Temperature
C_H(c,t); Enthalpy
C_K(c,t); Turbulent kinetic energy (k)
C_D(c,t); Turbulent dissipation rate (ε)
C_O(c,t); Specific dissipation of TKE (ω)
C_YI(c,t,i); Species mass fraction
C_UDSI(c,t,i); UDS scalars
C_UDMI(c,t,i); UDM scalars
C_DUDX(c,t); Velocity derivative
C_DUDY(c,t); Velocity derivative
C_DUDZ(c,t); Velocity derivative
C_DVDX(c,t); Velocity derivative
C_DVDY(c,t); Velocity derivative
C_DVDZ(c,t); Velocity derivative
C_DWDX(c,t); Velocity derivative
C_DWDY(c,t); Velocity derivative
C_DWDZ(c,t); Velocity derivative
C_MU_L(c,t); Laminar viscosity
C_MU_T(c,t); Turbulent viscosity
C_MU_EFF(c,t); Effective viscosity
C_K_L(c,t); Laminar thermal conductivity
C_K_T(c,t); Turbulent thermal conductivity
C_K_EFF(c,t); Effective thermal conductivity
C_CP(c,t); Specific heat
C_RGAS(c,t); Gas constant
C_DIFF_L(c,t); Laminar species diffusivity
C_DIFF_EFF(c,t,i); Effective species
diffusivity
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Face Field Variable Macros
 Face field variables are only available when using the segregated solver
and generally, only at exterior boundaries.
F_R(f,t); Density
F_P(f,t); Pressure
F_U(f,t); U-velocity
F_V(f,t); V-velocity
F_W(f,t); W-velocity
F_T(f,t); Temperature
F_H(f,t); Enthalpy
F_K(f,t); Turbulent KE
F_D(f,t); TKE dissipation
F_O(f,t); Specific dissipation of tke
F_YI(f,t,i); Species mass fraction
F_UDSI(f,t,i); UDS scalars
F_UDMI(f,t,i); UDM scalars
F_FLUX(f,t); Mass flux across face f, defined out of domain at boundaries.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Other UDF Applications
 In addition to defining boundary values, source
terms, and material properties, UDFs can be
used for:
 Initialization
 Executes once per initialization.
 Executes every iteration.
 Wall heat flux
 Defines fluid-side diffusive and radiative wall
heat fluxes in terms of heat transfer
coefficients
 Applies to all walls
 User-defined surface and volumetric reactions
 Read/write to/from case and data files
 Read order and write order must be same.
 Execute-on-Demand capability
 Does not participate in the solver iterations
Lecture 2: Controlling
Rigid Body Motion using
DEFINE_CG_MOTION
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DEFINE_CG_MOTION : Introduction
 In the previous lecture, we used the 6DOF UDF to couple the motion of
objects to the flow solution;
 We saw that the heart of the 6DOF UDF is the DEFINE_CG_MOTION macro;
 The macro simply governs how far the object will move/rotate during each time step
(it is called every time step);
 The object moves as a rigid body: all nodes and boundaries/walls associated with it
move as one, without any relative motion (deformation);
 The translational and rotational motions of the rigid body are specified with respect to
the CG (Center of Gravity) of the body;
 The macro works for both prescribed and coupled motions.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DEFINE_CG_MOTION; Example 1: Airdrop
 Let us revisit the airdrop of the
rescue pod
 Let us repeat the same example, but
use a UDF instead;
 The horizontal velocity component
will be zero, while the vertical one
will rise linearly and then stay
constant at –1 m/s. We will also use
a constant rotation of 0.3 rad/sec;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DEFINE_CG_MOTION; Example : Airdrop
#include "udf.h“
DEFINE_CG_MOTION(pod_prescribed_UDF, dt, cg_vel, cg_omega, time, dtime)
{
cg_vel[0] = 0.0;
if (time <= 3.0)
cg_vel[1] = - time/3.0;
else
cg_vel[1] = - 1.0;
cg_omega[0] = 0.0;
cg_omega[1] = 0.0;
cg_omega[2] = 0.3;
}
dt = dynamic thread
pointer
This is the complete UDF:
Note this name
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DEFINE_CG_MOTION; Example 1: Airdrop
 We hook the UDF in and preview
the motion (250 time steps of 0.03
seconds each)
Lecture 3: Overview of the
Dynamic Mesh (DM) Model
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Dynamic Mesh (DM) Model: Features
 Several meshing schemes are available to handle all types of boundary
motion;
 Boundaries/Objects may be moved based on:
 In-cylinder motion (RPM, stroke length, crank angle, …);
 Prescribed motion via profiles;
 Prescribed motion via UDF (User-Defined Function);
 Coupled motion based on hydrodynamic forces from the flow solution, via
FLUENT‟s 6 DOF model.
 First order accurate in time;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
DM Model: Mesh Motion Schemes
 Fluent‟s DM (Dynamic Mesh) model offers three meshing schemes:
 Spring analogy (smoothing);
 Local remeshing;
 Layering
 Mesh motion may be applied to individual zones;
 Different zones may use different schemes for mesh motion;
 Connectivity between adjacent deforming zones may be non-
conformal, e.g., there might be a sliding interface between two
neighboring zones.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Spring Analogy (Spring Smoothing)
 The nodes move as if connected via
springs, or as if they were part of a
sponge;
 Connectivity remains unchanged;
 Limited to relatively small deformations
when used as a stand-alone meshing
scheme;
 Available for tri and tet meshes;
 May be used with quad, hex and wedge
mesh element types, but that requires a
special command;
 We will see the details of this method in
one of next lectures.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
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;
 The animation also shows
smoothing (which one typically
uses together with remeshing).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
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.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Motion Specification
 Internal node positions are automatically calculated based on user
specified boundary motion:
 Prescribed mesh motion:
 Position or velocity versus time, i.e., „profile‟ text file;
 UDF with expression for position or velocity versus time (independent of
the flow solution).
 Flow dependent motion (coupled motion):
 Motion is coupled with hydrodynamic forces from the flow solution via
FLUENT‟s 6 DOF model.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Mesh Preview
 Mesh motion can be previewed without calculating flow variables:
 Allows user to quickly check mesh quality throughout the
simulation cycle;
 Applicable to any dynamic mesh simulation;
 Accessed via GUI: Solve > Mesh Motion;
 Be careful with the time step.
 Save your case before doing the preview, else the setup will be lost!
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Dynamic Mesh (DM) Model: Limitations
 Objects may not move from one fluid zone into another;
 Cannot (yet) be used in conjunction with hanging node adaption
 Constrained motion, such as a motion about a hinge, is only allowed if
one uses a UDF;
 Bodies may not make contact, since that implies a change in topology;
one always leaves at least one layer of cells between bodies;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Dynamic Mesh (DM) Model: Tips
 Suppose you are moving an object and a small fluid zone that
encapsulates it – the remaining, larger fluid zone is not moving. If you
just turn the small fluid zone into a dynamic zone, you will obtain the
correct dynamic mesh behavior. However, if you run the flow
calculation, you will get incorrect wall velocities unless you also turn
the walls of the object into dynamic zones!
 The topic of the next lecture is the layering method.
Lecture 4: Layering for Linear Motion
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Introduction
 Layering involves the creation
and destruction of cells;
 Available for quad, hex and
wedge mesh elements;
 Layering is used for purely
linear motion – two examples
are:
 A piston moving inside a
cylinder (see animation);
 A box on a conveyor belt.
 We will now look at these two
examples.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 For the piston, the piston wall is
moved up and down;
 The motion is governed by the “in-
cylinder” controls (see panel below):
Piston wall moves
Complex geometry near cylinder head
is tri meshed
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 Cells are being split or collapsed as
the piston wall comes near
(explanation on the next page):
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 Split if:
 Collapse if:
 h
ideal
is defined later, during
the definition of the
dynamic zones.
ideal S
h h ) 1 ( o + >
ideal c
h h o <
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 Constant Height:
 Every new cell layer has the same height;
 Constant Ratio:
 Maintain a constant ratio of cell heights
between layers (linear growth);
 Useful when layering is done in curved
domains (e.g. cylindrical geometry).
Piston at
top-most
position
Edge “i”
Edges “i” and
“i+1” have
same shape
Edge “i+1”
is an average
of edge “i”
and the
piston shape
Constant
Height
Constant
Ratio
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 Definition of the
dynamic zone:
piston (wall zone) moves as a
rigid body in the y-direction
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering Example 1: Piston
 Definition of the ideal
height of a cell layer;
 h
ideal
is about the same as
the height of a typical
cell in the model.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Other
Examples
 Fuel injector;
 Flow solution on the next slide.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Other Examples
 Fuel injector;
 Flow solution
(velocity contours).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Other Examples
 2-stroke engine;
 Of course, a 4-stroke engine could be
simulated in the same way
 Premixed combustion
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Other Examples
 Vibromixer;
 Layering;
 Flow solution on
next slide.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Other Examples
 Vibromixer;
 Layering;
 Flow solution
(contours of
velocity).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Limitations
 Layering is used for linear/translational motion;
 Layering is only available for quad, hex, and wedge cells (but you can have other
cell types in the stationary fluid zones);
 If the moving zone is bounded by a two-sided wall, then define a coupled, sliding
interface;
 In 2D, the sliding interfaces must be parallel, straight lines. In 3D, they must be
sides of a prismatic cylinder (i.e., a cylinder with constant cross section);
 One layer of quad cells must always remain, i.e., one cannot eliminate a dynamic
zone;
 If you turn a fluid zone into a dynamic zone, you should also turn the associated
moving walls into dynamic zones – otherwise the incorrect wall boundary
conditions will be applied, and you will get unphysical velocities adjacent to the
wall.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Layering: Tips & Tricks
 If you use the in-cylinder tool, be sure to set the in-cylinder parameters before you
define the dynamic zones;
 Similarly, delete the dynamic zones before making changes to the in-cylinder
parameters, and afterwards redefine the dynamic zones;
 While preparing a nonconformal (sliding) interface within Gambit, be sure that the
two fluid zones are totally disconnected. Even nodes on the interface must be
disconnected (i.e., duplicate). If one does not do this, then the typical symptom is
that the dynamic mesh fails, with nodes from the static fluid zone being dragged
along by nodes in the layering zone;
 Also, be sure that the cells are of similar size on both sides of the interface;
otherwise, the dynamic mesh may fail and report negative volumes.
 If you use sliding interfaces, keep the mesh density on both sides similar;
Lecture 5: Local Remeshing for Large,
General Motion
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Introduction
 If the relative motions of the
boundaries are large and
general (both translation and
rotation may be involved), then
we need to remesh locally;
 Why local remeshing? For
efficiency, FLUENT remeshes
only those cells that exceed the
specified maximum skewness
and/or fall outside the specified
range of cell volumes;
 In the flowmeter shown, the
cuff rocks and reciprocates
(rotates and translates
sinusoidally).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Introduction
 Local Remeshing is used for cases involving large, general motion:
 Cars passing (overtaking) each other;
 Rescue capsule dropped from an airplane (store separation);
 The motion of two intermeshing gears;
 Two stages of a rocket separating from each other (stage separation).
 Local remeshing is available for tri/tet meshes only.
 We will look at three examples:
 Butterfly valve;
 Simple piston;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 The butterfly valve
rotates, governed by
a profile;
 Flow is from left to
right;
 One challenge is that
the mesh is much
finer at the valve‟s
tips than at its center;
 The tip tends to leave
a “wake” of small
cells;
 Small gaps require
3-5 cells, otherwise
one gets unphysical
velocities.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 The mesh was made
in Gambit;
 Valve radius is 0.1 m
 Small gap (9 mm)
has 3 cells across;
 The rounded portion
of the housing has a
variable cell size;
 Minimum cell
length is about 3 mm
(0.003 m);
 1674 cells, max.
skewness 0.39
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 The motion of the butterfly valve is governed by a profile:
((butterfly 6 point)
(time 0 0.6 1.0 2.2 2.6 3.2)
(omega_z 0.0 1.571 1.571 -1.571 -1.571 0.0)
)
Time (sec)
3.2
1.571
0.0
 The valve first rotates
CCW through 90
degrees, then CW;
 The maximum
rotational speed is
15 RPM.
0.6
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 Use Mesh Scale Info…to find the
minimum and maximum length scale of the
initial mesh ;
 Base your specification of the minimum
and maximum length scale on the initial
mesh;
 Base your specification of the maximum
cell skewness on the initial mesh, and on
the rule-of-thumb: 0.7 for 2D, 0.85 for 3D.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 Define > DynamicMesh > Zones
 Select the wall of the valve
(“wall-butterfly”) and make it move
as a rigid body,
driven by the
profile “butterfly”;
 The CG is located
at (0,0);
 Ideal cell height is
0.003 m, based on
the smallest cell
length of the initial
mesh; h
ideal
controls
the cell size adjacent
to the moving wall.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 1: Butterfly Valve
 Previewing the mesh motion:
 Choose a first time step based on the
length of the smallest cell and on the
maximum velocity;
 In our case:
s
s m
m
v
s
t 018 . 0
/ 16 . 0
003 . 0
= =
A
= A
 We chose to display the mesh
motion to the screen, and to:
 Capture every seventh frame
to disk (be sure to visit
File > Hardcopy before you
begin)
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 2: Piston
 Effect of Size Remesh
Interval (SRI):
 If SRI is high, then
remeshing is dominated
by skewness;
 Here SRI = 10;
 Note that cells adjacent
to the moving wall get
stretched/large
(especially on the way
down);
 Also note how localized
the remeshing is.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing Example 2: Piston
 Effect of Size
Remesh Interval
(SRI):
 If SRI is low,
then remeshing
is strongly
affected by both
size and
skewness;
 Here SRI = 1;
 Note that cells
wall don‟t get
stretched as
much.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: 12 Short Examples
 Idealized valve (wall
both move as rigid
bodies):
 Remeshing and
smoothing;
 Two fluid zones;
 Two deforming
symmetry
boundaries
(remeshing only);
 One deforming
non-conformal,
sliding interface
(remeshing only).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 2/12
 Piston with tri mesh
mesh below:
 The “piston” (blue
interior edge) is
the dynamic zone,
moves as a rigid
body;
 Remeshing and
smoothing above;
 Layering below;
 Two fluid zones;
 Deforming side
walls only needed
next to tris.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 3/12
 Same as before, but
let us create cell
layers at the bottom:
 The “piston” (blue
interior edge) and
moving as rigid
bodies;
 Two fluid zones;
 The bottom wall is
a dynamic zone of
type “stationary”;
 Deforming side
walls only needed
next to tris.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 4/12
 Another cylinder, but
here we first move the
quad-fluid and the blue
interior edge downward
as a rigid body, while
the tri-fluid expands
(remeshing and
smoothing, plus
deforming side walls)
 Then we freeze the blue
interior edge (as well as
the tri-fluid), and start
generating cell layers
there;
 Driven by two profiles,
one for the blue edge
and one for the quad-
fluid.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing:
Short Example 5/12
 Here is an application of the previous
set-up: a compressor with spring-
loaded intake and exhaust valves;
 Flow solution on the next slide:
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing:
Short Example 5/12
 Compressor with spring-loaded
intake and exhaust valves;
 Flow solution.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 6/12
 An example involving
layering, remeshing,
smoothing, and
nonconformal
interfaces;
 4 dynamic zones:
 two bottom walls
are moving as rigid
bodies;
 the tri-side of the
nonconformal is
deforming;
 the right wall is
deforming.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 7/12
 An HVAC valve:
 Remeshing and
smoothing;
 Nonconformal grid
interface (circular
arc);
 Flow solution on next
slide.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 7/12
 An HVAC valve:
 Flow solution (contours
of temperature);
 The small gaps are fully
blocked.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 8/12
 Automotive valve:
 Remeshing,
smoothing, and
layering;
 4 nonconformal grid
interfaces (vertical
lines);
 The gaps are fully
blocked;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 9/12
 Two cars
passing
each other;
 Wedge cells
move with
the car (as
rigid body).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 10/12
 Gear pump
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 11/12
 Positive
displacement
pump
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 12/12
 Airplane
wing‟s
control
surface
(aileron);
 Flow
solution on
next slide:
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 12/12
 Airplane
wing‟s
control
surface
(aileron):
2D flow
solution.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Short Example 12/12
 Airplane
wing‟s
control
surface
(aileron):
3D.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Limitations
 One cannot use hanging-node adaption together with the local remeshing
method (this includes dynamic adaption);
 Local remeshing is only possible with tri and tet cells;
 Mixed zones are not allowed (e.g., a fluid zone with a mix of tet and wedge
cells);
 Nodes on a boundary can only be moved if we can project them onto a
simple geometric entity, such as: a plane, a cylinder, or a user-defined
surface;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Tips
 During the remeshing, the Fluent GUI reports a skewness: this is the
skewness before the boundaries/objects move, so the skewness at the end of
the time step will be higher;
 Start with a 2D problem, to develop a feel for the proper settings;
 Remember that the final skewness can only be controlled indirectly;
 Be prepared to spend time adjusting parameters (time step, ideal cell height,
minimum and maximum volumes, maximum skewness, size remesh interval,
etc.);
 If your model has small gaps (flow passages), then you generally need at
least 3-5 cells across that gap. Otherwise, you may get unphysical velocities.
This makes models with tight spaces (gear pumps, g-rotors, etc.) difficult,
and one often has to use even fewer cell layers in the gap;
 Set “Maximum Cell Skewness” to about 0.7 in 2D, and to about 0.85 in 3D;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
Local Remeshing: Tips
 Be sure to choose a sufficiently small time step – otherwise the dynamic
mesh may fail; a rule of thumb is that the mesh motion during one time step
should be less than one-half of the smallest cell dimension;
 The use of smoothing (in addition to remeshing) may allow you to use larger
time steps;
 Problems with the time step size may already become evident during the
preview;
 If the motion of the moving object is limited, it may be a good idea to split
the fluid domain into two fluid zones: you can thereby restrict the remeshing
to just one of those two zones and reduce the computational effort.
Lecture 6: Coupled Mesh Motion via
the 6 DOF Solver
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF Coupled Motion: Introduction
 So far, we have only used prescribed motion: we specified the location or
velocity of the object using the in-cylinder tool or a profile;
 Now we would like to move the object as a result of the aerodynamic forces
and moments acting together with other forces, such as the force due to
gravity, thrust forces, or ejector forces (i.e., forces used to initially push
objects away from an airplane or rocket, to avoid collisions);
 In other words, we want the motion/trajectory of the object to involve the
aerodynamic forces/moments: the motion and the flow field are thus
coupled, and we call this coupled motion;
 Fluent provides a dynamic mesh model that computes the trajectory of an
object based on the aerodynamic forces/moments, gravitational force, and
ejector forces. This is often called a 6 DOF Solver.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF Solver
 Motion is coupled with hydrodynamic forces from the flow solution via
FLUENT’s 6 DOF model.
 A udf is needed to specify the mass and the initial inertia matrix, which can be
time dependent
#include "udf.h“
DEFINE_SDOF_PROPERTIES(stage, prop, dt, time, dtime)
{
prop[SDOF_MASS] = 800.0;
prop[SDOF_IXX] = 200.0;
prop[SDOF_IYY] = 100.0;
prop[SDOF_IZZ] = 100.0;
Message("\nstage: updated 6DOF properties");
}
 Inertial matrix needs to be specified in global coordinate
 A udf is written to convert values from principle axis to global coordinate
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 We will learn about the 6 DOF UDF by applying it to the airdrop of the rescue pod;
 Let us begin by making changes to the UDF before we compile it. We begin with
the mass and second moments in the local coordinate system:
#include "udf.h"
DEFINE_SDOF_PROPERTIES(store, prop, dt, time, dtime)
{
/* Define the mass matrix */
prop[SDOF_MASS] = 5000.;
prop[SDOF_IZZ] = 5000.;
/* add ejector forces, moments */
if (time <= 0.3)
{
}
Message0("\nUpdated 6DOF properties\n");
}
Excerpt from the 6 DOF UDF:
Mass of the rescue pod (5,000 kg)
Second moments of inertia of the rescue pod
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 The user continues by adjusting the ejector forces in the global coordinate system:
#include "udf.h"
DEFINE_SDOF_PROPERTIES(store, prop, dt, time, dtime)
{
/* Define the mass matrix */
prop[SDOF_MASS] = 5000.;
prop[SDOF_IZZ] = 5000.;
/* add ejector forces, moments */
if (time <= 0.3)
{
}
Message0("\nUpdated 6DOF properties\n");
}
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Having made the changes to the 6 DOF UDF, we are ready to hook it into
the case;
 We load the case we had already set up (for which we had driven the motion
with a profile);
 Then we compile the 6 DOF UDF as shown: first add the UDF (property.c),
then build a library (store::libudf), and finally load that library:
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Adjusts the gravity vector in the global coordinate system:
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Next we revisit the definition of the dynamic zones, and select “store::libudf”
as the UDF that drives the motion of the pod‟s walls (“wall-object”):
“fluid-bl”
“wall-object”
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Next we select “store::libudf” as the UDF that drives the motion of the fluid
zone (“fluid-bl”) consisting of the quad cells in the boundary layer adjacent to
the rescue pod:
“fluid-bl”
“wall-object”
Passive option will allow “fluid-bl” to
move with the “wall-object” but it does
not contribute to the force calculation
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Even in cases with
coupled motion, it is wise
to preview the mesh
motion before carrying
out the flow calculations;
 In this case, one can start
without initializing, and
the object will simply
drop under the influence
of gravity;
 One can observe the effect
of one‟s choices for the
dynamic mesh parameters
(such as the spring
constant, the maximum
skewness, etc.).
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF; Example 1: Airdrop
 Finally, one can re-load the
case (to get back to the
original mesh) and compute
the flow and the coupled
motion;
 The figure shows pressure
contours corresponding to a
freestream Mach number of
0.8 – note how the object has
drifted aft;
 This problem exists as a
tutorial.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF coupled motion; short examples (1 of 4)
 Store dropped from a
delta wing (NACA
64A010) at Mach 1.2;
 Ejector forces
dominate for a short
time;
 All-tet mesh;
 Smoothing;
remeshing with size
function;
 Fluent results agree
very well with wind
tunnel results!
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF coupled motion; short examples (2 of 4)
 Silo launch; UDF computes thrust force;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF coupled motion; short examples (3 of 4)
 Projectile moving
inside and out of a
barrel;
 Initial patch in the
chamber drives
the motion;
 User-defined real
gas law (Abel-
Nobel Equation of
State);
 Layering;
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF coupled motion; short examples (4 of 4)
 Rocket
stage
separation;
 Smoothing
and
remeshing.
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
6 DOF coupled motion; Tips
 Even in cases with coupled motion, it is wise to preview the mesh motion
before carrying out the flow calculations (which can be expensive);
 Sometimes one can proceed without initialization, and observe a linear motion
in the direction of the gravity vector;
 Other times it is better to compute a steady solution to obtain an initial
distribution of pressures and shear stresses. After convergence, one switches
to the unsteady solver and hooks in the UDF. During the preview, the object
will move based on the forces that resulted from the steady calculation – the
motion usually involves both translation and rotation;
Lecture 7: Coupled Mesh Motion via
the 2 DOF User Defined Function
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• Wigley hull advancing in calm water moves in 2 degrees of freedom – heave
& pitch
Rotation as well as
Translation
Translation
Translation is in the direction of heave
Collapse & Split
Yellow lines are interfaces
2DOF Heave & Pitch
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• Time-dependant calculation using Fluent‟s VOF multiphase model
2DOF Heave & Pitch
Pressure Inlet (air)
Pressure Inlet
(water) – use open
channel boundary
condition
Pressure Outlent
(water) – use open
channel boundary
condition
Pressure Outlet
(water)
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• Use open channel boundary condition to resolve hydrostatic pressure
distribution in water
2DOF Heave & Pitch
User-defined function is used to generate wave at water inlet
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• Use open channel boundary condition to resolve hydrostatic pressure
distribution in water
2DOF Heave & Pitch
User-defined function is used to generate wave at water inlet
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• UDF for wave generation
2DOF Heave & Pitch
#include "udf.h"
{
face_t f;
real t = CURRENT_TIME;
{
F_PROFILE(f, thread, position) = 5.0 + 5.0*sin(10.0*t + M_PI*1.5);
}
}
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
• We can not use 6 DOF solver in Fluent, because we have to confine one
translational motion.
• Another UDF is needed to specify the mass and the initial inertia matrix,
compute forces and moment, and drive an object to move.
2DOF Heave & Pitch
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
2DOF Heave & Pitch
 After compiling and loading the UDF, select “two_dof::libudf” as the UDF that
drives the motion of the fluid zones and wall zone:
“fluid_rotate”
“fluid_layer”
“moving_body”
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
2DOF Heave & Pitch
 Next we select “Stationary” zone for layering:
“top_wall_stat”
“bottom_wall_stat”
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
2DOF Heave & Pitch
 Initialize variables and patch water volume fraction as “1” to initial free
surface level
Fluent User Services Center
www.fluentusers.com
Dynamic Mesh Training Notes
UGM at Marine Industries 2007
2DOF Heave & Pitch
 Iterate until the solution converge without time advancement to get initial
hydrostatic pressure distribution.

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

Outline
      

Controlling Inlet velocity using DEFINE_PROFILE Controlling Rigid Body Motion using DEFINE_CG_MOTION Overview of the Dynamic Mesh (DM) Model Layering for Linear Motion Local Remeshing for Large, General Motion Coupled Mesh Motion via the 6 DOF Solver Coupled Mesh Motion via the 2 DOF User Defined Function

2

ANSYS, Inc. Proprietary

Lecture 1: Controlling Inlet velocity using DEFINE_PROFILE

ANSYS, Inc. Proprietary

material property.     Customization of boundary conditions. All rights reserved. . etc. file i/o. etc.fluentusers. do-loops. material properties.  Why build UDF‟s?  Standard interface cannot be programmed to anticipate all needs.com Introduction  What is a User Defined Function?  A UDF is a routine (programmed by the user) written in C which can be dynamically linked with the solver. Adjust functions (once per iteration) Execute on Demand functions Solution Initialization 4 ANSYS. and cell geometry data. exponential. control blocks. Inc. reaction rates. Proprietary © 2006 ANSYS. Inc.  Pre-Defined Macros s Allows access to field variable. source terms.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.  Standard C functions s Trigonometric.

All rights reserved. Momentum. Proprietary . Update Velocity Source terms Solve Mass. Energy.com User Access to the FLUENT Solver Segregated Userdefined ADJUST PBCS DBCS Initialize Begin Loop Solver? Source terms User Defined INITIALIZE Repeat Solve U-Momentum Solve V-Momentum Solve W-Momentum Solve Mass Continuity.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc.fluentusers. Inc. 5 ANSYS. Species Solve Mass & Momentum Source terms Exit Loop Check Convergence Update Properties User-Defined Properties User-Defined BCs Solve Energy Solve Species Solve Turbulence Equation(s) Solve Other Transport Equations as required Source terms © 2006 ANSYS.

fluentusers. s Position of each face is available to calculate and assign spatially varying properties  Thread and variable references are automatically passed to the UDF when assigned to a boundary zone in the GUI.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.g.  For example.  Values returned to the solver by UDFs must be in SI units. zones are referred to as threads A looping macro is used to access individual cells belonging to a thread. 6 ANSYS. a face-loop macro visits 563 faces on face zone 3 (named inlet).com UDF Basics  UDF‟s assigns values (e. boundary data. . Inc. Inc.. Proprietary © 2006 ANSYS. source terms) to individual cells and cell faces in fluid and boundary zones   In a UDF. All rights reserved.

2. 7 ANSYS. 5. All rights reserved.com Using UDFs in the Solvers  The basic steps for using UDFs in FLUENT are as follows: 1.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. 3. Create a file containing the UDF source code Start the solver and read in your case/data files Interpret or Compile the UDF Assign the UDF to the appropriate variable and zone in BC panel. Inc. 6. Set the UDF update frequency in the Iterate panel Run the calculation © 2006 ANSYS. Proprietary . Inc. 4.

8 ANSYS. Inc. Proprietary . Inc.0745    y0 u( y) © 2006 ANSYS. The x velocity is to be specified as   y 2  u ( y )  20 1       0.com Example – Parabolic Inlet Velocity Profile   We would like to impose a parabolic inlet velocity to the 2D elbow shown. All rights reserved.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

You can also unload a library if needed. The assembly language code will display in the FLUENT console. Click Interpret. Click Load to load the library. Click Build to create UDF library. All rights reserved.     Add the UDF source code to the Source Files list. Inc. 10 .com Step 3 – Interpret or Compile the UDF  Interpreted UDF Define User-Defined Functions Interpreted…  Compiled UDF Define User-Defined Functions Compiled…    Add the UDF source code to the Source File Name list. Inc. Proprietary © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. Define User-Defined Functions Manage… ANSYS.

Inc. Disadvantage – Interpreter is slow and takes up memory. Proprietary . UDF code is translated once into machine language (object modules).fluentusers. structure references. etc.com Interpreted vs.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Compiled UDFs   Functions can either be read and interpreted at run time or compiled and grouped into a shared library that is linked with the standard FLUENT executable. All rights reserved. Executes code on a “line by line” basis instantaneously Advantage – Does not require a third-party compiler. Creates shared libraries which are linked with the rest of the solver Overcomes many interpreter limitations such as mixed mode arithmetic.  Compiled (refer to the FLUENT User‟s Guide for instructions)     © 2006 ANSYS. compiled code  Interpreted     Interpreter is a large program that sits in the computer‟s memory. 11 ANSYS. Interpreted code vs. Inc. Efficient way to run UDFs.

Switch from Constant to the UDF function in the X-Velocity drop-down list. Proprietary . Inc.fluentusers. 12 ANSYS.com Step 4 – Activate the UDF  Open the boundary condition panel for the surface to which you would like to apply the UDF.  © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. All rights reserved.

 This setting controls how often (either iterations or time steps if unsteady) the UDF profile is updated. All rights reserved.com Steps 5 and 6 – Run the Calculations  You can change the UDF Profile Update Interval in the Iterate panel (default value is 1).Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Proprietary .fluentusers. Inc. © 2006 ANSYS. 13 ANSYS.  Run the calculation as usual. Inc.

16 ANSYS. Proprietary .fluentusers. The bottom figure shows the velocity vectors at the inlet.  © 2006 ANSYS.com Numerical Solution of the Example  The figure at right shows the velocity field through the 2D elbow. All rights reserved.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. Notice the imposed parabolic profile. Inc.

Returns cell volume C_VOLUME_2D(c. Returns time step number RP_Get_Real(“physical-time-step”).t). Returns time step size © 2006 ANSYS. 18 ANSYS. C_CENTROID(x. Returns actual time int time_step.t). All rights reserved.f.c.f.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.t). C_NFACES(c. F_NNODES(f.t). Inc. Returns nodes/cell Returns faces/cell Returns nodes/face Returns coordinates of cell centroid in array x[] F_CENTROID(x.t). Returns cell volume (axisymmetric domain) real flow_time().t). Proprietary .com Geometry and Time Macros C_NNODES(c.t). Returns area vector in array A[] C_VOLUME(c. Returns coordinates of face centroid in array x[] F_AREA(A.t). Inc.

t). U-velocity C_V(c.t). Turbulent kinetic energy (k) C_D(c. Proprietary .t).t). Species mass fraction C_UDSI(c. Pressure C_U(c. Specific heat C_RGAS(c. Density C_P(c. Turbulent viscosity C_MU_EFF(c.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.t).t.t). Turbulent thermal conductivity C_K_EFF(c. Inc. Effective thermal conductivity C_CP(c.i). V-velocity C_W(c.i). C_DVDY(c. UDM scalars C_DUDX(c.t).t). Turbulent dissipation rate (ε) C_O(c. C_DWDX(c. UDS scalars C_UDMI(c.t). C_DWDZ(c.t).t).t).t). Effective species diffusivity 19 ANSYS. Enthalpy C_K(c.t).t). Specific dissipation of TKE (ω) C_YI(c. Velocity derivative Velocity derivative Velocity derivative Velocity derivative Velocity derivative Velocity derivative Velocity derivative Velocity derivative Velocity derivative C_MU_L(c.t). C_DUDZ(c.t).fluentusers.t). C_DWDY(c.t).t).i). W-velocity C_T(c. Laminar viscosity C_MU_T(c.t). Effective viscosity C_K_L(c. C_DUDY(c. Temperature C_H(c.t). Laminar species diffusivity C_DIFF_EFF(c. C_DVDX(c. © 2006 ANSYS. Gas constant C_DIFF_L(c.t. All rights reserved.t). Laminar thermal conductivity C_K_T(c.t).t).t.i).t).t. C_DVDZ(c. Inc.t).com Cell Field Variable Macros C_R(c.t).

Turbulent KE F_D(f. defined out of domain at boundaries. UDM scalars F_FLUX(f. UDS scalars F_UDMI(f. V-velocity F_W(f. Inc.t).t).t).i).t).t).t. F_R(f. Enthalpy F_K(f.t. © 2006 ANSYS. Temperature F_H(f. Pressure F_U(f.i). W-velocity F_T(f.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 20 ANSYS. Species mass fraction F_UDSI(f. Proprietary .t). only at exterior boundaries. Density F_P(f. Specific dissipation of tke F_YI(f.t).t).t).t).t). All rights reserved. U-velocity F_V(f. Mass flux across face f.fluentusers. TKE dissipation F_O(f.i).com Face Field Variable Macros  Face field variables are only available when using the segregated solver and generally.t. Inc.

Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Proprietary . Executes every iteration. UDFs can be used for:  Initialization  Executes once per initialization.fluentusers.  Solution adjustment   Wall heat flux   Defines fluid-side diffusive and radiative wall heat fluxes in terms of heat transfer coefficients Applies to all walls   User-defined surface and volumetric reactions Read/write to/from case and data files  Read order and write order must be same. 21 ANSYS. All rights reserved. and material properties. Does not participate in the solver iterations  Execute-on-Demand capability  © 2006 ANSYS.com Other UDF Applications  In addition to defining boundary values. source terms. Inc.

Inc.Lecture 2: Controlling Rigid Body Motion using DEFINE_CG_MOTION © 2006 ANSYS. Proprietary . All rights reserved. Inc. ANSYS.

We saw that the heart of the 6DOF UDF is the DEFINE_CG_MOTION macro. without any relative motion (deformation).com DEFINE_CG_MOTION : Introduction    In the previous lecture. The object moves as a rigid body: all nodes and boundaries/walls associated with it move as one. The macro works for both prescribed and coupled motions. All rights reserved. 23 ANSYS. we used the 6DOF UDF to couple the motion of objects to the flow solution. Inc. The translational and rotational motions of the rigid body are specified with respect to the CG (Center of Gravity) of the body. Inc.fluentusers. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.    © 2006 ANSYS. The macro simply governs how far the object will move/rotate during each time step (it is called every time step).

fluentusers. © 2006 ANSYS. All rights reserved. Proprietary . Example 1: Airdrop    Let us revisit the airdrop of the rescue pod Let us repeat the same example. 24 ANSYS. We will also use a constant rotation of 0. Inc.com DEFINE_CG_MOTION. The horizontal velocity component will be zero. Inc. while the vertical one will rise linearly and then stay constant at –1 m/s.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. but use a UDF instead.3 rad/sec.

dtime) { cg_vel[0] = 0. Note this name cg_omega[0] = 0.0.1. dt. 25 ANSYS.3. } © 2006 ANSYS. else cg_vel[1] = .0) pointer cg_vel[1] = .com DEFINE_CG_MOTION.0. time.0. Proprietary . cg_vel. All rights reserved.0. Inc. Example : Airdrop This is the complete UDF: #include "udf.0. Inc. dt = dynamic thread if (time <= 3. cg_omega[2] = 0. cg_omega.fluentusers.time/3.h“ DEFINE_CG_MOTION(pod_prescribed_UDF. cg_omega[1] = 0.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

03 seconds each) © 2006 ANSYS. Proprietary .fluentusers. All rights reserved.com DEFINE_CG_MOTION. 26 ANSYS. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Example 1: Airdrop  We hook the UDF in and preview the motion (250 time steps of 0. Inc.

Lecture 3: Overview of the Dynamic Mesh (DM) Model

ANSYS, Inc. Proprietary

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

Dynamic Mesh (DM) Model: Features

Several meshing schemes are available to handle all types of boundary motion; Boundaries/Objects may be moved based on:
  

In-cylinder motion (RPM, stroke length, crank angle, …); Prescribed motion via profiles; Prescribed motion via UDF (User-Defined Function); Coupled motion based on hydrodynamic forces from the flow solution, via FLUENT‟s 6 DOF model.

First order accurate in time;

28

ANSYS, Inc. Proprietary

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

DM Model: Mesh Motion Schemes

Fluent‟s DM (Dynamic Mesh) model offers three meshing schemes:
  

Spring analogy (smoothing); Local remeshing; Layering

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, e.g., there might be a sliding interface between two neighboring zones.

29

ANSYS, Inc. Proprietary

All rights reserved. Available for tri and tet meshes.com Spring Analogy (Spring Smoothing)       The nodes move as if connected via springs. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 30 ANSYS. hex and wedge mesh element types. but that requires a special command. or as if they were part of a sponge. We will see the details of this method in one of next lectures. © 2006 ANSYS. Connectivity remains unchanged. May be used with quad.fluentusers. Limited to relatively small deformations when used as a stand-alone meshing scheme. Proprietary . Inc.

com Local Remeshing     As user-specified skewness and size limits are exceeded. 31 ANSYS. Available only for tri and tet mesh elements. As cells are added or deleted. Inc. connectivity changes. All rights reserved.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Proprietary . © 2006 ANSYS. local nodes and cells are added or deleted. The animation also shows smoothing (which one typically uses together with remeshing).fluentusers. Inc.

© 2006 ANSYS. All rights reserved. As cells are added or deleted.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc.fluentusers. Available for quad. 32 ANSYS. Inc. Proprietary .com Layering    Cells are added or deleted as the zone grows and shrinks. hex and wedge mesh elements. connectivity changes.

All rights reserved. Inc.fluentusers. „profile‟ text file. 33 ANSYS.. i. UDF with expression for position or velocity versus time (independent of the flow solution).e.  Flow dependent motion (coupled motion):  © 2006 ANSYS. Inc. Motion is coupled with hydrodynamic forces from the flow solution via FLUENT‟s 6 DOF model.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Proprietary .com Motion Specification   Internal node positions are automatically calculated based on user specified boundary motion: Prescribed mesh motion:   Position or velocity versus time.

fluentusers.  Applicable to any dynamic mesh simulation.com Mesh Preview  Mesh motion can be previewed without calculating flow variables:  Allows user to quickly check mesh quality throughout the simulation cycle.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. else the setup will be lost! © 2006 ANSYS. All rights reserved.  Save your case before doing the preview.  Accessed via GUI: Solve > Mesh Motion. Proprietary .  Be careful with the time step. Inc. 34 ANSYS. Inc.

is only allowed if one uses a UDF. Proprietary . © 2006 ANSYS. such as a motion about a hinge. 35 ANSYS. since that implies a change in topology. Bodies may not make contact. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers.com Dynamic Mesh (DM) Model: Limitations     Objects may not move from one fluid zone into another. one always leaves at least one layer of cells between bodies. Inc. Constrained motion. All rights reserved. Cannot (yet) be used in conjunction with hanging node adaption (including dynamic adaption).

However.fluentusers.  © 2006 ANSYS. larger fluid zone is not moving. you will obtain the correct dynamic mesh behavior. If you just turn the small fluid zone into a dynamic zone. if you run the flow calculation.com Dynamic Mesh (DM) Model: Tips  Suppose you are moving an object and a small fluid zone that encapsulates it – the remaining. Inc. All rights reserved. you will get incorrect wall velocities unless you also turn the walls of the object into dynamic zones! The topic of the next lecture is the layering method. Proprietary . 36 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc.

Inc. Proprietary . ANSYS. All rights reserved.Lecture 4: Layering for Linear Motion © 2006 ANSYS. Inc.

Proprietary . Available for quad. © 2006 ANSYS. Layering is used for purely linear motion – two examples are:   A piston moving inside a cylinder (see animation). 38 ANSYS. A box on a conveyor belt.com Layering: Introduction    Layering involves the creation and destruction of cells. All rights reserved. Inc.fluentusers. hex and wedge mesh elements.  We will now look at these two examples. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

Inc. The motion is governed by the “incylinder” controls (see panel below): Complex geometry near cylinder head is tri meshed Piston wall moves © 2006 ANSYS. the piston wall is moved up and down. Inc. Proprietary . All rights reserved.com Layering Example 1: Piston   For the piston.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 39 ANSYS.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. Proprietary . All rights reserved.com Layering Example 1: Piston  Cells are being split or collapsed as the piston wall comes near (explanation on the next page): © 2006 ANSYS.fluentusers. Inc. 40 ANSYS.

41 ANSYS.fluentusers. Proprietary . during the definition of the dynamic zones. Inc. Inc.com Layering Example 1: Piston   Split if: Collapse if: h  (1   S )hideal h   c hideal  hideal is defined later. All rights reserved.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. © 2006 ANSYS.

42 ANSYS. All rights reserved. Inc.fluentusers. Proprietary . cylindrical geometry). Maintain a constant ratio of cell heights between layers (linear growth).com Layering Example 1: Piston  Constant Height:  Every new cell layer has the same height.g. Constant Height Edges “i” and “i+1” have same shape  Constant Ratio:   Piston at top-most position Constant Ratio Edge “i+1” is an average of edge “i” and the piston shape Edge “i” © 2006 ANSYS. Inc. Useful when layering is done in curved domains (e.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

Proprietary . Inc. All rights reserved.fluentusers. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 43 ANSYS.com Layering Example 1: Piston  Definition of the dynamic zone: piston (wall zone) moves as a rigid body in the y-direction © 2006 ANSYS.

Inc.fluentusers.com Layering Example 1: Piston   Definition of the ideal height of a cell layer. 44 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. hideal is about the same as the height of a typical cell in the model. © 2006 ANSYS. Proprietary . All rights reserved. Inc.

© 2006 ANSYS.com Layering: Other Examples   Fuel injector. Inc. Proprietary . All rights reserved.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. Flow solution on the next slide. 45 ANSYS.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 46 ANSYS.fluentusers.com Layering: Other Examples   Fuel injector. All rights reserved. Proprietary . Inc. Flow solution (velocity contours). Inc. © 2006 ANSYS.

fluentusers. All rights reserved. Inc. a 4-stroke engine could be simulated in the same way  Premixed combustion © 2006 ANSYS.com Layering: Other Examples   2-stroke engine.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 47 ANSYS. Proprietary . Of course. Inc.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 48 ANSYS.com Layering: Other Examples    Vibromixer. Proprietary . Inc. © 2006 ANSYS. All rights reserved. Flow solution on next slide. Layering.fluentusers. Inc.

All rights reserved. Layering. Flow solution (contours of velocity). 49 ANSYS.fluentusers. Proprietary . Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. © 2006 ANSYS.com Layering: Other Examples    Vibromixer.

50 ANSYS. i. In 3D. one cannot eliminate a dynamic zone.e. Proprietary . then define a coupled. Layering is only available for quad. If the moving zone is bounded by a two-sided wall. you should also turn the associated moving walls into dynamic zones – otherwise the incorrect wall boundary conditions will be applied.fluentusers. One layer of quad cells must always remain.. hex. In 2D. a cylinder with constant cross section). and you will get unphysical velocities adjacent to the wall.e. they must be sides of a prismatic cylinder (i. straight lines.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.. sliding interface. the sliding interfaces must be parallel. Inc.com Layering: Limitations       Layering is used for linear/translational motion. All rights reserved. Inc. If you turn a fluid zone into a dynamic zone. and wedge cells (but you can have other cell types in the stationary fluid zones). © 2006 ANSYS.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www..e.com Layering: Tips & Tricks   If you use the in-cylinder tool. and afterwards redefine the dynamic zones. with nodes from the static fluid zone being dragged along by nodes in the layering zone. Inc. Inc. be sure to set the in-cylinder parameters before you define the dynamic zones. delete the dynamic zones before making changes to the in-cylinder parameters. Also. Even nodes on the interface must be disconnected (i. 51 ANSYS. If you use sliding interfaces. the dynamic mesh may fail and report negative volumes. otherwise. be sure that the cells are of similar size on both sides of the interface. duplicate).    © 2006 ANSYS.fluentusers. While preparing a nonconformal (sliding) interface within Gambit. If one does not do this. All rights reserved. be sure that the two fluid zones are totally disconnected. Similarly. then the typical symptom is that the dynamic mesh fails. Proprietary . keep the mesh density on both sides similar.

Inc. Proprietary . All rights reserved.Lecture 5: Local Remeshing for Large. Inc. ANSYS. General Motion © 2006 ANSYS.

Proprietary © 2006 ANSYS. In the flowmeter shown.fluentusers. Inc. 53 ANSYS. then we need to remesh locally. .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Why local remeshing? For efficiency. the cuff rocks and reciprocates (rotates and translates sinusoidally). Inc. All rights reserved.com Local Remeshing: Introduction    If the relative motions of the boundaries are large and general (both translation and rotation may be involved). FLUENT remeshes only those cells that exceed the specified maximum skewness and/or fall outside the specified range of cell volumes.

com Local Remeshing: Introduction  Local Remeshing is used for cases involving large.fluentusers. Inc. Rescue capsule dropped from an airplane (store separation). Inc. general motion:     Cars passing (overtaking) each other. Proprietary . © 2006 ANSYS. The motion of two intermeshing gears. 54 ANSYS.   Local remeshing is available for tri/tet meshes only. Two stages of a rocket separating from each other (stage separation). We will look at three examples:   Butterfly valve. All rights reserved. Simple piston.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

Proprietary © 2006 ANSYS. The tip tends to leave a “wake” of small cells. Small gaps require 3-5 cells.com Local Remeshing Example 1: Butterfly Valve      The butterfly valve rotates. One challenge is that the mesh is much finer at the valve‟s tips than at its center. Flow is from left to right. Inc. Inc. 55 ANSYS. governed by a profile.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. All rights reserved. . otherwise one gets unphysical velocities.

. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 1674 cells. Minimum cell length is about 3 mm (0. skewness 0. Inc.1 m Small gap (9 mm) has 3 cells across. The rounded portion of the housing has a variable cell size.com Local Remeshing Example 1: Butterfly Valve       The mesh was made in Gambit. Proprietary © 2006 ANSYS. All rights reserved. Valve radius is 0.39 56 ANSYS.fluentusers. max.003 m).

All rights reserved.0) )   The valve first rotates CCW through 90 degrees.com Local Remeshing Example 1: Butterfly Valve  The motion of the butterfly valve is governed by a profile: ((butterfly 6 point) (time 0 0. then CW.6 0.571 0. Proprietary . 57 ANSYS.0 2.571 3.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.571 1.0 Time (sec) © 2006 ANSYS. The maximum rotational speed is 15 RPM.0 1.2 0.571 -1. Omega_z (rad/s) 1.fluentusers.571 -1. Inc.2 2.2) (omega_z 0.6 3.6 1. Inc.

All rights reserved. 58 ANSYS. Inc. Base your specification of the minimum and maximum length scale on the initial mesh. 0. Proprietary .com Local Remeshing Example 1: Butterfly Valve    Use Mesh Scale Info… to find the minimum and maximum length scale of the initial mesh . Inc.fluentusers. and on the rule-of-thumb: 0.7 for 2D.85 for 3D. © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Base your specification of the maximum cell skewness on the initial mesh.

59 ANSYS. based on the smallest cell length of the initial mesh.com Local Remeshing Example 1: Butterfly Valve     Define > DynamicMesh > Zones Select the wall of the valve (“wall-butterfly”) and make it move as a rigid body. Ideal cell height is 0. Inc. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.003 m. hideal controls the cell size adjacent to the moving wall. Inc. driven by the profile “butterfly”. All rights reserved. © 2006 ANSYS.0).fluentusers. The CG is located at (0.

All rights reserved.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. and to: Capture every seventh frame to disk (be sure to visit File > Hardcopy before you begin) © 2006 ANSYS.16m / s   We chose to display the mesh motion to the screen. Inc.fluentusers.com Local Remeshing Example 1: Butterfly Valve    Previewing the mesh motion: Choose a first time step based on the length of the smallest cell and on the maximum velocity.018s v 0. 60 ANSYS.003m  0. In our case: t  s  0. Proprietary . Inc.

com Local Remeshing Example 2: Piston  Effect of Size Remesh Interval (SRI):     If SRI is high. Also note how localized the remeshing is. then remeshing is dominated by skewness.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. © 2006 ANSYS. All rights reserved.fluentusers. Note that cells adjacent to the moving wall get stretched/large (especially on the way down). 61 ANSYS. Inc. Here SRI = 10. Inc. Proprietary .

62 ANSYS. All rights reserved.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. © 2006 ANSYS. then remeshing is strongly affected by both size and skewness. Note that cells adjacent to the wall don‟t get stretched as much. Inc.com Local Remeshing Example 2: Piston  Effect of Size Remesh Interval (SRI):    If SRI is low. Here SRI = 1. Proprietary . Inc.

Inc. Inc.com Local Remeshing: 12 Short Examples  Idealized valve (wall and wall shadow both move as rigid bodies):     Remeshing and smoothing. One deforming non-conformal.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. sliding interface (remeshing only). Two deforming symmetry boundaries (remeshing only). © 2006 ANSYS. Two fluid zones. Proprietary .fluentusers. All rights reserved. 63 ANSYS.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.com Local Remeshing: Short Example 2/12  Piston with tri mesh above and quad mesh below:      The “piston” (blue interior edge) is the dynamic zone. moves as a rigid body. Layering below. 64 ANSYS. Inc. © 2006 ANSYS. Deforming side walls only needed next to tris. All rights reserved. Inc. Proprietary .fluentusers. Remeshing and smoothing above. Two fluid zones.

fluentusers. Two fluid zones. Deforming side walls only needed next to tris. © 2006 ANSYS. Inc. Proprietary . but let us create cell layers at the bottom:     The “piston” (blue interior edge) and the quad-fluid are moving as rigid bodies. All rights reserved. 65 ANSYS. The bottom wall is a dynamic zone of type “stationary”. Inc.com Local Remeshing: Short Example 3/12  Same as before.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

All rights reserved. Proprietary . © 2006 ANSYS.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. one for the blue edge and one for the quadfluid. while the tri-fluid expands (remeshing and smoothing. Inc. plus deforming side walls) Then we freeze the blue interior edge (as well as the tri-fluid). Driven by two profiles. 66 ANSYS. Inc. and start generating cell layers there.com Local Remeshing: Short Example 4/12    Another cylinder. but here we first move the quad-fluid and the blue interior edge downward as a rigid body.

67 ANSYS. Proprietary .fluentusers. Inc. All rights reserved. Flow solution on the next slide: © 2006 ANSYS.com Local Remeshing: Short Example 5/12   Here is an application of the previous set-up: a compressor with springloaded intake and exhaust valves.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc.

Inc.fluentusers.com Local Remeshing: Short Example 5/12   Compressor with spring-loaded intake and exhaust valves. All rights reserved. © 2006 ANSYS. Flow solution. Proprietary . 68 ANSYS. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

the tri-side of the nonconformal is deforming. 69 ANSYS. 4 dynamic zones:    two bottom walls are moving as rigid bodies. and nonconformal interfaces. the right wall is deforming. Inc. © 2006 ANSYS. smoothing. remeshing. Inc. All rights reserved. Proprietary .fluentusers.com Local Remeshing: Short Example 6/12   An example involving layering.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

Inc. All rights reserved.fluentusers. Flow solution on next slide. Inc. 70 ANSYS. Nonconformal grid interface (circular arc).com Local Remeshing: Short Example 7/12     An HVAC valve: Remeshing and smoothing. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. © 2006 ANSYS.

Inc. © 2006 ANSYS.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. 71 ANSYS.com Local Remeshing: Short Example 7/12    An HVAC valve: Flow solution (contours of temperature). The small gaps are fully blocked. All rights reserved. Proprietary .

com Local Remeshing: Short Example 8/12     Automotive valve: Remeshing.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 4 nonconformal grid interfaces (vertical lines). Inc. All rights reserved. smoothing. 72 ANSYS.fluentusers. © 2006 ANSYS. The gaps are fully blocked. Proprietary . Inc. and layering.

© 2006 ANSYS. Inc.com Local Remeshing: Short Example 9/12   Two cars passing each other. Wedge cells move with the car (as rigid body). Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. All rights reserved. 73 ANSYS.fluentusers. Inc.

All rights reserved. 74 ANSYS. Inc. Proprietary .com Local Remeshing: Short Example 10/12  Gear pump © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. Inc.

75 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Proprietary . Inc. All rights reserved.com Local Remeshing: Short Example 11/12  Positive displacement pump © 2006 ANSYS. Inc.fluentusers.

76 ANSYS.fluentusers.com Local Remeshing: Short Example 12/12   Airplane wing‟s control surface (aileron). Inc. Inc. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Flow solution on next slide: © 2006 ANSYS. All rights reserved.

fluentusers. 77 ANSYS. All rights reserved. Inc. Inc. Proprietary . © 2006 ANSYS.com Local Remeshing: Short Example 12/12  Airplane wing‟s control surface (aileron): 2D flow solution.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

Inc.com Local Remeshing: Short Example 12/12  Airplane wing‟s control surface (aileron): 3D. 78 ANSYS. Proprietary . Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. All rights reserved. © 2006 ANSYS.

a cylinder.fluentusers. a fluid zone with a mix of tet and wedge cells). © 2006 ANSYS.. Nodes on a boundary can only be moved if we can project them onto a simple geometric entity. Proprietary .com Local Remeshing: Limitations     One cannot use hanging-node adaption together with the local remeshing method (this includes dynamic adaption). All rights reserved. Mixed zones are not allowed (e.g. or a user-defined surface. Inc. Inc. such as: a plane. 79 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Local remeshing is only possible with tri and tet cells.

etc. then you generally need at least 3-5 cells across that gap. © 2006 ANSYS. to develop a feel for the proper settings. size remesh interval. Otherwise. etc.85 in 3D. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.) difficult. minimum and maximum volumes. and one often has to use even fewer cell layers in the gap. Start with a 2D problem. ideal cell height. Inc.fluentusers. you may get unphysical velocities.7 in 2D. If your model has small gaps (flow passages). the Fluent GUI reports a skewness: this is the skewness before the boundaries/objects move. maximum skewness. Inc. Be prepared to spend time adjusting parameters (time step. and to about 0. g-rotors.com Local Remeshing: Tips       During the remeshing. 80 ANSYS. so the skewness at the end of the time step will be higher.). Remember that the final skewness can only be controlled indirectly. All rights reserved. Set “Maximum Cell Skewness” to about 0. This makes models with tight spaces (gear pumps.

Inc. a rule of thumb is that the mesh motion during one time step should be less than one-half of the smallest cell dimension. If the motion of the moving object is limited. The use of smoothing (in addition to remeshing) may allow you to use larger time steps. Proprietary . 81 ANSYS. All rights reserved. Inc.  © 2006 ANSYS.fluentusers.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.com Local Remeshing: Tips    Be sure to choose a sufficiently small time step – otherwise the dynamic mesh may fail. Problems with the time step size may already become evident during the preview. it may be a good idea to split the fluid domain into two fluid zones: you can thereby restrict the remeshing to just one of those two zones and reduce the computational effort.

All rights reserved. ANSYS.Lecture 6: Coupled Mesh Motion via the 6 DOF Solver © 2006 ANSYS. Inc. Inc. Proprietary .

com 6 DOF Coupled Motion: Introduction     So far. Proprietary . 83 ANSYS.e. to avoid collisions). In other words. This is often called a 6 DOF Solver. and ejector forces. Now we would like to move the object as a result of the aerodynamic forces and moments acting together with other forces. Fluent provides a dynamic mesh model that computes the trajectory of an object based on the aerodynamic forces/moments. thrust forces. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. or ejector forces (i. Inc. such as the force due to gravity. we want the motion/trajectory of the object to involve the aerodynamic forces/moments: the motion and the flow field are thus coupled. and we call this coupled motion.. gravitational force. we have only used prescribed motion: we specified the location or velocity of the object using the in-cylinder tool or a profile. All rights reserved. © 2006 ANSYS. forces used to initially push objects away from an airplane or rocket.

Message("\nstage: updated 6DOF properties").h“ DEFINE_SDOF_PROPERTIES(stage. Inc. prop[SDOF_IXX] = 200. Proprietary . Inc.fluentusers. dtime) { prop[SDOF_MASS] = 800. All rights reserved. which can be time dependent #include "udf. time. A udf is needed to specify the mass and the initial inertia matrix. 84 ANSYS. prop[SDOF_IYY] = 100. }  Inertial matrix needs to be specified in global coordinate  A udf is written to convert values from principle axis to global coordinate © 2006 ANSYS.0. prop[SDOF_IZZ] = 100.0.0. dt.0.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.com 6 DOF Solver   Motion is coupled with hydrodynamic forces from the flow solution via FLUENT’s 6 DOF model. prop.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. We begin with the mass and second moments in the local coordinate system: Excerpt from the 6 DOF UDF: #include "udf. prop. Let us begin by making changes to the UDF before we compile it.000 kg) Second moments of inertia of the rescue pod /* Define the mass matrix */ prop[SDOF_MASS] = 5000. Example 1: Airdrop   We will learn about the 6 DOF UDF by applying it to the airdrop of the rescue pod. 85 ANSYS.. moments */ if (time <= 0.com 6 DOF. Inc. All rights reserved. } © 2006 ANSYS. prop[SDOF_IZZ] = 5000. /* add ejector forces. dt. } Message0("\nUpdated 6DOF properties\n"). prop[SDOF_LOAD_F_Y] = -80000. Proprietary .0.h" DEFINE_SDOF_PROPERTIES(store. dtime) { Mass of the rescue pod (5.fluentusers. Inc. prop[SDOF_LOAD_M_Z] = -2200. time..3) { prop[SDOF_LOAD_F_X] = -10000.

Inc.. All rights reserved. dtime) { /* Define the mass matrix */ prop[SDOF_MASS] = 5000. } © 2006 ANSYS. /* add ejector forces.0. 86 ANSYS.. prop[SDOF_IZZ] = 5000.3) { prop[SDOF_LOAD_F_X] = -10000. Inc. prop[SDOF_LOAD_M_Z] = -2200. } Message0("\nUpdated 6DOF properties\n").h" DEFINE_SDOF_PROPERTIES(store. time. dt. prop. Proprietary .fluentusers. prop[SDOF_LOAD_F_Y] = -80000.com 6 DOF. Example 1: Airdrop  The user continues by adjusting the ejector forces in the global coordinate system: #include "udf.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. moments */ if (time <= 0.

com 6 DOF. 88 ANSYS. Example 1: Airdrop  Adjusts the gravity vector in the global coordinate system: © 2006 ANSYS. Inc. All rights reserved.fluentusers. Inc. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.

and select “store::libudf” as the UDF that drives the motion of the pod‟s walls (“wall-object”): “wall-object” “fluid-bl” © 2006 ANSYS. Proprietary . All rights reserved. 89 ANSYS.com 6 DOF.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. Inc. Inc. Example 1: Airdrop  Next we revisit the definition of the dynamic zones.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.com 6 DOF. Proprietary .fluentusers. Inc. 90 ANSYS. All rights reserved. Example 1: Airdrop  Next we select “store::libudf” as the UDF that drives the motion of the fluid zone (“fluid-bl”) consisting of the quad cells in the boundary layer adjacent to the rescue pod: “wall-object” “fluid-bl” Passive option will allow “fluid-bl” to move with the “wall-object” but it does not contribute to the force calculation © 2006 ANSYS. Inc.

etc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.com 6 DOF. Proprietary . One can observe the effect of one‟s choices for the dynamic mesh parameters (such as the spring constant.fluentusers. one can start without initializing. and the object will simply drop under the influence of gravity. Example 1: Airdrop    Even in cases with coupled motion. the maximum skewness. All rights reserved. it is wise to preview the mesh motion before carrying out the flow calculations.). © 2006 ANSYS. In this case. Inc. 91 ANSYS. Inc.

Example 1: Airdrop    Finally. The figure shows pressure contours corresponding to a freestream Mach number of 0. All rights reserved. Inc. This problem exists as a tutorial.com 6 DOF.fluentusers.8 – note how the object has drifted aft. 92 ANSYS. © 2006 ANSYS. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. one can re-load the case (to get back to the original mesh) and compute the flow and the coupled motion.

2.com 6 DOF coupled motion. short examples (1 of 4)      Store dropped from a delta wing (NACA 64A010) at Mach 1. Proprietary . Smoothing. All-tet mesh. remeshing with size function. 93 ANSYS. Ejector forces dominate for a short time.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. All rights reserved. Inc. Fluent results agree very well with wind tunnel results! © 2006 ANSYS.fluentusers. Inc.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. Inc. 94 ANSYS.com 6 DOF coupled motion. Proprietary .fluentusers. UDF computes thrust force. short examples (2 of 4)  Silo launch. All rights reserved. © 2006 ANSYS. Inc.

Proprietary . short examples (3 of 4)     Projectile moving inside and out of a barrel. Inc. Initial patch in the chamber drives the motion. Layering. All rights reserved. User-defined real gas law (AbelNobel Equation of State). Inc. © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 95 ANSYS.fluentusers.com 6 DOF coupled motion.

Inc.fluentusers.com 6 DOF coupled motion. © 2006 ANSYS. Smoothing and remeshing. Proprietary . 96 ANSYS. All rights reserved. Inc.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. short examples (4 of 4)   Rocket stage separation.

All rights reserved. and observe a linear motion in the direction of the gravity vector. © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. it is wise to preview the mesh motion before carrying out the flow calculations (which can be expensive). After convergence.com 6 DOF coupled motion. the object will move based on the forces that resulted from the steady calculation – the motion usually involves both translation and rotation. Other times it is better to compute a steady solution to obtain an initial distribution of pressures and shear stresses.fluentusers. Sometimes one can proceed without initialization. During the preview. Tips    Even in cases with coupled motion. Proprietary . one switches to the unsteady solver and hooks in the UDF. Inc. 97 ANSYS. Inc.

Proprietary . ANSYS. Inc. Inc. All rights reserved.Lecture 7: Coupled Mesh Motion via the 2 DOF User Defined Function © 2006 ANSYS.

com 2DOF Heave & Pitch • Wigley hull advancing in calm water moves in 2 degrees of freedom – heave & pitch Yellow lines are interfaces Collapse & Split Translation Rotation as well as Translation Translation is in the direction of heave © 2006 ANSYS.Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. Proprietary . 99 ANSYS. Inc. Inc. All rights reserved.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www.fluentusers. Proprietary .com 2DOF Heave & Pitch • Time-dependant calculation using Fluent‟s VOF multiphase model Pressure Inlet (air) Pressure Outlet (water) Pressure Inlet (water) – use open channel boundary condition Pressure Outlent (water) – use open channel boundary condition © 2006 ANSYS. Inc. 100 ANSYS. Inc. All rights reserved.

Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 101 ANSYS.com 2DOF Heave & Pitch • Use open channel boundary condition to resolve hydrostatic pressure distribution in water User-defined function is used to generate wave at water inlet © 2006 ANSYS. Inc. All rights reserved.fluentusers. Inc. Proprietary .

com 2DOF Heave & Pitch • Use open channel boundary condition to resolve hydrostatic pressure distribution in water User-defined function is used to generate wave at water inlet © 2006 ANSYS.fluentusers. All rights reserved. Proprietary .Dynamic Mesh Training Notes UGM at Marine Industries 2007 Fluent User Services Center www. 102 ANSYS. Inc. Inc.

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

2DOF Heave & Pitch
• UDF for wave generation
#include "udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = 5.0 + 5.0*sin(10.0*t + M_PI*1.5); } end_f_loop(f, thread) }

103

ANSYS, Inc. Proprietary

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

2DOF Heave & Pitch
• We can not use 6 DOF solver in Fluent, because we have to confine one translational motion. Another UDF is needed to specify the mass and the initial inertia matrix, compute forces and moment, and drive an object to move. •

104

ANSYS, Inc. Proprietary

Dynamic Mesh Training Notes UGM at Marine Industries 2007

Fluent User Services Center www.fluentusers.com

2DOF Heave & Pitch

After compiling and loading the UDF, select “two_dof::libudf” as the UDF that drives the motion of the fluid zones and wall zone:
“fluid_layer”

“fluid_rotate”

“moving_body”