SVG-Viewer needed.

SVG-Viewer needed.

SVG-Viewer needed.

Overview

The TransAT User Manual is a self-sufficient document that provides step-by-step instructions on how to interact with TransAT software, in particular how to setup the simulation, create a grid, setup boundary and initial conditions. It also provides insights on how to execute a simulation and postprocess its output. Furthermore, user defined functions, run time intervention and run quality analysis tools are briefly described herein.

TransAT User Manual


Contents

Contents
1 Rapid User Guide
 1.1 Basic Steps
 1.2 Starting TransAT
 1.3 Objects
 1.4 Grid Generation
 1.5 Simulation Parameters
 1.6 Preparing the Simulation Files
 1.7 Initial conditions
 1.8 Execution and Post processing
2 Project Management
 2.1 Creating a Project
 2.2 Saving and Loading a Project
 2.3 Solver Output Files Management
 2.4 Recovering Input Files
3 Grid Generation
 3.1 3D Viewer
 3.2 Create a geometry
  3.2.1 Creating a geometry
  3.2.2 Load a geometry from the TransAT database
  3.2.3 Load a geometry from an external source
  3.2.4 Object operations
  3.2.5 Object Motion
  3.2.6 Properties of Solid Objects
   Immersed Surfaces
 3.3 CAD File Management
 3.4 Definition of the Domain
 3.5 Grid
 3.6 Blocks
  3.6.1 Mesh Information
  3.6.2 Block decomposition
 3.7 Block Mesh Refinement
 3.8 Boundary Conditions (BCs)
  3.8.1 Assigning a boundary condition to a surface
  3.8.2 SubBCs
  3.8.3 Boundary conditions properties
  3.8.4 Inflow boundary conditions
   Inflow Properties
   Basic
   Turbulence (RANS)
   Oscillatory Inflow
   Unsteady Inflow Generator
   Lagrangian Particle Tracking
   N-Phase Algebraic Slip Model
   Inflow Conditions from Data File
   Chemical Species
   Multiphase Flow Topology
   Pump type
  3.8.5 Outflow boundary conditions
   General
   Backflow properties
  3.8.6 Wall boundary conditions
   Basic
   Interface Tracking
   Wall Conditions from Data File
   Surface Reactions
  3.8.7 Symmetry boundary conditions
  3.8.8 OLGA Coupling boundary conditions
  3.8.9 Cyclic boundary conditions
4 Physics and Numerics Inputs
 4.1 Physical Models
  4.1.1 Basic Equations
  4.1.2 Models and Properties
   Turbulence Modelling
   Compressible flows
   Gravity
   Reference Properties
  4.1.3 Multiphase
   Interface Tracking
   Phase Average
   Phase Change Modelling
   Lagrangian Particle Tracking
   Example
  4.1.4 Multiphysics
   Reactive Flow Modelling
   Hydrate Model
   Radiation
   Viscoelasticity
  4.1.5 Additional Features
   Axisymmetry
   Vibrating Body Force
   Periodic Conditions
   Point sources
   Coupling modelling
   Rotating Reference Frame
 4.2 Phase Properties
  4.2.1 Material Library
  4.2.2 Density
  4.2.3 Viscosity
  4.2.4 Temperature related fluid properties
  4.2.5 Concentration Diffusivity
  4.2.6 Species Diffusivity
  4.2.7 Boussinesq Approximation
  4.2.8 Curve-Fit
  4.2.9 Sutherland Law
  4.2.10 Non Newtonian Fluid
  4.2.11 Compressible Flows
  4.2.12 Radiation Rosseland model
  4.2.13 Viscoelastic model
  4.2.14 Phase Change
 4.3 Phase Interactions
  4.3.1 Momentum Transfer
   Miscibility Table
   Drag Model Table
   Lift Model Table and Coefficient
   Wall Lubrication
   Surface Tension
  4.3.2 Hydrate Properties
   Hydrate Reaction
 4.4 Simulation Parameters
  4.4.1 Control parameters
   Steady Simulation Control Parameters
   Unsteady Simulation Control Parameters
   Other Control Parameters
   SArP (Smart Adaptive run Parametrisation)
  4.4.2 Equations
   Equation Parameters
 4.5 Initial Conditions
  4.5.1 Methods
  4.5.2 Variable tree
  4.5.3 Setting parameters
  4.5.4 File structure
  4.5.5 Advanced Initial Conditions
 4.6 User Defined Functions
  4.6.1 Creating UDFs
  4.6.2 Compiling and Executing UDFs
 4.7 Output Management
  4.7.1 Visualization Files
   Choice of Output Variables
  4.7.2 Post-processing panel
  4.7.3 Restart Parameters
5 Running a Simulation
 5.1 Simulation control
  5.1.1 Running TransAT
  5.1.2 Stopping a Simulation
  5.1.3 Restarting a Simulation
 5.2 Runtime information
   Info: Timing and convergence
   Expert information
 5.3 Screen output
 5.4 Visualization of residuals
  5.4.1 Unsteady simulations
 5.5 Run-time Intervention
  5.5.1 Inputs for run-time intervention
 5.6 Quitting the GUI
6 Settings Guides
 6.1 SArP Guide
  6.1.1 When to use SArP
  6.1.2 Detection of convergence issues
   Residuals based issues
   Solver based issues
   Time step based issues
  6.1.3 Correction And Optimisation
   Evaluations
   Roll-back option
   Stopping criteria
  6.1.4 Speeding up SArP
7 Post-Processing
 7.1 Output Files
  7.1.1 SArP
 7.2 Visualisation with ParaView
 7.3 Visualisation with Tecplot
 7.4 Data Processing
  7.4.1 Non-dimensional numbers
  7.4.2 Time signals probes
  7.4.3 Section Output
8 Command Line Options
 8.1 Environment variables setting
 8.2 Generation of simulation files
 8.3 Running TransAT on a workstation in command line
  8.3.1 Advanced initial conditions
  8.3.2 Running a simulation
   Options
   Examples
  8.3.3 Stopping a simulation
  8.3.4 Restarting a simulation
   Matching restart
   Non-matching restart
 8.4 Running TransAT on a cluster
  8.4.1 Settings
  8.4.2 Advanced initial conditions
  8.4.3 Running a simulation
  8.4.4 Stopping a simulation
  8.4.5 Restarting a simulation
   Matching restart
   Non-matching restart
9 Custom Features
 9.1 TransAT Tools
  9.1.1 Properties Module
  9.1.2 Interfaces to TransAT data structure
   Accessing parameters
   List of accessible parameters
   Accessing variables
   List of accessible variables
   Converting 1D/3D index
   Getting the number of wall cells
   Getting wall quantities
   Getting the cell center index next to wall
   Getting particle quantities
   Other Functions
  9.1.3 Cell-data access and filtering
   Grid
   Cell-markers
   Cell-indexing and looping
  9.1.4 Parallel post-processing
 9.2 Custom Initial Conditions
  9.2.1 User-defined Initial Conditions
   Shape definitions
   Signed distance function
   Example
  9.2.2 Advanced Initial Conditions
   Initial conditions template
   Setting advanced initial conditions in the graphical user interface
   Creating advanced initial conditions file
   Example 1: Wallboiling tutorial
   Example 2
   Running advanced initial conditions
 9.3 User-defined functions
  9.3.1 Creating user-defined functions
  9.3.2 Basic UDF Types
   Paraview Output
   Entry Point
   Source Terms
   Extended Paraview Output
  9.3.3 Extended UDF Types
   Drag Model UDF
   Lift Model UDF
   Wall LubricationModel UDF
  9.3.4 Compiling UDFs
  9.3.5 Compiling UDFs through a terminal
  9.3.6 Running TransAT with user-defined functions
  9.3.7 Adding Additional Files
  9.3.8 Backwards Compatability
  9.3.9 Example of a user-defined function
  9.3.10 Data output along a straight line
 9.4 Advanced UDF
  9.4.1 Embedded Fan
   Creating an embedded jet fan
   Modifying fan volumetric flow rate
  9.4.2 Fire source
   Creating a fire source
   Modifying fire source heat release rate
   Modifying fire source concentration production rate
10 Parametric Analyzer
 10.1 Files
 10.2 Parametric Variables
  10.2.1 Selection of Input, Boundary Conditions and Grid Properties
  10.2.2 Selection of Advanced initial Conditions and User Defined Functions variables
  10.2.3 Add Parametric Variable
  10.2.4 Graphical Representation
 10.3 Execute
  10.3.1 Rearrange parametric variables
  10.3.2 Assemble folders
  10.3.3 Run the simulations
 10.4 Data Analysis
11 Support
 11.1 Downloading TransAT
 11.2 Customer Portal
 11.3 Known Issues
  11.3.1 Error in AMG Agglomerator
List of Figures
12 Engineering Guidelines
 12.1 Moving Objects
  12.1.1 Main Idea
  12.1.2 Tips
 12.2 Hydraulics
  12.2.1 Main Idea
  12.2.2 Practical Steps
   Domain, Grid and Boundary Conditions
   Physical Models
   Post-processing
 12.3 Hydraulic Jump
  12.3.1 Main Idea
  12.3.2 Practical Steps
   Domain, grid and Boundary Conditions
   Physical Models
   Postprocessing
 12.4 Flocculation
  12.4.1 Main Idea
  12.4.2 Modelling Principle
  12.4.3 Practical Steps
   Domain, Grid and Boundary Conditions
   Physical Models
   Run Time
 12.5 Sludge Clarifier - Controlling Separation
  12.5.1 Main Idea
  12.5.2 Modelling Principles
  12.5.3 Practical Steps
   Domain, Grid and Boundary Conditions
   Physical Models
   Run Time
 12.6 Natural Hazards - debris fall and avalanches
  12.6.1 Main Idea
  12.6.2 Modelling Principles
  12.6.3 Practical Steps and Tips
   Domain, Grid and Boundary Conditions
   Physical Models
   Initial Conditions
 12.7 Process Engineering - Chemistry
  12.7.1 Main Idea
  12.7.2 Modelling Principles
  12.7.3 Practical Steps
   Domain, Grid and Boundary Conditions
   Domain, Grid and Boundary Conditions
   Physical Models
   Run Time
 12.8 Process Engineering - Separation
  12.8.1 Main Idea
  12.8.2 Modelling Principle
  12.8.3 Practical Steps
   Domain, Grid and Boundary Conditions
   Run Time tips
 12.9 Thermal Packaging
  12.9.1 Main Idea
  12.9.2 Practical Steps
  12.9.3 Tips
 12.10 Turbulence Study
  12.10.1 Main Idea
  12.10.2 Practical Steps
   Problem Setup
   Turbulence Generation On Coarse Meshes
   mesh Refinement
   Tips
 12.11 Restarting Procedures
 12.12 Level-set - microfluidics
  12.12.1 Main Idea
  12.12.2 Practical Steps
  12.12.3 Tips and Hints
 12.13 Viscoelasticity
  12.13.1 Main Idea
  12.13.2 Practical Steps
   Problem Setup
   Important Things to Look for and Troubleshooting
   Tips
References

Chapter 1
Rapid User Guide

In this chapter the basic steps required to run a simulation using TransAT will be very briefly outlined. The following chapters will then explore these steps in further detail, including descriptions of input parameters, etc.

1.1 Basic Steps

  1. Start the TransAT user interface TransATUI from the terminal with the follwing command:
     transatui.py

    Click PIC to create a new project, then click PIC to select the folder where the project files will be stored or create a new project folder by clicking PIC and specifying its name. Set the Project Name field with the name of the project, e.g. myproject then click PIC to save the project.

    Please note: It is highly recommended to create a new project folder for each project, as some files will always have the same name. (Starting TransAT GUI)

  2. Objects: In the Geo tab, create an object or import a CAD file. (Objects)
  3. Grid generation: In the Mesh & BCs Set the mesh properties and boundary conditions. (Grid Generation)
  4. Physical and numerical parameters: Use the Input tab and navigate inside it to define physical models, phase properties, simulation parameters, initial conditions and the simulation outputs. (Simulation Parameters)
  5. Create the project files: Use the Files menu in the top left corner of the TransATUI window to create the output files containing the mesh properties and the simulation parameters by clicking Prepare Simulation Files. This menu can be used to save the project as well by clicking Save. The preparation of simulation files is also available from the Execute tab. (Preparing the Simulation Files)
  6. Initial conditions: For setting basic initial conditions use the sub-tab Initial Conditions in the main-tab Input. In order to use advanced initial conditions create a file called initialconditions.cxx (e.g. two–phase flow, where the interface between the two fluids has to be specified) and create the initial conditions by using the dedicated button in the Initial Conditions tab (Advanced Initial Conditions)
  7. Run TransAT in the Execute tab. Residuals and other run-time indicators are directly available in TransAT. Post-processing of two- or three-dimensional data can be done using software packages such as Tecplot or freely available Paraview (www.paraview.org). (Execution and Post processing)

1.2 Starting TransAT

TransAT always uses the same names for input files and creates a folder RESULT for the outputs. It is therefore recommended to create a dedicated folder when starting a new simulation.

 transatui.py

A description of the available TransAT commands can be found in the Command Line Options chapter.

The simulation files (grid, boundary conditions,...) will automatically be assigned the given project name when they will be saved later on. Note that the extension of TransAT project files is .stt.

For more information about the creation of projects or files handling, refer to the Project Management chapter.

1.3 Objects

Create Shape  Simple shapes can be created in the Create Shape sub-tab. Also, CAD files can be loaded using PIC. The geometry files must be in either STL or GTS format.
Please note: the CAD files must describe volumes (i.e. closed surfaces where an interior and an exterior can be defined). Database  Different objects from applications ranging from aerodynamics to nuclear engineering can be found in the Database subtab. An object from the database can be loaded in TransAT by selecting the said object in the database and clicking PIC. Objects  In the Objects sub-tab, properties of the object can be adjusted. To do so, click the object in the browser window on the left side. An existing object in the Objects sub-tab can be transformed (rotated, translated or rescaled). As well, CAD files can be loaded directly into the mesh using PIC. The geometry files must be in either STL or GTS format.
Please note: the CAD files must describe volumes (i.e. closed surfaces where an interior and an exterior can be defined).

1.4 Grid Generation

The domain is defined and the mesh is created in the Mesh & BCs tab. In the Mesh & BCs tab at the top of the GUI, several sub-tabs can be selected to set the grid parameters.
Domain & Grid  In the Domain & Grid sub-tab the limits of the computational domain along with the number of cells in the mesh and refinement zones are defined. To define refinement zones, check the Customized Refinement check-box, then set the parameters. Blocks  In the Blocks sub-tab, the domain can be split into several blocks. This allows for parallel computation and speeds up the process, and allows to define more complex domains. BCs  The boundary conditions are specified in BCs sub-tab.

For more information about mesh generation using TransATUI, please read the Chapter Grid Generation.

1.5 Simulation Parameters

The simulation parameters are defined in the Input tab at the top of the GUI.
In the Input tab, the physical properties of the flow to be simulated, as well as the numerical parameters of the simulation are set.

For more information about the Input tab, the reader is referred to the chapter Physics and Numerics Inputs.

1.6 Preparing the Simulation Files

To save a project,

Saving the project stores the current status of the user interface. This does not require much space and is fast. In order to run a simulation from this state, the solver needs additional data files, which are also generated by the user interface. To do so,

The Prepare Simulation Files option creates the necessary data files (grid, boundary conditions,...) to run a simulation, which require more disk space, depending on the size of the domain.

For more information about the files needed by the solver, please refer to the Project Management chapter.

1.7 Initial conditions

Initial conditions can be set:

For the initial velocity field, the default behaviour is to make it divergence-free if the fluids are incompressible. The default initial pressure field is based on the source terms if the fluids are incompressible.

To specify basic interface shapes at the initial state with Level-Set method,

To specify problem-specific initial conditions,

An output file in the format specified in the Input tab will be written in the folder RESULT. This can be viewed using visualisation software and then verified to be valid before proceeding with the simulation. (For more details: see Chapter Running a Simulation)

1.8 Execution and Post processing

Residuals and run-time data can be visualized in real time in the Residuals section on the right-hand side. The full 2D or 3D results can be viewed using software such as Tecplot or Paraview (www.paraview.org); results can be found in the RESULT folder.

For more details see the Running TransAT section and the Post-Processing chapter.

Chapter 2
Project Management


PIC

Figure 2.1: Project Management Tab.


Project management is performed from the opening window of the TransATUI (Fig. 2.1) or by using the options offered by the Files button.

In the opening TransAT window projects can be created and loaded. Files provides the same options with the addition of the possibility to create the files that are needed to run the TransAT solver.

2.1 Creating a Project

After starting TransATUI,

If the Project Name field is not modified before clicking PIC, the default project name newproject will be used.

After clicking PIC, the Mesh & BCs tab will be opened and several tabs will be accessible. To make the simulation ready to run, the simulation files (also called setup files) need to be created. To do so,

2.2 Saving and Loading a Project

Once modifications have been made to a project, they can be saved for future use by clicking Files then selecting Save.

This will not change the simulation files. They need to be re-generated if changes are done in the Mesh & BCs tab. To do so,

A project can also be renamed by clicking Files then selecting Save As.

Please note: The input file transat_mb.inp and the material property file properties.dat, as well as some grid-related files, will always have the same names, independently from the project name. It is therefore recommended to have only one project in a folder everytime.

To load an existing project,

If the simulation files were not generated, it will not be possible to run the simulation directly. The simulation files need to be created in the project folder by clicking Files then selecting Prepare Simulation Files.

2.3 Solver Output Files Management

Before running a simulation, the simulation files must be created for the TransAT solver. The list of simulation files includes:

If a CAD file is used to define a geometry inside the mesh domain, an extra file, which is created automatically, is needed to run the simulation:

In case of coupling TransAT with another software, the Coupling properties file Coupling_parameters.cfg is also written.

A visualisation file is written at the same time as the other simulation files. Its format depends on the visualization software (i.e. either Paraview or Tecplot) chosen in the Output Management sub-tab in the Input tab. Its name is automatically set.

This visualization file is particulary useful to verify the geometry and the simulation domain before running a simulation.

The simulation files can be saved at any time when preparing a simulation, by clicking Files then selecting Save or Prepare Simulation Files.

Please note: All the files are saved in the Project Folder, where the stt file has been saved.

2.4 Recovering Input Files

When running a simulation (See Chapter Running a Simulation), a reference file named transat_mb.out is created, saving all input options in the RESULT folder.

Chapter 3
Grid Generation

Only cartesian meshes can be created using TransATUI. The Mesh & BCs tab gives access to the grid generation modules. There are four tabs on the left-hand side, where all the grid properties can be set.

Geometries in either STL or GTS format can be read by TransAT to generate a 3D mesh with refinements. In TransAT, the meshes are structured per block. The TransAT mesher can be used to generate multi–block meshes, with or without Block-based Mesh Refinement (BMR).

Figure 3.1 shows the tab for grid generation, which contains a preview of the mesh on the right side.


PIC

Figure 3.1: Mesh tab


3.1 3D Viewer

The 3D graphics viewer on the right shows the mesh and the surfaces either in a 3D perspective or in 2D planes, adjustable by the user.

The view icons at the bottom left corner of the visualisation panel offer the options to choose between the 3D view and 2D slices in the x-, y- or z-plane.

To reset the view, click PIC in the bottom left of the window. This will return the mesh to the default view in the current perspective or plane selected. This is useful especially if the mesh is away or outside of the current viewing space. Or, if the mesh is zoomed in or out, the reset view will return the entire mesh within the viewing space.

In 2D view mode, when Cut is activated, the intersection between the grid plane and objects is shown in red.

Note that the Cut option is available only in 2D view mode and is displayed after clicking PIC in the top left corner of the visualisation panel. Once Cut is activated, the grid plane can be changed by using the scroller at the top right corner of the graphical view window.

Other view buttons are also available in the top left corner of the visualization pane by clicking PIC to show or hide them. An image of the mesh can be exported in either JPG or TIFF formats by clicking PIC.

By clicking PIC in the top left corner, the mesh will be reset. This can be used to reset the current domain bounds, reset and remove extra blocks and to reset the mesh around CAD objects. For example, if an object was loaded into the mesh, but the object is not shown, clicking PIC in the top left will rebound the domain around the object.

3.2 Create a geometry

TransAT provides a small geometry module to create simple geometries, that can be used afterwards as solid objects in the setup of the simulation to be run.

3.2.1 Creating a geometry

The geometry creation modules is accessible by clicking Geo at the top of the TransAT window.

The Geo module has three tabs where geometries can be created and modified:

Several shapes can be used to create geometries with TransAT. The shapes of the objects to be created are selected in the drop-down list below the list of objects (dark grey area). The following shapes can be chosen:

A specific name can be given to the geometry to be created by filling in the text field below the shape-selection drop-down list. The geometry is created after clicking PIC.
Once the shape is created it is sent directly to the mesh. The Objects tab can be used to transform objects and modify the properties.

3.2.2 Load a geometry from the TransAT database

To load objects from the TransAT database of objects

3.2.3 Load a geometry from an external source

GTS and STL files can be loaded in the Geo tab. To load a geometry created with an external software

In the Objects sub-tab some transformations can be applied, and properties can be defined for the Objects.

3.2.4 Object operations

Once a geometry has been loaded to the mesh, simple geometric operations can be applied to it: Rotation, Translation and Rescaling.

To apply geometric operations to a geometry

3.2.5 Object Motion

Motion can be specified for a CAD file under the Objects sub-tab. This motion can consist of translation or rotation. The user has two options for defining the motion, either as Specified Motion or Flow Coupled.

Specified Motion forces the Object to move with the given translational or rotational velocity. The fluid will be impacted and react to this motion. It is possible to set translational and rotational simultaneously, as well as multiple directions and axes of motion.

Coupled Motion, as the name suggests, couples the movement of the object to the flow of the fluid. A fluid flow impacting the Object will transfer moment and cause motion in the Object. Again, it is possible to have translational coupling and rotational coupling. Both types of coupling can be activated simultaneously.

To define motion to a geometry

3.2.6 Properties of Solid Objects

The physical properties of solid objects are available for modification in the Objects sub-tab. Figure 3.2 shows what this tab looks like. To adjust the properties for an object, select an object in the list of objects loaded in the mesh (dark grey area). For problems not involving heat transfer, default values may be used. Figure 3.3 shows the window where object properties are set.


PIC

Figure 3.2: Object tab



PIC

Figure 3.3: Solid Properties Window.


To modify properties of a specific object,

If the CAD file contains several objects, the properties of the different objects can be set individually. To do so,

The changes to the properties are automatically saved.

For each solid, the following properties can be defined :

Temperature model and Concentration model define the boundary condition at the fluid-solid interface. They can be of the following types:

Each object is considered as an immersed surface and mesh refinements are applied around each one of them by default. These options can be deactivated.

The deactivation of the Enable for IS Computation option is very useful when several geometries are present and one object hides another.

Note the objects for which Enable for IS computation is deactivated are not exported to new GTS files (see next paragraph). However, they are still taken into account when creating the simulation files.

With the deactivation of the Enable for Grid Refinement option no automatic refinement will be created when selecting Edges Refinement or Blocks Refinement in the Domain & Grid tab (see sections Grid Properties and Multi-Block).

Solve Temperature in Solid can be activated to solve for temperature within an object. Solving for solid temperature is not possible for Conjugate temperature boundary conditions (Dirichlet or Neumann required) Please note: Ensure to activate Temperature under Equations in the Inputs when defining the physics for the simulation.

Optimize Graphics improves the rendering speed for objects loaded into the mesh. This is activated by default, ensuring fast visualization of the object. Un-checking Optimize Graphics will show all details of the object, in case some features were smoothened.

Set CAD as Solid can be used to set Objects as solids (flow obstruction) or fluids (flow domain). This is only possible with one CAD file loaded to the mesh. For the basic use of TransAT, multiple CAD files must all be set as solids. To work around this issue, merge the solids together using a CAD software.
Please note: For advanced techniques to set multiple CAD files as solids or fluids, please contact support at ams@poyry.com

Representation of the Object

Immersed Surfaces is a technique applied for objects in the flow, and applies to all objects for which Enable for IS computation is activated. Immersed Surfaces must be activated if any objects are Enabled for IS computation and properties can be adjusted by clicking PIC. For more information on Immersed Surfaces, refer to the Immersed Surfaces section.

In TransAT, geometries of CAD files are considered as solids by default. This is displayed by the Set CAD as Solid check box. If the CAD file actually represents the fluid domain and not the solid domain, the Set CAD as Solid check box should be de-activated.

For the basic use of TransAT, multiple CAD files must all be set as solids. The check box will be hidden if more than one CAD file is imported into the mesh. To work around this issue, merge the solids together using a CAD software.
Please note: For advanced techniques to set multiple CAD files as solids or fluids, please contact support at ams@poyry.com

Immersed Surfaces


PIC

Figure 3.4: Immersed Surface window


Immersed Surface will enable the use of the Immersed Surface Technology (IST, see Equations and Algorithms manual, Section Immersed Surface Equations ). It is automatically checked when at least one solid object loaded into the computational domain has the Enable for IS computation option activated.

Clicking PIC opens a window to set advanced parameters (Fig. 3.4):

3.3 CAD File Management

Geometry files can be added or removed from TransAT using the Geo tab. Objects can be added through any of the subtabs Create Shape, Database or Objects directly into the mesh.

CAD File Requirements

Given the particularity of the IST technique applied for solids (See the Equations and Algorithms Manual, Section Immersed Surface Equations ), TransAT has some specific requirements with regards to the CAD geometries that can be imported.

Two CAD formats are supported by TransAT, namely GTS and STL formats, with the latter being the widely used format in which geometries are exported by CAD software.

Note that the geometry file must be written in ASCII format to be usable by TransAT. Also, when using TransATUI on a Linux platform, make sure that the geometry file format is appropriate for Linux.

The geometry must respect the following properties:

If you have troubles importing your CAD files, please contact support (ams@poyry.com).

Adding Objects

The PIC button opens a file chooser starting from the current directory to select a geometry file.

After selecting the geometry file and clicking PIC, a window will pop up where units of the objects can be set. Also, the domain boundaries can be adapted for the Object by checking the box Resize Mesh around Geometry.

After the object is loaded, TransAT checks if the object geometry is a Closed surfaces. The Immersed Surfaces Technique in TransAT requiring objects with non-zero thickness, a warning will be displayed if the objects geometry happens to be opened.

Please note: objects representing open surfaces will not be loaded by TransAT.

Removing Objects

The PIC button removes a selected object from the mesh. To do so, select an Object from the list to be removed. Once selected, the PIC is shown above the object list. Clicking this button will remove the selected Object from the mesh.

3.4 Definition of the Domain

The boundaries of the domain are set in the Domain & Grid tab. The domain can then be adjusted thanks to the Multiblock options (See Section Multi-Block). Figure 3.6 shows this Tab. There are several options to modify the boundaries of the domain:

In the Define Domain window, the PIC button resets the domain boundaries back to the default calculated values and the PIC, PIC or PIC can be clicked to change the view.

Also note that the fields are changed accordingly to the position of the sliders and vice versa.


PIC
Figure 3.5: Define Domain window


Please note: Be aware that the boundaries of the domain bounding box must be set before the setting the Blocks parameters. After modifications in the Domain & Grid tab, changes done in the Blocks tab are lost.

3.5 Grid

In Figure 3.6, the Domain & Grid tab, in which cell sizes are set, is shown.


PIC

Figure 3.6: Domain & Grid tab


In this tab the grid density is set by either giving the minimal cell size or the number of cell (Nx, Ny, Nz) corners for each direction. Furthermore, the Cell Ratio between two neighbouring cells (when refining) and the Maximal Ratio between the smallest and largest cell can also be set.

When setting the number of corners, bear in mind that it is advised to to have Nx- 1, Ny - 1, Nz - 1 divisible by 2 many times over. Such numbers of cells give the possibility for Multigrid preconditioning at several levels.

The three check-boxes at the bottom are used to set the type of refinement applied to the grid. The grid can be refined over the whole bounding box of each surface with the Blocks Refinement option as shown in Fig. 3.7, or it can be refined only around the edges of the bounding boxes with the Edges Refinement option as in Fig. 3.8.

After activating the Customized Refinement check-box, the user can choose to refine in the x, y, or z directions from the options shown, as in Fig. 3.9.

To create a refinement zone

Refinements can be done around a point by choosing the Point option or over a Range. in the drop-down menu.


PIC
Figure 3.7: Refinement over whole Objects.



PIC

Figure 3.8: Refinement over Object Edges.



PIC

Figure 3.9: Customized refinement parameters


3.6 Blocks

Defining and setting up multi–block meshes is done in the Blocks tab. There, one can split the grid into several blocks of different sizes, which can then be distributed to several CPUs.

3.6.1 Mesh Information

To obtain general information on the mesh, such as the number of cells or the size of the domain, the user can refer to the information in the Mesh Info panel. To display the mesh information,

In the Mesh Info panel that appears after clicking PIC (see Fig. 3.10), the user can find:


PIC

Figure 3.10: Blocks tab


3.6.2 Block decomposition

The block decomposition is done thanks to the Select Block field, the PIC, PIC, PIC and PIC icons.

3.7 Block Mesh Refinement

For a BMR grid there are some starting parameters for the initialisation and then some tools to modify the resulting grid as needed.

The starting parameters are:

The initial dimensions of the grids are calculated automatically after clicking PIC. They can be further modified. In fact, once the BMR is initialised, all the other tools can be used. In particular:

3.8 Boundary Conditions (BCs)

The BCs tab is used to set boundary conditions on surfaces. To define boundary conditions on objects go to the Object sub-tab in the Geo tab. The BCs tab is shown in Figure 3.14.

A boundary surface is defined as boundary cell faces oriented in the same direction AND being located on the same plane. As an example, Figure 3.15 shows three different boundary surfaces highlighted, where independent boundary conditions can be applied.


PIC

Figure 3.14: BCs tab



PIC

Figure 3.15: Domain BCs


The top part of the BCs tab contains the list of boundary surfaces in the form of a tree. It is used to list and select boundary surfaces. Modify the value in the drop-down list above the boundary surfaces tree to display the boundary surfaces only in a given direction. The boundary surfaces in all directions can be displayed in the list by selecting All surfaces in the Boundary drop-down list.

3.8.1 Assigning a boundary condition to a surface

With a click on the PIC icon, the user can create a new boundary condition. It can then be given a name, and defined as one of the basic types consisting of:

Properties of these boundary conditions can then be defined by clicking on PIC. A description of boundary condition property panels is available in the Section Boundary conditions properties.

Once the boundary condition is defined, it can be assigned to a boundary surfaces. To do this,

The little square will become orange when the selection is effective.

Note that a boundary condition can also be assigned to several surfaces at once. To do so

After the assignment is complete, the surfaces are colored with the color associated to the boundary condition in the boundary condition table.

To see which surfaces have a given boundary condition assigned, select the boundary condition and click PIC.

Please note: boundaries can be directly selected in the view window on the right using Ctrl + left click.

Also note that one boundary condition can be assigned to several surfaces, but a boundary surface can have only one condition assigned. To define different boundary conditions on the same boundary surface, sub-boundary conditions need to be created. Their use is described in the next section.

3.8.2 SubBCs

To create a boundary condition that does not span the full boundary surface,

A new window will be opened where boundary patches can be defined (Fig 3.16). With this tool, boundary patches can be specified on each of the boundary surfaces.

Please note: The SubBC takes precedence over the larger boundary condition and SubBCs cannot intersect each other.

SubBCs can however be created inside another patch (See Figure 3.17). In this case, the smallest SubBC will have precedence over the bigger ones.


PIC
Figure 3.16: Sub-BCs window



PIC

Figure 3.17: BC patches within each other. The smallest patches have precedence over the bigger one, which has precedence over the general BC.


3.8.3 Boundary conditions properties

