Level set based 2-D liquid solver. More...

#include <Core/Solver/LevelSet/LevelSetLiquidSolver2.hpp>

Inheritance diagram for CubbyFlow::LevelSetLiquidSolver2:
CubbyFlow::GridFluidSolver2 CubbyFlow::PhysicsAnimation CubbyFlow::Animation

Classes

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

Public Member Functions

 LevelSetLiquidSolver2 ()
 Default constructor. More...
 
 LevelSetLiquidSolver2 (const Vector2UZ &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
 LevelSetLiquidSolver2 (const LevelSetLiquidSolver2 &)=delete
 Deleted copy constructor. More...
 
 LevelSetLiquidSolver2 (LevelSetLiquidSolver2 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~LevelSetLiquidSolver2 () override=default
 Default virtual destructor. More...
 
LevelSetLiquidSolver2operator= (const LevelSetLiquidSolver2 &)=delete
 Deleted copy assignment operator. More...
 
LevelSetLiquidSolver2operator= (LevelSetLiquidSolver2 &&) noexcept=delete
 Deleted move assignment operator. More...
 
ScalarGrid2Ptr GetSignedDistanceField () const
 Returns signed-distance field. More...
 
LevelSetSolver2Ptr GetLevelSetSolver () const
 Returns the level set solver. More...
 
void SetLevelSetSolver (const LevelSetSolver2Ptr &newSolver)
 Sets the level set solver. More...
 
void SetMinReinitializeDistance (double distance)
 Sets minimum reinitialization distance. More...
 
void SetIsGlobalCompensationEnabled (bool isEnabled)
 Enables (or disables) global compensation feature flag. More...
 
double ComputeVolume () const
 Returns liquid volume measured by smeared Heaviside function. More...
 
- Public Member Functions inherited from CubbyFlow::GridFluidSolver2
 GridFluidSolver2 ()
 Default constructor. More...
 
 GridFluidSolver2 (const Vector2UZ &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
 GridFluidSolver2 (const GridFluidSolver2 &)=delete
 Deleted copy constructor. More...
 
 GridFluidSolver2 (GridFluidSolver2 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~GridFluidSolver2 () override=default
 Default virtual destructor. More...
 
GridFluidSolver2operator= (const GridFluidSolver2 &)=delete
 Deleted copy assignment operator. More...
 
GridFluidSolver2operator= (GridFluidSolver2 &&) noexcept=delete
 Deleted move assignment operator. More...
 
const Vector2DGetGravity () const
 Returns the gravity vector of the system. More...
 
void SetGravity (const Vector2D &newGravity)
 Sets the gravity of the system. More...
 
double GetViscosityCoefficient () const
 Returns the viscosity coefficient. More...
 
void SetViscosityCoefficient (double newValue)
 Sets the viscosity coefficient. More...
 
double GetCFL (double timeIntervalInSeconds) const
 Returns the CFL number from the current velocity field for given time interval. More...
 
double GetMaxCFL () const
 Returns the max allowed CFL number. More...
 
void SetMaxCFL (double newCFL)
 Sets the max allowed CFL number. More...
 
bool GetUseCompressedLinearSystem () const
 Returns true if the solver is using compressed linear system. More...
 
void SetUseCompressedLinearSystem (bool isOn)
 Sets whether the solver should use compressed linear system. More...
 
const AdvectionSolver2PtrGetAdvectionSolver () const
 Returns the advection solver instance. More...
 
void SetAdvectionSolver (const AdvectionSolver2Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver2PtrGetDiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void SetDiffusionSolver (const GridDiffusionSolver2Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver2PtrGetPressureSolver () const
 Returns the pressure solver instance. More...
 
void SetPressureSolver (const GridPressureSolver2Ptr &newSolver)
 Sets the pressure solver. More...
 
int GetClosedDomainBoundaryFlag () const
 Returns the closed domain boundary flag. More...
 
void SetClosedDomainBoundaryFlag (int flag)
 Sets the closed domain boundary flag. More...
 
const GridSystemData2PtrGetGridSystemData () const
 Returns the grid system data. More...
 
void ResizeGrid (const Vector2UZ &newSize, const Vector2D &newGridSpacing, const Vector2D &newGridOrigin) const
 Resizes grid system data. More...
 
Vector2UZ GetResolution () const
 Returns the resolution of the grid system data. More...
 
Vector2D GetGridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector2D GetGridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid2PtrGetVelocity () const
 Returns the velocity field. More...
 
const Collider2PtrGetCollider () const
 Returns the collider. More...
 
void SetCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter2PtrGetEmitter () const
 Returns the emitter. More...
 
void SetEmitter (const GridEmitter2Ptr &newEmitter)
 Sets the emitter. More...
 
- Public Member Functions inherited from CubbyFlow::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
 PhysicsAnimation (const PhysicsAnimation &)=default
 Default copy constructor. More...
 
 PhysicsAnimation (PhysicsAnimation &&) noexcept=default
 Default move constructor. More...
 
virtual ~PhysicsAnimation ()=default
 Default virtual destructor. More...
 
PhysicsAnimationoperator= (const PhysicsAnimation &)=default
 Default copy assignment operator. More...
 
PhysicsAnimationoperator= (PhysicsAnimation &&) noexcept=default
 Default move assignment operator. More...
 
bool GetIsUsingFixedSubTimeSteps () 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 GetNumberOfFixedSubTimeSteps () 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 GetCurrentFrame () const
 Returns current frame. More...
 
void SetCurrentFrame (const Frame &frame)
 Sets current frame cursor (but do not invoke update()). More...
 
double GetCurrentTimeInSeconds () const
 Returns current time in seconds. More...
 
- Public Member Functions inherited from CubbyFlow::Animation
 Animation ()=default
 Default constructor. More...
 
 Animation (const Animation &)=default
 Default copy constructor. More...
 
 Animation (Animation &&) noexcept=default
 Default move constructor. More...
 
virtual ~Animation ()=default
 Default virtual destructor. More...
 
Animationoperator= (const Animation &)=default
 Default copy assignment operator. More...
 
Animationoperator= (Animation &&) noexcept=default
 Default move assignment operator. More...
 
void Update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder fox LevelSetLiquidSolver2. More...
 
- Static Public Member Functions inherited from CubbyFlow::GridFluidSolver2
static Builder GetBuilder ()
 Returns builder fox GridFluidSolver2. More...
 

Protected Member Functions

void OnBeginAdvanceTimeStep (double timeIntervalInSeconds) override
 Called at the beginning of the time-step. More...
 
void OnEndAdvanceTimeStep (double timeIntervalInSeconds) override
 Called at the end of the time-step. More...
 
void ComputeAdvection (double timeIntervalInSeconds) override
 Customizes advection step. More...
 
ScalarField2Ptr GetFluidSDF () const override
 Returns fluid region as a signed-distance field. More...
 
- Protected Member Functions inherited from CubbyFlow::GridFluidSolver2
void OnInitialize () override
 Called when it needs to setup initial condition. More...
 
void OnAdvanceTimeStep (double timeIntervalInSeconds) override
 Called when advancing a single time-step. More...
 
unsigned int GetNumberOfSubTimeSteps (double timeIntervalInSeconds) const override
 Returns the required sub-time-steps for given time interval. 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 () const
 Applies the boundary condition to the velocity field. More...
 
void ExtrapolateIntoCollider (ScalarGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (CollocatedVectorGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (FaceCenteredGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
ScalarField2Ptr GetColliderSDF () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField2Ptr GetColliderVelocityField () const
 Returns the velocity field of the collider. More...
 

Detailed Description

Level set based 2-D liquid solver.

This class implements level set-based 2-D liquid solver. It defines the surface of the liquid using signed-distance field and use stable fluids framework to compute the forces.

See also
Enright, Douglas, Stephen Marschner, and Ronald Fedkiw. "Animation and rendering of complex water surfaces." ACM Transactions on Graphics (TOG). Vol. 21. No. 3. ACM, 2002.

Constructor & Destructor Documentation

◆ LevelSetLiquidSolver2() [1/4]

CubbyFlow::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( )

Default constructor.

◆ LevelSetLiquidSolver2() [2/4]

CubbyFlow::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( const Vector2UZ resolution,
const Vector2D gridSpacing,
const Vector2D gridOrigin 
)

Constructs solver with initial grid size.

◆ LevelSetLiquidSolver2() [3/4]

CubbyFlow::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( const LevelSetLiquidSolver2 )
delete

Deleted copy constructor.

◆ LevelSetLiquidSolver2() [4/4]

CubbyFlow::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( LevelSetLiquidSolver2 &&  )
deletenoexcept

Deleted move constructor.

◆ ~LevelSetLiquidSolver2()

CubbyFlow::LevelSetLiquidSolver2::~LevelSetLiquidSolver2 ( )
overridedefault

Default virtual destructor.

Member Function Documentation

◆ ComputeAdvection()

void CubbyFlow::LevelSetLiquidSolver2::ComputeAdvection ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Customizes advection step.

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ ComputeVolume()

double CubbyFlow::LevelSetLiquidSolver2::ComputeVolume ( ) const

Returns liquid volume measured by smeared Heaviside function.

This function measures the liquid volume (area in 2-D) using smeared Heaviside function. Thus, the estimated volume is an approximated quantity.

◆ GetBuilder()

static Builder CubbyFlow::LevelSetLiquidSolver2::GetBuilder ( )
static

Returns builder fox LevelSetLiquidSolver2.

◆ GetFluidSDF()

ScalarField2Ptr CubbyFlow::LevelSetLiquidSolver2::GetFluidSDF ( ) const
overrideprotectedvirtual

Returns fluid region as a signed-distance field.

This function returns fluid region as a signed-distance field. For this particular class, it returns the same field as the function LevelSetLiquidSolver2::signedDistanceField().

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ GetLevelSetSolver()

LevelSetSolver2Ptr CubbyFlow::LevelSetLiquidSolver2::GetLevelSetSolver ( ) const

Returns the level set solver.

◆ GetSignedDistanceField()

ScalarGrid2Ptr CubbyFlow::LevelSetLiquidSolver2::GetSignedDistanceField ( ) const

Returns signed-distance field.

◆ OnBeginAdvanceTimeStep()

void CubbyFlow::LevelSetLiquidSolver2::OnBeginAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Called at the beginning of the time-step.

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ OnEndAdvanceTimeStep()

void CubbyFlow::LevelSetLiquidSolver2::OnEndAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Called at the end of the time-step.

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ operator=() [1/2]

LevelSetLiquidSolver2& CubbyFlow::LevelSetLiquidSolver2::operator= ( const LevelSetLiquidSolver2 )
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

LevelSetLiquidSolver2& CubbyFlow::LevelSetLiquidSolver2::operator= ( LevelSetLiquidSolver2 &&  )
deletenoexcept

Deleted move assignment operator.

◆ SetIsGlobalCompensationEnabled()

void CubbyFlow::LevelSetLiquidSolver2::SetIsGlobalCompensationEnabled ( bool  isEnabled)

Enables (or disables) global compensation feature flag.

When isEnabled is true, the global compensation feature is enabled. The global compensation measures the volume at the beginning and the end of the time-step and adds the volume change back to the level-set field by globally shifting the front.

See also
Song, Oh-Young, Hyuncheol Shin, and Hyeong-Seok Ko. "Stable but non-dissipative water." ACM Transactions on Graphics (TOG) 24, no. 1 (2005): 81-97.

◆ SetLevelSetSolver()

void CubbyFlow::LevelSetLiquidSolver2::SetLevelSetSolver ( const LevelSetSolver2Ptr newSolver)

Sets the level set solver.

◆ SetMinReinitializeDistance()

void CubbyFlow::LevelSetLiquidSolver2::SetMinReinitializeDistance ( double  distance)

Sets minimum reinitialization distance.


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