UDF와 Dynamic Mesh를 이용한
Coupled motion의 구현
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
Lecture 1: Controlling
Inlet velocity using
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.
Fluent User Services Center www.fluentusers.com
Dynamic Mesh Training Notes UGM at Marine Industries 2007
User Access to the FLUENT Solver
User Defined INITIALIZE Segregated PBCS Exit Loop Repeat Check Convergence
Update Properties Solve Species Solve Energy Initialize Begin Loop
DBCS
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 ADJUST Source terms Source terms Source terms Source
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.
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
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
u
( y
)
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_velocitywill 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
#include "udf.h“
DEFINE_PROFILE(inlet_x_velocity, thread, nv) {
float x[3]; /* Position vector*/ float y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, nv) = 20.*(1.- y*y/(.0745*.0745)); } end_f_loop(f, thread) }
Compiled UDF
Add the UDF source code to the Source
Files list.
Click Build to create UDF library.
Click Load to load the library.
Interpreted UDF
Add the UDF source code to the Source
File Name list.
Click Interpret.
The assembly language code will
Step 3 – Interpret or Compile the UDF
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.
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.
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.
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_UDS_UNSTEADY(name,cell,thread,index,apu,su); defines UDS transient terms
DEFINE_SR_RATE(name,face,thread,r,mw,yi,rr); defines surface reaction rates
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
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
cell_t, face_t, Thread,
Domain are part of FLUENT UDF data structure
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
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_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
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
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.
Solution adjustment
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
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;
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:
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
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.
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.
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).
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
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.
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.
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
(including dynamic 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;
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!
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
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):
Complex geometry near cylinder head is tri meshed
Layering Example 1: Piston
Cells are being split or collapsed as the piston wall comes near
Fluent User Services Center www.fluentusers.com
Dynamic Mesh Training Notes UGM at Marine Industries 2007
Layering Example 1: Piston
Split if: Collapse if:
hideal is defined later, during
ideal S h h (1 ) ideal ch h
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
Edges “i” and “i+1” have same shape Edge “i+1” is an average of edge “i” and the 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:
Layering Example 1: Piston
Definition of the ideal height of a cell layer; hideal 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;
Layering: Other Examples
Fuel injector; Flow solution
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
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).
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.
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
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;
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);
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 Omega_z (rad/s)
The valve first rotates
CCW through 90 degrees, then CW;
The maximum
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; hideal controls the cell size adjacent
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 0.018 / 16 . 0 003 . 0
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);
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 cellsadjacent to the wall don‟t get stretched as
Fluent User Services Center www.fluentusers.com
Dynamic Mesh Training Notes UGM at Marine Industries 2007
Local Remeshing: 12 Short Examples
Idealized valve (wall
and wall shadow both move as rigid bodies):
Remeshing and smoothing;
Two fluid zones; Two deforming symmetry boundaries (remeshing only); One deforming non-conformal,
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;
Remeshing and smoothing above; Layering below; Two fluid zones; Deforming side
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 the quad-fluid are moving as rigid bodies;
Two fluid zones; The bottom wall is
a dynamic zone of type “stationary”; Deforming side
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-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;
Local Remeshing:
Short Example 5/12
Compressor with spring-loaded
intake and exhaust valves;
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;
Local Remeshing: Short Example 7/12
An HVAC valve: Remeshing and smoothing; Nonconformal grid interface (circular arc); Flow solution on next
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.
Local Remeshing: Short Example 8/12
Automotive valve: Remeshing, smoothing, and layering; 4 nonconformal grid interfaces (vertical lines); The gaps are fully
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).
Local Remeshing: Short Example 10/12
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
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.
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;
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;
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.
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.
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"); }
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)
Excerpt from the 6 DOF UDF:
Mass of the rescue pod (5,000 kg) Second moments of inertia of the rescue pod
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) { prop[SDOF_LOAD_F_X] = -10000; prop[SDOF_LOAD_F_Y] = -80000; prop[SDOF_LOAD_M_Z] = -2200.0; }
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),
6 DOF; Example 1: Airdrop
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”
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
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
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!
6 DOF coupled motion; short examples (2 of 4)
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);
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;
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 Collapse & Split
Yellow lines are interfaces
• 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
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
• Use open channel boundary condition to resolve hydrostatic pressure distribution in water
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"
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) }
• 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.
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”
2DOF Heave & Pitch
Next we select “Stationary” zone for layering:
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
2DOF Heave & Pitch
Iterate until the solution converge without time advancement to get initial