.. _boundary_conditions: Boundary Conditions ------------------- Boundary condition properties are defined using consecutively numbered blocks. .. code-block:: python 'BC_1' : {....}, 'BC_2' : {....}, zCFD supports the following boundary condition types: .. list-table:: :widths: 20 80 :header-rows: 1 * - BC Type - Description * - :ref:`Wall ` - Wall boundaries * - :ref:`Farfield ` - Farfield boundaries with automatic inflow/outflow detection * - :ref:`Inflow ` - Pressure or massflow inflow boundaries * - :ref:`Outflow ` - Pressure or massflow outflow boundaries * - :ref:`Symmetry ` - Mirror boundary condition * - :ref:`Overset ` - The boundary of a mesh to be overset on a background mesh * - :ref:`Periodic ` - Repeating boundary condition, with flow from one periodic boundary mapped to the other. "ref" and "zone" ^^^^^^^^^^^^^^^^ Boundary conditions can be mapped to the mesh in two ways, depending on the mesh format used. Some mesh formats (for example Fluent) will have boundaries tagged with an integer (wall = 3, etc). These can be referenced directly using the **"ref"** keyword in your boundary condition definition. Alternatively, the mesh format may contain explicitly numbered zones (which can be determined by inspecting the mesh). In this case, the user can specify the list of zone numbers for each boundary condition using the **"zone"** keyword. For example to apply BC_1 to boundaries tagged with value 3: .. code-block:: python .. 'BC_1' : { 'ref' : 3, .. } .. Or to apply BC_1 to boundaries to zones with IDs 0,1,2 & 3: .. code-block:: python .. 'BC_1' : { 'zone' : [0,1,2,3], .. } .. .. note:: If a **'zone'** entry is provided it will override the IDs specified in **'refs'** .. _wall: Wall ==== Wall boundaries in zCFD can be either slip walls, no-slip walls, or use automatic wall functions. No-slip walls are appropriate when the mesh is able to fully resolve the boundary layer (i.e :math:`(y^{+} \leq 1)`) otherwise automatic wall functions should be used. This behaviour is chosen by setting :code:`'kind'` in the wall specification below. Optionally it is possible to set wall velocity, roughness and temperature. .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'kind' - Yes - - 'slip', 'noslip', 'wallfunction' - Specifies the type of wall boundary condition. Slip - zero viscosity wall boundary. noslip - viscous wall with y+ ~ 1 mesh resolution, wallfunction - viscous wall with automatic handling of mesh resolution between y+~1 to y+ > 100 * - 'type' - No - - 'wall' or 'immersed wall' - Specifies a solid wall boundary which defaults to adiabatic unless a temperature is specified * - 'roughness' - No - - See :ref:`roughness ` - Specifies the surface roughness. If not specified the wall is specified as perfectly smooth. This requires the wall boundary condition kind to be set to **wallfunction**. * - 'v' - No - - See :ref:`velocity ` - Wall velocity specification. * - 'temperature' - No - - See :ref:`temperature ` - Specifies the wall temperature for an isothermal wall. If not specified the wall is treated as adiabatic * - 'immersed normal type' - No - 'STL' - 'STL' or 'immersed boundary vector' - Specifies how the geometry unit normals are specified (from the STL directly or approximated by the vector from the face centre to the nearest surface point) Example Wall BC with roughness and temperature set: .. code-block:: python 'BC_1' : { # Zone type tag 'ref' : 3, 'type' : 'wall', 'kind' : 'slip', 'roughness' : { 'type' : 'height', 'scalar' : 0.001 }, 'temperature' : { # Temperature in Kelvin 'scalar' : 280.0, }, }, .. _bc_roughness: Roughness ^^^^^^^^^ .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'type' - No - - 'height' or 'length' - Specify how roughness is being specified. * - 'scalar' - No - - Positive float - Specify the value of roughness length or height in mesh units * - 'field' - No - - Valid filename - Specify the name of a file that defines a roughness field. This file needs to contain a node array called Roughness that is used to set the value by finding the nearest point to the mesh location. Roughness can be specified as either a 'height' or 'length'. Roughness **length** is defined as the height at which the mean velocity profile of the flow is zero. In other words, at this distant above the surface, the flow is considered to be effectively smooth, and the velocity distribution approaches a logarithmic law. Roughness **height** refers to the average height or magnitude of surface roughness elements on a solid boundary. It represents the scale of irregularities or protrusions on the surface, which disrupt the smooth flow and create additional drag or turbulence. Examples of roughness elements include bumps, ridges, or rough surface textures. This value can be given as a single **scaler** value or a **field** file can be provided. This should be a VTP file containing a node array called "Roughness". The roughness at each boundary face is then set by finding the nearest point to the face centre on the supplied VTK file with the roughness value looked up in a node based scalar array called 'Roughness' .. _bc_velocity: Velocity ^^^^^^^^ The velocity keywords are used to apply a surface velocity, this is used to model cases with surfaces in relative motion. e.g. a car moving over a road surface or rotating tyre surface. The wall boundary condition supports either a **linear** velocity or a **rotating** one The options for the **'linear'** dictionary are: .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'vector' - Yes - - [x, y, z]: vector of numbers - Sets the velocity vector for the translation motion of the surface. * - 'mach' - No - - Number - Overrides the magnitude of the translation velocity vector The options for the **'rotating'** dictionary are: .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'axis' - Yes - - [x, y, z]: vector of numbers - Sets the axis of rotation * - 'origin' - Yes - - [x, y, z]: vector of numbers - Sets the origin of the rotation axis * - 'omega' - Yes - - Number - Sets the rotational velocity of the rotation in radians per second .. _bc_temperature: Temperature ^^^^^^^^^^^ The temperature keywords are used to apply a surface temperature. A scalar temperature can be applied to the whole boundary or a VTP file provided containing a temperature **'field'**. When using a **'field'** The temperature at each boundary face is set by finding the nearest point to the face centre on the supplied VTP file with the temperature value looked up in a node based scalar array called 'Temperature' The options for the **'temperature'** dictionary are: .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'scalar' - Yes - - number - Specify the value of wall temperature in Kelvin * - 'field' - No - - Valid filename - Specify the name of a file that defines a temperature field. This file needs to contain a node array called *Temperature* that is used to set the value by finding the nearest point to the mesh location for an isothermal wall. .. _bc_farfield: Farfield ======== Farfield boundary conditions are typically used for external flow simulations and automatically switch for inflows or outflows. This boundary condition cannot be used with the incompressible solver. The farfield boundary automatically determines whether the flow is locally an inflow or an outflow by solving a Riemann equation. The conditions on the farfield boundary are set by referring to an :code:`'IC_'` block. In addition to this an atmospheric boundary layer profile or a turbulence profile may be set. .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'farfield' - This sets the type of boundary condition to be associated with the zones. * - 'kind' - Yes - 'riemann' - 'riemann', 'pressure', 'supersonic' or 'preconditioned' - This sets the specific model used for the farfield boundary condition: * *riemann* uses riemann invariants to provide a non reflecting inflow with a pressure outflow. * *pressure* uses a pressure boundary condition for both inflow (downstream pressure) and outflow (user specified pressure). * *supersonic* uses a supersonic boundary conditions by using upstream conditions for both inflow and outflow. * *preconditioned* uses a preconditioned variant of the riemann boundary condition. * - 'condition' - Yes - - String reference to IC - Set the reference flow conditions block that relates to these boundaries, see :ref:`IC_* `. Example boundary condition block for a farfield boundary: .. code-block:: python 'BC_2' : { # Zone type tag 'ref' : 9, # Optional: Specific zone boundary condition override 'zone' : [0,1,2,3], # Required: Boundary condition type 'type' : 'farfield', # Required: Kind of farfield options (riemann, pressure or supersonic) 'kind' : 'riemann', # Required: Farfield conditions 'condition' : 'IC_1', # Optional: Atmospheric Boundary Layer }, .. _bc_inflow: Inflow ====== zCFD can specify two kinds of inflow boundary condition: pressure or massflow, selected using the :code:`'kind'` key. When using the pressure inflow the boundary condition is specified by a total pressure ratio and a total temperature ratio that needs to be defined by the condition this refers to. When using the massflow condition a total temperature ratio and mass flow ratio or a mass flow rate is required. Note the mass flow ratio is defined relative to the condition set in the :code:`'reference'` key. By default the flow direction is normal to the boundary but either a single vector or a python function can be used to specify the inflow normal vector of each face on the surface. .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'inflow' - This sets the type of boundary condition to be associated with the zones. * - 'kind' - Yes - 'default' - 'default' or 'massflow' - This sets the how the user wants to specify the inflow boundary condition: * *default*. Pressure inflow. Velocity and density are calculated from the user provided total pressure ratio and total temperature ratio set in the reference **condition**. The direction of the velocity vector uses the surface normal but a specific direction can also be provided by the user. Local static pressure is used to compute a local mach number from the total pressure ratio. If the user specifies a mach number this is used to set the static pressure from the total pressure ratio. * *massflow* The velocity is set from the massflow set in the reference **condition**. * - 'condition' - Yes - - String reference to IC - Set the reference flow conditions block that relates to these boundaries, see :ref:`IC_* `. Example boundary condition for setting up a **pressure** inflow condition based on flow conditions defined in *IC_2*: .. code-block:: python 'BC_3' : { 'ref' : 4, 'type' : 'inflow', 'kind' : 'default', 'condition' : 'IC_2', }, 'IC_1' : { 'temperature' : 293.0, 'pressure' : 101325.0, 'V': { 'vector' : [1.0,0.0,0.0], 'Mach' : 0.20, }, 'Reynolds No' : 1.0e6, 'Reference Length' : 1.0, 'turbulence intensity' : 0.1, 'eddy viscosity ratio' : 1.0, }, 'IC_2' : { 'reference' : 'IC_1', 'total temperature ratio' : 1.0, 'total pressure ratio' : 1.0, # Optional - specify mach number to set # static pressure at inflow from total pressure 'mach' : 0.1, }, Example boundary condition for setting up a **massflow** inflow condition based on flow conditions defined in *IC_2*: .. code-block:: python 'BC_3' : { 'ref' : 4, 'type' : 'inflow', 'kind' : 'massflow', 'condition' : 'IC_2', }, 'IC_1' : { 'temperature' : 293.0, 'pressure' : 101325.0, 'V': { 'vector' : [1.0,0.0,0.0], 'Mach' : 0.20, }, 'Reynolds No' : 1.0e6, 'Reference Length' : 1.0, 'turbulence intensity' : 0.1, 'eddy viscosity ratio' : 1.0, }, 'IC_2' : { 'reference' : 'IC_1', 'total temperature ratio' : 1.0, 'mass flow rate' : 10.0, }, .. _bc_outflow: Outflow ======= Pressure or massflow outflow boundaries are specified in a similar manner to the `Inflow`_ boundary. They can be of :code`'kind'` :code:`'pressure'`, :code:`'radial pressure gradient'` or :code:`'massflow'`. When either pressure boundary is set the :code:`'IC_'` conditions it refers to must set a static temperature ratio, when :code:`'massflow'` is specified a mass flow ratio or mass flow rate must be set. Note the mass flow ratio is defined relative to the condition set in the :code:`'reference'` key. .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'outflow' - This sets the type of boundary condition to be associated with the zones. * - 'kind' - Yes - 'default' - 'default' or 'massflow' - This sets how the user wants to specify the outflow conditions: * *default* Sets the pressure at the outflow using the user specified static pressure ratio set in the reference **condition**. * *massflow* Scales the local velocity so that the total integrated massflow across all the zones meets the user specified value. * - 'condition' - Yes - - String reference to IC - Set the reference flow conditions block that relates to these boundaries, see :ref:`IC_* `. * - 'reference radius' - Yes - - Number - .. code-block:: python 'BC_4' : { # Zone type tag 'ref' : 5, # Optional: Specific zone boundary condition override 'zone' : [0,1,2,3], # Boundary condition type 'type' : 'outflow', # Kind of outflow 'pressure, 'massflow' or 'radial pressure gradient' 'kind' : 'pressure', # Required only when using 'radial pressure gradient' # Radius at which the static pressure ratio is defined 'reference radius' : 1.0, # Outflow conditions 'condition' : 'IC_2', }, .. _bc_symmetry: Symmetry ======== .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'symmetry' - This sets the type of boundary condition to be associated with the zones. Example symmetry boundary condition: .. code-block:: python 'BC_5' : { 'ref' : 7, 'type' : 'symmetry', }, .. _bc_periodic: Periodic ======== This boundary condition needs to be specified in pairs with opposing transformations. The transforms specified should map each zone onto each other. .. note:: Each periodic boundary needs to provide the correct vector to the opposite matching boundary. .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'periodic' - This sets the type of boundary condition to be associated with the zones. * - 'kind' - Yes - - 'rotated' or 'linear' dictionary (see below) - The definition of the periodic transformations, can either be a 'rotated' or 'linear' dictionary The options for the **'linear'** dictionary are: .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'vector' - Yes - - [x, y, z]: vector of numbers - Defines the translation vector to map this zone onto the matching periodic zone Example linear periodic boundary condition: .. code-block:: python 'BC_6' : { 'zone' : [1], 'type' : 'periodic', 'kind' : { # Linear periodic settings 'linear' : { 'vector' : [1.0,0.0,0.0], }, }, }, The options for the **'rotated'** dictionary are: .. list-table:: :widths: 25 10 10 20 30 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'axis' - Yes - - [x, y, z]: vector of numbers - Defines the axis of rotation used to map this boundary onto the matching periodic zone * - 'origin' - Yes - - [x, y, z]: vector of numbers - Defines the origin of the axis of rotation * - 'theta' - Yes - - Number - Defines the angle of rotation about the axis (in radians) Example rotated periodic boundary condition: .. code-block:: python 'BC_6' : { 'zone' : [1], 'type' : 'periodic', 'kind' : { # Rotated periodic settings 'rotated' : { 'theta' : math.radians(120.0), 'axis' : [1.0,0.0,0.0], 'origin' : [-1.0,0.0,0.0], }, }, } .. _bc_overset: Overset ======= The overset boundary condition should be applied to the boundaries of a mesh to be overset on top of a larger background mesh. .. list-table:: :widths: 20 10 10 20 35 :header-rows: 1 * - Keyword - Required - Default - Valid values - Description * - 'ref' - Yes - - Integer - Mesh reference defined by this boundary condition * - 'zone' - No - - List of integers - Specifies list of mesh zones defined by this boundary condition * - 'type' - Yes - - 'overset' - This sets the type of boundary condition to be associated with the zones. Example overset boundary condition: .. code-block:: python 'BC_7' : { 'zone': [1,2,3,4], 'type' : 'overset', },