In the following tutorial you will learn how to:

- Create periodic boundary conditions with non-conforming boundary mesh
- Apply pressure jump between periodic boundaries
- Calculate mass flow rate through a boundary

In this tutorial, you will investigate mass flow rates obtained in two configurations of the infinite tesla valve. You will create a two-dimensional model with periodic boundary conditions. In the first part, you will calculate flow in the blocking direction of the valve. The flow will be forced by a prescribed pressure difference between inlet and outlet boundary of the periodic domain segment. In the second part, you will simulate flow in the opposite direction, by changing the sign of pressure difference. Finally, you will compare obtained results and efficiency of the valve.

## Starting New Project

Start your new project by:

- Providing a case name
- Clicking Create Case button to open simFlow

### Loading Geometry

Start preprocessing by downloading this geometry file. Then load the file into simFlow by clicking Import Geometry button.

## Geometry Location

Geometry is three-dimensional volume. In this tutorial, however, you will work on a two-dimensional case. To prepare this kind of mesh you will use the **Plate** base mesh, which should cut through the 3D volume. Therefore you need to adjust the location of geometry so that its center will be located on the XY plane.

- Click on
**Options**button to open geometry context menu (you can also right-click on geometry name) - Select
`Translate`

option

In the **Translate Geometry** panel:

- Specify
**translation vector**`[0, 0, -2.5]`

- Translate the geometry by clicking the Translate button

## Geometry Scale (I)

Our geometry was created in millimeters but the mesh should be in meters. Therefore you need to scale the geometry. To do this once again open geometry options. Then select the `Scale`

option.

## Geometry Scale (II)

In **Scale Geometry** panel:

- Select
**Uniform**option - Set
**scaling factor**to`1e-03`

(conversion from millimeters to meters) - Click Scale button to scale the geometry

## Geometry Scale (III)

After the geometry is scaled you will not be able to see it in the 3D graphics panel. You can adjust the view by clicking Fit View button or by pressing CTRL+F key combination.

## Creating Face Groups (I)

In this fluid flow simulation, you are dealing with an internal flow problem. The imported geometry determines the bounds of the fluid domain. To inform the program where the inlet and outlet mesh boundaries should be created, distinguish two surfaces of the geometry. In simFlow you can do this by means of **Face Groups**. Face Groups can be created directly in the **3D graphics** panel or from the **Face Group** geometry properties panel. In this tutorial, you will utilize the first approach.

- Left-click on the highlighted surface while holding CTRL key. When surface is selected it should be highlighted by switching color to orange
- Click Face Group button in the graphics context toolbar. This will create a new Face Group from the graphics selection. Note that if the operation is successful a new
`Face Group`

will appear in the**Geometry Panel** - Once again Left-click on the highlighted surface. This will deselect it previously selected surface

Next, rotate the 3D graphics view in such a way that you will be able to see the second end of the geometry:

- Select the second surface
- Once again click Face Group button in the 3D graphics context

Now, go to the **Geometry Panel**. There should be three **Face Groups** under the `tesla_valve`

geometry. The first group, named `default`

, consists of all non-selected surfaces. This surfaces will constitute the walls of the valve. The two additional groups represent inlet and outlet of the fluid domain. Rename these groups by double-clicking on an appropriate name.

`group1`

→`left`

`group2`

→`right`

## Geometry Meshing Properties

Now you will set up meshing properties:

- Go to the
**Hex Meshing**panel - Enable
`tesla_valve`

to be used as a cutting tool - Enable boundary layer creation on the
`tesla_valve`

surfaces - Change
**number of layers**to 2 – in this case, we use boundary layer just to make the near wall cells aligned with the walls, there will be no need for lowering cells size due to y^{+}requirement - Set first cell size to 0.5 (by default first cell size value is the relative size, in this case, program will generate boundary layer with height equal to half of the original near wall cell size)
- Select all
**Face Groups**for boundary layer - Change tab to
**Base**

## Base Mesh Geometry

In this tutorial, you will generate a mesh for a 2D fluid flow problem. The **Plate **base mesh is best suited for this purpose. This **base mesh type** will automatically take care of preparing appropriate boundaries and cell divisions in the `Z`

direction.

- Change
**Base Mesh Type**from Box to Plate - Click Autosize button, which will compute plate size based on the visible geometries bounds

## Base Mesh Cell Size

While still in the **Base** tab, define base mesh division in each direction.

- Set 400 number of cells in the
**X**direction - Set 80 number of cells in the
**Y**direction

