Commit 4249d29c authored by Lukas Werner's avatar Lukas Werner Committed by Christoph Rettinger
Browse files

Add virtual mass functionality to lbm-mesapd coupling

parent 6e75c8a8
...@@ -32,4 +32,4 @@ endif() ...@@ -32,4 +32,4 @@ endif()
# Python module # Python module
if ( WALBERLA_BUILD_WITH_PYTHON ) if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory( pythonmodule ) add_subdirectory( pythonmodule )
endif() endif()
\ No newline at end of file
...@@ -2,6 +2,7 @@ add_subdirectory( BidisperseFluidizedBed ) ...@@ -2,6 +2,7 @@ add_subdirectory( BidisperseFluidizedBed )
add_subdirectory( CombinedResolvedUnresolved ) add_subdirectory( CombinedResolvedUnresolved )
add_subdirectory( FluidizedBed ) add_subdirectory( FluidizedBed )
add_subdirectory( HeatConduction ) add_subdirectory( HeatConduction )
add_subdirectory( LightRisingParticleInFluidAMR )
add_subdirectory( Mixer ) add_subdirectory( Mixer )
add_subdirectory( PegIntoSphereBed ) add_subdirectory( PegIntoSphereBed )
if ( WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_PYTHON ) if ( WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_PYTHON )
......
waLBerla_add_executable ( NAME LightRisingParticleInFluidAMR
FILES LightRisingParticleInFluidAMR.cpp
DEPENDS core mesa_pd lbm lbm_mesapd_coupling domain_decomposition field vtk geometry postprocessing )
...@@ -63,6 +63,22 @@ if __name__ == '__main__': ...@@ -63,6 +63,22 @@ if __name__ == '__main__':
ps.add_property("oldHydrodynamicTorque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", ps.add_property("oldHydrodynamicTorque", "walberla::mesa_pd::Vec3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE") syncMode="ON_OWNERSHIP_CHANGE")
# Properties for virtual mass:
ps.add_property("virtualMass", "walberla::real_t", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("invMassIncludingVirtual", "walberla::real_t", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("oldLinearAcceleration", "walberla::mesa_pd::Vec3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("invInertiaBF", "walberla::mesa_pd::Mat3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("virtualInertiaBF", "walberla::mesa_pd::Mat3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("invInertiaBFIncludingVirtual", "walberla::mesa_pd::Mat3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
ps.add_property("oldAngularAcceleration", "walberla::mesa_pd::Vec3", defValue="real_t(0)",
syncMode="ON_OWNERSHIP_CHANGE")
# properties for VBond model # properties for VBond model
ps.add_property("clusterID", "int64_t", defValue="-1", syncMode="ON_GHOST_CREATION") ps.add_property("clusterID", "int64_t", defValue="-1", syncMode="ON_GHOST_CREATION")
ps.add_property("segmentID", "int64_t", defValue="-1", syncMode="ON_GHOST_CREATION") ps.add_property("segmentID", "int64_t", defValue="-1", syncMode="ON_GHOST_CREATION")
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
namespace walberla { namespace walberla {
namespace lbm_mesapd_coupling { namespace lbm_mesapd_coupling {
namespace amr
{
/* /*
* Class to determine the minimum level a block can be. * Class to determine the minimum level a block can be.
* For coupled LBM-PE simulations the following rules apply: * For coupled LBM-PE simulations the following rules apply:
...@@ -39,21 +40,24 @@ namespace lbm_mesapd_coupling { ...@@ -39,21 +40,24 @@ namespace lbm_mesapd_coupling {
*/ */
class ParticlePresenceLevelDetermination class ParticlePresenceLevelDetermination
{ {
public: public:
ParticlePresenceLevelDetermination(const shared_ptr< InfoCollection > infoCollection,
ParticlePresenceLevelDetermination( const shared_ptr<lbm_mesapd_coupling::InfoCollection> & infoCollection, uint_t finestLevel) : uint_t finestLevel)
infoCollection_( infoCollection ), finestLevel_( finestLevel) : infoCollection_(infoCollection), finestLevel_(finestLevel)
{} {}
void operator()( std::vector< std::pair< const Block *, uint_t > > & minTargetLevels, void operator()(std::vector< std::pair< const Block*, uint_t > >& minTargetLevels, std::vector< const Block* >&,
std::vector< const Block * > &, const BlockForest & /*forest*/ ) { const BlockForest& /*forest*/)
for (auto &minTargetLevel : minTargetLevels) { {
for (auto& minTargetLevel : minTargetLevels)
{
uint_t currentLevelOfBlock = minTargetLevel.first->getLevel(); uint_t currentLevelOfBlock = minTargetLevel.first->getLevel();
const uint_t numberOfParticlesInDirectNeighborhood = getNumberOfLocalAndShadowParticlesInNeighborhood(minTargetLevel.first); const uint_t numberOfParticlesInDirectNeighborhood =
getNumberOfLocalAndShadowParticlesInNeighborhood(minTargetLevel.first);
uint_t targetLevelOfBlock = currentLevelOfBlock; //keep everything as it is uint_t targetLevelOfBlock = currentLevelOfBlock; // keep everything as it is
if ( numberOfParticlesInDirectNeighborhood > uint_t(0) ) if (numberOfParticlesInDirectNeighborhood > uint_t(0))
{ {
// set block to finest level if there are particles nearby // set block to finest level if there are particles nearby
targetLevelOfBlock = finestLevel_; targetLevelOfBlock = finestLevel_;
...@@ -61,41 +65,44 @@ public: ...@@ -61,41 +65,44 @@ public:
else else
{ {
// block could coarsen since there are no particles nearby // block could coarsen since there are no particles nearby
if( currentLevelOfBlock > uint_t(0) ) if (currentLevelOfBlock > uint_t(0)) targetLevelOfBlock = currentLevelOfBlock - uint_t(1);
targetLevelOfBlock = currentLevelOfBlock - uint_t(1);
} }
WALBERLA_CHECK_LESS_EQUAL(std::abs(int_c(targetLevelOfBlock) - int_c(currentLevelOfBlock)), uint_t(1), "Only level difference of maximum 1 allowed!"); WALBERLA_CHECK_LESS_EQUAL(std::abs(int_c(targetLevelOfBlock) - int_c(currentLevelOfBlock)), uint_t(1),
"Only level difference of maximum 1 allowed!");
minTargetLevel.second = targetLevelOfBlock; minTargetLevel.second = targetLevelOfBlock;
} }
} }
private: private:
uint_t getNumberOfLocalAndShadowParticlesInNeighborhood(const Block* block)
uint_t getNumberOfLocalAndShadowParticlesInNeighborhood(const Block * block) { {
auto numParticles = uint_t(0); auto numParticles = uint_t(0);
// add particles of current block // add particles of current block
const auto infoIt = infoCollection_->find(block->getId()); const auto infoIt = infoCollection_->find(block->getId());
WALBERLA_CHECK_UNEQUAL(infoIt, infoCollection_->end(), "Block with ID " << block->getId() << " not found in info collection!"); WALBERLA_CHECK_UNEQUAL(infoIt, infoCollection_->end(),
"Block with ID " << block->getId() << " not found in info collection!");
numParticles += infoIt->second.numberOfLocalParticles + infoIt->second.numberOfShadowParticles; numParticles += infoIt->second.numberOfLocalParticles + infoIt->second.numberOfGhostParticles;
// add particles of all neighboring blocks // add particles of all neighboring blocks
for(uint_t i = 0; i < block->getNeighborhoodSize(); ++i) for (uint_t i = 0; i < block->getNeighborhoodSize(); ++i)
{ {
const BlockID &neighborBlockID = block->getNeighborId(i); const BlockID& neighborBlockID = block->getNeighborId(i);
const auto infoItNeighbor = infoCollection_->find(neighborBlockID); const auto infoItNeighbor = infoCollection_->find(neighborBlockID);
WALBERLA_CHECK_UNEQUAL(infoItNeighbor, infoCollection_->end(), "Neighbor block with ID " << neighborBlockID << " not found in info collection!"); WALBERLA_CHECK_UNEQUAL(infoItNeighbor, infoCollection_->end(),
"Neighbor block with ID " << neighborBlockID << " not found in info collection!");
numParticles += infoItNeighbor->second.numberOfLocalParticles + infoItNeighbor->second.numberOfShadowParticles; numParticles += infoItNeighbor->second.numberOfLocalParticles + infoItNeighbor->second.numberOfGhostParticles;
} }
return numParticles; return numParticles;
} }
shared_ptr<lbm_mesapd_coupling::InfoCollection> infoCollection_; shared_ptr< InfoCollection > infoCollection_;
uint_t finestLevel_; uint_t finestLevel_;
}; };
} // namespace amr
} // namespace lbm_mesapd_coupling } // namespace lbm_mesapd_coupling
} // namespace walberla } // namespace walberla
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file AddVirtualForceTorqueKernel.h
//! \ingroup lbm_mesapd_coupling
//! \author Lukas Werner <lks.werner@fau.de>
//
//======================================================================================================================
#pragma once
#include <utility>
#include "mesa_pd/data/DataTypes.h"
#include "mesa_pd/data/IAccessor.h"
#include "mesa_pd/common/ParticleFunctions.h"
#include "mesa_pd/data/ParticleStorage.h"
namespace walberla {
namespace lbm_mesapd_coupling {
/**
* Kernel that sets a virtual force and torque on particles. It accesses a virtual mass and inertia, which have to be
* set beforehand using InitializeVirtualMassKernel.
* During the calculation of virtual force and torque linear and angular accelerations are used, for which acceleration
* estimators need to be supplied.
*
* This kernel requires the following particle attributes:
* ps.addProperty("virtualMass", "walberla::real_t", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.addProperty("virtualInertiaBF", "walberla::mesa_pd::Mat3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.add_property("oldLinearAcceleration", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.add_property("oldAngularAcceleration", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
*/
class AddVirtualForceTorqueKernel
{
public:
explicit AddVirtualForceTorqueKernel(shared_ptr<mesa_pd::data::ParticleStorage> ps) : ps_(std::move(ps)){};
template <typename Accessor_T>
void operator()(const size_t idx, Accessor_T& ac) {
static_assert(std::is_base_of<mesa_pd::data::IAccessor, Accessor_T>::value, "please provide a valid accessor");
WALBERLA_CHECK_FLOAT_UNEQUAL(ac.getVirtualMass(idx), real_t(0.),
"No virtual mass set on body. Was the virtualMass kernel not called before?");
//// force
// obtain the acceleration estimation
Vector3<real_t> approximatedCurrentLinearAcceleration = ac.getOldLinearAcceleration(idx);
// prepare the next acceleration estimation for the following time step
const Vector3<real_t> virtualForce = ac.getVirtualMass(idx) * approximatedCurrentLinearAcceleration;
const Vector3<real_t> currentLinearAcceleration = (ac.getForce(idx) + virtualForce) /
(ac.getVirtualMass(idx) + ac.getMass(idx));
ac.setOldLinearAcceleration(idx, currentLinearAcceleration);
mesa_pd::addForceAtomic(idx, ac, virtualForce);
//// torque
// obtain the acceleration estimation
Vector3<real_t> approximatedCurrentAngularAcceleration = ac.getOldAngularAcceleration(idx);
// prepare the next acceleration estimation for the following time step
const Vector3<real_t> virtualTorque = ac.getVirtualInertiaBF(idx) * approximatedCurrentAngularAcceleration;
const Vector3<real_t> angularAcceleration = math::transformMatrixRART(ac.getRotation(idx).getMatrix(),
ac.getInvInertiaBFIncludingVirtual(idx)) * (ac.getTorque(idx) + virtualTorque);
ac.setOldAngularAcceleration(idx, angularAcceleration);
mesa_pd::addTorqueAtomic(idx, ac, virtualTorque);
}
private:
const shared_ptr<mesa_pd::data::ParticleStorage> ps_;
};
}
}
\ No newline at end of file
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file VirtualMass.h
//! \author Lukas Werner <lks.werner@fau.de>
//
//======================================================================================================================
#pragma once
#include <mesa_pd/data/DataTypes.h>
#include <mesa_pd/data/IAccessor.h>
namespace walberla {
namespace lbm_mesapd_coupling {
/**
* This kernel calculates virtual mass and inertia and sets them as attributes on a particle.
*
* It requires the following particle attributes:
* ps.addProperty("virtualMass", "walberla::real_t", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.addProperty("invMassIncludingVirtual", "walberla::real_t", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.addProperty("virtualInertiaBF", "walberla::mesa_pd::Mat3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
* ps.addProperty("invInertiaBFIncludingVirtual", "walberla::mesa_pd::Mat3", defValue="real_t(0)", syncMode="ON_OWNERSHIP_CHANGE")
*/
class InitializeVirtualMassKernel {
public:
InitializeVirtualMassKernel() = default;
template <typename Accessor>
void operator()(size_t i, Accessor& ac, real_t C_v, real_t C_v_omega, real_t fluidDensity) const;
};
template <typename Accessor>
inline void InitializeVirtualMassKernel::operator()(const size_t i, Accessor& ac, const real_t C_v, const real_t C_v_omega,
const real_t fluidDensity) const {
static_assert(std::is_base_of<mesa_pd::data::IAccessor, Accessor>::value, "please provide a valid accessor");
const real_t virtualMass = C_v * fluidDensity * ac.getVolume(i);
ac.setVirtualMass(i, virtualMass);
ac.setInvMassIncludingVirtual(i, real_t(1.) / (ac.getMass(i) + virtualMass));
const real_t angularVirtualMass = C_v_omega * fluidDensity * ac.getVolume(i);
const mesa_pd::Mat3 virtualInertiaBF = ac.getInertiaBF(i) * ac.getInvMass(i) * angularVirtualMass;
const mesa_pd::Mat3 inertiaBFIncludingVirtual = ac.getInertiaBF(i) + virtualInertiaBF;
ac.setVirtualInertiaBF(i, virtualInertiaBF);
ac.setInvInertiaBFIncludingVirtual(i, inertiaBFIncludingVirtual.getInverse());
}
} //namespace lbm_mesapd_coupling
} //namespace walberla
\ No newline at end of file
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file ParticleAccessorWithShapeAndVirtualMassWrapper.h
//! \author Lukas Werner <lks.werner@fau.de>
//
//======================================================================================================================
#pragma once
#include <mesa_pd/data/ParticleStorage.h>
#include <mesa_pd/data/ShapeStorage.h>
namespace walberla {
namespace lbm_mesapd_coupling {
/**
* !\brief Wraps a ParticleAccessor to change its getInvMass and getInvInertiaBF methods to include virtual mass.
* @tparam T A ParticleAccessor providing functions getInvMass and getInvInertiaBF, and their respective getInvMassIncludingVirtual and getInvInertiaBFIncludingVirtual.
*/
template <typename T>
class ParticleAccessorWithShapeVirtualMassWrapper : public T {
public:
ParticleAccessorWithShapeVirtualMassWrapper(std::shared_ptr<mesa_pd::data::ParticleStorage>& ps, std::shared_ptr<mesa_pd::data::ShapeStorage>& ss)
: T(ps, ss) {
}
auto getInvMass(const size_t p_idx) const {
return T::getInvMassIncludingVirtual(p_idx);
}
const auto getMass(const size_t p_idx) const {
return T::getMass(p_idx) + T::getVirtualMass(p_idx);
}
auto getInvInertiaBF(const size_t p_idx) const {
return T::getInvInertiaBFIncludingVirtual(p_idx);
}
const auto getInertiaBF(const size_t p_idx) const {
return T::getInertiaBF(p_idx) + T::getVirtualInertiaBF(p_idx);
}
};
}
}
\ No newline at end of file
...@@ -164,6 +164,34 @@ public: ...@@ -164,6 +164,34 @@ public:
walberla::mesa_pd::Vec3& getOldHydrodynamicTorqueRef(const size_t p_idx) {return ps_->getOldHydrodynamicTorqueRef(p_idx);} walberla::mesa_pd::Vec3& getOldHydrodynamicTorqueRef(const size_t p_idx) {return ps_->getOldHydrodynamicTorqueRef(p_idx);}
void setOldHydrodynamicTorque(const size_t p_idx, walberla::mesa_pd::Vec3 const & v) { ps_->setOldHydrodynamicTorque(p_idx, v);} void setOldHydrodynamicTorque(const size_t p_idx, walberla::mesa_pd::Vec3 const & v) { ps_->setOldHydrodynamicTorque(p_idx, v);}
walberla::real_t const & getVirtualMass(const size_t p_idx) const {return ps_->getVirtualMass(p_idx);}
walberla::real_t& getVirtualMassRef(const size_t p_idx) {return ps_->getVirtualMassRef(p_idx);}
void setVirtualMass(const size_t p_idx, walberla::real_t const & v) { ps_->setVirtualMass(p_idx, v);}
walberla::real_t const & getInvMassIncludingVirtual(const size_t p_idx) const {return ps_->getInvMassIncludingVirtual(p_idx);}
walberla::real_t& getInvMassIncludingVirtualRef(const size_t p_idx) {return ps_->getInvMassIncludingVirtualRef(p_idx);}
void setInvMassIncludingVirtual(const size_t p_idx, walberla::real_t const & v) { ps_->setInvMassIncludingVirtual(p_idx, v);}
walberla::mesa_pd::Vec3 const & getOldLinearAcceleration(const size_t p_idx) const {return ps_->getOldLinearAcceleration(p_idx);}
walberla::mesa_pd::Vec3& getOldLinearAccelerationRef(const size_t p_idx) {return ps_->getOldLinearAccelerationRef(p_idx);}
void setOldLinearAcceleration(const size_t p_idx, walberla::mesa_pd::Vec3 const & v) { ps_->setOldLinearAcceleration(p_idx, v);}
walberla::mesa_pd::Mat3 const & getInvInertiaBF(const size_t p_idx) const {return ps_->getInvInertiaBF(p_idx);}
walberla::mesa_pd::Mat3& getInvInertiaBFRef(const size_t p_idx) {return ps_->getInvInertiaBFRef(p_idx);}
void setInvInertiaBF(const size_t p_idx, walberla::mesa_pd::Mat3 const & v) { ps_->setInvInertiaBF(p_idx, v);}
walberla::mesa_pd::Mat3 const & getVirtualInertiaBF(const size_t p_idx) const {return ps_->getVirtualInertiaBF(p_idx);}
walberla::mesa_pd::Mat3& getVirtualInertiaBFRef(const size_t p_idx) {return ps_->getVirtualInertiaBFRef(p_idx);}
void setVirtualInertiaBF(const size_t p_idx, walberla::mesa_pd::Mat3 const & v) { ps_->setVirtualInertiaBF(p_idx, v);}
walberla::mesa_pd::Mat3 const & getInvInertiaBFIncludingVirtual(const size_t p_idx) const {return ps_->getInvInertiaBFIncludingVirtual(p_idx);}
walberla::mesa_pd::Mat3& getInvInertiaBFIncludingVirtualRef(const size_t p_idx) {return ps_->getInvInertiaBFIncludingVirtualRef(p_idx);}
void setInvInertiaBFIncludingVirtual(const size_t p_idx, walberla::mesa_pd::Mat3 const & v) { ps_->setInvInertiaBFIncludingVirtual(p_idx, v);}
walberla::mesa_pd::Vec3 const & getOldAngularAcceleration(const size_t p_idx) const {return ps_->getOldAngularAcceleration(p_idx);}
walberla::mesa_pd::Vec3& getOldAngularAccelerationRef(const size_t p_idx) {return ps_->getOldAngularAccelerationRef(p_idx);}
void setOldAngularAcceleration(const size_t p_idx, walberla::mesa_pd::Vec3 const & v) { ps_->setOldAngularAcceleration(p_idx, v);}
int64_t const & getClusterID(const size_t p_idx) const {return ps_->getClusterID(p_idx);} int64_t const & getClusterID(const size_t p_idx) const {return ps_->getClusterID(p_idx);}
int64_t& getClusterIDRef(const size_t p_idx) {return ps_->getClusterIDRef(p_idx);} int64_t& getClusterIDRef(const size_t p_idx) {return ps_->getClusterIDRef(p_idx);}
void setClusterID(const size_t p_idx, int64_t const & v) { ps_->setClusterID(p_idx, v);} void setClusterID(const size_t p_idx, int64_t const & v) { ps_->setClusterID(p_idx, v);}
...@@ -337,6 +365,34 @@ public: ...@@ -337,6 +365,34 @@ public:
void setOldHydrodynamicTorque(const size_t /*p_idx*/, walberla::mesa_pd::Vec3 const & v) { oldHydrodynamicTorque_ = v;} void setOldHydrodynamicTorque(const size_t /*p_idx*/, walberla::mesa_pd::Vec3 const & v) { oldHydrodynamicTorque_ = v;}
walberla::mesa_pd::Vec3& getOldHydrodynamicTorqueRef(const size_t /*p_idx*/) {return oldHydrodynamicTorque_;} walberla::mesa_pd::Vec3& getOldHydrodynamicTorqueRef(const size_t /*p_idx*/) {return oldHydrodynamicTorque_;}
walberla::real_t const & getVirtualMass(const size_t /*p_idx*/) const {return virtualMass_;}
void setVirtualMass(const size_t /*p_idx*/, walberla::real_t const & v) { virtualMass_ = v;}
walberla::real_t& getVirtualMassRef(const size_t /*p_idx*/) {return virtualMass_;}
walberla::real_t const & getInvMassIncludingVirtual(const size_t /*p_idx*/) const {return invMassIncludingVirtual_;}
void setInvMassIncludingVirtual(const size_t /*p_idx*/, walberla::real_t const & v) { invMassIncludingVirtual_ = v;}
walberla::real_t& getInvMassIncludingVirtualRef(const size_t /*p_idx*/) {return invMassIncludingVirtual_;}
walberla::mesa_pd::Vec3 const & getOldLinearAcceleration(const size_t /*p_idx*/) const {return oldLinearAcceleration_;}
void setOldLinearAcceleration(const size_t /*p_idx*/, walberla::mesa_pd::Vec3 const & v) { oldLinearAcceleration_ = v;}
walberla::mesa_pd::Vec3& getOldLinearAccelerationRef(const size_t /*p_idx*/) {return oldLinearAcceleration_;}
walberla::mesa_pd::Mat3 const & getInvInertiaBF(const size_t /*p_idx*/) const {return invInertiaBF_;}
void setInvInertiaBF(const size_t /*p_idx*/, walberla::mesa_pd::Mat3 const & v) { invInertiaBF_ = v;}
walberla::mesa_pd::Mat3& getInvInertiaBFRef(const size_t /*p_idx*/) {return invInertiaBF_;}
walberla::mesa_pd::Mat3 const & getVirtualInertiaBF(const size_t /*p_idx*/) const {return virtualInertiaBF_;}
void setVirtualInertiaBF(const size_t /*p_idx*/, walberla::mesa_pd::Mat3 const & v) { virtualInertiaBF_ = v;}
walberla::mesa_pd::Mat3& getVirtualInertiaBFRef(const size_t /*p_idx*/) {return virtualInertiaBF_;}
walberla::mesa_pd::Mat3 const & getInvInertiaBFIncludingVirtual(const size_t /*p_idx*/) const {return invInertiaBFIncludingVirtual_;}
void setInvInertiaBFIncludingVirtual(const size_t /*p_idx*/, walberla::mesa_pd::Mat3 const & v) { invInertiaBFIncludingVirtual_ = v;}
walberla::mesa_pd::Mat3& getInvInertiaBFIncludingVirtualRef(const size_t /*p_idx*/) {return invInertiaBFIncludingVirtual_;}
walberla::mesa_pd::Vec3 const & getOldAngularAcceleration(const size_t /*p_idx*/) const {return oldAngularAcceleration_;}
void setOldAngularAcceleration(const size_t /*p_idx*/, walberla::mesa_pd::Vec3 const & v) { oldAngularAcceleration_ = v;}
walberla::mesa_pd::Vec3& getOldAngularAccelerationRef(const size_t /*p_idx*/) {return oldAngularAcceleration_;}
int64_t const & getClusterID(const size_t /*p_idx*/) const {return clusterID_;} int64_t const & getClusterID(const size_t /*p_idx*/) const {return clusterID_;}
void setClusterID(const size_t /*p_idx*/, int64_t const & v) { clusterID_ = v;} void setClusterID(const size_t /*p_idx*/, int64_t const & v) { clusterID_ = v;}
int64_t& getClusterIDRef(const size_t /*p_idx*/) {return clusterID_;} int64_t& getClusterIDRef(const size_t /*p_idx*/) {return clusterID_;}
...@@ -389,6 +445,13 @@ private: ...@@ -389,6 +445,13 @@ private:
walberla::mesa_pd::Vec3 hydrodynamicTorque_; walberla::mesa_pd::Vec3 hydrodynamicTorque_;
walberla::mesa_pd::Vec3 oldHydrodynamicForce_; walberla::mesa_pd::Vec3 oldHydrodynamicForce_;
walberla::mesa_pd::Vec3 oldHydrodynamicTorque_; walberla::mesa_pd::Vec3 oldHydrodynamicTorque_;
walberla::real_t virtualMass_;
walberla::real_t invMassIncludingVirtual_;
walberla::mesa_pd::Vec3 oldLinearAcceleration_;
walberla::mesa_pd::Mat3 invInertiaBF_;
walberla::mesa_pd::Mat3 virtualInertiaBF_;
walberla::mesa_pd::Mat3 invInertiaBFIncludingVirtual_;
walberla::mesa_pd::Vec3 oldAngularAcceleration_;
int64_t clusterID_; int64_t clusterID_;
int64_t segmentID_; int64_t segmentID_;
std::unordered_set<walberla::mpi::MPIRank> neighborState_; std::unordered_set<walberla::mpi::MPIRank> neighborState_;
......
...@@ -37,7 +37,10 @@ public: ...@@ -37,7 +37,10 @@ public:
{} {}
const auto& getInvMass(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getInvMass();} const auto& getInvMass(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getInvMass();}
const auto& getMass(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getMass();}
const auto& getInvInertiaBF(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getInvInertiaBF();} const auto& getInvInertiaBF(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getInvInertiaBF();}
const auto& getInertiaBF(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getInertiaBF();}
const auto getVolume(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)]->getVolume();}
data::BaseShape* getShape(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)].get();} data::BaseShape* getShape(const size_t p_idx) const {return ss_->shapes[ps_->getShapeIDRef(p_idx)].get();}
private: private:
......
...@@ -100,6 +100,13 @@ public: ...@@ -100,6 +100,13 @@ public:
using hydrodynamicTorque_type = walberla::mesa_pd::Vec3; using hydrodynamicTorque_type = walberla::mesa_pd::Vec3;
using oldHydrodynamicForce_type = walberla::mesa_pd::Vec3; using oldHydrodynamicForce_type = walberla::mesa_pd::Vec3;
using oldHydrodynamicTorque_type = walberla::mesa_pd::Vec3; using oldHydrodynamicTorque_type = walberla::mesa_pd::Vec3;
using virtualMass_type = walberla::real_t;
using invMassIncludingVirtual_type = walberla::real_t;
using oldLinearAcceleration_type = walberla::mesa_pd::Vec3;
using invInertiaBF_type = walberla::mesa_pd::Mat3;
using virtualInertiaBF_type = walberla::mesa_pd::Mat3;
using invInertiaBFIncludingVirtual_type = walberla::mesa_pd::Mat3;
using oldAngularAcceleration_type = walberla::mesa_pd::Vec3;
using clusterID_type = int64_t; using clusterID_type = int64_t;
using segmentID_type = int64_t; using segmentID_type = int64_t;
using neighborState_type = std::unordered_set<walberla::mpi::MPIRank>; using neighborState_type = std::unordered_set<walberla::mpi::MPIRank>;
...@@ -221,6 +228,34 @@ public: ...@@ -221,6 +228,34 @@ public:
oldHydrodynamicTorque_type& getOldHydrodynamicTorqueRef() {return storage_.getOldHydrodynamicTorqueRef(i_);} oldHydrodynamicTorque_type& getOldHydrodynamicTorqueRef() {return storage_.getOldHydrodynamicTorqueRef(i_);}
void setOldHydrodynamicTorque(oldHydrodynamicTorque_type const & v) { storage_.setOldHydrodynamicTorque(i_, v);} void setOldHydrodynamicTorque(oldHydrodynamicTorque_type const & v) { storage_.setOldHydrodynamicTorque(i_, v);}
virtualMass_type const & getVirtualMass() const {return storage_.getVirtualMass(i_);}
virtualMass_type& getVirtualMassRef() {return storage_.getVirtualMassRef(i_);}
void setVirtualMass(virtualMass_type const & v) { storage_.setVirtualMass(i_, v);}
invMassIncludingVirtual_type const & getInvMassIncludingVirtual() const {return storage_.getInvMassIncludingVirtual(i_);}
invMassIncludingVirtual_type& getInvMassIncludingVirtualRef() {return storage_.getInvMassIncludingVirtualRef(i_);}
void setInvMassIncludingVirtual(invMassIncludingVirtual_type const & v) { storage_.setInvMassIncludingVirtual(i_, v);}
oldLinearAcceleration_type const & getOldLinearAcceleration() const {return storage_.getOldLinearAcceleration(i_);}
oldLinearAcceleration_type& getOldLinearAccelerationRef() {return storage_.getOldLinearAccelerationRef(i_);}
void setOldLinearAcceleration(oldLinearAcceleration_type const & v) { storage_.setOldLinearAcceleration(i_, v);}