Skip to content

Tutorial 5: Grid Generation for the Viscous Flow Solver XCHAP

Overview

In this tutorial you generate structured volume grids with XGRID and use them in the viscous flow solver XCHAP. You work with a single-skeg and a twin-skeg container ship, set up a viscous free-surface (VoF) computation, control the grid by hand, post-process XCHAP results and add a rudder with its own overlapping grid.

The tutorial has six parts. Each part starts from its own files (see Tutorial Files), so once you know the basics from Part 1 you can work through the parts in any order.

Time required: 3–4 hours (all parts)
Difficulty: Intermediate to Advanced
Prerequisites: Tutorial 1, Tutorial 3 and Tutorial 4
SHIPFLOW modules used: XPAN, XBOUND, XGRID, XCHAP


Learning Objectives

By completing this tutorial, you will be able to:

  • Generate XGRID grids automatically with preset densities, and control the number and distribution of grid planes manually
  • Choose between the global and the zonal approach for XCHAP
  • Set up grids for non-symmetric cases, wet transoms and twin-skeg hulls
  • Set up a viscous free-surface (VoF) computation and control the grid refinement around the free surface
  • Post-process XCHAP results: grids, boundary conditions, contour and vector plots, streamlines and wave cuts
  • Add a parametric rudder and inspect how the overlapping grids are combined

SHIPFLOW Modules Used in This Tutorial

XGRID — Volume Grid Generator

XGRID generates the structured, body-fitted volume grid around the hull that XCHAP uses. It can also add a separate grid behind a submerged transom, mirror the grid for non-symmetric cases and handle twin-skeg hulls. XGRID does not grid appendages: XCHAP creates the grids of parametric appendages such as the rudder in Part 6. Command reference: XGRID commands.

XCHAP — RANS Viscous Flow Solver

XCHAP is a finite-volume solver for the Reynolds-averaged Navier-Stokes (RANS) equations, with the turbulence models EASM, k-ω SST and k-ω BSL. It computes either the whole hull (global approach) or only the aftbody (zonal approach), with a double-body model or with a free surface (VoF), and it combines overlapping grids for the hull and the appendages. Command reference: XCHAP commands.

XMESH, XPAN and XBOUND

The modules from the earlier tutorials are still used. XMESH generates the panel mesh for XPAN, and in the zonal approach the XPAN and XBOUND results provide the inflow boundary conditions for XCHAP. See Tutorial 1 for XPAN and Tutorial 4 for XBOUND.


Tutorial Files

The tutorial files are in the SHIPFLOW installation folder:

C:\FLOWTECH\SHIPFLOW<version>-x86_64\tutorials\tutorial-files\BasicTraining\Tutorials-v5\Tutorial_5\

Parts 2 and 4 also use example files from C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\.

Part Topic Files
Part 1 Automatic grid generation, global and zonal approach, non-symmetric cases, wet transom T_5_1\source\config_tutorial_5_1 and offset file off_tut_5_1
Part 2 Twin-skeg hull examples\geometry\tkcs.igs and examples\twinskeg_kcs_xgr8_resistance
Part 3 Viscous free surface (VoF) T_5_3\source\ath_vof_tut
Part 4 Manual grid control T_5_4\source\config_tutorial_5_4 and offset file off_tut_5_4; examples\kcs_xchap_vof and examples\geometry\kcs_g2010.igs
Part 5 Post-processing of XCHAP results T_5_5\kcs_import_IGES_zonal.cgns and T_5_5\kcs_vof_def.cgns — not in the distribution, see Part 5
Part 6 Rudder and overlapping grids T_5_6\source\config_tutorial_5_6 and offset file off_tut_5_6

Part 1: Automatic Grid Generation with XGRID

In this part you let XGRID generate a grid automatically for the KCS (KRISO Container Ship), run XCHAP for zero iterations and inspect the grid and the boundary conditions in post-processing. Sections 1.5–1.8 then use this case as a base for variations: grid density, global and zonal approach, non-symmetric cases and a wet-transom grid. You start from the configuration file T_5_1\source\config_tutorial_5_1 and the offset file off_tut_5_1 in the same folder.


1.1 Import Configuration and Offset File

  1. Go to Import → Configuration (SHIPFLOW).

    Import menu with Configuration (SHIPFLOW) highlighted

  2. Navigate to T_5_1\source\, select config_tutorial_5_1 and click Open.

  3. When a file dialog asks for the offset file, select off_tut_5_1 (in the same folder) and click Open.

    Import offset file dialog with off_tut_5_1 selected in the T_5_1 source folder

  4. In Select groups to be imported, make sure that all offset groups are ticked and click OK.

    Offset group selection with the groups main, bulb, aft, boss and bow all ticked

    The imported offsets are shown in the 3DView:

    Imported offsets of the KCS hull in the 3D view

  5. Save the project as tut5_part1.


1.2 Configure the Computation

Adding and removing configuration items

To add a section, command or parameter, select its parent in the Object Tree, pick the item in the drop-down list at the top of the Object Editor and click the green +. To remove an item, click the red cross next to it.

  1. In Connect → Configurations, select the configuration and rename it to config_tutorial_5_1_coarse in the Object Editor.

    Configuration renamed to config_tutorial_5_1_coarse in the object editor

  2. The imported configuration runs XPAN only. To run all modules in sequence, select xflow → program, remove xpan and add all.

    Program command with all selected in the drop-down list

  3. Add an xgrid and an xchap section to config_tutorial_5_1_coarse.

    Adding the xgrid section to config_tutorial_5_1_coarse from the drop-down list

  4. Add the command size to xgrid, then add xgdens and set it to coarse. In the command file this appears as size( coarse ).

    xgrid size command with xgdens set to coarse

  5. Add the command control to xchap, then add maxit and set it to 0.

    xchap control command with maxit set to 0

    With zero iterations, XCHAP only sets the boundary conditions and creates an initial solution. This lets you inspect the grid before you start a real computation.

  6. Save the project (Ctrl+S).

