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¶
-
Go to Import → Configuration (SHIPFLOW).
-
Navigate to
T_5_1\source\, selectconfig_tutorial_5_1and click Open. -
When a file dialog asks for the offset file, select
off_tut_5_1(in the same folder) and click Open. -
In Select groups to be imported, make sure that all offset groups are ticked and click OK.
The imported offsets are shown in the 3DView:
-
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.
-
In Connect → Configurations, select the configuration and rename it to
config_tutorial_5_1_coarsein the Object Editor. -
The imported configuration runs XPAN only. To run all modules in sequence, select xflow → program, remove
xpanand addall. -
Add an xgrid and an xchap section to
config_tutorial_5_1_coarse. -
Add the command size to xgrid, then add
xgdensand set it tocoarse. In the command file this appears assize( coarse ). -
Add the command control to xchap, then add
maxitand set it to0.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.
-
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¶
- Select Computations → shfComputation1 and click the green run button in the Object Editor.
-
Follow the progress in the TaskMonitor window. If it is not open, open it with View → Windows → TaskMonitor.
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) |
Open the 3DOverView¶
-
If the 3DOverView is not open, open it from the main menu with View → Windows → 3DOverView.
-
The 3DOverView opens below the 3DView:
-
To give it more room, right-click in the 3DOverView and select Central widget. The 3DOverView then becomes a tab next to the 3DView.
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.
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.
-
To hide the offsets, go to Model and click the folder icon of
SHF_Import_off_tut_5_1in the Object Tree. -
To show the outer edges of the XGRID grid, activate XCHAP_ComponentOutline under Results → shfComputation1 → XCHAP → Component Grids → Xgrid_1.
Inspect the Grid with Grid Slices¶
The FGridSlices tool displays the parametric grid surfaces of a structured 3D grid.
- Select Results → shfComputation1 → XCHAP → Component Grids → Xgrid_1.
-
In the Object Editor (FDisplayOptions3D: Xgrid_1 → Visualization), select create new in the drop-down list of the empty row.
-
In the list of tools that appears, scroll down to Data Extraction and select FGridSlices.
-
In the Object Editor of the new
gridSlices1, select create new in the drop-down list under Visualization. -
Select FMeshVisualization in the list that appears.
-
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.
Try different planes and zoom in to inspect the grid around the bow and the stern.
Visualise the Boundary Conditions¶
- Activate XCHAP → Component Grids → Xgrid_1 → XCHAP_BoundaryConditions.
- Click XCHAP_BoundaryConditions to open its Object Editor.
-
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)
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:
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:
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.
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.
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¶
- Select config_tutorial_5_1_coarse → xgrid → size.
-
Add
domainand set it tozonal. -
Keep XPAN and XBOUND in the program list (
allincludes 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.
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:
- Add the command symmetr to xflow.
-
Set
symmetrytonosym(see SYMMETRY).
The figure shows the resulting zonal grid on both sides of the hull:
XPAN and XBOUND stay symmetric in automatic mode
XPAN and XBOUND ignore nosym in automatic mode and print this warning:
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):
- Increase the draught: set
xflow | offset | zorito14(the imported value is10.8). - Set xflow → hull → fsflow to
fsflowto include the free surface in XPAN. -
Add
tranmodeto xflow → hull and set it towtran.wtranis the wet-transom grid option of XGRID (WTRANSOMin HULLTYPE). Do not confuse it with the keywordtransom, 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: setxflow | hull | xmdenstocoarse. -
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.
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¶
- Start a new project.
- Go to Import → IGES and import
C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\geometry\tkcs.igs. -
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. -
Go to Import → Configuration (SHIPFLOW) and import
C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\twinskeg_kcs_xgr8_resistance. -
Rename the configuration to
twinskeg_kcs_resistance. -
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:
-
xgrid → control. It contains only the keyword
xgr8, which switches on the XGR8-based grid generation (see CONTROL). -
xgrid → poisson.
-
The xgr8 section.
-
-
Link the geometry to the configuration: select xflow → offset, drag the surface group
grp1into theigesfield and complete the expression so that it reads:Press Ctrl+Space for autocompletion while you type. Then click Evaluate. The resulting file name is shown above the expression.
-
Add an xpan section to the configuration.
Add the command iterati to xpan and set
maxitto1, so that XPAN runs only one iteration (the default is 20, see ITERATION). -
Set
xchap | control | maxitto0, so that XCHAP does not start the flow computation. -
Set
xflow | hull | xmdenstocoarse.
2.2 Global Approach for Twin-Skeg Hulls¶
-
Add the command size to xgrid, then add
domainand set it toglobal. -
Save the project as
tut5_part2. - Start the computation. In the TaskMonitor, note that SHIPFLOW first generates an offset file from the IGES geometry.
- 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_1covers the aftbody, from the outlet to midship.Xgrid_fwd_1covers 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.
2.3 Zonal Approach for Twin-Skeg Hulls¶
For twin-skeg hulls, conventional XGRID uses the zonal approach unless domain = global is set.
-
Create a new design variant with Optimize → New Design and name it
zonal(design variants are explained in Tutorial 2). -
Remove the command size from xgrid. Alternatively, change
domaintozonal. -
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.
-
When the computation has finished, display the component grid outline to see the flow domain. Only
Xgrid_1is present: it covers the aftbody from midship to the outlet, and XPAN and XBOUND compute the forebody. -
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¶
- Go to Import → Configuration (SHIPFLOW) and import
T_5_3\source\ath_vof_tut. - Save the project as
tut5_part3. -
Select xflow → hull and add the keyword
vofto activate the viscous free surface. -
Set
xchap | control | maxitto500.
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¶
- Run the case. It takes a few minutes.
-
Follow the progress in the TaskMonitor. Every 100 iterations, XCHAP prints the standard deviation of
Fxp, the difference ofFxover the last 100 iterations, the remaining time and the estimated time of finish.
3.3 View Results¶
- Switch to Post-Processing and open the 3DOverView. It shows the wave pattern (
XCHAP_FreeContours) by default. -
Click the mirror button in the toolbar at the bottom of the 3DOverView to show both sides of the wave pattern.
Very coarse grid
The grid of this case is extremely coarse (xgdens = vcoarse). For commercial work, use at least the medium grid density.
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¶
-
Go to Import → Configuration (SHIPFLOW) and import
T_5_4\source\config_tutorial_5_4. When asked for the offset file, selectoff_tut_5_4. -
Select xflow → program, remove
xpanand addxgridandxchap. -
Add an xgrid section to the configuration.
-
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
etamaxto32andzetamaxto66(see SIZE). -
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) andxend=2(1 Lpp behind the aft perpendicular). -
The grid planes are distributed over five segments.
xfpu,xfpd,xapuandxapdare the x-coordinates of the boundaries between the segments, andnu,nf,nm,naandnwthe numbers of planes in the segments:Set these values:
Parameter Value Meaning xfpu-0.1Start of the bow region, upstream of the fore perpendicular xfpd0.2End of the bow region xapu0.8Start of the stern region xapd1End of the stern region, at the aft perpendicular nu14Planes between xstartandxfpu(upstream)nf38Planes between xfpuandxfpd(bow region)nm50Planes between xfpdandxapu(midship)na38Planes between xapuandxapd(stern region)nw14Planes between xapdandxend(wake) -
Add an xchap section, add the command control to it and set
maxitto0(grid inspection only). -
Turn off the automatic report generation: add an xpost section, add the command control to it and set
onofftooff(see XPOST). - Save the project (for example as
tut5_part4) and run SHIPFLOW. -
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.
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.
-
Create a new design variant in the current project with Optimize → New Design, for example named
zonal. -
Change xgrid → xdistr: set
xstartto0.5, removenu,nf,xfpuandxfpd(the forebody is no longer in the domain), and reducenmto about half its previous value, for example25. -
Select xgrid → size, add
domainand set it tozonal. -
Add
xboundto xflow → program. -
Save the project and run SHIPFLOW.
-
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.
4.3 Grids for Viscous Free-Surface Computations¶
- Go to Import → Configuration (SHIPFLOW) and import
C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\kcs_xchap_vof. - Go to Import → IGES and import
C:\FLOWTECH\SHIPFLOW<version>-x86_64\examples\geometry\kcs_g2010.igs. - Select all hull surfaces and create a surface group,
grp1, with Model → CAD → Surfaces → Surface Based → Surface Group. - Link the geometry to the configuration as in Part 2: drag
grp1into theigesfield of xflow → offset, complete the expression togrp1.exportIGES("kcs_g2010.igs")and click Evaluate. - Save the project as
tut5_part4_2. -
Note the keyword
vofin 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. -
Set
xchap | control | maxitto0and remove the command parall from xchap. -
Check that
xflow | hull | tranmodeiswtran. It is already set in the example. -
Add
xgridto xflow → program. -
Run SHIPFLOW.
-
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_1andXgrid_transom_1); the figure uses grid slices on three of them.
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:
| 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.
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¶
- Start a new project.
-
Go to Import → Results (SHIPFLOW) and select
kcs_import_IGES_zonal.cgns.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. -
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.
-
Hide the propeller wake cut: click the icon of XCHAP → Propeller → KP505_MOERI_cut.
-
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.
- Positions:
-
Click the pencil next to
contourPlot1and set Mapped Data toVelocityX. -
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. -
Add velocity vectors to the cut: select
XCHAP_CombinedCut, select create new under Visualization and pick FVectorVisualization in the 3D Visualization section. -
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.2Vector Scaling → Length Scale 2Arrow → Type Cone Display Options → Vector Color black -
Click the mirror button to show both sides.
5.2 Velocity Vectors on the Hull Surface¶
- Hide
XCHAP_CombinedCutby clicking the button to the left of it. -
Activate
XCHAP_BodyContoursand check that Mapped Data isPressureCoefficient. If needed, click Reset Color Map to rescale the legend. -
Select XCHAP → Body, select create new under Visualization and pick FVectorVisualization.
-
Set the parameters:
Parameter Value Use Vector Data Not ticked Vector Scaling → Length Scale 20Arrow → Type Arrow Display Options → Vector Color black -
Zoom in on the stern.
Exercise: Tick Constant Length and choose a suitable length scale.
5.3 Streamlines¶
- Hide the velocity vectors on the hull.
-
Select XCHAP → Component Grids → Xgrid_1, select create new under Visualization and pick FStreamlines in the 3D Visualization section. An object
streamlines1is created. -
Add a seed point: in Seed Points / Curves, select create ... in the drop-down list and then Points → 3D Point.
-
In the Object Editor of the new point,
point1, enter X =4.1, Y =1and Z =-6. -
Set the streamline parameters in
streamlines1:Parameter Value Seed Points / Curves → Number of Streamlines per Point / Curve 25Seed Points / Curves → Distribution Radius (Points only) 2Mapped Vector Data → Use Vector Data Not ticked Mapped Vector Data → X, Y, Z VelocityX,VelocityY,VelocityZColor Mapping → Mapped Data velocity magnitude Display Options → Width 0.5
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.
- Start a new project.
- Go to Import → Results (SHIPFLOW) and import
T_5_5\kcs_vof_def.cgns. - The wave pattern is shown in the 3DOverView by default. View it from above.
-
Select Results → kcs_vof_def → XCHAP → Free Surface → XCHAP_FreeContours, set General → Divisions to
25and add a legend with the + next to Color Map. -
Optionally, pick the preset Black isolines on colored surface and move the legend (pencil next to Color Map, then Geometry → X and Y).
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.
-
Select Results → kcs_vof_def → XCHAP → Free Surface, select create new under Visualization and pick FPlaneCut in the Data Extraction section.
-
In the Object Editor of
planeCut1, set Cut → Positions to-0.1. -
Under Visualization of
planeCut1, select create new and pick F2DPlotCurve. -
Click the pencil next to
2DPlotCurve1. Under Visualization of2DPlotCurve1, select create new and pick F2DPlot. -
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. -
To show several cuts, change Positions in
planeCut1to-0.1, -0.2, -0.3.
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¶
- Go to Import → Configuration (SHIPFLOW) and import
T_5_6\source\config_tutorial_5_6. - 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:
-
Add a rudder command to xflow (see RUDDER).
-
Add these parameters to xflow → rudder:
Parameter Value Description s[0, 0.5, 1]Spanwise stations, normalised with the span (0 = root, 1 = tip) span10.5Total span of the rudder, used to normalise sc[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 angle10Rudder angle in degrees idfor example example_rudderName of the rudder; XCHAP requires an ID -
Set
xflow | hull | xmdenstocoarse. -
Set
xgrid | size | xgdenstovcoarse(shown asvcoarsin the drop-down list). -
Evaluate the offset under xflow → offset.
- 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.
- 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.
- 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.
-
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.
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:
- Results are computed but nothing appears in the 3D view — 3DView and 3DOverView
- Only one side of the geometry or grid is visible — mirroring
- "XFLOW WARNING: XZ-SYMMETRY IS ENFORCED FOR STANDARD CASES" —
nosymcases - The zonal approach produces poor or unexpected results
- "Error: Leak or thin interpolation detected" — overlapping appendage grids
- The computation takes much longer than expected
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 | sizeandxgrid | 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¶
- Advanced Tutorial 1: Self-Propulsion Simulation: XCHAP computations with a propeller model
- Advanced Tutorial 3: Appendage Modelling with Overlapping Grids: more appendages and overlapping grids
- Command reference: XGRID, XCHAP and XGR8
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











































































































