Loading...
Searching...
No Matches
CubbyFlow::MPMFluidSystemData< N > Class Template Referencefinal

N-D weakly compressible MPM fluid transfer state. More...

#include <Core/Particle/MPM/MPMFluidSystemData.hpp>

Inheritance diagram for CubbyFlow::MPMFluidSystemData< N >:
CubbyFlow::MPMTransferSystemData< N > CubbyFlow::ParticleSystemData< N > CubbyFlow::Serializable

Public Types

using Base = MPMTransferSystemData< N >
 
using MatrixType = Matrix< double, N, N >
 
- Public Types inherited from CubbyFlow::MPMTransferSystemData< N >
using Base = ParticleSystemData< N >
 
- Public Types inherited from CubbyFlow::ParticleSystemData< N >
using ScalarData = Array1< double >
 Scalar data chunk.
 
using VectorData = Array1< Vector< double, N > >
 Vector data chunk.
 

Public Member Functions

 MPMFluidSystemData (const Vector< size_t, N > &resolution=Vector< size_t, N >::MakeConstant(1), const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1.0), const Vector< double, N > &gridOrigin=Vector< double, N >{}, size_t numberOfParticles=0)
 Constructs fluid MPM state with a vertex-centered background grid.
 
void Resize (size_t newNumberOfParticles) override
 Resizes particle state, initializing new fluid attributes.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes inherited particle state and resets fluid state.
 
void Set (const ParticleSystemData< N > &other) override
 Copies inherited particle state and resets fluid state.
 
ConstArrayView1< doubleVolumeRatios () const
 Returns current-to-reference particle volume ratios.
 
ArrayView1< doubleVolumeRatios ()
 Returns current-to-reference particle volume ratios.
 
ConstArrayView1< MatrixTypeVelocityGradients () const
 Returns particle velocity gradients interpolated from the grid.
 
ArrayView1< MatrixTypeVelocityGradients ()
 Returns particle velocity gradients interpolated from the grid.
 
void TransferFromGridToParticles (double timeStepInSeconds)
 
- Public Member Functions inherited from CubbyFlow::MPMTransferSystemData< N >
 MPMTransferSystemData (const Vector< size_t, N > &resolution=Vector< size_t, N >::MakeConstant(1), const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1.0), const Vector< double, N > &gridOrigin=Vector< double, N >{}, size_t numberOfParticles=0)
 Constructs transfer state with a vertex-centered background grid.
 
void Resize (size_t newNumberOfParticles) override
 Resizes particle state, initializing new transfer attributes.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes inherited particle state and resets transfer state.
 
void Set (const ParticleSystemData< N > &other) override
 Copies inherited particle state and resets transfer state.
 
void ResizeGrid (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin)
 Resizes the background grid without changing particle state.
 
ConstArrayView1< doubleParticleMasses () const
 Returns per-particle masses.
 
ArrayView1< doubleParticleMasses ()
 Returns per-particle masses.
 
ConstArrayView1< doubleInitialVolumes () const
 Returns per-particle initial volumes.
 
ArrayView1< doubleInitialVolumes ()
 Returns per-particle initial volumes.
 
const VertexCenteredScalarGrid< N > & GridMass () const
 Returns grid mass.
 
VertexCenteredScalarGrid< N > & GridMass ()
 Returns grid mass.
 
const VertexCenteredVectorGrid< N > & GridVelocities () const
 Returns current grid velocities.
 
VertexCenteredVectorGrid< N > & GridVelocities ()
 Returns current grid velocities.
 
const VertexCenteredVectorGrid< N > & GridVelocitiesBeforeUpdate () const
 Returns grid velocities before the grid update.
 
VertexCenteredVectorGrid< N > & GridVelocitiesBeforeUpdate ()
 Returns grid velocities before the grid update.
 
double FLIPBlendingFactor () const
 Returns the FLIP fraction used for grid-to-particle transfer.
 
void SetFLIPBlendingFactor (double factor)
 Sets the FLIP fraction used for grid-to-particle transfer.
 
void TransferFromParticlesToGrid ()
 
- Public Member Functions inherited from CubbyFlow::ParticleSystemData< N >
 ParticleSystemData ()
 Default constructor.
 
 ParticleSystemData (size_t numberOfParticles)
 Constructs particle system data with given number of particles.
 
 ~ParticleSystemData () override=default
 Default virtual destructor.
 
 ParticleSystemData (const ParticleSystemData &other)
 Copy constructor.
 
 ParticleSystemData (ParticleSystemData &&other) noexcept
 Move constructor.
 
ParticleSystemDataoperator= (const ParticleSystemData &other)
 Copy assignment operator.
 
ParticleSystemDataoperator= (ParticleSystemData &&other) noexcept
 Move assignment operator.
 
size_t NumberOfParticles () const
 Returns the number of particles.
 
size_t AddScalarData (double initialVal=0.0)
 Adds a scalar data layer and returns its index.
 
size_t AddVectorData (const Vector< double, N > &initialVal=Vector< double, N >{})
 Adds a vector data layer and returns its index.
 
double Radius () const
 Returns the radius of the particles.
 
virtual void SetRadius (double newRadius)
 Sets the radius of the particles.
 
double Mass () const
 Returns the mass of the particles.
 
virtual void SetMass (double newMass)
 Sets the mass of the particles.
 
ConstArrayView1< Vector< double, N > > Positions () const
 Returns the position array (immutable).
 
ArrayView1< Vector< double, N > > Positions ()
 Returns the position array (mutable).
 
ConstArrayView1< Vector< double, N > > Velocities () const
 Returns the velocity array (immutable).
 
ArrayView1< Vector< double, N > > Velocities ()
 Returns the velocity array (mutable).
 
ConstArrayView1< Vector< double, N > > Forces () const
 Returns the force array (immutable).
 
ArrayView1< Vector< double, N > > Forces ()
 Returns the force array (mutable).
 
ConstArrayView1< doubleScalarDataAt (size_t idx) const
 Returns custom scalar data layer at given index (immutable).
 
ArrayView1< doubleScalarDataAt (size_t idx)
 Returns custom scalar data layer at given index (mutable).
 
ConstArrayView1< Vector< double, N > > VectorDataAt (size_t idx) const
 Returns custom vector data layer at given index (immutable).
 
ArrayView1< Vector< double, N > > VectorDataAt (size_t idx)
 Returns custom vector data layer at given index (mutable).
 
void AddParticle (const Vector< double, N > &newPosition, const Vector< double, N > &newVelocity=Vector< double, N >(), const Vector< double, N > &newForce=Vector< double, N >())
 Adds a particle to the data structure.
 
void AddParticles (const ConstArrayView1< Vector< double, N > > &newPositions, const ConstArrayView1< Vector< double, N > > &newVelocities=ConstArrayView1< Vector< double, N > >(), const ConstArrayView1< Vector< double, N > > &newForces=ConstArrayView1< Vector< double, N > >())
 Adds particles to the data structure.
 
const std::shared_ptr< PointNeighborSearcher< N > > & NeighborSearcher () const
 Returns neighbor searcher.
 
void SetNeighborSearcher (const std::shared_ptr< PointNeighborSearcher< N > > &newNeighborSearcher)
 Sets neighbor searcher.
 
const Array1< Array1< size_t > > & NeighborLists () const
 Returns neighbor lists.
 
void BuildNeighborSearcher (double maxSearchRadius)
 Builds neighbor searcher with given search radius.
 
void BuildNeighborLists (double maxSearchRadius)
 Builds neighbor lists with given search radius.
 
void Serialize (std::vector< uint8_t > *buffer) const override
 Serializes this particle system data to the buffer.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes this particle system data from the buffer.
 
- Public Member Functions inherited from CubbyFlow::Serializable
 Serializable ()=default
 Default constructor.
 
 Serializable (const Serializable &)=default
 Default copy constructor.
 
 Serializable (Serializable &&) noexcept=default
 Default move constructor.
 
virtual ~Serializable ()=default
 Default virtual destructor.
 
Serializableoperator= (const Serializable &)=default
 Default copy assignment operator.
 
Serializableoperator= (Serializable &&) noexcept=default
 Default move assignment operator.
 

Additional Inherited Members

- Protected Member Functions inherited from CubbyFlow::MPMTransferSystemData< N >
void TransferFromGridToParticles ()
 
void ValidateGridState () const
 
void ValidateGridToParticleState () const
 
void TransferFromGridToParticlesUnchecked ()
 
Matrix< double, N, NComputeVelocityGradient (size_t particleIndex) const
 
- Static Protected Member Functions inherited from CubbyFlow::MPMTransferSystemData< N >
static Vector< size_t, NClampIndex (const Vector< ssize_t, N > &index, const Vector< size_t, N > &dataSize)
 
static bool IsFinite (const Vector< double, N > &value)
 
static void ValidateGridParameters (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin)
 
- Static Protected Member Functions inherited from CubbyFlow::ParticleSystemData< N >
template<size_t M = N>
static std::enable_if_t< M==2, voidSerialize (const ParticleSystemData< 2 > &particles, flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData2 > *fbsParticleSystemData)
 
template<size_t M = N>
static std::enable_if_t< M==3, voidSerialize (const ParticleSystemData< 3 > &particles, flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData3 > *fbsParticleSystemData)
 
template<size_t M = N>
static std::enable_if_t< M==2, voidDeserialize (const fbs::ParticleSystemData2 *fbsParticleSystemData, ParticleSystemData< 2 > &particles)
 
template<size_t M = N>
static std::enable_if_t< M==3, voidDeserialize (const fbs::ParticleSystemData3 *fbsParticleSystemData, ParticleSystemData< 3 > &particles)
 

Detailed Description

template<size_t N>
class CubbyFlow::MPMFluidSystemData< N >

N-D weakly compressible MPM fluid transfer state.

Stores the particle volume ratio and velocity gradient required by a fluid constitutive model without carrying snow deformation or plasticity state.

Member Typedef Documentation

◆ Base

◆ MatrixType

template<size_t N>
using CubbyFlow::MPMFluidSystemData< N >::MatrixType = Matrix<double, N, N>

Constructor & Destructor Documentation

◆ MPMFluidSystemData()

template<size_t N>
CubbyFlow::MPMFluidSystemData< N >::MPMFluidSystemData ( const Vector< size_t, N > &  resolution = Vector<size_tN>::MakeConstant(1),
const Vector< double, N > &  gridSpacing = Vector<doubleN>::MakeConstant(1.0),
const Vector< double, N > &  gridOrigin = Vector<doubleN>{},
size_t  numberOfParticles = 0 
)
explicit

Constructs fluid MPM state with a vertex-centered background grid.

Member Function Documentation

◆ Deserialize()

template<size_t N>
void CubbyFlow::MPMFluidSystemData< N >::Deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Deserializes inherited particle state and resets fluid state.

Implements CubbyFlow::Serializable.

◆ Resize()

template<size_t N>
void CubbyFlow::MPMFluidSystemData< N >::Resize ( size_t  newNumberOfParticles)
overridevirtual

Resizes particle state, initializing new fluid attributes.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ Set()

template<size_t N>
void CubbyFlow::MPMFluidSystemData< N >::Set ( const ParticleSystemData< N > &  other)
overridevirtual

Copies inherited particle state and resets fluid state.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ TransferFromGridToParticles()

template<size_t N>
void CubbyFlow::MPMFluidSystemData< N >::TransferFromGridToParticles ( double  timeStepInSeconds)

Transfers updated grid velocities and advances fluid kinematic state.

The volume ratio is updated by the determinant of the incremental deformation gradient, I + dt * velocityGradient.

◆ VelocityGradients() [1/2]

Returns particle velocity gradients interpolated from the grid.

◆ VelocityGradients() [2/2]

Returns particle velocity gradients interpolated from the grid.

◆ VolumeRatios() [1/2]

template<size_t N>
ArrayView1< double > CubbyFlow::MPMFluidSystemData< N >::VolumeRatios ( )

Returns current-to-reference particle volume ratios.

◆ VolumeRatios() [2/2]

template<size_t N>
ConstArrayView1< double > CubbyFlow::MPMFluidSystemData< N >::VolumeRatios ( ) const

Returns current-to-reference particle volume ratios.


The documentation for this class was generated from the following files: