Good to Know
What geometries are supported?
What synchronization functions are available?
Please check the documentation of each individual method for more information.
What coarse collision detection functions are available?
Please check the documentation of each individual function for more information.
What fine collision detection functions are available?
Please check the documentation of each individual function for more information.
What collision resolution solvers are available?
Please check the documentation of each individual solver for more information.
Global, Communicating and InfiniteMass flags
These flags are given during the creation process of the rigid body. They can be retrieved with RigidBody::isGlobal(), RigidBody::isCommunicating() and RigidBody::hasInfiniteMass().
The global flag decides if the rigid body is stored in the global body storage or in one of the block local body storages. If the body is stored in the global body storage it will receive a global system id. Infinitely large bodies like planes are always global.
The communicating flag decides if the body takes part in the synchronization process, e.g. it spawns shadow copies and updates already existent shadow copies. Bodies which do not move throughout the simulation can be made non communicating.
- Attention
- There will be no shadow copies of non communicating bodies even if they overlap a subdomain boundary. To overcome this drawback you can set syncNonCommunicatingBodies to true once in your sync call (syncNextNeighbors() or syncShadowOwners()).
The infiniteMass flag decides if the body is "considered" by the collision resolution system. It still influences other rigid bodies but will not be moved itself. Rigid bodies with the infiniteMass flag set can still have a static velocity and will move accordingly.
"Object with id: xxx not found in shadowStorage! Cannot transfer ownership!"
Most likely one of your bodies got too fast. The process of migrating a rigid body to a new process is:
- overlap new subdomain
- sync
- move center of mass into the new subdomain
- sync
If a rigid body gets fast enough to move its center of mass into a new subdomain without first creating a shadow copy you will receive that error message.
Contacts Involving Unions
Collision detection for unions is done by colliding each of its subbodies separately. The contacts generated involves the subbodies. With this approach you can use different material parameters for every subbody and the solver component can retrieve the material of every collision partner by retrieving the material of Contact::getBody1(), Contact::getBody2().
- Attention
- To get the correct mass and inertia of a union during collision resolution you should call RigidBody::getTopSuperBody() and then RigidBody::getMass() (RigidBody::getInertia()) using the returned rigid body.
How can I dynamically switch between sync calls?
You can bind the function to a std::function and call this one.
std::function<void(void)> syncCallWithoutTT;
{
syncCallWithoutTT = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID,
static_cast<WcTimingTree*
>(
nullptr), real_c(0.0),
false );
} else
{
syncCallWithoutTT = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(*forest), storageID,
static_cast<WcTimingTree*
>(
nullptr), real_c(0.0),
false );
}
Important Classes and Functions
|
ConvexPolyhedronID | walberla::mesh::pe::createConvexPolyhedron (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const std::vector< Vec3 > &pointCloud, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new ConvexPolyhedron. More...
|
|
ConvexPolyhedronID | walberla::mesh::pe::createConvexPolyhedron (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, Vec3 gpos, TriangleMesh mesh, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new ConvexPolyhedron. More...
|
|
BoxID | walberla::pe::createBox (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const Vec3 &lengths, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Box. More...
|
|
CapsuleID | walberla::pe::createCapsule (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const real_t radius, const real_t length, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Capsule. More...
|
|
CylindricalBoundaryID | walberla::pe::createCylindricalBoundary (BodyStorage &globalStorage, id_t uid, const Vec3 &gpos, const real_t radius, MaterialID material=Material::find("iron")) |
| Setup of a new Cylindrical Boundary. More...
|
|
EllipsoidID | walberla::pe::createEllipsoid (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const Vec3 &semiAxes, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Ellipsoid. More...
|
|
PlaneID | walberla::pe::createPlane (BodyStorage &globalStorage, id_t uid, Vec3 normal, const Vec3 &gpos, MaterialID material=Material::find("iron")) |
| Setup of a new Plane. More...
|
|
static void | walberla::pe::SetBodyTypeIDs< BodyTypeTuple, N >::execute () |
| Initial setup of static type ids. More...
|
|
SphereID | walberla::pe::createSphere (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, real_t radius, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Sphere. More...
|
|
SquirmerID | walberla::pe::createSquirmer (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, real_t radius, real_t squirmerVelocity, real_t squirmerBeta, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Squirmer. More...
|
|
template<typename... BodyTypes> |
Union< BodyTypes... > * | walberla::pe::createUnion (BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Union. More...
|
|
template<typename... BodyTypes> |
BoxID | walberla::pe::createBox (Union< BodyTypes... > *un, id_t uid, const Vec3 &gpos, const Vec3 &lengths, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Box directly attached to a Union. More...
|
|
template<typename... BodyTypes> |
CapsuleID | walberla::pe::createCapsule (Union< BodyTypes... > *un, id_t uid, const Vec3 &gpos, const real_t radius, const real_t length, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Capsule directly attached to a Union. More...
|
|
template<typename... BodyTypes> |
SphereID | walberla::pe::createSphere (Union< BodyTypes... > *un, id_t uid, const Vec3 &gpos, real_t radius, MaterialID material=Material::find("iron"), bool global=false, bool communicating=true, bool infiniteMass=false) |
| Setup of a new Sphere directly attached to a Union. More...
|
|
◆ createBox() [1/2]
Setup of a new Box.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the box. |
gpos | The global position of the center of the box. |
lengths | The side length of the box \( (0..\infty) \). |
material | The material of the box. |
global | specifies if the box should be created in the global storage |
communicating | specifies if the box should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the box has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new box.
- Exceptions
-
std::invalid_argument | Invalid box radius. |
std::invalid_argument | Invalid global box position. |
This function creates a box primitive in the pe simulation system. The box with user-specific ID uid is placed at the global position gpos, has the side lengths lengths, and consists of the material material.
The following code example illustrates the setup of a box:
BoxID box =
createBox( *globalBodyStorage, forest->getBlockStorage(), storageID, 1,
Vec3(2,3,4),
Vec3(2.5,2.5,2.5) );
if (box != nullptr)
box->rotate( 0.0, real_c(
math::pi/3.0), 0.0 );
◆ createBox() [2/2]
template<typename... BodyTypes>
BoxID walberla::pe::createBox |
( |
Union< BodyTypes... > * |
un, |
|
|
id_t |
uid, |
|
|
const Vec3 & |
gpos, |
|
|
const Vec3 & |
lengths, |
|
|
MaterialID |
material = Material::find("iron") , |
|
|
bool |
global = false , |
|
|
bool |
communicating = true , |
|
|
bool |
infiniteMass = false |
|
) |
| |
Setup of a new Box directly attached to a Union.
- Template Parameters
-
BodyTypes | all geometries the Union is able to contain |
- Exceptions
-
std::runtime_error | Box TypeID not initialized! |
std::invalid_argument | createBox: Union argument is NULL |
std::logic_error | createBox: Union is remote |
std::invalid_argument | Invalid side length |
- See also
- createBox for more details
◆ createCapsule() [1/2]
CapsuleID walberla::pe::createCapsule |
( |
BodyStorage & |
globalStorage, |
|
|
BlockStorage & |
blocks, |
|
|
BlockDataID |
storageID, |
|
|
id_t |
uid, |
|
|
const Vec3 & |
gpos, |
|
|
const real_t |
radius, |
|
|
const real_t |
length, |
|
|
MaterialID |
material = Material::find("iron") , |
|
|
bool |
global = false , |
|
|
bool |
communicating = true , |
|
|
bool |
infiniteMass = false |
|
) |
| |
Setup of a new Capsule.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the capsule. |
gpos | The global position of the center of the capsule. |
radius | The radius of the cylinder part and the end caps \( (0..\infty) \). |
length | The length of the cylinder part of the capsule \( (0..\infty) \). |
material | The material of the capsule. |
global | specifies if the capsule should be created in the global storage |
communicating | specifies if the capsule should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the capsule has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new capsule.
The following code example illustrates the setup of a capsule:
if (capsule != nullptr)
capsule->rotate( 0.0, real_c(
math::pi/3.0), 0.0 );
◆ createCapsule() [2/2]
template<typename... BodyTypes>
Setup of a new Capsule directly attached to a Union.
- Template Parameters
-
BodyTypes | all geometries the Union is able to contain |
- Exceptions
-
std::runtime_error | Capsule TypeID not initialized! |
std::invalid_argument | createCapsule: Union argument is NULL |
std::logic_error | createCapsule: Union is remote |
std::invalid_argument | Invalid capsule radius |
std::invalid_argument | Invalid capsule length |
- See also
- createCapsule for more details
◆ createConvexPolyhedron() [1/2]
Setup of a new ConvexPolyhedron.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the box. |
gpos | The global position of the center of the box. |
pointCloud | A point cloud which convex hull defines the polyhedron |
material | The material of the box. |
global | specifies if the box should be created in the global storage |
communicating | specifies if the box should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the box has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new box.
- Exceptions
-
std::invalid_argument | Invalid box radius. |
std::invalid_argument | Invalid global box position. |
This function creates a box primitive in the pe simulation system. The box with user-specific ID uid is placed at the global position gpos, has the side lengths lengths, and consists of the material material.
The following code example illustrates the setup of a box:
BoxID box =
createBox( *globalBodyStorage, forest->getBlockStorage(), storageID, 1,
Vec3(2,3,4),
Vec3(2.5,2.5,2.5) );
if (box != nullptr)
box->rotate( 0.0, real_c(
math::pi/3.0), 0.0 );
◆ createConvexPolyhedron() [2/2]
Setup of a new ConvexPolyhedron.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the box. |
gpos | The global position of the center of the box. |
mesh | Surface mesh of convex polyhedron |
material | The material of the box. |
global | specifies if the box should be created in the global storage |
communicating | specifies if the box should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the box has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new box.
- Exceptions
-
std::invalid_argument | Invalid box radius. |
std::invalid_argument | Invalid global box position. |
This function creates a box primitive in the pe simulation system. The box with user-specific ID uid is placed at the global position gpos, has the side lengths lengths, and consists of the material material.
The following code example illustrates the setup of a box:
BoxID box =
createBox( *globalBodyStorage, forest->getBlockStorage(), storageID, 1,
Vec3(2,3,4),
Vec3(2.5,2.5,2.5) );
if (box != nullptr)
box->rotate( 0.0, real_c(
math::pi/3.0), 0.0 );
◆ createCylindricalBoundary()
Setup of a new Cylindrical Boundary.
- Parameters
-
globalStorage | process local global storage |
uid | The user-specific ID. |
gpos | One point located on the central axis. |
radius | radius of the cylinder |
material | The material of the boundary. |
- Returns
- Handle for the new boundary.
◆ createEllipsoid()
Setup of a new Ellipsoid.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the Ellipsoid. |
gpos | The global position of the center of the Ellipsoid. |
semiAxes | The semiAxes of the Ellipsoid \( (0..\infty) \). |
material | The material of the Ellipsoid. |
global | specifies if the Ellipsoid should be created in the global storage |
communicating | specifies if the Ellipsoid should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the Ellipsoid has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new Ellipsoid.
- Exceptions
-
std::invalid_argument | Invalid Ellipsoid semi-axes. |
std::invalid_argument | Invalid global Ellipsoid position. |
This function creates a Ellipsoid primitive in the pe simulation system. The Ellipsoid with user-specific ID uid is placed at the global position gpos, has the semi-axes semiAxes, and consists of the material material.
◆ createPlane()
Setup of a new Plane.
- Parameters
-
globalStorage | process local global storage |
uid | The user-specific ID of the plane. |
normal | Normal of the plane. |
gpos | One point located on the plane. |
material | The material of the plane. |
- Returns
- Handle for the new plane.
This function creates a plane primitive in the simulation system. The plane with user-specific ID uid is placed at the global position gpos, oriented with normal and consists of the material material
The following code example illustrates the setup of a plane:
◆ createSphere() [1/2]
Setup of a new Sphere.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the sphere. |
gpos | The global position of the center of the sphere. |
radius | The radius of the sphere \( (0..\infty) \). |
material | The material of the sphere. |
global | specifies if the sphere should be created in the global storage |
communicating | specifies if the sphere should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the sphere has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new sphere.
- Exceptions
-
std::invalid_argument | Invalid sphere radius. |
std::invalid_argument | Invalid global sphere position. |
This function creates a sphere primitive in the pe simulation system. The sphere with user-specific ID uid is placed at the global position gpos, has the radius radius, and consists of the material material.
The following code example illustrates the setup of a sphere:
if (sphere != nullptr)
sphere->rotate( 0.0, real_c(
math::pi/3.0), 0.0 );
◆ createSphere() [2/2]
template<typename... BodyTypes>
Setup of a new Sphere directly attached to a Union.
- Template Parameters
-
BodyTypes | all geometries the Union is able to contain |
- Exceptions
-
std::runtime_error | Sphere TypeID not initialized! |
std::invalid_argument | createSphere: Union argument is NULL |
std::logic_error | createSphere: Union is remote |
std::invalid_argument | Invalid sphere radius |
- See also
- createSphere for more details
◆ createSquirmer()
SquirmerID walberla::pe::createSquirmer |
( |
BodyStorage & |
globalStorage, |
|
|
BlockStorage & |
blocks, |
|
|
BlockDataID |
storageID, |
|
|
id_t |
uid, |
|
|
const Vec3 & |
gpos, |
|
|
real_t |
radius, |
|
|
real_t |
squirmerVelocity, |
|
|
real_t |
squirmerBeta, |
|
|
MaterialID |
material = Material::find("iron") , |
|
|
bool |
global = false , |
|
|
bool |
communicating = true , |
|
|
bool |
infiniteMass = false |
|
) |
| |
Setup of a new Squirmer.
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the sphere. |
gpos | The global position of the center of the sphere. |
radius | The radius of the sphere \( (0..\infty) \). |
squirmerVelocity | The velocity of the squirmer. |
squirmerBeta | The dipolar characteristic of the squirmer. |
material | The material of the sphere. |
global | specifies if the sphere should be created in the global storage |
communicating | specifies if the sphere should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the sphere has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new sphere.
- Exceptions
-
std::invalid_argument | Invalid sphere radius. |
std::invalid_argument | Invalid global sphere position. |
This function creates a squirmer primitive in the pe simulation system. The squirmer with user-specific ID uid is placed at the global position gpos, has the radius radius, and consists of the material material. Its self-propulsion velocity is squirmerVelocity and its dipolar characteristic is squirmerBeta.
◆ createUnion()
template<typename... BodyTypes>
Setup of a new Union.
- Template Parameters
-
BodyTypes | all geometries the Union should be able to contain |
- Parameters
-
globalStorage | process local global storage |
blocks | storage of all the blocks on this process |
storageID | BlockDataID of the BlockStorage block datum |
uid | The user-specific ID of the union. |
gpos | The global position of the center of the union. |
global | specifies if the union should be created in the global storage |
communicating | specifies if the union should take part in synchronization (syncNextNeighbour, syncShadowOwner) |
infiniteMass | specifies if the union has infinite mass and will be treated as an obstacle |
- Returns
- Handle for the new union.
- Exceptions
-
std::runtime_error | Union TypeID not initialized! |
The code example illustrates the setup of a Union. For convenience the following typedefs were made. You can adapt them to your needs.
using UnionT = Union<Box, Capsule, Sphere>;
using UnionID = UnionT *;
UnionID un = createUnion<Box, Capsule, Sphere>( *globalBodyStorage, forest->getBlockStorage(), storageID, 1,
Vec3(2,3,4) );
if (un != nullptr)
{
}
◆ execute()
template<typename BodyTypeTuple , int N = std::tuple_size<BodyTypeTuple>::value - 1>
Initial setup of static type ids.
- Template Parameters
-
BodyTypeTuple | std::tuple of all geometries used throughout the simulation |
Each geometry has a unique type id which is used to identify the geometry. These type ids have to be set at the start of the simulation using this function.
- Note
- You have to call this function on all processes identically.
The template parameter is a std::tuple of geometries used during the simulation. Since the tuple is used often a typedef is used.
typedef std::tuple<Box, Capsule, Plane, Sphere, UnionT>
BodyTypeTuple ;
The function call then looks like:
PlaneID createPlane(BodyStorage &globalStorage, id_t uid, Vec3 normal, const Vec3 &gpos, MaterialID material)
Setup of a new Plane.
Definition: PlaneFactory.cpp:35
BoxID createBox(BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const Vec3 &lengths, MaterialID material, bool global, bool communicating, bool infiniteMass)
Setup of a new Box.
Definition: BoxFactory.cpp:35
math::Vector3< real_t > Vec3
Definition: DataTypes.h:40
SphereID createSphere(BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, real_t radius, MaterialID material, bool global, bool communicating, bool infiniteMass)
Setup of a new Sphere.
Definition: SphereFactory.cpp:35
constexpr real_t pi
Definition: Constants.h:42
Box * BoxID
Handle for a box primitive.
Definition: Types.h:89
void syncShadowOwners(BlockForest &forest, BlockDataID storageID, WcTimingTree *tt=nullptr, const real_t dx=real_t(0), const bool syncNonCommunicatingBodies=false)
Definition: SyncShadowOwners.h:375
Plane * PlaneID
Handle for a plane primitive.
Definition: Types.h:114
timing::TimingTree< timing::WcPolicy > WcTimingTree
Definition: TimingTree.h:261
math::Vector3< real_t > Vec3
Definition: Types.h:46
std::tuple< Sphere, Plane > BodyTypeTuple
[BodyTypeTuple]
Definition: 01_ConfinedGas.cpp:38
float real_t
Definition: DataTypes.h:167
static void execute()
Initial setup of static type ids.
Definition: SetBodyTypeIDs.h:50
CapsuleID createCapsule(BodyStorage &globalStorage, BlockStorage &blocks, BlockDataID storageID, id_t uid, const Vec3 &gpos, const real_t radius, const real_t length, MaterialID material, bool global, bool communicating, bool infiniteMass)
Setup of a new Capsule.
Definition: CapsuleFactory.cpp:35
Sphere * SphereID
Handle for a sphere primitive.
Definition: Types.h:119
Capsule * CapsuleID
Handle for a capsule primitive.
Definition: Types.h:94