The configuration now runs all SHIPFLOW modules in sequence, using the global approach (see 1.6):

Setting Value Effect
xflow → hull → xmdens fine Panel mesh density for XPAN (already in the imported file)
xgrid → size → xgdens coarse Coarse XGRID grid
xchap → control → maxit 0 Boundary conditions and initial solution only

See HULLTYPE, SIZE and CONTROL in the user manual.

Running a real XCHAP computation

To start an actual XCHAP computation, increase maxit to about 200. For an accurate solution the grids should also be fine. This is left for you to explore.


1.3 Run the Computation

  1. Select Computations → shfComputation1 and click the green run button in the Object Editor.
  2. Follow the progress in the TaskMonitor window. If it is not open, open it with View → Windows → TaskMonitor.

    TaskMonitor during the run; the XCHAP output lists the number of grid points and cells

    The modules run in this order: XMESH and XPAN (potential flow), XBOUND (boundary layer), XGRID (volume grid) and XCHAP (boundary conditions and initial solution), followed by XPOST (report). The XCHAP output shows the size of the grid: about 1 million cells for this coarse global grid.


1.4 Post-Processing and Grid Visualisation

The objects that control the visualisation of the results are under Post-Processing → Object Tree → Results → shfComputation1.

The Two 3D Windows

SHIPFLOW shows the results in two separate 3D windows:

Window Shows by default
3DView XPAN and XBOUND results (potential flow)
3DOverView XCHAP results (viscous flow)

3DView with the XPAN pressure on the hull and the imported offsets

Open the 3DOverView

  1. If the 3DOverView is not open, open it from the main menu with View → Windows → 3DOverView.

    View → Windows menu with 3DOverView highlighted

  2. The 3DOverView opens below the 3DView:

    3DOverView opened in the lower half of the 3D area, below the 3DView

  3. To give it more room, right-click in the 3DOverView and select Central widget. The 3DOverView then becomes a tab next to the 3DView.

    Context menu of the 3DOverView with Central widget highlighted

Which window shows a visualisation

Each visualisation has a Viewer setting under Display Options that selects the window it is drawn in. XCHAP visualisations use 3DOverViewScene.

XCHAP_BodyContours object editor with Display Options → Viewer set to 3DOverViewScene

Hull Pressure and Domain Outline

The 3DOverView shows the pressure coefficient on the hull by default. Because XCHAP ran zero iterations, the pressure is zero everywhere and the hull has a single colour.

  1. To hide the offsets, go to Model and click the folder icon of SHF_Import_off_tut_5_1 in the Object Tree.

    Model object tree: clicking the icon of SHF_Import_off_tut_5_1 hides the offsets

  2. To show the outer edges of the XGRID grid, activate XCHAP_ComponentOutline under Results → shfComputation1 → XCHAP → Component Grids → Xgrid_1.

    XCHAP_ComponentOutline activated, showing the outline of the XGRID domain around the hull

Inspect the Grid with Grid Slices

The FGridSlices tool displays the parametric grid surfaces of a structured 3D grid.

  1. Select Results → shfComputation1 → XCHAP → Component Grids → Xgrid_1.
  2. In the Object Editor (FDisplayOptions3D: Xgrid_1 → Visualization), select create new in the drop-down list of the empty row.

    Visualization list of Xgrid_1 with create new selected

  3. In the list of tools that appears, scroll down to Data Extraction and select FGridSlices.

    FGridSlices entry in the list of tools

  4. In the Object Editor of the new gridSlices1, select create new in the drop-down list under Visualization.

    gridSlices1 object editor with create new selected under Visualization

  5. Select FMeshVisualization in the list that appears.

    FMeshVisualization entry in the list of tools

  6. Tick the check boxes of the L-, M- and N-planes (L, M and N are the parametric directions of the structured grid). Select the plane with the slider or by entering its index.

    Grid slices on an M-plane and an N-plane of the XGRID grid

    Try different planes and zoom in to inspect the grid around the bow and the stern.

Visualise the Boundary Conditions

  1. Activate XCHAP → Component Grids → Xgrid_1 → XCHAP_BoundaryConditions.
  2. Click XCHAP_BoundaryConditions to open its Object Editor.
  3. Tick the boundary conditions you want to see. A coloured sphere is drawn at the centre of each boundary cell face, in the colour given in the check-box label, for example:

    • Draw Noslip (green): no-slip boundaries, such as the hull surface
    • Draw Slip (orange): slip boundaries
    • Draw Inflow (aqua): the inlet (see 1.6)

    Boundary conditions with Draw Noslip and Draw Slip ticked: green spheres on the hull, orange spheres on the slip boundaries


1.5 Grid Density

Sections 1.5–1.8 use the Part 1 case as a base and show variations that are useful for different types of computations.

The density of the XGRID grid is selected with xgrid | size | xgdens:

xgrid size with xgdens coarse, and the resulting size( coarse ) line in the command file

