Jet  v1.3.3
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
jet::PicSolver3 Class Reference

3-D Particle-in-Cell (PIC) implementation. More...

#include <jet/pic_solver3.h>

Inheritance diagram for jet::PicSolver3:
jet::GridFluidSolver3 jet::PhysicsAnimation jet::Animation jet::ApicSolver3 jet::FlipSolver3

Classes

class  Builder
 Front-end to create PicSolver3 objects step by step. More...
 

Public Member Functions

 PicSolver3 ()
 Default constructor. More...
 
 PicSolver3 (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~PicSolver3 ()
 Default destructor. More...
 
ScalarGrid3Ptr signedDistanceField () const
 Returns the signed-distance field of particles. More...
 
const ParticleSystemData3PtrparticleSystemData () const
 Returns the particle system data. More...
 
const ParticleEmitter3PtrparticleEmitter () const
 Returns the particle emitter. More...
 
void setParticleEmitter (const ParticleEmitter3Ptr &newEmitter)
 Sets the particle emitter. More...
 
- Public Member Functions inherited from jet::GridFluidSolver3
 GridFluidSolver3 ()
 Default constructor. More...
 
 GridFluidSolver3 (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~GridFluidSolver3 ()
 Default destructor. More...
 
const Vector3Dgravity () const
 Returns the gravity vector of the system. More...
 
void setGravity (const Vector3D &newGravity)
 Sets the gravity of the system. More...
 
double viscosityCoefficient () const
 Returns the viscosity coefficient. More...
 
void setViscosityCoefficient (double newValue)
 Sets the viscosity coefficient. More...
 
double cfl (double timeIntervalInSeconds) const
 Returns the CFL number from the current velocity field for given time interval. More...
 
double maxCfl () const
 Returns the max allowed CFL number. More...
 
void setMaxCfl (double newCfl)
 Sets the max allowed CFL number. More...
 
bool useCompressedLinearSystem () const
 Returns true if the solver is using compressed linear system. More...
 
void setUseCompressedLinearSystem (bool onoff)
 Sets whether the solver should use compressed linear system. More...
 
const AdvectionSolver3PtradvectionSolver () const
 Returns the advection solver instance. More...
 
void setAdvectionSolver (const AdvectionSolver3Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver3PtrdiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void setDiffusionSolver (const GridDiffusionSolver3Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver3PtrpressureSolver () const
 Returns the pressure solver instance. More...
 
void setPressureSolver (const GridPressureSolver3Ptr &newSolver)
 Sets the pressure solver. More...
 
int closedDomainBoundaryFlag () const
 Returns the closed domain boundary flag. More...
 
void setClosedDomainBoundaryFlag (int flag)
 Sets the closed domain boundary flag. More...
 
const GridSystemData3PtrgridSystemData () const
 Returns the grid system data. More...
 
void resizeGrid (const Size3 &newSize, const Vector3D &newGridSpacing, const Vector3D &newGridOrigin)
 Resizes grid system data. More...
 
Size3 resolution () const
 Returns the resolution of the grid system data. More...
 
Vector3D gridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector3D gridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid3Ptrvelocity () const
 Returns the velocity field. More...
 
const Collider3Ptrcollider () const
 Returns the collider. More...
 
void setCollider (const Collider3Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter3Ptremitter () const
 Returns the emitter. More...
 
void setEmitter (const GridEmitter3Ptr &newEmitter)
 Sets the emitter. More...
 
- Public Member Functions inherited from jet::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
virtual ~PhysicsAnimation ()
 Destructor. More...
 
bool isUsingFixedSubTimeSteps () const
 Returns true if fixed sub-timestepping is used. More...
 
void setIsUsingFixedSubTimeSteps (bool isUsing)
 Sets true if fixed sub-timestepping is used. More...
 
unsigned int numberOfFixedSubTimeSteps () const
 Returns the number of fixed sub-timesteps. More...
 
void setNumberOfFixedSubTimeSteps (unsigned int numberOfSteps)
 Sets the number of fixed sub-timesteps. More...
 
void advanceSingleFrame ()
 Advances a single frame. More...
 
Frame currentFrame () const
 Returns current frame. More...
 
void setCurrentFrame (const Frame &frame)
 Sets current frame cursor (but do not invoke update()). More...
 
double currentTimeInSeconds () const
 Returns current time in seconds. More...
 
- Public Member Functions inherited from jet::Animation
 Animation ()
 
virtual ~Animation ()
 
void update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

static Builder builder ()
 Returns builder fox PicSolver3. More...
 
- Static Public Member Functions inherited from jet::GridFluidSolver3
static Builder builder ()
 Returns builder fox GridFluidSolver3. More...
 

Protected Member Functions

void onInitialize () override
 Initializes the simulator. More...
 
void onBeginAdvanceTimeStep (double timeIntervalInSeconds) override
 Invoked before a simulation time-step begins. More...
 
void computeAdvection (double timeIntervalInSeconds) override
 Computes the advection term of the fluid solver. More...
 
ScalarField3Ptr fluidSdf () const override
 Returns the signed-distance field of the fluid. More...
 
virtual void transferFromParticlesToGrids ()
 Transfers velocity field from particles to grids. More...
 
virtual void transferFromGridsToParticles ()
 Transfers velocity field from grids to particles. More...
 
virtual void moveParticles (double timeIntervalInSeconds)
 Moves particles. More...
 
- Protected Member Functions inherited from jet::GridFluidSolver3
void onAdvanceTimeStep (double timeIntervalInSeconds) override
 Called when advancing a single time-step. More...
 
unsigned int numberOfSubTimeSteps (double timeIntervalInSeconds) const override
 Returns the required sub-time-steps for given time interval. More...
 
virtual void onEndAdvanceTimeStep (double timeIntervalInSeconds)
 Called at the end of a time-step. More...
 
virtual void computeExternalForces (double timeIntervalInSeconds)
 Computes the external force terms. More...
 
virtual void computeViscosity (double timeIntervalInSeconds)
 Computes the viscosity term using the diffusion solver. More...
 
virtual void computePressure (double timeIntervalInSeconds)
 Computes the pressure term using the pressure solver. More...
 
void computeGravity (double timeIntervalInSeconds)
 Computes the gravity term. More...
 
void applyBoundaryCondition ()
 Applies the boundary condition to the velocity field. More...
 
void extrapolateIntoCollider (ScalarGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void extrapolateIntoCollider (CollocatedVectorGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void extrapolateIntoCollider (FaceCenteredGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
ScalarField3Ptr colliderSdf () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField3Ptr colliderVelocityField () const
 Returns the velocity field of the collider. More...
 

Protected Attributes

Array3< char > _uMarkers
 
Array3< char > _vMarkers
 
Array3< char > _wMarkers
 

Detailed Description

3-D Particle-in-Cell (PIC) implementation.

This class implements 3-D Particle-in-Cell (PIC) method by inheriting GridFluidSolver3. Since it is a grid-particle hybrid method, the solver also has a particle system to track fluid particles.

See also
Zhu, Yongning, and Robert Bridson. "Animating sand as a fluid." ACM Transactions on Graphics (TOG). Vol. 34. No. 3. ACM, 3005.

Constructor & Destructor Documentation

◆ PicSolver3() [1/2]

jet::PicSolver3::PicSolver3 ( )

Default constructor.

◆ PicSolver3() [2/2]

jet::PicSolver3::PicSolver3 ( const Size3 resolution,
const Vector3D gridSpacing,
const Vector3D gridOrigin 
)

Constructs solver with initial grid size.

◆ ~PicSolver3()

virtual jet::PicSolver3::~PicSolver3 ( )
virtual

Default destructor.

Member Function Documentation

◆ builder()

static Builder jet::PicSolver3::builder ( )
static

Returns builder fox PicSolver3.

◆ computeAdvection()

void jet::PicSolver3::computeAdvection ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Computes the advection term of the fluid solver.

Reimplemented from jet::GridFluidSolver3.

◆ fluidSdf()

ScalarField3Ptr jet::PicSolver3::fluidSdf ( ) const
overrideprotectedvirtual

Returns the signed-distance field of the fluid.

Reimplemented from jet::GridFluidSolver3.

◆ moveParticles()

virtual void jet::PicSolver3::moveParticles ( double  timeIntervalInSeconds)
protectedvirtual

Moves particles.

◆ onBeginAdvanceTimeStep()

void jet::PicSolver3::onBeginAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Invoked before a simulation time-step begins.

Reimplemented from jet::GridFluidSolver3.

◆ onInitialize()

void jet::PicSolver3::onInitialize ( )
overrideprotectedvirtual

Initializes the simulator.

Reimplemented from jet::GridFluidSolver3.

◆ particleEmitter()

const ParticleEmitter3Ptr& jet::PicSolver3::particleEmitter ( ) const

Returns the particle emitter.

◆ particleSystemData()

const ParticleSystemData3Ptr& jet::PicSolver3::particleSystemData ( ) const

Returns the particle system data.

◆ setParticleEmitter()

void jet::PicSolver3::setParticleEmitter ( const ParticleEmitter3Ptr newEmitter)

Sets the particle emitter.

◆ signedDistanceField()

ScalarGrid3Ptr jet::PicSolver3::signedDistanceField ( ) const

Returns the signed-distance field of particles.

◆ transferFromGridsToParticles()

virtual void jet::PicSolver3::transferFromGridsToParticles ( )
protectedvirtual

Transfers velocity field from grids to particles.

Reimplemented in jet::FlipSolver3, and jet::ApicSolver3.

◆ transferFromParticlesToGrids()

virtual void jet::PicSolver3::transferFromParticlesToGrids ( )
protectedvirtual

Transfers velocity field from particles to grids.

Reimplemented in jet::FlipSolver3, and jet::ApicSolver3.

Member Data Documentation

◆ _uMarkers

Array3<char> jet::PicSolver3::_uMarkers
protected

◆ _vMarkers

Array3<char> jet::PicSolver3::_vMarkers
protected

◆ _wMarkers

Array3<char> jet::PicSolver3::_wMarkers
protected

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