3.8.4 Inflow boundary conditions

Basic properties for inflow boundary conditions are the temperature of the fluid at the inflow, the bulk velocity and the velocity profile. Other, more specific inflow conditions can be applied. They are described in the following section.

Inflow Properties

Several options exist to specify inflow conditions. Depending on the nature of the inflow, the choices can be narrowed down. They can be accessed by clicking PIC at the corresponding line in the boundary conditions table.


PIC

Figure 3.18: Window for Inflow Properties


Basic

In the Basic tab the essential inflow variables can be set.

Turbulence (RANS)

Turbulence(RANS) has two variables.

The values described above are used for velocity or pressure based inflow with data source from BC or initial conditions.

Oscillatory Inflow

Oscillatory Inflow has three variables.

Please note: Default values of -1010 mean that the feature is deactivated. If values are specified, than the formula for the inflow velocity is:

⃗u = ⃗u  +  ⃗u  ⊙ ⃗a × sin(tΩ + Θ)
     in    in
(3.1)

where ⃗u is the oscillatory inflow velocity, ⃗uin is the inflow velocity specified in the basic tab, ⃗a is Oscillation Relative Velocity, Ω is the Oscillation Period and Θ is the Oscillation Phase Angle.

Unsteady Inflow Generator

Please note: Default values of -1010 mean that the feature is deactivated.

Lagrangian Particle Tracking
N-Phase Algebraic Slip Model

In this tab, Volume fractions and Velocities can be defined for each phase, separately.

Velocities will only be used if the drift velocity model has been enabled (See Section Phase Average Model), otherwise they are ignored and the basic inflow velocity vector will be used.

Inflow Conditions from Data File

When using inputs from data file, the probe coordinates file is compulsory. It stores the coordinates of each probe. These coordinates are given in two dimensions, the third dimension is given by the face location. Thus the y- and z-coordinates must be given for ”west/xmin” and ”east/xmax” faces, x- and z-coordinates for ”north/ymax” and ”south/ymin” faces and x- and y-coordinates for ”top/zmax” and ”bottom/zmin” faces. An example of probe coordinates file is given below:

 0.15 -0.1  
 0.00 -0.1  
-0.15 -0.1  
 0.15  0.1  
 0.00  0.1  
-0.15  0.1

where each line corresponds to the coordinates of one probe.

The time index file is also compulsory. It stores the time instances at which the values are given for each variables. An example of such a file is given:

0.0  
0.1  
0.2  
0.3  
0.4  
0.5  
0.6  
0.7  
0.8  
0.9

Finally, the data files include values of the different variables for each probe at each time instance. It must be written by giving first the values for each probe at the first time point, then the values for the second time point.

Below is an example of a data file.

0 0 10 0 0 10  
1 1 10 1 1 10  
2 2 10 2 2 10  
3 3 10 3 3 10  
14 14 10 14 14 10  
5 5 10 5 5 10  
6 6 10 6 6 10  
7 7 10 7 7 10  
8 7 1 7 7 1  
9 7 1 7 7 1

where each line corresponds to a time instance and each column corresponds to a probe.

If a data file is not found, initial values will be used as boundary conditions.

The boundary conditions will be interpolated in space and time from the data files. If the simulation time is smaller than the first time point, values of this first time point are used. In the same way, if the simulation time exceeds the last time point, values of the last time point are used. Space interpolation is performed using the four probes bordering the cell centre. If no space interpolation can be performed, the value defined by the basic BC definitions will be used.

Chemical Species

Full chemical species inputs are only available if Species and Reaction is enabled.

Depending on the components involved in the reactions, which have been defined in the Reactive Flow Modelling window (see Section 4.1.4), the user can enter the compositions based on one of the following options:

A typical example is shown in Fig. 3.19.


PIC
Figure 3.19: Inflow Chemical Species tab


Multiphase Flow Topology

For multiphase flow simulations with the Phase Average model activated, one of the following inflow Topology Types can be selected (By default None is selected):

For the Horizontal\Vertical Slug the following input parameters need to be specified:

Please note: Horizontal Slug flow or Vertical Slug flow is only available for unsteady simulations.

For the Annular Flow the following input parameters need to be specified:

For the Stratified Flow the following input parameters need to be specified:

For each type of multiphase flow topology a general liquid (slug) part and a general gas part is distinguished, however it is possible to freely choose the composition of each part in terms of phase volume fractions using the inputs under Film\Liquid Composition and Gas Composition. E.g. an annular inflow with liquid droplets entrapped in the bulk gas stream can be defined by specifying some volume fraction of a liquid phase under Gas Composition.

Please note: When using the TransATUI to set up a simulation, for each type of multiphase flow topology a descriptive schematic is displayed describing all parameters that need to be set.

Pump type

A pump type boundary is also available in TransAT. This is particularly useful if the user wants to define an outflow type with known fixed velocity. In order to activate it an inflow should have negative velocity defined (or negative volume/mass flow rate). For the homogeneous model mixture velocity is used to define pump discharge rate, whereas for Algebraic Slip Model both mixture or Phase Velocities can be used to do so. In both cases the void fractions for the pump boundary condition should be set to zero, since they are extrapolated from the domain side. Turbulence parameters are therefore also set based on the values from domain side, and there is no need to define them for the pump.

Please note: For a pump boundary condition the Multiphase Flow Topology option is not available.

3.8.5 Outflow boundary conditions

For outflow boundary conditions, two types of outflows are used:

General

For the Velocity outflow, no further options need to be set.

For the Pressure outflow, two options are available for the Outflow Data Source input:

If a non-zero Pressure loss coefficient is defined TransAT will adjust the boundary pressure value pBC during the simulation according to the following relation

            1    2
pBC = p∞  + 2ζρu¯
(3.3)

where p is the pressure value set for Outflow Pressure, ζ is the value set for Pressure loss coefficient, ρ is the fluid density and u is the bulk outflow velocity, i.e. the average outflow velocity accounting for all the cells that are part of the same outflow.

Please note: The Pressure loss coefficient should be set only for outflows without backflow.

Backflow properties

Backflow properties should be defined for pressure outflow boundary. These are particularly:

3.8.6 Wall boundary conditions

Wall boundary conditions usually set no-slip boundary conditions.

When the temperature equation is solved, the user can define the Temperature or Heat Flux at the wall choice.

Basic

Basic lists the essential wall values.

Interface Tracking

Interface Tracking inputs are only for Level-Set model.

Please note: The film thickness should be less than the grid size near the wall.

Wall Conditions from Data File

When using inputs from data file, the probe coordinates file is compulsory, and includes the coordinates of each probe. These coordinates are given in two dimensions, the third dimension is given by the face location. Thus the y- and z-coordinates must be given for “east/xmax” and “west/xmin” faces, x- and z-coordinates for “north/ymax” and “south/ymin” faces and x- and y-coordinates for “top/zmax” and “bottom/zmin” faces.

An example of probe coordinates file is given below:

 0.15 -0.1  
 0.00 -0.1  
-0.15 -0.1  
 0.15  0.1  
 0.00  0.1  
-0.15  0.1

where each line corresponds to the coordinates of one probe.

The time index file is also compulsory, and includes the time points at which the values are given for each variables. An example of such a file is given:

0.0  
0.1  
0.2  
0.3  
0.4  
0.5  
0.6  
0.7  
0.8  
0.9

Finally, the data files include the value of the different variables for each probe and each time point. It must be written by giving first the values for each probe at the first time point, then the values for the second time point. Below is an example of such a data file.

0 0 10 0 0 10  
1 1 10 1 1 10  
2 2 10 2 2 10  
3 3 10 3 3 10  
14 14 10 14 14 10  
5 5 10 5 5 10  
6 6 10 6 6 10  
7 7 10 7 7 10  
8 7 1 7 7 1  
9 7 1 7 7 1

where each line corresponds to a time point and each column corresponds to a probe.

If a data file is not found, initial values will be used as boundary conditions.

The boundary conditions will be interpolated in space and time from the data files. If the simulation time is smaller than the first time point, values of this first time point are used. In the same way, if the simulation time exceeds the last time point, values of the last time point are used. Space interpolation is performed using the four probes bordering the cell centre. If no space interpolation can be performed, initial values are used.

Surface Reactions

Surface Coverage provides the concentration of the catalyst (in per m2) on the surface. The higher the surface coverage, the higher the intensity of reaction.

3.8.7 Symmetry boundary conditions

The symmetry boundary condition is a slip boundary condition. Velocity normal to the boundary is set to zero, and homogeneous Dirichlet boundary conditions are applied to all the other variables ϕ:

∂ϕ
---= 0
∂n
(3.4)

where n is the direction normal to the boundary.

3.8.8 OLGA Coupling boundary conditions

An OLGA coupling boundary condition must be defined giving three different set of parameters:

3.8.9 Cyclic boundary conditions

Cyclic (periodic) boundary conditions will copy the values of all variables at one boundary to the cells of the other boundary (see Fig. 3.20). Pressure forcing can be set in the Physical Models tab by activating the Periodic Conditions check-box and opening its properties window. Details about pressure forcing settings for periodic BCs are available in the section Periodic Conditions.

The settings take effect for surfaces where cyclic BCs have been set. Cyclic BCs must be assigned on all surfaces in the directions where the pressure forcing term is enabled. Cyclic BCs require careful setup and in general are applied to domains with simple geometries.


PIC

Figure 3.20: Cyclic boundary conditions


Chapter 4
Physics and Numerics Inputs

In the Input Tab, all the inputs concerning Physical Models, Phase Properties, Phase Interactions, Simulation Parameters and Output Management are defined, using the different available pages.

4.1 Physical Models

Clicking the Physical Models button enables the user to choose the equations to be solved, and the physical models to be used. A view of the Physical models page is presented in Figure 4.1.


PIC

Figure 4.1: Physical Models Page


The tab is split into five sections.

4.1.1 Basic Equations

The first thing to do is to select the equations to be solved for during the simulation. This is done in the Basic Equations section. The following equations can be selected by checking the small squares next to them (they are colored in light grey when deactivated and in orange otherwise):

4.1.2 Models and Properties

The base models are found in the Models and Properties section. These include Turbulence Modelling, Compressibility, Gravity and Reference Properties.

Turbulence Modelling

Clicking the Turbulence Modelling check-box activates a model for turbulent flows. Three families of methods are available: RANS (Reynolds-Averaged Navier Stokes), LES (Large Eddy Simulation) and V-LES (Very Large Eddy Simulation). For more information on the theories underlying these methods, the user can read the Turbulence Theory Manual, Chapters Two-Equation Turbulence Models and Scale Resolving Strategies: LES and V-LES RANS  To use a RANS model, the user should choose RANS in the Turbulence Modelling list.

Clicking PIC opens a new window (Fig. 4.2) where the different parameters of the model can be defined.


PIC
Figure 4.2: RANS Parameters window

For the description of the K-Epsilon Model, see the Turbulence Theory Manual, Chapter Two-Equation Turbulence Models . With the k - ε model, one must choose:

Extensions to the basic two-equation model can be chosen if necessary. Details of the extensions are available in the Turbulence Theory Manual, Section Extensions to k - ε Turbulence Model .

The different k-epsilon model constants can then be set. Defaults values for σk, σε, Cμ, Cε,1 and Cε,2 are the values proposed by Launder & Spalding (1974). Value for cε,3 is determined by the stability of flow stratification, and is between 0.8 and 1.0 for stable stratification and close to 0 for unstable ones (See the Turbulence Theory Manual, Chapter Buoyancy-Driven Turbulent Flows ).
Default Inflow Conditions values must be defined for the following properties:

If the value has already been defined for an inflow BC, this value will have precedence over the value defined here.
Default Wall properties may also be defined in this window. The user can define the default inflow wall roughness (default roughness at the inflow) and the wall roughness. LES  To perform a LES simulation, the user should choose LES in the Turbulence Modelling list. Clicking PIC opens a new window (Fig. 4.3) with the available options for LES. For theory on LES, the reader is referred to the Turbulence theory manual, Section Large Eddy Simulation
The first step is to choose the Subgrid Scale Model (SGS) that must be used. The following models are available in TransAT:


PIC

Figure 4.3: LES Parameters window


For more information about these models, the reader is referred to the Turbulence Theory Manual, Chapter Large Eddy Simulation and Very-Large Eddy Simulation   Turbulent Prandtl number  Turbulent Prandtl number can be computed using either the Dynamic model or Kays model. It can also be set as a constant. In this case, the constant value must be given as an input. The dynamic model for the Prandtl number is only available if the dynamic subgrid model is used. For more information, the reader is referred to the Turbulence Theory Manual, Section Turbulent Prandtl Number .   Near-Wall Treatment  A Wall Force Calculation can be applied for the LES simulations. One can choose if mean velocities or instantaneous velocities should be used for the near-wall treatment. The available wall boundary type functions are:

For more information about these functions, the reader is referred to the Turbulence Theory Manual, Section Wall-functions in LES .

With the Smagorinsky model, one can choose a near-wall damping, using Deardorff-Werner model or the Schmidt and Schumann model. In the latter case, the constants C2inh and kappa must be given.   Other Parameters  In some cases, the flow tends to become laminar at the beginning of LES simulations. To avoid this behaviour, the user may uncheck the Recalculate Wall shear box. In this case, initial wall shear is used during all the simulation. Another possibility is to give a Recalculation interval: a value of n means that the wall shear is recalculated every nth step.

Initial Perturbation: Checking this box will enable the initial velocity field to be perturbed using a random signal, which may enable the flow to reach the statistical steady-state faster. The amplitude of the perturbation is specified with the input variable Perturbation Amplitude, which is in m/s. V-LES  To use the V-LES model, the user should choose V-LES in the Turbulence Modelling list.

Clicking PIC opens a new window, pretty similar to the Fig. 4.2, specific to RANS model. The only difference is that a V-LES filter width can be given, which is used to filter the k -ε equations. A lower value will make it closer to Large Eddy Simulation (although with a different subgrid model) while a large value will make the solver use standard k - ε equations.

For more information, see the Turbulence Theory Manual, Section Very-Large Eddy Simulation Concept . Turbulent Heat Flux Modelling  When solving for temperature along with the RANS turbulence model, a Turbulent Heat Flux (THF) model must be chosen. The different models and available parameters can be chosen and tuned by clicking PIC. In the Turbulent Heat Flux properties window several models can be chosen from:

The models can be sorted by increasing complexity (based on the number of additional equations to be solved) as shown in Figure 4.4.


PIC

Figure 4.4: Turbulent heat flux modelling overview, where kT represent the variance of the temperature fluctuati ons θ2 and eT represent the dissipation rate of the heat fluxes εθ.


SGDH, GGDH and WET models do not require any additional equation to be solved even if the θ2 equation can be solved based on user-choice. The THFM model requires the solution of 5 equations to solve for the turbulent heat flux explicitely. A more comprehensive description of the different models and required inputs or parameters can be found in the Turbulence Theory Manual, Chapter Turbulent Heat Flux Modelling.

When any of the aforementioned models is activated, some additional simulation outputs can be chosen, namely the turbulent heat flux, the intensity of the temperature fluctuations and the dissipation rate of the temperature fluctuations.

Compressible flows

The Compressibility check-box in the Physical Models page activates the compressible solver of TransAT.

The window where compressibility parameters are set is displayed after clicking PIC (Fig. 4.5).


PIC

Figure 4.5: Compressible Flow window


The drop-down list at the top sets the Density interpolation method. First-order upwind method is more adapted to high-speed flows, while second order central method is better for low-speed flows.

The next input is the Contrast factor for Schlieren image. TransAT can output numerical Schlieren variable for compressible flow, and this factor sets the contrast resolution. Numerical Schlieren images are evaluated by

               |δρ|
schlieren = e- κ|δρ|max,
(4.1)

where κ is the contrast factor and |δρ| is the magnitude of the numerical density gradient. To enable the output of Schlieren images: go to the Output Management tab (Fig. 4.36), then click Output Variables > . This opens the Output Variables window (Fig. 4.35). Finally, check Numerical Schlieren Image.

In the window to set the compressibility model parameters The user can also set the System Pressure. Indeed, unlike incompressible solver, compressible solver must use the absolute pressure. The pressure defined at the boundaries has to be set as gauge pressure. System pressure ps can then be used as a differential pressure: we have the equation

pabsolute = pnumerical + ps
(4.2)

where pabsolute is the absolute pressure and pnumerical is the pressure that is used and output by TransAT.
If the user wants to output the pressure values around average numerical pressure, he can check the box Automatically adjust system pressure. With this option, the system pressure evolves with time. This is useful when one wants to track small pressure variations, for example when solving acoustic waves. Recommendations 

Gravity

Activating the Gravity check-box allows for adjusting the Gravity vector. Clicking PIC at the right of Gravity opens the gravity sub-window. This allows the user to define the components of the gravity vector. Its components must be given in S.I. units. When gravity is non-zero, the Hydrostatic pressure source term will be automatically enabled for multiphase flows.

Reference Properties

Reference Properties can be activated with the check-box. Clicking PIC at the right opens the reference properties sub-window. Reference values for different variables can be defined:

With the exception of the reference temperature, which is used when the Boussinesq approximation is applied (section 4.2.7), these values are not used for numerical simulations, only for evaluating the non-dimensional numbers of the simulations and for post-processing. All the values are given in S.I. units.

When the user does not provide a reference value for a property, a default value is automatically set. In the case of the reference length, the automatic default value is -1. Then a length scale is automatically computed from the simulation files at the beginning of any simulation. This automatic value will be used only if no user value has been specified. A message is displayed when launching a simulation which summarizes the different length scales and specifies which one will be used. The automatic length scale is computed as the minimum of:

Reference Concentration is also available. It is used to determine the buoyancy effects when solving the concentration of a scalar.

4.1.3 Multiphase

By default on opening TransAT, the Multiphase models will be displayed. If this is not the case, clicking Multiphase will display these models. The models available in the Multiphase section includes Interface Tracking, Phase Average, Phase Change, and Lagrangian Particle Tracking.

Interface Tracking

The check-box Interface Tracking enables using an Interface Tracking Method (Level Set). The user should first activate the Interface Tracking check-box then click PIC to define the parameters of the model. More information is available in the Multiphase Theory Manual, Section The Level Set Method for Level-Set and The VOF methodology for Volume Of Fluid (VOF). Please note: when using a multiphase flow method, initial conditions must be defined for the interface or for the initial volume fractions. See Section Creating Initial Conditions to define initial conditions. Level Set Method  The more feature-rich interface tracking method in TransAT is the Level Set method. The window where its properties are set is shown in Fig. 4.6


PIC
Figure 4.6: Level Set properties window

  Interface calculation parameters  Several numerical parameters are available for the Level-Set computation:   Bubble Nucleation Model  Bubbles can be inserted during the simulation at a given time by the user.

In the Bubble Table the relevant parameters of the bubbles, such as the position and the time where they should appear, are stored.

TransAT will automatically modify the level-set field to add this bubble when the nucleation time is reached.

A second table, Mdot Table is present in this window. It allows for defining regions with different rates of phase change. This is available only when the phase change correlation is set to fixed (see Multiphase Theory Manual, Section Phase Change Modelling ).

The first column stores the mdot value that must be assigned to this region, and the next columns store the parameters to locate the boundary of the regions.   Marangoni Model  The Marangoni model enables a temperature-dependent surface-tension model. One must specify the temperature T weber at which the reference surface tension (as defined in the Level Set Properties window) is given and the temperature at which surface tension is zero (T crit). For more information, see Multiphase Theory Manual, Section Marangoni Effect .   Redistancing 

  Recommendations  Volume Of Fluid  The window where VOF properties are set is shown in Fig. 4.7. Currently the user only needs to set the surface tension value in the VOF properties window. Features such as Marangoni effects and phase change are not available for the VOF method. For more information on VOF method, see the Multiphase Theory Manual, Section The VOF methodology .
PIC
Figure 4.7: VOF properties window

  Recommendations 
Phase Average

The check-box Phase Average enables using the Homogeneous model or Algebraic Slip model (ASM). The user should first activate the Phase Average check-box then click PIC to define the parameters of the model. The Algebraic Slip model adds Drift Velocities to the Homogeneous model. More information is available in the Multiphase Theory Manual, Section Phase-Average Multiphase Flow Modelling for the Homogeneous model and ASM.

Please note: when using a multiphase flow method, initial conditions must be defined for the initial volume fractions. See Section Creating Initial Conditions to define initial conditions.

Homogeneous Model   
To enable the Homogeneous model,

With this model, up to ten different phases can be modelled.


PIC

Figure 4.8: Homogeneous Model window


A turbulent dispersion term can be added, which adds to the drift velocity a term due to turbulence. This term allows for a better description of mixing for turbulent flows.

Please note: The turbulent dispersion term is only available when turbulence is being modelled. Additionally, it is enabled by default if turbulence modelling is activated.

For more information on the Phase Average Mixture Model, please refer to the Multiphase Theory Manual, Section Phase-Average Mixture Models

Suspension viscosity model can be turned on in order to modify the viscosity of the mixture as an effect of the phase volume fractions. The user has to give the state of each phase of the mixture. Suspension viscosity model has then to be defined for each type of dispersed phases: bubbles, droplets and/or particles. Choices are as follows:

The Maximum packing volume fraction must also be given, which is the maximum volume fraction that can be occupied by the particles phase, For more information, see the Multiphase Theory Manual Mixture viscosity .

ASM Model   
An extension to the homogeneous model is the algebraic slip model. To enable ASM,

The window as in Fig. 4.9 is used to set the general parameters for ASM. Some of the parameters are the same as in the homogeneous model (turbulent dispersion and suspension viscosity model). By choosing the algebraic slip model, drift velocities will be activated which will make the velocities of the phases different from each other. Drift velocity will then be computed as a function of the pressure gradient. This can be set in the Pressure gradient approximation drop-down menu. If Hydrostatic is selected instead, the pressure gradient is computed by ρg, allowing for faster computations.


PIC

Figure 4.9: ASM Window


For ASM, drag, lift and wall lubrication models need to be defined. These models are chosen within the Phases Interactions tab, Momentum Transfer section. Refer to 4.3.1 for information about defining the interphase slip models. Examples of the interphase slip models include; drag models of stokes, clift, tomiyama and schiller; lift models of auton and tomiyama; and wall lubrication models of antal, frank, hosokawa and tomiyama. The slip models are described in the Multiphase Theory Manual, Section Algebraic Slip Model .


Phase Change Modelling

This section describes the Phase change modelling capabilities of TransAT. Phase change modelling is turned on by clicking the corresponding check-box. Currently, phase change is available with Level-Set and Phase-Average multiphase models.

Clicking PIC opens the Phase Change Parameters window.

Please note: The options displayed in the Phase Change Parameters window depend on the type of Multiphase Flow Method selected (i.e. Level-Set or Phase Average).

For the Level-Set method (Fig. 4.10) the following phase change correlations are available:


PIC

Figure 4.10: Phase Change Properties window with Level-Set multiphase model


Curvature correction of saturation temperature will adjust the saturation temperature as a function of liquid-gas curvature and surface tension (available only for Level-Set).

Meniscus model accounts for heat transfer near the triple point (solid-liquid-gas point). It can only be used when the Correlation is set to none.


When using the Phase Average multiphase model, the following options are available (Fig. 4.11):

Please note: With the Phase Average model, phase change occurs between phase 1 and 2 only. This means that if the phase change model is activated, the state of the first two phases must be Liquid and Gas.

Please note: With the Phase Average model, wall phase change will not be applied for immersed surfaces of conjugate objects.


PIC

Figure 4.11: Phase Change Properties window with Phase Average multiphase model


The Latent Heat Method input offers two options for the value of the latent heat:

The Thermally Limited Phase Change option is available only if solving for Temperature. It contains the following entries:

The Inertial Phase Change / Cavitation model section is available for both compressible and incompressible flows. Two cavitation models are available:

The Psat method can either be

For more information on Phase change models, please refer to the Multiphase Theory Manual, sections Phase change modelling (for Level-Set method) and Phase change in the bulk (for Phase Average method).

Saturation Curve  The saturation curve is defined within the Phase Properties. Phase 1 and 2 will have a Saturation Curve method available to choose from. This allows pre-defined curves from Ammonia or Water. Also, the Antoine equation is available, with the corresponding A, B and C model parameters. If using the Antoine equation, model parameters for various materials can be found in literature or reference material. The saturation curve for phase 1 and 2 must be the same (i.e. same Antoine model parameters, or defined from the same phase). More information about defining the Saturation Curve is available in the Phase Properties section 4.2.14.

Lagrangian Particle Tracking

It can be used by selecting the Lagrangian Particle Tracking Model in the Physical Model tab. The particle positions and velocities are updated at each time step in conjunction with the carrier flow field which evolves in time. Particle Tracking theory is available in the Multiphase Theory Manual, Chapter Particle Tracking Models . Properties  Here is a list of available parameters that can be set by the user in the Properties tab of the Lagrangian Particle Tracking window.

Physics  Here is a list of available physical models that can be set by the user in the Physics tab of the Lagrangian Particle Tracking window. Forces  Here is a list of forces that can be calculated by TransAT. They are available in Forces panel.

Please note: The forces that are to be included are to be explicitly chosen by the user based on the relevant physics of the problem at hand. None of the forces are hard-wired. For example, in the case of bubbles it is left to the user to turn on the added-mass force. Numerical  The Interpolation method is the order of interpolation to evaluate the fluids properties, such as velocity, temperature, …at the location of the particle.

The Time integration provides methods to solve the particle variables such as velocity, position, temperature, angular velocity. Time stepping control is the method of controlling the time step: fluid CFL number or response time can be used.

The parameter Response time factor is used to return the maximum allowable time-step from the particle side. The smallest particle response time (τp,min) is multiplied by this value to arrive at the maximal time-step. Response time factor can be as high as 0.9 for 4th order Runge-Kutta time integration and should be maintained below 0.4 for the Adams-Bashforth and 2nd order Runge-Kutta methods. Initialise  In Initial Particle Location, the user can define the initial position of particles as the intersection of Primary and Secondary Volumes.

The parameter Random Series with the option fixed allows repeatability when using random numbers (to initialise the particle positions). The geometrical properties of these volumes has then to be defined.

In this intersection, the Particle Distribution can then be defined. If it is random, defining the Random series as fixed, allows repeatability when using random numbers to initialise the particle positions. Changing Random seed changes the random distribution for fixed random series.

In the panel Initial Variable Values, checking Velocity equilibrium will initialise particle velocity equal to the fluid velocity. Otherwise, Mean velocity and RMS velocity must be given.

Temperature equilibrium uses fluid temperature as initial particle temperature. If it is not checked, Initial temperature can be defined for particles.

Angular velocity equilibrium uses fluid angular velocity as initial particle angular velocity. If it is not checked, Initial angular velocity can be defined for particles.

Read particle data from file initialises particles with parameters defined in read_particle.ini. Each line represents the set of parameters used to initialise a particle. The set of parameters that must be defined are:

read_particle.ini should be formatted as such:

  tinit_p d x_p y_p z_p u_p v_p w_p (T_p) 
  ...
Example

In the following example, two particles with the following parameters are initialised through read_particle.ini:

Particle 1

Particle 2

The corresponding read_particle.ini file consists of the following lines:

  0.0 0.0005 2.0 0.0 0.0 0.0 0.0 1.0 300 
  5.2 0.001  0.0 3.0 1.0 0.5 0.5 0.0 350

Particle 1 will be initialised at the beginning of the simulation (t = 0s). Particle 2 will be added at the specified location with the specified properties after the simulation has reached a time of t = 5.2s. Particles with negative time values will be initialised at the beginning of the simulation. Boundary Conditions  The Wall interaction defines the behaviour of particles when they hit a wall. They can be Reflected or Absorbed. Wall friction coefficient and coefficient of restitution can also be given.

Symmetry interaction defines the behaviour of particles when they hit a symmetry boundary, in the same way as for a wall. Particles can be Reflected or Absorbed.

Particle Inflow Type is used for inflow condition. If Per cell is selected, particle volume fraction for the inflow will be verified for each cell. With Per boundary, only the average for the boundary will be verified, and volume fraction can vary from cell to cell.

The parameter Random Series with the option fixed allows repeatability when using random distribution of particles for boundary conditions. Changing Random seed changes the random distribution for fixed random series. Output  In Variables for Output, Particle Step defines the ratio between simulated particles and output particles. If the value is more than 1, Random Output enables one to select particles randomly.
The particles variables to be output have then to be defined.

The following options can be selected:

Finally, Post Processing provides several outputs to be written as functions of time during simulations.

Please note: The format of the particles_leaving.dat file written by selecting the Store particles leaving postprocessing option is compatible with the feature Read particle data from file in the Initialise tab. These files can be used for example to simulate the transition of particles into an adjacent domain

4.1.4 Multiphysics

The Multiphysics section of the Physical Models contains more physics models. Clicking Multiphysics will show these available models. The Multiphysics models include the Species and Reaction, the Hydrate Model, the Radiation Model and the Viscoelasticity Model.

Reactive Flow Modelling

Activating the reactive flow solver of TransAT is done by checking the box Species and Reaction. The window for the model properties (Fig. 4.12) opens after clicking PIC.

Please note: As of TransAT version 5.7 the surface and porous interface reaction modules are deprecated and not available anymore in TransATUI.

The Cantera library can be used with TransAT to evaluate material properties and import complex reaction mechanisms. If the Cantera database is used an input file (cantera_input.cti) has to be in the working directory. The syntax of the Cantera input file is described in the section Cantera Input File document Cantera_Input_Manual. Theory for reactive flow modelling is available in the Equations & Algorithms Handbook, Chapter Reactive Flow Modelling


PIC

Figure 4.12: Reactive Flow Properties window


The definition of a reaction in a mixture consists in three main steps:

Reaction Model  The reaction rate is modelled using the finite chemistry approach with Arrhenius reaction constants, called Mass Action Kinetics. The reaction rate is proportional to the reaction constant and the reactant concentrations raised to the reaction order. More detail can be found in the Define the reactions section.

Number of Subiterations is the number of subiterations over all the species transport equations in every global iteration. This should be increased if the species are strongly coupled, or for problems with fast reaction and high heat release (i.e. combustion).
Constraint Species If this check-box is activated, a transport equation is solved for each of the species. If this box is deactivated the mass fraction of the species with the highest average mass fraction is calculated as one minus the sum of the remaining species mass fractions.   Cantera Phases  The Cantera Database checkbox has to be activated if the Cantera database is used for evaluating properties or importing reaction mechanisms. In this case an additional input file cantera_input.cti has to be present in the working directory. (See also section cantera input file). If the Cantera database is activated the text input fields in the Cantera Phases frame have to be completed. For homogeneous reactions it is sufficient to add a name in the Fluid field.   The Cantera input file  For most cases the syntax of the Cantera input file is simple. Here, we will consider a case with one reaction and three components. First an ideal gas mixture needs to be created. It should use the same name that was used in the TransATUI (Mixture Input) for the fluid phase in the frame Cantera phases. In this example the name ‘gas’ was chosen.
 ideal_gas(name = "gas",  
           elements = "H O",  
           species = "gri30:O2 H2 H2O"  
           transport = "Mix"  
          )

The mixture contains the species O2, H2, H2O which contain the elements H and O. The elements always have to be the element name in uppercase letters because some data (e.g. molar weights) are directly linked to these elements. The term gri30 in front of the species names indicates that the thermodynamic data and the transport properties are imported from the gri30 (gri30.xml) mechanism.

Note that species can be imported from any mechanism that is present in the folder
transatMB/properties_database/cantera_data in the xml format.

The transport keyword defines the transport manager used for the transport properties. The mixture transport model is the appropriate model to be used with TransAT. To define the reaction add:

reaction( "2 H2 +  O2 =>  2 H2O",   [1.0, 0, 45])