xgdens Use
coarse Quick tests and grid inspection
medium The minimum for commercial work
fine Needed for an accurate solution
vcoarse Very coarse grid, used in Parts 3 and 6 to keep the tutorial fast

The number of grid planes that each option gives is listed under SIZE in the user manual.

Coarse grids are for testing only

The coarse grid gives too low a resolution for normal purposes. Use medium or fine for real computations.

If xgrid → size is not present, XGRID takes the grid density from xflow | hull | xmdens:

xflow hull with xmdens set to coarse, in a configuration without an xgrid size command


1.6 Global and Zonal Approach

XCHAP can compute the viscous flow around the whole hull (global approach) or only around the aftbody (zonal approach).

Global Approach

In the global approach, the XGRID grid covers the whole hull, from an inlet upstream of the bow to an outlet downstream of the stern, and XCHAP computes the viscous flow in the whole domain. For this hull the global approach is the default, so it is what you ran in 1.3. The coarse global grid has about 1 million cells.

Hull surface grid of the global approach, covering the whole hull

Zonal Approach

In the zonal approach, XPAN (potential flow) and XBOUND (thin boundary layer) compute the flow around the forebody, and XCHAP computes only the aftbody. The XGRID inlet is moved to about midship, and the inflow boundary conditions of XCHAP are generated from the XPAN and XBOUND results. This works because the boundary layer on the forebody is thin, as XBOUND assumes, while it grows quickly over the aftbody, where XCHAP is used.

The zonal grid is much smaller: about 0.4 million cells for the coarse grid, roughly 60 % fewer than the global grid, so the computation is faster.

Hull surface grid of the zonal approach, starting at about midship

Zonal approach in full scale

The zonal approach is not recommended in full scale, because the inflow computed by XPAN and XBOUND is not suitable for full-scale conditions. Use the global approach instead.

Activate the Zonal Approach

  1. Select config_tutorial_5_1_coarse → xgrid → size.
  2. Add domain and set it to zonal.

    xgrid size with xgdens coarse and domain zonal

  3. Keep XPAN and XBOUND in the program list (all includes them): their results are needed for the inlet conditions. The modules run in the order XMESH → XPAN → XBOUND → XGRID → XCHAP.

To see the inlet after the run, tick Draw Inflow (aqua) in XCHAP_BoundaryConditions. The aqua spheres mark the inlet at about midship; the figure also shows the grid on the centre plane.

Zonal grid on the centre plane, with the inlet at about midship marked by aqua spheres

Comparison

Property Global approach Zonal approach
Region computed by XCHAP Whole hull Aftbody, from about midship
Forebody flow computed by XCHAP XPAN and XBOUND
Inlet conditions from XPAN and XBOUND No Yes: both must run before XCHAP
Coarse grid of this hull About 1 million cells About 0.4 million cells
Setting in xgrid → size domain = global domain = zonal

1.7 Non-Symmetric Flow Cases

Both sides of the hull must be gridded when the flow is not symmetric, for example in self-propulsion with a single propeller or in manoeuvring cases with a drift angle or a rudder angle. XGRID mirrors the grid to both sides when the symmetry condition is nosym:

  1. Add the command symmetr to xflow.
  2. Set symmetry to nosym (see SYMMETRY).

    xflow symmetr command with symmetry set to nosym

The figure shows the resulting zonal grid on both sides of the hull:

Hull surface grid of the zonal nosym case, covering both sides of the aftbody

XPAN and XBOUND stay symmetric in automatic mode

XPAN and XBOUND ignore nosym in automatic mode and print this warning:

*** XFLOW WARNING: XZ-SYMMETRY IS ENFORCED FOR STANDARD CASES

Asymmetric cases must be set up in manual mode for XPAN and XBOUND. The inflow that XCHAP needs at the zonal inlet is mirrored automatically.


1.8 Wet Transom Grid

Hulls with a large submerged transom need special treatment. XGRID usually generates a single-block grid fitted to the hull. If such a grid has to be wrapped around the edges of a submerged transom, its poor quality degrades the flow solution. Instead, a separate component grid is fitted behind the transom, and the main grid is fitted around a streamlined surface made of the hull surface without the transom and the outer surface of the transom grid.

Continue with the Part 1 configuration (you may want to save the project under a new name first, for example tut5_part1_2):

  1. Increase the draught: set xflow | offset | zori to 14 (the imported value is 10.8).
  2. Set xflow → hull → fsflow to fsflow to include the free surface in XPAN.
  3. Add tranmode to xflow → hull and set it to wtran.

    xflow hull with fsflow set to fsflow and tranmode set to wtran

    wtran is the wet-transom grid option of XGRID (WTRANSOM in HULLTYPE). Do not confuse it with the keyword transom, which is a potential-flow setting.

    License errors during a training course

    The screenshot shows xmdens = medium. If a computation stops with a license error during a training course, the grid density may be too high for the training license: set xflow | hull | xmdens to coarse.

  4. Run SHIPFLOW.

Two component grids now appear under Results → shfComputation1 → XCHAP → Component Grids: Xgrid_1 (the main grid) and Xgrid_transom_1 (the transom grid). The figure shows a grid slice of Xgrid_transom_1; the green spheres (Draw Noslip (green)) show that a no-slip condition is used on the transom.

Transom component grid behind the transom; green spheres mark the no-slip condition on the transom face


Part 2: Automatic Grid Generation for Twin-Skeg Hulls

