Geom.IBM: specific geometry modifications for IBMs

Specific geometry modification functions for immersed boundaries.

These functions require a geometry tree “tb” or a connectivity tree “tc”.

Notes on IBCTypes

Table outlining the various IBCs currently supported. Please note that the “Name” are case sensitive (e.g. Slip is not supported)

IBC Type

Name

Integer Identifier

Wall slip

slip

0

Wall no slip

noslip

1

Wall model: Logarithmic

Log

2

Wall model: Musker

Musker

3

Outflow pressure

outpress

4

Injection

inj

5

Wall model: Thin Boundary Layer Equations (TBLE)

TBLE

6

Wall no slip with rotation (limited capabilities)

MuskerMob

7

Wall model: Pohlhausen

Pohlhausen

8

Wall model: Thwaites

Thwaites

9

Wall model: Mafzal

Mafzal

10

Wall model: Full TBLE

TBLE_FULL

11

Wall no slip with curvature radius

slip_cr

100

Note: Wall no slip with rotation with an integer identifier of 7 assumes the x-axis (i.e. x=0) is the axis of rotation. A more complete IBM with rotation is in the process of being developed and will be shortly be available making the current IBC decrepit.

List of functions

– Setting Snear & Dfar

Geom.IBM.setSnear

Set the value of snear in a geometry tree.

Geom.IBM.setDfar

Set the value of dfar in a geometry tree.

Geom.IBM.snearFactor

Multiply the value of snear in a geometry tree by a sfactor.

– Setting IBC Type

Geom.IBM.setIBCType

Set the IBC type in a geometry tree.

Geom.IBM.changeIBCType

Change the IBC type in a connectivity tree from oldIBCType to newIBCType.

Geom.IBM.initOutflow

Set the value of static pressure PStatic for the outflow pressure IBC with family name familyName.

Geom.IBM.initInj

Set the total pressure PTot, total enthalpy HTot, and direction of the flow injDir for the injection IBC with family name familyName.

Geom.IBM.setFluidInside

Set fluid inside a geometry tree.

Contents

Note that all the functions have an in-place version, modifying directly the data without copy. The function names must be prefixed by an ‘_’ (e.g. _setSnear for the in-place version of setSnear)

Setting Snear & Dfar

Geom.IBM.setSnear(tb, snear)

Set the snear for a geometry defined by tb. Exists also as in-place (_setSnear). Snear is the local Cartesian spacing close to cells intersected by the immersed boundary.

Parameters:
  • tb ([zone, list of zones, tree]) – geometry tree

  • snear (float) – snear value

Returns:

same as input

Example of use:

# - setSnear (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D

a = D.circle((0,0,0), 1. , 0., 360.)
D_IBM._setSnear(a,0.01)
C.convertPyTree2File(a, 'out.cgns')

Geom.IBM.setDfar(tb, dfar)

Set the dfar for a geometry defined by tb. Exists also as in-place (_setDfar). Dfar is the distance from the center of the bounding box of the immersed boundary to the edge of the domain.

Parameters:
  • tb ([zone, list of zones, tree]) – geometry tree

  • dfar (float) – dfar value

Returns:

same as input

Example of use:

# - setDfar (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D

a = D.circle((0,0,0), 1. , 0., 360.)
a = D_IBM.setDfar(a, 10)

C.convertPyTree2File(a, 'out.cgns')


Geom.IBM.snearFactor(tb, sfactor)

Multiply the snears in the geometry defined by tb by a factor. Exists also as in-place (_snearFactor).

Parameters:
  • tb ([zone, list of zones, tree]) – geometry tree

  • sfactor (float) – multiplying factor

Returns:

same as input

Example of use:

# - snearFactor (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D

a = D.circle((0,0,0), 1. , 0., 360.)
D_IBM._setSnear(a, 0.01)
D_IBM._snearFactor(a, 2)
C.convertPyTree2File(a, 'out.cgns')

Setting IBC Type

Geom.IBM.setIBCType(tb, ibctype)

Set the type of IBC for the geometry defined by tb. Exists also as in-place (_setIBCType). See the table in “Notes on IBCTypes” for the IBCs currently supported.