The terms in square brackets specify the Arrhenius reaction constant ([“pre-exponential factor”,“temperature exponent”, “Activation Energy”]).

Several sample input files are present in the aforementioned folder cantera_data.

  Diffusion Model  The simplest model is to use the same coefficient for all species: set the Diffusion Model to Constant, and set the constant value of the Diffusion Coefficient.

A more accurate model available is the mixture model. The mixture model can only be used in conjunction with Cantera. The diffusion coefficient of species k is evaluated under the assumption that all other species have equal diffusion velocity. This leads to a mixture diffusion coefficient Dkm for every species. As unequal diffusion coefficients do not guarantee conservation of mass (the mass weighted diffusion velocities do not sum to zero), a correction has to be applied to ensure mass conservation. This can be done by constraining one species, which is particularly convenient when one species is always in excess (see Solve constrained component).   Define the components and their properties  The components can be added by clicking the PIC button below the Components table. A new line will appear in the component table where one can enter the component name in the first column and specify the molar weight in the second column. By default the properties of the mixture are constant and set in the Phase Properties window.   Define the Reactions  Having defined all the components the next step is to define the reactions. Note that only simple homogeneous reactions can be defined with TransATUI. Homogeneous reactions with a more complex reaction rate expression such as pressure-dependent reactions can only be specified in the Cantera input file. To learn how to define reactions in the Cantera input file refer to the document Cantera_Input_Manual.

If the Cantera database is used (i.e activation of Cantera Database), all the reactions have to be defined in the Cantera input file.

To define a new reaction,

The reaction definition should now appear in the Reaction column.


PIC
Figure 4.13: Reaction Creator Window


To delete a component or a reaction, check the delete check-box at the lines corresponding to the items to be removed then click PIC below the table.

Reactions can also be edited by clicking edit at the corresponding lines in the list of reactions.

Hydrate Model

The Hydrate Model can be used to define interactions between phases. Activating Hydrate Model will allow the user to edit the Phase Interactions. In order to activate the Hydrate Model, Phase Average needs to be activated with at least three phases. More information can be found in the Phase Interactions section.

Radiation

This section describes the Radiation modelling in TransAT. Radiation is activated by clicking on the checkbox adjacent to it.

There is one option only: Rosseland model.

In the Phase Properties, the user can enter the coefficients for all phases and specify the different radiation bands to be taken into account. For a particular band, a separate set of coefficients can be entered, making the formulation flexible to accurately calculate the Rosseland Extinction Coefficient.

Note that solving for the temperature equation is required to activate the radiation model, and that for multiphase problems, the homogeneous or Algebraic Slip models have to be used, whereas it is not possible to use the level-set model.

Viscoelasticity

This section describes the viscoelasticity modelling capabilities in TransAT. Viscoelasticity is activated by clicking on the checkbox adjacent to it.

There are several model options to choose from: Oldroyd-B., linear PTT and exponential PTT. The model choice will determine the complexity of the modelling and the number of model parameters required. In addition, the user must specify the number of viscoelastic modes considered in the problem, and specify if the LCT formulation (Logarithm of Conformation Method) is to be used.

In the Phase Properties, the user can enter the model parameters for each phase and each viscoelastic mode, by selecting Non-Newtonian in the viscosity method, and Viscoelasticity in the drop-down lists. Depending on the choice of the model, the following model parameters may be required:

In addition, it is possible to include a temperature dependence of the polymeric viscosity to the temperature by activating the Arrhenius Tmperature Dependence model.

4.1.5 Additional Features

Additional Features

contains supplementary geometric and physical models. The Additional Features include Axisymmetry, Vibrating Body Force, Point Sources, 1-D Coupling, and Rotating Reference Frame.

Axisymmetry

Axisymmetric flows can be solved for with TransAT by checking the Axisymmetry check-box.

In axisymmetric setups, cylindrical coordinates are used instead of Cartesian ones. Note that axisymmetric simulations are limited to the x-y plane, with y representing the radial component and x the axial component. The axis of symmetry is defined at the line y = 0 (and therefore along the x-axis).

For more information, please report to the Equations and Algorithms Manual, Section Axisymmetry .

Vibrating Body Force

An oscillating force can be applied with TransAT by using the Vibrating Body Force capability. To apply an oscillating force,


PIC

Figure 4.14: Body force window


Periodic Conditions

When cyclic boundary conditions are used, a pressure source term can be added. This is done in the Periodic conditions panel (Fig. 4.15). To apply pressure forcing to cyclic BCs,

A choice drop-down can choose between defining a superficial velocity or pressure gradient. Next, a spinner shows for which phase to set a velocity or pressure gradient. It is therefore possible to have a different magnitude and direction of pressure forcing for each phase.

Superficial velocity specifies a bulk velocity in the fluid domain, i.e. the space-average velocity over the whole fluid domain. It is not possible to define a velocity profile. However, a fully developed flow will naturally occur from periodicity during a transient phase early in the simulation. This profile is dependent on the geometry for the flow.

If defining pressure gradient instead of the superficial velocity the pressure source term is directly set. The user must define the components of the source term in the desired directions.

The settings take effect for surfaces where cyclic BCs have been set. Cyclic BCs must be assigned on all surfaces in the directions where the pressure forcing term is enabled. Cyclic BCs require careful setup and in general are applied to domains with simple geometries. To assign cyclic boundary conditions to surfaces the reader is referred to Assigning a boundary condition to a surface.


PIC

Figure 4.15: Periodic Pressure Forcing Panel


Point sources

Point sources can be positioned in the domain by activating the Point sources. After activating Point sources, the PIC icon will appear.

To create point sources and set their parameters

To define a point source, the following parameters need to be set:

Also note that a point source can be deleted by clicking Delete at the end of the corresponding line in the point source table.

Coupling modelling

The Coupling modelling of TransAT can be enabled by clicking the corresponding check-box. The coupled code has to be chosen among the list:

When coupling modelling is enabled, next the coupling parameters need to be set.

The coupling algorithm parameters are listed as follows:

The exclusive parameters for OLGA(Fig. 4.16) are listed as follows:


PIC

Figure 4.16: OLGA coupling Model window


Rotating Reference Frame

A rotating reference frame can be defined with TransAT by checking the Rotating reference frame check-box.

Opening the properties window for defining a rotating reference frame, inputs are available to define the center of rotation as well as the angular velocities for the rotation. The angular velocity is defined in radians per second. After clicking PIC to save and close the settings, the rotating reference frame will be applied once the simulation is executed.

4.2 Phase Properties

When clicking the Phase Properties button, the Phase Properties page is opened, as shown in Fig. 4.17.


PIC

Figure 4.17: Phase Properties


The properties of the phases are defined in that page. It is separated in two sub-windows:

The sheet provides input boxes to enter in values of the various properties. The catolog gives an overview of all the phases and properties per phase. By default, the tree is collapsed, but can be expanded by clicking on the plus box per item in the tree.


PIC

Figure 4.18: Sheet



PIC

Figure 4.19: Catalog


4.2.1 Material Library

The user can enter pre-defined properties using the catalog displayed for each phase on the sheet, as shown in Fig. 4.20


PIC

Figure 4.20: Choice of a pre-defined material


4.2.2 Density

For incompressible simulations, a fixed density can be defined for each fluid. For a compressible setup, an equation of state can be chosen for defining the density. For more details on the equation of state and possible settings refer to section 4.2.11.

4.2.3 Viscosity

Assuming that the simulation solves for velocity, viscosity can be defined through several methods. A fixed viscosity can be defined by choosing a constant viscosity for a fluid. For a temperature dependent viscosity, the curve fit option can be selected. For more details on defining viscosity in this manner, refer to section 4.2.8. Another possibility is to define viscosity by Sutherland’s Law, which is described in section 4.2.9. Or, fluids can be set as Non Newtonian, through various methods such as Bingham, a Power Law, Carreau or others. Viscosity through Non-Newtonian models are described in section 4.2.10.

4.2.4 Temperature related fluid properties

For simulations that solve for temperature, corresponding properties need to be defined for the fluid. These include thermal conductivity, thermal expansion, and heat capacity. Each of these can be set with a fixed value. Thermal conductivity can instead be defined by curve fit method or Sutherland’s Law. For heat capacity, curve-fit method is the only additional method available.

4.2.5 Concentration Diffusivity

Solving for a passive scalar (activated by concentration, under equations), it is necessary to define a diffusivity. For multiple phases, the diffusivity can be defined uniquely for each phase.

4.2.6 Species Diffusivity

Additional to Concentration, TransAT can also add species to a simulation for reactions. These species also need a value for the diffusivity. Unlike concentration, multiphase simulations are not possible with species. For species defined in a simulation, the diffusivity is defined by the transporting fluid, i.e. the only phase in the Phase Properties tab.

4.2.7 Boussinesq Approximation

The Boussinesq approximation can be used to solve natural convection problems without having to solve the full compressible Navier-Stokes equations. The Boussinesq approximation is applied in TransAT by setting the value of the thermal expansion coefficient for each phase and the reference temperature in the reference properties under Physical Models (see also section 4.1.2).
Please note: The Boussinesq approximation only affects the gravity term in the Navier Stokes equation and will have no effect on any other terms.

4.2.8 Curve-Fit

Viscosity, heat capacity or thermal conductivity can be defined by the user as a function of the temperature. To do this, the curve fit method must first be selected in the drop-down list next to the corresponding property. The file defining the property as a function of the temperature must then be selected. To select the file with the temperature-dependent values of the physical properties, click >.

The data file should be in the project folder. Its format is as follows:

# T   viscosity ---  Use this line for comments  
200   7.0e-6  
300  11.0e-6  
400  14.0e-6  
500  17.0e-6

where the first column gives the temperatures and the second column gives the corresponding value of the property. At least two rows must be present. Hermite interpolation method (cited in Sarfraz (2003)) will then be used. If the data available in the file shows a monotonic behaviour, the method proposed by Sarfraz (2003) is used to keep monotonicity.

If temperature lies outside the temperature range given in the file, the property will have the same value as the one given for the lowest or highest temperature.

4.2.9 Sutherland Law

The user may also choose to apply Sutherland’s law for viscosity or thermal conductivity, instead of setting a constant value for this quantity, by checking the corresponding check-box. Parameters for this model become accessible by this action. The following properties can be modified:

Sutherland’s law is described in the Equations and Algorithms Manual, Section Sutherland’s Law .

4.2.10 Non Newtonian Fluid

In Non-Newtonian fluids, the viscosity, defined by the ratio of stress-to-strain, is not a constant anymore. A Non-Newtonian model can be used in TransAT to take this behaviour into account. To do so, Non-Newtonian needs to be selected in the viscosity model drop-down list next to the viscosity label. Non-Newtonian models can be selected in the new drop-down list will be displayed to the right of the viscosity model drop-down list.

The following models are currently available:

When choosing a model, the corresponding constants that must be set appear in the panel. All these models are presented in the Algorithms Handbook, Chapter Non-Newtonian Models .
Note that non-Newtonian models are implemented per phase.

4.2.11 Compressible Flows

For compressible flow models, the Equation of state (EOS) of the fluids has to be specified. Several choices are possible:

  1. The Perfect Gas EOS is adapted for gas. Ratio of specific heats γ must be given, as well as the Molecular Weight and the Heat capacity Cp in the Phase Properties page (See Fig. 4.17).
  2. The Stiffened Gas EOS is adapted for a liquid. Ratio of specific heats γ, cohesion pressure p and heat capacity Cp in the Fluid Properties page (See Fig. 4.17) become parameters to define the fluid density. The fluid will behave as a perfect gas at a pressure of p.
  3. The Tait Water equation has been specifically designed for liquid water.
  4. The Tait Ammonia equation has been specifically designed for liquid ammonia.
  5. The Incompressible option enables a user to have an incompressible phase (constant density). This is useful for mixtures where a phase is compressible but not the other.
  6. Peng-Robinson enables the use of the generic Peng-Robinson equation of state, where by the user can specify Acentric Factor, Volume Translation, Critical Pressure and Critical Temperature. Typical inputs for various materials can be found in reference literature.
  7. For pre-defined Peng-Robinson parameters, the Peng-Robinson-Water equation of state for liquid or vapour -water can be enabled.

TransAT also offers the possibility to calculate the Heat Capacity of a phase using the selected equation of state (this option is not accessible if the selected equation of state is Incompressible). To use this option the entry Eq. of State must be chosen in the drop-down list of the Heat Capacity property.

Note that the Ideal Gas, Stiffened Gas and Incompressible equations of state are general in the sense that a user-input is required. The Tait equation of state for ammonia or water is specific as all the numerical parameters are pre-entered in TransAT.
The user can also select the option Resolution of pressure waves. When this option is turned on, pressure wave velocities are taken into account when calculating the CFL criterion. This enables TransAT to capture acoustic waves. Note that the timestep Δt will be much lower when this option is activated. This option is not accessible if the selected equation of state is Incompressible.

For more information on the equations, models and algorithms for compressible flow, the reader is referred to the Equations and Algorithms Manual, section Equations of State .

4.2.12 Radiation Rosseland model

If Radiation is activated, then the inputs for the Rosseland model have to be specified for each phase. This is done in the Rosseland properties window as shown in Fig. 4.21


PIC

Figure 4.21: Rosseland model window for radiative properties


The inputs required from the user are the Refraction Index of the phase and the Rosseland Coefficients. TransAT’s radiation model uses the extinction coefficient to calculate the radiative component of the heat transfer, and the Rosseland model allows the user to give either a constant value of the extinction coefficient (this is when the a0 coefficient is non-zero, and a1 ... a5 are zero) or a polynomial fit (up to fourth order) to take the temperature dependence of the extinction coefficient into account. In addition, it is also possible to take into account the dependence of the extinction coefficient on the wavelength. This is done using the definition of Radiation Bands. Each band corresponds to an interval between two wavelengths where the Rosseland coefficients a0 ... a5 can be defined. At least 1 and up to 10 bands are allowed in TransAT.

For each new band, the maximum wavelength of the band must be provided (in meters). The first band always starts at 0, and the last one will go up to infinity by default (when the maximum wavelength is defined as -1). Bands must be defined in increasing order of the maximum wavelength.

4.2.13 Viscoelastic model

If Viscoelasticity is activated, then the inputs for the different models have to be specified for each phase. This is done in the viscoelasticity properties window as shown in Fig. 4.22


PIC

Figure 4.22: Viscoelastic phasic properties window


The inputs required from the user are the values of the model parameters and the temperature dependence for each phase.

4.2.14 Phase Change

For simulations including Phase Change between two phases, it is possible to define the saturation curve between the phases, based on pre-defined phases (available is either Ammonia or Water), or based on the Antoine equation.

To define the saturation curves from the Phase Properties, set the Tsat method or Psat method to variable while defining Phase Change settings under the Physical Models, before changing Phase Properties.

4.3 Phase Interactions

Interactions between phases are defined in the Phases Interactions tab. Momentum Transfer is used to define phase interactions (drag, lift and wall lubrication) for the algebraic slip model (ASM). In Hydrate Reactions a hydrate formation and dissociation model is available.

4.3.1 Momentum Transfer

When ASM is activated for the Phase Average, Momentum Transfer between phases becomes available. This is necessary for the proper definition of miscibility, drag, lift and wall lubrication. Before these relations are defined, it is first necessary to ensure that the state of each phase is correctly set to the desired solid, liquid or gas, in the Phase Properties tab, because the momentum transfer mechanisms depend on this. After setting the state of each phase, the phase interaction will be automatically initialized to the recommended models for each pair of phases.

Please note: Modifying the State of Phase input in the Phase Properties tab, resets all Interphase Slip Relations. Please make sure that state of phases are set correctly, before modifying the phase interaction tables.

The Momentum Transfer section of TransAT is shown in Fig. 4.23. the drop-down choice below the title ”Interphase Slip Relations” can be used to switch between each of the six parameters (miscibility, drag, lift, wall lubrication, lift coefficient and surface tension). The default table displayed on opening the Phases Interactions is the Miscibility table.

Each of the tables is setup in a similar fashion, with each row representing a dispersed phase and each column representing a continuous phase. For example in Fig. 4.23, five phases have been defined: two liquids, two gases and a solid. The row and column labels are each displayed with the name set for each phase from the Phase Properties tab. Notice also, that the row labels are given with the proper dispersed phase characteristic (bubble/drop/particle), versus the continuous phases which are labeled as either gas, liquid or solid.


PIC

Figure 4.23: Momentum Transfer


Miscibility Table

Fig. 4.23 shows the Miscibility table, where miscibility is displayed and defined. If two phases are miscible, the ASM will not calculate a slip between them and their respective phase velocities are equal. The majority of relations within the table are not available to be set by the user; miscibility can only be defined for liquid-liquid interactions, thus miscibility is not available to be set by the user for other state of phase combinations. When phases are of a different state (e.g. gas-liquid, liquid-solid, etc.) the phases are by default immiscible with each other. The implemented slip model does not consider direct gas-gas or solid-solid interactions, thus these relations are displayed as ”N/A”. Shown in the example for the five phases, the liquids have been set to be miscible with each other.

Some conditions on miscibility include reciprocity and consistency between phases. If one phase is miscible in a second, then the second is also miscible in the first. Therefore, the miscibility table will be symmetric. Miscibility must also be consistent between a group of phases. Given three phases, if the first and second phases are miscible, and the second and third phases are miscible, then the first and third phases must also be miscible. Breaking this consistency between groups will display a warning and prevent a simulation from running.

Drag Model Table

The definition of the drag model between phases is available by selecting Drag Model in the Interphase Slip Relations drop-down menu. The table for defining drag models has a similar structure as the miscibility table. Rows define the dispersed phase and columns define the continuous phase. The drag table is shown in Fig. 4.24 for the example setup.


PIC

Figure 4.24: Drag Table


Possible drag models to choose from include Stokes, Clift, Tomiyama Contaminated, Tomiyama Slightly Contaminated, Tomiyama Pure and Schiller relations. The various Tomiyama relations were empirically determined for bubbles in liquids, as such these models are unavailable for other state of phase pairs. Tomiyama models also refer to the conditions of the liquid, for example, pure refers to a liquid that has been distilled several times to remove impurities. A contaminated liquid would not have been distilled, and a slightly contaminated liquid is inbetween a contaminated and pure liquid. Choosing a drag model from the table is shown in Fig.4.24

There are certain phase interactions where drag relations are not permitted. This includes miscible phases, and solids as the continuous phase. Miscible phases do not have a slip and no drag is applied between them. When the solid is the continuous phase, fluids become trapped inside and there is no drag relation possible.

Lift Model Table and Coefficient

The definition of the lift model between phases is available by selecting Lift Model in the Interphase Slip Relations drop-down menu. The usage and restrictions of the lift model table are analogous to the drag model table. Possible models to choose from are either Auton or Tomiyama. Tomiyama is again only valid for gas bubbles dispersed in a liquid. For miscible phases, and solids as the continuous phase, there is no slip and a lift model cannot be applied. The auton lift model requires a coefficient to be defined. This is accomplished by choosing Lift Coefficient in the Interphase Slip Relations drop-down menu. In the lift coefficient table, the lift coefficient can only be set for phase interactions where Auton was defined as the lift model.

Wall Lubrication

The definition of the wall lubrication model between phases is available by selecting Wall Lubrication Model in the Interphase Slip Relations drop-down menu. Wall lubrication is a model only applied to bubbles in a liquid, so the choice of model is only available for corresponding pairs of phases. Models to choose from are Antal, Frank, Hosokawa and Tomiyama.

Surface Tension

The definition of surface tension between phases is available by selecting Surface Tension in the Interphase Slip Relations drop-down menu. Surface tension is required for Frank, Hosokawa, and all Tomiyama models. If one of these models has been selected within any of the model tables, then an input for surface tension becomes available in the surface tension table. Surface tension must be given a value greater than zero.

4.3.2 Hydrate Properties

Please note: The Hydrate Reactions can only be activated when Phase Average is chosen as Multiphase Flow method, with at least three phases defined given that water, hydrocarbon and hydrate phases are needed to simulate hydrate formation.

The parameters that can be set in the Phase Properties tab are the following:

Please note: the model is built such that the user is not allowed to assign the same phase defined in Phase Properties tab to different inputs of the hydrate model. For instance “Phase1” cannot be the hydrate model water phase and the hydrate model methanol phase at the same time. The same is true for the hydrate phases and for the hydrocarbons phases to be defined in the hydrate reactions. Red error messages of “incompatible values” will be displayed if there is a conflict in the hydrate models inputs.

In fact, many hydrate reactions can then be defined in the same simulation. One can add a hydrate reaction by clicking PIC.

To modify a hydrate reaction click edit at the corresponding line.

For deletion of hydrate reactions, click the delete check-boxes of the reactions to be deleted in the hydrate reaction table then click PIC.

Hydrate Reaction

When adding a hydrate reaction, a sub-window Hydrate Reaction Creator will open. The parameters to be set in this window are the following:

The user can then select one or several hydrocarbon phases from which hydrate will form, and one of the forming phases can be selected as dissociation phase.

One can add a hydrocarbon by clicking PIC.

For deletion of hydrocarbons, click the delete check-boxes of the hydrocarbons to be deleted in the hydrocarbons table then click PIC.

For information on hydrate formation and dissociation models, please refer to the Multiphase Theory Manual, Section Hydrates modelling .

4.4 Simulation Parameters

The page Simulation Parameters can be accessed by clicking the button of the same name (Fig. 4.25). This is where the numerics are set. The page is divided in three different sections:


PIC

Figure 4.25: Simulation Parameters tab


4.4.1 Control parameters

In this section, one defines the control parameters of the simulation. Most of them depend on the Simulation Type specified, as described in the following sections.

Steady Simulation Control Parameters

When running a steady simulation, the Number of Iterations must be defined. It corresponds to the maximum number of iterations to be performed if convergence thresholds are not reached. If the simulation reaches this number of iterations, it is automatically stopped.

For the definition of convergence criteria, see Section Convergence Parameters.

Unsteady Simulation Control Parameters
Other Control Parameters

Regardless of the Simulation Type, two more options can be specified:

SArP (Smart Adaptive run Parametrisation)

The SArP module is a controller for simulation convergence. The SArP module may stabilise a simulation and optimise numerical parameters of a simulation to make it converge faster. These objectives are achieved by tuning:

The whole set of these numerical parameters is referred as Chromosome in the present document and in TransATUI. Likewise, every individual parameter from the numerical parameter set is referred as a Gene.

The SArP module has two modes which are depicted in Figure 6.1 and Figure 6.2:


PIC

Figure 4.26: SArP Stability Mode



PIC

Figure 4.27: SArP Optimisation Mode


When triggered, the SArP module automatically sets the numerical parameters by means of an optimising and learning iterative process (genetic algorithm).

The SArP module can be activated by checking the SArP check-box. The corresponding mode is set accordingly to the entry selected in the drop-down menu. SArP triggers
 
In stability mode, the SArP module can be triggered if either one of the following issues are encountered while running a simulation:

Note that in optimisation mode, SArP is triggered right from the beginning of the simulation. After the first execution the SArP module remains activated in stability mode to monitor the convergence of the simulation. SArP Advanced Parameters
 
By clicking PIC, the advanced parameters of the SArP module can be accessed as shown in Figure 4.28. The advanced parameters are classified into two sections corresponding to the two main features of SArP, namely a Monitoring section and a Correction and Optimisation section.

The Monitoring section has one subsection where non-convergence of a simulation is set. The Correction and Optimisation section has 4 different subsections:


PIC

Figure 4.28: SArP Advanced Parameters window for an unsteady simulation


Monitoring  The Monitoring section contains the parameters of the convergence monitoring feature of SArP.

Convergence is monitored over an analysis window whose size can be set in the Analysis Window Size field. This parameter is used in several settings of the monitoring and correction features of SArP which will be expanded on in the next paragraphs.

The Residual Analysis Window Size field is only available for steady simulations. This field specifies the window over which the residuals must be decreasing overall.

Please note: if residuals fluctuate, low values of Residual Analysis Window Size may result in triggering the correction module of SArP too often hence slowing down the simulation. Using higher values of Residual Analysis Window Size avoids this potential issue. However it may delay the triggering of the correction module.   Non-convergence Thresholds  The non-convergence thresholds are the set of thresholds that are used to define the convergence quality of a simulation. They are based on residuals, iteration convergence and time steps. The set of non-convergence thresholds is the following:

Correction and Optimisation  The correction and optimisation of the numerical parameters is handled by a genetic algorithm. The process of the genetic algorithm is illustrated by Figure 6.7.
PIC
Figure 4.29: Genetic Algorithm Process


If SArP is activated for the sole purpose of monitoring the convergence of a simulation, the correction module should be deactivated by uncheking Enable Genetic Algorithm Correction/Optimisation.   Main Algorithm Properties  This subsection groups the main parameters of the genetic algorithm which are the following:

Two pre-defined configurations can be selected in the Configuration drop-down menu: the fast configuration and the normal configuration. Fitness Evaluations Per Generation, Max. Generations and Analysis Window Size are greater with the normal configuration. With this configuration, the space of the parameters is more thoroughly explored. This may lead to better convergence of the genetic algorithm and make the computational cost of the SArP module higher.

An evaluation or fitness evaluation consists of a simulation run from the point where the correction module is triggered. The simulation is run over a number of iterations/time steps corresponding to Analysis Window Size. A steady simulation evaluation is illustrated in Figure 6.9.


PIC

Figure 4.30: Steady Simulation Evaluation Example


The Enable Roll-Back option for an unsteady simulation is depicted in Figure 4.31. The principle is exactly the same for steady simulations. As shown in Figure 4.31, the Enable Roll-Back option runs some preliminary steps before correcting numerical parameters:

  1. restart simulation using the latest restart backup file
  2. stop simulation before the time step/iteration where convergence issues have been detected
  3. launch the SArP module from that point

The offset is determined depending on the detected convergence issue. Depending on the value of the offset, the simulation may be restarted from an earlier point than the backup restart file.


PIC

Figure 4.31: SArP roll back option



Please note: the frequency of restart backup file can be set in the Output Management sub-tab by the modifying the Frequency of Restart Backup entry.

  Convergence  This subsection contains the convergence criteria of the correction module which are the following:

  Genetic Operations  The parameters of the Genetic Operations section determine how the sets of parameters evolve from one generation of the genetic algorithm to another:

The Selection Operator may be one of the following:

More information can be found on the selection operators in the SArP section of the TransAT Algorithms Handbook .   Fitness Approximation  Approximation of the optimal set of parameters can be activated by checking the Fitness Approximation check-box and selecting the corresponding Learning Method in the drop-down list. The approximation method can be one of the following:

When Fitness Approximation is activated, the number of evaluation is divided by 2 from the second generations onwards. Five other sets of parameters are evaluated using the learning fitness approximation algorithm.

More information can be found on the learning methods in the SArP section of the TransAT Algorithms Handbook .

4.4.2 Equations

In the bottom part of the Simulation Parameters tab, the equations properties are shown. On the left, the available equations can be selected (depending on the setting in the Physical Models tab).

Equations are divided into subgroups. Clicking the Solver Options check-box at the bottom of the page, will expand Other Variables into different subgroups, depending on the models used and on the basic equations solved for.

Multiple selection is allowed using Ctrl + left click. Moreover, when selecting a tree node (symbolised with a folder in the equation tree), all its subnodes are automatically selected. This is done in order to facilitate applying changes to similar equations. If you want to unselect one or more subnodes, just use Ctrl + left click again on these subnodes.

Whenever the user does a selection on a node, the corresponding equation properties are shown on the right. When using multiple selections, a warning symbol is displayed for the inputs for which there is a conflict of values.

Please note: the conflict of values for an input simply means that every input is not the same for all the equations that have been selected.

In order to apply changes on one of the parameters on the right, e.g. the Convergence Tolerance, the user must first select the equations in the tree, then change the desired value on the right.

Please note: If one wants to apply the same parameters to all the equations, the root node All Quantities can just be selected. With All Quantities selected, all the parameters modification will be applied to all the equations.

Please note: The same parameters can be set for all the equations except for the pressure equation. For the pressure equation has the same parameters as the other equation except the Convection Scheme option which is not available for it.

All the Equation Parameters on the right of the Equations panel are described in detail in the following section.

Equation Parameters

Here, a full description of the equation parameters is given.

4.5 Initial Conditions

In the Initial Conditions tab (see Fig. 4.32), initial conditions can be set for variables to be solved for. Simple initial conditions can be set here, along with advanced initial conditions. Variables defined with advanced initial conditions will overwrite any basic initial conditions defined. Basic initial conditions not overwritten will still be used together with advanced initial conditions.

4.5.1 Methods

Basic initial interfaces with the interface-tracking method can be defined in initialconditions.xml. Please refer to the User-defined Initial Conditions section. For more complex initial conditions, please refer to the Advanced Initial Conditions section.

The basic set of initial conditions that can be set in the Initial Conditions tab comprises the following methods:

For velocity components, the Automatic option consists in making the initial velocity field divergence-free if the fluid is incompressible.
For pressure the Automatic option consists in setting the initial pressure field based on the source terms.

Note that the default Method for all variables is Automatic.

When Method is set to Constant for a variable, the variable field is initialised with a constant value throughout the domain. The value that is used is the one given in the Value field.

When Method is set to Userdefined for a variable, the variable field needs to be specified directly in the initialconditions.xml file created by TransATUI.

Please note: an extra input, Sub Method, is available for the phase variables when the Constant method is chosen and the Species and Reactions option is activated in the Physical Model tab. The Sub Method option allows the user to specify either mass or mole fractions for initial values of the species variables.

Please note: the Userdefined method can only be set by editing initialconditions.xml by hand.

Please note: the values set using Advanced Initial Conditions overwrite the basic values set in the Initial Conditions tab.

4.5.2 Variable tree

In the tree on the left, the available variables can be selected (depending on the models enabled in the Physical Models tab). The variables in the tree are divided into subgroups.

Multiple selection is allowed using Ctrl + left click or by dragging the mouse. Moreover, when selecting a tree node (symbolised with a folder in the variable tree), all its subnodes are automatically selected. This is done in order to facilitate applying changes to one set of variables in one go. If you want to unselect one or more subnodes, just use Ctrl + left click again on these subnodes.

4.5.3 Setting parameters

Whenever a user selects a node, the corresponding initial conditions parameters are shown on the right. When using multiple selections, a warning symbol is displayed for the inputs for which there is a conflict of values. The warning symbol is displayed in orange for the Method and Value inputs. It is displayed in red for the Sub Method input.

Please note: the conflict of values for an input simply means that the value for that very input is not the same for all the variables that have been selected.

In order to apply changes on one of the parameters on the right, e.g. the Method, the user must first select the variables in the tree, then change the desired value and sub-method (if available) on the right.

Please note: If one wants to apply the same parameters to all the variables, the root node All Quantities can just be selected. With All Quantities selected, all the parameter modifications will be applied to all the variables.


PIC

Figure 4.32: Initial Conditions tab


4.5.4 File structure

All the information relevant to the parameters of the Initial Conditions tab are written in the file initialconditions.xml.

4.5.5 Advanced Initial Conditions

The user can set more advanced initial conditions using the C++ interface to TransAT’s code. The method to do so consists in creating a C++ subroutine, called initialconditions.cxx.

Advanced initial conditions are introduced in more details in the Advanced initial conditions section.

If variables are to be initialised using advanced initial condtions

4.6 User Defined Functions

In the User Defined Functions tab (see Fig. 4.33), user defined functions (UDFs) can be defined. A brief description of how to define UDFs is given in this section, for greater detail and explanation of UDFs refer to the User-Defined Functions section.

4.6.1 Creating UDFs

Click on the PIC button to define a new UDF. A window will open to define the basic features of the UDF. First a name for the UDF must be defined. This name must be a valid C++ file name (no special characters and cannot begin with a number). The UDF name, file name and class name must all be the same.