In this part you generate XGRID grids for a twin-skeg container ship, first with the global and then with the zonal approach. Basic knowledge of XGRID, XCHAP and post-processing from Part 1 is assumed. You start a new project from the IGES geometry examples\geometry\tkcs.igs and the example configuration examples\twinskeg_kcs_xgr8_resistance, which you convert from XGR8 to conventional XGRID grid generation.


2.1 Set Up the Project

  1. Start a new project.
  2. Go to Import → IGES and import C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\geometry\tkcs.igs.
  3. Select all imported surfaces and create a surface group with Model → CAD → Surfaces → Surface Based → Surface Group. The group, grp1, must contain all imported surfaces.

    CAD ribbon with Surfaces → Surface Based → Surface Group, and the imported twin-skeg hull

  4. Go to Import → Configuration (SHIPFLOW) and import C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\twinskeg_kcs_xgr8_resistance.

    Import menu with Configuration (SHIPFLOW) highlighted; the surface group grp1 is in the object tree

  5. Rename the configuration to twinskeg_kcs_resistance.

    Configuration twinskeg_kcs_xgr8_resistance selected, with its name in the object editor

  6. Convert the configuration to conventional XGRID. The example uses XGR8, which meshes the hull surface for XGRID (see XGR8 commands); this tutorial uses the conventional XGRID grid generation. Select each of the following items and click the red cross next to it:

    1. xgrid → control. It contains only the keyword xgr8, which switches on the XGR8-based grid generation (see CONTROL).

      xgrid control containing the keyword xgr8; the red cross next to control removes the whole command

    2. xgrid → poisson.

      xgrid poisson command with the red cross that removes it

    3. The xgr8 section.

      xgr8 section with the red cross that removes it

  7. Link the geometry to the configuration: select xflow → offset, drag the surface group grp1 into the iges field and complete the expression so that it reads:

    grp1.exportIGES("tkcs.igs")
    

    Press Ctrl+Space for autocompletion while you type. Then click Evaluate. The resulting file name is shown above the expression.

    xflow offset with the iges expression grp1.exportIGES that writes tkcs.igs

  8. Add an xpan section to the configuration.

    Adding the xpan section to twinskeg_kcs_resistance from the drop-down list

    Add the command iterati to xpan and set maxit to 1, so that XPAN runs only one iteration (the default is 20, see ITERATION).

    xpan iterati with maxit set to 1

  9. Set xchap | control | maxit to 0, so that XCHAP does not start the flow computation.

    xchap control with maxit set to 0

  10. Set xflow | hull | xmdens to coarse.

    xflow hull of the twin-skeg case with xmdens set to coarse


2.2 Global Approach for Twin-Skeg Hulls

  1. Add the command size to xgrid, then add domain and set it to global.

    xgrid size with domain set to global

  2. Save the project as tut5_part2.

  3. Start the computation. In the TaskMonitor, note that SHIPFLOW first generates an offset file from the IGES geometry.
  4. Switch to Post-Processing and inspect the grid in the 3DOverView. (The XPAN results are shown in the 3DView.)

For a twin-skeg hull, the global grid consists of two component grids under Results → shfComputation1 → XCHAP → Component Grids:

  • Xgrid_1 covers the aftbody, from the outlet to midship.
  • Xgrid_fwd_1 covers the forebody, from the inlet to midship.

The two grids overlap at midship, and XCHAP transfers the flow between them with its overlapping-grid technique.

Global grid of the twin-skeg hull: Xgrid_1 and Xgrid_fwd_1 overlap at midship, marked by the red box


2.3 Zonal Approach for Twin-Skeg Hulls

For twin-skeg hulls, conventional XGRID uses the zonal approach unless domain = global is set.

  1. Create a new design variant with Optimize → New Design and name it zonal (design variants are explained in Tutorial 2).

    Optimization tab with New Design; the new design is named zonal

  2. Remove the command size from xgrid. Alternatively, change domain to zonal.

    xgrid size command with the red cross that removes it

  3. Run the case. SHIPFLOW generates the offset file once more.

    Reuse the offset file

    If you plan several computations for the same hull geometry, it pays off to store the generated offset file and use it instead of the IGES file. See Reusing Generated Offset Files in Tutorial 3.

  4. When the computation has finished, display the component grid outline to see the flow domain. Only Xgrid_1 is present: it covers the aftbody from midship to the outlet, and XPAN and XBOUND compute the forebody.

    Zonal grid of the twin-skeg hull: only Xgrid_1, starting at midship

  5. Save the project.


Part 3: Viscous Free-Surface Computation (VoF)

In this part you turn a double-body XCHAP case into a viscous free-surface computation with the Volume of Fluid (VoF) method. Basic knowledge of XGRID, XCHAP and post-processing from Part 1 is assumed. You start from the configuration file T_5_3\source\ath_vof_tut.

Potential-flow and viscous free surface

XPAN computes the waves with potential flow, which neglects viscosity. With VoF, XCHAP computes the viscous flow of water and air together and captures the free surface with an equation for the volume fraction. VoF computations need many more iterations than double-body computations; the kcs_xchap_vof example, for instance, uses maxit = 7000.


3.1 Import and Configure

  1. Go to Import → Configuration (SHIPFLOW) and import T_5_3\source\ath_vof_tut.
  2. Save the project as tut5_part3.
  3. Select xflow → hull and add the keyword vof to activate the viscous free surface.

    xflow hull of ath_vof_tut with the vof keyword added

  4. Set xchap | control | maxit to 500.

    xchap control with maxit set to 500

