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

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

#include <jet/level_set_liquid_solver2.h>

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

Classes

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

Public Member Functions

 LevelSetLiquidSolver2 ()
 Default constructor. More...
 
 LevelSetLiquidSolver2 (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~LevelSetLiquidSolver2 ()
 Destructor. More...
 
ScalarGrid2Ptr signedDistanceField () const
 Returns signed-distance field. More...
 
LevelSetSolver2Ptr levelSetSolver () 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 jet::GridFluidSolver2
 GridFluidSolver2 ()
 Default constructor. More...
 
 GridFluidSolver2 (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~GridFluidSolver2 ()
 Default destructor. More...
 
const Vector2Dgravity () const
 Returns the gravity vector of the system. More...
 
void setGravity (const Vector2D &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 AdvectionSolver2PtradvectionSolver () const
 Returns the advection solver instance. More...
 
void setAdvectionSolver (const AdvectionSolver2Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver2PtrdiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void setDiffusionSolver (const GridDiffusionSolver2Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver2PtrpressureSolver () const
 Returns the pressure solver instance. More...
 
void setPressureSolver (const GridPressureSolver2Ptr &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 GridSystemData2PtrgridSystemData () const
 Returns the grid system data. More...
 
void resizeGrid (const Size2 &newSize, const Vector2D &newGridSpacing, const Vector2D &newGridOrigin)
 Resizes grid system data. More...
 
Size2 resolution () const
 Returns the resolution of the grid system data. More...
 
Vector2D gridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector2D gridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid2Ptrvelocity () const
 Returns the velocity field. More...
 
const Collider2Ptrcollider () const
 Returns the collider. More...
 
void setCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter2Ptremitter () const
 Returns the emitter. More...
 
void setEmitter (const GridEmitter2Ptr &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 LevelSetLiquidSolver2. More...
 
- Static Public Member Functions inherited from jet::GridFluidSolver2
static Builder builder ()
 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 fluidSdf () const override
 Returns fluid region as a signed-distance field. More...
 
- Protected Member Functions inherited from jet::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 numberOfSubTimeSteps (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 ()
 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 colliderSdf () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField2Ptr colliderVelocityField () 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/2]

jet::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( )

Default constructor.

◆ LevelSetLiquidSolver2() [2/2]

jet::LevelSetLiquidSolver2::LevelSetLiquidSolver2 ( const Size2 resolution,
const Vector2D gridSpacing,
const Vector2D gridOrigin 
)

Constructs solver with initial grid size.

◆ ~LevelSetLiquidSolver2()

virtual jet::LevelSetLiquidSolver2::~LevelSetLiquidSolver2 ( )
virtual

Destructor.

Member Function Documentation

◆ builder()

static Builder jet::LevelSetLiquidSolver2::builder ( )
static

Returns builder fox LevelSetLiquidSolver2.

◆ computeAdvection()

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

Customizes advection step.

Reimplemented from jet::GridFluidSolver2.

◆ computeVolume()

double jet::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.

◆ fluidSdf()

ScalarField2Ptr jet::LevelSetLiquidSolver2::fluidSdf ( ) 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 jet::GridFluidSolver2.

◆ levelSetSolver()

LevelSetSolver2Ptr jet::LevelSetLiquidSolver2::levelSetSolver ( ) const

Returns the level set solver.

◆ onBeginAdvanceTimeStep()

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

Called at the beginning of the time-step.

Reimplemented from jet::GridFluidSolver2.

◆ onEndAdvanceTimeStep()

void jet::LevelSetLiquidSolver2::onEndAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Called at the end of the time-step.

Reimplemented from jet::GridFluidSolver2.

◆ setIsGlobalCompensationEnabled()

void jet::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 nondissipative water." ACM Transactions on Graphics (TOG) 24, no. 1 (2005): 81-97.

◆ setLevelSetSolver()

void jet::LevelSetLiquidSolver2::setLevelSetSolver ( const LevelSetSolver2Ptr newSolver)

Sets the level set solver.

◆ setMinReinitializeDistance()

void jet::LevelSetLiquidSolver2::setMinReinitializeDistance ( double  distance)

Sets minimum reinitialization distance.

◆ signedDistanceField()

ScalarGrid2Ptr jet::LevelSetLiquidSolver2::signedDistanceField ( ) const

Returns signed-distance field.


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