After defining the UDF name, a type must be selected. The types of UDFs are organized with templates. By choosing a template, the UDF will be set with the same type (the type is shown by the folder that the template is in). If a template is not desired, the choice ”None” can be selected, which exists within each folder. This is helpful if the file for the UDF already exists in the usercompile folder, to prevent it from being overwritten.

Once finished defining the UDF, click PIC to create the UDF. If a template was selected, the implementation (.cxx) and header (.h) files will be copied from the installation directory into the usercompile folder of the project directory. The UDF can be edited by clicking the PIC button.

A UDF can be removed by clicking PIC. This will not delete any of the files, but prevent it from being compiled or used during a simulation. Only the UDFs activated in the table of the User Defined Functions tab will be compiled and executed. When a UDF is not desired during a certain run, it can be deactivated using the checkbox, there is no need to delete it from the table.

4.6.2 Compiling and Executing UDFs

To test that a UDF was written properly, click the PIC button. This will compile UDFs activated by the orange check-box. The text output at the bottom of the tab will display the results of compilation. An error will display if UDFs failed to compile.

Activated UDFs are compiled automatically at the start of a simulation. This will ensure that changes to a UDF file will be included.

Please note: UDFs regarding drag models, lift models, and wall lubrication models require additional steps in order to be executed. Refer to Extended UDF Types for more information.


PIC

Figure 4.33: User Defined Functions tab


4.7 Output Management

The last page of the Input Tab revolves around Output Management and Post-Processing (Fig. 4.36). It is divided into three sections:

4.7.1 Visualization Files

The output of the visualization files and of the restart/backup files are controlled in the Output Management tab.

Output File Format input sets the output format for visualization. Two visualization formats are supported by TransAT: Tecplot files, and vtk file format, which is the standard format for Paraview. The default option for Paraview is point-data. For further information, please refer to the Paraview User Manual.

Frequency of output files sets the interval at which visualization files are saved: a value of n means that visualization files are written every nth iteration/timestep. For unsteady simulation the output frequency can also be set based on time interval. These files are stored in the RESULT subfolder of the project folder.

In the file names, xxxx represents the iteration/time-step index, and ext is the file extension, namely dat for Tecplot files and vtm for Paraview files.

The second part of the tab deals with extra parameters for the visualization files.

These extra parameters are the following:

Managing which variables are written in the output files is done in the Output Variables dialog window, which opens by clicking Output Variables.

Choice of Output Variables

Clicking Output Variables opens the Output Variables window (Fig. 4.35). The variables are grouped for better readability. Primary Variables Group
  The Primary Variables group is always activated.

Material Properties Group
 

In this group of variables, only Density and Viscosity are always activated. Heat Capacity and Thermal Conductivity are activated only if temperature is solved for. Geometry Group
 

In this group, only Wall Distance is always activated. Solid Step Function is activated only if Immersed Surfaces in Objects is enabled. Miscellaneous Group
  The variables of the Miscellaneous group are available only if Compressibility is activated in the Models and Properties section of the Input tab.

Particle Tracking Group
  The Particle Tracking group of variables is activated only if Lagrangian Particle Tracking is selected in Multiphase section of the Input tab. Interface Tracking Group
  The Interface Tracking group of variables is activated only if Interface Tracking is activated and Level-Set is selected in the Multiphase section of the Physical Models tab. Multiphase Model Group
  The Multiphase Model group of variables is activated only if Phase Average is activated and in the Multiphase section of the Physical Models tab. Phase Change Group
  The Phase Change group of variables is activated only if Phase Change is activated in the Multiphysics section of the Physical Models tab. Reactions Group
  The Reaction group of variables is activated only if Species and Reaction is selected in the Multiphysics section of the Physical Model tab. Statistics Group
  The Statistics group is only activated if Averaging is selected in Output Management. The list of variables displayed depends on the type of model chosen for Turbulence Modelling in the Models and Properties section of the Physical Models tab. If Turbulence Modelling is not activated, or if LES is selected as Turbulence Modelling model, only three variables are available:

If the Turbulence model selected is RANS or V-LES, three other output variables are available:

Turbulence Modeling Group
  The Turbulence Modeling group of variables is activated only if Turbulence Modelling is selected in the Models and Properties section of the Physical Models tab. The Variables displayed depend on the Turbulence Modelling choice.

When RANS or V-LES is selected in the Turbulence Modelling drop-down list:

If LES is chosen in the Turbulence Modelling drop-down list:

Turbulent Prandtl Number is available only if Turbulent Prandtl Number Model is not constant in LES model properties. Hydrates Group
  The Hydrates group of variables is activated only if Hydrate Model is selected in the Multiphysics section of Physical Models tab.

Please note: Hydrate Model is only available when Phase Average is selected as Multiphase Flow method and when the number of phases is bigger than 2.

The list of variables for this group is the following:


PIC

Figure 4.35: Output Variables Window


4.7.2 Post-processing panel

This section enables the user to set post-processing parameters and outputs. Their use is described later in the Section Data Processing.

4.7.3 Restart Parameters

In the third section, Restart Parameters of the restart files which allow restarting simulations are set.


PIC

Figure 4.36: Output Management tab


Chapter 5
Running a Simulation

The last tab of the GUI is the Execute tab. Fig. 5.1 gives an example of how this tab looks like when a simulation is running. There are mainly 4 elements displayed which will be further discussed in this chapter:


PIC

Figure 5.1: Execute tab


5.1 Simulation control

This part of the execute window controls the solver. Simulations can be started, stopped and restarted.

5.1.1 Running TransAT

To run simulations, it is important the project is saved and all solver input files generated. The manual way to do this:

The automatic way to do exactly the same is to keep the checkbox ”Save and Prepare Simulation Files” ticked. This will automatically write all necessary files whenever a simulation is started. This is the default behavior and recommended to keep. Expert users might disable this option and manually save model parameters or remaining files.

Clicking the PIC button will start the simulation. Runtime messages output by TransAT solver are shown in the output field.

Please note: Before starting a simulation, make sure that:

Warning and error messages might appear at the beginning of the simulation. It is strongly recommended to read these messages and to correct the input parameters to comply with the given advise. Otherwise, the solver may not run properly.

Fig. 5.2 and 5.3 show typical outputs of the solver for different types of simulation.


PIC

Figure 5.2: Typical output for an unsteady simulation



PIC

Figure 5.3: Typical output for a steady simulation


5.1.2 Stopping a Simulation

Clicking PIC stops the current simulation. The stop occurs only at the end of the time-step (or iteration for a steady simulation), so there may be a lag between the moment PIC is clicked and the actual stop of TransAT.

A restart file is then written, called <project_name>.runa or <project_name>.runb (depending on the restart file format, see Section Output Management). It can be used for a future restart of the simulation. Another restart file is also written called properties.dat.runb. This contains properties for any objects in the mesh (such as center of mass, velocity, rotation, and others).

Please note: This restart file overwrites any restart file that could have been saved previously.

5.1.3 Restarting a Simulation

Restarting a previous simulation is done by clicking PIC and selecting restart file(s) (Fig. 5.4). Restart files have the extension .runa or .rsta for ASCII format, and .runb or .rstb for binary format.

The solution file is mandatory, and loads all the simulation values for the various variables in the cells. The Object properties file is optional, and is important if the object properties have changed during the simulation. For example, if the object was specified with motion, then the simulation must be restarted with the current position. The restart file for objects is always called properties.dat, with the extension .runb set.


PIC

Figure 5.4: Restart Dialog box


TransAT can also be restarted (initialised) using a restart file from a coarser or finer grid. It is assumed that the geometry is exactly the same (or almost the same). The results from this solution and grid will be interpolated on the current grid. An exact restart is not guaranteed in this case since the grid itself is different.

To do this,

Please note: Old and new grids must have the same format, i.e. both files must be in ASCII format or binary format. Also, the new grid cannot be outside of the old grid boundaries (but it can be smaller).

5.2 Runtime information

In the left window of the execute tab below the buttons to run a simulation, there are several elements accessible to display important information while running a simulation. The dropdown menu gives access to all runtime information which will be displayed in the box below the menu.

Detailed information from the running simulation are displayed in the text window on the left side of the Execute tab of the TransATUI (”Runtime information” in Fig. 5.1).
Five information views are possible:

Every time the simulation is started all the info content is cleared. However when TransATUI loads a project of a simulation that has already run and finished, the runtime information will display the information from the previous run. To the right of the runtime information selection menu there is another output displaying the current run-state of the simulation:

Info: Timing and convergence


PIC

Figure 5.10: Runtime Information sections


As shown in Fig. 5.10 the runtime information window can be split in 3 sections:


PIC
Figure 5.11: Runtime Information for BMR


Fig. 5.11 shows timing and convergence info for a BMR simulation.

Expert information

All the information printed in the runtime info window can be also found in the following files in the project directory where the simulation is running:

Running on clusters using a job system these files will be created as well, except simInfo.txt. The files are useful to check for info/warning/error messages of a simulation.

5.3 Screen output

The runtime information as described in the previous sections is a summary of the solver screen output in the ”Simulation screen output” part of the execute window as shown in Fig. 5.1. Information, warnings, errors and convergence information are displayed in the solver output window. The information and the coloring displayed is slightly different however and it will also code all convergence information if colors are disabled using markers. The coloring differs for the following events:

For convergence or last iteration the residual line is separated from the other lines and marked


PIC
Figure 5.12: Simulation convergence screen output


The screen output gives a lot of information about convergence already without the additional simulation info of the GUI. Depending if colors are enabled or not, colors or markers are used to give additional information. See Fig. 5.13 for screen output with and without colors displaying:


PIC
Figure 5.13: Color- and marker-based convergence information


5.4 Visualization of residuals

Residuals of the simulation are displayed in the Graphs section of the Execute tab.

Clicking Custom opens a window where one can output data of interest written in the RESULT folder in real time.

5.4.1 Unsteady simulations

For unsteady simulations, the relative residuals for each time step are written in files L1_resnorm.dat, L2_resnorm.dat and Linf_resnorm.dat, using norms L1, L2 and L, respectively. These files can be selected in the Graphs section of the Execute tab of the TransATUI

5.5 Run-time Intervention

Run-time intervention is available when using TransAT. However, this is not available in TransATUI yet except for the simulation-stopping and SArP-module-stopping buttons.
During a simulation, the user can click PIC to stop it. Inputs can then be changed and saved before re-running the simualtion or restarting it by clicking PIC. See Section 5.1.3 for restart options.

When the SArP module is running, the SArP module can be stopped by clicking PIC. After stopping the simulation, the simuation is restarted with the parameters of the best solution found by the SArP algorithm.

The run-time behaviour of TransAT can be changed by creating run-time intervention file transat_mb.rti in the project folder.

5.5.1 Inputs for run-time intervention

The file transat_mb.rti is made up of the first line which indicates the action to be taken on reading the file and the Namelist Run_Time_Control. The following strings are accepted in the first line: output, reread_input, stop, noaction.

Below is a sample of the Namelist Run_Time_Control input variables:

&RUN_TIME_CONTROL  
!------------------------  
! Adaptive time stepping  
! Sample values  
!------------------------  
RT_ADAPTTIME    = T,         ! use adaptive step (.true. or .false.)  
RT_CFLMAX       =   1.0      ! Maximum and minimum CFL value  
RT_CFLMIN       =   0.8  
RT_DIFMIN       =   1.0      ! Maximum and minimum diffusion criterion  
RT_DIFMAX       =   0.8  
RT_STNMAX       =   1.0      ! Maximum and minimum surface tension criterion  
RT_STNMIN       =   0.8  
RT_FOUMAX       =   1.0      ! Maximum and minimum Fourier criterion  
RT_FOUMIN       =   0.8  
!---------------  
! Output files  
! Sample values  
!---------------  
rt_l3dplot      = .true. or .false.       ! Write 3D output files  
rt_data_format  = "paraview" or "tecplot" ! Output file format  
rt_l2dplot      = .true. or .false.       ! Write 2D output files  
rt_write_iplane = .true. or .false.       ! Write xy, xz ,or yz plane  
rt_write_jplane = .true. or .false.  
rt_write_kplane = .true. or .false.  
rt_iplane = 3                             ! Index of the plane to be written  
rt_jplane = 3  
rt_kplane = 3  
 
!--------------------  
! Time steps  
! Sample values  
!--------------------  
rt_ntimet        = 1000     ! Maximum number of time step  
rt_ctimet        = 1.0      ! Final time of the simulation  
rt_ntimp1        = 100      ! Frequency of outputs (number of iterations/timesteps)  
rt_ctimp1        = 1        ! Frequency of outputs (time interval [s])  
rt_maxit         = 5        ! Maximum number of iterations in a time step  
rt_nsave         = 100      ! Frequency of restart files writing  
 
!-----------  
! Convergence thresholds  
!-----------  
rt_epsimp  = 1.0e-3  ! Overall threshold  
rt_epspimp = 1.0e-2  ! Pressure threshold  
/

Example of transat_mb.rti file:

reread_input  
&run_time_control  
rt_ntimet = 20000  
/

The number of iterations to be run can be changed without stopping the code using the above transat_mb.rti file.

Another option would be to stop the simulation using PIC, change inputs as needed, save the project and restart the simulation.

5.6 Quitting the GUI

Clicking Files then selecting Exit closes the GUI. If a simulation is running at the same time, a dialog box pops up, as shown in Fig. 5.14. The following choices are possible:

Click PIC to keep the GUI open and the simulation running.


PIC

Figure 5.14: Exit window


Chapter 6
Settings Guides

6.1 SArP Guide

6.1.1 When to use SArP

The SArP module has two modes which are depicted in Figure 6.1 and Figure 6.2:


PIC

Figure 6.1: SArP Stability Mode



PIC

Figure 6.2: SArP Optimisation Mode


Before using the optimisation mode, it is advised to first run the simulation without it as the optimisation process can be costly. If the simulation can be completed in an acceptable time, it is advised not to use the optimisation mode. Otherwise the optimisation mode can be used to correct and accelerate the simulation.

The typical use cases for the optimisation mode are:

There is no specific restriction regarding the use of the stability mode.

Please note: the optimisation can be accelerated by tuning some parameters or exiting the optimisation process early. See the Speeding up SArP section to get more information.

Please note: after the initial SArP launch in optimisation mode, the simulation runs in stability mode in the remainder of the simulation.

6.1.2 Detection of convergence issues

To use the SArP module optimally, it is important to understand how it operates to detect convergence issues. The parameters that are used to detect convergence issues can be tuned so that the SArP module is only triggered when necessary. Convergence issues can be detected by the SArP module by monitoring the following quantities:

Residuals based issues
Residuals trend  A simulation may be deemed non-converging if its residuals stagnate or increase. To measure this, the average slope of the residuals over a sliding monitoring window (or analysis window) is computed. For unsteady simulations the monitoring windows are whole time steps. The trend of the residuals is measured in each time step. For steady simulations, the size of the monitoring window is set by the Residual Analysis Window Size input in Advanced Parameters window of SArP.

The ideal value of the Residual Analysis Window Size input depends on the test case at hand. Low values of Residual Analysis Window Size make the SArP module more reactive but may trigger the correction module too much especially in cases such as Figure 6.3 where residuals are decreasing while oscillating. High values of Residual Analysis Window Size would not trigger the SArP module in that case however they will be slower to react in case where residuals stagnate or increase such as in Figure 6.4.
PIC
Figure 6.3: Oscillating residuals


PIC
Figure 6.4: Stagnating residuals

Residuals ratio  The ratios of residuals at the current iterations over the residuals at the previous iterations for each equation are also monitored. High ratios indicate discontinuities and convergence issues. The SArP module is triggered as soon as the ratio of residuals of one of the equations reaches a threshold value. This threshold value is set in the Max. Residual Ratio field in the Advanced Parameters window of SArP in TransATUI. Unconverged Time Steps  Unconverged time steps are time steps where the target residual is not reached for at least one equation. The target residual of each equation is the Convergence Tolerance parameter in the Equations section of the Simulation Parameters tab. Figure 6.5 shows the typical TransAT output of a simulation with unconverged time steps. The residuals of the last iteration of each time step are coloured in red which indicates that the time steps are unconverged.


PIC
Figure 6.5: Simulation with unconverged time steps

The SArP module is triggered as soon as the number of consecutive unconverged time steps is above a threshold value. The threshold value is set in the Unconverged Time Steps field in the Advanced Parameters window of SArP in TransATUI.
Solver based issues

In a given simulation, each equation is solved iteratively at each iteration. The iterative solvers have a maximum number of iterations parameter. This parameter can be set in the Equations section of the Simulation Parameters tab after activating Advanced Solver Options. The parameter is called Max Number of Solver Iterations. Figure 6.6 is a typical TransAT output shown in the Execute tab of a simulation with unconverged iterations. In this example there are residuals that are coloured in orange indicating that the solver of the corresponding equation did not converge.


PIC

Figure 6.6: Simulation with unconverged iterations


Whenever the solver of an equation reaches the maximum number of solver iterations, it indicates convergence issues especially in cases where this happens frequently. In the remainder of this section we will refer to iterations where the maximum number of solver iterations is reached as unconverged iterations. Consecutive unconverged iterations  One way to check convergence issues down to solvers is to monitor the number of consecutive unconverged iterations for each equation. The SArP module is triggered as soon as the number of consecutive unconverged iterations reaches a threshold value. This threshold value is set in the Consecutive Unconverged Iterations field in the Advanced Parameters window of SArP in TransATUI. Unconverged iterations rate  Another way to check convergence issues down to solvers is to monitor the rate of unconverged iterations. For steady simulations, the unconverged iterations rate is measured over the SArP analysis window while it is measured over whole time steps for unsteady simulations. The SArP module is triggered as soon as rate of unconverged iterations reaches a threshold value. This threshold value is set in the Unconverged Iterations Rate field in the Advanced Parameters window of SArP in TransATUI.

Time step based issues
Decreasing time step duration  Simulations for which the time step duration keeps on decreasing will run slowly and may eventually crash. That is why the ratio of the time step duration at the current time step over the time step duration at the beginning of the analysis window is also monitored. A low ratio indicates sharp time step duration drop and convergence issues. The SArP module is triggered as soon as the ratio of time step duration is below a threshold value. This threshold value is set in the Min. Time Step Drop field in the Advanced Parameters window of SArP in TransATUI. Low time step duration  The SArP module may be triggered as soon as the time step duration drops below a threshold value. This threshold value is set in the Min. Time Step Drop field in the Advanced Parameters window of SArP in TransATUI.

6.1.3 Correction And Optimisation

Evaluations

For a given simulation, the SArP module can be launched only a limited amount of times. The limit of SArP launches is the value in the Max. Genetic Algorithm Runs field in the Advanced Parameters window of SArP in TransATUI.

In the SArP module, solutions – set of random parameters – are evaluated. A solution evaluation is done in two steps. Firstly, a simulation is run for n iterations/time steps, with n the value in the Analysis Window Size field in the Advanced Parameters window of SArP in TransATUI. Secondly, the results are analysed to determine the validity status and the score of the solution.

Unless a stopping criterion is met, each SArP launch evaluates neval solutions for gmax generations as shown in the diagram of Figure 6.7. gmax and neval are respectively the Max. Generation and the Evaluations Per Generation fields in the Advanced Parameters window of SArP in TransATUI.


PIC

Figure 6.7: Evaluation Process


Roll-back option

The roll-back option which is activated by the Enable Roll-Back check box in the Advanced Parameters window of SArP in TransATUI. With this option, preliminary steps are run before correcting numerical parameters:

  1. restart simulation using the latest restart backup file
  2. stop simulation before the time step/iteration where convergence issues have been detected
  3. launch the SArP module from that point

Figure 6.8 depicts the roll-back option for an unsteady simulation. The principle is exactly the same for steady simulations. The offset shown in Figure 6.8 is determined depending on the detected convergence issue. Depending on the value of the offset, the simulation may be restarted from an earlier point than the closest backup restart file.


PIC

Figure 6.8: SArP roll back option


Stopping criteria

The SArP module stops when one of the stopping criteria is met. Setting appropriate stopping criteria of the SArP module is recommended The stopping criteria vary accordingly to the nature of the simulation, steady or unsteady. The stopping criteria are described below. Steady simulations  For steady simulations, the SArP module stops if:

A typical steady simulation evaluation is shown in Figure 6.9. In that example the residuals exit condition is met by the variable represented with red disks and green crosses since their residuals drop below γResmax where γ is the user-defined residual drop factor. The exit condition is however not met by the variable represented with purple diamonds.


PIC

Figure 6.9: Steady Simulation Evaluation Example


Unsteady simulations  For unsteady cases, the SArP module stops if:

6.1.4 Speeding up SArP

Tuning SArP parameters  The main strategy to speed up the SArP module is to reduce the number of evaluations performed during the correction and optimisation process. This can be done by setting parameters of the Advanced Parameters window of SArP in TransATUI. There are four main options which can be used in combination to do this:

Please note: with these options the space of the parameters is searched less. It makes finding the optimal set of parameters less likely. This is usually not an issue especially when acceptable or reasonably fast set of parameters can be found with less effort compared to the deeper search required to find the optimal set of parameters. User intervention  Alternatively, the SArP module can be stopped in the middle of the process if a satisfactory solution has been found. This can be done by clicking PIC in the Execute tab of TransATUI or creating the file transat_mb.rti and setting its content to stop_sarp (only one word in the file).

To check whether a solution is satisfactory the SArP Info tab of the simulation information panel along with the simulation output can be checked.

The simulation information panel contains information related to the SArP module progress and selection process. During the SArP module run, a table with the validity status and the score of the evaluated solution is displayed in the SArP Info tab. The validity status of a given solution indicates whether the solution has convergence issues. Valid solutions are coloured in green while invalid ones are coloured in orange.

The score is a metric of the convergence of the simulation based on the residuals. The higher the score the better the convergence. To get a more detailed view of the convergence quality, the simulation output can be looked at. For steady simulations, the residuals of the best solution at the previous generation can be directly checked in the simulation information panel. Figure 6.10 shows a typical SArP Info tab of a steady simulation.


PIC
Figure 6.10: SArP info tab of a steady simulation

For unsteady simulations, the time step score is also displayed and takes precedence over the score. The time step score indicates which solution is to reach the target physical time the fastest. The time step score is based on the time step duration and the actual time required to evaluate a solution. The fastest running solutions are the solutions with the highest time step scores. Figure 6.11 shows a typical SArP Info tab of an unsteady simulation.


PIC
Figure 6.11: SArP info tab of an unsteady simulation

Please note: it is advised to hit the PIC button only if a solution with a validity status of true has been found. Failing that, the SArP module will be immediately triggered again after clicking PIC since the selected solution will present convergence issues (as indicated by a validity status of false).

Chapter 7
Post-Processing

7.1 Output Files

7.1.1 SArP

When the SArP module is activated, the following ouptut files are generated:

7.2 Visualisation with ParaView

To get a rough idea about visualisation of TransAT results with ParaView, please refer to the TransAT Paraview Tutorial .

More detailed information can also be found in the Paraview Tutorial on the ParaView website.

7.3 Visualisation with Tecplot

Start Tecplot in you working directory by:
tecplot
Open your result file:
File Load Data File(s)...
Tecplot Data Loader
Choose your result file and click ’OK’.
When asked to select your Initial Plot Type, select the (default) 3D Cartesian type and click ’OK’. Now the tecplot window should look like in Fig. (7.1).


PIC

Figure 7.1: Tecplot window after loading the result file.


Define Variables

Open the window to define variables (see Fig. (7.2)).


PIC

Figure 7.2: Define variables C1 and C2.


Define variable C1 to be Temperature and C2 to be EmbI, which is the function representing the immersed surfaces. Close this window.
Define Isosurface
Enable and define the isosurface representing the immersed objects (see Fig. (7.3)).


PIC

Figure 7.3: Define isosurface.


Define the Interface using variable C2:EmbI at 1 specific value which is zero. By default, the interface is coloured by variable C1 which should be the temperature.
Define Slice
Enable and define the slice like in Fig. (7.4).


PIC

Figure 7.4: Define slice.


7.4 Data Processing

This section describes the various post-processing utilities available in TransAT. All input files related to the post–processing utilities are created in the project folder, and all results are written in the RESULT folder by default.

Please note: Some post-processing utilities are not available in the GUI yet. To enable them, the user may have to edit and modify directly the input file transat.inp, which is located in the project folder.

7.4.1 Non-dimensional numbers

Non-dimensional numbers can be evaluated by TransAT during the simulation. This feature is turned on by default.

It can be activated or deactivated in the Output Management sub-tab of the Input tab. One simply needs to check or uncheck the Non Dimensional Numbers box in the Postprocessing section (Fig. 4.36).

This utility calculates a variety of non-dimensional numbers and writes them to the file RESULT/ND_numbers.dat.

The reference length scale and reference velocities are taken from the value given in the Physical Models sub-tab of the Input tab (See Section Physical Models).

Depending on the physical models used, the available non-dimensional numbers can be the following

A typical output of this utility is shown below.

 ==========================================  
 = Non-dimensional numbers at: begin  
 ==========================================  
  Length             (m)     :    1.000  
  Velocity           (m/s)   :    1.000  
  Velocity Max       (m/s)   :    1.444  
 
  Density Gas        (kg/m^3):    1.205  
  Viscosity Gas      (Pa s)  :   0.1511E-04  
  Kin. Visc. Gas     (m^2/s) :   0.1254E-04  
  Heat Capa. Gas     (J/kg K):    1005.  
  Therm. Cond. Gas   (W/m K) :   0.2570E-01  
 
  Density Liq         (kg/m^3):    997.8  
  Viscosity Liquid    (Pa s)  :   0.9772E-03  
  Kin. Visc. Liquid   (m^2/s) :   0.9794E-06  
  Heat Capa. Liquid   (J/kg K):    4076.  
  Therm. Cond. Liquid (W/m K) :   0.6048  
 
  Surface Tension    (N/m)   :   0.7200E-01  
 
  Gravity            (m/s^2) :    9.810  
 
  Coef. Thermal Exp (gas) (K^-1):   0.3430E-02  
  Coef. Thermal Exp (liq) (K^-1):   0.3411E-02  
  Temp difference   (K)         :    0.000  
 
  Reynolds number (Re) = Rho*RefL*RefU/Visc  
    Re(G):   0.7975E+05  
    Re(L):   0.1021E+07  
 
  Froude number (Fr) = RefU^2/(g*RefL)  
    Fr(ReferenceL):   0.1019  
    Fr(Domainsize):   0.1014  
 
  Prandtl number (Pr) = Visc*Cp/Lambda  
    Pr(G):   0.5909  
    Pr(L):    6.587  
 
  Rayleigh number (Ra) = Beta*DeltaT*g*(Rho^2)*(RefL^3)*Pr/(Visc^2)  
    Ra(G):    0.000  
    Ra(L):    0.000  
 
  Weber number (We) = RhoL*RefL*(RefU^2)/Sigma  
    We(L):   0.1386E+05  
 
  Eotvos number (Eo) = g*(RhoL-RhoG)*(RefL^2)/Sigma  
    Eo:   0.1358E+06  
 
  Morton number (Mo) = g*(Visc^4)*(RhoL-RhoG)/((RhoL^2)*(Sigma^3))  
    Mo:   0.2399E-10  
 
  Capillary number (Ca) = Visc*RefU/Sigma  
  Ca(L):   0.1357E-01  
  Ca(G):   0.2099E-03

Checking the ND_numbers.dat file at the beginning of every simulation and specifying a reasonable value of the reference length and velocity is part of the best practice guidelines for using TransAT.

7.4.2 Time signals probes

This utility saves time signals at a given set of points in the domain. The points do not have to match with a grid point, values are interpolated.

This feature can be turned on by creating an input file named timesignalxyz.dat in the project folder. The input file contains coordinates of points at which data has to be extracted. Each line should have 4 columns: viz. probe number (integer), x–coordinate, y–coordinate, z–coordinate.

1 0.1 0.5 0.7  
2 1.0 2.5 3.7  
3 0.95 0.3 0.89

The output file is stored in the RESULT folder and has a name of the type timesignal.yyyy., with y the index of the time signal (Note: If ”blockfile” is set by hand to true in the input file transat_mb.inp then y represents the block number and can contain several time signal points).
The signal is stored at every time step. The following variables are written in timesignal.yyyy, depending on different equations solved:

7.4.3 Section Output

This utility saves output on a given section plane. The plane could be aligned to the grid or can be defined at an arbitrary angle. The utility can also be used to extract ouput on a sub-section of a plane. An example of a section plane is shown in Fig. (7.5).


PIC

Figure 7.5: A section plane.


This feature can be turned on by creating an input file named sectionsxyz.dat in the project folder. The input file contains definitions of section planes. Each plane is defined by its normal and a point on the plane.
A sub-section in a given plane can also be defined by defining the extents of the sub-section in the plane. Each line in the input file should have either 6 columns: viz. plane–normal (x–axis), plane–normal (y–axis), plane–normal (z–axis), x–coordinate, y–coordinate, z–coordinate or 12 columns: viz. plane–normal (x–axis), plane–normal (y–axis), plane–normal (z–axis), x–coordinate, y–coordinate, z–coordinate, xmin, xmax, ymin, ymax, zmin, zmax, where xmin, xmax, ymin, ymax, zmin and zmax defines the extents of a sub-section in a given plane.

1.0 0.0 0.0 0.1 0.0 0.0  
0.707 -0.707 0.0 0.0 0.3 0.0  
1.0 0.0 0.0 0.1 0.0 0.0 0.1 0.1 0.01 0.03 0.001 0.001

First line defines a plane with normal in x-direction through point (0.1,0.0,0.0). The second line defines a plane rotated by 450 around the z-axis and through point (0.0,0.3,0.0). The last line finally has the same definition as the first one. The section is further limited by x/y/z-plane integration limits.

The output file is stored in the RESULT folder and has a name of the type section.y., with y the index of the plane.
The section output is stored at every iteration for steady simulation and at every time step for unsteady simulation. The following variables are written in section.y, depending on different equations solved:


Area weighting of a variable ϕ is defined as:

∫
-∫ϕdA-
  dA
(7.10)

Mass flux weighting of a variable ϕ is defined as:

∫       ⃗
-∫ϕρ⃗v-⋅dA-
  ρ⃗v ⋅dA⃗
(7.11)

Heat capacity flux weighting of a variable ϕ is defined as:

∫ ϕρc ⃗v ⋅d⃗A
-∫---p------
   ρcp⃗v ⋅d⃗A
(7.12)

Chapter 8
Command Line Options

Multiple TransAT operations such as the generation of simulation files, setting of initial conditions and simulation execution can be directly launched in command line. The command line options of TransAT are of particular use to run multiple simulations. Indeed, scripts can be created using the TransAT command lines to run large number of simulations without user intervention.

8.1 Environment variables setting

Some of the operations supported by TransATUI can be directly executed in command line. TransAT commands can be directly executed if the PATH environment variable contains the following folders:

To check if the first folder is in the PATH environment variable, execute the following command in a terminal:

which tmb_run.py

It should point to a file located in <TransAT_Installation_directory>/transatMB/bin. If that is not the case, execute the following command

export PATH=<TransAT_Installation_directory>/transatMB/bin:$PATH

To check if the second folder is in the PATH environment variable, execute the following command in a terminal:

which transatui.py

It should point to a file located in <TransAT_Installation_directory>/transatUI/bin. If that is not the case, execute the following command

export PATH=<TransAT_Installation_directory>/transatUI/bin:$PATH

Please note: to keep these settings permanently add the export commands to  /.bashrc or  /.cshrc if the bash or c-shell is used.

Please note: it is assumed in the following sections that the environment variables have been set accordingly to the present section. Full path to executable should be used if that is not the case.

8.2 Generation of simulation files