This configuration is very similar to a regular double-body case, so apart from the number of iterations, adding vof is all it needs. In many other cases more settings have to be adjusted (see 4.3). By default, XCHAP solves both VoF and double-body cases with the Krylov solver (see CONTROL); control ( adi ) selects the ADI solver that earlier versions used for VoF cases.


3.2 Run and Monitor

  1. Run the case. It takes a few minutes.
  2. Follow the progress in the TaskMonitor. Every 100 iterations, XCHAP prints the standard deviation of Fxp, the difference of Fx over the last 100 iterations, the remaining time and the estimated time of finish.

    TaskMonitor during the VoF run, with the convergence summary printed every 100 iterations


3.3 View Results

  1. Switch to Post-Processing and open the 3DOverView. It shows the wave pattern (XCHAP_FreeContours) by default.
  2. Click the mirror button in the toolbar at the bottom of the 3DOverView to show both sides of the wave pattern.

    VoF wave pattern in the 3DOverView, mirrored with the button marked at the bottom of the window

Very coarse grid

The grid of this case is extremely coarse (xgdens = vcoarse). For commercial work, use at least the medium grid density.

xgrid size of ath_vof_tut with xgdens vcoarse and domain global


Part 4: Manual Grid Control of XGRID

In this part you control the number and the distribution of the XGRID grid planes yourself: first for a global and then for a zonal double-body grid of the KCS, and finally for a VoF grid. For 4.1 and 4.2 you start from the configuration file T_5_4\source\config_tutorial_5_4 and the offset file off_tut_5_4; for 4.3 and 4.4 from the example configuration examples\kcs_xchap_vof and the geometry examples\geometry\kcs_g2010.igs.

The goal of 4.1 is a global grid with 154 × 31 × 65 cells in the longitudinal, circumferential and normal directions:

  • inlet at x = −1.0 and outlet at x = 2.0;
  • cells concentrated around the stem (−0.1 < x < 0.2) and the stern (0.8 < x < 1.0);
  • about one third of the cells amidships, one tenth upstream and one tenth downstream of the hull, and the remaining half for the forebody and the aftbody.

x is non-dimensional (divided by Lpp), with x = 0 at the fore perpendicular and x = 1 at the aft perpendicular. The values below are suggestions based on these goals.


4.1 Double-Body Grid — Global Approach

  1. Go to Import → Configuration (SHIPFLOW) and import T_5_4\source\config_tutorial_5_4. When asked for the offset file, select off_tut_5_4.

    Import offset file dialog with off_tut_5_4 selected in the T_5_4 source folder

  2. Select xflow → program, remove xpan and add xgrid and xchap.

    Program command containing xgrid and xchap

  3. Add an xgrid section to the configuration.

    Adding the xgrid section to config_tutorial_5_4 from the drop-down list

  4. Add the command size to xgrid. The transverse resolution is given as a number of grid planes: to get 31 × 65 cells in each transverse slab, set etamax to 32 and zetamax to 66 (see SIZE).

    xgrid size with etamax 32 and zetamax 66

  5. Add the command xdistr to xgrid. It controls the longitudinal distribution of the grid planes (see XDISTR). Set the positions of the inflow and outflow planes: xstart = -1 (1 Lpp ahead of the fore perpendicular) and xend = 2 (1 Lpp behind the aft perpendicular).

    xgrid xdistr with xstart -1 and xend 2

  6. The grid planes are distributed over five segments. xfpu, xfpd, xapu and xapd are the x-coordinates of the boundaries between the segments, and nu, nf, nm, na and nw the numbers of planes in the segments:

    Longitudinal segmentation of the XGRID domain: segments NW, NA, NM, NF and NU between XEND, XAPD, XAPU, XFPD, XFPU and XSTART

    Set these values:

    Parameter Value Meaning
    xfpu -0.1 Start of the bow region, upstream of the fore perpendicular
    xfpd 0.2 End of the bow region
    xapu 0.8 Start of the stern region
    xapd 1 End of the stern region, at the aft perpendicular
    nu 14 Planes between xstart and xfpu (upstream)
    nf 38 Planes between xfpu and xfpd (bow region)
    nm 50 Planes between xfpd and xapu (midship)
    na 38 Planes between xapu and xapd (stern region)
    nw 14 Planes between xapd and xend (wake)

    xgrid xdistr with all segment boundaries and numbers of planes set

  7. Add an xchap section, add the command control to it and set maxit to 0 (grid inspection only).

    Adding the xchap section to config_tutorial_5_4 from the drop-down list

    Adding maxit to xchap control from the drop-down list

  8. Turn off the automatic report generation: add an xpost section, add the command control to it and set onoff to off (see XPOST).

  9. Save the project (for example as tut5_part4) and run SHIPFLOW.
  10. In Post-Processing, activate Results → shfComputation1 → XCHAP → Component Grids → Xgrid_1 → XCHAP_ComponentOutline to see the edges of the grid, and create a grid slice visualisation as in 1.4.

    Plan view of the manual global grid with the segment boundaries XFPU, XFPD, XAPU and XAPD marked

    Compare the grid with the segmentation diagram above: the planes are concentrated in the bow and stern regions, and XGRID stretches the cells smoothly between the segments. The grid covers one side of the hull only; press F5 to mirror it.


4.2 Double-Body Grid — Zonal Approach

