↑top

Tutorial - Calculation of flow in a sloping channel

In this tutorial, we will calculate flow in a sloping channel with multiphase function.

Analysis summary

We will calculate the water flows through an air-filled, 40 meter long, 11 meter high sloping channel for 20 seconds.

Flow in a sloping channel

Creating an analysis configuration file

Creating a project

Open XSim. Type "SlopingChannel" as Project Name and click Create button to create project.

A dialog for project creating
A dialog for project creating

Importing shapes

We will use a prepared shape file in this tutorial. Please download a zipped file from next link, "tutorial-SlopingChannel.zip", and extract it.

Drag&Drop the extracted file "bottom.stl", "inlet.stl", "outlet.stl", "pillar.stl", "sides.stl" and "top.stl" at "Drop files" tab and load it.

Importing shapes from a file
Importing shapes from a file

Click Next button to go to Mesh page.

Mesh

Set 500000 as target number of base meshes. You can preview the base mesh by clicking preview button'preview' icon. And set (8.5, -2, 8) as computational domain to specify the spatial domain for calculation.

Base mesh settings
Base mesh settings

To increase the accuracy of the inflow and outflow, we refine the meshes around the inlet and outlet. Set the Range type to "Surface (Region)", the Region to "Selected regions" and the Refinement level to 2. Select "inlet" and "outlet" in Navigation view on the left side of the window and click Add.

Refinement settings
Refinement settings

Confirm that 0.3 is set to layer thickness ratio and 3 is set to number of layers. Click "bottom", "pillar", "sides" and "top" in Navigation view to select, then click Set.

Layer mesh settings
Layer mesh settings

The mesh settings is over. Click Next button to go to Basic Settings page.

Basic Settings

We will set analysis tyoe settings. Select "Transient" and enter "20 sec" as End time. Enter "0.1 sec" as Initial time interval. Then select "Multiphase".

Basic Settings
Basic Settings

Click Next button to go to Physical Property page.

Physical Property

At first, we will set basic physical property.

We want to calculate water flow in the channel filled with air. So we will set air as basic physical property. Push library buttonlibrary icon at "Basic physical property settings" and select "Air" from the library as basic physical property.

Basic physical property settings
Basic physical property settings

Then we will set "Water" as additional physical properties. Push library buttonlibrary icon at "Additional physical property settings" and select "Water" from the library. Then push Set to register the water as additional physical property.

Additional physical property settings
Additional physical property settings

We need to set a surface tension values between each fluid, but for this tutorial we will simplify all of them to "0.07 N/m".

Click Next button to go to Initial Condition page.

Initial Condition

No configuration is required because we will use default parameters. Click Next button to go to Flow Boundary Condition page.

Flow Boundary Condition

  • Inflow boundary

    Select "Selected regions" as the Region, "Fixed volume flow rate" as the Type, "5 m3/s" as the Volume flow rate, and "Water" as the Inflow fluid, then select "inlet" in the Navigation view and click Set.

    Inflow boundary condition
    Inflow boundary condition
  • Outflow boundary

    Select "Selected regions" as the Region, "Fixed static pressure" as the type, "101325 Pa" as the Static pressure, and "Air" as the Inflow fluid, then select "outlet" in the Navigation view and click Set.

    Outflow boundary condition
    Outflow boundary condition
  • Stationary wall boundary

    Select "Selected regions" as Region and "Stationary wall" as Type. Then select "bottom", "pillar", "sides", "top" in navigation view and push Set.

    Stationary wall condition
    Stationary wall condition

Click Next button to go to Calculation Settings page.

Calculation Settings

In this section, we set parallel number of CPU core that we use in this calculation (for example, 6).

Calculation settings
Calculation settings

Click Next button to go to Output page.

Output

Because this analysis is a transient analysis, select "Each specified time" as Type and enter 1 sec to interval.

We also set the output to show the forces acting on the pillar (region "pillar"). In the "Region" tab, select "Selected regions" as the Region, "integral" as the Type, and "Pressure" as the Physical quantity. Select "pillar" in the Navigation view and press Set.

Output settings
Output settings

Click Next button to go to Export page.

Export

Finally we finished all settings. Click Export button to export the analysis setting as zipped OpenFOAM case directory "SlopingChannel.zip". The zip file download starts immediately.

Export
Export

Running a calculation

Extract downloaded file "SlopingChannel.zip". There is a bash-script "Allrun " in the case directory. So run the script to make mesh and start the OpenFOAM solver by following command.

./Allrun

If the machine that calculation is running has desktop environment and gunuplot was installed, residual convergence chart will be displayed.

Chart for monitoring
Chart for monitoring

Running in 6 parallel (Inter(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19GHz), it takes 1 minute to create a mesh and about 40 minutes to analyze.

Calculation result

After the calculation, execute a following command to visualize the mesh and the calculation result.

paraFoam

Mesh is as follows.

Meshes
Meshes

If we use the Threshold filter of ParaView to visualize the volume ratio (alpha.Water) with a lower limit of 0.1, we can see the following.

The result of multiphase analysis

Next, we check the integral values of the pressure at the surface of the pillar. The values are stored under the patchIntegrate(patch=pillar,p_rgh) folder in the postProcessing folder as the file "surfaceFieldValue.dat", which contains the values for each time period as shown below. Note that the reference pressure used in the calculation is 101325 Pa.

# Region type : patch pillar
# Faces  :    182
# Area   :    1.078870e+01
# Time        	areaIntegrate(p_rgh)
0             	1.093165e+06
0.00406504    	1.135852e+06
0.00859202    	1.093317e+06
0.0136245     	1.093210e+06

…………

19.9944       	1.129061e+06
19.9972       	1.128886e+06
20            	1.128877e+06

If we graph this time-series data using Excel or other appropriate software, we can see the following. You can see that the values increase significantly from around 2.3 seconds after the water flow reaches the pillar, and you can also see the maximum and minimum values.

Integration values of pressure at the pillar
Integral values of pressure at the pillar