Parameters:
  • tb ([zone, list of zones, tree]) – geometry tree

  • ibctype (string) – name of the type of IBC

Returns:

same as input

Example of use:

# - setIBCType (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D

a = D.circle((0,0,0), 1. , 0., 360.)
D_IBM._setIBCType(a, "Musker")
C.convertPyTree2File(a, 'out.cgns')

Geom.IBM.changeIBCType(tc, oldBCType, newBCType)

Change the IBC type in a connectivity tree. Exists also as in-place (_changeIBCType). Please refer to the table in “Notes on IBCTypes” for details on the integer identifies for the various IBC types.

Parameters:
  • tc ([zone, list of zones, tree]) – connectivity tree

  • oldBCType (integer) – type of ibc

  • newBCType (integer) – type of ibc

Returns:

same as input

Example of use:

# - changeIBCType (pyTree) -
import Converter.Internal as Internal
import Converter.PyTree as C
import Generator.PyTree as G
import Geom.IBM as D_IBM
import numpy 

a = G.cart((0.,0.,0.), (0.1,0.1,0.2), (10,11,12))
a = C.node2Center(a)
for z in Internal.getZones(a):
    Internal._createChild(z, 'IBCD_2_'+z[0] , 'ZoneSubRegion_t', value=z[0])

Nlength = numpy.zeros((10),numpy.float64)
for z in Internal.getZones(a):
    subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t')
    for zsr in subRegions:
        Internal._createChild(zsr, 'ZoneRole', 'DataArray_t', value='Donor')
        Internal._createChild(zsr, 'GridLocation', 'GridLocation_t', value='CellCenter')
        zsr[2].append(['Pressure', Nlength, [], 'DataArray_t'])
        zsr[2].append(['Density', Nlength, [], 'DataArray_t'])
        zsr[2].append(['VelocityX', Nlength, [], 'DataArray_t'])
        zsr[2].append(['VelocityY', Nlength, [], 'DataArray_t'])
        zsr[2].append(['VelocityZ', Nlength, [], 'DataArray_t'])
a = D_IBM.changeIBCType(a,2,3)

C.convertPyTree2File(a, 'out.cgns')

Geom.IBM.setFluidInside(tb)

Define the fluid inside a surface defined by tb. In that case, the IBM mesh will be defined inside tb. Exists also as in-place (_setFluidInside).

Parameters:

tb ([zone, list of zones, tree]) – geometry tree

Returns:

same as input

Example of use:

# - setFluidInside (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D
# Geometry
a = D.circle((0,0,0), 1. , 0., 360.)

D_IBM._setFluidInside(a)
C.convertPyTree2File(a, 'out.cgns')

Geom.IBM.symetrizePb(tb)

Add a symmetry plane and symmetrize the body base; input surface must be y>=0 if the symmetry plane is at y=0. Creates the geometry for the symmetry plane, the snear and slip IBC type. :param tb: geometry tree :type tb: [zone, list of zones, tree] :param bodyNameSym: name of the base where :type bodyNameSym: string :param snear_sym: mesh resolution at the symmetry plane :type snear_sym: float :param dir_sym: direction of the symmetry plane :type dir_sym: integer (1:x,2:y,3:z) :return: same as input

Example of use:

# - symetrizePb (pyTree) -
import Converter.PyTree as C
import Geom.IBM as D_IBM
import Geom.PyTree as D
# Geometry
a = D.cone((0,0,0), 1. , 0., 1.)
D_IBM._setDfar(a, 10.)
D_IBM._setSnear(a,0.01)
tb = C.newPyTree(["BODY",a])
D_IBM._symetrizePb(tb,"BODY", 0.1, dir_sym=3)
C.convertPyTree2File(tb, 'out.cgns')

Geom.IBM.initOutflow(tc, familyName, Pstatic, InterpolPlane=None, PressureVar=0, isDensityConstant=False)

Set the value of the static pressure Pstatic for the outflow pressure IBC with family name familyName. A plane InterpolPlane may also be provided with only static pressure variable or various variables with static pressure as the PressureVar (e.g. 2nd) variable). Exists also as in-place (_initOutflow).

