From ae1c326d9cc701225809da973bcb441e03fdf978 Mon Sep 17 00:00:00 2001 From: Christoph Rettinger <christoph.rettinger@fau.de> Date: Fri, 31 Aug 2018 11:01:07 +0200 Subject: [PATCH] Added some asserts, typo fix in pe coupling --- src/pe_coupling/mapping/BodyBBMapping.cpp | 2 +- src/pe_coupling/momentum_exchange_method/BodyMapping.h | 6 ++++++ .../restoration/PDFReconstruction.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pe_coupling/mapping/BodyBBMapping.cpp b/src/pe_coupling/mapping/BodyBBMapping.cpp index c3726a574..41d5e0c10 100644 --- a/src/pe_coupling/mapping/BodyBBMapping.cpp +++ b/src/pe_coupling/mapping/BodyBBMapping.cpp @@ -57,7 +57,7 @@ CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, Struct // then determine the cell bounding box of the intersection blockStorage.getCellBBFromAABB( cellBB, body->getAABB().getIntersection( extendedBlockAABB ), level ); - // if infinte body does not intersect with the extended block AABB, return an empty interval + // if infinite body does not intersect with the extended block AABB, return an empty interval if( cellBB.empty() ) return CellInterval(); } diff --git a/src/pe_coupling/momentum_exchange_method/BodyMapping.h b/src/pe_coupling/momentum_exchange_method/BodyMapping.h index c44bc77e6..045eeb5d1 100644 --- a/src/pe_coupling/momentum_exchange_method/BodyMapping.h +++ b/src/pe_coupling/momentum_exchange_method/BodyMapping.h @@ -123,6 +123,9 @@ private: CellInterval cellBB = getCellBB( body, *block, *blockStorage_, flagField->nrOfGhostLayers() ); + WALBERLA_ASSERT_LESS_EQUAL(body->getLinearVel().length(), real_t(1), + "Velocity is above 1 (" << body->getLinearVel() << "), which violates the assumption made in the getCellBB() function. The coupling might thus not work properly. Body:\n" << *body); + Vector3<real_t> startCellCenter = blockStorage_->getBlockLocalCellCenter( *block, cellBB.min() ); real_t cz = startCellCenter[2]; @@ -157,6 +160,9 @@ private: } // let pointer from body field point to this body (*bodyField)(x,y,z) = body; + + WALBERLA_ASSERT(isFlagSet( cellFlagPtr, obstacle ), "Flag mapping incorrect for body\n" << *body ); + WALBERLA_ASSERT_EQUAL((*bodyField)(x,y,z), body, "Body field does not point to correct body\n" << *body << "."); } else { diff --git a/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h b/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h index 808fc089f..e65d2cc3c 100644 --- a/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h +++ b/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h @@ -108,7 +108,7 @@ private: if (isFlagSet(flagField->get(x,y,z), formerObstacle)) { boundaryHandling->setDomain( fluid, x, y, z ); removeFlag( flagField->get(x,y,z), formerObstacle ); - (*bodyField)(x,y,z) = NULL; + (*bodyField)(x,y,z) = nullptr; } } } -- GitLab