CubbyFlow::SemiLagrangian3 Class Reference

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

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

Inheritance diagram for CubbyFlow::SemiLagrangian3:
CubbyFlow::AdvectionSolver3 CubbyFlow::CubicSemiLagrangian3

Public Member Functions

 SemiLagrangian3 ()=default
 Default constructor. More...
 
 SemiLagrangian3 (const SemiLagrangian3 &)=default
 Default copy constructor. More...
 
 SemiLagrangian3 (SemiLagrangian3 &&) noexcept=default
 Default move constructor. More...
 
 ~SemiLagrangian3 () override=default
 Virtual default destructor. More...
 
SemiLagrangian3operator= (const SemiLagrangian3 &)=default
 Default copy assignment operator. More...
 
SemiLagrangian3operator= (SemiLagrangian3 &&) noexcept=default
 Default move assignment operator. More...
 
void Advect (const ScalarGrid3 &input, const VectorField3 &flow, double dt, ScalarGrid3 *output, const ScalarField3 &boundarySDF=ConstantScalarField3(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given scalar grid. More...
 
void Advect (const CollocatedVectorGrid3 &input, const VectorField3 &flow, double dt, CollocatedVectorGrid3 *output, const ScalarField3 &boundarySDF=ConstantScalarField3(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given collocated vector grid. More...
 
void Advect (const FaceCenteredGrid3 &input, const VectorField3 &flow, double dt, FaceCenteredGrid3 *output, const ScalarField3 &boundarySDF=ConstantScalarField3(std::numeric_limits< double >::max())) final
 Computes semi-Lagrangian for given face-centered vector grid. More...
 
- Public Member Functions inherited from CubbyFlow::AdvectionSolver3
 AdvectionSolver3 ()=default
 Default constructor. More...
 
 AdvectionSolver3 (const AdvectionSolver3 &)=default
 Default copy constructor. More...
 
 AdvectionSolver3 (AdvectionSolver3 &&) noexcept=default
 Default move constructor. More...
 
virtual ~AdvectionSolver3 ()=default
 Default virtual destructor. More...
 
AdvectionSolver3operator= (const AdvectionSolver3 &)=default
 Default copy assignment operator. More...
 
AdvectionSolver3operator= (AdvectionSolver3 &&) noexcept=default
 Default move assignment operator. More...
 

Protected Member Functions

virtual std::function< double(const Vector3D &)> GetScalarSamplerFunc (const ScalarGrid3 &input) const
 Returns spatial interpolation function object for given scalar grid. More...
 
virtual std::function< Vector3D(const Vector3D &)> GetVectorSamplerFunc (const CollocatedVectorGrid3 &input) const
 Returns spatial interpolation function object for given collocated vector grid. More...
 
virtual std::function< Vector3D(const Vector3D &)> GetVectorSamplerFunc (const FaceCenteredGrid3 &input) const
 Returns spatial interpolation function object for given face-centered vector grid. More...
 

Detailed Description

Implementation of 3-D semi-Lagrangian advection solver.

This class implements 3-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

◆ SemiLagrangian3() [1/3]

CubbyFlow::SemiLagrangian3::SemiLagrangian3 ( )
default

Default constructor.

◆ SemiLagrangian3() [2/3]

CubbyFlow::SemiLagrangian3::SemiLagrangian3 ( const SemiLagrangian3 )
default

Default copy constructor.

◆ SemiLagrangian3() [3/3]

CubbyFlow::SemiLagrangian3::SemiLagrangian3 ( SemiLagrangian3 &&  )
defaultnoexcept

Default move constructor.

◆ ~SemiLagrangian3()

CubbyFlow::SemiLagrangian3::~SemiLagrangian3 ( )
overridedefault

Virtual default destructor.

Member Function Documentation

◆ Advect() [1/3]

void CubbyFlow::SemiLagrangian3::Advect ( const ScalarGrid3 input,
const VectorField3 flow,
double  dt,
ScalarGrid3 output,
const ScalarField3 boundarySDF = ConstantScalarField3(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::AdvectionSolver3.

◆ Advect() [2/3]

void CubbyFlow::SemiLagrangian3::Advect ( const CollocatedVectorGrid3 input,
const VectorField3 flow,
double  dt,
CollocatedVectorGrid3 output,
const ScalarField3 boundarySDF = ConstantScalarField3(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 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 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::AdvectionSolver3.

◆ Advect() [3/3]

void CubbyFlow::SemiLagrangian3::Advect ( const FaceCenteredGrid3 input,
const VectorField3 flow,
double  dt,
FaceCenteredGrid3 output,
const ScalarField3 boundarySDF = ConstantScalarField3(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::AdvectionSolver3.

◆ GetScalarSamplerFunc()

virtual std::function<double(const Vector3D&)> CubbyFlow::SemiLagrangian3::GetScalarSamplerFunc ( const ScalarGrid3 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::CubicSemiLagrangian3.

◆ GetVectorSamplerFunc() [1/2]

virtual std::function<Vector3D(const Vector3D&)> CubbyFlow::SemiLagrangian3::GetVectorSamplerFunc ( const CollocatedVectorGrid3 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::CubicSemiLagrangian3.

◆ GetVectorSamplerFunc() [2/2]

virtual std::function<Vector3D(const Vector3D&)> CubbyFlow::SemiLagrangian3::GetVectorSamplerFunc ( const FaceCenteredGrid3 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::CubicSemiLagrangian3.

◆ operator=() [1/2]

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

Default copy assignment operator.

◆ operator=() [2/2]

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

Default move assignment operator.


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