Parameters:
  • tc ([zone, list of zones, tree]) – connectivity tree

  • familyName (string) – familyName

  • Pstatic (float) – static pressure

  • PInterpolPlane ([zone, list of zones, tree]) – interpolation plane

  • PressureVar (integer) – variable number of static pressure

  • isDensityConstant (boolean) – is density at the outflow constant and equal to the reference density

Returns:

same as input

Example of use:

# - initOutflow (pyTree) -
import Converter.Internal as Internal
import Converter.PyTree as C
import Generator.PyTree as G
import Geom.IBM as D_IBM
import Geom.PyTree as D
import numpy

a = G.cart((0.,0.,0.), (0.1,0.1,0.2), (10,11,12))
a = C.node2Center(a)
for z in Internal.getZones(a):
    Internal._createChild(z, 'IBCD_4_'+z[0] , 'ZoneSubRegion_t', value=z[0])


Nlength = numpy.zeros((10),numpy.float64)
for z in Internal.getZones(a):
    subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t')
    for zsr in subRegions:
        Internal._createChild(zsr, 'ZoneRole', 'DataArray_t', value='Donor')
        Internal._createChild(zsr, 'GridLocation', 'GridLocation_t', value='CellCenter')
        zsr[2].append(['Pressure', Nlength, [], 'DataArray_t'])
        Internal._createChild(zsr, 'FamilyName', 'FamilyName_t', value='CART_LOCAL')

a=D_IBM.initOutflow(a,'CART_LOCAL',101325)

C.convertPyTree2File(a, 'out.cgns')

Geom.IBM.initInj(tc, familyName, Ptot, Htot, injDir=[1., 0., 0.], InterpolPlane=None, PressureVar=0, EnthalpyVar=0)

Set the total pressure Ptot, total enthalpy Htot, and direction of the flow injDir (w.r.t the absolute frame of reference) for the injection IBC with family name familyName. A plane InterpolPlane may also be provided with at least the total pressure and total enthalpy variables with the former and latter as the PressureVar (e.g. 2nd) and EnthalpyVar (e.g. 4th) variables, respectively. Exists also as in-place (_initInj).

Parameters:
  • tc ([zone, list of zones, tree]) – connectivity tree

  • familyName (string) – familyName

  • Ptot (float) – total pressure

  • Htot (float) – total enthalpy

  • injDir (float list) – direction of the injection w.r.t to the reference coordinate axis

  • PInterpolPlane ([zone, list of zones, tree]) – interpolation plane

  • PressureVar (integer) – variable number of total pressure

  • EnthalpyVar (integer) – variable number of total enthalpy

Returns:

same as input

Example of use:

# - initInj (pyTree) -
import Converter.Internal as Internal
import Converter.PyTree as C
import Generator.PyTree as G
import Geom.IBM as D_IBM
import numpy

a = G.cart((0.,0.,0.), (0.1,0.1,0.2), (10,11,12))
a = C.node2Center(a)
for z in Internal.getZones(a):
    Internal._createChild(z, 'IBCD_5_'+z[0] , 'ZoneSubRegion_t', value=z[0])

Nlength = numpy.zeros((10),numpy.float64)
for z in Internal.getZones(a):
    subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t')
    for zsr in subRegions:
        Internal._createChild(zsr, 'ZoneRole', 'DataArray_t', value='Donor')
        Internal._createChild(zsr, 'GridLocation', 'GridLocation_t', value='CellCenter')

        zsr[2].append(['StagnationEnthalpy', Nlength, [], 'DataArray_t'])
        zsr[2].append(['StagnationPressure', Nlength, [], 'DataArray_t'])
        zsr[2].append(['dirx', Nlength, [], 'DataArray_t'])
        zsr[2].append(['diry', Nlength, [], 'DataArray_t'])
        zsr[2].append(['dirz', Nlength, [], 'DataArray_t'])
        
        Internal._createChild(zsr, 'FamilyName', 'FamilyName_t', value='CART_LOCAL')

a = D_IBM.initInj(a,'CART_LOCAL',10,20,injDir=[0.5,0.5,0.])

C.convertPyTree2File(a, 'out.cgns')

Index