Please note: the generation of simulation files requires executing the transatui.py script which runs a graphical programme. If the generation of simulation files is done remotely, the X11 port forwarding should be enabled when connecting to the host

ssh -X username@host

To generate the simulation files, execute the following command in a terminal

transatui.py --Graphics bash --Project <project_file>

where <project_file> refers to the TransAT project file i.e. the *.stt file.

8.3 Running TransAT on a workstation in command line

8.3.1 Advanced initial conditions

If advanced initial conditions are used to initialise a simulation, the advanced initial conditions file, initialconditions.cxx, must first be compiled and run.

To do so, execute the following command

tmb_init_compile.py -n <nprocs>

with <nprocs> the number of processors to be used to run the initial conditions which should be no greater than the number of blocks defined in the setup of the simulation.

Note that if the -n option is not specified the initial conditions executable will be created but not executed. In that case re-run the tmb_init_compile.py command with the specified number of processors.

To display the number of blocks directly in command line

The first line displayed by the command corresponds to the number of blocks in the domain.

8.3.2 Running a simulation

To run a simulation in command line, execute the following command

tmb_run.py -n <nprocs>

with <nprocs> the number of processors to be used to run the simulation which should be no greater than the number of blocks defined in the setup of the simulation.

Note that if the -n option is not specified the number of processors used to run the simulation will be set to 1.

Options

Some simulation options can be set to run simulations for a fixed number of time steps and/or iterations. The corresponding arguments are --maxiterations and --ntimesteps.

Simulations can also be run with user-defined functions by calling tmb_run.py with the -u option.

Please note: if user-defined functions are to be called, the command

tmb_link.py -u

is to be executed before running tmb_run.py.

Examples
tmb_run.py -n 4 
tmb_run.py -u -n 4 
tmb_run.py -n 1 --maxiterations 100 
tmb_run.py -u -n 2 --ntimesteps 1000 
tmb_run.py -n 4 --ntimesteps 300 --maxiterations 10

8.3.3 Stopping a simulation

To stop a simulation,

These operations can be done in command line by executing the following command from the project folder:

echo STOP > transat_mb.rti

Once transat_mb.rti has been saved, the simulation should be stopped after completing the current iteration or time step depending on whether the simulation is steady or unsteady. The file <project_name>.runb should be created upon stopping the simulation. This file can be used to restart the simulation from where it has been stopped.

8.3.4 Restarting a simulation

There are two methods to restart simulations with TransAT:

Matching restart

To restart a simulation with the matching restart method, run tmb_run.py with the following arguments:

tmb_run.py -n <nprocs> --restartfile <restart_file> 
                       --restartpropertiesfile <restart_properties_file>

<restart_file> can be any restart solution file generated by the setup of the simulation or any setup that uses the same domain and grid. Usually it will have the same name as the project file, an optional time step number and a .runa or .runb file ending.

The <restart_properties_file> contains the restart properties of all the embedded solids, if present. It is especially important for simulations with rigid body motion. For simulations without embedded solids this argument can be omitted. Usually it will have the name properties.dat. ….runb with an optional time step number in place of the .

Note that a simulation can be restarted in combination with any argument of the tmb_run.py script. Examples
 

tmb_run.py -n 4 --restartfile projectname.runb 
                --restartpropertiesfile properties.dat.runb 
tmb_run.py -n 1 --restartfile projectname.001000.runb 
                --restartpropertiesfile properties.dat.001000.runb 
                --maxiterations 100 
tmb_run.py -n 4 --restartfile projectname.runb --ntimesteps 300 --maxiterations 10
Non-matching restart

To restart a simulation with the non-matching restart method, run tmb_run.py with the following arguments:

tmb_run.py -n <nprocs> --nmrestartfile <restart_file> --nmgridfile <grid_file> 
                       --restartpropertiesfile <restart_properties_file>

<restart_file> can be any setup that uses the same domain including restart files generated with a different grid. <grid_file> is the corresponding grid file (*.grda) in the setup that was used to generate the restart file. The <restart_properties_file> contains restart information for embedded solids and is essential for simulations with rigid body motion. For simulations without embedded solids this argument can be omitted. See section Matching restart for examples of typical solution and solid properties restart file designations.

Note that a simulation can be restarted in combination with any argument of the tmb_run.py script. Examples
 

tmb_run.py -n 4 --nmrestartfile proj_coarse.runb --nmgridfile proj_coarse.grda 
                --restartpropertiesfile properties.dat.runb 
tmb_run.py -n 1 --nmrestartfile proj.001000.runb --nmgridfile proj.grda 
                --restartpropertiesfile properties.dat.001000.runb 
                --maxiterations 100 
tmb_run.py -n 4 --nmrestartfile proj_coarse.runb --nmgridfile proj_coarse.grda 
                --ntimesteps 300 --maxiterations 10

8.4 Running TransAT on a cluster

Contrary to workstations, computational resources are not immediately available on clusters. The allocation of the resources and the launch of parallel jobs is managed by a queuing system (Grid Engine, PBS, etc. ). Simulations must be run by submitting jobs to the queuing system of the cluster. In this section the different steps to set up a job running TransAT on a cluster are detailed.

8.4.1 Settings

To run simulations on a cluster, the path <TransAT_Installation_directory>/transatMB/bin must be added to the execution path for all the nodes. Please contact your System Administrator to apply these settings.

8.4.2 Advanced initial conditions

If advanced initial conditions are used to initialise a simulation to be run on a cluster, the advanced initial conditions file, initialconditions.cxx, must first be compiled.

To do so, execute the following command

tmb_init_compile.py

This command will generate the executable transatmbinitialDP in the project folder.

To initialise the simulation, the following line needs to be executed in the job submission script

<parallel_exec_command> ./transatmbinitialDP

with <parallel_exec_command> the command to run an executable in parallel on the cluster, e.g. mpirun -np <nprocs> with <nprocs> the number of processors to be used to run the simulation. Please refer to your cluster documentation to get the corresponding command to run an executable in parallel.

8.4.3 Running a simulation

To run a simulation on a cluster without user-defined function, the following line should be present in the job submission script

<parallel_exec_command> transatmbDP



If the simulation is to be run with user-defined functions, the following command must first be run

tmb_link.py -u

This command will generate the executable uitransatmbDP in the project folder.

Please note: This command does not create the files uifilelist.py, registerfunctors.cxx, or registerfunctors.h, which are required for UDF compilation. To create these, compile from the User Defined Functions tab of TransATUI, after which tmb_link.py -u can be used from the command line.
To run a simulation with user-defined function on a cluster, the following line should be present in the job submission script

<parallel_exec_command> ./uitransatmbDP

8.4.4 Stopping a simulation

To stop a simulation,

These operations can be done in command line by executing the following command from the project folder:

echo STOP > transat_mb.rti

Once transat_mb.rti has been saved, the simulation should be stopped after completing the current iteration or time step depending on whether the simulation is steady or unsteady. The file <project_name>.runb should be created upon stopping the simulation. This file can be used to restart the simulation from where it has been stopped.

8.4.5 Restarting a simulation

There are two methods to restart simulations with TransAT:

Matching restart

To restart a simulation with the matching restart method,

Alternatively, the restart file can be specified in transat_mb.inp instead of using the *.rstb file. (i.e. ignoring the third and fourth step in the set of instructions given above). To do so:

Please note: that for restart files located inside the project folder, relative file paths can also be specified.

The simulation is completely set to restart after doing these operations. To restart the simulation, execute the job submission script which should be the same as the one used to run TransAT i.e. either of the following lines depending on the use of user-defined functions or not should be present in the script to run the simulation

<parallel_exec_command> transatmbDP
<parallel_exec_command> ./uitransatmbDP
Non-matching restart

To restart a simulation with the non-matching restart method,

Please note: that for restart files located inside the project folder, relative file paths can also be specified.

The simulation is completely set to restart after doing these operations. To restart the simulation, execute the job submission script which should be the same as the one used to run TransAT i.e. either of the following lines depending on the use of user-defined functions or not should be present in the script to run the simulation

<parallel_exec_command> transatmbDP
<parallel_exec_command> ./uitransatmbDP

Chapter 9
Custom Features

Several TransAT tools give user more control on the simulation settings and access to data produced by TransAT during the simulation. These tools are particularly useful to set custom initial conditions and for the definition of user defined functions. Note that these tools are not directly available in the user interface.

9.1 TransAT Tools

A set of tools are available to access and post-process the data produced by TransAT. These tools consist of

9.1.1 Properties Module

The thermodynamic variables such as pressure, temperature, etc... can be set and read using the properties module of TransAT. On top of including cppinterface.h, the following steps have to be followed to use the properties module in advanced initial conditions file or user-defined functions:

  1. Initialise the module at a certain block number, nb, and cell index, ii, inside the for loop for the block and cell indices using:
       properties_initialize(nb, ii);

  2. To set the value of a thermodynamic variable, e.g. pressure, for the first phase equal to 150.0 use:
       properties_set_state("pressure", 150.0, 0);

  3. To set the value of a thermodynamic variable, e.g. temperature, at the mixture level equal to 273.0 use:
       properties_set_state("temperature", 273.0);

  4. One can get the value of different thermodynamic variables using the get function at the phase and the mixture level. Please note that either the value will be computed based on the variables which were set or the value of the variable which was set would be returned directly.
       double density_mixture  = properties_get("density");  
       double density_phase    = properties_get("density", 0);

  5. One can also get the value of thermodynamic variables at a specific cell numbers for any block using
       double density_mixture  = properties_get("density", nb, ii);  
       double density_phase    = properties_get("density", nb, ii, 0);

  6. To push back the values of all the dependent and set thermodynamic variables use:
       properties_set_back();

The variables that can be accessed through the properties module along with their corresponding keywords are listed below.

∂ρ
∂T|p                          : drhodt_p 
∂ρ
∂p|T                          : drhodp_t 
∂ρ
∂p                            : drhodp 
Thixotropic Scalar            : thixotropic_scalar 
Shear Rate                    : shear_rate 
Level Set Value               : levelset 
Thermal Conductivity          : lambda 
Volume Fraction                 : alpha 
Acoustic Impedance            : acoustic_impedances 
Cohesion Pressure             : cohesion_pressure 
Heat Capacity Ratio (Cp/Cv)   : heat_capacity_ratio 
Molecular Weight              : molecularweight 
Viscosity                     : viscosity 
Specific Heat Capacity        : cp 
Speed of Sound                : soundspeed 
Enthalpy                      : energy 
Temperature                   : temperature 
Density                       : density 
Pressure                      : pressure

The following section is a template for the use of properties module in the initialconditions.cxx file:

   for (int nb=0; ii < nblocks; nb++) {  
      for (int ii=0; ii < nijk; ii++) {  
         properties_initialize(nb, ii);  
         properties_set_state("pressure", 0.0);  
         properties_set_state("temperature", 273.0);  
         double density_mixture  = properties_get("density");  
         double density_phase    = properties_get("density", 0);  
         properties_set_back();  
      }  

9.1.2 Interfaces to TransAT data structure

A set of interfaces are available to access elements of the data structure generated by TransAT for simulations. The main use of these interfaces is to define advanced initial conditions and user-defined functions (run-time processing and post-processing). The elements that can be accessed consist of

Please note: the header file cppinterface.h needs to be included int the user-defined function to access the interfaces.

Accessing parameters

It is often required to read simulation parameters or some other global variables to set the initial conditions or post-process simulations. For example, the number of blocks in the domain is one such variable and it is often needed. Indeed, TransAT being a multiblock code, it is required to loop over all the blocks in the domain to access and set values over the domain. In some other cases, one may need to use the components of the gravity vector or the saturation temperature to initialise variables or to compute quantities in user-defined functions for instance. All these TransAT parameters can be accesed. To access them, depending on the type of variable (integer, real or logical) specific functions can be called. Getting an Integer
 
To get a global parameter of type integer the get_integer function can be called

with

For example, the time-step index is obtained in the following code excerpt:

  int itimestep; 
 
  // Get current time step 
  itimestep = get_integer(timestep);


To get a block-specific parameter of type integer the get_integer function can be called

with

For example, the number of cells is obtained in the in x-direction of the first block is obtained in the following code excerpt:

  int nb = 0; 
  int ni; 
 
  // Get number of cells in x-direction for block nb 
  ni = get_integer(nb,ni);

The list of accessible parameters and keywords is available here. Getting a Double
 
To get a global parameter of type double the get_double function can be called

with

For example, the interface width is obtained in the following code excerpt:

  double interfacewidth; 
 
  // Get interface width for two-phase flow 
  interfacewidth = get_double(delta);


The list of accessible parameters and keywords is available here. Getting a Logical
 
To get a global parameter of type logical the get_logical function can be called

with

For example, the solving status of the Level-set equation is obtained in the following code excerpt:

  bool solving_levelset; 
 
  solving_levelset = false; // Initialise 
 
  // Find out if Level Set is being solved 
  solving_levelset = get_logical(solve_levelset);


The list of accessible parameters and keywords is available here.

List of accessible parameters

Simulation parameters can be accessed in advanced initial conditions or user-defined functions by calling the corresponding function as in the following example where the gravity vector component in the x-direction is used to set the pressure.

   double *p; 
   int nblocks; 
   int nijk; 
   double rho,xgravity; 
 
   xgravity = get_double(xgravity); 
   rho = get_double(rhog); 
   nblocks = get_integer(nblocks); 
 
   for (int nb=0; nb < nblocks; nb++){ 
      nijk = get_integer(nb,nijk); 
      set_pointer(nb,&p,pressure); 
      for (int ii = 0; ii < nijk; ii++){ 
         p[ii] = -xgravity*x[ii]*rho; 
      } 
   }

Variables that can be accessed are the following:

-------------------------------------------------------------  
 Integer Variables              Valid Keywords  
-------------------------------------------------------------  
(global, accessible by: get_integer("keyword")  
Current Time Step                : "timestep"  
Output frequency                 : "output_frequency"  
 
Number of particle sub-steps     : "particle_nsubsteps"  
Current particle sub-step        : "particle_substep"  
 
Advection scheme density         : "scheme_density"  
Advection scheme u-velocity      : "scheme_uvelocity"  
Advection scheme v-velocity      : "scheme_vvelocity"  
Advection scheme w-velocity      : "scheme_wvelocity"  
Advection scheme temperature     : "scheme_temperature"  
Advection scheme concentration   : "scheme_concentration"  
Advection scheme levelset        : "scheme_levelset"  
 
Advection scheme turbulent kinetic energy: "scheme_tke"  
Advection scheme epsilon                 : "scheme_epsilon"  
 
Number of blocks                 : "nblocks"  
Number of phases                 : "nphases"  
Number of particle classes       : "nclasses"  
 
-------------------------------------------------------------  
 Integer Variables              Valid Keywords  
-------------------------------------------------------------  
(global and indexed, accessible by: get_integer("keyword",index)  
BMR level to global block index  : "bmr_block_level_global"  
BMR level to local block index   : "bmr_block_level_local"  
 
Processor holding global block   : "global_block_to_proc"  
Local index of global block      : "global_block_to_local"  
 
-------------------------------------------------------------  
 Integer Variables              Valid Keywords  
-------------------------------------------------------------  
(per block, accessible by: get_integer(nb,"keyword")  
Global block index               : "gnb", "glob_nb"  
 
Number of Grid points in I       : "ni"  
Number of Grid points in J       : "nj"  
Number of Grid points in K       : "nk"  
Number of Grid points I*J        : "nij"  
Number of Grid points I*J*K      : "nijk"

-------------------------------------------------------------  
 Double  Variables                Valid Keywords  
-------------------------------------------------------------  
Time interval:                    "dtime", "delt"  
Current time:                     "time" , "ctime"  
 
Particle sub-step time interval:  "particle_dtsubstep"  
 
Gravity in X direction:           "xgravity"  
Gravity in Y direction:           "ygravity"  
Gravity in Z direction:           "zgravity"  
 
Density of Phase 1:               "rhog"  
Viscosity of Phase 1:             "viscg"  
Heatcapacity of Phase 1:          "cpg"  
Thermal conductivity of Phase 1:  "lambg"  
Molecular weight of Phase 1:      "mwg"  
Scalar diffusivity of Phase 1:    "c_diffg"  
Thermal expansion of Phase 1:     "texpg"  
 
Density of Phase 2:               "rhol"  
Viscosity of Phase 2:             "viscl"  
Heatcapacity of Phase 2:          "cpl"  
Thermal conductivity of Phase 2:  "lambl"  
Molecular weight of Phase 2:      "mwl"  
Scalar diffusivity of Phase 2:    "c_diffl"  
Thermal expansion of Phase 2:     "texpl"  
 
Surface tension coefficient:      "weber"  
Saturation temperature:           "tsat"  
Interface width:                  "delta"  
 
Levelset narrowband size:         "reinit_distance"  
Equilibrium contact angle (deg):  "eq_contact_angle"  
Equilibrium contact angle (rad):  "eq_contact_angle_rad"  
 
Real constant zero:               "zero"  
Real constant one:                "one"  
Real constant Pi:                 "pi"  
Real constant small:              "small"  
Real constant infinity:           "infty"

-------------------------------------------------------------  
 Logical Variables               Valid Keywords  
-------------------------------------------------------------  
If solving pressure:             "solve_pressure"  
If solving u-velocity:           "solve_uvelocity"  
If solving u-velocity:           "solve_vvelocity"  
If solving u-velocity:           "solve_wvelocity"  
If solving temperature:          "solve_temperature"  
If solving solid temperature:    "solve_tsolid"  
If solving concentration:        "solve_concentration"  
If solving Level Set:            "solve_levelset"  
If solving VoF:                  "solve_vof"  
If solving immersed surfaces:    "activate_embedded_interface"

Accessing variables

Arrays storing values of variables that are set and solved for by TransAT can be accessed through pointers in advanced initial conditions or user-defined functions. The access to these arrays is done block-wise by calling the set_pointer function.

with

Please note: in order to access and set thermodynamic properties like pressure, temperature, etc. it is recommended to use the Properties Module.

The list of accessible variables and their corresponding keywords is available here.

Below, a full example of sets of variables accessed through pointer is shown:

  int nblocks; 
  int nijk; 
  double *xcenter, *xcorner; 
  double *ycenter, *ycorner, *volume; 
  double *levelset; 
  double *dirac_levelset; 
 
  int ii; 
  double total_interfacial_area; 
 
  //- 
  //- Get number of blocks 
  //- 
  nblocks = get_integer(nblocks); 
 
  //- 
  //- Loop over blocks 
  //- 
 
  for (int nb=0; nb < nblocks; nb++){ 
  //- 
  //- Get block grid size 
  //- 
  nijk = get_integer(nb,nijk); 
 
  //- 
  //- Get access to cell centers 
  //- 
  set_pointer(nb,&xcenter,cellcenterx); 
  set_pointer(nb,&ycenter,cellcentery); 
  //- 
  //- Get access to cell corners 
  //- 
  set_pointer(nb,&xcorner,cellcornerx); 
  set_pointer(nb,&ycorner,cellcornery); 
  //- 
  //- Get access to level set, Dirac delta & cell volume 
  //- 
  set_pointer(nb,&levelset,levelset); 
  set_pointer(nb,&dirac_levelset,deltaphi); 
  set_pointer(nb,&volume,cellvolume); 
 
  //------------------------------------------// 
  //- Calculate total interfacial area (say) -// 
  //------------------------------------------// 
  total_interfacial_area = 0.0; 
  for (int ii=0; ii < nijk; ii++) { 
    total_interfacial_area = total_interfacial_area+volume[ii]*dirac_levelset[ii]; 
  } 
  } // End of the loop over blocks

List of accessible variables

The following is the list of arrays, integers, reals, and logicals that are accessible in advanced initial conditions files and user-defined functions:

-------------------------------------------------------------  
 Array Pointers                Valid Keywords  
-------------------------------------------------------------  
(per block, accessible by: set_pointer(nb,aptr,"keyword")  
Cell volume:                   "cellvolume"  
Fluid density:                 "rhofluid","density"  
Composite fluid-solid density: "isden","solidfluiddensity"  
 
Pressure:                      "isp","pres","pressure"  
U-velocity:                    "isu","uvel","uvelocity"  
V-velocity:                    "isv","vvel","vvelocity"  
W-velocity:                    "isw","wvel","wvelocity"  
Temperature:                   "istemp","temp","temperature"  
Concentration:                 "isconc","conc","concentration"  
 
Turbulent kinetic energy:      "tke"  
Turbulent dissipation rate:    "tke_diss","epsilon"  
Eddy viscosity ratio:          "mut","mu_t"  
 
Cell center X:                 "isx","ccenx","cellcenterx"  
Cell center Y:                 "isy","cceny","cellcentery"  
Cell center Z:                 "isz","ccenz","cellcenterz"  
 
Cell corner X:                 "iscox","ccorx","cellcornerx"  
Cell corner Y:                 "iscoy","ccory","cellcornery"  
Cell corner Z:                 "iscoz","ccorz","cellcornerz"  
 
Interpolation coefficient I:   "isfx","inti","interpolationi"  
Interpolation coefficient J:   "isfy","intj","interpolationj"  
Interpolation coefficient K:   "isfz","intk","interpolationk"  
 
Level Set:                     "isph","levelset"  
Curvature:                     "curvature","curv"  
Interfatial Dirac Delta:       "deltaphi","discdel"  
 
Volume of Fluid:               "iss","vof"  
 
Embedded Level Set/Immersed surface: "lsembed"  
Embedded Heaviside:                  "hembed"  
Wall distance:                       "walldistance", "walldist"  
Solid Temperature:                   "tsolid"  
Solid Temperature Heaviside:         "htsolid"  
 
Block-out function:            "kblk","block"  
 
Time averaged statistics:  
 
averaged U-velocity           :      "stats_um", "Umean", "mean_U"  
averaged V-velocity           :      "stats_vm", "Vmean", "mean_V"  
averaged W-velocity           :      "stats_wm", "Wmean", "mean_W"  
averaged pressure             :      "stats_pm", "Pmean", "mean_P"  
reynolds_stress uu            :      "stats_ufuf", "reynolds_stress_11"  
reynolds_stress vv            :      "stats_vfvf", "reynolds_stress_22"  
reynolds_stress ww            :      "stats_wfwf", "reynolds_stress_33"  
reynolds_stress uv            :      "stats_ufvf", "reynolds_stress_12"  
reynolds_stress uw            :      "stats_ufwf", "reynolds_stress_13"  
reynolds_stress vw            :      "stats_vfwf", "reynolds_stress_23"  
averaged Pprime sqr           :      "stats_pfpf", "mean_Pprime_sqr", "Pprime_sqr_mean"  
averaged Tprime sqr           :      "stats_tftf", "mean_Tprime_sqr", "Tprime_sqr_mean"  
averaged temperature          :      "stats_tm", "Tmean", "mean_T"  
averaged TKE                  :      "stats_tkem", "mean_tke", "tke_mean"  
averaged epsilon              :      "stats_epsm", "mean_eps", "eps_mean"  
averaged eddy visc ratio      :      "stats_mutm", "mean_mut", "mut_mean"  
averaged subgrid visc         :      "stats_sgsvism", "mean_subgrid_visc", "subgrid_visc_mean"  
averaged density              :      "stats_denm", "mean_dens", "dens_mean"  
averaged concentration        :      "stats_concm", "mean_conc", "conc_mean"  
averaged level-set            :      "stats_lsetm", "mean_levelset", "levelset_mean"  
averaged liquid indicator     :      "stats_hliqm", "mean_liq_indic", "liq_indic_mean"  
averaged turbulent heat flux X:      "stats_uftf", "turbulent_heat_flux_1"  
averaged turbulent heat flux Y:      "stats_vftf", "turbulent_heat_flux_2"  
averaged turbulent heat flux Z:      "stats_wftf", "turbulent_heat_flux_3"  
 
Radiative Heat Transfer X:     "radheatfluxx"  
Radiative Heat Transfer Y:     "radheatfluxy"  
Radiative Heat Transfer Z:     "radheatfluxz"  
 
Area component cell center 11:    "areacellcenter11"  
Area component cell center 12:    "areacellcenter12"  
Area component cell center 13:    "areacellcenter13"  
Area component cell center 21:    "areacellcenter21"  
Area component cell center 22:    "areacellcenter22"  
Area component cell center 33:    "areacellcenter23"  
Area component cell center 31:    "areacellcenter31"  
Area component cell center 32:    "areacellcenter32"  
Area component cell center 33:    "areacellcenter33"  
 
-------------------------------------------------------------  
 Array Pointers                Valid Keywords  
-------------------------------------------------------------  
(per block and phase component, accessible by: set_pointer(nb,aptr,"keyword",arg1,arg2)  
Phase component mass fraction:    "component_massfraction"  

Converting 1D/3D index

In a block-structured cartesian grid a cell is defined by the block number and the index i/j/k, where i/j/k is the spatial index in x/y/z-direction. TransAT is storing arrays linearily, therefore the i/j/k index is converted to a 1D index ii. The 1D index can be simply calculated from i/j/k as

where number of cells in i/j-direction (ni/nj) can be extracted using the get_integer function. To do the opposite and convert a 1D to a 3D index there is a TransAT function available:

with

See an example converting a 1D to 3D index and back in the Code block in Listing 9.1.

Getting the number of wall cells

The number of cell faces in a certain direction can be obtained by calling the following function

with

Valid keywords for the direction argument are:

This function is particularly useful to loop over cells of a specific wall to evaluate wall quantities.

In the following code excerpt the number of cells on the ymax face is obtained for block 0:

  int nb = 0; 
  // Number of cells on the ymax face of block 0 
  int nim = getWallBoundaryNFaces(nb, north); 
 
  /* The same result could have also been achieved 
  with either of the following two statements 
  int nim = getWallBoundaryNFaces(nb, n); 
  int nim = getWallBoundaryNFaces(nb, ymax); 
  */
Getting wall quantities

Values in a given cell at a wall in a given direction can be obtained by calling getWallBoundaryValue:

with


Available quantities and their corresponding keywords are:


Valid keywords for the direction argument are:


In the following code excerpt the dimensionless wall distance is obtained for the first cell of block 0 on the ymax surface:

  int nb = 0; 
  // Dimensionless wall distance in the first cell of block 0 on the ymax surface 
  double yplus = getWallBoundaryValue(nb, 0, yplus, ymax); 
 
  /* The same result could have also been achieved 
   with either of the following statements 
  double yplus = getWallBoundaryValue(nb, 0, y+, ymax); 
  double yplus = getWallBoundaryValue(nb, 0, dlwd, ymax); 
  double yplus = getWallBoundaryValue(nb, 0, yplus, north); 
  double yplus = getWallBoundaryValue(nb, 0, y+, north); 
  double yplus = getWallBoundaryValue(nb, 0, dlwd, north); 
  double yplus = getWallBoundaryValue(nb, 0, yplus, n); 
  double yplus = getWallBoundaryValue(nb, 0, y+, n); 
  double yplus = getWallBoundaryValue(nb, 0, dlwd, n); 
  */
Example
 
The following piece of code makes use of the getWallBoundaryNFaces and getWallBoundaryValue functions to print several wall quantities for each wall face in the domain.
char directions[6][2] = {n, s, e, w, t, b}; // define directions 
int nim; 
double area, xp, xb, yp, yb, zp, zb, delt; 
int nblocks = get_integer(nblocks); 
// loop over all blocks 
for (int nb=0; nb < nblocks; nb++) { 
  // loop over all directions 
  for(int i = 0; i<6; i++){ 
    nim = getWallBoundaryNFaces(nb, directions[i]); 
    printf(Block_%i,_direction_%s:\nnumber_of_cell_faces_on_the_wall:_%i\n, 
      nb, directions[i], nfaces); 
 
    // loop over all faces of current wall 
    for(int j = 0; j < nim; j++) { 
      area = getWallBoundaryValue(nb, j, area, directions[i]); 
      xp   = getWallBoundaryValue(nb, j, xp,   directions[i]); 
      xb   = getWallBoundaryValue(nb, j, xb,   directions[i]); 
      yp   = getWallBoundaryValue(nb, j, yp,   directions[i]); 
      yb   = getWallBoundaryValue(nb, j, yb,   directions[i]); 
      zp   = getWallBoundaryValue(nb, j, zp,   directions[i]); 
      zb   = getWallBoundaryValue(nb, j, zb,   directions[i]); 
      delt = getWallBoundaryValue(nb, j, delta,directions[i]); 
 
      printf(\tFace_%i,_area_%.4e_xp_%.4e_xb_%.4e 
        yp_%.4e_yb_%.4e_zp_%.4e_zb_%.4e_delta_%.4e\n, 
        j, area, xp, xb, yp, yb, zp, zb, delt); 
    } 
  } 
}
Getting the cell center index next to wall

The index of the cell center next to a wall in a given direction can be obtained by calling getWallBoundaryCellIndex:

with

Using the properties module then the cell center quantities can be used together with the wall values. Below is as small example how to use this. The example loops over wall boundaries, extracting the wall temperature and the corresponding cell center temperature. Using finite differences, the temperature gradient and the corresponding heat flux is calculated and compared to the heat flux used in TransAT. Furthermore the example also shows the function convert1DindexTo3D converting 1D-index ii to 3D-index i,j,k.

Listing 9.1: Example
// local number of blocks 
int nblocks = get_integer(nblocks); 
// loop over blocks 
for (int nb=0; nb < nblocks; nb++){ 
   int ni = get_integer(nb,ni); // number of cells in x/i-direction 
   int nj = get_integer(nb,nj); // number of cells in y/j-direction 
   std::cout<<local block index (nb)    : <<nb<<std::endl; 
   std::cout<<local block size  (ni,nj) : <<ni<<, <<nj<<std::endl; 
   // get number of north (ymax) boundary faces 
   int nWalls = getWallBoundaryNFaces(nb, north); 
   // loop over north wall boundaries 
   for (int iWall = 0; iWall < nWalls; iWall++){ 
      // get index of cell with given given north wall boundary face 
      int iiWallCell = getWallBoundaryCellIndex(nb, iWall, north); 
      // convert 1D index to 3D index 
      int i,j,k; 
      convert1DindexTo3D(nb,iiWallCell,i,j,k); 
      // calculate back 1D index from 3D index (to show consistency) 
      // which will be the same as iiWallCell 
      int iiWallCellFromIJK = i+j*ni+k*ni*nj; 
 
      // Wall temperature 
      double Twall = getWallBoundaryValue(nb, iWall, temperature, north); 
      // initialise properties module in cell center next to wall face 
      // to have access to cell properties like temperature 
      properties_initialize(nb, iiWallCell); 
      double Tcell  = properties_get(temperature); 
      double lambda = properties_get(lambda); 
 
      // normal distance cell center to wall 
      double wallDist = getWallBoundaryValue(nb, iWall, walldistance, north); 
      double heatFluxFD = -(Tcell-Twall)/wallDist*lambda; 
 
      // heat flux as used internally by TransAT 
      // (using wallfunctions for turbulent cases) 
      double heatFluxTransAT = getWallBoundaryValue(nb,iWall,heatflux,north); 
 
      // screen output 
      std::cout<<  Wall boundary index:  
               <<iWall<<std::endl; 
      std::cout<<    local cell index  (ii)               :  
               <<iiWallCell<<std::endl; 
      std::cout<<    local cell index  (i,j,k)            :  
               <<i<<, <<j<<, <<k<<std::endl; 
      std::cout<<    ii = i + j*ni + k*ni*nj              :  
               <<iiWallCellFromIJK<<std::endl; 
      std::cout<<    temperature(wall/cell)               :  
               <<Twall<</<<Tcell<<std::endl; 
      std::cout<<    heatflux(Finite Differences/TransAT) :  
               <<heatFluxFD 
               <</<<heatFluxTransAT<<std::endl; 
   } 
}

Below the output of the code above for a small laminar testcase where the heat flux using finite differences matches the TransAT heat flux:

local block index (nb)    : 0 
local block size  (ni,nj) : 15, 15 
  Wall boundary index: 0 
    local cell index  (ii)               : 617 
    local cell index  (i,j,k)            : 2, 11, 2 
    ii = i + j*ni + k*ni*nj              : 617 
    temperature(wall/cell)               : 310/306.957 
    heatflux(Finite Differences/TransAT) : 15.6385/15.6385 
  ...

Getting particle quantities

When lagrangian particle tracking is applied access to particle data is provided to the user by user-defined functions and the particle interface class, defined in Particle.h.

Some general particle-modelling information can be accessed with the following methods

In order to get access to the properties and paramters of a specific particle, a particle object must first be created using its block-independent particle index

The properties and parameters of a specific particle can be accessed through the following get functions:

Please note: the particle interface class and its member functions belong to the tmb namespace.

In the following code excerpt, particle properties and parameters are accessed using the get functions described above.

  #include Particle.h 
 
  ... 
  ... 
 
  int nblocks, nparticles, nbGlobal; 
  double pdiameter; 
 
  Eigen::Vector3d ppos, pvel, povel; 
  Eigen::Vector3i pcell; 
 
  //- 
  //- Get number of blocks 
  //- 
  nblocks = get_integer(nblocks); 
 
  //- 
  //- Loop over blocks 
  //- 
  for (int nb=0; nb < nblocks; nb++){ 
 
    //- Get number of particles in local block 
    nparticles = tmb::Particle::getNumParticlesLocal(nb); 
 
      //- 
      //- Loop over particles in current block 
      //- 
      for (int np=0; np < nparticles, np++){ 
 
        // Convert particle block-local index into block-independent index 
        int ip = tmb::Particle::convertPindex(np,nb); 
 
        // Create particle object 
        tmb::Particle p(ip); 
 
        // Get current particle position (x,y,z) 
        ppos = p.getPosition(); 
 
        // Get current particle velocity (u,v,w) 
        pvel = p.getVelocity(); 
 
        // Get particle velocity at previous time step (u\_old,v\_old,w\_old) 
        povel = p.getOldVelocity(); 
 
        // Get index of cell where particle is contained (i,j,k) 
        pcell = p.getCellIndex(); 
 
        // Get particle diameter 
        pdiameter = p.getDiameter(); 
 
        // Get global block index of block containing particle 
        nbGlobal = p.getGlobalBlockIndex(); 
 
      } // end of the loop over particles 
 
  } // end of the loop over blocks
Other Functions

Other functions available for use by any user:

9.1.3 Cell-data access and filtering

Grid

At each end of the domain and in each direction there is a padding of two cells around the internal cells. The padded cells either store boundary conditions or a copy of cell data from neighbouring blocks.

The full TransAT grid is illustrated with a typical example in Figure 9.1. It is the third layer of cells in the z-direction of a 2D-grid with a resolution of Nx × Ny × Nz = 4 × 4 × 2 cell corners (i.e. 3 × 3 × 1 cells).


PIC

Figure 9.1: TransAT grid with cell types and indices


In the subsequent examples, ni = Nx + 4, nj = Ny + 4 and nk = Nz + 4 refer to the number of cells in the three principal directions. nij = ni × nj is the number of cells in the xy-planes. In the example depicted in Figure 9.1, (ni,nj,nk) = (8,8,6) and nij = 64.

The computational domain is coloured in blue while the padded cells are coloured in orange. In terms of cell coordinates, the computational domain always ranges from i = 2 to i = ni - 4, from j = 2 to j = nj - 4 and from k = 2 to k = nk - 4 as shown in Figure 9.1. In this case, the range of internal cell indices is [2,4] × [2,4] × [2,2].

Please note: including the padded cells, all grids have at least 5 cells in each direction. The example of Figure 9.1 represents the third layer of cells in the normal direction to the plane (i.e. the z-direction in this case) which contains all the internal cells for this two-dimensional example. The first, second, fourth and fifth layer of cells in the z-direction are only made of padded cells.

Please note: the index ii of a cell of coordinates (i,j,k) is

ii = i+ j × ni + k × nij
(9.1)

The cell-indexing has been purposefully shifted in Figure 9.1 to simplify the understanding of the cell padding concept. For this specific case 2nij = 128 should be added to each of the cell-indices in Figure 9.1. This comes from Eq. 9.1 as k = 3 in the plane illustrated in Figure 9.1.

Please note: the cell-coordinates always start from 0 as shown in Figure 9.1.

Cell-markers

Cell-markers are available in initial conditions or in user-defined functions to distinguish the different types of cells (internal, boundary, etc.) and regions (fluid or solid). These markers operates as indicator functions i.e. equal to 0 or 1 depending on the type of cells. They can all be accessed using the set_pointer method described in the Accessing variables section.

There are 4 cell-markers to differentiate cell types implemented in TransAT:

The different cell-markers are illustrated in the example of Figure 9.2 which represents a grid of 3 blocks with Block 3 a BMR block.


PIC

Figure 9.2: TransAT cell markers


To distinguish fluid or solid region, the Hembed marker may be used. Contrary to the markers mentioned above, this one can take any value between 0 and 1 as it is continuous. It represents the proportion of fluid in a cell. It is equal to 1 in the fluid region and 0 in the solid region. The value varies smoothly from 0 to 1 at the interface between fluid and solid. Please refer to the Immersed Surfaces Technique section in the TransAT Equations and Algortithms handbook for more details.

In porous regions, Hembed’s value is equal to the porosity of the solid.

Cell-indexing and looping

To access and/or set values of a variable array at a specific cell, a cell-index must be given. The cell-indexing is usually done through loops over regions of interest. The looping can be done through the use of either one-dimensional or three-dimensional indices. One-dimensional looping
 
The one-dimensional index-looping is particularly useful when data is accessed or set globally for instance to initialise, integrate or find an extremum of a variable over the whole domain. The main data required for the looping is the range of indices covering the set of cells of interest. Looping over internal cells  To strictly loop over the whole set of internal cells i.e. the blue cells in Figure 9.1, the delimiting indices should be iis_inside and iie_inside which are respectively the indices of the first and last internal cells. In Figure 9.1, the cells in the set ranging from iis_inside to iie_inside are numbered in red. On top of that, the kblk cell-marker should be used to skip the non-internal cells in the iis_inside and iie_inside range.

A loop over internal cells would then be constructed as follows:

   /* nb: block index  
      iis_inside: index of first internal cell  
      iie_inside: index of last internal cell */  
 
   int* kblk;  
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // access block specific parameters such as grid properties  
      iis_inside = get_integer(nb,"iis_inside");  
      iie_inside = get_integer(nb,"iie_inside");  
      set_pointer(nb, &kblk,"kblk");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=iis_inside; ii < iie_inside; ii++) {  
         // Exclude padded cells  
         if(kblk[ii] == 0){  
            continue;  
         }  
 
         ...  
 
      }  
   }

Looping over internal and overlapping cells  To strictly loop over the whole set of internal cells along with block-overlapping cells the whole set of cells should be used for the looping in combination with the kblkmb cell-marker. The delimiting indices of the loop should then range from 0 to nijk with nijk the total number of cells in the block.

The loop would be constructed as follows:

   /* nb: block index  
      nijk: number of cells in block nb  
      kblkmb: block array storing cell-marker values */  
 
   int* kblkmb;  
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // access block specific parameters  
      nijk = get_integer(nb,"nijk");  
      set_pointer(nb, &kblkmb,"kblkmb");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=0; ii < nijk; ii++) {  
         // Exclude non-internal or non-overlapping cells  
         if(kblkmb[ii] == 0){  
            continue;  
         }  
 
         ...  
 
      }  
   }

Looping over internal, overlapping and boundary cells  To strictly loop over the whole set of internal cells along with block-overlapping cells and boundary cells, the whole set of cells should be used for the looping in combination with the filter_mask cell-marker. The delimiting indices of the loop should then range from 0 to nijk with nijk the total number of cells in the block.

The loop would be constructed as follows:

   /* nb: block index  
      nijk: number of cells in block nb  
      filter_mask: block array storing cell-marker values */  
 
   int* filter_mask;  
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // access block specific parameters such as grid properties  
      nijk = get_integer(nb,"nijk");  
      set_pointer(nb, &filter_mask,"filter_mask");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=0; ii < nijk; ii++) {  
         // Exclude non-internal, non-overlapping or non-boundary cells  
         if(filter_mask[ii] == 0){  
            continue;  
         }  
 
         ...  
 
      }  
   }

