waLBerla core Module

Slices

Certain waLBerla functions require Python slices. These slices can be created using the waLBerla.makeSlice object with the usual Python list slicing syntax:

Example:

import waLBerla
waLBerla.field.gather(b, "SomeField" , waLBerla.makeSlice[:,0.5,:] )

Block Structure

class CellInterval

Export of walberla::cell::CellInterval. Describes a range of cells delimited by a min and a max cell. Caution: The max cell is included!

static fromSlice(slice)

Creates a CellInterval from a given Python slice e.g. CellInterval.fromSlice( makeSlice[0:2,0:1,0:4] )

__init__(xMin, yMin, zMin, xMax, yMax, zMax)

Constructs a cell interval using 6 integers corresponding to begin and end of the CellInterval in each dimension. The maximum is included in the interval.

min

Minimum cell.

max

Maximum cell.

size

Size in x,y,z direction.

numCells

Number of cells in the interval.

empty()

True if CellInterval does not contain any cells.

positiveIndicesOnly()

True if min and max cell are all non-negative.

contains(cell)

Tests if a cell is contained in the CellInterval.

contains(cellInterval)

Tests if another CellInterval is fully contained inside the CellInterval

overlaps(cellInterval)

True if the CellIntervals have at least one common cell.

shift(xShift, yShift, zShift)

Adds an offset to min and max cell, thus effectively shifting/moving the CellInterval.

getShifted(xShift, yShift, zShift)

Returns a new CellInterval which is shifted by the given offsets

expand(nrOfCells)

Subtracts nrOfCells from min, and adds nrOfCells to max. The size in on dimension effectively increases by 2*nrOfCells.

getExpanded(x, y, z)

Creates new CellInterval which is expanded by the given number of cells in each direction.

getExpanded(val)

Shorthand for getExpanded( val, val, val )

intersect(cellInterval)

Intersects the two CellIntervals and stores result in self.

getIntersection(cellInterval)

Returns the intersection interval between the current and the passed CellInterval.

class AABB

Export of walberla::math::GenericAABB. Axis aligned bounding box using floating point coordinates.

__init__(min, max)

Creates bounding box using a minimum and maximum point, given as tuples.

__init__(xMin, yMin, zMin, xMax, yMax, zMax)

Creates bounding box using the given minimum and maximum values for each coordinate.

min

Minimum cell.

max

Maximum cell.

size

Size in x,y,z direction.

empty()

True if enclosed volume is zero.

volume()

Volume of the enclosed 3D cube.

center()

Returns centroid of the enclosed cube.

contains(value)
Parameters:

value – either another AABB or a point

containsClosedInterval(point, dx=0)
Parameters:
  • point – The point to be tested for containment

  • dx – An epsilon the box is extended by in each direction before the test

getExtended(x)
Parameters:

x – either a scalar or 3-tuple with scaling factors for each dimension

For the following methods see documentation of walberla::math::GenericAABB.

extend(scalarOrVector)
translate(vector)
getTranslated(translationVector)
scale(scalarOrVector)
getScaled(value)
merge(pointOrAABB)
getMerged(pointOrAABB)
intersect(aabb)
intersects(aabb, dx=0)
intersectsClosedInterval(aabb, dx=0)
intersectionVolume(aabb)
getIntersection(aabb)
isIdentical(aabb)
isEqual(aabb)
sqDistance(point)
sqSignedDistance(point)
sqMaxDistance(point)
distance(point)
signedDistance(point)
maxDistance(point)
class StructuredBlockForest

StructuredBlockForest represents a collection of blocks. It can be created using the createUniformBlockGrid method.

getNumberOfLevels()
getDomain()

Returns an axis aligned bounding box representing the complete simulation domain.

mapToPeriodicDomain(x, y, z)
mapToPeriodicDomain(point)
mapToPeriodicDomain(cell, level=0)
getBlock(x, y, z)
containsGlobalBlockInformation()
blocksOverlappedByAABB(point, aabb)
blocksContainedWithinAABB(point, aabb)
addBlockData(name, blockdata)

Adds custom data to the blockforest. This can be a Python Class for example which is then callable on all blocks

blockExists(point)
blockExistsLocally(point)
blockExistsRemotely(point)
atDomainXMinBorder(block)
atDomainYMinBorder(block)
atDomainZMinBorder(block)
atDomainXMaxBorder(block)
atDomainYMaxBorder(block)
atDomainZMaxBorder(block)
dx(level=0)
dy(level=0)
dz(level=0)
getDomainCellBB(level=0)
getBlockCellBB(block)
transformGlobalToLocal(block, object)
Parameters:

object – either a cell (3 tuple) or a CellInterval

transformLocalToGlobal(block, object)
Parameters:

object – either a cell (3 tuple) or a CellInterval

containsGlobalBlockInformation
periodic
class build_info
version

Git Hash of waLBerla

type

Type of build: Release,Debug, …

compiler_flags
build_machine
source_dir
build_dir

Timing

class Timer
start()
stop()
reset()
merge(otherTimer)
class TimingPool
getReduced(reduceType, targetRank=0)
Parameters:

reduceType – allowed values: total, min,avg, max

merge(otherTimingPool, mergeDuplicates=True)
clear()
unifyRegisteredTimersAcrossProcesses()
logResultOnRoot()
class TimingTree
start(timerName)
Parameters:

value – name of the timer

stop(timerName)
Parameters:

value – name of the timer

toDict()

Logging

abort(msg)
log_devel(msg)
log_devel_on_root(msg)
log_result(msg)
log_result_on_root(msg)
log_warning(msg)
log_warning_on_root(msg)
log_info(msg)
log_info_on_root(msg)
log_progress(msg)
log_progress_on_root(msg)
log_detail(msg)
log_detail_on_root(msg)

MPI

Rank & Communicator Infos

rank()
worldRank()
numProcesses()
hasCartesianSetup()
rankValid(rank)
worldBarrier()

Broadcast

broadcastInt(integerOrListOfIntegers, sendRank=0)
broadcastReal(realOrListOfReals, sendRank=0)
broadcastString(stringOrListOfStrings, sendRank=0)

Reduction

reduceInt(integerOrListOfIntegers, operation, recvRank=0)
reduceReal(realOrListOfReals, operation, recvRank=0)
allreduceInt(integerOrListOfIntegers, operation)
allreduceReal(realOrListOfReals, operation)

Gather

gatherInt(integerOrListOfIntegers, recvRank=0)
gatherReal(realOrListOfReals, recvRank=0)
allgatherInt(integerOrListOfIntegers)
allgatherReal(realOrListOfReals)