CubbyFlow::SemiLagrangian2 Class Reference

Implementation of 2-D semi-Lagrangian advection solver. More...

#include <Core/Solver/Advection/SemiLagrangian2.hpp>

Inheritance diagram for CubbyFlow::SemiLagrangian2:
CubbyFlow::AdvectionSolver2 CubbyFlow::CubicSemiLagrangian2

Public Member Functions

 SemiLagrangian2 ()=default
 Default constructor. More...
 
 SemiLagrangian2 (const SemiLagrangian2 &)=default
 Default copy constructor. More...
 
 SemiLagrangian2 (SemiLagrangian2 &&) noexcept=default
 Default move constructor. More...
 
 ~SemiLagrangian2 () override=default
 Virtual default destructor. More...
 
SemiLagrangian2operator= (const SemiLagrangian2 &)=default
 Default copy assignment operator. More...
 
SemiLagrangian2operator= (SemiLagrangian2 &&) noexcept=default
 Default move assignment operator. More...
 
void Advect (const ScalarGrid2 &input, const VectorField2 &flow, double dt, ScalarGrid2 *output, const ScalarField2 &boundarySDF=ConstantScalarField2(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given scalar grid. More...
 
void Advect (const CollocatedVectorGrid2 &input, const VectorField2 &flow, double dt, CollocatedVectorGrid2 *output, const ScalarField2 &boundarySDF=ConstantScalarField2(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given collocated vector grid. More...
 
void Advect (const FaceCenteredGrid2 &input, const VectorField2 &flow, double dt, FaceCenteredGrid2 *output, const ScalarField2 &boundarySDF=ConstantScalarField2(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given face-centered vector grid. More...
 
- Public Member Functions inherited from CubbyFlow::AdvectionSolver2
 AdvectionSolver2 ()=default
 Default constructor. More...
 
 AdvectionSolver2 (const AdvectionSolver2 &)=default
 Default copy constructor. More...
 
 AdvectionSolver2 (AdvectionSolver2 &&) noexcept=default
 Default move constructor. More...
 
virtual ~AdvectionSolver2 ()=default
 Default virtual destructor. More...
 
AdvectionSolver2operator= (const AdvectionSolver2 &)=default
 Default copy assignment operator. More...
 
AdvectionSolver2operator= (AdvectionSolver2 &&) noexcept=default
 Default move assignment operator. More...
 

Protected Member Functions

virtual std::function< double(const Vector2D &)> GetScalarSamplerFunc (const ScalarGrid2 &input) const
 Returns spatial interpolation function object for given scalar grid. More...
 
virtual std::function< Vector2D(const Vector2D &)> GetVectorSamplerFunc (const CollocatedVectorGrid2 &input) const
 Returns spatial interpolation function object for given collocated vector grid. More...
 
virtual std::function< Vector2D(const Vector2D &)> GetVectorSamplerFunc (const FaceCenteredGrid2 &input) const
 Returns spatial interpolation function object for given face-centered vector grid. More...
 

Detailed Description

Implementation of 2-D semi-Lagrangian advection solver.

This class implements 2-D semi-Lagrangian advection solver. By default, the class implements 1st-order (linear) algorithm for the spatial interpolation. For the back-tracing, this class uses 2nd-order mid-point rule with adaptive time-stepping (CFL <= 1). To extend the class using higher-order spatial interpolation, the inheriting classes can override SemiLagrangian2::getScalarSamplerFunc and SemiLagrangian2::getVectorSamplerFunc. See CubicSemiLagrangian2 for example.

Constructor & Destructor Documentation

◆ SemiLagrangian2() [1/3]

CubbyFlow::SemiLagrangian2::SemiLagrangian2 ( )
default

Default constructor.

◆ SemiLagrangian2() [2/3]

CubbyFlow::SemiLagrangian2::SemiLagrangian2 ( const SemiLagrangian2 )
default

Default copy constructor.

◆ SemiLagrangian2() [3/3]

CubbyFlow::SemiLagrangian2::SemiLagrangian2 ( SemiLagrangian2 &&  )
defaultnoexcept

Default move constructor.

◆ ~SemiLagrangian2()

CubbyFlow::SemiLagrangian2::~SemiLagrangian2 ( )
overridedefault

Virtual default destructor.

Member Function Documentation

◆ Advect() [1/3]

void CubbyFlow::SemiLagrangian2::Advect ( const ScalarGrid2 input,
const VectorField2 flow,
double  dt,
ScalarGrid2 output,
const ScalarField2 boundarySDF = ConstantScalarField2(std::numeric_limits< double >::max()) 
)
finalvirtual

Computes semi-Lagrangian for given scalar grid.

This function computes semi-Lagrangian method to solve advection equation for given scalar field input and underlying vector field flow that carries the input field. The solution after solving the equation for given time-step dt should be stored in scalar field output. The boundary interface is given by a signed-distance field. The field is negative inside the boundary. By default, a constant field with max double value (std::numeric_limits<double>::max()) is used, meaning no boundary.

Parameters
inputInput scalar grid.
flowVector field that advects the input field.
dtTime-step for the advection.
outputOutput scalar grid.
boundarySDFBoundary interface defined by signed-distance field.

Implements CubbyFlow::AdvectionSolver2.

◆ Advect() [2/3]

void CubbyFlow::SemiLagrangian2::Advect ( const CollocatedVectorGrid2 input,
const VectorField2 flow,
double  dt,
CollocatedVectorGrid2 output,
const ScalarField2 boundarySDF = ConstantScalarField2(std::numeric_limits< double >::max()) 
)
finalvirtual

Computes semi-Lagrangian for given collocated vector grid.

This function computes semi-Lagrangian method to solve advection equation for given collocated vector grid input and underlying vector field flow that carries the input field. The solution after solving the equation for given time-step dt should be stored in scala1r field output. The boundary interface is given by a signed-distance field. The field is negative inside the boundary. By default, a constant field with max double value (std::numeric_limits<double>::max()) is used, meaning no boundary.

Parameters
inputInput vector grid.
flowVector field that advects the input field.
dtTime-step for the advection.
outputOutput vector grid.
boundarySDFBoundary interface defined by signed-distance field.

Reimplemented from CubbyFlow::AdvectionSolver2.

◆ Advect() [3/3]

void CubbyFlow::SemiLagrangian2::Advect ( const FaceCenteredGrid2 input,
const VectorField2 flow,
double  dt,
FaceCenteredGrid2 output,
const ScalarField2 boundarySDF = ConstantScalarField2(std::numeric_limits< double >::max()) 
)
finalvirtual

Computes semi-Lagrangian for given face-centered vector grid.

This function computes semi-Lagrangian method to solve advection equation for given face-centered vector grid input and underlying vector field flow that carries the input field. The solution after solving the equation for given time-step dt should be stored in vector field output. The boundary interface is given by a signed-distance field. The field is negative inside the boundary. By default, a constant field with max double value (std::numeric_limits<double>::max()) is used, meaning no boundary.

Parameters
inputInput vector grid.
flowVector field that advects the input field.
dtTime-step for the advection.
outputOutput vector grid.
boundarySDFBoundary interface defined by signed-distance field.

Reimplemented from CubbyFlow::AdvectionSolver2.

◆ GetScalarSamplerFunc()

virtual std::function<double(const Vector2D&)> CubbyFlow::SemiLagrangian2::GetScalarSamplerFunc ( const ScalarGrid2 input) const
protectedvirtual

Returns spatial interpolation function object for given scalar grid.

This function returns spatial interpolation function (sampler) for given scalar grid input. By default, this function returns linear interpolation function. Override this function to have custom interpolation for semi-Lagrangian process.

Reimplemented in CubbyFlow::CubicSemiLagrangian2.

◆ GetVectorSamplerFunc() [1/2]

virtual std::function<Vector2D(const Vector2D&)> CubbyFlow::SemiLagrangian2::GetVectorSamplerFunc ( const CollocatedVectorGrid2 input) const
protectedvirtual

Returns spatial interpolation function object for given collocated vector grid.

This function returns spatial interpolation function (sampler) for given collocated vector grid input. By default, this function returns linear interpolation function. Override this function to have custom interpolation for semi-Lagrangian process.

Reimplemented in CubbyFlow::CubicSemiLagrangian2.

◆ GetVectorSamplerFunc() [2/2]

virtual std::function<Vector2D(const Vector2D&)> CubbyFlow::SemiLagrangian2::GetVectorSamplerFunc ( const FaceCenteredGrid2 input) const
protectedvirtual

Returns spatial interpolation function object for given face-centered vector grid.

This function returns spatial interpolation function (sampler) for given face-centered vector grid input. By default, this function returns linear interpolation function. Override this function to have custom interpolation for semi-Lagrangian process.

Reimplemented in CubbyFlow::CubicSemiLagrangian2.

◆ operator=() [1/2]

SemiLagrangian2& CubbyFlow::SemiLagrangian2::operator= ( const SemiLagrangian2 )
default

Default copy assignment operator.

◆ operator=() [2/2]

SemiLagrangian2& CubbyFlow::SemiLagrangian2::operator= ( SemiLagrangian2 &&  )
defaultnoexcept

Default move assignment operator.


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