Three-dimensional looping
 
Three-dimensional index-looping should be used when more control is required for example to get data over a boundary, do some post-processing along a specific direction, plane or line, etc. The main step in this case resides in creating a one-dimensional index to access the data using the cell coordinates in the three principal directions in terms of index.

The data at a cell located at (i,j,k) can be accessed at the following ii index of the data array:

   /* ni  : number of cells in x-direction obtained by calling get_integer(nb,"ni")  
      nij : number of cells in xy-plane obtained by calling get_integer(nb,"nij") */  
      ii = i + j*ni + k*nij;

The i, j and k coordinates respectively range from 0 to ni- 1, 0 to nj - 1 and 0 to nk - 1 with ni, nj and nk the total number of cells in the x-, y- and z-directions.

For internal cells, the ranges of i, j and k are 2 to ni - 4, 2 to nj - 4 and 2 to nk - 4 as illustrated in Figure 9.1. Looping over internal cells  Using three-dimensional indexing, a loop exclusively over the internal cells would read as such:

   /* nb  : block index  
      ni  : number of cells in x-direction  
      nj  : number of cells in y-direction  
      nk  : number of cells in z-direction  
      nij : number of cells in xy-plane */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // get grid properties  
      nij  = get_integer(nb,"nij");  
      ni   = get_integer(nb,"ni");  
      nj   = get_integer(nb,"nj");  
      nk   = get_integer(nb,"nk");  
 
      /* i: cell index in x-direction  
         j: cell index in y-direction  
         k: cell index in z-direction  
         ii: 1D cell index */  
 
      // Loop over the cells of block nb  
      for (int k=2; k < nk-3; k++) {  
         for (int j=2; j < nj-3; j++) {  
            for (int i=2; i < ni-3; i++) {  
               // convert 3D to 1D index  
               ii = i + j*ni + k*nij;  
               ...  
            }  
         }  
      }  
   }

Looping over the whole set of cells  Using three-dimensional indexing, a loop over all the cells would be constructed as follows:

   /* nb  : block index  
      ni  : number of cells in x-direction  
      nj  : number of cells in y-direction  
      nk  : number of cells in z-direction  
      nij : number of cells in xy-plane */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // get grid properties  
      nij  = get_integer(nb,"nij");  
      ni   = get_integer(nb,"ni");  
      nj   = get_integer(nb,"nj");  
      nk   = get_integer(nb,"nk");  
 
      /* i: cell index in x-direction  
         j: cell index in y-direction  
         k: cell index in z-direction  
         ii: 1D cell index */  
 
      // Loop over the cells of block nb  
      for (int k=0; k < nk; k++) {  
         for (int j=0; j < nj; j++) {  
            for (int i=0; i < ni; i++) {  
               // convert 3D to 1D index  
               ii = i + j*ni + k*nij;  
 
               ...  
 
            }  
         }  
      }  
   }

Similarly to the one-dimensional indexing examples above, cell-markers can also be used to filter the dataset further.

9.1.4 Parallel post-processing

Parallel toolbox
 
When a simulation is running in parallel (with more than one processor), the UDFs are executed simultaneously by all the processors. The data from each processor needs to be gathered then sorted after the processors have operated the tasks they have been assigned. After this operation, the sorted data can be written to a file. To do the parallel data-processing, MPI (Message Passing Interface) is required. It allows communication between processors. In TransAT, a set of functions built around MPI are available to perform parallel post-processing operations. To access these functions, toolbox.h needs to be included.
Please note: the file toolbox.h is located in <TransAT_Installation_folder>/transatMB/inc.
  Gathering data from processors
 
In the case of a multiblock simulation, several blocks can be assigned to one processor. When more than one processor is used to run a simulation, the workload along with the data is spread over the processors. To gather the spread data, the user can call the following function:
tmb::toolbox::parallel_collectVector(std::vector<double>* localVector, unsigned root)

The function returns a pointer to a vector of double.
  Sorting data
 
The order of the gathered data depends on the block distributon over processors and the time required for each processor to execute the operations it has been assigned. As a result, the gathered data is not ordered and it is necessary to sort it.

The data needs to be sorted with a coordinate vector in increasing order.
Once every vector of data is added in a single pointer to a vector of vector, the sorted dataset can be obtained by calling the following function:

tmb::toolbox::getDataVectorsSortedByIndexMap(std::vector<double>* referenceGlobalVector,  
                                             std::vector<std::vector<double> >* data)

The function returns a pointer to a vector of vector with the sorted dataset.
  Writing data to file
 
The sorted data can be written to a file in a standard format by calling the following function:

tmb::toolbox::writeDataVectorsToFile(std::string filename,  
                              std::vector<std::string> &varnames,  
                              std::vector<std::vector<double> > &variables)

The vector with the file names is used to create a header in the file that will store the data.

Example of output file:

#1: coordinatename  
#2: varname_1  
#3: varname_2  
x1 var1(x1) var2(x1)  
x2 var1(x2) var2(x2)  
x3 var1(x3) var2(x3)  
...

MPI_Allreduce method
 
The MPI_Allreduce method combines values from all processors and distributes the result back to all processors. To use it, mpi.h must be included. The MPI_Allreduce method is called as follows:

MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,  
                  MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)

If a value or an array, say var_local, is to be combined into the single_value/array var_global, sendbuf and recvbuf should respectively be set to &var_local and &var_global.

If vectors are to be combined into other vectors, sendbuf and recvbuf should respectively be set to &var_local.front() and &var_global.front().

The count value should be set to 1 if values are to be combined. Otherwise, for arrays and vectors it should be the size of the var_local array/vector. Note that arrays/vectors must all at least be of size count.

Depending on the type of the &var_local and &var_global variables, the the corresponding MPI data type should be sent in as the datatype argument. Some of the most useful datatype for post-processing data from TransAT are:

Some of the combination operators that are commonly used to post-process TransAT data are:

For post-processing with TransAT, it is sufficient to always set comm to MPI_COMM_WORLD.   Example 1: value combinations  Let us assume that an executable runs on two processors. Processors 1 and 2 respectively set the var_local to 1.2 and 2.5.

To store the maximum of all the var_local in var_global, one would call MPI_Allreduce as follows

MPI_Allreduce(&var_local, &var_global, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);

This would set var_global to 2.5.

To sum all the var_local values into var_global, one would call MPI_Allreduce as follows

MPI_Allreduce(&var_local, &var_global, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);

This would set var_global to 3.7.   Example 2: array values combinations  Let us assume that an executable runs on two processors. Processors 1 and 2 respectively set the var_local array to {8.92,4.95} and {2.58,6.74}.

To store the minimum of all the var_local into the var_global array, one would call MPI_Allreduce as follows

MPI_Allreduce(&var_local, &var_global, 2, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);

This would set var_global to {2.58, 4.95}.
  Example 3: vector values combinations  Let us assume that an executable runs on two processors. Processors 1 and 2 respectively set the var_local vector to {8,5,4} and {3,7,1}.
To get the product of all the var_local values into the var_global vector, one would call MPI_Allreduce as follows

MPI_Allreduce(&var_local.front(), &var_global.front(), 3,  
              MPI_INT, MPI_PROD, MPI_COMM_WORLD);

This would set var_global to {24,35,4}. Parallel post-processing example in a UDF
 
In this example, the goal is to write the local Reynolds number versus the x coordinate in a file.

#include <stdio.h>  
#include <cmath>  
#include "userglobal.h"  
#include "user_interface.h"  
#include <algorithm>  
#include "mpi.h"  
#include <vector>  
#include <fstream>  
#include <iomanip>  
 
// Header with parallel post-processing functions  
#include <toolbox.h>  
 
UserGlobal::UserGlobal(){  
   printf("\n--------\nUDF INIT\n--------\n");  
}  
UserGlobal::~UserGlobal(){  
   printf("\n--------\nUDF DESTRUCT\n--------\n");  
}  
// end of simulation  
 
void UserGlobal::User_processing_end() //processing at the end of the simulation  
{  
int nblocks = get_integer("nblocks");  
int ncellsblock;  
char direction[] = "ymin";  
double Uinf=20.0;  
double rho=1.205;  
 
// local coordinate vector (i.e. specific to processor)  
std::vector <double>* x = new std::vector <double> ();  
 
// Global coordinate vector gathering data from all the processors  
std::vector <double>* xtotal = new std::vector <double> ();  
 
// Local vector (i.e. specific to processor) with values of Reynolds number  
std::vector <double>* Re_x = new std::vector <double> ();  
 
// Global vector gathering values of Reynolds number from all the processor  
std::vector <double>* Re_xtotal = new std::vector <double> ();  
 
//get the rank (index) of the processor executing the programm  
int glob_rank;  
MPI_Comm_rank(MPI_COMM_WORLD, &glob_rank);  
 
 
//---------Collecting the data and add them to locals vectors ---------//  
 
for (int iblock=0; iblock<nblocks; iblock++)  
{  
   ncellsblock = getWallBoundaryNFaces(iblock, direction);  
   //number of cells at the wall, in the block  
 
   for (int icell = 0; icell < ncellsblock; icell++)  
   {  
      (*x).push_back(getWallBoundaryValue(iblock, icell, "x", direction));  
 
      //here we calculate Re_x  
      (*Re_x).push_back(rho*Uinf*getWallBoundaryValue(iblock,  
                                                      icell,  
                                                      "x",  
                                                      direction)/mu));  
   }  
}  
 
//Gather data from all processors to the root  
xtotal = tmb::toolbox::parallel_collectVector(x);  
Re_xtotal = tmb::toolbox::parallel_collectVector(Re_x);  
 
if (glob_rank==0) //executed only by the root processor  
{  
   // Store all the data in a matrix  
   std::vector<std::vector<double> >* dataMatrix  
                                 = new std::vector<std::vector<double> > ();  
   dataMatrix->push_back(*xtotal);  
   dataMatrix->push_back(*Re_xtotal);  
 
   // Sorting data with coordinate vector  
   std::vector<std::vector<double> >* dataMatrixSorted  
                                 = new std::vector<std::vector<double> > ();  
   dataMatrixSorted = tmb::toolbox::getDataVectorsSortedByIndexMap(xtotal, dataMatrix);  
 
   // Store the names of the variables to put them in the header of the file  
   std::vector<std::string> varnames;  
   varnames.push_back("x");  
   varnames.push_back("Re_x");  
 
 
   tmb::toolbox::writeDataVectorsToFile(std::string("test_output.dat"),  
                                 varnames,  
                                 *dataMatrixSorted);  
   delete dataMatrix, dataMatrixSorted; //delete the pointers  
}  
delete xtotal, x, Re_x, Re_xtotal;  
return;  
}

9.2 Custom Initial Conditions

It is sometimes necessary to define initial conditions that are more complex than the ones that are currently available in the TransAT user interface. Setting more complex initial conditions can be done in two ways:

9.2.1 User-defined Initial Conditions

The Userdefined method in initialconditions.xml is of particular use to define shapes for interface-tracking simulations (i.e. with the Level-Set method). Multiple shapes can be initialised in the computational domain by specifying the relevant properties in the Level-Set node of initialconditions.xml.

Shape definitions

The available shapes for initialisation are:

To initialise a shape in the domain, the shape definition needs to be added to the level-set node in the initialconditions.xml. For each shape, specific attributes need to be specified for its definition. Below, attributes and examples for each available shape in TransAT are described. Circle
 
The following attributes can be set to initialise a circular interface (for 2D cases only) through initialconditions.xml

The coordinates of the center are set by setting coordinate nodes in the center node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

Below is an example of the definition of a circle object.

<object type=circle> 
   <attribute name=center> 
      <coordinate direction=x value=1 /> 
      <coordinate direction=y value=1 /> 
   </attribute> 
   <attribute name=radius value=0.5 /> 
</object>
Sphere
 
The following attributes can be set to initialise a spherical interface (for 3D cases only) through initialconditions.xml

The coordinates of the center are set by setting coordinate nodes in the center node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

Below is an example of the definition of a sphere object.

<object type=sphere> 
   <attribute name=center> 
      <coordinate direction=x value=3.5 /> 
      <coordinate direction=y value=-0.5 /> 
      <coordinate direction=z value=2.0 /> 
   </attribute> 
   <attribute name=radius value=2.0 /> 
</object>
Plane
 
The following attributes can be set to initialise a plane interface through initialconditions.xml

The coordinates of the center are set by setting coordinate nodes in the reference node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

The coordinates of the normal vector are set by setting coordinate nodes in the normal node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

Below is an example of the definition of a plane object.

<object type=plane> 
   <attribute name=reference> 
      <coordinate direction=x value=1.0 /> 
      <coordinate direction=y value=1.0 /> 
      <coordinate direction=z value=0.5 /> 
   </attribute> 
   <attribute name=normal> 
      <coordinate direction=x value=0.0 /> 
      <coordinate direction=y value=0.0 /> 
      <coordinate direction=z value=1.0 /> 
   </attribute> 
</object>
Rectangle
 
The following attributes can be set to initialise a rectangle interface (for 2D cases only) through initialconditions.xml

The coordinates of the center are set by setting coordinate nodes in the reference node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

The dimensions of the rectangle in the principal directions are set by setting coordinate nodes in the dimensions node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

The rectangular interface can be rotated around the normal axis of the domain by setting coordinate nodes in the rotation node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding normal direction (x, y or z) and angle of rotation in degrees.

Below is an example of the definition of a rectangle object.

<object type=rectangle> 
   <attribute name=reference> 
      <coordinate direction=x value=0.5 /> 
      <coordinate direction=y value=0.1 /> 
   </attribute> 
   <attribute name=dimensions> 
      <coordinate direction=x value=1.0 /> 
      <coordinate direction=y value=0.2 /> 
   </attribute> 
   <attribute name=rotation> 
      <coordinate axis=x value=0 /> 
      <coordinate axis=y value=0 /> 
   </attribute> 
</object>
Cuboid
 
The following attributes can be set to initialise a cuboid interface (for 3D cases only) through initialconditions.xml

The coordinates of the center are set by setting coordinate nodes in the reference node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

The dimensions of the cuboid in the principal directions are set by setting coordinate nodes in the dimensions node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and value.

The cuboid-shaped interface can be rotated around the axes in the principal directions by setting coordinate nodes in the rotation node. The coordinate nodes are defined as follows:

with <direction> and <value> replaced by the corresponding direction (x, y or z) and angle of rotation in degrees.

Below is an example of the definition of a cuboid object.

<object type=cuboid> 
   <attribute name=reference> 
      <coordinate direction=x value=10.0 /> 
      <coordinate direction=y value=10.0 /> 
      <coordinate direction=z value=3.0 /> 
   </attribute> 
   <attribute name=dimensions> 
      <coordinate direction=x value=5.0 /> 
      <coordinate direction=y value=5.0 /> 
      <coordinate direction=z value=6.0 /> 
   </attribute> 
   <attribute name=rotation> 
      <coordinate axis=x value=0 /> 
      <coordinate axis=y value=0 /> 
      <coordinate axis=z value=0 /> 
   </attribute> 
</object>
Signed distance function

The sign attribute is an attribute common to all the shapes that can be initialised with initialconditions.xml. It belongs to the Method node.

For closed shapes the sign attribute designates the sign of the distance function inside the shape. For planes, it designates the sign of the distance function under the planes (i.e. in the opposite direction of the normal vector).

By default the sign attribute is set to negative (distance function negative inside shapes/under planes ). The sign of the distance function can be flipped by setting the sign attribute to positive

<attribute name="sign" value="positive" />

Example

The following example is an xml file to set the initial fields in a two-dimensional simulation of a two-phase flow using the Level-Set method. The pressure and velocity field are automatically initialised whilst the volume fraction fields are constant over the domain.The initial shape of the interface between the two fluids is a 1m by 0.2m rectangle which centre is located at (0.5, 0.1).

<?xml version=1.0?> 
<initialconditions version=5.3> 
   <VARIABLE variable_name=Pres-Div> 
      <method type=string value=Automatic /> 
   </VARIABLE> 
   <VARIABLE variable_name=AlphaRho01> 
      <method type=string value=Constant /> 
   <constant_value type=double value=0.5 /> 
   </VARIABLE> 
   <VARIABLE variable_name=AlphaRho02> 
      <method type=string value=Constant /> 
      <constant_value type=double value=0.5 /> 
   </VARIABLE> 
   <VARIABLE variable_name=U-Velocity> 
      <method type=string value=Automatic /> 
   </VARIABLE> 
   <VARIABLE variable_name=V-Velocity> 
      <method type=string value=Automatic /> 
   </VARIABLE> 
   <VARIABLE variable_name=Temperature> 
      <method type=string value=Constant /> 
      <constant_value type=double value=300 /> 
   </VARIABLE> 
   <VARIABLE variable_name=Level-Set> 
      <method type=string value=Userdefined> 
         <attribute name=sign value=positive /> 
         <object type=rectangle> 
            <attribute name=reference> 
               <coordinate direction=x value=0.5 /> 
               <coordinate direction=y value=0.1 /> 
            </attribute> 
            <attribute name=dimensions> 
               <coordinate direction=x value=1.0 /> 
               <coordinate direction=y value=0.2 /> 
            </attribute> 
            <attribute name=rotation> 
               <coordinate axis=x value=0 /> 
               <coordinate axis=y value=0 /> 
            </attribute> 
         </object> 
      </method> 
   </VARIABLE> 
</initialconditions>

This file is read at runtime and all variables are initialized before the actual iterating/time-stepping process.

Samples of initial conditions in the xml format initialising various shapes for the Level-Set method are available in the following folder:
<TransAT_installation_folder>/transatMB/input/initialconditions_templates

9.2.2 Advanced Initial Conditions

In very simple cases, initial conditions can be set directly in the Initial Conditions tab. However, in more complex cases where a greater degree of influence is required by the user over the initial settings of the simulation, it may become necessary to set advanced initial conditions using a C++ routine.

The general workflow to set advanced initial conditions consists of creating the advanced initial conditions file initialconditions.cxx then compiling it and running it.

Initial conditions template

An initial conditions file template is available at the following location:

 <TransAT_Installation_folder>/transatMB/input/initialconditions.cxx 
 
Setting advanced initial conditions in the graphical user interface

Editing, compiling and running the initial conditions can be done through the graphical user interface. These functionalities are available after selecting the Input and Initial Conditions sub-tab, enabling Advanced Initial Conditions.

Clicking PIC opens an initial conditions file. If an initial conditions file was already available in the project folder, that very file will be opened in the default text editor after clicking PIC.

If no initial conditions file is available in the project folder, clicking PIC copies the template initial conditions file to the project folder then opens the copy in the default text editor. It can be modified to suit the need of the simulation.

Once the initial conditions file is ready, PIC will compile the initial conditions to check that the file is written properly. This step is optional, but is helpful for debugging the compilation of the initialconditions.cxx file. Continue setting the remaining simulation parameters, and initialise the flow before execution. To initialize the flow, go to the Execute window and click PIC

Creating advanced initial conditions file

With TransAT, initial conditions are set in the initialconditions.cxx file.

Several steps need to be followed to set the initial conditions:

To illustrate this, a couple of advanced initial conditions examples are described in the following sections.

Example 1: Wallboiling tutorial

This example is based on the wallboiling test case that is available in the tutorial manual. In the tutorial manual, the variables are initialised through the Initial Condtions tab. In this example, the initial conditions from the user interface will be reproduced using advanced initial conditions. Initialisation methods
 
There are two methods to initially set variables with advanced initial conditions. The first method consists in getting access to the arrays containing the values of the variables to be set and modifying the entries of these arrays. The second method uses the properties module of TransAT. It is only available for thermodynamic quantities such as pressure, temperature and densities. More details can be found in the properties module section of the of the Transat User Manual.

In this example both methods will be used to set the initial conditions. Preliminary work
 
The first step when setting advanced initial conditions is to list the variables to be initialised. An exhaustive list of variables that should cover the equations that are solved for.

Once the variables have been listed, one should list the variables and parameters on which the variables to be initialised depend on. For instance, one may initialise quantities that depend on the position in the domain. Writing the initial conditions file
 
Declaration of variables  After the listing of the variables is done, the arrays storing the values of the variables over the domain should be declared in the initialcondtions.cxx file.

In the wallboiling tutorial, only the velocities, pressure, temperature and volume fractions are initialised.

void initialconditions() {  
 
   // Block specific variables  
   int nblocks, nijk, nij, ni, nj, nk;  
   // Simulation parameters  
   double Tsat, ygravity;  
   // Velocities  
   double *u, *v;  
 
   ...  

Note that for this case, arrays are declared only for the velocities. The remaining variables are initialised with the properties module with which arrays do not need to be declared.
Accessing global parameters  It is often required to read simulation parameters or some other global variables to set the initial conditions in the domain. These parameters should usually be read before doing any loop on the blocks and the cells of the computational grid. For example, one may need to use the components of the gravity vector or the saturation temperature to initialise the variables.

One very important parameter is the number of blocks in the domain. Indeed, TransAT being a multiblock code, it is required to loop over all the blocks in the domain set the values in all the cells.

For reference, see the TransAT interfaces section and the Accessing Parameters section.

   // Getting access to global parameters  
   nblocks  = get_integer("nblocks");  
   Tsat     = get_double("Tsat");  
   ygravity = get_double("ygravity");  
 
   // Extra print statements  
   printf(" nblocks  = %i\n",nblocks);  
   printf(" Tsat     = %f\n",Tsat);  
   printf(" ygravity = %f\n",ygravity);

Here, extra print statements were added. They can be useful to display information or debugging.
Loops over blocks and cells  The next step consists in setting the values of the variables in all the cells. Given the multiblock structure of the TransAT grids, one must loop over the blocks then over the cells of each block to initialise variables over the whole domain.

   /* nb: block index  
      nijk: number of cells in block nb */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // access block specific parameters such as grid properties  
      nijk = get_integer(nb,"nijk");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=0; ii < nijk; ii++) {  
 
         ...  
 
      }  
   }

Equivalently, one can also loop over the cells using a 3D index of the cells as follows

   /* nb  : block index  
      ni  : number of cells in x-direction  
      nj  : number of cells in y-direction  
      nk  : number of cells in z-direction  
      nij : number of cells in xy-plane */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // get grid properties  
      nij  = get_integer(nb,"nij");  
      ni   = get_integer(nb,"ni");  
      nj   = get_integer(nb,"nj");  
      nk   = get_integer(nb,"nk");  
 
      /* i: cell index in x-direction  
         j: cell index in y-direction  
         k: cell index in z-direction  
         ii: 1D cell index */  
 
      // Loop over the cells of block nb  
      for (int k=0; k < nk; k++) {  
         for (int j=0; j < nj; j++) {  
            for (int i=0; i < ni; i++) {  
               // convert 3D to 1D index  
               ii = i + j*ni + k*nij;  
 
               ...  
 
            }  
         }  
      }  
   }

In the remainder of this example the first formulation of the looping over cells is used. The second formulation could have also been used to yield the same results. Setting initial velocities  To set the velocities, the arrays storing the values must be accessed through the use of the set_pointer function.

To use the set_pointer function, a block index, a pointer and a keyword are required for 1D arrays. For 2D arrays which store phase and component specific variables such as mass and volume fractions, the phase or component index is required on top of a block index, a pointer and a keyword.

Note that the arrays accessed through the set_pointer function are block-specific meaning that the set_pointer function should be called in the block loops and before the loop over the cells.

More information on the set_pointer function, including the list of possible keywords, is available in the Accessing variables section of the User Manual .

