1

AUTO UGM 2003 Confidential
Fluent Tips and Tricks
R. Jeffrey Benko
Customer Support Manager
June 5, 2003
2
AUTO UGM 2003 Confidential
Outline
• Materials From Corporate UGM Training Seminar
– Samir Rida, Suti Wirogo (Aero Team)
• General Tips and Tricks: From Pre to Post
– For Mesh and Case Set-up
– For Solving
– For Post-Processing
– For Customizing Fluent
• Appendices
– Miscellaneous Slides from General Tips and Tricks
– User Defined Function Tips
– The Text User Interface: FLUENT’s Hidden Jewels
– A Case Study: The Segregated Solver with High Pressure
Differential.
3
AUTO UGM 2003 Confidential
General Tips and Tricks:
For Mesh and Case Set-up
4
AUTO UGM 2003 Confidential
Miscellaneous on mesh modifications
• How to repair left-handed faces in Fluent ?
/grid/modify-zones/repair-face-handedness TUI
• How to repair problematic periodic boundary in Fluent ?
/grid/modify-zones/repair-periodic TUI
• What is tfilter (now called utility)?
A set of utilities used by Fluent/Gambit/Tgrid to perform
mesh related modifications, such as:
– Convert mesh to Fluent format (fe2ram)
– Convert mesh (tconv)
– Merge meshes (tmerge3d)
Tfilter can be invoked manually. To find all the options:
shell> utility
shell> utility fe2ram
5
AUTO UGM 2003 Confidential
Miscellaneous on mesh modifications
• In recent release, tfilter has been renamed to utility
• How to convert 2D mesh into 3D surface mesh ?
utility tconv –d2 sample2d.msh 3d-surface.msh
The z-coordinate is assigned as zero in the 3d surface mesh
• How to convert 3D surface mesh into 2d mesh ?
utility tconv –d3 3d-surface.msh sample2d.msh
The z-coordinate is ignored in the 3d surface mesh
• How to merge two meshes ?
utility tmerge3d -cl -p ./mesh1.msh ./mesh2.msh combine.msh
• How to convert CFX mesh to Fluent mesh format ?
utility fe2ram -cl -tCFX -dN -cl -group cfx.geo fl.cas
6
AUTO UGM 2003 Confidential
Creation of non-conformal interface
• Intersected mesh is created using the two interface meshes and
then used to ‘replace’ the original interface meshes
• To improve accuracy and robustness:
– Maintain similar face element sizes at both interfaces
– Maintain good face mesh skewness at both interfaces
• To create non-conformal interface which crosses periodic
boundary, need to set the following Scheme command first:
(rpsetvar 'nonconformal/allow-interface-at-periodic-boundary 0)
• To view non-overlapping portions of the interface surfaces, use
the TUI Command: /display/zone-grid
• Creation of intersected mesh is delicate, if fails, try to modify a
default by using either of the following Scheme commands:
– (rpsetvar 'nonconformal/cell-faces 0)
– (rpsetvar 'nonconformal/cell-faces 2)
7
AUTO UGM 2003 Confidential
How to copy setup and solution to a similar case ?
• Avoid lengthy manual re-setup and solution initialization
• To copy the case setup:
– From the first case, write a bc setup file:
/file/write-bc TUI
– Load the second mesh and read the bc file
/file/read-bc TUI
– Restrictions:
• Only zones with the same names (not same ID) as used in the first
case will be setup
• Does not include mesh scaling (need to do scaling separately)
• Surface information not copied
Use journal file to create the surfaces to avoid recreation
8
AUTO UGM 2003 Confidential
How to copy setup and solution to a similar case ?
• To reuse the previous solution:
– From the first case, write an interpolation file:
File – Interpolate… – Write Data GUI
– Read the interpolation file to the second case:
File – Interpolate… – Read and Interpolate GUI
Can selectively apply to individual fluid zone(s)
• Tips:
– Simple closest distance interpolation is used (no gradient or geometry
based interpolation)
– Use small under-relaxation factors initially to avoid large jump in the
solution
9
AUTO UGM 2003 Confidential
How to store user defined materials for reuse ?
• If user uses certain materials often then can create a material
file that can be reused and thus avoid redefinition each time
• A material file can be created from a bc file:
– Start a fluent session and define the user material in the material panel
– Write the b.c. file
/file/write-bc
– Edit the b.c. file:
• Keep the first and last line
• Keep the material line
(materials ((water-xxx fluid (chemical-formula . #f) ...
• Delete all other lines
– The next time the user would like to use this material file, then read
the material file as if reading the b.c. file.
10
AUTO UGM 2003 Confidential
(air
fluid
(chemical-formula . #f)
(density (constant . 1.225))
(specific-heat (constant . 1006.43))
(thermal-conductivity (constant . 0.0242))
(viscosity (constant . 1.7894e-05) (sutherland 1.7894e-05 273.11 110.56) (power-law 1.7894e-05 273.11 0.666))
(molecular-weight (constant . 28.966))
(lennard-jones-length (constant . 3.711))
(lennard-jones-energy (constant . 78.6))
(thermal-accom-coefficient (constant . 0.9137))
(velocity-accom-coefficient (constant . 0.9137))
)
How to store user defined materials for reuse ?
• An alternative is to add entries to the file propdb.scm which is
located in ~fluent6.x/cortex/lib
Example entry on propdb.scm
11
AUTO UGM 2003 Confidential
Custom Field Functions
• Custom field functions are GUI based, it is not possible to
create them through journal files
• If a set of existing custom field functions are to be used for
different cases:
– Write the existing functions as a scheme file using:
• Define – Custom Field Functions – Manage – Save GUI
• file/write-field-functions TUI
– Read the scheme file to the new case using:
• Define – Custom Field Functions – Manage – Load GUI
• file/read-field-functions TUI
12
AUTO UGM 2003 Confidential
General Tips and Tricks:
For Solving
13
AUTO UGM 2003 Confidential
Setting uneven parallel load
(OTS Solution 487)
• It is possible to partition the mesh in an uneven distribution to
accommodate differences in the CPU speeds and RAM
• Suppose the 3 machines (m0, m1, m2) are to be used in a
parallel job with 10%, 20%, and 70% load distribution
respectively
– Load the case and data file into serial Fluent
– Using TUI, execute the command:
/parallel/partition/set/load-distribution
and enter the percentage load of each partition (must add to 100%)
– Partition the mesh for 3 partitions
• Can use any partitioning scheme
14
AUTO UGM 2003 Confidential
Setting uneven parallel load
10% of cell count is
2256.
Total mesh cell count is 22560.
70% of cell count is
15792.
15
AUTO UGM 2003 Confidential
Miscellaneous on parallel IO (1)
• In parallel, the mesh is first read into the host process and
then distributed to the compute nodes
• If reading case into parallel solver takes unusually long time,
do the following:
– Put the host and compute-node-0 on the same machine
– Put the case and data files on a disk on the machine running the host
and compute-node-0 processes
– Try to execute the following Scheme commands before reading the
case file
• (%free-parallel-io-buffers)
• (%limit-parallel-io-buffer-size 0)
• (%allocate-parallel-io-buffers 10000000)
• (%query-parallel-io-buffers)
16
AUTO UGM 2003 Confidential
– Merge as many zones as possible
– If the machine running the host process has enough memory, execute
the following Scheme command:
(rpsetvar 'parallel/fast-io? #t)
• When loading a large mesh into parallel Fluent and the
process hangs, execute the following Scheme command:
(rpsetvar 'parallel/case-read-use-pack? #f)
The above will disable buffer packing and will change the
way entities are packed into messages during the build
process. More but smaller messages will be created by
disabling.
Miscellaneous on parallel IO (2)
17
AUTO UGM 2003 Confidential
How to determine CPU time for serial solver ?
(OTS Solution 334)
• For parallel run, can use the built in parallel timer via the GUI:
– Parallel – Timer – Reset before iteration
– Parallel – Timer- Usage after completing iterations
• For serial solver, can use the following TUI command that is
executed before and after the iteration period of interest:
(solver-cpu-time)
– The difference is the elapsed CPU time in seconds for the iteration
period completed
– If used in the parallel session, the difference represents the sum of the
CPU times of all the compute nodes
18
AUTO UGM 2003 Confidential
Miscellaneous on batch processing (1)
• Commands to run in batch mode:
– fluent 3d -g < batch.jou >& out.trn & for C-shell
– fluent 3d -g < batch.jou > out.trn 2>&1 & for Bourne/Korne-shell
– fluent 3d -g -i batch.jou -o out.trn for windows
• Use –cnf=host_file to automatically load frequently used
machines for parallel run
• To receive mail notification upon the completion of a batch
job, add the following line at the end of the batch journal:
!mail email-address < message.txt
where message.txt is a text file located inside the working
directory and contains the message to be sent
19
AUTO UGM 2003 Confidential
Miscellaneous on batch processing (2)
• To enter a comment inside a journal file:
; This line is commented
• To execute a shell command inside a journal file:
! Shell-command-to-be-executed
• To generate animation files during a batch processing, add the
following option to the start up command of the batch job:
-driver null
• Is it possible to read a journal file from another journal file ?
Strictly speaking, the answer is “No”. Nested journal files are not
allowed in Fluent. Scheme can be used as a workaround. Please
contact your support engineer if you need this functionality.
20
AUTO UGM 2003 Confidential
Miscellaneous on batch processing (3)
• How to start a batch job at a user specified time ?
– Create the batch journal file as usual i.e. batch.jou
– Open and create a file containing a single line which specify the unix
shell command to execute the batch job. For example:
fluent 3d -g < batch.jou > out.trn 2>&1 & for Bourne/Korne-shell
– Make this file executable
unix> chmod a+x filename
– Suppose that the batch job is to be executed at 2003 June 03 09:25:00
then, enter the following command in the unix prompt:
unix> at -m -t 200306030925.00 –f filename
– When the job finish, an email will be sent to you
– The at command is also available on windows
21
AUTO UGM 2003 Confidential
Miscellaneous on batch processing (4)
• How to execute several batch processes sequentially ?
– In Unix/Linux environments, if a shell command is not ended by an
ampersand (&) then the OS will wait until the completion of the
execution of that line before going to the next line. This is not the case
with Windows.
– Suppose there are two directories corresponding to two cases where each
has its own corresponding journal file. Then see the following shell
scripts:
Unix/Linux
cd ./dir1
fluent 3d -psmpi -t2 -g < batch1.jou
cd ../dir2
fluent 3d -psmpi -t2 -g < batch2.jou
Windows
call cd .\dir1
call fluent 3d -wait -g -i batch1.jou
call cd ..\dir2
call fluent 3d -wait -g -i batch2.jou
22
AUTO UGM 2003 Confidential
Miscellaneous on batch processing (5)
• Useful options for batch processing have been implemented in
Fluent 6.1
– Confirm file overwrite is a must for batch processing
– Option to turn off question dialog boxes
– Exit when an error occurs during journal execution
– Through GUI File Batch Options or TUI: /file/set-batch-options
– Equivalent Scheme command to turn on exit on error is:
(set! *cx-exit-on-error* #t)
Can be appended inside the journal file or .fluent file
23
AUTO UGM 2003 Confidential
Check pointing (1)
(OTS Solution 291)
• It is possible to tell the Fluent process to stop the iteration
and write the case/data files without interacting with the GUI
• This procedure is useful to stop a batch process or when the
GUI process has crashed, and can be used as long as Fluent
is still in the iteration loop
• In Unix/Linux environment, the owner of the process can
create a kill file inside the /tmp directory:
unix> cd /tmp
unix> touch exit-fluent exit Fluent after writing files
or
unix> touch check-fluent continue iteration after writing files
If either exit-fluent or check-fluent found in /tmp, Fluent will finish the
current iteration, write the files, and then delete the exit-fluent or check-
fluent file
24
AUTO UGM 2003 Confidential
Check pointing (2)
• The files will be written to the same directory where the
original input files were read and will have the same names
but with appended current iteration number
• To write the data file only, execute the following Scheme
command before iterating:
(rpsetvar 'checkpoint/write-case? #f)
By default, the case file will be written
• Make sure that sufficient disk space is available
– Check-pointing code calls the same file I/O routines used by the GUI
or TUI and will produce the same error messages if disk space is
insufficient
– In such case, Fluent will not return to the iteration loop
25
AUTO UGM 2003 Confidential
Check pointing (3)
• The touch command will produce file of zero length and is
also available in Windows
• For Windows, the check point files need to be created at:
c:\temp\check-fluent.txt
c:\temp\exit-fluent.txt
26
AUTO UGM 2003 Confidential
Check pointing (4)
• If the machine has several Fluent sessions running, named
check pointing can be used to selectively stop a specific Fluent
process
• A specific check point name can be added to the first line of
the batch journal file, as shown below:
(set! checkpoint/exit-filename "/tmp/exit-flu-job-1")
file/read-case-data sample.cas
solve/iterate 1000
file/write-case-data junk2
• To stop this particular job, use the following command inside
the /tmp directory:
unix> touch exit-flu-job-1
27
AUTO UGM 2003 Confidential
ƒ /solve/set/expert/use alternate formulation for wall temperature? [no]
– FLUENT models the flux at the wall as follows:
– The term f(∆T) includes second order terms that need to be determined,
which involves approximations.
Alternative Wall Formulation (1)
n T k q
r
⋅ ∇ =
) (
) (
T f
h
T T
k q
c w
∆ +


=
28
AUTO UGM 2003 Confidential
ƒ /solve/set/expert/use alternate formulation for wall temperature? [yes]
– Assume face center is defined such as the vector between cell center
and face center is perpendicular to the wall.
– The term f(∆T) vanishes and ∆h changes.
– This option doesn’t impact the results if the wall cells are not skewed.
Alternative Wall Formulation (2)
n T k q
r
⋅ ∇ =
h
T T
k q
c w


=
) (
29
AUTO UGM 2003 Confidential
Temperature definitions for thin wall model
• Thin wall model applies normal conduction only (no in-plane
conduction) and no actual cells are created
• Wall thermal boundary condition is applied at the outer layer
static-temperature
(cell value)
wall-temperature
(inner-surface)
wall-temperature
(outer-surface)
thin wall (no cell)
Wall thermal condition
30
AUTO UGM 2003 Confidential
Temperature definitions for shell conduction zone
• A thin wall conduction with both normal and in-plane conductions
• Actual conduction cells are created but can not be displayed and
can only be limitedly accessed by UDFs
• Solid properties of the conduction zones must be constant and can
not be specified as temperature dependent
• Case must be partitioned in the serial mode before loading into
parallel (conduction zones need to be encapsulated)
static-temperature
(cell value)
wall-temperature
(inner-surface)
wall-temperature
(outer-surface)
conduction cells
31
AUTO UGM 2003 Confidential
ƒ /monitors/force/clear-all-monitors
– Fast way to discard the internal and external file data associated with
the force monitors.
ƒ /set/flow-warnings?
– Specify whether or not to print warning messages when reversed flow
occurs at inlets and outlets, and when mass flow inlets develop
supersonic regions. By default, flow warnings are printed.
Misc. Text Commands
32
AUTO UGM 2003 Confidential
General Tips and Tricks:
For Post-Processing
33
AUTO UGM 2003 Confidential
Pressure force calculation
• Force due to pressure is computed using the following equation
in Fluent:
Fp = Sum ( p
g
– p
ref
)*Area
where p
g
is the gauge pressure and p
ref
is the reference pressure
specified in the reference value panel
• For closed surface (closed body), it does not matter what the
value of p
ref
is since the total pressure force due to p
ref
is zero
• For open surface, p
ref
must be set to the negative of the operating
pressure so that the equation becomes:
Fp = Sum ( p
g
+ p
op
)*Area
= Sum ( p
abs
*Area )
34
AUTO UGM 2003 Confidential
Turbulent intensity
• The definition used by Fluent when computing the turbulence
intensity is:
TI = sqrt( (2/3)*k )/Vref
where Vref is specified inside the reference value panel
• It is more instructive to use the local velocity magnitude for
turbulence intensity calculation
TI = sqrt( (2/3)*K )/Vmag-local
• Can use a custom field function to define modified turbulent
intensity
35
AUTO UGM 2003 Confidential
How to create an iso-surface that passes through
a selected zone?
• Create a surface that passed through the entire domain
Surface →Iso-Surface…
• From the boundary condition panel, determine the Cell Zone ID
(same as the Cell Zone Index) where the iso-surface is to be
retained. Lets say the Cell Zone ID is 7.
• Clip the iso-surface using to the desired ID:
Surface →Iso-Clip…
– Under “Clip To Values Of” select “Cell Info” and “Cell Zone Index”
– Under “Clip Surface” select the surface created in first step
– Enter 6.9 and 7.1 for “Min” and “Max”, respectively
– Specify the name and click on “Clip”
36
AUTO UGM 2003 Confidential
Example
fluid-core
fluid-out
fluid-in
iso-clip passing through
fluid-core only
37
AUTO UGM 2003 Confidential
ƒ /display/set/windows/… [example]
– Add borders to the scale, the axis, the image.
– Eliminate the application title
– etc
Altering the Display Window
38
AUTO UGM 2003 Confidential
How to specify floating format for contour scale ?
• The floating format for the contour scale is
sometimes preferred since it is easier to
read
• Use the following TUI command:
/display/set/windows/scale/format "%f"
– This will give the default 6 significant digits
after the decimal point
– To get 3 significant digits after the decimal
point, use: "%0.3f"
39
AUTO UGM 2003 Confidential
General Tips and Tricks:
For Customizing Fluent
40
AUTO UGM 2003 Confidential
How to save graphics/GUI layout ?
• To save custom window layout, can use the GUI command:
File – Save Layout
• Sizes and locations of currently defined windows (0,1,2,...)
as well as other windows for iteration panel, display panel,
etc that have been opened will be saved in .cxlayout located
at the same location as the .fluent file
41
AUTO UGM 2003 Confidential
Scheme
• What is Scheme ?
A high level, functional, and interpreted based language used by
Fluent interface
• How to load a Scheme file ?
– File – Read – Scheme… GUI
– file/read-macros TUI
– (load “filename.scm”) TUI
The opening and closing double quotes are part of the command.
Scheme file is not part of the case file and must be reloaded every time Fluent is
restarted
• A Scheme command is executed using TUI only, e.g.
– (rpsetvar 'flow-time 0.0) reset the flow time to 0.0
– (display “ Welcome to scheme…”) print a welcome message at
the fluent console
42
AUTO UGM 2003 Confidential
The .fluent file
• When FLUENT opens, it auto executes the .fluent file in:
– home directory of unix users
– c:\ directory of NT machines
• A .fluent file can contain any number of scheme file names to load
– Note: unless full path is specified for each scheme file in .fluent file,
FLUENT tries to locate the scheme files from the working directory
43
AUTO UGM 2003 Confidential
• The Scheme commands can also be appended inside the
.fluent file itself
;; ------------------------------------------------------------------------------------------;;
;; Code to create USC panel
(let ((menu (cx-add-menu "USC" #\U)))
(cx-add-item menu "User Services Center" #\O #f and (lambda ()
(system "netscape http://www.fluentusers.com/ &"))))
;; Various useful stuff
(set! *cx-exit-on-error* #f)
;; ------------------------------------------------------------------------------------------;;
The .fluent file
USC panel created by
44
AUTO UGM 2003 Confidential
How to modify Fluent defined variables ?
• Fluent defines a set of variables that control the model and
interface setup
• Examples of these variables are:
– flow-warnings? boolean
– mg/grid-levels integer
– smooth-mesh/niter
– pressure/relax real
– flow-time
– physical-time-step
– matching-tolerance
• List of the available variables is not made public but user
can contact support engineer for a specific variable
45
AUTO UGM 2003 Confidential
How to modify Fluent defined variables ?
• These variables can be queried or changed via Scheme or UDF
• To query or change via Scheme:
– (rpgetvar 'flow-warnings?)
– (rpgetvar 'flow-time)
– (rpsetvar 'pressure/relax 0.5)
Note that there is no need to specify variable type in scheme
• To query or change via UDF:
– RP_Set_Boolean("dpm/track-in-absolute-frame?",TRUE);
– RP_Set_Real("flow-time",0.7);
– RP_Set_Integer("time-step",3);
Use RP_Get_type to query values
46
AUTO UGM 2003 Confidential
How to customize the Fluent startup setup ?
• Fluent imposes standard defaults on solver/model setup
during startup of a new case, for example:
– Printing but not plotting residuals
– Under relaxation default values
– Standard KE turbulence model
– and many more …
• User can customize some of these defaults to avoid
repetitive manual change every time fluent is started
• The scheme file given in the next slide shows an example
which can be modified and then appended to the .fluent file
47
AUTO UGM 2003 Confidential
How to customize the Fluent startup setup ?
(let ((old-rc client-read-case))
(set! client-read-case
(lambda args
(apply old-rc args)
(if (cx-gui?)
(begin
;; Do your customization here
(rpsetvar 'residuals/plot? #t)
(rpsetvar 'residuals/settings '((continuity #t 0 #f 0.001) (x-velocity #t 0 #f 0.001) (y-velocity #t 0 #f 0.001)
(z-velocity #t 0 #f 0.001) (energy #t 0 #f 1e-06) (k #t 0 #f 0.001) (epsilon #t 0 #f 0.001)))
(rpsetvar 'mom/relax 0.4)
(rpsetvar 'pressure/relax 0.5)
(rpsetvar 'ke-realizability-on? #t)
(rpsetvar 'realizable-epsilon? #t)
(cxsetvar 'vector/style "arrow")
;; You can add more settings here
)))))
Append to the .fluent file
Turning off convergence check
Use arrow instead of harpoon
for vector head
Use ke-realizable as default
48
AUTO UGM 2003 Confidential
How to use TUI to patch a variable ?
(OTS Solution 366 & 681)
• The Scheme file tui-patch.scm (given in next slide) provides
user with the functionality to patch a variable on a given list
of zones when running in batch mode
• The procedure consists of:
– Load the Scheme file using TUI command:
(load “tui-patch.scm”)
– Execute the TUI command:
(patch (arg-patch variable-name desired-value list-of-zone-names))
Example:
(patch (arg-patch ‘x-velocity 20.3 '(fluid-1 fluid-2 fluid-3)))
(patch (arg-patch ‘temperature 545.8 '(fluid-1 fluid-2 solid-4)))
Note the key string x-velocity and temperature used by Fluent to
identify field name and all values are in SI
49
AUTO UGM 2003 Confidential
How to use TUI to patch a variable ?
tui-patch.scm
(define thr-list
(lambda (name-list) (map thread-name->id name-list)))
(define cb-p
(let ((pa-var-list))
(set! pa-var-list (%inquire-patch-variable-names))
(lambda (varn) (assq varn pa-var-list))))
(define n-index
(lambda (varn index) (list-ref (cb-p varn) index)))
(define arg-patch
(let ((reg-list))
(set! reg-list '())
(lambda (varn xt name-list) (list (n-index varn 2) (n-index varn 3) (thr-list name-list) reg-list xt))))
50
AUTO UGM 2003 Confidential
Which interior zone(s) belong to a fluid zone ?
(OTS Solution 470)
• Can be done by visual inspection or changing the interior zone
to wall and check the adjacent fluid zone(s)
• The Scheme function find-zone.scm (given in next slide) will
list all the interior zones that are immersed within the user
specified fluid zone
• The procedure consists of:
– Load the Scheme file using TUI command:
(load “find-zone.scm”)
– Execute the TUI command:
(imme-info 'fluid-1)
51
AUTO UGM 2003 Confidential
find-zone.scm
(define (imme-info fluid-zone-name)
(let ((id-fz (thread-name->id fluid-zone-name))
(int-list (map thread-id (get-threads-of-type 'interior))))
(for-each (lambda (id)
(let ((zz (inquire-adjacent-threads id))(id1)(id2))
(set! id1 (car zz))
(set! id2 (cadr zz))
(if (eqv? id1 id2) (if (eqv? id1 id-fz)
(format "\n Interior zone \"~a\" is immersed in fluid zone \"~a\" \n"
(thread-id->name id) fluid-zone-name) )))) int-list))
(format "-------------------------------------------------------------------"))
Which interior zone(s) belong to a fluid zone ?
52
AUTO UGM 2003 Confidential
How to define customized color map ?
("thermacam"
(0.0 0.000 0.000 0.000)
(0.083 0.055 0.000 0.467)
(0.167 0.306 0.000 0.592)
(0.250 0.545 0.000 0.616)
(0.333 0.725 0.016 0.584)
(0.417 0.824 0.114 0.455)
(0.500 0.898 0.267 0.098)
(0.583 0.945 0.404 0.012)
(0.667 0.973 0.545 0.000)
(0.750 0.996 0.702 0.000)
(0.833 0.996 0.847 0.047)
(0.917 1.000 0.945 0.455)
(1.000 1.000 1.000 0.976)
)
• It is possible to read a custom color map or write an existing one
• The procedure consists of:
– Load the Scheme file:
(load “rw-colormap.scm”)
– To read a new color map:
/file/read-colormap
– To write an existing color map:
/file/write-colormap
Example: thermacam colormap
R G B
Scale (0-1)
53
AUTO UGM 2003 Confidential
How to define customized color map ?
Example: Static pressure variation for a simple duct
therma-cam color map default Fluent color map
54
AUTO UGM 2003 Confidential
How to define customized color map ?
(define (write-cmap fn)
(let ((port (open-output-file (cx-expand-filename fn)))
(cmap (cxgetvar 'def-cmap)))
(write (cons cmap (cx-get-cmap cmap)) port)
(newline port)
(close-output-port port)))
(define (read-cmap fn)
(if (file-exists? fn)
(let ((cmap (read (open-input-file (cx-expand-filename fn)))))
(cx-add-cmap (car cmap) (cons (length (cdr cmap)) (cdr cmap)))
(cxsetvar 'def-cmap (car cmap)))
(cx-error-dialog
(format #f "Macro file ~s not found." fn))))
(define (ti-write-cmap)
(let ((fn (read-filename "colormap filename" "cmap.scm")))
(if (ok-to-overwrite? fn)
(write-cmap fn))))
(define (ti-read-cmap)
(read-cmap (read-filename "colormap filename" "cmap.scm")))
(ti-menu-insert-item!
file-menu
(make-menu-item "read-colormap" #t ti-read-cmap
"Read a colormap from a file."))
(ti-menu-insert-item!
file-menu
(make-menu-item "write-colormap" #t ti-write-cmap
"Write a colormap to a file."))
rw_colormap.scm
(1) (2)
55
AUTO UGM 2003 Confidential
One Miscellaneous Scheme Tip
• Given a Zone ID, how do you find its zone name?
– Can be useful to know which zone is being mentioned
in an error message.
In the TUI: (thread-id name ID_NUMBER)
56
AUTO UGM 2003 Confidential
Summary
• General Tips and Tricks: From Pre to Post
– For Mesh and Case Set-up
– For Solving
– For Post-Processing
– For Customizing Fluent
• Appendices
– Miscellaneous Slides from General Tips and Tricks
– User Defined Function Tips
– The Text User Interface: FLUENT’s Hidden Jewels
– A Case Study: The Segregated Solver with High Pressure
Differential.
• Check out the User Services Center (USC) for solutions in
the Online Technical Support (OTS) Area.
57
AUTO UGM 2003 Confidential
Appendices
• Miscellaneous Slides from General Tips and
Tricks
• User Defined Function Tips
• The Text User Interface: FLUENT’s Hidden
Jewels
• A Case Study: The Segregated Solver with High
Pressure Differential.
58
AUTO UGM 2003 Confidential
Part I : Miscellaneous Slides from
General Tips and Tricks
59
AUTO UGM 2003 Confidential
How to address the heap memory limitation?
• In certain instances on Unix and Linux platforms, the heap
memory limit can be reached when:
– Creating a large number of surfaces
– Defining a large number of DPM injections
• To increase the heap memory allocation, start Fluent using
the “-h10000000” option
– This will allocate 10000000 storage
– The default is 500000
• For the DPM case, deleting all individual injections and
replacing them by several injections of type “file” will
alleviate the problem
60
AUTO UGM 2003 Confidential
How to modify the Schmidt number?
• In V5, Sc
t
is “hardwired” to the Pr
t
– Sc
t
could not be changed independently of Pr
t
– For adiabatic PDF simulations, Sc
t
could not be changed at all
• In V6.0, updated Sc
t
definition provides greater user
flexibility
– “PDF Schmidt number”
• Used in mixture fraction based calculations (default is 0.85)
– “Turbulent Schmidt number”
• Used in species transport calculations (default is 0.7)
– Either may be updated in the Define/Models/Viscous GUI panel
61
AUTO UGM 2003 Confidential
How to read V5 case with two-layer-zonal
model in V6?
• The two-layer-zonal model is no
longer available in Fluent 6.
• When reading a Fluent 5 case
with 2-layer-zonal model, Fluent
6 will chose the enhanced wall
treatment option
62
AUTO UGM 2003 Confidential
How to define custom turbulent thermal
conductivity?
• The UDF DEFINE_PROPERTY allows the user to modify only the
laminar thermal conductivity. For turbulent flows, FLUENT
computes a turbulent thermal conductivity based on turbulent
viscosity and add it to the (UDF-defined) laminar conductivity
#define C_K_T(c,t) (C_MU_T(c,t) * C_CP(c,t) / M_keprt)
#define C_K_EFF(c,t) (C_K_L(c,t) + C_K_T(c,t))
• If the turbulent Prandtl number “M_keprt” is set to a high value
in the define/models/viscous panel, C_K_T will become infinitely
small. The customized the turbulent heat conductivity can be
entrered through DEFINE_PROPERTY UDF for C_K_L
Note: Setting the turbulent Prandtl number to a very high value
will eliminate the turbulence production due to buoyancy
effects
63
AUTO UGM 2003 Confidential
How to compute the gradient of a scalar ?
• Many field variables in Fluent have their gradients stored
internally which can then be accessed via UDF for post-
processing or other purposes
• For variables where the gradients are not stored, can use the
following procedure:
– Load case/data file, define one UDS (UDS-0) and one UDM (UDM-0)
– Modify, load, and compile the UDF given in the next slide
– Execute the assign_scalar on-demand UDF
This will assign the variable (whose gradient is to be calculated) to the UDS-0
– Using TUI, execute 0 iteration
/solve/iterate 0
This will compute all the coefficients and gradients but won’t solve the
– Execute the store_gradient on-demand UDF
– This will assign the computed gradient to UDM-0
64
AUTO UGM 2003 Confidential
#include “udf.h”
#define zone_ID 2
DEFINE_ON_DEMAN(assign_scalar)
{
Thread *tc;
Domain *domain;
cell_t c;
face_t f;
domain = Get_Domain(zone_ID);
/* Fill UDF with the scalar */
thread_loop_c(tc,domain)
{
begin_c_loop(c,tc)
C_UDSI(c,tc,0) = C_P(c,tc);
end_c_loop(c,tc)
}
}
DEFINE_ON_DEMAND(store_gradient)
{
Thread *tc;
Domain *domain;
cell_t c;
domain = Get_Domain(zone_ID);
/* Fill UDM with magnitude of gradient */
thread_loop_c(tc,domain)
{
begin_c_loop(c,tc)
C_UDMI(c,tc,0) = NV_MAG(C_UDSI_C(c,tc));
end_c_loop(c,tc)
}
}
(1)
(2)
How to compute the gradient of a scalar ?
modify this
65
AUTO UGM 2003 Confidential
Part II : User Defined Function Tips
66
AUTO UGM 2003 Confidential
• Define Adjust UDF is called at the beginning of every
iteration even for unsteady solver
• For unsteady runs, there are instances where it is desirable for
the Adjust UDF to be called only at the beginning of the first
iteration of every time-step
• Can use the macro first-iteration, example:
DEFINE_ADJUST(myadjust,domain)
{
if (first_iteration)
{
/* Do procedures to be executed only at the
first
iteration of every timestep */
}
}
Miscellaneous on UDF (1)
67
AUTO UGM 2003 Confidential
Miscellaneous on UDF (2)
• To get the current iteration number, use:
int current_iteration_number = (nres==0)?(1):((int)count2[nres-1]);
• To check if a face zone is of type wall, use:
if (THREAD_TYPE(tf) = = THREAD_F_WALL)
Similarly for other face zone types, can use:
– THREAD_F_INTERIOR
– THREAD_F_SYMMETRIC
– THREAD_F_PERIODIC
– THREAD_F_MFINLET
– THREAD_F_PINLET
– THREAD_F_POUTLET
– THREAD_F_PFAR
– THREAD_F_VINLET
– THREAD_F_OUTFLOW
68
AUTO UGM 2003 Confidential
Miscellaneous on UDF (3)
• To toggle between 2d and 3d, use the following compiler
directives:
#if RP_2D
{ … codes for 2D …}
#else
{ … codes for 3D … }
#endif
• To toggle between 2d and 2d-axisymmetric, use:
#if RP_2D
if (rp_axi)
{ … codes for axisymmetric …}
else
{ … codes for 2D planar … }
#endif
69
AUTO UGM 2003 Confidential
Miscellaneous on UDF (4)
• To toggle between segregated and coupled solvers, use:
if (rp_seg)
{ … codes for segregated solver …}
else
{ … codes for segregated solver …}
• To toggle between inviscid and viscous, use:
if (rp_visc)
{ … codes for viscous …}
else
{ … codes for inviscid …}
• To exclude boundary face when looping through the faces:
if (!BOUNDARY_FACE_THREAD_P(t))
70
AUTO UGM 2003 Confidential
• How to access solution residuals using UDF ?
#include "udf.h"DEFINE_ADJUST(my_adjust,domain)
{
int nw;
real scaled_res;
FILE *fp;
fp = fopen("output_test","a");
fprintf(fp,"\n");
fprintf(fp, "current iter = %d\n",count2[nres-1]);
for (nw=0; nw<MAX_EQNS; ++nw)
{
if (strlen(DOMAIN_EQN_LABEL(domain,nw))>0)
{
scaled_res = DOMAIN_RES(domain,nw)[nres-1]/
DOMAIN_RES_SCALE(domain,nw)[nres-1];
fprintf(fp,"%s equation: %g\n",DOMAIN_EQN_LABEL(domain,nw),scaled_res);
}
}
fclose(fp);
}
Miscellaneous on UDF (5)
current iter = 1
continuity equation: 1
x-velocity equation: 1.01033e-08
y-velocity equation: 1.01114e-08
z-velocity equation: 0.000495387
energy equation: 5.91456e-08
k equation: 0.77859
epsilon equation: 0.7963
71
AUTO UGM 2003 Confidential
Miscellaneous on UDF (6)
• How to loop through all nodes of a given face zone only once ?
begin_f_loop(f,tf)
f_node_loop(f,tf,n) SET_V_FLAGS(F_NODE(f tf,n),TAG_FLAG);
end_f_loop(f,tf)
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
if (NODE_FLAG (v = F_NODE(f,tf,n),TAG_FLAG))
{
CLEAR_V_FLAGS (v, TAG_FLAG);
/* Your code */
}
}
}
end_f_loop(f,tf)
Each node of the corresponding
face zone will be visited only
once
72
AUTO UGM 2003 Confidential
Miscellaneous on UDF (7)
• Certain fields inside the Fluent model panel do not have built-
in UDF hookups, thus it is difficult to specify user specified
time/iteration varying values
• Examples are the wall and fluid speeds
• Is there any workaround ?
No UDF hookup
73
AUTO UGM 2003 Confidential
Miscellaneous on UDF (8)
• Can write a DEFINE_ADJUST UDF and directly access the
macro of the variable of interest (contact support engineer for
variable names)
THREAD_VAR(tf).wall.origin[0]
THREAD_VAR(tf).wall.origin[1]
THREAD_VAR(tf).wall.origin[2]
THREAD_VAR(tf).wall.axis[0]
THREAD_VAR(tf).wall.axis[1]
THREAD_VAR(tf).wall.axis[2]
THREAD_VAR(tf).wall.translate_mag
THREAD_VAR(tf).wall.translate_dir[0]
THREAD_VAR(tf).wall.translate_dir[1]
THREAD_VAR(tf).wall.translate_dir[2]
THREAD_VAR(tf).wall.omega
THREAD_VAR(tf).wall.u
THREAD_VAR(tf).wall.v
THREAD_VAR(tf).wall.w
THREAD_VAR(tc).fluid.origin[0]
THREAD_VAR(tc).fluid.origin[1]
THREAD_VAR(tc).fluid.origin[2]
THREAD_VAR(tc).fluid.axis[0]
THREAD_VAR(tc).fluid.axis[1]
THREAD_VAR(tc).fluid.axis[2]
THREAD_VAR(t1).fluid.velocity[0]
THREAD_VAR(t1).fluid.velocity[1]
THREAD_VAR(t1).fluid.velocity[2]
THREAD_VAR(tc).fluid.omega
74
AUTO UGM 2003 Confidential
Miscellaneous on UDF (9)
• Example UDF to ramp up the fluid rotational speed for MRF
to obtain improved convergence
#include "udf.h"
#define Niter 25
#define omg_mn 1
#define omg_mx 100
DEFINE_ADJUST(myadjust,domain)
{
int zoneID;
int iter = (nres==0)?(1):((int)count2[nres-1]);
float omega;
Thread *tc;
FILE *fp;
fp = fopen("output_check","a");
zoneID = 3;
tc = Lookup_Thread(domain,zoneID);
if ( (iter%Niter)==0 )
{
omega = omg_mn + (iter/Niter)*10;
if ( omega > omg_mx ) omega = omg_mx;
THREAD_VAR(tc).fluid.omega = omega;
fprintf(fp,"At iter=%d - update omega to %f\n",
iter,omega);
fclose(fp);
}
}
(1) (2)
75
AUTO UGM 2003 Confidential
Part III : Fluent Text User Interface
FLUENT’s Hidden Jewels
76
AUTO UGM 2003 Confidential
Text User Interface
ƒ The text menu system provides a hierarchical interface to
the program’s underlying procedural interface.
ƒ The user can easily manipulate its operation with
standard text-based tools: input can be saved in files,
modified with text editors, and read back in to be
executed.
ƒ Text menu system is tightly integrated with the scheme
extension language, it can easily be programmed to
provide sophisticated control and customized
functionality.
77
AUTO UGM 2003 Confidential
Text User Interface
ƒ The general menu consists of
adapt/ grid/ surface/
display/ plot/ view/
define/ report/ exit
file/ solve/
ƒ Certain commands are available only through the TUI.
They will be outlined and described hereinafter.
78
AUTO UGM 2003 Confidential
define/models/dpm
ƒ clear-particles-from-domain
– Remove all particles currently in the domain.
ƒ coupled-heat-mass-update
– By default, the solution of the particle heat and mass equations are
solved in a segregated manner. If you enable this option, FLUENT
will solve this pair of equations using a stiff, coupled ODE solver
with error tolerance control. The increased accuracy, however,
comes at the expense of increased computational expense.
– This option gives a more accurate temperature and mass content
for the particles when having a strong coupling between both
equations. It doesn’t affect nor accelerate the coupling of the
particle source terms to the fluid equations.
79
AUTO UGM 2003 Confidential
define/models/dpm
ƒ implicit-momentum-coupling
– Use an implicit treatment for the DPM momentum source terms
(else explicit).
– In certain circumstances, the implicit source term linearization
model doesn’t seem to respond very quickly to major changes in
the flow field (turning an air inlet off or adding / removing porous
media). In these cases, FLUENT behaves better when the explicit
source term formulation is used
– Example: The geometry is a 2x2x12 meter chamber. Air and
particles are introduced through inlets on one end of the chamber.
An additional air inlet is located on the top of the chamber at a
distance of approximately 8m.
80
AUTO UGM 2003 Confidential
define/models/dpm
ƒ implicit-momentum-coupling
81
AUTO UGM 2003 Confidential
define/models/dpm
ƒ implicit-momentum-coupling
– The predicted gas velocity magnitude on the chamber mid-plane is
shown. The main jet is introduced on the right side and persists
approximately halfway down the chamber. A second smaller jet can
be seen entering from the top approximately 2/3 of the way down
the chamber.
82
AUTO UGM 2003 Confidential
define/models/dpm
ƒ implicit-momentum-coupling
– Top inlet was turned off. With explicit formulation, after 50
iteration there is little evidence that an air jet was injected from
chamber roof. With implicit formulation it takes more time.
83
AUTO UGM 2003 Confidential
define/models/dpm
ƒ velocity-gradient-correction
– During the particle tracking step the velocity of the
surrounding medium changes. In FLUENT 6 this has been
taken into account for the particle trajectory equation.
– FLUENT predicts the trajectory of a discrete phase particle (or
droplet or bubble) by integrating the force balance on the particle,
which is written in a Lagrangian reference frame.
– With the trajectory itself predicted by:
( ) ( )
i p p i p D
p
F g u u F
dt
du
+ − + − = ρ ρ ρ /
p
u
dt
dx
=
84
AUTO UGM 2003 Confidential
define/models/dpm
ƒ velocity-gradient-correction
– The trajectory equation is rewritten in simplified form as:
τ is the particle relaxation time.
– As opposed to Fluent 5, FLUENT 6 uses a trapezoidal scheme to
integrate this equation
– The trapezoidal scheme approach is the default with velocity-gradient-
correction switched on.
( )
p p p
u u dt du τ / / − =
( ) ...
1
1 *
1
+ − =


+
+
n
p
n
p
n
p
u u
t
u u
τ
( )
1 *
2
1
+
+ =
n n
u u u
n n
p
n n
u u t u u ∇ ⋅ ∆ + =
+1
85
AUTO UGM 2003 Confidential
define/models/dpm
ƒ Track-in-absolute-frame
– When multiple reference frames are used in conjunction with
the discrete phase model, the display of particle tracks will not,
by default, be meaningful. Similarly, coupled discrete-phase
calculations are not meaningful.
– An alternative approach for particle tracking and coupled
discrete-phase calculations with multiple reference frames is to
track particles based on absolute velocity instead of relative
velocity. To make this change, this command should be used.
However, tracking particles based on absolute velocity may
result in incorrect particle-wall interaction.
86
AUTO UGM 2003 Confidential
define/models/dpm
ƒ Track-in-absolute-frame
– The particle injection velocities (specified in the Injection panel)
are defined relative to the frame of reference in which the particles
are tracked. By default, the injection velocities are specified
relative to the local reference frame. If this option is enabled, the
injection velocities will be specified relative to the absolute frame.
87
AUTO UGM 2003 Confidential
define/models/energy?
ƒ include diffusion at inlets?
– The net transport of energy at inlets consists of both the convection
and diffusion components. The convection component is fixed by
the inlet temperature specified by the user. The diffusion
component, however, depends on the gradient of the computed
temperature field. Thus the diffusion component (and therefore the
net inlet transport) is not specified a priori.
– In some cases, the user may wish to specify the net inlet transport
of energy rather than the inlet temperature. By default, FLUENT
includes the diffusion flux of energy at inlets. To turn off inlet
diffusion, answer [no] to include diffusion at inlets?
– Available only for the segregated solver.
88
AUTO UGM 2003 Confidential
define/models/species
ƒ inlet-diffusion?
– Similar to the energy equation, the net transport of species at inlets
consists of both the convection and diffusion components. The
convection component is fixed by the inlet species concentration
specified by the user. The diffusion component, however, depends
on the gradient of the computed species concentration field.
– If the user wants to include only the convective transport of
species through the inlets of the domain. This can be done by
disabling inlet species diffusion. By default, FLUENT includes the
diffusion flux of species at inlets.
– Available only with the segregated solver.
89
AUTO UGM 2003 Confidential
define/models/viscous/
ƒ sa-damping? [yes]
– The full Spalart-Allmaras model is a low-Reynolds-number model.
Damping functions have been built into the model in order to
properly reduce the turbulent viscosity in the viscous sublayer.
ν
ν
χ
χ
χ
ν ρ u
~
, f ,
~
3
1
3
3
v1 1 t

+
= ≡
c
v
v
f
1
v2 2
2 2
1
1 f ,
~
~
v
v
f
f
d
S S
χ
χ
κ
ν
+
− = + ≡
( )
2 2
6
2
6 / 1
6
3
6
6
3
~
~
, g ,
1
d S
r r r c r
g
g f
w
w
w
w
c
c
κ
ν
≡ − + =

+
+
=
( )
2
1
2
2
~
1
~

~ ~
~
1
~
~
~
|
.
|

\
|

|
|
.
|

\
|


+
¦
)
¦
`
¹
¦
¹
¦
´
¦


+


+ =
d
f c
x
c
x x
S c
Dt
D
w w
j
b
j j
b
ν
ρ
ν
ρ
ν
ν ρ u
σ
ν ρ
ν
ρ
ν
0
~
: condition boundary Wall = ν
distance from wall distance from wall
damping functions damping functions
90
AUTO UGM 2003 Confidential
define/models/viscous/
ƒ sa-damping? [no]
– There are some situations in which the damping functions will
adversely affect the accuracy of the model when it is used with
coarse meshes. A high-Reynolds-number form of the model has
been included.
– Wall Boundary condition :
– It is assumed that the mesh is too coarse to resolve the laminar
sublayer, and the wall shear-stress is obtained from the law-of-the-
wall:
unchanged = = =
w v2 v1
f , 0 f , 1 f
|
|
.
|

\
|
=
u
ρ
κ
τ
τ
u y
E
u
u
ln
1
d u κ ν
τ
=
~
91
AUTO UGM 2003 Confidential
define/models/viscous/
ƒ turbulence-expert/
– Menu for expert options related to turbulence.
ƒ turbulence-expert/low-re-ke?
– Extend the k-ε model to low Reynolds numbers and allow it to be
applied very close to the wall. Modifications involve adding
damping functions to the source terms in the transport equation for
ε and to the expression for turbulent viscosity.
– While the damping functions allow the equations to be used
through the turbulent boundary layer, including the viscous sub-
layer, they are typically of an ad hoc nature and therefore cannot
be relied upon to give consistently good results in all types of
flows.
92
AUTO UGM 2003 Confidential
ƒ turbulence-expert/low-re-ke? [yes]
– Standard k-ε model modified by damping functions:
– Damping functions are written in terms of Reynolds numbers:
+



|
|
.
|

\
|
+


=
j j
x x Dt
D ε
σ
u
u
ε
ρ
ε
t
( ) ε ρ u
ε
ε ε 2 2
2
1 1
C f S C f
k
t

ε ε− −transport equation transport equation
turbulent viscosity turbulent viscosity
ε
ρ u
u u
2

k
C f
t
=
2 1
, , f f f
u
define/models/viscous/
( )
u
ρ uε ρ
u
ρ

ρ
ε
y
R
y k
R
k
R
4 / 1
y
2
t
/
e ; e ; e = = =
93
AUTO UGM 2003 Confidential
ƒ turbulence-expert/low-re-ke-index
– Select which low-Reynolds-number k-ε model is to be used among the
six models available.
define/models/viscous/
( )

|
|
.
|

\
|

|
|
.
|

\
|
− − =
=
+ =

12
exp 1
36
exp
9
2
1
1
4 1 ) 008 . 0 tanh(
2
2
1
4 / 3
y
t
t y
Re
Re
f
f
Re Re f
u
low low- -re re- -ke ke- -index index : 0 : 0 Î ÎAbid Abid
low low- -re re- -ke ke- -index index : 1 : 1 Î ÎLam Lam- -Bremhorst Bremhorst
| | ( )
) exp( 1
) / 05 . 0 ( 1
/ 5 . 20 1 ) 0165 . 0 exp( 1
2
2
3
1
2
t
t y
Re f
f f
Re Re f
− − =
+ =
+ − − =
u
u
94
AUTO UGM 2003 Confidential
define/models/viscous/
low low- -re re- -ke ke- -index index : 2 : 2 Î ÎLaunder Launder- -Sharma Sharma
) exp( 3 . 0 1
1
) 50 / Re 1 (
4 . 3
exp
2
2
1
2
t
t
Re f
f
f
− − =
=

+

=
u
low low- -re re- -ke ke- -index index : 3 : 3 Î ÎYang Yang- -Shih Shih
( )
( )
2
2
1
2 5 10 3 7 4
Re 1 1
05 . 0 95 . 0
Re 1 Re 10 Re 10 5 Re 10 5 . 1 exp( 1

− − − −
+ =
+ =
+ − × − × − − =
t
k
t y y y
f
G
f
f
ρε
u
ƒ turbulence-expert/low-re-ke-index
95
AUTO UGM 2003 Confidential
ƒ turbulence-expert/low-re-ke-index
define/models/viscous/
low low- -re re- -ke ke- -index index : 4 : 4 Î ÎAbe Abe- -Kondoh Kondoh- -Nagano Nagano
| | ( ) | |
| | | | ) 25 . 42 / Re exp( 3 . 0 1 ) 1 . 3 / Re exp( 1
1
Re 10 5 . 2 exp Re 5 1 ) 14 / Re exp( 1
2
2
2
1
2 5 75 . 0
2
t e
t t e
f
f
f
− − − − =
=
× − + − − =
− −
u
low low- -re re- -ke ke- -index index : 5 : 5 Î ÎChang Chang- -Hsieh Hsieh- -Chen Chen
| | ( )
| | | | ) Re 0631 . 0 exp( 0631 . 0 1 ) Re exp( 01 . 0 1
1
Re 66 . 31 1 ) Re 0215 . 0 exp( 1
2
2
2
1
125 . 1
2
y t
t y
f
f
f
− − − − =
=
+ − − =

u
96
AUTO UGM 2003 Confidential
ƒ turbulence-expert/low-re-ke-index
– Low-Reynolds model k-ε equations solved on fine mesh (required)
right to the wall. The mesh resolution requirements are similar to those
of the two-layer model.
– y+ at the wall-adjacent cell should be of 1. Most ideally, One must
have at least 10 cells within the viscosity-affected near-wall region
define/models/viscous/
97
AUTO UGM 2003 Confidential
ƒ turbulence-expert/kato-launder-model?
– This model accounts for vorticity magnitude in the production term of
turbulent kinetic energy. It results in a reduced level of production
close to stagnation points (e.g. impinging jets).
ƒ turbulence-expert/kw-vorticity-base-production?
– Production of turbulent kinetic energy is function of vorticity
magnitude instead of strain rate magnitude. The main purpose is to
prevent over production of turbulence close to stagnation point.
– Damping functions are written in terms of Reynolds numbers:
define/models/viscous/
98
AUTO UGM 2003 Confidential
ƒ rke-cmu-rotation-term?
– The use of realizable k-ε model with multiple reference frame (MRF)
model is not recommended.
– Where is the mean rate-of-rotation tensor viewed in a rotating
reference frame with the angular velocity .
– When using this expression of C
u
with the MRFmodel, there is a jump in
the turbulent viscosity ratio at the interface between the stationary and
rotating fluid zones because of the ad hoc term .
– This option is provided for users who want to experiment with this model
and modify the definition of C
u
by switching off the term .
define/models/viscous/
ε
u
k U
A A
C
s
*
0
1
+
=
ij ij
Ω = Ω
~

~ ~
*
ij ij ij ij
S S U Ω Ω + ≡
k ijk ij ij
ω ε − Ω = Ω
ij

k
ω
k ijk
ω ε 2 −
k ijk
ω ε 2 −
k ijk
ω ε 2 −
Absolute Absolute
Relative Relative
99
AUTO UGM 2003 Confidential
ƒ Modify-zone/extrude-face-zone-…
– Ability to extrude a boundary face zone and extend the solution domain
without having to exit the solver. A typical application of the extrusion
capability is to extend the solution domain when recirculating flow is
impinging on a flow outlet.
– Current extrusion capability creates prismatic or hexahedral layers based
on the shape of the face and normal vectors to the face zone’s nodes.
– New fluid zone is created
– Implemented only in 3D.
define/boundary-conditions/
100
AUTO UGM 2003 Confidential
ƒ Two options available
ƒ Modify-zone/extrude-face-zone-delta
• Extrude a face thread by specifying a list of displacements (in SI units).
ƒ Modify-zone/extrude-face-zone-para
• Extrude a face thread by specifying a total distance (in SI units) and a
list of parametric locations between 0 and 1 (e.g. 0., 0.2, 0.4, 0.8, 1.0).
define/boundary-conditions/
101
AUTO UGM 2003 Confidential
ƒ modify-zone/extrude-face-zone-delta [example]
– A cube (10x10x10) is extruded twice at the outlet by a distance of 1.
/define/boundary-conditions/modify-zones> extrude-face-zone-delta
Distance delta(1) [()] 1
Distance delta(2) [()] 1
Distance delta(3) [()]
Extrude face zone? [yes]
Moved original zone (outlet) to interior-7
Created new prism cell zone fluid-10
Created new prism cap zone pressure-outlet-11
Created new prism side zone wall-12
Created new prism interior zone interior-13
define/boundary-conditions/
102
AUTO UGM 2003 Confidential
ƒ modify-zone/make-periodic
– Attempt to establish periodic/shadow zone connectivity.
ƒ modify-zone/repair-periodic
– Modify the grid to enforce a rotational angle or translation distance for
periodic boundaries.
– For translationally periodic boundaries, the command computes an
average translation distance and adjusts the node coordinates on the
shadow face zone to match this distance.
– For rotationally periodic boundaries, the command prompts for an
angle and adjusts the node coordinates on the shadow face zone using
this angle and the defined rotational axis for the cell zone.
define/grid/
103
AUTO UGM 2003 Confidential
ƒ modify-zone/slit-periodic
ƒ Slit periodic zone into two symmetry zones.
ƒ modify-zone/slit-face-zone
– Slit two-sided wall into two connected wall zones.
define/grid/
104
AUTO UGM 2003 Confidential
ƒ non-reflecting-bc/
– Enter the non-reflecting boundary conditions (NRBC) menu.
– Available for pressure inlet/outlet BCs and mixing plane.
– Implementation with a number of limitations
• SS, coupled explicit solutions only
• NRBC and NRMP faces require structured meshes
• NRMP requires equal numbers of divisions equally spaced in the
“spanwise” direction for each plane
• Quad/hex layer adjacent to NRBC/MP highly recommended for
2D, required for 3D
• To choose “non-reflecting” requires ALL pressure boundaries and
mixing planes to be non-reflecting
• ALL must meet requirements for NR option to be available
define/boundary-conditions/
105
AUTO UGM 2003 Confidential
ƒ non-reflecting-bc/
define/boundary-conditions/
Truncated downstream
boundary
Long Domain
Short Domain
2D Turbine Vane
106
AUTO UGM 2003 Confidential
Shock wave at
vane trailing edge
define/boundary-conditions/
Long Domain
Constant Pressure BC
Contours of Static
Pressure (atm)
ƒ non-reflecting-bc/
107
AUTO UGM 2003 Confidential
define/boundary-conditions/
Short Domain
Constant Pressure BC
Contours of Static
Pressure (atm)
Constant pressure BC
results in incorrect shock
location
ƒ non-reflecting-bc/
108
AUTO UGM 2003 Confidential
Short Domain
Non-Reflecting BC
Contours of Static
Pressure (atm)
Non-reflecting boundary
conditions permit shock
wave to pass through the
boundary - shock location
is correctly predicted!
define/boundary-conditions/
ƒ non-reflecting-bc/
109
AUTO UGM 2003 Confidential
ƒ mixing-planes/set/fix-pressure-level
– For certain turbomachinery configurations, such as a torque converter,
there is no fixed-pressure boundary when the mixing plane model is
used.
– The mixing plane model is usually used to model the three interfaces
that connect the components of the torque converter. In this
configuration, the pressure is no longer fixed. As a result, the pressure
may float unbounded, making it difficult to obtain a converged solution.
– FLUENT offers an option for fixing the pressure level and adjust the
gauge pressure field after each iteration by subtracting from it the
pressure value in the cell closest to the Reference Pressure Location in
the Operating Conditions panel.
– Only available for incompressible flows using the segregated solver
define/boundary-conditions/
110
AUTO UGM 2003 Confidential
• mixing-plane/set/conserve-swirl
– Conservation of swirl is important for applications such as torque
converters. Once the option is turned on, the user can ask the solver to
report information about the swirl conservation during the calculation.
– If verbosity? is turned on, FLUENT will report for every iteration:
• The zone ID for the zone on which the swirl conservation is active
• The upstream and downstream swirl integration per zone area,
• The ratio of upstream to downstream swirl integration before and
after the correction.
define/boundary-conditions/
111
AUTO UGM 2003 Confidential
ƒ real-gas/
– The real gas model uses the National Institute of Standards and
Technology (NIST) Thermodynamic and Transport Properties of
Refrigerants and Refrigerant Mixtures Database Version 6.0
(REFPROP v6.0) to evaluate thermodynamic and transport properties.
– Limitations of the real gas model
• Used only with the coupled solvers.
• All fluid property information in the Materials panel is ignored by
FLUENT. User cannot override the REFPROP database for a real
gas material by modifying parameters in the Materials panel.
• All fluid zones must contain the real gas.
• The real gas model does not support mixtures and/or saturated
fluids.
define/user-defined/
112
AUTO UGM 2003 Confidential
ƒ real-gas/
– Activating the real gas model is a two-step process. First enable the real
gas model, and then select a material from the REFPROP database.
> define/user-defined/real-gas
use real gas? [no] yes
CO2.fld R123.fld R142b.fld R236fa.fld butane.fld
R11.fld R124.fld R143a.fld R245ca.fld ethane.fld
R113.fld R125.fld R152a.fld R245fa.fld isobutan.fld
R114.fld R13.fld R22.fld R32.fld propane.fld
R115.fld R134a.fld R227ea.fld R41.fld propylen.fld
R116.fld R14.fld R23.fld RC318.fld
R12.fld R141b.fld R236ea.fld ammonia.fld
select real-gas data file [""] "R125.fld"
define/user-defined/
/usr/local/Fluent.Inc/fluent6.0/realgas/lib/R125.fld
Opening "/usr/local/Fluent.Inc/fluent6.0/realgas/
ultra/librealgas.so"...
Setting material "air" to a real-gas...
matl name: "R125"
: "pentafluoroethane"
: "354-33-6"
Mol Wt : 120.022
Critical properties:
Temperature : 339.33 (K)
Pressure : 3.629e+06 (Pa)
Density : 4.75996 (mol/L) 571.3 (kg/m^3)
113
AUTO UGM 2003 Confidential
• mixing-plane/set/conserve-total-enthalpy
– Global parameters such as efficiency are directly related to the change
in total enthalpy across a blade row or stage.
– Ensuring conservation of total enthalpy involves adjusting the
downstream total temperature profile such that the integrated total
enthalpy matches the upstream integrated total enthalpy.
– If verbosity? is turned on, FLUENT will report for every iteration:
• The zone ID for the zone on which the enthalpy conservation is
active
• The upstream and downstream heat fluxes,
• The ratio of upstream to downstream heat fluxes.
define/boundary-conditions/
114
AUTO UGM 2003 Confidential
ƒ rendering-options/auto-spin?
– Enable mouse view rotations to continue to spin the display after the
button is released. To stop the spinning, click on the display window
again.
– It is recommended to use this option with the double buffering option
turned on. Double buffering dramatically reduces screen flicker during
graphics updates.
ƒ reset-graphics
– Reset the graphics system and kill all the display windows.
ƒ windows/
– Contains commands that allow user to customize the relative positions
of sub-windows inside the active graphics window.
display/set/
115
AUTO UGM 2003 Confidential
ƒ windows/… [example]
– Add borders to the scale, the axis, the image.
– Eliminate the application title
– etc
display/set/
116
AUTO UGM 2003 Confidential
ƒ write-bc
– Save all currently-defined boundary conditions to a file, FLUENT will
use the same format as the “zone”' section of the case file.
ƒ read-bc
– Read boundary conditions from a file and apply them to the
corresponding zones in the model. FLUENT will set the boundary
conditions in the current model by comparing the zone name associated
with each set of conditions in the file with the zone names in the model.
Note : If user wants to apply a set of conditions to multiple zones with
similar names, the boundary-condition file saved with the write-bc can
be edited to include “wildcards” ( *) within the zone names (e.g. to
apply a particular set of conditions to wall-12, wall-15, and wall-17 in
the current model, edit the boundary-condition file and set the zone
name associated with the desired conditions to wall-*).
file/
117
AUTO UGM 2003 Confidential
• reread-grid
– Given a case file with a particular grid, the user can use this option to
merge a new grid with the existing boundary conditions, material
properties, solution parameters, etc.
– Useful situation: a better mesh is generated for the same problem and
the user doesn’t want to reenter all of the boundary conditions,
properties, and parameters.
– The new grid must have the same zone structure as the original grid.
file/
118
AUTO UGM 2003 Confidential
ƒ species-mass-flow
– Print list of species mass flow rate at inlets and outlets.
ƒ uds-flow
– Print list of user-defined scalar flow rate at boundaries.
Note: These options are more accurate than surface integrals at boundary
zones because they do not involve cell interpolation. They are analogous to
the report →fluxes in the GUI for mass and heat transfer rates.
report/
119
AUTO UGM 2003 Confidential
ƒ monitors/force/clear-all-monitors
– Fast way to discard the internal and external file data associated with
the force monitors.
ƒ set/flow-warnings?
– Specify whether or not to print warning messages when reversed flow
occurs at inlets and outlets, and when mass flow inlets develop
supersonic regions. By default, flow warnings are printed.
ƒ set/numerics/implicit body force treatment?
– For problems with dominant body forces, this option allows for a
linearization of body force source terms.
solve/
120
AUTO UGM 2003 Confidential
ƒ set/expert/use conservative form of energy equation?
– FLUENT solves the energy equation in its conservative form
– Which is consistent with the finite volume conservative form of
governing equations.
– If the user wants to solve the energy equation in non-conservative
form this option should be switched off (not recommended)
solve/
( ) ( ) ( ) ( )
h
j
eff j j eff
S v J h T k p E v E
t
+
|
|
.
|

\
|
⋅ + − ∇ ⋅ ∇ = + ⋅ ∇ +



r
r
r
τ ρ ρ
( ) ( ) ( )
φ
φ φ ρ ρφ S D v
t
eff
+ ∇ ⋅ ∇ = ⋅ ∇ +

∂ r
121
AUTO UGM 2003 Confidential
ƒ set/expert/use alternate formulation for wall temperature? [no]
– FLUENT models the flux at the wall as follows:
– The term f(∆T) includes second order terms that need to be determined,
which involves approximations.
solve/
n T k q
r
⋅ ∇ =
) (
) (
T f
h
T T
k q
c w
∆ +


=
122
AUTO UGM 2003 Confidential
ƒ set/expert/use alternate formulation for wall temperature? [yes]
– Assume face center is defined such as the vector between cell center
and face center is perpendicular to the wall.
– The term f(∆T) vanishes and ∆h changes.
– This option doesn’t impact the results if the wall cells are not skewed.
solve/
n T k q
r
⋅ ∇ =
h
T T
k q
c w


=
) (
123
AUTO UGM 2003 Confidential
ƒ set/relaxation-method?
– By default FLUENT uses the Gauss-Seidel relaxation method
(“gauss-seidel”).
– With Gauss-Seidel, each cell uses the updated value of the neighboring
cells. This yields differences between the serial and parallel solvers.
– If the parallel solver partitions are visited in an order that is different
form the way the serial solver sweeps the domain, the results can differ
from one iteration to another but will ultimately converge to the same
solution.
– If the Jacobi approach is used, the parallel and serial solvers will give
the exact same solution at every iteration because the Jacobi approach
always uses values from the previous iteration (“jacobi”).
– This option is used for testing purposes. It is recommended to use
Gauss-Seidel method.
solve/
124
AUTO UGM 2003 Confidential
Part IV : Case Study
The Segregated Solver with High
Pressure Differential.
125
AUTO UGM 2003 Confidential
How to use the segregated solver when there are
large pressure variations between the inlets and
outlets ?
A case study for a ball diverter controlled valve
126
AUTO UGM 2003 Confidential
Valve controlled by ball diverter
Description
ƒ Flow to the left and right channels is
controlled by the position of the ball
diverter
ƒ Very high pressure at the inlets (~500
psi) and low pressures at the outlets
(~0.01 psi)
ƒ Large pressure variation within the
domain
127
AUTO UGM 2003 Confidential
ƒ Hybrid mesh was created in Gambit using the map, cooper,
and Tgrid schemes
Valve controlled by ball diverter
Mesh Issue
cooper
cooper
cooper
tgrid with sizing function
map
tgrid
128
AUTO UGM 2003 Confidential
ƒ Mesh count is 1.09M with low skewness
– Cell equi-angle skew: [0, 0.84]
– Cell equi-volume skew: [0, 0.79]
ƒ High quality tetrahedral elements with
appropriate clustering of cells are created in
Gambit using the sizing function tools
Valve controlled by ball diverter
Mesh Issue
Red lines show the faces used as the
sources of the sizing function
Mesh clustering at the gap regions
129
AUTO UGM 2003 Confidential
ƒ Inlet boundaries
– Main inlet is specified as pressure-inlet type
• Total pressure is 500 psi and total temperature is 2000 K
• Flow is subsonic, set the static pressure to 499.5 psi
– Side inlets are specified as Massflow-inlet type
• Massflow rates are 7e-5 kg/s and 2e-5 kg/s
– Correspond to velocities of 33.4 m/s and 9.8 m/s respectively
• Total temperature is 2000 K
• Flow is subsonic, set the static pressure to 499.5 psi
ƒ Outlet boundaries
– Both outlet boundaries are specified as pressure-outlet type
• Static pressure is 0.01 psi
• Backflow total temperature is 2000K
Valve controlled by ball diverter
Setup Parameters
130
AUTO UGM 2003 Confidential
ƒ Case is very difficult to start and to converge due to large
pressure variations in the domain
ƒ Convergence difficulties are attributed to:
– Difficult to specify good initial conditions
– Patching is also difficult since there may be compression/expansion
structures inside the domain
– Difficult to setup appropriate solution limits due to large variations
in pressure
ƒ Will lowering URFs work ?
– Using very low URFs at the beginning may work but it may be
impractical since very low values may be needed
Valve controlled by ball diverter
Solution Procedure
131
AUTO UGM 2003 Confidential
– Set the static pressure at the outlets to values slightly lower than the
inlet values
ƒ Set appropriate solution limits which reflects the modified
condition
– Initialize using the inlet condition but set velocities to zero
– Iterate until sufficient first order convergence
ƒ No backflow at the main inlet
– Gradually lower the outlet static pressure values and iterate until
sufficient convergence at each step
ƒ Adjust the solution limits to reflect the updated outlet pressure
values
– Save the case/data files as necessary
Valve controlled by ball diverter
Solution Procedure
132
AUTO UGM 2003 Confidential
ƒ Other tips:
– Change to second order only after sufficient convergence using
first order with the desired pressure values at the outlets
– Density discretization needs to be changed to second-order to
resolve shocks accurately, if any
– Specify Massflow inlet instead of pressure-inlet at the main inlet
• Prevent backflow at the inlet during the initial stages of the
iteration
– Use the PISO algorithm to handle the velocity-pressure coupling
• Will reduce the pressure oscillations between the high pressure
inlets and low pressure outlets
Valve controlled by ball diverter
Miscellaneous
133
AUTO UGM 2003 Confidential
Valve controlled by ball diverter
Results
Static pressure Mach number
134
AUTO UGM 2003 Confidential
ƒ Stable solution procedure requires setting a high static
pressure values at the outlets and then gradually reduces
the values in steps until the desired value is achieved
ƒ This manual adjustment of the static pressure values at the
outlet boundaries can be time consuming and an
automated procedure is desirable
ƒ Once a good experience of how fast to reduce and how
many to iterate at each step is obtained, the knowledge can
be used to write a UDF to automate the whole process
Valve controlled by ball diverter
Practical Issues
135
AUTO UGM 2003 Confidential
ƒ The UDF requires the following inputs:
– Number of iterations to be performed before each update (iterP)
– Change of pressure value at each update (deltaP)
– Impose limit on the minimum pressure to prevent oscillations
(Plimit)
ƒ The sample UDF given in the next slide works only in
serial and has not been parallelized yet.
Valve controlled by ball diverter
Practical Issues
136
AUTO UGM 2003 Confidential
#include "udf.h"
#define PI 3.14159265
#define Factor 1.0
#define zoneID 3
#define iterP 50
#define deltaP 5000.0
#define Plimit 1000.0
int iter=0;
float Pupdate=3446083.0;
DEFINE_ADJUST(Padjust,domain)
{
face_t f;
Thread *tf;
float sumA,sumP,phif,Amag,Pavg,
A[ND_ND];
Valve controlled by ball diverter
tf = Lookup_Thread(domain,zoneID);
sumA = 0.0;
sumP = 0.0;
begin_f_loop(f,tf)
{
phif = F_P(f,tf);
F_AREA(A,f,tf);
Amag = Factor*NV_MAG(A);
sumA += Amag;
sumP += phif*Amag;
}
end_f_loop(f,tf)
Pavg = sumP/sumA;
(1) (2)
137
AUTO UGM 2003 Confidential
Valve controlled by ball diverter
iter += 1;
Message("Current pressure is %e\n",Pavg);
if ( (iter%iterP)==0 )
{
Pupdate = Pavg - deltaP;
if ( Pupdate<Plimit ) Pupdate = Plimit;
Message("Update pressure to %f\n",Pupdate);
}
}
DEFINE_PROFILE(prsbc,tf,pos)
{
face_t f;
begin_f_loop(f,tf)
{F_PROFILE(f,tf,pos) = Pupdate;}
end_f_loop(f,tf)
}
(3)

Outline
• • Materials From Corporate UGM Training Seminar
– – – – – Samir Rida, Suti Wirogo (Aero Team) For Mesh and Case Set-up For Solving For Post-Processing For Customizing Fluent Miscellaneous Slides from General Tips and Tricks User Defined Function Tips The Text User Interface: FLUENT’s Hidden Jewels A Case Study: The Segregated Solver with High Pressure Differential.
2
AUTO UGM 2003 Confidential

General Tips and Tricks: From Pre to Post

Appendices
– – – –

General Tips and Tricks:
For Mesh and Case Set-up

3
AUTO UGM 2003 Confidential

To find all the options: AUTO UGM 2003 Confidential . such as: – – – Convert mesh to Fluent format (fe2ram) Convert mesh (tconv) Merge meshes (tmerge3d) shell> utility shell> utility fe2ram 4 Tfilter can be invoked manually.Miscellaneous on mesh modifications • • • How to repair left-handed faces in Fluent ? /grid/modify-zones/repair-face-handedness /grid/modify-zones/repair-periodic TUI TUI How to repair problematic periodic boundary in Fluent ? What is tfilter (now called utility)? A set of utilities used by Fluent/Gambit/Tgrid to perform mesh related modifications.

msh The z-coordinate is ignored in the 3d surface mesh How to merge two meshes ? utility tmerge3d -cl -p .msh The z-coordinate is assigned as zero in the 3d surface mesh How to convert 3D surface mesh into 2d mesh ? utility tconv –d3 3d-surface.geo fl. tfilter has been renamed to utility How to convert 2D mesh into 3D surface mesh ? utility tconv –d2 sample2d.cas 5 AUTO UGM 2003 Confidential .Miscellaneous on mesh modifications • • • • • In recent release.msh combine.msh sample2d.msh 3d-surface.msh How to convert CFX mesh to Fluent mesh format ? utility fe2ram -cl -tCFX -dN -cl -group cfx.msh ./mesh1./mesh2.

if fails. need to set the following Scheme command first: (rpsetvar 'nonconformal/allow-interface-at-periodic-boundary 0) To view non-overlapping portions of the interface surfaces.• • • • • Intersected mesh is created using the two interface meshes and then used to ‘replace’ the original interface meshes To improve accuracy and robustness: – – Maintain similar face element sizes at both interfaces Maintain good face mesh skewness at both interfaces Creation of non-conformal interface To create non-conformal interface which crosses periodic boundary. try to modify a default by using either of the following Scheme commands: – – (rpsetvar 'nonconformal/cell-faces 0) (rpsetvar 'nonconformal/cell-faces 2) 6 Confidential AUTO UGM 2003 . use the TUI Command: /display/zone-grid Creation of intersected mesh is delicate.

write a bc setup file: /file/write-bc TUI Load the second mesh and read the bc file /file/read-bc TUI Restrictions: • Only zones with the same names (not same ID) as used in the first case will be setup • Does not include mesh scaling (need to do scaling separately) • Surface information not copied Use journal file to create the surfaces to avoid recreation 7 AUTO UGM 2003 Confidential .How to copy setup and solution to a similar case ? • • Avoid lengthy manual re-setup and solution initialization To copy the case setup: – – – From the first case.

write an interpolation file: File – Interpolate… – Write Data GUI Read the interpolation file to the second case: File – Interpolate… – Read and Interpolate GUI Can selectively apply to individual fluid zone(s) Simple closest distance interpolation is used (no gradient or geometry based interpolation) Use small under-relaxation factors initially to avoid large jump in the solution 8 AUTO UGM 2003 Confidential • Tips: – – .How to copy setup and solution to a similar case ? • To reuse the previous solution: – – From the first case.

file /file/write-bc Edit the b. Delete all other lines – The next time the user would like to use this material file. #f) .c.c. then read the material file as if reading the b.. 9 Confidential AUTO UGM 2003 . file..How to store user defined materials for reuse ? • • If user uses certain materials often then can create a material file that can be reused and thus avoid redefinition each time A material file can be created from a bc file: – – – Start a fluent session and define the user material in the material panel Write the b.c. file: • • • Keep the first and last line Keep the material line (materials ((water-xxx fluid (chemical-formula .

7894e-05 273.6)) (thermal-accom-coefficient (constant . 1. 1006. 1.How to store user defined materials for reuse ? • An alternative is to add entries to the file propdb. 3. 0.711)) (lennard-jones-energy (constant .9137)) ) 10 AUTO UGM 2003 Confidential .56) (power-law 1.0242)) (viscosity (constant .666)) (molecular-weight (constant .7894e-05) (sutherland 1. 0.43)) (thermal-conductivity (constant .9137)) (velocity-accom-coefficient (constant .scm which is located in ~fluent6. #f) (density (constant . 78.scm (chemical-formula .x/cortex/lib (air fluid Example entry on propdb. 28.11 110.11 0.225)) (specific-heat (constant .966)) (lennard-jones-length (constant .7894e-05 273. 0.

Custom Field Functions • • Custom field functions are GUI based. it is not possible to create them through journal files If a set of existing custom field functions are to be used for different cases: – Write the existing functions as a scheme file using: • • Define – Custom Field Functions – Manage – Save file/write-field-functions Define – Custom Field Functions – Manage – Load file/read-field-functions GUI TUI GUI TUI – Read the scheme file to the new case using: • • 11 AUTO UGM 2003 Confidential .

General Tips and Tricks: For Solving 12 AUTO UGM 2003 Confidential .

Setting uneven parallel load • • (OTS Solution 487) It is possible to partition the mesh in an uneven distribution to accommodate differences in the CPU speeds and RAM Suppose the 3 machines (m0. m2) are to be used in a parallel job with 10%. and 70% load distribution respectively – – Load the case and data file into serial Fluent Using TUI. 20%. execute the command: /parallel/partition/set/load-distribution and enter the percentage load of each partition (must add to 100%) Partition the mesh for 3 partitions • Can use any partitioning scheme – 13 AUTO UGM 2003 Confidential . m1.

10% of cell count is 2256. 14 AUTO UGM 2003 Confidential . 70% of cell count is 15792.Setting uneven parallel load Total mesh cell count is 22560.

the mesh is first read into the host process and then distributed to the compute nodes If reading case into parallel solver takes unusually long time.Miscellaneous on parallel IO (1) • • In parallel. do the following: – – – Put the host and compute-node-0 on the same machine Put the case and data files on a disk on the machine running the host and compute-node-0 processes Try to execute the following Scheme commands before reading the case file • (%free-parallel-io-buffers) • (%limit-parallel-io-buffer-size 0) • (%allocate-parallel-io-buffers 10000000) • (%query-parallel-io-buffers) 15 AUTO UGM 2003 Confidential .

execute the following Scheme command: (rpsetvar 'parallel/fast-io? #t) • When loading a large mesh into parallel Fluent and the process hangs. execute the following Scheme command: (rpsetvar 'parallel/case-read-use-pack? #f) The above will disable buffer packing and will change the way entities are packed into messages during the build process.Miscellaneous on parallel IO (2) – – Merge as many zones as possible If the machine running the host process has enough memory. More but smaller messages will be created by disabling. 16 AUTO UGM 2003 Confidential .

Usage before iteration after completing iterations For serial solver.How to determine CPU time for serial solver ? (OTS Solution 334) • • For parallel run. can use the built in parallel timer via the GUI: – – Parallel – Timer – Reset Parallel – Timer. the difference represents the sum of the CPU times of all the compute nodes 17 AUTO UGM 2003 Confidential . can use the following TUI command that is executed before and after the iteration period of interest: (solver-cpu-time) – – The difference is the elapsed CPU time in seconds for the iteration period completed If used in the parallel session.

trn for windows • • Use –cnf=host_file to automatically load frequently used machines for parallel run To receive mail notification upon the completion of a batch job.trn 2>&1 & for Bourne/Korne-shell fluent 3d -g -i batch.trn & for C-shell fluent 3d -g < batch.txt where message.jou > out. add the following line at the end of the batch journal: !mail email-address < message.txt is a text file located inside the working directory and contains the message to be sent 18 AUTO UGM 2003 Confidential .Miscellaneous on batch processing (1) • Commands to run in batch mode: – – – fluent 3d -g < batch.jou -o out.jou >& out.

the answer is “No”. Please contact your support engineer if you need this functionality. add the following option to the start up command of the batch job: -driver null • Is it possible to read a journal file from another journal file ? Strictly speaking.Miscellaneous on batch processing (2) • • • To enter a comment inside a journal file: . Scheme can be used as a workaround. This line is commented To execute a shell command inside a journal file: ! Shell-command-to-be-executed To generate animation files during a batch processing. Nested journal files are not allowed in Fluent. 19 AUTO UGM 2003 Confidential .

00 –f filename – When the job finish.Miscellaneous on batch processing (3) • How to start a batch job at a user specified time ? – Create the batch journal file as usual i.trn 2>&1 & for Bourne/Korne-shell – Make this file executable unix> chmod a+x filename – Suppose that the batch job is to be executed at 2003 June 03 09:25:00 then. For example: fluent 3d -g < batch. an email will be sent to you – The at command is also available on windows 20 AUTO UGM 2003 Confidential .jou – Open and create a file containing a single line which specify the unix shell command to execute the batch job. batch.jou > out. enter the following command in the unix prompt: unix> at -m -t 200306030925.e.

./dir1 fluent 3d -psmpi -t2 -g < batch1.jou cd .jou call cd .Miscellaneous on batch processing (4) • How to execute several batch processes sequentially ? – In Unix/Linux environments.. if a shell command is not ended by an ampersand (&) then the OS will wait until the completion of the execution of that line before going to the next line. Then see the following shell scripts: Unix/Linux Windows cd .jou 21 AUTO UGM 2003 Confidential . – Suppose there are two directories corresponding to two cases where each has its own corresponding journal file./dir2 fluent 3d -psmpi -t2 -g < batch2.\dir2 call fluent 3d -wait -g -i batch2.\dir1 call fluent 3d -wait -g -i batch1. This is not the case with Windows.jou call cd .

fluent file 22 AUTO UGM 2003 Confidential .Miscellaneous on batch processing (5) • Useful options for batch processing have been implemented in Fluent 6.1 – – – – – Confirm file overwrite is a must for batch processing Option to turn off question dialog boxes Exit when an error occurs during journal execution Through GUI File Batch Options or TUI: /file/set-batch-options Equivalent Scheme command to turn on exit on error is: (set! *cx-exit-on-error* #t) Can be appended inside the journal file or .

Check pointing (1) • • • (OTS Solution 291) It is possible to tell the Fluent process to stop the iteration and write the case/data files without interacting with the GUI This procedure is useful to stop a batch process or when the GUI process has crashed. and then delete the exit-fluent or checkfluent file 23 AUTO UGM 2003 Confidential . the owner of the process can create a kill file inside the /tmp directory: unix> cd /tmp unix> touch exit-fluent or exit Fluent after writing files continue iteration after writing files unix> touch check-fluent If either exit-fluent or check-fluent found in /tmp. write the files. Fluent will finish the current iteration. and can be used as long as Fluent is still in the iteration loop In Unix/Linux environment.

execute the following Scheme command before iterating: (rpsetvar 'checkpoint/write-case? #f) • By default. the case file will be written Make sure that sufficient disk space is available – – Check-pointing code calls the same file I/O routines used by the GUI or TUI and will produce the same error messages if disk space is insufficient In such case. Fluent will not return to the iteration loop 24 AUTO UGM 2003 Confidential .Check pointing (2) • • The files will be written to the same directory where the original input files were read and will have the same names but with appended current iteration number To write the data file only.

txt c:\temp\exit-fluent.Check pointing (3) • • The touch command will produce file of zero length and is also available in Windows For Windows. the check point files need to be created at: c:\temp\check-fluent.txt 25 AUTO UGM 2003 Confidential .

as shown below: (set! checkpoint/exit-filename "/tmp/exit-flu-job-1") file/read-case-data sample.Check pointing (4) • • If the machine has several Fluent sessions running.cas solve/iterate 1000 file/write-case-data junk2 • To stop this particular job. use the following command inside the /tmp directory: unix> touch exit-flu-job-1 26 AUTO UGM 2003 Confidential . named check pointing can be used to selectively stop a specific Fluent process A specific check point name can be added to the first line of the batch journal file.

which involves approximations.Alternative Wall Formulation (1) /solve/set/expert/use alternate formulation for wall temperature? [no] – FLUENT models the flux at the wall as follows: r q = k∇T ⋅ n (Tw − Tc ) q=k + f (∆T ) ∆h – The term f(∆T) includes second order terms that need to be determined. 27 AUTO UGM 2003 Confidential .

28 AUTO UGM 2003 Confidential .Alternative Wall Formulation (2) /solve/set/expert/use alternate formulation for wall temperature? [yes] – Assume face center is defined such as the vector between cell center and face center is perpendicular to the wall. r q = k∇T ⋅ n q=k (Tw − Tc ) ∆h – – The term f(∆T) vanishes and ∆h changes. This option doesn’t impact the results if the wall cells are not skewed.

Temperature definitions for thin wall model • • Thin wall model applies normal conduction only (no in-plane conduction) and no actual cells are created Wall thermal boundary condition is applied at the outer layer static-temperature (cell value) thin wall (no cell) Wall thermal condition 29 AUTO UGM 2003 Confidential wall-temperature (outer-surface) wall-temperature (inner-surface) .

Temperature definitions for shell conduction zone • • • • A thin wall conduction with both normal and in-plane conductions Actual conduction cells are created but can not be displayed and can only be limitedly accessed by UDFs Solid properties of the conduction zones must be constant and can not be specified as temperature dependent Case must be partitioned in the serial mode before loading into parallel (conduction zones need to be encapsulated) static-temperature (cell value) conduction cells wall-temperature (outer-surface) wall-temperature (inner-surface) 30 AUTO UGM 2003 Confidential .

/set/flow-warnings? – 31 AUTO UGM 2003 Confidential . and when mass flow inlets develop supersonic regions. flow warnings are printed. Specify whether or not to print warning messages when reversed flow occurs at inlets and outlets. Text Commands /monitors/force/clear-all-monitors – Fast way to discard the internal and external file data associated with the force monitors. By default.Misc.

General Tips and Tricks: For Post-Processing 32 AUTO UGM 2003 Confidential .

pref must be set to the negative of the operating pressure so that the equation becomes: Fp = Sum ( pg + pop )*Area = Sum ( pabs*Area ) 33 AUTO UGM 2003 Confidential • • . it does not matter what the value of pref is since the total pressure force due to pref is zero For open surface.Pressure force calculation • Force due to pressure is computed using the following equation in Fluent: Fp = Sum ( pg – pref )*Area where pg is the gauge pressure and pref is the reference pressure specified in the reference value panel For closed surface (closed body).

Turbulent intensity • The definition used by Fluent when computing the turbulence intensity is: TI = sqrt( (2/3)*k )/Vref • where Vref is specified inside the reference value panel It is more instructive to use the local velocity magnitude for turbulence intensity calculation TI = sqrt( (2/3)*K )/Vmag-local • Can use a custom field function to define modified turbulent intensity 34 AUTO UGM 2003 Confidential .

respectively Specify the name and click on “Clip” 35 AUTO UGM 2003 Confidential .1 for “Min” and “Max”. Clip the iso-surface using to the desired ID: – – – – Surface → Iso-Clip… Under “Clip To Values Of” select “Cell Info” and “Cell Zone Index” Under “Clip Surface” select the surface created in first step Enter 6.• • • How to create an iso-surface that passes through a selected zone? Create a surface that passed through the entire domain Surface → Iso-Surface… From the boundary condition panel. Lets say the Cell Zone ID is 7.9 and 7. determine the Cell Zone ID (same as the Cell Zone Index) where the iso-surface is to be retained.

fluid-in fluid-core Example fluid-out iso-clip passing through fluid-core only 36 AUTO UGM 2003 Confidential .

the axis.Altering the Display Window /display/set/windows/… [example] – Add borders to the scale. – Eliminate the application title – etc 37 AUTO UGM 2003 Confidential . the image.

How to specify floating format for contour scale ? • The floating format for the contour scale is sometimes preferred since it is easier to read Use the following TUI command: – – /display/set/windows/scale/format "%f" This will give the default 6 significant digits after the decimal point To get 3 significant digits after the decimal point. use: "%0.3f" • 38 AUTO UGM 2003 Confidential .

General Tips and Tricks: For Customizing Fluent 39 AUTO UGM 2003 Confidential .

) as well as other windows for iteration panel. display panel.cxlayout located at the same location as the .2.How to save graphics/GUI layout ? • • To save custom window layout...1. etc that have been opened will be saved in .. can use the GUI command: File – Save Layout Sizes and locations of currently defined windows (0.fluent file 40 AUTO UGM 2003 Confidential .

e. functional. and interpreted based language used by Fluent interface How to load a Scheme file ? – – – GUI TUI TUI The opening and closing double quotes are part of the command.0 print a welcome message at the fluent console 41 AUTO UGM 2003 Confidential .0) (display “ Welcome to scheme…”) reset the flow time to 0.g.Scheme • • What is Scheme ? A high level. – – (rpsetvar 'flow-time 0.scm”) • A Scheme command is executed using TUI only. Scheme file is not part of the case file and must be reloaded every time Fluent is restarted File – Read – Scheme… file/read-macros (load “filename.

The .fluent file
• When FLUENT opens, it auto executes the .fluent file in:
– home directory of unix users – c:\ directory of NT machines

• A .fluent file can contain any number of scheme file names to load
– Note: unless full path is specified for each scheme file in .fluent file, FLUENT tries to locate the scheme files from the working directory

42
AUTO UGM 2003 Confidential

The .fluent file
• The Scheme commands can also be appended inside the .fluent file itself
;; ------------------------------------------------------------------------------------------;; ;; Code to create USC panel (let ((menu (cx-add-menu "USC" #\U))) (cx-add-item menu "User Services Center" #\O #f and (lambda () (system "netscape http://www.fluentusers.com/ &")))) ;; Various useful stuff (set! *cx-exit-on-error* #f) ;; ------------------------------------------------------------------------------------------;;

USC panel created by

43
AUTO UGM 2003 Confidential

How to modify Fluent defined variables ?
• • Fluent defines a set of variables that control the model and interface setup Examples of these variables are:
– – – – – – – flow-warnings? mg/grid-levels smooth-mesh/niter pressure/relax flow-time physical-time-step matching-tolerance boolean integer real

List of the available variables is not made public but user can contact support engineer for a specific variable
44

AUTO UGM 2003

Confidential

5) • Note that there is no need to specify variable type in scheme To query or change via UDF: – – – RP_Set_Boolean("dpm/track-in-absolute-frame?". RP_Set_Integer("time-step". Use RP_Get_type to query values 45 AUTO UGM 2003 Confidential .3).0. RP_Set_Real("flow-time".7).TRUE).How to modify Fluent defined variables ? • • These variables can be queried or changed via Scheme or UDF To query or change via Scheme: – – – (rpgetvar 'flow-warnings?) (rpgetvar 'flow-time) (rpsetvar 'pressure/relax 0.

for example: – – – – Printing but not plotting residuals Under relaxation default values Standard KE turbulence model and many more … • • User can customize some of these defaults to avoid repetitive manual change every time fluent is started The scheme file given in the next slide shows an example which can be modified and then appended to the .How to customize the Fluent startup setup ? • Fluent imposes standard defaults on solver/model setup during startup of a new case.fluent file 46 AUTO UGM 2003 Confidential .

001) (x-velocity #t 0 #f 0. Do your customization here (rpsetvar 'residuals/plot? #t) (rpsetvar 'residuals/settings '((continuity #t 0 #f 0.001) (epsilon #t 0 #f 0.001) (energy #t 0 #f 1e-06) (k #t 0 #f 0.001) (z-velocity #t 0 #f 0.4) (rpsetvar 'pressure/relax 0..How to customize the Fluent startup setup ? Append to the .fluent file (let ((old-rc client-read-case)) (set! client-read-case (lambda args (apply old-rc args) Turning off convergence check (if (cx-gui?) (begin .. You can add more settings here Use arrow instead of harpoon ))))) for vector head 47 AUTO UGM 2003 Confidential .001))) (rpsetvar 'mom/relax 0.001) (y-velocity #t 0 #f 0.5) Use ke-realizable as default (rpsetvar 'ke-realizability-on? #t) (rpsetvar 'realizable-epsilon? #t) (cxsetvar 'vector/style "arrow") .

scm (given in next slide) provides user with the functionality to patch a variable on a given list of zones when running in batch mode The procedure consists of: – – Load the Scheme file using TUI command: (load “tui-patch.How to use TUI to patch a variable ? • • (OTS Solution 366 & 681) The Scheme file tui-patch.scm”) Execute the TUI command: (patch (arg-patch variable-name desired-value list-of-zone-names)) Example: (patch (arg-patch ‘x-velocity 20.3 '(fluid-1 fluid-2 fluid-3))) (patch (arg-patch ‘temperature 545.8 '(fluid-1 fluid-2 solid-4))) Note the key string x-velocity and temperature used by Fluent to identify field name and all values are in SI 48 AUTO UGM 2003 Confidential .

How to use TUI to patch a variable ? tui-patch.scm (define thr-list (lambda (name-list) (map thread-name->id name-list))) (define cb-p (let ((pa-var-list)) (set! pa-var-list (%inquire-patch-variable-names)) (lambda (varn) (assq varn pa-var-list)))) (define n-index (lambda (varn index) (list-ref (cb-p varn) index))) (define arg-patch (let ((reg-list)) (set! reg-list '()) (lambda (varn xt name-list) (list (n-index varn 2) (n-index varn 3) (thr-list name-list) reg-list xt)))) 49 AUTO UGM 2003 Confidential .

scm (given in next slide) will list all the interior zones that are immersed within the user specified fluid zone The procedure consists of: – – Load the Scheme file using TUI command: (load “find-zone.Which interior zone(s) belong to a fluid zone ? (OTS Solution 470) • • Can be done by visual inspection or changing the interior zone to wall and check the adjacent fluid zone(s) The Scheme function find-zone.scm”) • Execute the TUI command: (imme-info 'fluid-1) 50 AUTO UGM 2003 Confidential .

scm (define (imme-info fluid-zone-name) (let ((id-fz (thread-name->id fluid-zone-name)) (int-list (map thread-id (get-threads-of-type 'interior)))) (for-each (lambda (id) (let ((zz (inquire-adjacent-threads id))(id1)(id2)) (set! id1 (car zz)) (set! id2 (cadr zz)) (if (eqv? id1 id2) (if (eqv? id1 id-fz) (format "\n Interior zone \"~a\" is immersed in fluid zone \"~a\" \n" (thread-id->name id) fluid-zone-name) )))) int-list)) (format "-------------------------------------------------------------------")) 51 AUTO UGM 2003 Confidential .Which interior zone(s) belong to a fluid zone ? find-zone.

000) 0.455) 0.917 (1.584) 0.083 (0.898 0.016 0.973 0.583 (0.000 – – G 0.976) 52 AUTO UGM 2003 Confidential .000) 0.847 0.833 (0.750 (0.333 (0.000 0.114 0.250 (0.404 0.000 0.824 0.945 1.616) 0.996 0.000 0.055 0.012) 0.047) 0.592) 0.167 (0.545 0.0 (0.996 1.467) 0.000 ) 0.scm”) To read a new color map: /file/read-colormap To write an existing color map: /file/write-colormap Scale (0-1) Example: thermacam colormap R ("thermacam" (0.306 0.267 0.000 B 0.How to define customized color map ? • • It is possible to read a custom color map or write an existing one The procedure consists of: – Load the Scheme file: (load “rw-colormap.000 0.455) 0.545 0.000 0.725 0.500 (0.417 (0.702 0.098) 0.000) 0.945 0.000 1.667 (0.

How to define customized color map ? Example: Static pressure variation for a simple duct default Fluent color map 53 AUTO UGM 2003 Confidential therma-cam color map .

")) (ti-menu-insert-item! file-menu (make-menu-item "write-colormap" #t ti-write-cmap "Write a colormap to a file.scm"))) (if (ok-to-overwrite? fn) (write-cmap fn)))) (define (ti-read-cmap) (read-cmap (read-filename "colormap filename" "cmap." fn)))) (define (ti-write-cmap) (let ((fn (read-filename "colormap filename" "cmap.How to define customized color map ? rw_colormap.scm (define (write-cmap fn) (let ((port (open-output-file (cx-expand-filename fn))) (cmap (cxgetvar 'def-cmap))) (write (cons cmap (cx-get-cmap cmap)) port) (newline port) (close-output-port port))) (define (read-cmap fn) (if (file-exists? fn) (let ((cmap (read (open-input-file (cx-expand-filename fn))))) (cx-add-cmap (car cmap) (cons (length (cdr cmap)) (cdr cmap))) (cxsetvar 'def-cmap (car cmap))) (cx-error-dialog (format #f "Macro file ~s not found.scm"))) (ti-menu-insert-item! file-menu (make-menu-item "read-colormap" #t ti-read-cmap "Read a colormap from a file.")) (1) 54 AUTO UGM 2003 Confidential (2) .

how do you find its zone name? – Can be useful to know which zone is being mentioned in an error message. In the TUI: (thread-id name ID_NUMBER) 55 AUTO UGM 2003 Confidential .One Miscellaneous Scheme Tip • Given a Zone ID.

• Appendices • Check out the User Services Center (USC) for solutions in the Online Technical Support (OTS) Area.Summary • General Tips and Tricks: From Pre to Post – – – – – – – – For Mesh and Case Set-up For Solving For Post-Processing For Customizing Fluent Miscellaneous Slides from General Tips and Tricks User Defined Function Tips The Text User Interface: FLUENT’s Hidden Jewels A Case Study: The Segregated Solver with High Pressure Differential. 56 AUTO UGM 2003 Confidential .

57 AUTO UGM 2003 Confidential .Appendices • Miscellaneous Slides from General Tips and Tricks • User Defined Function Tips • The Text User Interface: FLUENT’s Hidden Jewels • A Case Study: The Segregated Solver with High Pressure Differential.

Part I : Miscellaneous Slides from General Tips and Tricks 58 AUTO UGM 2003 Confidential .

start Fluent using the “-h10000000” option – – This will allocate 10000000 storage The default is 500000 • For the DPM case.How to address the heap memory limitation? • In certain instances on Unix and Linux platforms. the heap memory limit can be reached when: – – Creating a large number of surfaces Defining a large number of DPM injections • To increase the heap memory allocation. deleting all individual injections and replacing them by several injections of type “file” will alleviate the problem 59 Confidential AUTO UGM 2003 .

How to modify the Schmidt number? • In V5. Sct could not be changed at all • In V6.7) – Either may be updated in the Define/Models/Viscous GUI panel 60 AUTO UGM 2003 Confidential . updated Sct definition provides greater user flexibility – “PDF Schmidt number” • Used in mixture fraction based calculations (default is 0.0. Sct is “hardwired” to the Prt – Sct could not be changed independently of Prt – For adiabatic PDF simulations.85) – “Turbulent Schmidt number” • Used in species transport calculations (default is 0.

When reading a Fluent 5 case with 2-layer-zonal model. Fluent 6 will chose the enhanced wall treatment option 61 AUTO UGM 2003 Confidential .How to read V5 case with two-layer-zonal model in V6? • • The two-layer-zonal model is no longer available in Fluent 6.

How to define custom turbulent thermal conductivity? • The UDF DEFINE_PROPERTY allows the user to modify only the laminar thermal conductivity. C_K_T will become infinitely small.t) / M_keprt) #define C_K_EFF(c. The customized the turbulent heat conductivity can be entrered through DEFINE_PROPERTY UDF for C_K_L Note: Setting the turbulent Prandtl number to a very high value will eliminate the turbulence production due to buoyancy effects 62 AUTO UGM 2003 Confidential • . FLUENT computes a turbulent thermal conductivity based on turbulent viscosity and add it to the (UDF-defined) laminar conductivity #define C_K_T(c.t) (C_K_L(c.t) (C_MU_T(c. For turbulent flows.t) * C_CP(c.t) + C_K_T(c.t)) If the turbulent Prandtl number “M_keprt” is set to a high value in the define/models/viscous panel.

load.How to compute the gradient of a scalar ? • • Many field variables in Fluent have their gradients stored internally which can then be accessed via UDF for postprocessing or other purposes For variables where the gradients are not stored. can use the following procedure: – – – – Load case/data file. define one UDS (UDS-0) and one UDM (UDM-0) Modify. and compile the UDF given in the next slide Execute the assign_scalar on-demand UDF This will assign the variable (whose gradient is to be calculated) to the UDS-0 Using TUI. execute 0 iteration /solve/iterate 0 This will compute all the coefficients and gradients but won’t solve the Execute the store_gradient on-demand UDF This will assign the computed gradient to UDM-0 63 AUTO UGM 2003 Confidential – – .

face_t f.tc.0) = NV_MAG(C_UDSI_C(c.tc).tc) C_UDMI(c.tc) C_UDSI(c.h” #define zone_ID 2 DEFINE_ON_DEMAN(assign_scalar) { Thread *tc.How to compute the gradient of a scalar ? #include “udf. end_c_loop(c. /* Fill UDM with magnitude of gradient */ thread_loop_c(tc.0) = C_P(c.tc) } } this (1) 64 (2) . end_c_loop(c.tc) } } AUTO UGM 2003 Confidential DEFINE_ON_DEMAND(store_gradient) { Thread *tc.tc. domain = Get_Domain(zone_ID). Domain *domain. cell_t c. Domain *domain.tc)). domain = Get_Domain(zone_ID). cell_t c. /* Fill UDF with the scalar */ thread_loop_c(tc.domain) { begin_c_loop(c.domain) modify { begin_c_loop(c.

Part II : User Defined Function Tips 65 AUTO UGM 2003 Confidential .

there are instances where it is desirable for the Adjust UDF to be called only at the beginning of the first iteration of every time-step Can use the macro first-iteration. example: DEFINE_ADJUST(myadjust.Miscellaneous on UDF (1) • • Define Adjust UDF is called at the beginning of every iteration even for unsteady solver For unsteady runs.domain) { if (first_iteration) { /* Do procedures to be executed only at the first iteration of every timestep */ } } 66 AUTO UGM 2003 Confidential • .

Miscellaneous on UDF (2) • • To get the current iteration number. To check if a face zone is of type wall. use: int current_iteration_number = (nres==0)?(1):((int)count2[nres-1]). can use: – – – – – THREAD_F_INTERIOR THREAD_F_SYMMETRIC THREAD_F_PERIODIC THREAD_F_MFINLET THREAD_F_PINLET 67 AUTO UGM 2003 Confidential – – – – THREAD_F_POUTLET THREAD_F_PFAR THREAD_F_VINLET THREAD_F_OUTFLOW . use: if (THREAD_TYPE(tf) = = THREAD_F_WALL) Similarly for other face zone types.

use: #if RP_2D if (rp_axi) { … codes for axisymmetric …} else { … codes for 2D planar … } #endif 68 AUTO UGM 2003 Confidential .Miscellaneous on UDF (3) • To toggle between 2d and 3d. use the following compiler directives: #if RP_2D { … codes for 2D …} #else { … codes for 3D … } #endif • To toggle between 2d and 2d-axisymmetric.

use: if (rp_visc) { … codes for viscous …} else { … codes for inviscid …} • To exclude boundary face when looping through the faces: if (!BOUNDARY_FACE_THREAD_P(t)) 69 AUTO UGM 2003 Confidential . use: if (rp_seg) { … codes for segregated solver …} else { … codes for segregated solver …} • To toggle between inviscid and viscous.Miscellaneous on UDF (4) • To toggle between segregated and coupled solvers.

nw).91456e-08 k equation: 0.nw))>0) { scaled_res = DOMAIN_RES(domain. for (nw=0.h"DEFINE_ADJUST(my_adjust.01114e-08 z-velocity equation: 0.01033e-08 y-velocity equation: 1."%s equation: %g\n".DOMAIN_EQN_LABEL(domain."\n"). ++nw) { if (strlen(DOMAIN_EQN_LABEL(domain.count2[nres-1]). fprintf(fp.nw)[nres-1]. fprintf(fp.nw)[nres-1]/ DOMAIN_RES_SCALE(domain. "current iter = %d\n". real scaled_res. FILE *fp. } } fclose(fp). nw<MAX_EQNS. fprintf(fp.domain) { int nw.Miscellaneous on UDF (5) • How to access solution residuals using UDF ? current iter = 1 continuity equation: 1 x-velocity equation: 1."a").scaled_res).77859 epsilon equation: 0. } AUTO UGM 2003 Confidential 70 .7963 #include "udf. fp = fopen("output_test".000495387 energy equation: 5.

TAG_FLAG). end_f_loop(f.n).TAG_FLAG).TAG_FLAG)) { CLEAR_V_FLAGS (v.n) { if (NODE_FLAG (v = F_NODE(f.tf) 71 AUTO UGM 2003 Confidential Each node of the corresponding face zone will be visited only once .tf) f_node_loop(f.n).tf.n) SET_V_FLAGS(F_NODE(f tf. /* Your code */ } } } end_f_loop(f.tf.tf) begin_f_loop(f.tf) { f_node_loop(f.tf.Miscellaneous on UDF (6) • How to loop through all nodes of a given face zone only once ? begin_f_loop(f.

Miscellaneous on UDF (7) • Certain fields inside the Fluent model panel do not have builtin UDF hookups. thus it is difficult to specify user specified time/iteration varying values Examples are the wall and fluid speeds Is there any workaround ? • • No UDF hookup 72 AUTO UGM 2003 Confidential .

fluid.wall.wall.wall.fluid.translate_mag THREAD_VAR(tf).fluid.axis[0] THREAD_VAR(tf).wall.fluid.translate_dir[1] THREAD_VAR(tf).origin[2] THREAD_VAR(tc).velocity[1] THREAD_VAR(t1).velocity[0] THREAD_VAR(t1).fluid.translate_dir[0] THREAD_VAR(tf).wall.fluid.wall.wall.omega 73 .wall.axis[2] THREAD_VAR(tf).wall.u THREAD_VAR(tf).origin[1] THREAD_VAR(tc).wall.wall.fluid.wall.axis[1] THREAD_VAR(tf).origin[1] THREAD_VAR(tf).axis[1] THREAD_VAR(tc).fluid.velocity[2] THREAD_VAR(tc).wall.Miscellaneous on UDF (8) • Can write a DEFINE_ADJUST UDF and directly access the macro of the variable of interest (contact support engineer for variable names) THREAD_VAR(tf).omega THREAD_VAR(tf).origin[0] THREAD_VAR(tc).w AUTO UGM 2003 Confidential THREAD_VAR(tc).v THREAD_VAR(tf).axis[2] THREAD_VAR(t1).fluid.axis[0] THREAD_VAR(tc).origin[2] THREAD_VAR(tf).translate_dir[2] THREAD_VAR(tf).fluid.wall.origin[0] THREAD_VAR(tf).

iter.domain) { int zoneID."At iter=%d .fluid. Thread *tc. fprintf(fp.Miscellaneous on UDF (9) • Example UDF to ramp up the fluid rotational speed for MRF to obtain improved convergence fp = fopen("output_check". } } 74 AUTO UGM 2003 Confidential #include "udf. fclose(fp). int iter = (nres==0)?(1):((int)count2[nres-1]). float omega. zoneID = 3."a"). if ( (iter%Niter)==0 ) { omega = omg_mn + (iter/Niter)*10.h" #define Niter 25 #define omg_mn 1 #define omg_mx 100 DEFINE_ADJUST(myadjust. THREAD_VAR(tc).update omega to %f\n".omega). if ( omega > omg_mx ) omega = omg_mx. (1) (2) . tc = Lookup_Thread(domain.zoneID). FILE *fp.omega = omega.

Part III : Fluent Text User Interface FLUENT’s Hidden Jewels 75 AUTO UGM 2003 Confidential .

The user can easily manipulate its operation with standard text-based tools: input can be saved in files. modified with text editors. Text menu system is tightly integrated with the scheme extension language. it can easily be programmed to provide sophisticated control and customized functionality. 76 AUTO UGM 2003 Confidential . and read back in to be executed.Text User Interface The text menu system provides a hierarchical interface to the program’s underlying procedural interface.

Text User Interface The general menu consists of adapt/ grid/ surface/ display/ plot/ view/ define/ report/ exit file/ solve/ Certain commands are available only through the TUI. They will be outlined and described hereinafter. 77 AUTO UGM 2003 Confidential .

It doesn’t affect nor accelerate the coupling of the particle source terms to the fluid equations.define/models/dpm clear-particles-from-domain – Remove all particles currently in the domain. – This option gives a more accurate temperature and mass content for the particles when having a strong coupling between both equations. coupled-heat-mass-update – By default. FLUENT will solve this pair of equations using a stiff. however. comes at the expense of increased computational expense. The increased accuracy. 78 AUTO UGM 2003 Confidential . coupled ODE solver with error tolerance control. the solution of the particle heat and mass equations are solved in a segregated manner. If you enable this option.

define/models/dpm
implicit-momentum-coupling
– Use an implicit treatment for the DPM momentum source terms (else explicit). – In certain circumstances, the implicit source term linearization model doesn’t seem to respond very quickly to major changes in the flow field (turning an air inlet off or adding / removing porous media). In these cases, FLUENT behaves better when the explicit source term formulation is used – Example: The geometry is a 2x2x12 meter chamber. Air and particles are introduced through inlets on one end of the chamber. An additional air inlet is located on the top of the chamber at a distance of approximately 8m.
79
AUTO UGM 2003 Confidential

define/models/dpm
implicit-momentum-coupling

80
AUTO UGM 2003 Confidential

define/models/dpm
implicit-momentum-coupling

– The predicted gas velocity magnitude on the chamber mid-plane is shown. The main jet is introduced on the right side and persists approximately halfway down the chamber. A second smaller jet can be seen entering from the top approximately 2/3 of the way down the chamber.
81
AUTO UGM 2003 Confidential

define/models/dpm
implicit-momentum-coupling

– Top inlet was turned off. With explicit formulation, after 50 iteration there is little evidence that an air jet was injected from chamber roof. With implicit formulation it takes more time.
82
AUTO UGM 2003 Confidential

define/models/dpm
velocity-gradient-correction
– During the particle tracking step the velocity of the surrounding medium changes. In FLUENT 6 this has been taken into account for the particle trajectory equation. – FLUENT predicts the trajectory of a discrete phase particle (or droplet or bubble) by integrating the force balance on the particle, which is written in a Lagrangian reference frame. – With the trajectory itself predicted by:

du p dt

= FD (u − u p ) + g i (ρ p − ρ ) / ρ p + Fi

dx = up dt
83
AUTO UGM 2003 Confidential

AUTO UGM 2003 Confidential ..define/models/dpm velocity-gradient-correction – The trajectory equation is rewritten in simplified form as: du p / dt = (u − u p ) / τ p τ is the particle relaxation time. FLUENT 6 uses a trapezoidal scheme to integrate this equation u n +1 − u n p p ∆t 1 n u = u + u n +1 2 * = (u τ 1 * − u n +1 + .. p ) ( ) 84 u n +1 = u n + ∆t u n ⋅ ∇u n p – The trapezoidal scheme approach is the default with velocity-gradientcorrection switched on. – As opposed to Fluent 5.

coupled discrete-phase calculations are not meaningful. tracking particles based on absolute velocity may result in incorrect particle-wall interaction. To make this change. by default. be meaningful. the display of particle tracks will not. this command should be used. 85 AUTO UGM 2003 Confidential . – An alternative approach for particle tracking and coupled discrete-phase calculations with multiple reference frames is to track particles based on absolute velocity instead of relative velocity.define/models/dpm Track-in-absolute-frame – When multiple reference frames are used in conjunction with the discrete phase model. However. Similarly.

the injection velocities will be specified relative to the absolute frame. the injection velocities are specified relative to the local reference frame.define/models/dpm Track-in-absolute-frame – The particle injection velocities (specified in the Injection panel) are defined relative to the frame of reference in which the particles are tracked. 86 AUTO UGM 2003 Confidential . If this option is enabled. By default.

Thus the diffusion component (and therefore the net inlet transport) is not specified a priori. The convection component is fixed by the inlet temperature specified by the user. – In some cases. The diffusion component. By default. however.define/models/energy? include diffusion at inlets? – The net transport of energy at inlets consists of both the convection and diffusion components. To turn off inlet diffusion. depends on the gradient of the computed temperature field. 87 AUTO UGM 2003 Confidential . answer [no] to include diffusion at inlets? – Available only for the segregated solver. FLUENT includes the diffusion flux of energy at inlets. the user may wish to specify the net inlet transport of energy rather than the inlet temperature.

88 AUTO UGM 2003 Confidential .define/models/species inlet-diffusion? – Similar to the energy equation. The diffusion component. – Available only with the segregated solver. however. The convection component is fixed by the inlet species concentration specified by the user. By default. – If the user wants to include only the convective transport of species through the inlets of the domain. This can be done by disabling inlet species diffusion. the net transport of species at inlets consists of both the convection and diffusion components. FLUENT includes the diffusion flux of species at inlets. depends on the gradient of the computed species concentration field.

χ≡ v1 3 ν χ 3 + c v1 ~ Dν ~ ν ~ S ≡ S + 2 2 fv2 . Damping functions have been built into the model in order to properly reduce the turbulent viscosity in the viscous sublayer.  g + c w3    ~ Wall boundary condition : ν = 0 ( ) ~ ν r≡ ~ 2 2 Sκ d 89 distance from wall AUTO UGM 2003 Confidential . κ d 1/ 6 f v2 = 1 − χ 1 + χf v1 damping functions  1+ 6  3 f w = g  6 c w6  . g = r + cw 2 r 6 − r .define/models/viscous/ sa-damping? [yes] – The full Spalart-Allmaras model is a low-Reynolds-number model. f = χ µ t ≡ ρν v1 .  ∂  ~ ~ 2 ~ 2  ∂ν   ~~ 1   ν  ~ ) ∂ν  + c ρ    − cw1 ρ f w   ρ = ρ cb1S ν + (µ + ρν  b2   σ ν~  ∂x j  ∂x j  Dt d  ∂x j       3 ~ ν ~f .

f v2 = 0. A high-Reynolds-number form of the model has been included. f v1 = 1. and the wall shear-stress is obtained from the law-of-thewall: u 1  ρ yuτ   = ln  E  µ  uτ κ   90 AUTO UGM 2003 Confidential . f w = unchanged – Wall Boundary condition : ~ ν = u κd τ – It is assumed that the mesh is too coarse to resolve the laminar sublayer.define/models/viscous/ sa-damping? [no] – There are some situations in which the damping functions will adversely affect the accuracy of the model when it is used with coarse meshes.

define/models/viscous/ turbulence-expert/ – Menu for expert options related to turbulence. including the viscous sublayer. Modifications involve adding damping functions to the source terms in the transport equation for ε and to the expression for turbulent viscosity. turbulence-expert/low-re-ke? – Extend the k-ε model to low Reynolds numbers and allow it to be applied very close to the wall. 91 AUTO UGM 2003 Confidential . – While the damping functions allow the equations to be used through the turbulent boundary layer. they are typically of an ad hoc nature and therefore cannot be relied upon to give consistently good results in all types of flows.

f1 . f 2 Dε ∂ ρ = Dt ∂x j  µt  µ +  σε    ∂ε    ∂x  +  j  k2 ε (f C k 1 µ t S 2 − ρ f 2 C 2ε ε ) 1ε turbulent viscosity µ t = ρ f µ Cµ ε – Damping functions are written in terms of Reynolds numbers: ρk 2 ρ ky ρ (µε / ρ )1 / 4 y Re t = . Re y = .define/models/viscous/ turbulence-expert/low-re-ke? [yes] – Standard k-ε model modified by damping functions: ε−transport equation f µ . Reε = µε µ µ 92 AUTO UGM 2003 Confidential .

f µ = tanh(0.define/models/viscous/ turbulence-expert/low-re-ke-index – Select which low-Reynolds-number k-ε model is to be used among the six models available.5 / Ret ) 2 [ ] low-re-ke-index : 1 Lam-Bremhorst f1 = 1 + (0.0165 Re y ) (1 + 20.008 Re y ) 1 + 4 Ret ( −3 / 4 ) low-re-ke-index : 0 Abid f1 = 1  2  Ret 2    Re   1 − exp y  f 2 = 1 − exp −  12   36   9        f µ = 1 − exp(−0.05 / f µ ) 3 f 2 = 1 − exp(− Ret2 ) 93 AUTO UGM 2003 Confidential .

3 exp(− Ret2 ) low-re-ke-index : 3 Yang-Shih Gk f µ = 1 − exp(−1.95 + 0.4 f µ = exp  2  (1 + Re t / 50)  f1 = 1 f 2 = 1 − 0.define/models/viscous/ turbulence-expert/low-re-ke-index low-re-ke-index : 2 Launder-Sharma   − 3.05 f 2 = 1 1 + Re t− 2 AUTO UGM 2003 Confidential ( ) ( ) ρε 94 .5 × 10 −4 Re y − 5 × 10 −7 Re 3 − 10 −10 Re 5 1 + Re t−2 y y f1 = 0.

0215 Re y ) 1 + 31.3 exp(− Re t2 / 42.0631 exp(−0.25) 2 ( ) [ ] [ ] low-re-ke-index : 5 Chang-Hsieh-Chen f µ = 1 − exp(−0.66 Re t−1.75 exp − 2.5 × 10 −5 Re t2 f1 = 1 f 2 = [1 − exp(− Re e / 3.1)] 1 − 0.define/models/viscous/ turbulence-expert/low-re-ke-index low-re-ke-index : 4 Abe-Kondoh-Nagano 2 f µ = [1 − exp(− Re e / 14)] 1 + 5 Re t−0.01 exp(− Re t2 ) 1 − 0.0631 Re y ) 95 AUTO UGM 2003 Confidential [ ][ 2 ] .125 f1 = 1 [ ]( 2 ) f 2 = 1 − 0.

define/models/viscous/ turbulence-expert/low-re-ke-index – Low-Reynolds model k-ε equations solved on fine mesh (required) right to the wall. One must have at least 10 cells within the viscosity-affected near-wall region 96 AUTO UGM 2003 Confidential . The mesh resolution requirements are similar to those of the two-layer model. – y+ at the wall-adjacent cell should be of 1. Most ideally.

g.define/models/viscous/ turbulence-expert/kato-launder-model? – This model accounts for vorticity magnitude in the production term of turbulent kinetic energy. turbulence-expert/kw-vorticity-base-production? – Production of turbulent kinetic energy is function of vorticity magnitude instead of strain rate magnitude. It results in a reduced level of production close to stagnation points (e. – Damping functions are written in terms of Reynolds numbers: 97 AUTO UGM 2003 Confidential . impinging jets). The main purpose is to prevent over production of turbulence close to stagnation point.

– When using this expression of Cµ with the MRFmodel. Absolute Cµ = 1 A0 + As U *k ~ ~ U ≡ S ij S ij + Ω ij Ω ij * ~ Ω ij = Ω ij − 2ε ijk ω k Ω ij = Ωij − ε ijk ω k Relative ε – Where Ωij is the mean rate-of-rotation tensor viewed in a rotating reference frame with the angular velocity ω k . 98 AUTO UGM 2003 Confidential . there is a jump in the turbulent viscosity ratio at the interface between the stationary and rotating fluid zones because of the ad hoc term − 2ε ijk ω k .define/models/viscous/ rke-cmu-rotation-term? – The use of realizable k-ε model with multiple reference frame (MRF) model is not recommended. – This option is provided for users who want to experiment with this model and modify the definition of Cµ by switching off the term − 2ε ijk ω k .

– New fluid zone is created – Implemented only in 3D.define/boundary-conditions/ Modify-zone/extrude-face-zone-… – Ability to extrude a boundary face zone and extend the solution domain without having to exit the solver. 99 AUTO UGM 2003 Confidential . – Current extrusion capability creates prismatic or hexahedral layers based on the shape of the face and normal vectors to the face zone’s nodes. A typical application of the extrusion capability is to extend the solution domain when recirculating flow is impinging on a flow outlet.

g. 100 AUTO UGM 2003 Confidential .0).8. Modify-zone/extrude-face-zone-para • Extrude a face thread by specifying a total distance (in SI units) and a list of parametric locations between 0 and 1 (e.4. 0. 0.. 0.2. 1. 0.define/boundary-conditions/ Two options available Modify-zone/extrude-face-zone-delta • Extrude a face thread by specifying a list of displacements (in SI units).

/define/boundary-conditions/modify-zones> extrude-face-zone-delta Distance delta(1) [()] 1 Distance delta(2) [()] 1 Distance delta(3) [()] Extrude face zone? [yes] Moved original zone (outlet) to interior-7 Created new prism cell zone fluid-10 Created new prism cap zone pressure-outlet-11 Created new prism side zone wall-12 Created new prism interior zone interior-13 101 AUTO UGM 2003 Confidential .define/boundary-conditions/ modify-zone/extrude-face-zone-delta [example] – A cube (10x10x10) is extruded twice at the outlet by a distance of 1.

define/grid/ modify-zone/make-periodic – Attempt to establish periodic/shadow zone connectivity. 102 AUTO UGM 2003 Confidential . – For translationally periodic boundaries. modify-zone/repair-periodic – Modify the grid to enforce a rotational angle or translation distance for periodic boundaries. – For rotationally periodic boundaries. the command prompts for an angle and adjusts the node coordinates on the shadow face zone using this angle and the defined rotational axis for the cell zone. the command computes an average translation distance and adjusts the node coordinates on the shadow face zone to match this distance.

define/grid/ modify-zone/slit-periodic Slit periodic zone into two symmetry zones. modify-zone/slit-face-zone – Slit two-sided wall into two connected wall zones. 103 AUTO UGM 2003 Confidential .

– Available for pressure inlet/outlet BCs and mixing plane. – Implementation with a number of limitations • SS. required for 3D • To choose “non-reflecting” requires ALL pressure boundaries and mixing planes to be non-reflecting • ALL must meet requirements for NR option to be available 104 AUTO UGM 2003 Confidential . coupled explicit solutions only • NRBC and NRMP faces require structured meshes • NRMP requires equal numbers of divisions equally spaced in the “spanwise” direction for each plane • Quad/hex layer adjacent to NRBC/MP highly recommended for 2D.define/boundary-conditions/ non-reflecting-bc/ – Enter the non-reflecting boundary conditions (NRBC) menu.

define/boundary-conditions/ non-reflecting-bc/ 2D Turbine Vane Short Domain Truncated downstream boundary Long Domain 105 AUTO UGM 2003 Confidential .

define/boundary-conditions/ non-reflecting-bc/ Shock wave at vane trailing edge Long Domain Constant Pressure BC Contours of Static Pressure (atm) 106 AUTO UGM 2003 Confidential .

define/boundary-conditions/ non-reflecting-bc/ Short Domain Constant Pressure BC Contours of Static Pressure (atm) Constant pressure BC results in incorrect shock location 107 AUTO UGM 2003 Confidential .

shock location is correctly predicted! Short Domain Non-Reflecting BC Contours of Static Pressure (atm) 108 AUTO UGM 2003 Confidential .define/boundary-conditions/ non-reflecting-bc/ Non-reflecting boundary conditions permit shock wave to pass through the boundary .

making it difficult to obtain a converged solution. As a result. – The mixing plane model is usually used to model the three interfaces that connect the components of the torque converter. the pressure may float unbounded. the pressure is no longer fixed. such as a torque converter. In this configuration.define/boundary-conditions/ mixing-planes/set/fix-pressure-level – For certain turbomachinery configurations. – FLUENT offers an option for fixing the pressure level and adjust the gauge pressure field after each iteration by subtracting from it the pressure value in the cell closest to the Reference Pressure Location in the Operating Conditions panel. there is no fixed-pressure boundary when the mixing plane model is used. – Only available for incompressible flows using the segregated solver 109 AUTO UGM 2003 Confidential .

• The ratio of upstream to downstream swirl integration before and after the correction.define/boundary-conditions/ • mixing-plane/set/conserve-swirl – Conservation of swirl is important for applications such as torque converters. – If verbosity? is turned on. 110 AUTO UGM 2003 Confidential . FLUENT will report for every iteration: • The zone ID for the zone on which the swirl conservation is active • The upstream and downstream swirl integration per zone area. Once the option is turned on. the user can ask the solver to report information about the swirl conservation during the calculation.

• The real gas model does not support mixtures and/or saturated fluids. 111 AUTO UGM 2003 Confidential . User cannot override the REFPROP database for a real gas material by modifying parameters in the Materials panel.0) to evaluate thermodynamic and transport properties. • All fluid zones must contain the real gas.define/user-defined/ real-gas/ – The real gas model uses the National Institute of Standards and Technology (NIST) Thermodynamic and Transport Properties of Refrigerants and Refrigerant Mixtures Database Version 6. • All fluid property information in the Materials panel is ignored by FLUENT. – Limitations of the real gas model • Used only with the coupled solvers.0 (REFPROP v6.

33 (K) Pressure : 3.fld RC318. and then select a material from the REFPROP database.fld R245fa.fld R115.fld" 112 AUTO UGM 2003 Confidential . matl name: "R125" : "pentafluoroethane" : "354-33-6" Mol Wt : 120.0/realgas/ ultra/librealgas.3 (kg/m^3) select real-gas data file [""] "R125.fld R124. > define/user-defined/real-gas use real gas? [no] yes CO2.fld R13.fld R125.fld R113.. First enable the real gas model.fld isobutan.fld R152a.fld ammonia.fld R236fa.fld R236ea.fld R114.fld R32.75996 (mol/L) 571.fld R12.fld R41.629e+06 (Pa) Density : 4.fld butane.fld R142b.so".fld R141b.fld R22.fld R123.fld R11.fld R134a.define/user-defined/ real-gas/ – Activating the real gas model is a two-step process.fld propylen.fld Opening "/usr/local/Fluent.022 Critical properties: Temperature : 339.fld R14.fld R116.fld /usr/local/Fluent..fld R23.fld R227ea. Setting material "air" to a real-gas.fld R143a.Inc/fluent6.fld ethane.fld R245ca...Inc/fluent6.0/realgas/lib/R125.fld propane.

– Ensuring conservation of total enthalpy involves adjusting the downstream total temperature profile such that the integrated total enthalpy matches the upstream integrated total enthalpy. FLUENT will report for every iteration: • The zone ID for the zone on which the enthalpy conservation is active • The upstream and downstream heat fluxes. – If verbosity? is turned on.define/boundary-conditions/ • mixing-plane/set/conserve-total-enthalpy – Global parameters such as efficiency are directly related to the change in total enthalpy across a blade row or stage. 113 AUTO UGM 2003 Confidential . • The ratio of upstream to downstream heat fluxes.

To stop the spinning. click on the display window again. windows/ – Contains commands that allow user to customize the relative positions of sub-windows inside the active graphics window. 114 AUTO UGM 2003 Confidential . reset-graphics – Reset the graphics system and kill all the display windows. – It is recommended to use this option with the double buffering option turned on.display/set/ rendering-options/auto-spin? – Enable mouse view rotations to continue to spin the display after the button is released. Double buffering dramatically reduces screen flicker during graphics updates.

display/set/ windows/… [example] – Add borders to the scale. the axis. – Eliminate the application title – etc 115 AUTO UGM 2003 Confidential . the image.

and wall-17 in the current model.g. FLUENT will set the boundary conditions in the current model by comparing the zone name associated with each set of conditions in the file with the zone names in the model. the boundary-condition file saved with the write-bc can be edited to include “wildcards” ( *) within the zone names (e. Note : If user wants to apply a set of conditions to multiple zones with similar names. read-bc – Read boundary conditions from a file and apply them to the corresponding zones in the model. edit the boundary-condition file and set the zone name associated with the desired conditions to wall-*). 116 AUTO UGM 2003 Confidential . wall-15.file/ write-bc – Save all currently-defined boundary conditions to a file. to apply a particular set of conditions to wall-12. FLUENT will use the same format as the “zone”' section of the case file.

and parameters. etc.file/ • reread-grid – Given a case file with a particular grid. material properties. The new grid must have the same zone structure as the original grid. – – 117 AUTO UGM 2003 Confidential . properties. solution parameters. the user can use this option to merge a new grid with the existing boundary conditions. Useful situation: a better mesh is generated for the same problem and the user doesn’t want to reenter all of the boundary conditions.

Note: These options are more accurate than surface integrals at boundary zones because they do not involve cell interpolation. They are analogous to the report →fluxes in the GUI for mass and heat transfer rates.report/ species-mass-flow – Print list of species mass flow rate at inlets and outlets. 118 AUTO UGM 2003 Confidential . uds-flow – Print list of user-defined scalar flow rate at boundaries.

flow warnings are printed. and when mass flow inlets develop supersonic regions. set/flow-warnings? – set/numerics/implicit body force treatment? – 119 AUTO UGM 2003 Confidential . For problems with dominant body forces. Specify whether or not to print warning messages when reversed flow occurs at inlets and outlets. By default. this option allows for a linearization of body force source terms.solve/ monitors/force/clear-all-monitors – Fast way to discard the internal and external file data associated with the force monitors.

r ∂ (ρφ ) + ∇ ⋅ (ρv φ ) = ∇ ⋅ (Deff ∇φ ) + Sφ ∂t – If the user wants to solve the energy equation in non-conservative form this option should be switched off (not recommended) 120 AUTO UGM 2003 Confidential .solve/ set/expert/use conservative form of energy equation? – FLUENT solves the energy equation in its conservative form r  r r ∂ (ρE ) + ∇ ⋅ (v (ρE + p )) = ∇ ⋅  k eff ∇T − ∑ h j J j + (τ eff ⋅ v ) + S h   ∂t j   – Which is consistent with the finite volume conservative form of governing equations.

121 AUTO UGM 2003 Confidential .solve/ set/expert/use alternate formulation for wall temperature? [no] – FLUENT models the flux at the wall as follows: r q = k∇T ⋅ n (Tw − Tc ) q=k + f (∆T ) ∆h – The term f(∆T) includes second order terms that need to be determined. which involves approximations.

This option doesn’t impact the results if the wall cells are not skewed. solve/ r q = k∇T ⋅ n q=k (Tw − Tc ) ∆h – – The term f(∆T) vanishes and ∆h changes.set/expert/use alternate formulation for wall temperature? [yes] – Assume face center is defined such as the vector between cell center and face center is perpendicular to the wall. 122 AUTO UGM 2003 Confidential .

the parallel and serial solvers will give the exact same solution at every iteration because the Jacobi approach always uses values from the previous iteration (“jacobi”). the results can differ from one iteration to another but will ultimately converge to the same solution. With Gauss-Seidel.solve/ set/relaxation-method? – – – By default FLUENT uses the Gauss-Seidel relaxation method (“gauss-seidel”). 123 AUTO UGM 2003 Confidential – – . It is recommended to use Gauss-Seidel method. This option is used for testing purposes. This yields differences between the serial and parallel solvers. If the parallel solver partitions are visited in an order that is different form the way the serial solver sweeps the domain. If the Jacobi approach is used. each cell uses the updated value of the neighboring cells.

Part IV : Case Study The Segregated Solver with High Pressure Differential. 124 AUTO UGM 2003 Confidential .

How to use the segregated solver when there are large pressure variations between the inlets and outlets ? A case study for a ball diverter controlled valve 125 AUTO UGM 2003 Confidential .

01 psi) Large pressure variation within the domain 126 AUTO UGM 2003 Confidential .Valve controlled by ball diverter Description Flow to the left and right channels is controlled by the position of the ball diverter Very high pressure at the inlets (~500 psi) and low pressures at the outlets (~0.

and Tgrid schemes tgrid cooper map cooper cooper tgrid with sizing function 127 AUTO UGM 2003 Confidential . cooper.Valve controlled by ball diverter Mesh Issue Hybrid mesh was created in Gambit using the map.

79] Red lines show the faces used as the sources of the sizing function High quality tetrahedral elements with appropriate clustering of cells are created in Gambit using the sizing function tools Mesh clustering at the gap regions 128 AUTO UGM 2003 Confidential . 0. 0.84] – Cell equi-volume skew: [0.09M with low skewness – Cell equi-angle skew: [0.Valve controlled by ball diverter Mesh Issue Mesh count is 1.

5 psi – Side inlets are specified as Massflow-inlet type • Massflow rates are 7e-5 kg/s and 2e-5 kg/s – Correspond to velocities of 33. set the static pressure to 499. set the static pressure to 499.Valve controlled by ball diverter Setup Parameters Inlet boundaries – Main inlet is specified as pressure-inlet type • Total pressure is 500 psi and total temperature is 2000 K • Flow is subsonic.01 psi • Backflow total temperature is 2000K 129 AUTO UGM 2003 Confidential .5 psi Outlet boundaries – Both outlet boundaries are specified as pressure-outlet type • Static pressure is 0.8 m/s respectively • Total temperature is 2000 K • Flow is subsonic.4 m/s and 9.

Valve controlled by ball diverter Solution Procedure Case is very difficult to start and to converge due to large pressure variations in the domain Convergence difficulties are attributed to: – Difficult to specify good initial conditions – Patching is also difficult since there may be compression/expansion structures inside the domain – Difficult to setup appropriate solution limits due to large variations in pressure Will lowering URFs work ? – Using very low URFs at the beginning may work but it may be impractical since very low values may be needed 130 AUTO UGM 2003 Confidential .

Valve controlled by ball diverter Solution Procedure – Set the static pressure at the outlets to values slightly lower than the inlet values Set appropriate solution limits which reflects the modified condition – Initialize using the inlet condition but set velocities to zero – Iterate until sufficient first order convergence No backflow at the main inlet – Gradually lower the outlet static pressure values and iterate until sufficient convergence at each step Adjust the solution limits to reflect the updated outlet pressure values – Save the case/data files as necessary 131 AUTO UGM 2003 Confidential .

Valve controlled by ball diverter Miscellaneous Other tips: – Change to second order only after sufficient convergence using first order with the desired pressure values at the outlets – Density discretization needs to be changed to second-order to resolve shocks accurately. if any – Specify Massflow inlet instead of pressure-inlet at the main inlet • Prevent backflow at the inlet during the initial stages of the iteration – Use the PISO algorithm to handle the velocity-pressure coupling • Will reduce the pressure oscillations between the high pressure inlets and low pressure outlets 132 AUTO UGM 2003 Confidential .

Valve controlled by ball diverter Results Static pressure Mach number 133 AUTO UGM 2003 Confidential .

the knowledge can be used to write a UDF to automate the whole process 134 AUTO UGM 2003 Confidential .Valve controlled by ball diverter Practical Issues Stable solution procedure requires setting a high static pressure values at the outlets and then gradually reduces the values in steps until the desired value is achieved This manual adjustment of the static pressure values at the outlet boundaries can be time consuming and an automated procedure is desirable Once a good experience of how fast to reduce and how many to iterate at each step is obtained.

Valve controlled by ball diverter Practical Issues The UDF requires the following inputs: – Number of iterations to be performed before each update (iterP) – Change of pressure value at each update (deltaP) – Impose limit on the minimum pressure to prevent oscillations (Plimit) The sample UDF given in the next slide works only in serial and has not been parallelized yet. 135 AUTO UGM 2003 Confidential .

tf) Pavg = sumP/sumA. AUTO UGM 2003 Confidential tf = Lookup_Thread(domain.f.Amag.0 #define zoneID 3 #define iterP 50 #define deltaP 5000. DEFINE_ADJUST(Padjust.zoneID).0. float sumA. sumP = 0. Thread *tf.0.domain) { (1) face_t f. (2) . float Pupdate=3446083. begin_f_loop(f. Amag = Factor*NV_MAG(A). F_AREA(A.0 #define Plimit 1000.tf).14159265 #define Factor 1. 136 A[ND_ND].0 int iter=0.tf) { phif = F_P(f.0.sumP. sumP += phif*Amag.phif. sumA = 0.Pavg.tf).Valve controlled by ball diverter #include "udf. sumA += Amag. } end_f_loop(f.h" #define PI 3.

tf.pos) = Pupdate.tf) {F_PROFILE(f.} end_f_loop(f. if ( (iter%iterP)==0 ) { Pupdate = Pavg . } } DEFINE_PROFILE(prsbc.Valve controlled by ball diverter iter += 1.deltaP.tf) } AUTO UGM 2003 Confidential (3) 137 .pos) { face_t f. begin_f_loop(f. Message("Update pressure to %f\n". Message("Current pressure is %e\n". if ( Pupdate<Plimit ) Pupdate = Plimit.Pupdate).tf.Pavg).

Sign up to vote on this title
UsefulNot useful