Now create a grid with the same density for the zonal approach. The grid starts at midship.

  1. Create a new design variant in the current project with Optimize → New Design, for example named zonal.

    Optimization tab with New Design; the new design is named zonal

  2. Change xgrid → xdistr: set xstart to 0.5, remove nu, nf, xfpu and xfpd (the forebody is no longer in the domain), and reduce nm to about half its previous value, for example 25.

    xdistr for the zonal grid: xstart 0.5, nm 25, xapu 0.8, na 38, xapd 1, nw 14 and xend 2

  3. Select xgrid → size, add domain and set it to zonal.

    xgrid size with domain zonal, etamax 32 and zetamax 66

  4. Add xbound to xflow → program.

    Program command containing xbound, xgrid and xchap

  5. Save the project and run SHIPFLOW.

  6. Inspect the grid in the 3DOverView. You can reuse the grid slice visualisation from 4.1; there is no need to create a new one.

    Plan view of the manual zonal grid, which starts at midship


4.3 Grids for Viscous Free-Surface Computations

  1. Go to Import → Configuration (SHIPFLOW) and import C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\kcs_xchap_vof.
  2. Go to Import → IGES and import C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\geometry\kcs_g2010.igs.
  3. Select all hull surfaces and create a surface group, grp1, with Model → CAD → Surfaces → Surface Based → Surface Group.
  4. Link the geometry to the configuration as in Part 2: drag grp1 into the iges field of xflow → offset, complete the expression to grp1.exportIGES("kcs_g2010.igs") and click Evaluate.
  5. Save the project as tut5_part4_2.
  6. Note the keyword vof in xflow → hull. It triggers the viscous free-surface computation, but in many cases this keyword alone is not enough: more settings have to be adjusted, as shown below.

    xflow hull of kcs_xchap_vof with the keyword vof and tranmode wtran

  7. Set xchap | control | maxit to 0 and remove the command parall from xchap.

    xchap control with maxit set to 0

  8. Check that xflow | hull | tranmode is wtran. It is already set in the example.

  9. Add xgrid to xflow → program.

    Adding xgrid to the program command of kcs_xchap_vof

  10. Run SHIPFLOW.

  11. Display the surface mesh on the hull and the transom. The VoF grid consists of several component grids (Xgrid_1, Xgrid_plug_main_1, Xgrid_plug_transom_1 and Xgrid_transom_1); the figure uses grid slices on three of them.

    Surface grids of the VoF case on the hull and the transom, shown with grid slices on three component grids


4.4 Free-Surface Refinement Band

Seen from the side, the surface grid of the VoF case has a band of higher resolution at the expected position of the free surface. The position, thickness and resolution of this band are controlled with the following parameters, which are available for VoF grids only:

Transverse cut through a VoF grid: uetamax, aetamax and jmaxf count the circumferential grid planes up to z = hund, z = habo and deck level

Parameter Command Description
hund xdistr Non-dimensional z-coordinate of the bottom of the refinement band. Default: −0.005.
habo xdistr Non-dimensional z-coordinate of the top of the refinement band. Default: 0.015.
uetamax size Number of grid planes in the circumferential direction up to z = hund
aetamax size As uetamax, but up to z = habo
jmaxf size As uetamax, but up to deck level

See XDISTR and SIZE in the XGRID commands for details.

The grid singularity line of the bow must lie below z = hund. For hulls without a bulbous bow, you may have to specify the singularity line yourself with xgrid | singul, using the keywords bow and xyzfwd. xyzfwd is given in the offset-file coordinate system (see SINGUL). The example examples\athena_xchap_vof and the Part 3 configuration ath_vof_tut both use it.

Side view of a VoF grid at the bow: refinement band between z = hund and z = habo around the still water plane, with the bow singularity line below it

Exercise: Change habo and the number of cells in the girthwise direction so that higher waves can be captured within the high-resolution band. Keep the number of cells in the refinement band about the same.


Part 5: Post-Processing of Viscous Flow Results

In this part you visualise ready-made XCHAP results: contour and vector plots on a cutting plane and on the hull, streamlines, and the wave pattern and wave cuts of a VoF computation. You start from the result files kcs_import_IGES_zonal.cgns (sections 5.1–5.3) and kcs_vof_def.cgns (sections 5.4–5.5) in:

C:\FLOWTECH\SHIPFLOW<version>-x86_64\tutorials\tutorial-files\BasicTraining\Tutorials-v5\Tutorial_5\T_5_5\

Where to get the result files

Because of their size, the two CGNS result files are not part of the SHIPFLOW distribution. They are handed out during SHIPFLOW training. If you do not have them, contact [email protected]. You can also produce your own results by running the cases of Parts 1 and 3 and post-processing those instead; the steps below are the same.

When you import a CGNS results file, the command file, the output file and the force logs are imported too, if they exist. XCHAP results are shown in the 3DOverView by default, and XPAN and XBOUND results in the 3DView. The default XCHAP visualisations are the pressure coefficient on the hull and the wake fraction on a propeller disk.


5.1 Cutting Plane with Contour and Vector Plots

  1. Start a new project.
  2. Go to Import → Results (SHIPFLOW) and select kcs_import_IGES_zonal.cgns.

    Import menu with Results (SHIPFLOW) highlighted

    File dialog in the T_5_5 folder with kcs_import_IGES_zonal.cgns selected

    When you are asked to save the project before importing, click Save and save it as tut5_part5. Saving is not required for post-processing, but it improves performance.

    Dialog recommending to save the project before importing SHIPFLOW results

  3. Add a legend to the pressure contours on the hull: select Results → kcs_import_IGES_zonal → XCHAP → Body → XCHAP_BodyContours and click the + next to Color Map in the General section of the Object Editor. If General is collapsed, click the arrow next to it.

    XCHAP_BodyContours object editor with the + button next to Color Map

  4. Hide the propeller wake cut: click the icon of XCHAP → Propeller → KP505_MOERI_cut.

    Clicking the icon of KP505_MOERI_cut hides the propeller wake contours

  5. Activate XCHAP → Combined Grids → XCHAP_CombinedCut by ticking the check box to the left of it, and set in its Object Editor:

    • Positions: 4.02, the x-coordinate of the propeller plane. (To find it, hover over the propeller disk in a side view; the coordinate is shown in the top-right corner of the window.)
    • Plane: X - (Y,Z)
    • Visualization: select create new and pick FContourPlot.

    XCHAP_CombinedCut at position 4.02 on an X - (Y,Z) plane, with FContourPlot picked as new visualisation

  6. Click the pencil next to contourPlot1 and set Mapped Data to VelocityX.

    contourPlot1 opened with the pencil button, with Mapped Data set to VelocityX

  7. Add a legend with the + next to Color Map. To move or restyle it, click the pencil next to Color Map and change, for example, Geometry → Y to 0.

    Legend settings opened with the pencil next to Color Map, and the VelocityX contours on the cut

  8. Add velocity vectors to the cut: select XCHAP_CombinedCut, select create new under Visualization and pick FVectorVisualization in the 3D Visualization section.

    FVectorVisualization entry in the list of tools

  9. Set the vector parameters. If Vector Color is not visible, show all options of Display Options.

    Parameter Value
    Use Vector Data Not ticked
    Vector Field → Type Tangential to Surface
    Vector Field → Minimum Vector Distance 0.2
    Vector Scaling → Length Scale 2
    Arrow → Type Cone
    Display Options → Vector Color black

    Vector parameters and the resulting in-plane velocity vectors on the VelocityX contours

  10. Click the mirror button to show both sides.

    Mirrored cut at the propeller plane with VelocityX contours and velocity vectors


5.2 Velocity Vectors on the Hull Surface

  1. Hide XCHAP_CombinedCut by clicking the button to the left of it.
  2. Activate XCHAP_BodyContours and check that Mapped Data is PressureCoefficient. If needed, click Reset Color Map to rescale the legend.

    XCHAP_CombinedCut hidden and XCHAP_BodyContours showing the pressure coefficient on the hull

  3. Select XCHAP → Body, select create new under Visualization and pick FVectorVisualization.

    Visualization list of Body with create new selected

  4. Set the parameters:

    Parameter Value
    Use Vector Data Not ticked
    Vector Scaling → Length Scale 20
    Arrow → Type Arrow
    Display Options → Vector Color black
  5. Zoom in on the stern.

    Velocity vectors on the hull surface at the stern, over the pressure coefficient contours

Exercise: Tick Constant Length and choose a suitable length scale.


5.3 Streamlines

  1. Hide the velocity vectors on the hull.
  2. Select XCHAP → Component Grids → Xgrid_1, select create new under Visualization and pick FStreamlines in the 3D Visualization section. An object streamlines1 is created.

    Visualization list of Xgrid_1 with FStreamlines in the 3D Visualization section

  3. Add a seed point: in Seed Points / Curves, select create ... in the drop-down list and then Points → 3D Point.

    streamlines1 object editor with create ... in the Seed Points / Curves drop-down list

    Points → 3D Point in the menu for creating a seed point

  4. In the Object Editor of the new point, point1, enter X = 4.1, Y = 1 and Z = -6.

    point1 with X 4.1, Y 1 and Z -6

  5. Set the streamline parameters in streamlines1:

    Parameter Value
    Seed Points / Curves → Number of Streamlines per Point / Curve 25
    Seed Points / Curves → Distribution Radius (Points only) 2
    Mapped Vector Data → Use Vector Data Not ticked
    Mapped Vector Data → X, Y, Z VelocityX, VelocityY, VelocityZ
    Color Mapping → Mapped Data velocity magnitude
    Display Options → Width 0.5

    Streamline parameters and the streamlines around the stern, coloured by velocity magnitude


5.4 Viscous Free-Surface Results (VoF)

The results used here were computed on a very coarse grid, so some details are bound to be somewhat unrealistic.

  1. Start a new project.
  2. Go to Import → Results (SHIPFLOW) and import T_5_5\kcs_vof_def.cgns.
  3. The wave pattern is shown in the 3DOverView by default. View it from above.
  4. Select Results → kcs_vof_def → XCHAP → Free Surface → XCHAP_FreeContours, set General → Divisions to 25 and add a legend with the + next to Color Map.

    XCHAP_FreeContours with Divisions 25 and the + button next to Color Map

  5. Optionally, pick the preset Black isolines on colored surface and move the legend (pencil next to Color Map, then Geometry → X and Y).

    VoF wave pattern around the KCS hull seen from above, with the WaveHeight legend and black isolines

    Look for the bow wave, the diverging waves spreading out from the hull, the transverse waves along the hull and the wave crest behind the transom.


5.5 Wave Cuts

