↑top

Tutorial - Calculation of inflow/outflow in a tank with a filter

Updated: August 22, 2022

Using porous region feature, We will calculate inflow/outflow and pressure drop in a with a filter.

Analysis summary

We will calculate steady-state water flow in the tanks with a porous filter. The water flows in at 0.1 m/s from the inlet and flows out from the outlet. We will also calculate the pressure drop (differential pressure between inlet and outlet).

Model geometry
Model geometry
Calculation result (flow velocity)
Calculation result (flow velocity)

Creating an analysis configuration file

Creating a project

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

Dialog for project creating
Dialog for project creating

Importing shapes

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

Drag&Drop the extracted file "Filter.stl", "Tank.stl", "Inlet.stl" and "Outlet.stl" at "Drop files" tab and load it. The loaded shape will be shown in 3D view. You can switch the 3D display to semitransparent by clicking a display-mode button'toggle display' iconunder 3D view.

Importing shapes
Importing shapes

Click Next button to go to Mesh page.

Mesh

Set 640000 as target number of base meshes. You can preview the base mesh by clicking preview button'preview' icon.

Target number of base meshes setting
Target number of base meshes setting

And we set the number of layers to "3" for the "Tank" region in the layer mesh setting.

Layer mesh settings
Layer mesh settings

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

Basic Settings

We set the analysis type. Select "Steady" and set the end cycle to "400". Also select "Porous regions".

Basic Settings
Basic Settings

Click Next button to go to Physical Property page.

Physical Property

No configuration is required because we will use default physical property. Confirm that "Water" is set as the physical property value. Then 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

  • Inlet

    Select "Selected regions" as region and "Fixed flow velocity" as type. Then set (0.1, 0, 0) m/s as flow velocity and select "Inlet" on Navigation view. After that, click Set.

    Fixed flow velocity (inlet)
    Fixed flow velocity (inlet)
  • Outlet

    In this calculation, the pressure at "Outlet" will be be used as reference point for pressure. Select "Selected regions" as region and "Fixed static pressure" as type. Then set 0 Pa as static pressure and select "Outlet" on Navigation view. After that, click Set.

    Fixed static pressure (outlet)
    Fixed static pressure (outlet)
  • The tank wall

    Select "Selected regions" as region and "Stationary wall" as type. Then select "Tank" on Navigation view and click Set.

    Stationary wall (the tank wall)
    Stationary wall (the tank wall)

After setting the boundary conditions, the 3D view will be as follows.

3D view
3D view

Click Next button to go to Porous Regions page.

Porous Regions

In this tutorial, We use Darcy-Forchheimer law as the porous model.

Select "Darcy-Forchheimer law" as porous type and "Arbitrary shape (Assembly)" as region type. Then set (5e7, 5e7, 5e7) for d as porous parameter and "Filter" as assembly and press Set.

Porous Regions settings
Porous Regions settings

*If you enter "5e7", the value is converted to "50000000 (= 5 x 107)".

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, 10).

計算設定
Calculation Settings

Click Next button to go to Output page.

Output

Because this analysis is a steady analysis, select "Each specified cycles" as type and set 50 cycles to interval.

Output settings
Output settings

To output inlet pressure with reference to the outlet, select "Region" tab. Select "Selected regions" as region, "Average" as type and "Pressure" as physical quantity. Then select "Inlet" on Navigation view and click Set.

Output for average pressure at inlet
Output for average pressure at inlet

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 "TankWithFilter.zip". The zip file download starts immediately.

Export
Export

Running a calculation

Extract downloaded file "TankWithFilter.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 10 parallel (Inter(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19GHz), it takes a minute to create a mesh and about 6 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.

Mesh
Mesh

The flow velocity, velocity vector and pressure distribution are also shown below.

Flow velocity and velocity vector
Flow velocity and velocity vector
Pressure distribution
Pressure distribution

Next, check the calculated pressure at the inlet. The average pressure at the inlet is stored in the folder postProcessing/patchAverage(patch=Inlet,p). The output results are as follows.

# Region type : patch Inlet
# Faces  :    299
# Area   :    1.954882e-03
# Time        	areaAverage(p)
0             	0.000000e+00
1             	4.931639e-01
2             	5.779418e-01
3             	2.377576e-01
…………
398           	2.414822e-02
399           	2.414903e-02
400           	2.414786e-02

The first column is the cycles and the second column is the average pressure; The units of pressure are m2/s2, because the fluid is incompressible.