For this example, the only variables initialised by getting access to the arrays are the velocity components in the x- and y-directions. In the following excerpt of the initial conditions file, the arrays containing the values of the velocity components are accessed. The values of the velocity components are then set over the domain (i.e. in the loop over the cells)

   /* nb: block index  
      nijk: number of cells in block nb */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // get grid properties  
      nijk = get_integer(nb,"nijk");  
 
      // set pointer to U/V-velocity array  
      // for block "nb"  
      set_pointer(nb,&u,"uvelocity");  
      set_pointer(nb,&v,"vvelocity");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=0; ii < nijk; ii++) {  
 
         // Setting velocity components  
         u[ii] = 1.0;  
         v[ii] = 0.0;  
 
      }  
   }

Initialising variables with the properties module  Now the pressure, temperature and volume fractions will be initialised using the properties module. There are three steps to set values of variables with the properties module

   /* nb: block index  
      nijk: number of cells in block nb */  
 
   // Loop over the blocks  
   for (int nb=0; nb < nblocks; nb++){  
      // get grid properties  
      nijk = get_integer(nb,"nijk");  
 
      // set pointer to U/V-velocity array  
      // for block "nb"  
      set_pointer(nb,&u,"uvelocity");  
      set_pointer(nb,&v,"vvelocity");  
 
      /* ii: cell index */  
 
      // Loop over the cells of block nb  
      for (int ii=0; ii < nijk; ii++) {  
 
         // Setting velocity components  
         u[ii] = 1.0;  
         v[ii] = 0.0;  
 
         // initialise properties module in block "nb" and cell "ii"  
         properties_initialize(nb, ii);  
 
         // using properties module to set pressure, temperature and volume fractions  
         properties_set_state("pressure", 0.0);  
         properties_set_state("temperature", 345.8);  
         properties_set_state("alpha", 0.003, 0);  
         properties_set_state("alpha", 0.997, 1);  
 
         // apply changes in properties for given cell  
         properties_set_back();  
 
      }  
   }

Please note: Note that the phase index starts at 0 meaning that 0 is the index of the first phase, 1 is the index of the second phase and so on and so forth.

The whole initial conditions file is available at the following location

 <TransAT_Installation_folder>/Tutorials/7.1 - wallboiling/ 
 
Example 2

An example of initialconditions.cxx file is described below:

//---------------------------------------//  
// Template to create initial flow field //  
//---------------------------------------//  
#include<stdio.h>  
#include<cmath>  
#include"cppinterface.h"  
extern "C"{  
   void initialconditions();  
}  
 
void initialconditions() {  
 
   int nijk,ni,nj,nk;  
   int nblocks;  
 
   printf("\n ---------------------------------\n");  
   printf(  " - initialconditions.cxx (start) -\n");  
   printf(  " ---------------------------------\n");  
 
   nblocks = get_integer("nblocks");  
 
   for (int nb=0; nb < nblocks; nb++){  
      nijk = get_integer(nb,"nijk");  
      ni   = get_integer(nb,"ni");  
      nj   = get_integer(nb,"nj");  
      nk   = get_integer(nb,"nk");  
 
      printf(" nijk = %i\n",nijk);  
      printf(" ni   = %i\n",ni);  
      printf(" nj   = %i\n",nj);  
      printf(" nk   = %i\n",nk);  
 
      double *u;  
 
      set_pointer(nb,&u,"Uvelocity");  
 
      for (int ii=0; ii < nijk; ii++) {  
         u[ii] = 1.0;  
      }  
   }  
 
   printf("\n ---------------------------------\n");  
   printf(  " - initialconditions.cxx (end)   -\n");  
   printf(  " ---------------------------------\n");  
}

The following points should be noted:

Running advanced initial conditions

Please note: if initialconditions.cxx is not available, a template of the initial conditions file, will be copied to the project folder after clicking PIC. The template file can be found in <TransAT_Installation_folder>/transatMB/input.

Once the initial conditions file is ready,


When PIC is clicked, the C++ file is compiled. To initialize the flow, go to the Execute window and click PIC. This can be done after finishing the remaining setup, directly before running the simulation. When PIC is clicked, an executable named transatmbinitialDP is created in the project folder and then run. If there are errors in the initial conditions file, the C++ compiler will show the errors report in TransATUI text panel.

If everything is correct in initialconditions.cxx, a file named <projectname>.ini is created , as well as an initial solution file in folder RESULT.

Hint: To check that the initial conditions have been properly set, check the output produced in the RESULT folder with ParaView or Tecplot after running the initial conditions.

9.3 User-defined functions

TransAT enables the user to create user-defined functions (UDFs) by writing C++ routines to interact with its data structure. Several steps need to be undertaken to use such functions. They need to be implemented and compiled before use.

Template files for user-defined functions are available in the usercompile/udf_templates directory of the installation folder. More easily, templates can be opened and edited through TransATUI.

9.3.1 Creating user-defined functions

To create user-defined functions, the user can load a template through the TransATUI. Settings for UDFs are found in the User Defined Functions window under the Input main tab. This window is shown in Fig. 9.3.


PIC

Figure 9.3: User Defined Functions Window



PIC

Figure 9.4: UDF Properties Window


The name for the UDF will be the same as the UDF file name and C++ class name. Therefore, the name cannot contain any special characters or spaces, and cannot begin with a number. Each UDF has an associated type, which determines the context in which the UDF is called. Each folder in the UDF properties window represents a different type of UDF. The type will be assigned automatically by TransATUI, when the desired template is chosen. Possible types of UDFs include:

Once finished defining the properties of a UDF, click PIC, and a folder called usercompile is created in the project directory, where the UDF template is copied to. The file name and class name will automatically be saved with the name defined in the properties window. The UDF template consists of two C++ files, the implementation file (.cxx) and header file (.h).

If ”none” was selected for the template, no files will be copied to the usercompile folder. It is necessary to ensure that the UDF is written properly so that the UDF will be found. To do so, the names of the files (.cxx and .h) must match with the name defined for the UDF. The class name of the UDF must also match with the defined name (UdfClassName::operator()() {...function...}).

A table is created in the User Defined Function window, listing the active UDFs. The table has columns for the UDF name, UDF type, edit button and delete button. UDFs activated in the table by the check-box will be included for compilation and execution in the simulation. To prevent a UDF from being compiled and executed during a simulation, un-check it in the list. UDFs can be deleted from the table by clicking PIC, however the files will not be removed from the usercompile folder. If a UDF file exists in the usercompile folder, but is not listed in the table for active UDFs, it can be introduced into the simulation by clicking PIC. Set the UDF name defined in the UDF properties window the same as the .cxx and .h files that are in the usercompile folder. Choose the proper type of UDF by selecting ”none” within the proper folder. This will prevent the existing UDF from being overwritten by a template.

Click PIC to open the UDF. The default text editor is launched to edit both the C++ implementation and header files. The main code and implementation of the UDF should go into the .cxx file operator method. The .h file is reserved for declarations only and does not need to be modified. The function executed can be found within the operator()() block of code.

9.3.2 Basic UDF Types

Some basic type of UDFs are only required to be defined in the User Defined Functions window. Once written and included in the list of active UDFs, these UDFs are automatically executed during the simulation. This includes Paraview Output, Entry Point and Source Term UDFs.

Paraview Output

Custom variables can be output for post processing in Paraview through the Paraview Output type UDF. The structure of the operator is as follows:

void template_class_name::operator ()(double &var_out) { 
   ... your expression; 
   var_out = ... your expression; 
}

Where var_out is the variable to be output to paraview.

Entry Point

The entry points are the following functions:

Figure 9.5 and Figure 9.6 depict the flowcharts of the steady and unsteady solving process of TransAT with the entry points of the UDFs.


PIC

Figure 9.5: Flowchart of steady solver with UDF entry points



PIC

Figure 9.6: Flowchart of unsteady solver with UDF entry points


Extended Paraview Output

It is also possible to output Paraview fields without using the Paraview Output type UDF. As part of any UDF type (Entry Point, Source Term, ...) a new vector to be written in the Paraview output can be declared. Using the syntax detailed below, the vector will be shared between all UDFs and then written to a Paraview format. This can be used for example in a Source Term to output the source term field.

void template\_class\_name::operator() { 
   double *vtk\_vector; 
   ... 
   // block loop 
   for (nb = 0; nb<nblocks;nb++){ 
      ... 
      set\_pointer(nb, &vtk\_vector, paraviewfield-yourName,0); 
      // loop cell 
      for (ii=0;ii<nijk;ii++){ 
         ... 
         vtk\_vector[ii] = your\_expression; 
         ... 
      } 
   } 
}

This will add to the Paraview output files a new variable called yourName. Since the vtk_vector can be accessed from several UDFs, the output value can updated by several UDF routines.

9.3.3 Extended UDF Types

The basic UDF types of Paraview Output, Entry Points and Source Terms are only defined once in the User Defined Functions window. Other UDFs need to be activated elsewhere in TransATUI to be used. This includes UDFs for the interphase models of drag, lift and wall lubrication.

Please note: Interphase UDFs (drag, lift and wall lubrication) need to be activated. Refer to the following sections.

Drag Model UDF

After setting the type of a UDF to ”drag_coefficient”, it can be selected in the drag model table. Click the Phases Interactions and the PIC button. Now, select Drag Model from the Interphase Slip Relations. In the drag model table, the UDF name will be available to choose from.

Lift Model UDF

After setting the type of a UDF to ”lift_coefficient”, it can be selected in the lift model table. Click the Phases Interactions and the PIC button. Now, select Lift Model from the Interphase Slip Relations. In the lift model table, the UDF name will be available to choose from.

Wall LubricationModel UDF

After setting the type of a UDF to ”wall_lubrication_coefficient”, it can be selected in the wall lubrication model table. Click the Phases Interactions and the PIC button. Now, select Wall Lubrication Model from the Interphase Slip Relations. In the wall lubrication model table, the UDF name will be available to choose from.

9.3.4 Compiling UDFs

While in the User Defined Functions window, UDFs can be compiled by clicking PIC. Only UDFs activated by the checkbox will be compiled. Furthermore, once the simulation is run, only those activated UDFs will be executed during the simulation. Output of the compilation will be shown below in the black text box. This is helpful for debugging the UDFs.

When executing a simulation, activated UDFs will automatically be compiled. To prevent any UDFs from being included in a simulation, deactivate or delete them from the table in the User Defined Functions window.

9.3.5 Compiling UDFs through a terminal

It is recommended to compile UDFs through TransATUI because several unique files are created in the compilation process. These files are:

To create these files without TransATUI, a template can be copied from the usercompile in the installation directory. For the custom file myfile.cxx the user must add the following line to uifilelist.py:

 filelist.append(sfile(gl,"myfile.cxx"))

The file registerfunctors.cxx depends on the UDF file names and types, but could be as follows:

#include registerfunctors.h 
#include register_functors.h 
#include cppinterface.h 
#include <stdio.h> 
#include TmbManager.h 
#include myudf.h 
#include mydragudf.h 
 
 
 
RegisterFunctors::RegisterFunctors(){ 
   printf(\n--------\nUDF INIT\n--------\n); 
   tmb::EntryPoint_Factory* entrypointfactory = 
      tmbManager.get<tmb::EntryPoint_Factory>()(); 
   entrypointfactory->registerBuilder(myudf,&(myudf::create)); 
 
   tmb::DragTerm_Factory* dragfactory = tmbManager.get<tmb::DragTerm_Factory>()(); 
   dragfactory->registerBuilder(mydragudf,&(mydragudf::create)); 
} 
 
RegisterFunctors::˜RegisterFunctors(){ 
   printf(\n--------\nUDF DESTRUCT\n--------\n); 
}

The possible factories for UDFs are:

Using a terminal, UDFs are compiled with the following command

tmb_link.py -u

9.3.6 Running TransAT with user-defined functions

Once UDFs are written and defined in the appropriate locations of TransATUI, TransAT can be run as usual to use the UDFs. UDFs will compile automatically at the start of a simulation.

If running TransAT through the command line, UDFs can first be compiled either through TransATUI or the command line. Next, the user can run the simulation with user-defined functions using the following command in a terminal

tmb_run.py -n <procs_number> -u

Do not forget to initialize the flow with advanced initial conditions first, if there are any. If the -u option is not used, TransAT will run without user-defined functions.

9.3.7 Adding Additional Files

If it is desired to use any additional files that are called by a UDF, extra steps are required for proper compilation. Any additional files to be compiled must be saved in the usercompile folder and added to uifilelist.py, manually. Once any additional files are added to uifilelist.py, UDFs can no longer be compiled with TransATUI, because during compilation through TransATUI, files are re-written, including uifilelist.py.

The proper method to include an additional file along with UDFs includes the following steps:

9.3.8 Backwards Compatability

Previous to TransAT version 5.5, UDFs were written with a different structure. The former UDF format (using userglobal.cxx and userglobal.h) is deprecated and is not supported by TransATUI. It is not recommended to apply former UDF and current UDF simultaneously, but it is possible, however only when compiling and running simulations from the command line. Compiling through TransATUI creates and rewrites files required for current UDFs (uifilelist.py, registerfunctors.cxx and registerfunctors.h). Files userglobal.cxx and userglobal.h are required for UDFs in TransAT previous to version 5.5. Additionally, uifilelist.py is not updated for older UDFs.

Please note: It is recommended to convert any old UDFs to the new format.

9.3.9 Example of a user-defined function

Below is an example of a user-defined function, where we want to print the maximum temperature of the domain. The folder usercompile contains the UDF called get_maxtemp.cxx. This file is also available as a template for the UDF type Every Iteration in TransATUI.

// get_maxtemp.cxx // 
 
#include<stdio.h> 
#include<math.h> 
#includecppinterface.h 
#include<string> 
 
get_maxtemp::get_maxtemp() { 
} 
 
get_maxtemp::˜get_maxtemp() { 
} 
 
void get_maxtemp::operator ()() { 
   int ii;//cell index 
   int nb;//block index 
   int nijk;//number of cells in one block 
   int nblocks;//number of blocks handled by one processor 
   double *T; // temperature array 
   double max_temperature; // maximum temperature (local) 
   double global_max_temperature; // maximum temperature (global) 
 
   // MPI tools 
   int glob_rank, numprocs;// Get the individual process ID. 
   glob_rank = MPI::COMM_WORLD.Get_rank(); // get the number of blocks handled 
                                           // by the current processor. 
   nblocks = get_integer(nblocks); 
 
   // Find the maximum temperature in the blocks 
   // handled by the current processor 
   max_temperature = 0.0; 
 
   // Loop on the blocks handled by the current processor 
   for (nb=1; nb<= nblocks; nb++){ 
 
      // get the number of cells on the current block 
      nijk = get_integer(nb,nijk); 
 
      // link to the temperature array of TransAT. 
      // This has to be done inside the block loop. 
      set_pointer(nb,&T,temperature); 
 
      // Loop on the cells of the block 
      for (ii=0; ii < nijk; ii++) { 
         max_temperature = fmax(max_temperature,T[ii]); 
      } 
   } 
 
   // MPI communication to obtain the global maximum 
   MPI::COMM_WORLD.Allreduce(&max_temperature,&global_max_temperature, 
      MPI::DOUBLE,MPI::MAX); 
 
   // Root processor writes the result 
   if (glob_rank == 0) { 
      printf(Maximum temperature is %f\n, global_max_temperature); 
   } 
 
}

The file get_maxtemp.h is the header file for the UDF:

// get_maxtemp.h // 
 
#include EntryPoint_Base.decl.h 
#include <vector> 
#include <string> 
#include <map> 
 
class get_maxtemp : public EntryPoint_Base { 
private: 
   std::vector<double> Time; 
   std::vector<double> Mass; 
public: 
   get_maxtemp(); 
   virtual ˜get_maxtemp(); 
   static EntryPoint_Base* create(){return new get_maxtemp;}; 
   /** 
    * @brief Function to be called at entry point. 
    */ 
   virtual void operator()(); 
};

Notice in the example for get_maxtemp, that there is no direct reference to the type of entry point (Every Iteration, Every Time Step, Simulation Begin,...) inside the source file. The type is defined in TransATUI, and no other reference to type is required. This particular UDF could be added to any particular entry point. It is most likely, however, that this should be of type ”Every Time Step”, that the maximum temperature over the entire duration of the simulation would be found. Alternatively, this UDF could be used at ”End Simulation” for a steady state simulation.

9.3.10 Data output along a straight line

Some post-processing task may require the output of selected variables along a straight line. The access to this data with a user-defined function is facilitated with the line_output class, which is provided in line_output.h.

A line_output object can be initialised using one of the following options

with

The coordinates in the first and second normal direction to a line in x-, y- or z-direction are (y,z), (x,z) and (x,y) respectively.


To specify which variables to extract along the line object the following methods can be used

with

Keyword and arguments are the same as in the set_pointer function, described earlier (see also List of accessible variables).


The extracted data can then be written into a file using one of the following methods

with

The file contains the coordinates of the extracted data along the line direction and the specified output data in a column-wise format. Example 1: standard use
 
The following code excerpt demonstrates how the velocity component u in x-direction and the temperature can be extracted along a line in the z-direction at x = 0.5m and y = 0.05m with the help of the line_output class. The velocity and temperature values along the line will be interpolated using a bilinear interpolation method. There are also UDF templates available in TransATUI that use the line_output feature, including crossflow_output, begin_iteration_lineoutput and end_iteration_lineoutput.

// line_udf.cxx // 
 
#include line_udf.h 
#include cppinterface.decl.h 
 
line_udf::line_udf() { 
 
   // initialize a line along the z-direction at the specified location (x,y) 
   output = new line_output(LO_ZDIR,0.5,0.05,LO_BILINEAR); 
 
   // select the velocity component in x-direction and temperature for output 
   output->add_variable(uvelocity); 
   output->add_variable(temperature); 
} 
 
line_udf::˜line_udf() { 
   delete output; 
} 
 
void line_udf::operator ()() { 
   // write the interpolated data into the file output_data.dat 
   output->write_file(output_data.dat); 
}
The file line_udf.h is the header file for the UDF:
// line_udf.h // 
 
#include EntryPoint_Base.decl.h 
#include line_output.h 
 
class line_udf : public EntryPoint_Base { 
private: 
   // line_output data type 
   line_output *output; 
public: 
   line_udf(); 
   virtual ˜line_udf(); 
   static EntryPoint_Base* create(){return new line_udf;}; 
   /** 
    * @brief Function to implement the UDF 
    *        the current template prints line output of velocity and temperature 
    *        at the end of an iteration. This could be compared against 
    *        begin_iteration_lineoutput 
    */ 
   virtual void operator()(); 
};
Example 2: variable registration
 
It is sometimes desired to get the output of a variable that is not stored the arrays of TransAT but can be computed using them. For instance one may want to combine several variables or do some form of filtering then plot the new variable along a straight line. The line_output feature has an option that allows register variables for this exact purpose.

The following code excerpt demonstrates how the Reynolds number can be extracted along a line in the z-direction at x = 0.5m and y = 0.05m with the help of the line_output class. The properties module and pointers to access the TransAT arrays are used to compute the Reynolds number. There are also UDF templates available in TransATUI that use the line_output feature, including crossflow_output, begin_iteration_lineoutput and end_iteration_lineoutput.
// line_udf.cxx // 
 
#include line_udf.h 
#include cppinterface.decl.h 
#include <cmath> 
 
line_udf::line_udf() { 
   // initialize a line along the z-direction at the specified location (x,y) 
   output = new line_output(LO_ZDIR,0.5,0.05); 
 
   // Size of TransAT variable arrays 
   unsigned istorf=get_integer(istorf); 
   reynolds.resize(istorf,0.0); 
   // register Reynolds number in line_output object 
   output->add_variable(Re,reynolds); 
} 
 
line_udf::˜line_udf() { 
   delete output; 
} 
 
void line_udf::operator ()() { 
 
   // Compute Reynolds number 
   // Number of blocks 
   unsigned nblocks=get_integer(nblocks); 
   // Pointer to velocity components 
   double *u, *v, *w; 
   // Characteristic length 
   double L = 1.0; 
   // Physical properties 
   double rho, mu, velocity; 
 
   // Compute the Reynolds number on blocks associated with current processor 
   for (int nb=0; nb<nblocks; nb++){ 
      unsigned nijk = get_integer(nb,nijk); 
      // Global cell index corresponding to first cell of block nb 
      int ii_start = get_integer(nb,iistr1); 
      set_pointer(nb,&u,uvelocity); 
      set_pointer(nb,&v,vvelocity); 
      set_pointer(nb,&w,wvelocity); 
      // Loop over cells in block (local block cell indexing) 
      for(unsigned ii=0; ii<nijk;ii++){ 
         properties_initialize(nb,ii); 
         rho = properties_get(density); 
         mu = properties_get(viscosity); 
         velocity = sqrt(u[ii]*u[ii] + v[ii]*v[ii] + v[ii]*v[ii]); 
         reynolds[ii_start + ii] = rho*velocity*L/mu; 
      } 
   } 
 
   // write the interpolated data into the file output_data.dat 
   output->write_file(output_data.dat); 
 
}
The file line_udf.h is the header file for the UDF:
// line_udf.h // 
 
#include EntryPoint_Base.decl.h 
#include line_output.h 
 
class line_udf : public EntryPoint_Base { 
private: 
   // line_output data type 
   line_output *output; 
   // Vector storing Reynolds number over domain 
   std::vector<double> reynolds; 
 
public: 
   line_udf(); 
   virtual ˜line_udf(); 
   static EntryPoint_Base* create(){return new line_udf;}; 
   /** 
    * @brief Function to implement the UDF 
    *        the current template prints line output of velocity and temperature 
    *        at the end of an iteration. This could be compared against 
    *        begin_iteration_lineoutput 
    */ 
   virtual void operator()(); 
};

9.4 Advanced UDF

TransAT provides some additional advanced user-defined functions (UDF) tools. These UDF are implemented in order to facilitate the addition of multifunctional objects into a simulation and let the user interact with these objects through an easy-to-use interface in C++.

The following advanced UDF are available:

Template files for user-defined functions using these advanced features are available in the
usercompile/udf_templates directory of the installation folder. More easily, templates can be opened and edited through TransATUI.

The following sections contain more information on the advanced UDF provided.

9.4.1 Embedded Fan

The embedded fan UDF corresponds to a lumped parameter representation of a jet fan and allows for the placement of a virtual jet fan anywhere inside the simulated domain.
The fan action will be introduced into the flow by means of volumetric momentum source terms. Fan parameters to be specified by the user are location, dimensions and the volumetric flow rate delivered by the fan during operation. The fan can also be given a name to identify it among several individual jet fan objects.
If needed the user can implement any variation of the fan volumetric flow rate or its dependence on other parameters such as time or any other available parameters through the UDF.

Creating an embedded jet fan

Start using the embedded fan UDF by selecting the corresponding template file in the
TransATUI. For a guide on how to add UDFs from templates see section Creating user-defined functions.

Please note: The fan UDF should always be used with the embedded_fan UDF type. For the compilation of UDF that use fan objects the corresponding header needs to be included.

#include ‘‘Fan.h

A new fan object is created using the appropriate call to the constructor. For each fan the user needs to specify

E.g. in order to specify a fan named “Fan1” of 0.4 m radius, 1.5 m length, with its centroid located at (2.5,0,0), its axis parallel to the X-axis and a volumetric flow rate of 10m3∕s, one would write the following lines of code.

Please note: The centroid coordinates refer to the geometrical centre of the cylinder, i.e. the mid-point of the cylinder axis of length L.

   // Initialise vectors with three elements equal to zero 
   std::vector<double> centroid(3,0), axis(3,0); 
 
   centroid[0] = 1.5;  // Set centroid X-coordinate 
   axis[0]     = 1.0;  // Set axis parallel to X-axis 
 
   Fan myFan(‘‘Fan1,0.4,1.5,centroid,axis,10);

Alternatively it is possible to set up the fan with an already existing CylinderRegion object as follows (Note: the fan constructor expects a C++ pointer to a CylinderRegion object).

   // Initialise vectors with three elements equal to zero 
   std::vector<double> centre(3,0), axis(3,0); 
 
   centre[0] = 1.5;  // Set centre X-coordinate 
   axis[0]   = 1.0;  // Set axis parallel to X-axis 
 
   CylinderRegion* fanCylinder = 
                       new CylinderRegion(‘‘Fan1_Region,0.4,1.5,centre,axis); 
 
   Fan myFan(‘‘Fan1,fanCylinder,10);

Please note: The actual fan cross section area and volume depend on how well the fan is resolved by the mesh. The resolution however will not have any effect on the fan jet exit velocity.

The actual volume of the fan can always be retrieved from the fan object CylinderRegion member as follows.

   myFan.getFanRegion()->getVolume();
Modifying fan volumetric flow rate

After setting up the fan object the volumetric flow rate can be modified arbitrarily within the UDF using the setVolumetricFlowRate interface. E.g. if one wants to change the volumetric flow rate of the example fan “Fan1” to 20m3∕s, one does the following

   myFan.setVolumetricFlowRate(20);

9.4.2 Fire source

The fire source UDF combines several features of a typical fire into a single UDF feature. With a fire source UDF the fire is described as a combined heat and concentration source, which corresponds to the heat and smoke/pollutant added to the system by a fire.
The extent of the fire as a heat and concentration source can be specified by either a box or a cylinder of arbitrary dimensions.
The fan can also be given a name to identify it among several individual fire source objects.
If needed the user can implement any variation of the fire heat and concentration source strength or their respective dependence on other parameters such as time, temperature, or any other available parameters through the UDF.

Creating a fire source

Start using the fire source UDF by selecting the corresponding template file in the
TransATUI. For a guide on how to add UDFs from templates see section Creating user-defined functions.

Please note: The fire source UDF should always be used with the fire_source UDF type. For the compilation of UDF that use fire source objects the corresponding header needs to be included.

#include ‘‘FireSource.h

A new fire source is created using the appropriate call to the constructor. For each fire the user needs to specify

E.g. in order to specify a fire named “Fire1” inside a box of extent [0.0,1.0] × [0.0,1.0] × [0.0,1.0], rotated about the Z-axis by 45 (=π∕4) with a volumetric heat source strength of 100kW and a volumetric concentration source strength of 0.1[C]∕s, one would write the following lines of code:

   // Create a box defining the desired extent of the fire 
   Region_Base* fireBox = 
                   new BoxRegion(‘‘Fire1_Region, 
                                   0.0,1.0,        // xmin, xmax 
                                   0.0,1.0,        // ymin, ymax 
                                   0.0,1.0,        // zmin, zmax 
                                   0.785,0.0,0.0); // Rotation angles [rad] 
 
   FireSource myFire(‘‘Fire1,fireBox,100000,0.1);

For fire sources inside a box a dedicated constructor exists. Thus for box shaped extents exclusively, the fire source can also be constructed directly without the need to create a separate BoxRegion object as demonstrated below.

   // Create a box defining the desired extent of the fire 
   FireSource myFire =(‘‘Fire1, 
                                   0.0,1.0,        // xmin, xmax 
                                   0.0,1.0,        // ymin, ymax 
                                   0.0,1.0,        // zmin, zmax 
                                   0.785,0.0,0.0,  // Rotation angles [rad] 
                                   100000,         // Volumetric heat source [W/mˆ3] 
                                   0.1);           // Volumetric conc. source [C]/s

For the same fire with a cylindrical extent instead of a box, e.g. with a radius of 0.5m, a length of 1.5m, centroid location at (10,15,0) and an axis parallel to the Z-axis the fire source constructor can be called as follows

   // Initialise vectors with three elements equal to zero 
   std::vector<double> centroid(3,0), axis(3,0); 
 
   centroid[0] = 10;   // Set centroid X-coordinate 
   centroid[0] = 15;   // Set centroid Y-coordinate 
   axis[2]     = 1.0;  // Set axis parallel to Z-axis 
 
   // Create a cylinder defining the desired extent of the fire 
   Region_Base* fireCylinder = 
                   new CylinderRegion(‘‘Fire1_Region,0.5,1.5,centroid,axis); 
 
   FireSource myFire(‘‘Fire1,fireCylinder,100000,0.1);

Please note: The actual fire volume depends on how well the fire source is resolved by the mesh. The heat release rate can be specified either by volume or in total. In the latter case the actual volume will be taken into consideration.

Please note: The fire source can also be used to represent a pure heat or pure concentration source. This can be achieved by simply setting the heat release rate or concentration source to zero. In the TransATUI appropriate templates exist for both cases.

Modifying fire source heat release rate

After setting up the fire source the volumetric heat relase rate can be modified arbitrarily within the UDF using the setVolumetricHeatPower and setTotalHeatPower interfaces. With the setTotalHeatPower the fire source will automatically scale the volumetric heat release with the actual fire source volume to ensure the total heat release rate is matched. E.g. if one wants to change the volumetric flow rate of the example fire “Fire1” to 1MW∕m3, one does the following

   fire.setVolumetricHeatPower(1000000);
Modifying fire source concentration production rate

After setting up the fire source the concentration production rate can be modified arbitrarily within the UDF using the setVolumetricSmokeSource and setTotalSmokeSource interfaces. With the setTotalSmokeSource the fire source will automatically scale the volumetric heat release with the actual fire source volume to ensure the total heat release rate is matched. E.g. if one wants to change the volumetric smoke production rate of the example fire “Fire1” to 1[C]∕s, one does the following

   fire.setVolumetricSmokeSource(1.0);

Please note: When using the fire source, the concentration will always be interpreted as a volumetric quantity, i.e. [C] = ..∕m3.

Chapter 10
Parametric Analyzer

The Parametric Analyzer is an application integrated in TransAT, developed with the purpose of performing parametric study based on existing TransAT project. Fig. 10.1 shows how the application looks like. It consists of 4 pages:

The idea behind the application is to define all the parametric variables of interest, regardless of if they belong to the same case or different ones, and, afterwards, reorganize them according to your own purpose. The role of the application is to assemble the folders corresponding to the different cases of the template project and run them. It is up to the user to run the simulations. Before performing the parametric study is advisable to check if the template project properly works.


PIC

Figure 10.1: Parametric Analyzer Interface. Four main tab page are present.


10.1 Files

The Files page deals with the management of necessary data files and names:

10.2 Parametric Variables

In the Parametric Variables page the user can choose the parametric variables of interest among Inputs, Boundary Conditions, Grid Properties, Advanced Initial Conditions and User Defined Functions


PIC

Figure 10.2: Parametric Variables Page


10.2.1 Selection of Input, Boundary Conditions and Grid Properties

The choice of a variable belonging to the branches Inputs, Boundary Conditions and Grid Properties occurs in the same way. By clicking on Get Input Variables (respectively Get BC Variables and Get Mesh Variables) a tree structure appears and the user can select one variable, Fig. 10.3).


PIC

Figure 10.3: Selection of parametric variables belonging to the branches Inputs, Boundary Conditions and Grid Properties


10.2.2 Selection of Advanced initial Conditions and User Defined Functions variables

Clicking on Get Initial Condition File (respectively Get User Defined Function File) the corresponding C++ file is displayed and the user can choose the parametric variable highlighting it with the mouse (it is preferable to highlight some additional information in addition to the parametric variable, as showed in Fig. 10.4).


PIC

Figure 10.4: Selection of parametric variables belonging to the branches Advanced Initial Conditions and User Defined Function


10.2.3 Add Parametric Variable

After choosing the parametric variable, it is possible to assign values to the parametric variable. This can be achieved in two ways:

The new parametric variable can be added clicking on Add New Parametric Variable .


PIC

Figure 10.5: Assign the values to the parametric variable: automatic and manual option


10.2.4 Graphical Representation

The structure of the parametric study and the total number of cases that will be obtained can be visualize through a diagram block structure, Fig. 10.6).


PIC

Figure 10.6: Graphical representation of the parametric study


Fig. 10.6 shows a parametric study with 2 parametric variables

and consisting of 4 different cases:

10.3 Execute


PIC