## Material Point

Now you need to decide where the mesh should be created – inside or outside of the geometry. For this purpose, you have to specify the **Material Point** location.

- Go to
**Point**tab - Set
**Material Point**coordinates to`[0.03, 0, 0]`

## Creating Mesh

Now everything is set up to create the mesh. To start meshing process:

- Go to
**Mesh**tab - Click Mesh button to run the mesher application

When meshing process will finish you should obtain the following mesh.

## Boundary Coupling

In this tutorial, you are simulating a valve consisting of an infinite number of segments, where the created mesh represents only one segment. In this situation, fluid flow can be driven only by body forces or pressure difference between inlet and outlet (the same across all segments). You can assume, that velocity field in each segment is the same along whole valve. Therefore outlet from one segment should be an inlet to a next one, and velocity profile from one boundary should be mapped onto the next one. This kind of constraint is usually called *periodic boundary condition* or *periodic coupling*. We can distinguish two main types of periodic coupling:

**cyclic**– all faces on one boundary match exactly the faces on the second boundary**cyclic AMI**– couples pair of boundaries, where communication between boundaries is performed using arbitrary mesh interface (AMI) interpolation. Boundaries have to be conforming only in the sense of shape.

During the meshing process, you have not enforced conformity of meshes on the `left`

and `right`

boundary. Therefore, you cannot assume that faces on the `left`

boundary are exactly matching the faces on the `right`

boundary. Therefore, in this case, you are limited to using the cyclic AMI boundary coupling.

In the **Boundaries** list:

- Make sure that the
`wall`

constraint is assigned to the`tesla_valve`

boundary - Hold Ctrl key and select both
`tesla_valve_left`

and`tesla_valve_right`

boundaries - Click the Cyclic AMI button to create AMI coupling between the left and the right side of the valve segment

## AMI Properties

Before you proceed to solver selection, you need to specify the type of coupling:

- Click on coupled boundary to display properties
- Select
`Translational`

**transform** - Set
**Separation Vector**to`[0.15, 0, 0]`

– the vector between left and right boundary

## Solver Selection

With computational domain prepared, you can choose the kind of physics you want to simulate by selecting appropriate solver:

- Select
`steady state`

type - Select
`incompressible`

flow filter - Select
`simpleFoam`

solver - Confirm by clicking Select button

## Turbulence Model

First go to **Turbulence** panel and:

- Change
**Turbulence Modeling**to`Reynolds-averaged Navier–Stokes (RANS)`

- From the list of available
**model**s select`k-ω SST`

## Fluid Properites (I)

Now define the fluid properties:

- Go to
**Transport Properties**panel - Open Material Database

## Fluid Properites (II)

In the **Material Selection** window:

- Find material
`water`

–`liquid`

- Confirm selection by clicking Apply

Selecting material from the **Material Database** will fill all inputs in the **Transport Properties** panel. At any time you will still be able to overwrite these values

## SIMPLE Algorithm

Now you will specify solver properties, which will increase the stability of the computational process:

- Go to
**Solution**panel - Change tab to
**SIMPLE** - Increase the
**Non-Orthogonal Correctors**– this option usually improves stability and convergence but at an additional computational cost due to solving pressure equation multiple time. This option should always be used when you have a mesh of low quality.

## Residual Levels

Decrease residual levels:

- Change tab to
**Residuals** - Change the residual level for
**p**ressure to`1e-5`

You do not need to decrease residual level for other variables because pressure equation is usually the one limiting accuracy.

## Velocity Limiter

- Go to
**Limits**tab - Switch
**Velocity Daming**on

Velocity Dumping will prevent solver from diverging even if unphysical velocity appears in the flow.

## Pressure Jump

You are simulating one segment of a periodic geometry, where values at the inlet and outlet of the domain are bounded by the cyclic constraint. In this case, you can not force fluid flow by using regular boundary conditions, but you can use pressure jump instead. This boundary condition will force constant pressure difference between coupled boundaries.

- Go to the
**Boundary Conditions**panel - Select
`tesla_valve_left`

boundary - Change boundary condition type for pressure to
`Fixed Jump AMI`

- Set the
**Jump**value to -100

If after changing boundary condition type to **Fixed Jump AMI** you are not able to see the **Jump** input field then move to the `tesla_valve_right`

boundary, where this input will appear. There you will have to apply the pressure difference with a negative sign. The **Jump** value input appears only on “master” boundary, which is the first boundary in the coupling.

