Project

Gearbox Sloshing Effect

Aim: To perform the four simulations of the gearbox sloshing effect and compare the results among all the cases.

Objective: To solve the following Four Cases

1. 20% Immersion, Fluid - Engine oil

2. 30 % Immersion, Fluid - Engine oil

3. 20% Immersion, Fluid - n-heptane-liquid(c7h16)

4. 30 % Immersion, Fluid - n-heptane-liquid(c7h16)

To analyze the flow pattern of the fluid for four cases.

To compare the results of four cases with animations by running all the simulations for the same total time.

Gearbox:

The term “gearbox” is one of those terms, often times used interchangeably with gearhead or gear reducer, even though they sometimes refer to slightly different physical arrangements of gears.

The most basic definition of a gearbox is that it is a contained gear train, or a mechanical unit or component consisting of a series of integrated gears within a housing. In fact, the name itself defines what it is — a box containing gears. In the most basic sense, a gearbox functions like any system of gears; it alters torque and speed between a driving device like a motor and a load.

The gears inside of a gearbox can be any one of a number of types from bevel gears and spiral bevel gears to wormgears and others such as planetary gears. The gears are mounted on shafts, which are supported by and rotate via rolling element bearings. The gearbox is a mechanical method of transferring energy from one device to another and is used to increase torque while reducing speed.

Gearboxes are used in many applications including machine tools, industrial equipment, conveyors, and really any rotary motion power transmission application that requires changes to torque and speed requirements.

Lubrication:

Lubrication is the process or technique of using a lubricant to reduce friction and wear & tear in a contact between two surfaces.

Lubricants can be solids (such as Molybdenum disulfide MoS2), solid/liquid dispersions (such as grease), liquids (such as oil or water), liquid-liquid dispersions or gases.

Fluid-lubricated systems are designed so that the applied load is partially or completely carried by hydrodynamic or hydrostatic pressure, which reduces solid body interactions (and consequently friction and wear). Depending on the degree of surface separation, different lubrication regimes can be distinguished.

Adequate lubrication allows smooth, continuous operation of machine elements, reduces the rate of wear, and prevents excessive stresses or seizures at bearings. When lubrication breaks down, components can rub destructively against each other, causing heat, local welding, destructive damage and failure.

Methods of Lubrication:

Lubrication is essential to the proper functioning of an industrial gearbox. Adequate levels of lubrication benefit a gearbox by lubricating the teeth and removing heat generated from operations. Lubricant is also used on the various bearings inside the gearbox. Adequately lubricating these elements of industrial gearbox will result in mechanical efficiency, reliability, low maintenance, and a long equipment life span.

Grease Lubrication:

Grease lubrication can be used for industrial gearbox systems that are open or closed, as long as they run at low speeds. The grease must have the correct viscosity with good fluidity, especially when used in an enclosed unit. Grease lubrication should not be used for continuous operation or high load gear drives. It should also be noted that grease lubrication has no cooling effect. A sufficient amount of grease must be used to ensure gear teeth are lubricated, but excess grease can result in power losses and viscous drag.

Splash Lubrication:

Helical, spur, and bevel gearboxes are typically lubricated using splash lubrication. During splash lubrication, the gears or another component within the gearbox dip into an oil bath. Through rotation these components begin “splashing” the oil into necessary chambers and crevices that may contain additional gears or bearings in need of lubricant. Provisions must be made to ensure the gear teeth are not fully immersed in the bath. If teeth are immersed in the oil, excessive losses will result due to the oil being churned.

Spray Lubrication:

High speed industrial gearboxes are lubricated through spray lubrication. These units often have spray lubrication provided through the use of nozzles, with oil circulating at a pressure of 0.7 barg. Extra care must be taken to ensure the oil reaches the contacting surfaces. This process can become difficult as centrifugal forces deflect the stream of oil.

Forced oil lubrication:

Forced oil lubrication is preferred for high-speed applications, and includes methods such as oil mist, oil spray, and oil drop. In the oil mist method, oil is atomized so that it saturates all areas of the gears and other internal components. In contrast, the oil spray method applies oil lubricant directly to the gears and other components, but this method is not always effective, as high centrifugal forces affect the direction of the oil spray.

The oil drop method pumps, or “drops,” oil directly onto the surfaces where it’s needed. A pump takes lubrication from a reservoir and delivers it to the gears and/or bearings via an internal piping system. This method can often be found in conjunction with the splash (aka oil bath) method, where some components may be difficult to reach via oil splash.

Gearbox Sloshing effect

1. Geometry:

Using visual c++ workbench is opened and a standalone system 'Fluid Flow (Fluent)' is created.

a) Import Geometry - Opening spaceclaim and imported geometry of gearbox -

The above imported geometry consist of two spur gears enclosed by housing.

i) Spur Gear

ii) Spur Gear

iii) Housing

b) Extracting Fluid Volume:

The fluid volume is extracted by selecting the 4 edges on housing.

The extracted fluid volume is -

c) Obtaining 2D geometry:

In order to obtain the 2D geometry body is cut in half and to do that first planes are created, then selecting split body option in design. To execute split body option first selecting the target object - in this case the target object is 'fluid volume'. Secondly the plane is selected in which body is to be cut in half. Finally clicking on the unwanted region to be removed.

Splitted body:

The orange colored surface is selected and copied to create 2D geometry. The copied part is pasted in new design, while doing this care must be taken that the part is copied in "x-yplane" in order to have ease while dealing with the co-ordinates. Then the geometry is saved as '2D_gear' i.e a 2D geometry.

2D geometry:

The above shown 2D geometry is used for simulation.

2. Meshing:

a) Named Selection-

By using the edge selection option all the edges of the gears individually are selected and named 'left_gear' & 'right_gear' respectively.

Element size - 0.75 mm

Mesh method - Inserting mesh method - All triangles method

Number of nodes - 22945

Number of elements - 42137

Capture Proximity - Yes

No. of Cells across gap - 1

b) Mesh:

3. Setup:

i) Geometry:

  1. Solver - Pressure-Based
  2. Time - Transient
  3. Gravitational Acceleration is (-9.81`m/s^2`) in 'y' direction.

ii) Models:

  1. Viscous - K-Epsion
  2. k-epsilon Model - Realizable & Near-Wall Treatment - Enhanced wall treatment

iii) Materials -

a) Air -

b) Engine-Oil -

c) n-heptane-liquid(c7h16) -

iv) Multiphase -

Model - Volume of Fluid

No. of Eulerian Phases - 2

Formulation - Implicit

v) Phases -

  • For Case - 1 and Case - 2

  • For Case - 3 and Case - 4

vi) Defining Fluid Region -

Fluid region will define where fluid has to be - it will ensures that the fluid reaches to all the gears.

For this simulation of gearbox sloshing effect, two different fluid regions are used for 4 cases.

a) 20% Immersion - Lubricant occupies 20% of complete fluid geometry.

b) 30% Immersion - Lubricant occupies 30% of complete fluid geometry.

vii) User Defined:

Here adding the udf file under functions and then selecting compiled and adding the file 'rate.c'

File 'rate.c'

#include "udf.h"

DEFINE_CG_MOTION(right_motion, dt, vel, omega, time, dtime)
{
	vel[0] = 0.0;
	vel[1] = 0.0;
	vel[2] = 0.0;

	omega[0] = 0.0;
	omega[1] = 0.0;
	omega[2] = 2.0e2; /* [rad/s]*/
}
DEFINE_CG_MOTION(left_motion, dt, vel, omega, time, dtime)
{
	vel[0] = 0.0;
	vel[1] = 0.0;
	vel[2] = 0.0;

	omega[0] = 0.0;
	omega[1] = 0.0;
	omega[2] = -2.0e2; /* [rad/s]*/
}

viii) Dynamic Mesh - This helps in simulating the model flows where the shape of the domain is changes with respect to time due to motion on the domain boundaries.
For gear sloshing effect simulation - the motion of gears are defined by User-defined Function which states gears are rotating with an angular velocity of 200 rad/sec.

The left gear rotates at point (0,0) and right gear rotates at (0.115,0) metres

The dynamic mesh function works by using 3 different methods:

  • Smoothing – The nodes moves according to boundary motion and elements stretch out like springs to keep the nodes joined.
  • Layering – The mesh moves layer by layer. (Useful in sliding mesh for less magnitude deformation)
  • Remeshing – The mesh is remeshed locally in regions that do not satisfy user specified limit on sizes and skewness.

The Smoothing spring constant is equal to 1.

The Remeshing limits require minimum and maximum sizes of element and its skewness limit. To calculate those limit, a theoretical deformation of an element in worst case. The worst case would be when base of triangle is fixed with 2 nodes and another node displaces totally.

Calculations:

The gears in geometry have 46 teeth each and considering simulation for 5.5 rotations of gears.

Here,

`omega = 200 (rad)/sec`

`omega = (2piN)/60`

`N = (60 times 200)/(2pi) = 6000/pi`

`N = 1909.8593`

`therefore N = 31.831 rps`

Time required for one rotation - `1/31.831 = 0.03141 sec`

Time required for one tooth shift - `0.03141/46 = 0.0006828`

Dividing 1 tooth shift in 10 divisions to obtain a reasonable accuracy.

Time required for 1 division - `0.0006828/10 = 0.00006828 sec` = 6.828e-5 seconds

Taking round off time step = 5e-5 seconds