Figure 10.7: Execute Tab Page


10.3.1 Rearrange parametric variables

In the Execute page of the Parametric Analyzer the variables defined in the Parametric Variable page can be properly rearranged through the buttons Delete, Swap and Merge.


PIC
Figure 10.8: Schematic parametric study representation before the merging of the variables inflowtemperature and inflow_velocity_u



PIC

Figure 10.9: Schematic parametric study representation after the merging of the variables inflowtemperature and inflow_velocity_u


The variables structure displayed in the Execute page is a simplified version of the diagram block structure.

10.3.2 Assemble folders

The folders for the parametric study are assembled clicking on Assemble Folder, according to the structure depicted in the diagram block. In general, if the text browser displays as final message Parametric study setup is ready! and Successfully moved filesthe folder assembling is successful. For example given the diagram block in Fig. 10.10


PIC

Figure 10.10: Graphical representation of the parametric study after the merging of the variables inflowtemperature and inflow_velocity_u


from the assembling we obtain 2 folders named inflowtemperature__inflow_velocity_u__ygravity_-9.8 and inflowtemperature__inflow_velocity_u__ygravity_0. The first corresponds to a value of the variable ygravity equal to -9.8ms2- and the second to 0ms2. Each on them contains two more folders: Case0pc and Case1pc, corresponding to 2 sub-cases:

Please note: The variables inflowtemperature and inflow_velocity_u vary within the same case, as result of their merging with button Merge.

10.3.3 Run the simulations

Once the folders for the parametric study are assembled, it is possible to compile and run the cases with the buttons Prepare Simulation FIles and Compile and Run. The former manages the preparation of the simulation files and the compilation of UDF and advanced initial conditions, if present. The latter, instead, manages the run of the cases. Two option are available:

10.4 Data Analysis


PIC

Figure 10.11: Data Analytics Tab Page


The Data Analysis manages the plotting of results of parametric study. Clicking on Open, the user is allowed to select one or multiple files, candidates for the plotting and comparison. The actual plot requires the loading of the data through the button Load. To this end the user is asked to enter the number of inputs and outputs variable according to the structure of the files (it is advisable to use properly designed User Defined Function to define the optimal format of the file). Two plot options are available:

Any ouput variable can be plotted as function of any input variable. If more than 2 input variables are present, the user is asked to insert the value of the input variable not indicated as plotting variables.

Chapter 11
Support

11.1 Downloading TransAT

To download TransAT,

Please note: if you did not receive an email with Customer Portal credentials, make sure that it has not been filtered out to your Spam folder

11.2 Customer Portal

Support for TransAT is provided through the Customer Portal.

To submit a support case in the Customer Portal

Upon submission, your case will be attended to as soon as possible.

Once a satisfactory solution has been found, the case can be closed in the Customer Portal by clicking Close this case in the case properties window.

11.3 Known Issues

11.3.1 Error in AMG Agglomerator

Error message

Listing 11.1: AMG Agglomerator error
AMG Agglomerator: 
 
---------------------------------------------------------------------------- 
Check user manual -> Chapter 9: Support -> Known issues for more information 
---------------------------------------------------------------------------- 
 
possible cause: 
-> separated flow regions which can not be handled by this AMG agglomerator 
-> one-dimensional grid with less than 3 cells 
 
solution: 
-> change grid / geometry 
-> rerun with another solver 
 -> having PETSc with HYPRE installed (linux only): 
    solver             = gmres 
    preconditioner     = AMG 
 -> or with default settings: 
    solver             = gmres 
    preconditioner     = bjacobi 
    subpreconditioner  = ILU
Description

This error typically appears because the AMG solver is not able to handle properly separated flow regions. Separated flow regions appear if a solid completely separates regions of the grid as shown in Fig. 11.4.


PIC

Figure 11.4: Grid regions separated by solid


It is important to note if BMR is used, separate regions might appear even due to the grid only. Fig. 11.5 shows the oilspill tutorial. In this tutorial there are two grid levels. The second level (fine grid) has two separate regions and therefore the default AMG solver might complain.


PIC

Figure 11.5: Separate regions in fine BMR level


Solution

TransAT offers other solvers which can handle separated flow regions. See subsection 4.4.2 for all solver options. The default solver ”GMRES” for example will also handle separate flow regions.

List of Figures

2.1 Project Management Tab.
3.1 Mesh tab
3.2 Object tab
3.3 Solid Properties Window.
3.4 Immersed Surface window
3.5 Define Domain window
3.6 Domain & Grid tab
3.7 Refinement over whole Objects.
3.8 Refinement over Object Edges.
3.9 Customized refinement parameters
3.10 Blocks tab
3.11 Modifying the dimensions of a selected block.
3.12 Creating a 4x3 block decomposition
3.13 Shrinking options.
3.14 BCs tab
3.15 Domain BCs
3.16 Sub-BCs window
3.17 BC patches within each other.
3.18 Window for Inflow Properties
3.19 Inflow Chemical Species tab
3.20 Cyclic boundary conditions
4.1 Physical Models Page
4.2 RANS Parameters window
4.3 LES Parameters window
4.4 Turbulent heat flux modelling overview, where kT represent the variance of the temperature fluctuati ons θ2 and eT represent the dissipation rate of the heat fluxes εθ.
4.5 Compressible Flow window
4.6 Level Set properties window
4.7 VOF properties window
4.8 Homogeneous Model window
4.9 ASM Window
4.10 Phase Change Properties window with Level-Set multiphase model
4.11 Phase Change Properties window with Phase Average multiphase model
4.12 Reactive Flow Properties window
4.13 Reaction Creator Window
4.14 Body force window
4.15 Periodic Pressure Forcing Panel
4.16 OLGA coupling Model window
4.17 Phase Properties
4.18 Sheet
4.19 Catalog
4.20 Choice of a pre-defined material
4.21 Rosseland model window for radiative properties
4.22 Viscoelastic phasic properties window
4.23 Momentum Transfer
4.24 Drag Table
4.25 Simulation Parameters tab
4.26 SArP Stability Mode
4.27 SArP Optimisation Mode
4.28 SArP Advanced Parameters window for an unsteady simulation
4.29 Genetic Algorithm Process
4.30 Steady Simulation Evaluation Example
4.31 SArP roll back option
4.32 Initial Conditions tab
4.33 User Defined Functions tab
4.34 Averaging
4.35 Output Variables Window
4.36 Output Management tab
5.1 Execute tab
5.2 Typical output for an unsteady simulation
5.3 Typical output for a steady simulation
5.4 Restart Dialog box
5.5 Simulation information (timing and convergence)
5.6 License information
5.7 Warning messages
5.8 Error messages
5.9 Other messages
5.10 Runtime Information sections
5.11 Runtime Information for BMR
5.12 Simulation convergence screen output
5.13 Color- and marker-based convergence information
5.14 Exit window
6.1 SArP Stability Mode
6.2 SArP Optimisation Mode
6.3 Oscillating residuals
6.4 Stagnating residuals
6.5 Simulation with unconverged time steps
6.6 Simulation with unconverged iterations
6.7 Evaluation Process
6.8 SArP roll back option
6.9 Steady Simulation Evaluation Example
6.10 SArP info tab of a steady simulation
6.11 SArP info tab of an unsteady simulation
7.1 Tecplot window after loading the result file.
7.2 Define variables C1 and C2.
7.3 Define isosurface.
7.4 Define slice.
7.5 A section plane.
9.1 TransAT grid with cell types and indices
9.2 TransAT cell markers
9.3 User Defined Functions Window
9.4 UDF Properties Window
9.5 Flowchart of steady solver with UDF entry points
9.6 Flowchart of unsteady solver with UDF entry points
10.1 Parametric Analyzer Interface. Four main tab page are present.
10.2 Parametric Variables Page
10.3 Selection of parametric variables belonging to the branches Inputs, Boundary Conditions and Grid Properties
10.4 Selection of parametric variables belonging to the branches Advanced Initial Conditions and User Defined Function
10.5 Assign the values to the parametric variable: automatic and manual option
10.6 Graphical representation of the parametric study
10.7 Execute Tab Page
10.8 Schematic parametric study representation before the merging of the variables inflowtemperature and inflow_velocity_u
10.9 Schematic parametric study representation after the merging of the variables inflowtemperature and inflow_velocity_u
10.10 Graphical representation of the parametric study after the merging of the variables inflowtemperature and inflow_velocity_u
10.11 Data Analytics Tab Page
11.1 Access to Download page
11.2 Customer Portal login page
11.3 Registration form
11.4 Grid regions separated by solid
11.5 Separate regions in fine BMR level
12.1 Flow through a ozone reactor tank
12.2 Cumulative residence time density function
12.3 Hydraulic energy dissipation
12.4 Hydraulic jump setup
12.5 Species quantities evolution
12.6 Flocs repartition in water treatment plant
12.7 Separation rate is a function of concentration
12.8 Flow through a sludge separator
12.9 Simulation of a landslide using TransAT
12.10 Tall Oil plant reactor vessel
12.11 Separation of Lignin in a Tall Oil reactor vessel
12.12 Thermal packaging setup
12.13 Temperature evolution in the thermal load
12.14 Mesh refinement
12.15 Averaged and instantaneous velocity
12.16 Flow of a supercritical CO2 bubble through a pore

Bibliography

   Apte, S. V., Mahesh, K., Moin, P. & Oefelein, J. C. 2003 Large-eddy simulation of swirling particle-laden flows in a coaxial-jet combustor. Int. J. Multiphase Flow 29, 1311–1331.

   Hysing, S. 2006 A new implicit surface tension implementation for interfacial flows. International Journal for Numerical Methods in Fluids 51 (6), 659–672.

   Johnson, P. C. & Jackson, R. 1987 Frictional-collisional constitutive relations for granular materials, with application to plane shearing. J. Fluid Mech. 176, 64–93.

   Launder, B. & Spalding, D. 1974 The numerical computation of turbulent flows. Comput. Meths. Appl. Mech. Eng. 3, 269–289.

   Sarfraz, M. 2003 A rational cubic spline for the visualization of monotonic data: an alternate approach. Computer & Graphics 27, 107–121.

   Snider, D. M. 2001 An incompressible three-dimensional multiphase particle-in-cell model for dense particle flows. Journal of Computational Physics 170, 523–549.

   Sundaram, S. & Collins, L. R. 1999 A numerical study of the modulation of isotropic turbulence by suspended particles. J. Fluid Mech. 379, 105–143.

Chapter 12
Engineering Guidelines

Some problems in TransAT require some experience to set up properly. The goal of these Guidelines is to present some of these problems and give some useful tips based on the TransAT developing team experience.

12.1 Moving Objects

TransAT now offers the possibility to add Rigid Body Motion into CFD simulations. This possibility is coupled with the Immersed Surface Technique (IST), which makes RBM possible and fast, but also goes with some specifics that need to be considered when setting up a simulation with moving parts. Some of these specifics are listed here in order to prevent some classic set-up errors.

12.1.1 Main Idea

In the IST, solid objects loaded into TransAT are represented using a step function, which is 1 in the fluid cells, 0 in the solid cells. This field is accessible in TransAT’s Paraview output under the name Hfluid. At the beginning of each time-step,the current position of the solid object within the computational mesh is read, and the step function is computed prior to any fluid calculation.

One of the requirements of the IST is that the mesh resolution must be good enough to always have at least 3 cells around a fluid/solid interface. For fixed objects this requirement is easy to implement, as the TransAT User Interface allows visualizing the mesh and the solid object together during the mesh definition step.

For moving objects, this requirement must still be filled, and at all times during the object motion. While defining the mesh, one must think about eventual problems which may occur once the moving part exits the mesh, or reaches a region where the grid size is larger.

12.1.2 Tips

Some tips can be listed as ”good practice” to work with TransAT’s IST in general and even more so when working with moving objects.

12.2 Hydraulics

Here are some guidelines summarizing the TransAT workflow to be followed for a study on a hydraulic system, here in the example of an ozonation channel. Other examples carried were flow rate repartition, velocity profile after a turn, ...

12.2.1 Main Idea

The goal is to give information about some interesting quantities for structure design, where a flow is taking place. Most of the times people want to access something in particular such as flow through time, velocity profiles, pressure drops, dead zones... These problems can be 2D, 3D, single phase, free-surface, multiphase... An important thing is to first decide how much can the approach be simplified to save computation time. Based on what people want to see, and on the problem itself, most of the time free-surface effects can be neglected... the goal is to stay, as much as possible, close to steady single phase simulations. Here some specifics about what has been done to access the residence time in an ozonation channel.


PIC

Figure 12.1: Flow through a ozone reactor tank


12.2.2 Practical Steps

The first step is a discussion with the client to see what they want and understand how much we can simplify. They dont always know much about CFD and fluid dynamics, but they know their processes really well and this is helpful. For instance, here they could confirm that 2D was enough and that free surface could be ignored. Thank to that the flow can be simulated single phase steady state, which is a huge time gain.

Domain, Grid and Boundary Conditions
Physical Models
Post-processing


PIC

Figure 12.2: Cumulative residence time density function


12.3 Hydraulic Jump

Here some tips are given to study hydraulic energy dissipation systems in general, with the example of a hydraulic jump.

12.3.1 Main Idea

The goal of a dissipation energy study is to assess the amount of energy which can be dissipated for given flow conditions and a given geometry. Depending on the situation some analytical solution or correlation might be available to validate the simulation results. The energy in a hydraulic system is often analyzed as the hydraulic head which is monitored along the streamlines and has the unit of a distance ([m]). Before starting anything the definition of the head must be well understood.

In this document we take the example of a hydraulic jump at the exit of a channel. A hydraulic jump is an energy dissipation configuration where the fluid slows down, and the cross section expands. The head at a given section is the integral of z + u2
∕2g over the cross section. A hydraulic jump is possible when the incoming flow is super-critical, meaning the Froude number Fr is greater than 1 and correlations give the amplitude of the jump and the head loss as a function of the Froude number before the jump:

        (     ∘ ---------)
Y2=  0.5  - 1+   1 + 8F r2
Y1                      1
(12.1)

      (Y1 - Y2)3
ΔH  = ----------
        4Y1Y2
(12.2)


PIC

Figure 12.3: Hydraulic energy dissipation


12.3.2 Practical Steps

As an example, a 2D problem with a simple geometry is described here:


PIC

Figure 12.4: Hydraulic jump setup


The problem is described by the incoming Froude and Reynolds numbers (Fr1 and Re1). After arbitrarily fixing quantities such as the channel height and the density, the other variables are adjusted to fit the desired problem.

Domain, grid and Boundary Conditions
Physical Models
Postprocessing

TransAT offers the possibility to use section outputs where different variables such as flow rate of each phase, kinetic energy and more can be monitored.

12.4 Flocculation

In this chapter we provide some hints to study a complex water treatment plant, which includes several separate difficulties like the hydraulics or the chemical reactions forming part of the purification process, modelled here using interphasic mass transfer between mixed phases in the ASM (Algebraic Slip Model) model. here the example of phosphorus removal using activated carbon powder (PAC) particles is modelled.

12.4.1 Main Idea

Initially some chemicals are mixed with the waste-water and the homogenized mixture is poured into a retention pool with slow mixing where chemical and physical reactions take place. The pollutants precipitate as solid particles, which in time become bigger and bigger by accumulating other pollutants: this process is called flocculation. These particles are heavier than water and will settle down, the goal of the slow mixing is to prevent this and drive the flocs until the outlet of the pool where they will be filtered.

12.4.2 Modelling Principle

It is impossible for a CFD code to have all the existing models for waste water treatment available, so modeling choices must be made for the physico-chemical reactions taking place. It is important to have a clear understanding of the problem to be able to simplify it to a reasonable number of key elements and reactions (the detailed process for flocculation involves tens of species and reactions, this is too much for CFD).

Once the process is simplified it will be converted into a mass transfer multiphase problem in order to use TransAT ASM capabilities. The different species, in this case:

All the species should be thought of as independent phases with their own properties such as density, viscosity and their own source and sink terms. The phasic properties will help to regulate how the phases move relative to each other by means of the ASM (air will be lighter than the other phases and will go up, dissolved phases will have the same density than water and so will follow it exactly, while precipitated species and flocs will be heavier and will tend to fall). The physico-chemical reactions will be modeled with inter-phasic mass transfer, defined by means of TransAT s UDFs (User-Defined Functions). The reaction rates must be converted to volume fraction source terms using the relation between volume fraction and molar concentration (one must first know what units, orders of reactions etc... are used to describe the processes).

There are two methods to simulate mixing in TransAT that one can choose from.

12.4.3 Practical Steps

This sort of problems is rather complex and should be done steps-by-steps in order to minimize the chances of undetected errors. Typically, these intermediate cases should be done.


PIC

Figure 12.5: Species quantities evolution


Domain, Grid and Boundary Conditions

The geometry should be defined as a closed .stl object and meshed with sufficient resolution so that solid and liquid layers always have at least 3 cells inside. BCs (especially inflow/outflow) should be defined carefully as an ill-suited choice of BCs is a current source of error, this choice should be carefully detailed and specified as explained above:

Physical Models
Run Time


PIC

Figure 12.6: Flocs repartition in water treatment plant


12.5 Sludge Clarifier - Controlling Separation

Here are some learnings summarized for the study of a water treatment plant where sludge is removed from clear water using stratification.

12.5.1 Main Idea

A sludge clarifier is a large-scale device (typically 20-30 m radius) where a sludge/water mixture is introduced and let there to settle. Under a mixture of gravity and flow forcing (pumping) the sludge is removed at the bottom of the clarifier while the clean-water, hopefully sludge-free up to a certain tolerance, is extracted at the top to be sent to secondary clarifiers.

12.5.2 Modelling Principles

This problem is a sedimentation problem which can be tackled using the Algebraic Slip Model (ASM). The inflow consists of a water-sludge mixture, with the ratio depending on environmental variables such as the amount of rain. The main modeling difficulty is that several studies have shown that the settling velocity of the sludge is a complex function of the sludge concentration (following a curve such as presented by Takacs et al. (1991)) and is as such not covered by the standard ASM. It is however possible to use TransATs UDFs to impose the correct settling velocity as a function of the concentration with a user-defined drag model.


PIC

Figure 12.7: Separation rate is a function of concentration


12.5.3 Practical Steps

This paragraph summarizes some useful tips to set up a water clarifier problem.

Domain, Grid and Boundary Conditions

The geometry should be defined as a closed .stl object and meshed with sufficient resolution so that the smaller details are captured and all structures are meshed with 3 cells minimum. Typically, the clarifiers have a axisymmetric geometry so the axisymmetric model of TransAT can be used. The axis of revolution has to be the X-axis.

The following boundaries need to be set up:

Physical Models
Run Time


PIC

Figure 12.8: Flow through a sludge separator


12.6 Natural Hazards - debris fall and avalanches

Here is a set of guidelines summarizing the TransAT workflow to be followed for the study of natural hazards like debris flows or avalanches.

12.6.1 Main Idea

The goal is to model avalanchesi, rock falls, debris flows or landslides and access the relevant quantities for this sort of problems such as spreading, runout length, thickness, energy balance.

12.6.2 Modelling Principles

Usually these problems can be approached using the ASM model of TransAT, while once available the VOF model might also be a good candidate. A study like this should usually consist of two steps: The materials involved are considered as a single phase following a non-Newtonian rheology such as the Bingham or Herschell-Blkley models. The parameters of this rheology are usually unknown, as the real material composition (debris, rocks, snow...) is very variable from one case to the other. The first part of a study like this one is to find a benchmark test case in the literature to simulate and obtain parameters for the rheology. Then, the real case can be simulated. It can be challenging to obtain good-quality geometrical models for problems involving real natural environment such as mountain faces. These topographic data can be accessed on various websites and some of them allow to export this data in a .stl format (usually for 3D printing applications).


PIC

Figure 12.9: Simulation of a landslide using TransAT


12.6.3 Practical Steps and Tips

This paragraph summarizes some useful tips to set up a natural hazard problem.

Domain, Grid and Boundary Conditions

The geometry should be defined as a closed .stl object and meshed with sufficient resolution so that the smaller details are captured and all structures are meshed with 3 cells minimum.

Physical Models
Initial Conditions

Initial conditions are important here as they define the initial topology, or the position and quantity of the flowing phases (snow, debris...) before they start moving. They are expected to have a great impact on the runout, energy and spreading of the flow. To set a certain thickness over a geometry the solid level-set function (lsembed) can be used to define initial positions.

12.7 Process Engineering - Chemistry

Here some hintsare provided for the study of the acidification reaction in a Tall Oil reactor vessel, but these tips can easily be translated to other process and hydraulics probems.

12.7.1 Main Idea

The reaction vessel consists of a large vessel with several inflows, several outflows and sometimes a rotating part used to steer the mixture (agitator). Different reacting species are introduced through the inflows, they will react, form new species and separate in the vessel, and finally exit at the outflows, based on their relative densities, ...

12.7.2 Modelling Principles

Simple reactions in homogeneous phases can be modelled using the Species & Reactions functionality of TransAT. However, this model will fail at modelling the separation between the reactants/products of the reactions, meaning that each component taking part to the reaction should be modelled as a phase in a N-phase mixture approach, using the Algebraic Slip Model to capture the phase separation (the pairwise miscibility of all phases must be entered in TransAT). The reactions must be defined through User Defined Functions (UDFs) with interphasic mass transfer source terms. Examples of such source terms can be found in the TransAT UDFs templates. In the example of the acidification reaction, the reaction and the different phases (components) involved are:

Acid + Soap - - >  SpentAcid + Lignin + TallOil + Gas
(12.3)

Assuming a reaction rate, the interphasic source terms can be set to model the reaction.

12.7.3 Practical Steps

This sort of problems is rather complex and should be done steps-by-steps in order to minimize the chances of undetected errors. Typically, these intermediate cases should be done.

Domain, Grid and Boundary Conditions
Domain, Grid and Boundary Conditions

The geometry should be defined as a closed .stl object and meshed with sufficient resolution so that solid and liquid layers always have at least 3 cells inside. BCs (especially inflow/outflow) should be defined carefully as an ill-suited choice of BCs is a current source of error, this choice should be detailed with the following quantities:

Physical Models
Run Time


PIC

Figure 12.10: Tall Oil plant reactor vessel


12.8 Process Engineering - Separation

A Tall Oil reaction vessel is again studied, with a focus on the separation of the produced species (Tall Oil, Lignin and Spent Acid), meaning that the reaction part is omitted here.

12.8.1 Main Idea

The part modelled here is downstream of the place where the reaction happens, so that we consider the reaction finished and the final species (Spent acid, Lignin, Tall Oil) already formed and mixed. The goal is to model the separation to see where each species is going.

12.8.2 Modelling Principle

Several options exist to model this based on how much time is available. Using the ASM is the obvious choice (and the most accurate) since it can follow each phase independently. The risk is that it will be very slow for 3D unsteady case.

In that case one approximation is to use particles tracking, one-way coupling frozen flow, on the back of a steady state, single phase simulation. It is an approximation in the sense that the effect of the lighter phases separation is decorrelated from a main flow pattern. On the other hand, this method is very fast, and 1 to 2 days are enough to perform a separation study. In both cases, the separation rate is critical and must be calibrated (a simple separation experiment can be enough).

12.8.3 Practical Steps

This sort of problems is rather complex and should be done steps-by-steps in order to minimize the chances of undetected errors. Typically, these intermediate cases should be done.

Domain, Grid and Boundary Conditions

The geometry should be defined as a closed .stl object and meshed with sufficient resolution so that solid and liquid layers always have at least 3 cells inside. BCs (especially inflow/outflow) should be defined carefully as an ill-suited choice of BCs is a current source of error, this choice should be carefully detailed using the quantities below.

Run Time tips


PIC

Figure 12.11: Separation of Lignin in a Tall Oil reactor vessel


12.9 Thermal Packaging

In this chapter, the long-term evolution of temperature in a passive container is studied, and some ideas on how to model such a problem are provided.

12.9.1 Main Idea

The goal of such a problem is to study how a system responds to a thermal load against time. The example developed here is that of a container used to transport sensible products (such as medicines) by plane and ensure that certain temperature constraints are respected during the shipment. The container is made of a load, corresponding to the center compartment where material is stored and where constraints have to be respected, of a structural material (isolating the load from the outside) and of pockets inside the load initially filled with ice in order to prevent excessive heating.

The challenge is to reduce the computational cost due to the long time span of the simulations (several days, while thermal convection starting in the fluid zones can be very fast).

12.9.2 Practical Steps


PIC

Figure 12.12: Thermal packaging setup


The geometry must account for all the parts of the container. If pockets of ice are introduced, then the corresponding holes in the container structure must be created and based on the modelling choice, solid parts corresponding to the ice pockets must be created.

If one chooses to model the ice pockets as fluids with a phase change model, then some multiphase model must be chosen, as typically the load inside the container is filled with air. A lighter option is to model those pockets as solids with an adaptive heat capacity model to account for the phase change (Cp becomes a custom function of temperature). Using solid is faster as no momentum equation is solved there, only the temperature equation when the heat transfer model for the solid is set as conjugate.

The other important modelling choice concerns the boundary conditions on the side of the container. Accurate modelling would require simulating the surrounding air in order to have the thermal convection considered, however this would make the simulation time increase significantly. One can set instead the domain to correspond with the container and choose between time-dependent temperature or heat flux at the walls.


PIC

Figure 12.13: Temperature evolution in the thermal load


12.9.3 Tips

To perform these simulations in an efficient way, the user can benefit from the expert’s experience, which is formulated in terms of tips:

12.10 Turbulence Study

A turbulence study oftan aims at producing some statistical profiles, including a mesh-dependency analysis, and in practice some useful tips are helpful to execute these studies in an efficient way.

12.10.1 Main Idea

The goal of a LES study is to generate a synthetic flow field in the form of x-y profiles of velocity, kinetic energy, temperature in a pipe or channel under specific flow conditions. The very nature of these profiles is statistical, meaning that they are obtained by performing a time- (and often space-) averaging of the instantaneous quantities (instant velocities, instant temperatures...). To perform these averages, the flow must have reached a pseudo-static state (also called ergodic state) where the statistical quantities do not vary anymore.

Mesh convergence is important in this sort of problems as it allows to generate turbulent flows on coarse meshes (hence saving computational time) and then restart on successive refined grids to enhance the solution accuracy. Ideally once the mesh is fine enough no further refinement is refined. It is important to note that turbulence can decay if the mesh and scheme are not adequate.

12.10.2 Practical Steps

Problem Setup

PIC

A turbulence problem is defined using non-dimensional numbers, based on the parameters of interest, e.g.: bulk or shear Reynolds number, Prandtl number, Based on known material properties, problem geometry and non-dimensional numbers of the problem, the list of key figures include (sometimes it is required to arbitrary fix some of the values):

Turbulence Generation On Coarse Meshes

Turbulence is more easily created on smaller meshes, as calculations are faster, numerical diffusion is less important and it is easier to highlight setup mistakes.


PIC

Figure 12.14: Mesh refinement


mesh Refinement

Restarting the simulation from a coarse mesh on a finer mesh is made possible by TransAT non-matching restart option. Before changing to the next mesh, it must first be made sure that the flow rate has equilibrated on the previous one. That is, for a given imposed pressure gradient, the bulk velocity (or macroscopic flow rate) will slightly vary from one mesh to another (due to resolution of the wall stresses) and this bulk velocity must have reached a stable value before starting the next finer-mesh simulation. The same occurs for flows with imposed flow rate and where the pressure gradient adjusts to flow conditions. Other quantities such as volume-integrated kinetic energy can be monitored to control the ergodicity of the flow.

Mesh needs to be refined so that several cells are present in the boundary layers for flow problems, this corresponds to the region of y+ < 10, with first cell around y+ = 1. For each mesh, based on the value of the wall-neighboring cell y+, the wall-functions or no-slip approach should be chosen. Time-averaging should typically start once the flow has reached ergodic conditions and last long enough taveraging+ 10000 is generally sufficient.


PIC PIC

Figure 12.15: Averaged and instantaneous velocity


Tips

To perform these simulations in an efficient way, the user can benefit from the expert’s experience, which is formulated in terms of tips:

12.11 Restarting Procedures

This chapter details a quick procedure to restart a simulation on a cluster, without using the GUI as it is not always available on a cluster. The last restart file that has been created during the previous run is called: casename.runb

Make a copy of this file using following command:

cp casename.runb casename.rstb

TransAT will automatically identify this file as the restart data to be used.

Then the user must specify that the simulation will be the restart of an old simulation. This can be done manually by editing the file: transat_mb.inp.

Open this file with a text editor and search for the following lines.

restart_method = "norestart"

and change it to:

restart_method = "restart"

Save and close.

To perform a restart from a different mesh, which is typically useful when grid refinement studies are performed, the restart file from the old mesh casename.runb a well as the old mesh file casename.grda must also be specified in the input file transat_mb.inp. The simplest way is to copy them in the current working folder, in a subfolder called, say, non_matching_restart_files/.

The modification in the input file must now look like:

restart_method = "nonmatching"  
restart_solution_file = "non_matching_restart_files/casename.runb"  
restart_grid_file = "non_matching_restart_files/casename.grda"

Submit your job again, check that the restart is effective. The time step or iteration numbering should start from the value at which the restart file was written.

12.12 Level-set - microfluidics

Here are some hints on how to simulate a low Capillary number flow using an interface tracking method (ITM), e.g. level Set approach. We refer to the example of the flow of a supercritical CO2 bubble through a convergent-divergent pore.

12.12.1 Main Idea

Low Ca flows are challenging because of the flow is mainly driven by wetting effects controlled by surface tension. Second, in this class of flows, parasitic currents appear around the front because of the imbalance between pressure gradient and surface tension in the momentum equation. These tend to dominate the rest of the flow, making accurate solution difficult.

12.12.2 Practical Steps


PIC

Figure 12.16: Flow of a supercritical CO2 bubble through a pore


The following items must be carefully checked:

12.12.3 Tips and Hints

To perform these simulations in an efficient way, the user can benefit from the expert’s experience, which is formulated in terms of tips:

12.13 Viscoelasticity

Viscoelastic problems are a challenging class of CFD poblems with very few guidelines on how to properly define and tackle them. This chapter aims at giving some useful tips in that regard, without tackling the problem of choosing a viscoelastic model among the many available (PTT, Giezekus, Oldroyd-B.).

12.13.1 Main Idea

The difficulty of simulating viscoelastic flows can come from several factors. One is a very well-known difficulty with the traditional methods called the high Weissenberg number problem, which can in theory be circumvented by the Log of Conformation Tensor (LCT) method (implemented in TransAT) which is itself very challenging and complex. Another difficulty is the number of equations to be solved which is very large, especially for 3D or multimode problems.

12.13.2 Practical Steps

Problem Setup

A viscoelastic flow is set up roughly the same as any other flow (free surface with Level-set method or single phase), where the rheology is specified as viscoelastic, which then requires several inputs such as the VE model, some material properties, and some equations parameters for the stress equations.

The VE stresses are generated as viscous stresses by shear, but then have a more complex behavior because of the elastic mechanisms which are making them time-dependent as well as shear-dependent.

Important Things to Look for and Troubleshooting

Calculating the flow Weissenberg (or Deborah) number gives information about how difficult a flow can be to simulate.

It is simple in theory, but many things can go wrong in practice, and looking at the stresses/LCT tensors in Paraview is probably the best way to access information about what is going wrong, and where. In many cases, onvergence problems will happen in regions where some mesh transition can be observed. The remedy to that it to keep the mesh as homogeneous as possible thoughout the domain. For multiphase problems, when the viscoelastic properties of the two phases are very different (or when a phase is not viscoelastic) the transition of the viscoelastic properties such as λ and μp at the interface can cause problems. Making the interface wider (smoother) is a way to try and circumvent this issue.

Tips

These elements can help with convergence: