Determining the Interior Wall Direction in ANSYS Fluent

Boundaries in ANSYS Fluent can be broken into two groups: external boundaries and internal boundaries.  External boundaries appear on the outer boundary of meshed regions (inlets, outlets, interfaces, etc.), while internal boundaries exist within a conformal mesh (interiors, porous-jumps, fans, etc.).  Internal boundaries are not limited to only residing inside a cell zone (for example they can separate two different cell zones); instead their restriction is simply that the mesh be continuous across them.  There is one boundary type that can be used as either an external or internal boundary: walls.

While external walls are fairly self-explanatory, internal walls are called coupled walls (or two-sided walls) because they are actually formed by a pair of wall boundaries that are by default coupled together.  You most often see coupled walls separating Fluid and Solid cell zones, but they can also be used with as infinitely thin baffles with fluid on both sides.  Each coupled wall pair shows up in the boundary list as a zone and its shadow: one for each side of the wall.  Sometimes it is necessary to set different boundary conditions on either side of the coupled wall.

Continue reading

Advertisements

Boundary Condition Setup of Zero Thickness Baffles in ANSYS CFD

Last week we discussed the different ways to create and mesh infinitely thin baffles using the tools in ANSYS Workbench.  In this blog, we’ll discuss how to create and modify baffles using the two flagship ANSYS CFD programs: CFX and Fluent.

CFX:

In CFX, the method you use to specify your baffles depends on your modeling intent, but the way the baffles were meshed will affect some of our choices. The two methods are as a ‘baffle boundary condition’ or defining a ‘baffle interface’.

Baffle Boundary Condition

Baffle walls can be created by inserting a boundary condition into the surrounding domain and selecting the appropriate faces.

bc1

Baffles created this way are for directing flow only!  Boundaries in CFX are always treated as leading to the exterior of the solved domain, which mean information cannot be passed from one side to the other (e.g. no heat transfer across the faces).

Baffle Interface

Alternatively, you can connect one side of a baffle face to the one facing the opposite direction by creating an Interface.

Face selection will depend on whether you made a conformal baffle (Default Method, Option 1, or Option 2 in Part 1 of this blog) or a nonconformal baffle (Option 3).  For nonconformal baffles, you can create Named Selections for each side of the baffle and then pick those from a list.  For conformal baffles, technically only 1 face exists for both sides in the Mesher, so the Named Selection can’t be used to specify side dependent locations.  That being said, conformal baffles will create 2 identical face IDs with different body IDs representing each side, and if you pick them for Side 1, CFX will automatically populate Side 2 with the appropriate pair.

bc2bc3

The interface will then need to be set as a wall, and additional interface models can be specified for the different equations.  For example, for Heat Transfer you can specify that the baffle provides a thermal resistance of a certain thickness of some defined material.

 

bc4

Heat transfer in this case is purely through-thickness.  In other words, heat can flow through the thickness of a metal baffle, but a high temperature would not conduct along the length of the baffle; instead the heat would spread through the adjacent fluid (and then interact with the wall at that the next location).

Fluent:

In Fluent, the method you use to specify your baffles is controlled by how the baffles were meshed, but modelling intent will still affect some choices therein. These methods we will separate between Conformal and Non-Conformal.

Conformal Baffles

Baffles formed by conformal meshes within a Part (Default Method, described last week in this blog) will come into Fluent as a coupled wall, consisting of a boundary zone and its shadow.  These zones represent the two opposite-facing sides of the baffle.

bc5

For the equations other than momentum, each side of the coupled wall can be treated individually or jointly.  For example, the default thermal behavior is to couple each side of the wall together using either a direct mapping of temperature (0 Wall Thickness) or using a specified thermal resistance (nonzero Wall Thickness), but you could instead set one side to have 0 Heat Flux and the other side to be a specific temperature.

bc6

Much like CFX, entering a Wall Thickness will provide a thermal resistance in the through-thickness direction.  However, Fluent additionally has a model called Shell Conduction that allows for heat transfer along the baffle in addition to through it.

Non-Conformal Baffles

Baffles defined by non-conformally meshed faces (i.e. Option 3 in last week’s blog) require different actions depending on whether you are using them to direct flow only or to additionally pass information.

Non-conformal baffles are exterior faces in the mesher, so if you only need them to direct the flow, they will automatically do so without any user intervention (note that if you also have a non-conformal mesh across regions where there are no baffles, you will need to have an interface across those faces).

If you do need to pass information across the baffle (like heat flow), you must create a non-conformal interface using the coupled-wall option.