Total time required for 5.5 rotations of gear = `0.03141 times 5.5`= 0.17275` considering it equals to 0.175

Total timesteps required = `0.175/(5e-5)` = 3500.

Each timestep would result in mesh rotation of 0.57 Degrees. The radius for tooth tip is 0.06 metres.

r = 0.06 m

`theta =0.57 degree`

`theta = 0.57 times 0.0175 = 0.009948377 radians`

`L = r times theta`

`L = 0.06 times 0.009948377`

`L = 0.0005969 m` i.e = 0.5969 mm

`therefore` for each time step tooth tip moves by 0.5969 mm.

Considering a regular triangular element with side = 0.75 mm and displacing its top node by 0.5969 mm per timestep.

Skewness Calculation:

`theta_max = "maximum angle"`

`theta_min = "minimum angle"`

`theta_e = "angle for equi-angular face"`

a) `"Skewness" = max((theta_max - theta_e)/(180-theta_e) , (theta_e - theta_min)/theta_e)`

`= max(48.86/120, 26.25/60)`

`= max(0.4072 , 0.4375)`

`"Skewness" = 0.4375`

OR

b) `"Skewness" = (90 - ("bisector angle"))/90`

`= (90 - 47.42)/90`

`"Skewness" = 0.4731`

The max skewness for 2D mesh should be equal to 0.7. As calculated skewness value approximately equal to 0.45, therefore proceeding with next timestep.

`theta_max = "maximum angle"`

`theta_min = "minimum angle"`

`theta_e = "angle for equi-angular face"`

a) `"Skewness" = max((theta_max - theta_e)/(180-theta_e) , (theta_e - theta_min)/theta_e)`

`= max(51.55/120, 44.05/60)`

`= max(0.42958 , 0.73456)`

`"Skewness" = 0.73456`

OR

b) `"Skewness" = (90 - ("bisector angle"))/90`

`= (90 - 21.82)/90`

`"Skewness" = 0.75756`

The max skewness for 2D mesh should be equal to 0.7.

The calculated skewness value is above 0.7. Therefore need to do remeshing.

The minimum length of side is 0.75 mm and need to provide a lesser value considering the presence of smoothing technique.

For the 'First' timestep maximum side is 1.17 mm and for 'Second' timestep maximum side is 1.7 mm.

Choosing maximum side length in between '1.17 to 1.7 mm'. i.e maximum side length = 1.5 mm.

  • Remeshing

Minimum element size = 0.5 mm

Maximum element size = 1.5 mm

Maximum skewness = 0.7

Remeshing interval = 2 timesteps

ix) Dynamic Mesh Zone - Creating dynamic mesh zones for left and right gears in order to assign the proper motion to the respective gears by setting up udf.

x) Display Zone Motion -

This is used in order to preview the motion and to check whether udf setup correctly.

xi) Initialization - With the above simulation setup initialization is done by 'Hybrid Initialization Method'.

xii) Patch - Representation of phases.

  • Settings For - Air and Engine-Oil
  • Representation - Whether patch of phases is done properly it can be checked by displaying the contour.

Similarly,

  • Settings For - Air and n-heptane-liquid
  • Representation - Whether patch of phases is done properly it can be checked by displaying the contour.

Run Calculation - With the above settings and proper changes according to the respective cases. Running all the simulation cases for same total time.

Four Different Cases -

Case 1 - 20% Immersion, Fluid - Engine oil

For this case fluid region is setup in such a way that - fluid region is filled with 20% of 'engine-oil' for lubricantion inside the gearbox.

Residuals:

Contour:

At the starting time when gears are in idle or at rest condition i.e t = 0 sec the lubrication fluid- engine-oil is concentrated at the bottom of the gearbox in defined 20% fluid region. In case of 20% fluid region, and no. of gear teeth already dipped in the engine-oil are very less, splashing of lubricant helps to spread the lubricant on all over parts but, the splashed oil from walls sliding down at the bottom is less hence when gears start rotating then minimum no. of teeth will carry lubricant with it. Due to this gears are operated in a loss‐of‐lubrication operating condition for a long time, their heat dissipation performance would deteriorate which result in a drastic increase in tooth temperature, which may lead to scuffing failure.

Animation of Case 1:

Case 2 - 30% Immersion, Fluid - Engine oil

For this case fluid region is setup in such a way that - fluid region is filled with 30% of 'engine-oil' for lubricantion inside the gearbox.

Residuals:

Contour:

At the starting time when gears are in idle or at rest condition i.e t = 0 sec the lubrication fluid- engine-oil is concentrated at the bottom of the gearbox in defined 30% fluid region. In case of 30% fluid region, significant no. of gear teeth are already dipped in the engine-oil, this configuration has enough lubrication to fill the gap between gear teeth right from first rotation of the gear. Splashing of lubricant helps to spread the lubricant on all over parts and is more effective, the splashed oil from walls sliding down at the bottom is more as compared to 20% configuration. In this case gears are operated with adequate lubrication condition for a long time and hence reduces the effect of problems which were associated with loss-of-lubrication operating condition.

Animation of Case 2:

Case 3 - 20% Immersion, Fluid - n-heptane-liquid(c7h16)

For this case fluid region is setup in such a way that - fluid region is filled with 20% of 'n-heptane-liquid(c7h16)' for lubricantion inside the gearbox.

Residuals:

Contour:

At the starting time when gears are in idle or at rest condition i.e t = 0 sec the lubrication fluid- n-heptane-liquid is concentrated at the bottom of the gearbox in defined 20% fluid region. In case of 20% fluid region, and no. of gear teeth already dipped in the n-heptane liquid are very less, splashing of lubricant helps to spread the lubricant on all over parts but, the splashed oil from walls sliding down at the bottom is less hence when gears start rotating then minimum no. of teeth will carry lubricant with it and more consumption as viscocity of n-heptane liquid is low though low ability to stick to tooth surface. Gears are operated in a loss‐of‐lubrication operating condition for a long time, their heat dissipation performance would deteriorate which result in a drastic increase in tooth temperature, which may lead to scuffing failure and other associated failures.

Animation of Case 3:

Case 4 - 30% Immersion, Fluid - n-heptane-liquid(c7h16)

For this case fluid region is setup in such a way that - fluid region is filled with 30% of 'n-heptane-liquid(c7h16)' for lubricantion inside the gearbox.

Residuals:

Contour:

At the starting time when gears are in idle or at rest condition i.e t = 0 sec the lubrication fluid-n-heptane-liquid is concentrated at the bottom of the gearbox in defined 30% fluid region. In case of 30% fluid region, significant no. of gear teeth are already dipped in the n-heptane-liquid, this configuration has enough lubrication to fill the gap between gear teeth right from first rotation of the gear but its low viscocity reduces ability to stick to gear tooth surface. Splashing of lubricant helps to spread the lubricant on all over parts and is more effective, the splashed oil from walls sliding down at the bottom is more as compared to 20% configuration. In this case gears are operated with adequate lubrication condition for a long time and hence reduces the effect of problems which were associated with loss-of-lubrication operating condition. But the low viscocity is matter of concern for using n-heptane-liquid for lubricantion in gearbox .

Animation of Case 4:

Conclusion:

Simulation of gearbox gear with 'Four' different configurations - in combination with 'Two' different lubricants 'engine-oil and n-heptane-liquid' & 'Two' different lubrication region 20% and 30%.

  • At beginning i.e time t= 0 sec, all lubricat is concentrated at the bottom of a gearbox, 30% immersion has more lubricant than that of 20% immersion case.
  • When gear starts rotating there is enough lubrication to fill the gap between teeth, right from first rotation of the gear in 30% immersion case. Whereas, the gears are in a loss‐of‐lubrication operating condition for a long time due to less lubricant in 20%immersion case.
  • Though splashing of lubricant helps to spread the lubricant on all over parts in both 20% & 30% immersion cases but 30% immersion is more effective.
  • Engine oil holds more benefits while operating at higher temperature as viscocity of engine oil `mu_"engine-oil" = 1.06 (kg)/(m-s)` is more than viscocity of n-heptane-liquid `mu_"n-heptane-liquid" = 0.000409 (kg)/(m-s)` i.e `(mu_"engine-oil" gt mu_"n-heptane-liquid")`.
  • Engine-oil has more ability to stick to the tooth surface as compared to n-heptane-liquid this is because engine-oil has high viscosity that results in appropriate temperature distribution.
  • The higher value of engine-oil viscosity results in lower oil consumption and less wear during gear rotation.

Q1. What is dynamic meshing and where the dynamic meshing is useful? Give other examples and describe the advantage and disadvantages of dynamic meshing.

Dynamic Meshing:-

Dynamic Mesh Module is a tool that allows the motion of parts (or subparts) relative to static ones, which therefore makes the fluid volume changing in time frame. In dynamic mesh model the boundaries of a cell zone are allowed to move relative to other boundaries of the zone, and to adjust the mesh accordingly. The boundaries can move rigidly with respect to each other (that is, linear or rotational motion), and/or deform.

The motion of the boundaries can be:

  1. Rigid - Pistons moving inside an engine cylinder or a flap deflecting on an aircraft wing.
  2. Deforming - The elastic wall of a balloon during inflation or a flexible artery wall responding to the pressure pulse from the heart.

In either case, the nodes that define the cells in the domain must be updated as a function of time, and hence the dynamic mesh solutions are inherently unsteady.

An important special case of dynamic mesh motion is called the sliding mesh in which all of the boundaries and the cells of a given mesh zone move together in a rigid-body motion. In this situation, the nodes of the mesh move in space (relative to the fixed, global coordinates), but the cells defined by the nodes do not deform.

The mesh Smoothing and Remeshing techniques, provide instant mesh deformation capability. Remeshing is used when the mesh is more sensitive to mesh changes, which can be used to manually specify ranges of maximum and minimum elements in the Maximum and Minimum Length Scale for mesh changes.

In the Dynamic Mesh Zone section, areas or boundaries of the model that should be affected by the mesh change must be defined, such as by Deforming to change the boundaries in the area (fluid around a moving object or a boundary-changing object), Rigid Body to moving physical boundary and moving boundaries but not boundaries themselves, from Stationary to fixed body and finally from System Coupling to FSI solution.

Generally, the dynamic mesh technique is used when simulating models that require a moving mesh area. Whenever the problem model was such that the fluid zone required mesh moment changes over time, the Dynamic Mesh technique will be used.

The dynamic meshing can be used to model flows where:-

  1. The shape of the domain is changing with time due to motion on the domain boundaries.
  2. Six DOF dynamic mesh for modelling variation of location and angle of ship and boat in wavy sea situation.
  3. Simulation of the tidal turbine using six DOF dynamic mesh method (calculating rotation speed).
  4. Releasing of food box from airplane using six DOF dynamic method.
  5. Simulation of globe valve movement during the time.
  6. Train movement in the tunnel by variable velocity function in a urban tunnel.
  7. Simulation of flap movement of an airplane wing.
  8. Modelling the underwater vehicle in Submerged and non-submerged situation.
  9. Solid fuel combustion and modelling solid height level during burning fuel.
  10. Fluid solid interaction of blood flow and vessel.
  11. FSI simulation blood flow pumping in human heart.
  12. Fluid solid interaction of airflow around building and finding final deflection and fluctuation (two way and one way FSI)
  13. Two and four-stroke internal combustion engine.
  14. Automotive piston moving.
  15. Gearbox.

Advantages

  1. This model enables the spatial variation of the defined areas for fluid flow and allows the mesh of the region at the same time as the spatial location of the points and boundaries of the region changes compatibility with the place at the present moment.

  2. Boundaries or motion of objects can be moved based on in-cylinder motion (RPM, stroke length, crank angle,etc), Prescribed motion via profiles or UDF, Coupled motion based on hydrodynamic forces from the flow solution, via FLUENT’s 6 DOF model.
  3. The dynamic mesh model can be applied to single or multiphase flows (and multi-species flows).

Disadvantage -Inaccurate remeshing settings under dynamic mesh may lead to error - update dynamic mesh failed. Negative cell volume detected. and Floating point exception error. This may happen because remeshing may be too coarse.

Q2. What is sloshing and explain whether the sloshing effect is good or bad for any applications?

In fluid dynamics, sloshing refers to the movement of liquid inside another object (which is, typically, also undergoing motion). The liquid must have a free surface to constitute a slosh dynamics problem, where the dynamics of the liquid can interact with the container to alter the system dynamics significantly.

For example propellant slosh in spacecraft tanks and rockets (especially upper stages), and the free surface effect (cargo slosh) in ships and trucks transporting liquids (for example oil and gasoline). However, it has become common to refer to liquid motion in a completely filled tank, i.e. without a free surface, as "fuel slosh".

Such motion is characterized by "inertial waves" and can be an important effect in spinning spacecraft dynamics. Extensive mathematical and empirical relationships have been derived to describe liquid slosh. These types of analyses are typically undertaken using computational fluid dynamics and finite element methods to solve the fluid structure interaction problem, especially if the solid container is flexible. Relevant fluid dynamics non-dimensional parameters include the Bond number, the Weber number, and the Reynolds number.

Slosh is an important effect for spacecraft, ships, and some aircraft. Slosh was a factor in the Falcon 1 second test flight anomaly, and has been implicated in various other spacecraft anomalies, including a near-disaster with the Near Earth Asteroid Rendezvous (NEAR Shoemaker) satellite.

Sloshing is also a periodic motion of the free surface of the liquid in a partially filled tank or container that can be caused by several factors. It is viewed in many applications. In freely slosh it can produce forces that cause instability, rollover, and failure or damage in tank or container in some cases. Baffles used as sloshing suppression devices. The severity of sloshing and its dynamic pressure loads depend on the tank geometry, the depth of the liquid, the amplitude and the nature of the tank motions. They also depend on the frequency of excitation over a range of frequencies close to the natural frequency of the fluid.

Sloshing of liquid in the storage tank may result in negative effects such as deformation and failure of tank walls due to impact. If an open tank is subjected to ground motions, sloshing may lead to liquid spillage. Therefore, sufficient clearance need to provide between the free surface and top of the tank or roof must be provided.

Liquid sloshing strongly influences the directional dynamics and safety performance of highway tank vehicles in a highly adverse manner.

Hydrodynamic forces and moments arising from liquid cargo oscillations in the tank under steering and/or braking maneuvers reduce the stability limit and controllability of partially-filled tank vehicles.

Anti-slosh devices such as baffles are widely used in order to limit the adverse liquid slosh effect on directional performance and stability of the tank vehicles.

Sloshing or shifting cargo, water ballast, or other liquid (e.g., from leaks or fire fighting) can cause disastrous capsizing in ships due to free surface effect; this can also affect trucks and aircraft.

The effect of slosh is used to limit the bounce of a roller hockey ball. Water slosh can significantly reduce the rebound height of a ball but some amounts of liquid seem to lead to a resonance effect. Many of the balls for roller hockey commonly available contain water to reduce the bounce height.

Q3. What is UDF? Explain the usage of UDF.

A user-defined function (UDF) is a common fixture in programming languages, and the main tool of programmers for creating applications with reusable code. Since programs are mostly composed of code that comes from the programmer, or in this case the user, most of it is composed of user-defined functions occasionally punctuated by built-in functions.

User-defined functions allow programmers to create their own routines and procedures that the computer can follow; it is the basic building block of any program and also very important for modularity and code reuse since a programmer could create a user-defined function which does a specific process and simply call it every time it is needed. Their syntax depend entirely on the programming language or application where they are created.

Though part of any programming language, user-defined functions more commonly refer to the special functions that a user creates as scripts or programs in large systems. This is because most of the functions being used in a database system or spreadsheet are built-in functions that the user simply has to call and provide parameters, and most of what the application can do is already being done by one or more built-in functions. In this case, user-defined functions are special custom functions that are meant to do something not normally done by the built-in functions. In programming languages such as C, C++ and Java almost every part of the program is user-defined, hence, these functions are no longer referred to as "user-defined" to separate them from the built-in functions, they are simply called functions.

In CFD

A user-defined function, or UDF, is a function that we program that can be dynamically loaded with the ANSYS FLUENT solver to enhance the standard features of the code. For example, we can use a UDF to define our own boundary conditions, material properties, and source terms for flow regime, as well as specify customized model parameters (e.g., DPM, multiphase models), initialize a solution, or enhance postprocessing.

UDFs are written in the C programming language using any text editor and the source code file is saved with a .c extension (e.g., myudf.c). One source file can contain a single UDF or multiple UDFs, and we can define multiple source files.

UDFs are defined using DEFINE macros provided by ANSYS FLUENT. They are coded using additional macros and functions also supplied by ANSYS FLUENT that access ANSYS FLUENT solver data and perform other tasks.

Every UDF must contain the udf.h file inclusion directive ( #include "udf.h") at the beginning of the source code file, which allows definitions of DEFINE macros and other ANSYS FLUENT-provided macros and functions to be included during the compilation process. Values that are passed to a solver by a UDF or returned by the solver to a UDF are specified in SI units.

UDF file used for this challenge is:-

#include "udf.h"

DEFINE_CG_MOTION(right_motion, dt, vel, omega, time, dtime)
{
	vel[0] = 0.0;
	vel[1] = 0.0;
	vel[2] = 0.0;

	omega[0] = 0.0;
	omega[1] = 0.0;
	omega[2] = 2.0e2; /* [rad/s]*/
}
DEFINE_CG_MOTION(left_motion, dt, vel, omega, time, dtime)
{
	vel[0] = 0.0;
	vel[1] = 0.0;
	vel[2] = 0.0;

	omega[0] = 0.0;
	omega[1] = 0.0;
	omega[2] = -2.0e2; /* [rad/s]*/
}

Source files containing UDFs can be either interpreted or compiled in ANSYS FLUENT. For interpreted UDFs, source files are interpreted and loaded directly at runtime, in a single-step process. For compiled UDFs, the process involves two separate steps. A shared object code library is first built and then it is loaded into ANSYS FLUENT.

UDFs allows to customize ANSYS FLUENT to fit particular modeling needs. UDFs can be used for a variety of applications. Some examples include

  • customization of boundary conditions, material property definitions, surface and volume reaction rates, source terms in ANSYS FLUENT transport equations, source terms in user-defined scalar (UDS) transport equations, diffusivity functions, etc.
  • adjustment of computed values on a once-per-iteration basis
  • initialization of a solution
  • asynchronous (on demand) execution of a UDF
  • execution at the end of an iteration, upon exit from ANSYS FLUENT, or upon loading of a compiled UDF library
  • postprocessing enhancement
  • enhancement of existing ANSYS FLUENT models (e.g., discrete phase model, multiphase mixture model, discrete ordinates radiation model)
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.