## Running Simluation

Finally you can start your computation. Go to the **Run** panel and:

- Set maximum number of iteration to 10 000
- Click Run button to start the calculation

## Convection Scheme

After calculation is finished you have to increase accuracy by increasing the order of convection scheme

- Go to the
**Discretization**panel - Switch tab to
**Convection** - Click the button next to the velocity name
- Change Scheme to
`LUST`

**LUST**– Linear Upwind Stabilized Transport – scheme blends linear and linear-upwind scheme.

- Continue the calculation with changed convection scheme.

## Check Wall Distance

After the computation is finished, check the `y`

value to verify that proper turbulence modeling was used. Go to the ^{+}**Calculate** panel:

- Change tab to
**Wall** - Click the Calculate button

The result will be displayed in the console panel.

You can see that average value of `y`

is equal to 23.5. You have left default setup for turbulence fields at wall boundaries – Low Re wall functions. This model calculates near wall velocity profile basing on the “log law”. The “log law” regime is valid for ^{+}`y`

values in the range between 30 and 300. In this case, the average value is slightly smaller than recommended one, but the results should still not differ that much from the situation with a proper mesh size. We will not change the mesh at this point and we will accept this results because in the next calculations we will perform analysis with higher velocity using the same mesh.^{+}

## Compute Mass Flow Rate

Now you will calculate what is the mass flow rate in the first direction – the flow blocking direction. To calculate mass flow rate:

- Change tab to
**Boundary** - Select
`tesla_valve_left`

**boundary**– when mass is conserved it does not matter whether you select inlet or outlet boundary - Choose the φ variable
- Click the Calculate button

Results will be displayed in the console:

The φ variable is the flux through mesh faces. In the case of incompressible solvers, the flux is volumetric instead of mass flux. To obtain mass flow rate you have to multiply results by density.

## Open Parview

Before you perform the next calculation, open Paraview to investigate the flow fields in the domain. Move to **Postprocessing** panel and click the Parview button.

## Load Data

In the ParaView window click the Apply button to load data.

## Adjust Color Scale

- Select the last data set.
- Adjust colors scale range to pressure value in the domain.

After this operation the following image should be displayed in the 3D window.

## View Velocity Magnitude

- Change coloring variable to velocity magnitude
- Make sure that color scale is adjusted

In the 3D window, you should see the following image.

After validating results, *do not close Paraview*, but switch back to simFlow window.

## Reset Result

Go back to the **Run** panel and click the Reset Calculation button. This will remove current results and allow to change setting for the second simulation.

## Upwind Scheme

Go to the **Discretization** panel. You need to change the higher order `LUST`

scheme back to `Upwind`

. This scheme will be again used for initial calculation since it is less accurate but more stable.

## Invers Pressure Gradient

In the second calculation, you will investigate the valve while flow is in the opposite direction. Go to **Boundary Conditions** panel:

- Select the
`tesla_valve_left`

boundary - Set the
**Jump**value to 100

## Start New Calculation

Go to **Run** panel and start the calculation again.

## Increase Convection Scheme Order

Again, after solution with the `Upwind`

scheme is converged, go to the **Discretization** panel and change scheme back to `LUST`

.

## Continue Calculation

Continue calculation with the higher order scheme.

## Check Wall Distance

When the computation is finished, go to **Calculate** panel and once again check the `y`

value.^{+}

As you can see in this case average value of `y`

matches recommended range.^{+}

## Compute Mass Flow Rate

Finally, change tab to **Boundary** and calculate the mass flow rate on the `tesla_valve_left`

boundary.

This time the value is negative because fluid flows in the opposite direction. Here you ara interested only in absolute values. Check the ratio between the two simulations:

\frac{\dot{m}_{forward} }{ \dot{m}_{backward} } = \frac{1.17e^{-4}}{1.57e^{-5}} = 7.45

As you can see the 7.45 times more fluid going through the valve when you will apply the pressure difference in the forward direction. Note that this simulation is in 2D, which means that the valve is infinitely wide.

## Reload Data in ParaView

At the end check how the flow fields changed in the second case. Switch window to **Paraview** and click the Refresh button. This will load the new data into the program.

## Adjust Color Ranges

Since the second calculation took more iteration you once again have to:

- Select the last data set
- Adjust color scale for new data

Velocity field will be displayed in the 3D window.

## View Pressure Field

Change displayed variable from velocity to pressure.

*This concludes the tutorial.*