Wave cuts are longitudinal profiles of the wave elevation at fixed y-positions. Continue with the kcs_vof_def results from 5.4.

  1. Select Results → kcs_vof_def → XCHAP → Free Surface, select create new under Visualization and pick FPlaneCut in the Data Extraction section.

    Visualization list of Free Surface with FPlaneCut in the Data Extraction section

  2. In the Object Editor of planeCut1, set Cut → Positions to -0.1.

  3. Under Visualization of planeCut1, select create new and pick F2DPlotCurve.

    planeCut1 at position -0.1 on a Y - (Z,X) plane, with F2DPlotCurve picked as new visualisation

  4. Click the pencil next to 2DPlotCurve1. Under Visualization of 2DPlotCurve1, select create new and pick F2DPlot.

    2DPlotCurve1 object editor with create new selected under Visualization

  5. Open the plot window from the main menu with View → Windows → plotViewer1. It shows the wave cut at y = −0.1. If the plot is empty, check that the 2D plot is selected under Visualization of 2DPlotCurve1.

    View → Windows menu with plotViewer1 highlighted

    Wave cut at y = -0.1 in plotViewer1

  6. To show several cuts, change Positions in planeCut1 to -0.1, -0.2, -0.3.

    Wave cuts at y = -0.1, -0.2 and -0.3 in plotViewer1


Part 6: Grid Generation for Appendages — Rudder Example

In this part you add a parametric rudder to a hull. XCHAP creates a separate grid around the rudder, which overlaps the hull grid, and you inspect how the grid points in the overlap region are classified. You start from the configuration file T_5_6\source\config_tutorial_5_6 and the offset file off_tut_5_6.

Very coarse grid

The hull grid in this part is very coarse, to keep the tutorial fast. Use a finer grid for real computations.


6.1 Import Configuration and Offset File

  1. Go to Import → Configuration (SHIPFLOW) and import T_5_6\source\config_tutorial_5_6.
  2. When asked for the offset file, select off_tut_5_6 (next to the configuration file).

6.2 Add a Rudder

The rudder geometry is given as a set of values at spanwise stations. The rudder in this example has these dimensions:

Rudder planform drawing: span 10.50 from the root (chord 6.60) to the tip (chord 3.00), chord 4.33 at mid-span, and leading-edge distances 2.87, 1.54 and 1.23 from the dashed spanwise reference line

  1. Add a rudder command to xflow (see RUDDER).

    Adding a rudder command to xflow of config_tutorial_5_6 from the drop-down list

  2. Add these parameters to xflow → rudder:

    Parameter Value Description
    s [0, 0.5, 1] Spanwise stations, normalised with the span (0 = root, 1 = tip)
    span 10.5 Total span of the rudder, used to normalise s
    c [6.6, 4.33, 3] Chord lengths at the stations
    xle [2.87, 1.54, 1.23] Chordwise distance between the leading edge and the spanwise reference line
    origin [0, 0, 10.5] Position, in the offset coordinate system, of the point where the reference line meets the rudder root
    angle 10 Rudder angle in degrees
    id for example example_rudder Name of the rudder; XCHAP requires an ID

    xflow rudder with all parameters set

  3. Set xflow | hull | xmdens to coarse.

    xflow hull of config_tutorial_5_6 with xmdens set to coarse

  4. Set xgrid | size | xgdens to vcoarse (shown as vcoars in the drop-down list).

    xgrid size with xgdens set to vcoarse

  5. Evaluate the offset under xflow → offset.

  6. Run SHIPFLOW.

6.3 Inspect the Overlapping-Grid Classification Points

The rudder has its own grid fitted to its surface, and this grid overlaps the hull grid. When the grids are combined, some grid points end up outside the fluid domain, some become superfluous and some take part in the transfer of information between the grids. This process is highly automated; visualising how the points were classified helps when it fails for a difficult geometry.

  1. In Post-Processing, select XCHAP → Component Grids → Xgrid_1 → XCHAP_ClassificationPoints in the results of the computation, and turn on its visibility with the round check box next to it.
  2. In its Object Editor, tick Draw Interp (aqua). All hull grid points close to the rudder are interpolation points: they take their values from the solution in the rudder grid.
  3. Tick Draw Outside (lime) and look into the rudder from above. The hull grid points that were in the fluid domain but are now inside the rudder are classified as outside the fluid domain.

    Classification points of the hull grid around the rudder: interpolation points in aqua and outside points in lime

More about appendages and overlapping grids: Advanced Tutorial 3: Appendage Modelling with Overlapping Grids.


Troubleshooting

General troubleshooting

Problems that can occur in any SHIPFLOW case are collected on one page: Troubleshooting.

Directly relevant to this tutorial:


Summary

In this tutorial you:

  • generated XGRID grids automatically with preset densities (xgdens) and inspected the grid and the boundary conditions in the 3DOverView (Part 1);
  • compared the global and the zonal approach, and set up non-symmetric and wet-transom grids (Part 1);
  • converted a twin-skeg example from XGR8 to conventional XGRID and generated its global grid (two overlapping components) and zonal grid (Part 2);
  • turned a double-body case into a VoF computation with the keyword vof (Part 3);
  • controlled the grid planes manually with xgrid | size and xgrid | xdistr, and looked at the free-surface refinement band of a VoF grid (Part 4);
  • post-processed XCHAP results: contour and vector plots, streamlines, wave pattern and wave cuts (Part 5);
  • added a parametric rudder and inspected the overlapping-grid classification points (Part 6).

Next Steps

Getting help: send your questions to [email protected]. Product information is available at shipflow.se.


Tutorial modified: May 2026
SHIPFLOW version: 8.0.37
Document version: 1.0