bc7

This will create 4 addition zones: the Boundary Zones (Side 1 & 2) which are used to control the wall information for areas where the two sides do not line up, and the coupled wall Interface Wall Zones (Side 1 & Side 2) which are used to specify the wall behavior when there is overlap between the two sides.  From here, the coupled wall Interface Wall Zones can be set as described in the Conformal Baffles section, other than that Shell Conduction is not supported (through-thickness heat transfer is still allowed).

One important thing to remember here is that Fluent non-conformal interfaces regularly experience trouble with significant overpenetration between the two sides of the interface.  This typically occurs when there are different mesh sizes on either side of a curved interface.  To combat this, you can enable the Mapped Interface Option, which will use an alternative heat transfer calculation across the coupled wall that performs much better with excessive mesh penetration.

bc8

Meshing Tips for Zero Thickness Baffles in CFD

nobaffleA common technique in distributing ducted flow involves thin guiding vanes, or baffles.  One of the biggest hurdles to modeling baffles is how thin they are relative to the rest of the model.  If you were to model their true thickness, you typically have a choice between poor quality, skewed elements and an excessively high mesh count.  Instead, thin baffles are often approximated as infinitely thin.  There are several ways to create these zero thickness baffles, and the method you choose will affect your meshing strategy as well as your boundary condition setup.  Today we will focus on meshing challenges, and next week in Part 2 we will cover setup in CFX and Fluent.

Default Baffle Meshing; Non-Manifold Faces

The traditional method for creating baffles involves grouping surface bodies and solid bodies into a Part in DesignModeler (or into a Component using the Merge Topology option in SpaceClaim).  This results in a single solid body in the Mesher with internal faces where the surface bodies intersected it.

baffle1

baffle2

These internal faces (with the same body on both sides of the face) are referred to as Non-Manifold Faces, and had to be created using the method above because most geometry editors don’t actually allow non-manifold faces.  In the Mesher, non-manifold faces limit the types of mesh methods that you can use: except in rare cases, you must use tetrahedral elements (which will typically drive up your mesh count and negatively affect the convergence rate)

baffle3

.Inflation on these non-manifold faces is also problematic.  For a finite thickness wall, inflation would simply wrap around the thin face from one side to the other; but for an infinitely thin baffle there’s no way for it to wrap around without producing a degenerate (i.e. collapsed) element.  Instead, the Mesher will stair-step the inflation down to nonexistence by the time it reaches the end of the baffle.

baffle4

Not only does this create poor quality pyramid elements where the stair step occurs, it tends to result in high y+ and bad element transition ratios, which can be just as problematic.  It is generally recommended to fix this behavior using one of the options below.

Option 1: Adjacent Nonconformal Interfaces

The problems listed above stem from the fact that the baffles are composed of non-manifold faces.  The fix is then to convert them exterior faces instead!

Rather than having surface bodies that end in the middle of a solid body, we could slice the model in such a way to make each passage between the baffles its own body, and then combine these bodies into a Part.  We can then give a Named Selection to these faces to be treated as walls.baffle5

The bodies adjacent to these passages will need to be nonconformally meshed though (i.e. be a separate Part so they do not share nodes).  If you were to leave everything as a single Part (or Merged Topology Component), The inflation layers would branch out and produce many of the same problems we saw with the tetrahedral inflation layers.

Option 2: Extending Baffle Faces

A drawback of Option 1 is that it typically results in a lack of mesh refinement immediately downstream of the baffles, which is an area where you often need more resolution.

Instead of placing nonconformal interfaces directly adjacent to the baffles, you could offset these and extend the baffle faces up to these offsets (alternatively you could not use any nonconformal interfaces and just extend the baffles to the ends of the model).  The trick would be to only select some of the faces between these bodies to be baffles.  Any face between bodies but within a multibody part that is not explicitly given a Named Selection will be treated as interior and not block the flow.

baffle6

Option 3: Nonconformal Interfaces as Baffles

The above options use multibody parts to define the baffle locations; if you are using a swept mesh this forces all the passages to use the same number of divisions in the sweep direction.  If each passage were drastically different in size, you might want to use different mesh controls for each passage, while still maintaining hexahedral elements and baffles in between.  This can be done with a noncoformal mesh between the passages.

Like before, each passage between the baffles is split up into its own body, but also remains as its own Part.  Then, we only need to specify where the interfaces go.  Faces where the baffle doesn’t exist will need to be set as interfaces, but baffle locations will only require interfaces if we need to pass data across them (like heat flow, species diffusion through a membrane, etc.).

baffle7

In our next blog, we’ll discuss how to handle the setup of infinitely thin baffles in CFX and Fluent.

 

Convergence Monitoring in ANSYS Fluent

When solving CFD models using ANSYS products, there are a number of ways to determine model convergence.  DRD recommends monitoring a combination of holistic (like individual equation residual values, which are representative of the average error across all control volumes in the model) and local quantities (like surface and point monitors) to ensure a stable, converged solution.

Sometimes you might encounter a situation where one or more residual does not reach its convergence target, but important characteristic features being monitored have steadied to a particular value.  Often this is sufficient for approximating the behavior you are simulating, but other times you may need to strive for more precision.  To do so, it is helpful to be able to determine where in the model there are locally high residuals that are preventing the overall residual value from reaching its target.

residual1

By default, Fluent only exposes mass-imbalance (related to continuity residual) to the user.  When post-processing, this can be found in the Residuals group of variables.

residual2

To access the other residuals, you need to enable a certain expert parameter prior to solving.  Expert parameters can be accessed using the TUI command ‘/solve/set/expert’.  Beyond that, the prompts you receive will depend on your Fluent environment, so we can’t dictate a specific list of responses.  However, to enable the remaining residuals you will need to answer yes to the prompt “Save cell residuals for post-processing?”.

residual3

After solving you should then see more options for plotting residuals, which will allow you to better evaluate where local error is preventing the overall residual from reaching its convergence target.

CFD Postprocessing of Cross-Sectional Average Values – Part 2

Last week I covered a technique for postprocessing averaged cross-sectional values in ANSYS Fluent.  Today, in Part 2 of this blog, I want to cover two additional methods for doing this that is specific to ANSYS CFD-Post.

The first method involves Turbo Mode. It has advantages of better user control over the location and can use either area-weighted or mas-flow-weighted averages as appropriate. The disadvantage is that it is possible the location specification may be non-intuitive and can be complicated for complex geometries.

CFD-Post has a chart tool called Inlet to Outlet that allows you to plot cross-sectional averaged data along the streamwise direction from inlet to outlet of a selected region.  What’s the catch?  Unless you’re modelling Turbomachinery, you have to manually define the region to be used for calculation in terms of a turbo region: hub, shroud, inlet, and outlet.

For a straight pipe, this actually isn’t that hard: the hub can be defined by the axis of the pipe (0 radius, i.e. nonexistent), the shroud simply follows along the outer wall of the pipe, and the inlet and outlet simply connect these two lines.

pipe1

For more complicated profiles, you could alternatively create a Polyline that is defined by the intersection of a plane and the boundary whose profile you are wanting to capture.

From there you will need to define the global rotation axis in Turbo Mode (i.e. the axis of the pipe), specify the lines to define your Turbo region, and Initialize.  This will create a 2D grid defining the revolved region for the calculations.

chart1

After that, you can create the Inlet to Outlet chart as needed.

chart2.png

The second method for doing this postprocessing involves scripting a session file. The advantage here is that you have direct control over location and calculation method and can be generalized to pipes with bends. The disadvantage is that the scripting uses CCL and Power Syntax (i.e. Perl) so you need to be a little familiar with that and you must be running CFD-Post independent of Workbench.

The goal has been to plot cross-sectional averaged data versus length along a pipe, and the brute force method to do that is to average data on a plane normal to the centerline of the pipe and then repeat this at several points along the pipe.  One of the more powerful features in CFD-Post is the ability to record an operation done in CFD-Post and then script the recorded behavior to perform repeated actions.

pic1

Let’s say we’ve already created a plane, Plane 1, and written an Expression, PlanerAve, that will calculate the mass-flow-weighted average of our fuel on Plane 1.  We could then begin a new session file (from the Session menu), start recording, edit Plane 1 to a new location, and then stop the recording.  If we then open this CSE (session) file, we can add some perl commands surround the CCL that directs the plane to loop through a set of locations and store the evaluated expression into an array.  Then, we can have that array printed to a CSV (comma separated value) file for plotting in a third party spreadsheet too like Microsoft Excel.

script

In CFD-Post, we can read this modified Session file back in using the Session menu.

excel1

An example of this script can be obtained by e-mailing support@drd.com.

CFD Postprocessing of Cross-Sectional Average Values – Part 1

pipecontour

In ANSYS CFD, it’s fairly simple to visualize how local cross-sectional profiles vary with respect to pipe length by animating a plane to sweep down the pipe.  However, a question often comes up: what if I want to retrieve quantitative data from this, like a plot of a variable averaged across the cross-section versus pipe length?  It turns out you can do this too, just not using the animation tool.  There are several different methods available to do this with ANSYS and you may choose your method based on your solver – Fluent or CFX.

Today’s post will be specific to Fluent.  In Part 2 of this blog post next week, I will cover how to do this in in the general CFD-Post processor that will be applicable to Fluent, CFX, Icepak or any other program that uses CFD-Post.

The advantage to this method specific to Fluent is that it is a very fast setup. A disadvantage is that there is little user control over location and you must use an area-weighted average which could give misleading data for transported quantities.

When solving using ANSYS Fluent, there is actually a TUI command available to you that will calculate a circumferential average of a selected variable on a selected zone along an axis: /plot/circum-avg-axial.  The command will ask for the variable to average, the surface to calculate on (remember: cell zones have an associated interior boundary zone that represents its internal volume), how many data points to calculate along the axis, and the file to write the data to.  The axis it uses will be defined in the Reference Frame tab of the cell zone associated with the surface you pick.  After it writes a file, you can then read this data into an XY Plot and display it.  One important thing to keep in mind is that the data in the file are just numbers: the axis labels on the screen are controlled by the Solution XY Plot window and are independent of the data in the file.

tui

screen

Automating Fluent Setup Using Journal Files

Many users don’t realize that Fluent contains a number of ways to automate their setup process for large, complicated models.  If you have a number of repetitive tasks within the same model, or if you’re applying similar settings to different models where replacing the mesh or using a settings file is problematic (such as the case of drastically different boundary zone lists), then a Journal file might accelerate your setup process.

First, let’s cover the basics.  A journal file is essentially a collection of TUI and/or Scheme commands that you’ll supply to Fluent in lieu of using the GUI.  TUI commands are those that are native to the Text User Interface and are typically of the form “/menu1 submenu1 submenu2 …. command response1 response2 …”.  Each item in the TUI command is either answering a question from the program or choosing an item from a list, so their format is rigid and depends on the models you have enabled.  Scheme commands on the other hand often give you direct access to a particular item and can be used for advanced techniques like looping and storing variables.  Scheme commands are always surrounded by parentheses “()”, and while many of the specialized Scheme commands within Fluent are undocumented, Scheme itself is a general programming language that can be learned, like C.

The primary way to create a journal file is to manually use the TUI to set up a particular object, write down the sequence of responses that gave you what you wanted, and then modify the inputs for how you will use them in the future.  For example, let’s say you had a large number of inlets that have nothing in common (such that the Copy feature in Fluent wouldn’t be useful).  Manually using the TUI, you might find that the command to set up your 1 m/s, 350 K, 0.1 m hydraulic diameter, 23% oxygen, 77% nitrogen velocity-inlet is:

“/define boundary-conditions velocity-inlet inlet1 n n y y n 1 n 0 n 350 n n n y 5 0.1 n n 0 n 0.23”

You can then duplicate that line and modify the boundary name and input values as appropriate for other inlets, and feed it back to Fluent via a file (File > Read > Journal).  However, if you try to reuse this command in a model that doesn’t have energy enabled, a 2-equation turbulence model enabled, or the specific ordering of species that this example did, you’ll get different behavior or even an error.  This is the primary limitation with TUI commands.

However, there is another way to get the commands to setup an object for modification.  You can record a journal (File > Write > Start Journal), at which point Fluent will keep track of everything you do in the GUI to play back later using Scheme “cx-gui-do” commands.  These commands work by actually instructing the GUI to repeat what had been done previously using your mouse.  The downside here is twofold.  First, setup for a single object is now spread through several lines of code, and Scheme commands are notoriously opaque, so it may be difficult find everything you need to modify.  Second, these commands are actually controlling the GUI when replayed, so it is very easy to accidentally interact with the GUI live and disrupt the journal file.

Lastly, some more experienced users will use journal files to control the solving behavior of a model in addition to the setup.  For example, a journal file could be used to tell the model to iterate for 100 iterations, then switch to transient, and then solve for 500 time steps.  However, Fluent within Workbench doesn’t support using journals for solving.  Instead, it is recommended to use the Automatically Initialize and Modify Case tool found on the Calculation Activities branch.  This allows you to incorporate these solution commands into the case settings so that you can still have a multi-configuration Fluent run while using some of the Workbench features like Parameters and Remote Solve Manager (RSM).