.. _periodicBoundaryCondition: .. |deg| unicode:: U+000B0 .. DEGREE SIGN .. role:: red TU Berlin TurboLab Stator simulation using periodic boundary conditions ========================================================================================== Description ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The "TurboLab Stator" is a stator enclosed in a measurement rig in the `TU Berlin TurboLab `__. This geometry has been used in the past for `CFD validation and optimization studies `__. .. figure:: Figures/Stator3DView.png :width: 600px :align: center :alt: TU Berlin TurboLab Stator TU Berlin TurboLab Stator This stator has 15 blades and because of its circular symmetry we can take advantage of the periodicity in the circumferential direction by simulating only 1 blade. This drastically reduces the meshing requirements and computing times. To do that we will use :ref:`rotationallyPeriodic boundary conditions `. :code:`rotationallyPeriodic` boundaries need to come in pairs, each is assigned the other as a match and the flow values of one are assigned to the other and vice versa. This ensures periodicity of the flow across those two boundaries. :code:`rotationallyPeriodic` boundaries are perfectly suited anytime the flow is axiperiodic and we can get away with simulating only a subset of the whole circular domain. .. note:: This technique requires that both the flow conditions and geometry be axiperiodic. In this example, even though the geometry is axiperiodic, if the inflow had some alpha or beta value for example then this technique wouldn't work. The same can be said if flow separation or unsteadiness makes the flow no longer axiperiodic. Meshing the geometry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When meshing a set of periodic boundaries it is important that both matched boundaries have the same shape and mesh topology so that the flow information from one boundary can be exactly copied to the other. Because the TurboLab Stator CAD geometry is commonly available, it is easy to mesh but for this tutorial we have provided you with a `ready made mesh `__. Once you have the mesh file, you can upload it either by using the :ref:`Web UI ` or the :ref:`Python API `. .. figure:: Figures/blade_hub_shroud.png :width: 600px :align: center :alt: blade_hub_shroud TU Berlin Stator slice showing the blade, hub and shroud As you can see above, we have the blade, hub and shroud boundaries which are going to be :code:`noSlipWall`. .. figure:: Figures/isometric2.png :width: 600px :align: center :alt: isometric2 Isometric view of the slice we will use as a flow domain .. figure:: Figures/isometric.png :width: 600px :align: center :alt: isometric2 Isometric view of the back of the slice we will use as a flow domain .. figure:: Figures/topView.png :width: 600px :align: center :alt: topView top view of the slice we will use as a flow domain As you can see in the above top view of the flow domain, we have setup a slip wall buffer region (in green) in front of the CAD geometry (in yellow). This is a technique used to allow for better convergence. Since we have a given velocity at the inlet, when that velocity meets the :code:`noSlipWall` at the hub and shroud then there will be a very large local gradient. That buffer region in green is set as a :code:`SlipWall` boundary condition and it gives the code a little room to spread that large gradient and thus converge better. Defining the boundary conditions. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A realistic scenario would be to define a given velocity distribution across the inlet using the :ref:`"velocity" option of the Freestream boundary condition ` but for the sake of this tutorial we will assume that the inflow is constant across the whole inlet. To that end we will simply assign the following Boundary conditions to the various regions: .. literalinclude:: Files/rot_periodic_BC_example.json As you can see we have simply assigned a :code:`Freestream` boundary condition at the inlet. Notice how :code:`fluid/bottomFront` and :code:`fluid/topFront` are set as :code:`SlipWall` boundaries and how we have a small :code:`staticPressureRatio` across the outlet. Notice also how the two :code:`RotationallyPeriodic` boundaries are across from each other in the above images and that we have set them as a :code:`RotationallyPeriodic` pair. The :code:`"axisOfRotation":[1,0,0]` and :code:`"ThetaRadians":0.41888` values are optional. If you know the values then it is a good idea to include them. If they are not included then the software tries to calculate the values based on the geometry of the mesh. Including them guarantees that the correct values will be used. Here we rotate around the X axis and we cover 1/15th of a circle: :math:`\frac{2*pi}{15}=0.41888` radians. Once we have set the boundary conditions setting up the rest of the `Flow360.json `__ file is trivial. Case running ~~~~~~~~~~~~~~~~~~~~~~ After launching the case using the provided `mesh `__ and `Flow360.json `__ files, in a few minutes, you will see the run converge and the forces quickly stabilize .. figure:: Figures/TU_berlin_convergence.png :width: 600px :align: center :alt: convergence of residuals Convergence plot showing more then 3 orders of magnitude decrease in the residuals. .. figure:: Figures/TU_berlin_forces.png :width: 600px :align: center :alt: convergence of forces Force history plot showing good convergence. Congratulations, you can now scale those forces and moments by 15 to get the forces and moments on all 15 blades of the TU Berlin stator. Translational periodic boundary conditions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Another periodic boundary condition that functions like the :code:`rotationallyPeriodic` boundary condition is the :code:`TranslationallyPeriodic` boundary condition. This is useful when the periodicity is not rotational but translational. An example would be a 2D airfoil. By using a :code:`TranslationallyPeriodic` boundary condition you could mesh a small subsection of the span and simulate an infinite span 2D section. This is particularly useful when you want to model 3D flow structures emanating from a 2D geometry. You can see this breakdown from 2D vortices into 3D vortices in our case study on :ref:`Scale-Resolving Simulations Past a Circular Cylinder`; specifically :ref:`this image`