chombo-discharge
Public Types | Public Member Functions | Static Public Member Functions | List of all members
LeastSquares Class Reference

Static class containing useful routines for (weighted) least squares polynomial reconstruction. More...

#include <CD_LeastSquares.H>

Public Types

using CellLocation = Location::Cell
 
using FaceLocation = Location::Face
 
using Connectivity = VofUtils::Connectivity
 
using Neighborhood = VofUtils::Neighborhood
 

Public Member Functions

 LeastSquares ()=delete
 Static class, no construction here.
 
 ~LeastSquares ()=delete
 Static class, no destruction here.
 

Static Public Member Functions

static VoFStencil getInterpolationStencil (const CellLocation a_cellPos, const CellLocation a_otherCellsPos, const Connectivity a_connectivity, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const Real a_dx, const int a_p, const int a_radius, const int a_order, const bool a_addStartingVof)
 Get an interpolation stencil to a point in a cell with a specified order and radius. More...
 
static VoFStencil getGradSten (const VolIndex &a_vof, const CellLocation a_gradLocation, const CellLocation a_cellLocation, const EBISBox &a_ebisbox, const Real a_dx, const int a_radius, const int a_p, const int a_order, const IntVectSet a_knownTerms=IntVectSet())
 Compute a least squares gradient stencil in a cell. More...
 
static VoFStencil getGradSten (const FaceIndex &a_face, const FaceLocation a_gradLocation, const CellLocation a_cellLocation, const EBISBox &a_ebisbox, const Real a_dx, const int a_radius, const int a_p, const int a_order, const IntVectSet a_knownTerms=IntVectSet())
 Compute a least squares gradient stencil on a grid face. More...
 
static VoFStencil getBndryGradSten (const VolIndex &a_vof, const Neighborhood a_neighborhood, const CellLocation a_cellPositions, const EBISBox &a_ebisbox, const Real a_dx, const int a_radius, const int a_p, const int a_order, const bool a_addStartingVof)
 Compute a least squares gradient stencil on the EB centroid with specified order. More...
 
static Real sumWeights (const VoFStencil &a_stencil, const int a_variable)
 Return the sum of weights in the stencil, for a specific variable. More...
 
static Real sumAllWeights (const VoFStencil &a_stencil)
 Compute the sum of all weights in a stencil. More...
 
static VoFStencil projectGradSten (const VoFStencil &a_stencil, const RealVect &a_projection)
 Assuming that a_stencil is a gradient stencil, project it along a direction. More...
 
static RealVect displacement (const CellLocation a_from, const CellLocation a_to, const VolIndex &a_fromVof, const VolIndex &a_toVof, const EBISBox &a_ebisbox, const Real &a_dx)
 Computes the distance between two Vofs that are defined on the same grid level. More...
 
static RealVect displacement (const FaceLocation a_fromLoc, const CellLocation a_toLoc, const FaceIndex &a_fromFace, const VolIndex &a_toVof, const EBISBox &a_ebisbox, const Real &a_dx)
 Computes the distance between a vof and and a face. More...
 
static RealVect displacement (const CellLocation a_from, const CellLocation a_to, const VolIndex &a_fromVof, const VolIndex &a_toVof, const EBISBox &a_ebisboxFrom, const EBISBox &a_ebisboxTo, const Real &a_dxFrom, const Real &a_dxTo)
 Computes the distance between two Vofs that are defined on two different grid levels. More...
 
static Vector< RealVect > getDisplacements (const CellLocation a_from, const CellLocation a_to, const VolIndex &a_fromVof, const Vector< VolIndex > &a_toVofs, const EBISBox &a_ebisbox, const Real &a_dx)
 Get displacement vectors from a cell position to another cell position for a list of Vofs, i.e. x = (xFrom - xTo). More...
 
static Vector< RealVect > getDisplacements (const FaceLocation a_fromLoc, const CellLocation a_to, const FaceIndex &a_fromFace, const Vector< VolIndex > &a_toVofs, const EBISBox &a_ebisbox, const Real &a_dx)
 Get displacement vectors from a cell position to another cell position for a list of Vofs, i.e. x = (xFrom - xTo). More...
 
static Vector< Real > makeDiagWeights (const Vector< RealVect > &a_displacements, const int a_pow)
 Create a list of weights. This routine returns a list of diagonal weights for a least squares system. The weights are given as 1/||x1-x0||^a where a is the power. More...
 
static VoFStencil computeGradSten (const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_p, const int a_order, const IntVectSet a_knownTerms)
 Get a least squares gradient stencil solution for computing the gradient at a point. This routine eliminates the value in the point where the gradient is computed (which is assumed to be known.) More...
 
static VoFStencil computeGradSten (const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const Vector< Real > &a_weights, const int a_order, const IntVectSet a_knownTerms)
 Get a least squares gradient stencil solution for a system of first-order Taylor extrapolation for computing the gradient at a point. More...
 
static int getTaylorExpansionSize (const int a_order)
 Get the size of a Taylor expansion for a given order. More...
 
static VoFStencil computeInterpolationStencil (const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_pow, const int a_order)
 Compute an interpolation stencil to specified order by solving a least squares system. More...
 
static VoFStencil computeInterpolationStencil (const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const Vector< Real > &a_weights, const int a_order)
 Compute an interpolation stencil to specified order by solving a least squares system. More...
 
static std::map< IntVect, VoFStencil > computeSingleLevelStencils (const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_p, const int a_order)
 Compute a least squares interpolation to a specified order. More...
 
static std::map< IntVect, VoFStencil > computeSingleLevelStencils (const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const Vector< Real > &a_weights, const int a_order)
 Compute a least squares interpolation to a specified order. More...
 
template<typename T >
static std::map< IntVect, std::pair< VoFStencil, VoFStencil > > computeDualLevelStencils (const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_fineVofs, const Vector< VolIndex > &a_coarVofs, const Vector< RealVect > &a_fineDisplacements, const Vector< RealVect > &a_coarDisplacements, const int a_p, const int a_order)
 Compute a least squares interpolation to a specified order. This version separates the stencils into two levels. More...
 
template<typename T >
static std::map< IntVect, std::pair< VoFStencil, VoFStencil > > computeDualLevelStencils (const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_fineVofs, const Vector< VolIndex > &a_coarVofs, const Vector< RealVect > &a_fineDisplacements, const Vector< RealVect > &a_coarDisplacements, const Vector< Real > &a_fineWeights, const Vector< Real > &a_coarWeights, const int a_order)
 Compute a least squares interpolation to a specified order. This version separates the stencils into two levels. More...
 

Detailed Description

Static class containing useful routines for (weighted) least squares polynomial reconstruction.

Member Function Documentation

◆ computeDualLevelStencils() [1/2]

template<typename T >
std::map< IntVect, std::pair< VoFStencil, VoFStencil > > LeastSquares::computeDualLevelStencils ( const IntVectSet &  a_derivs,
const IntVectSet &  a_knownTerms,
const Vector< VolIndex > &  a_fineVofs,
const Vector< VolIndex > &  a_coarVofs,
const Vector< RealVect > &  a_fineDisplacements,
const Vector< RealVect > &  a_coarDisplacements,
const int  a_p,
const int  a_order 
)
static

Compute a least squares interpolation to a specified order. This version separates the stencils into two levels.

This is the general version which lets the caller specify why derivatives he wants out of the interpolation. The user specifies this via a_derivs where each IntVect represent a differentiation. E.g. IntVect(0,0,0) is just f, IntVect(1,0,0) = d/dx, IntVect(1,1,2) = (d^4)/(dx dy dz^2) and so on. The stencils for the directional derivatives are coded onto the return map. E.g. if a_derivs contains IntVect(1,0,0) the stencil for d/dx is found in map.at(IntVect(1,0,0)). The user can solve a smaller system if some of the terms in the expansion are known, typically used when computing an approximation to the gradient at a point in space where the scalar value is known. Note that this will modify the right hand side of the system, and the user will have to figure out how to make sense of the stencil.

Parameters
[in]a_derivsSpecification of which unknowns in the Taylor series will be returned.
[in]a_knownTermsWhich terms in the Taylor series are known.
[in]a_fineVofsFine-level vofs to include in the interpolation method.
[in]a_coarVofsCoar-level vofs to include in the interpolation method.
[in]a_fineDisplacementsDisplacement vectors from the fine Vofs to the interpolation point
[in]a_coarDisplacementsDisplacement vectors from the coar Vofs to the interpolation point
[in]a_pWeighting factor for weighted least squares
[in]a_orderOrder of the interpolation.
Returns
Stencils for each of the derivatives specified in the input argument. The first entry in the pair contains fine-grid vofs only, and the second entry contains the coar vofs.
Note
This will throw an error if you don't have enough equations for obtaining the specified order.
The return map is always initialized with empty stencils. If computing the pseudoinverse fails, the returned stencils are all empty.
T is the precision used by LAPACK

◆ computeDualLevelStencils() [2/2]

template<typename T >
std::map< IntVect, std::pair< VoFStencil, VoFStencil > > LeastSquares::computeDualLevelStencils ( const IntVectSet &  a_derivs,
const IntVectSet &  a_knownTerms,
const Vector< VolIndex > &  a_fineVofs,
const Vector< VolIndex > &  a_coarVofs,
const Vector< RealVect > &  a_fineDisplacements,
const Vector< RealVect > &  a_coarDisplacements,
const Vector< Real > &  a_fineWeights,
const Vector< Real > &  a_coarWeights,
const int  a_order 
)
static

Compute a least squares interpolation to a specified order. This version separates the stencils into two levels.

This is the general version which lets the caller specify why derivatives he wants out of the interpolation. The user specifies this via a_derivs where each IntVect represent a differentiation. E.g. IntVect(0,0,0) is just f, IntVect(1,0,0) = d/dx, IntVect(1,1,2) = (d^4)/(dx dy dz^2) and so on. The stencils for the directional derivatives are coded onto the return map. E.g. if a_derivs contains IntVect(1,0,0) the stencil for d/dx is found in map.at(IntVect(1,0,0)). The user can solve a smaller system if some of the terms in the expansion are known, typically used when computing an approximation to the gradient at a point in space where the scalar value is known. Note that this will modify the right hand side of the system, and the user will have to figure out how to make sense of the stencil.

Parameters
[in]a_derivsSpecification of which unknowns in the Taylor series will be returned.
[in]a_knownTermsWhich terms in the Taylor series are known.
[in]a_fineVofsFine-level vofs to include in the interpolation method.
[in]a_coarVofsCoar-level vofs to include in the interpolation method.
[in]a_fineDisplacementsDisplacement vectors from the fine Vofs to the interpolation point
[in]a_coarDisplacementsDisplacement vectors from the coar Vofs to the interpolation point
[in]a_fineWeightsWeights for the fine level
[in]a_coarWeightsWeights for the coarse level
[in]a_orderOrder of the interpolation.
Returns
Stencils for each of the derivatives specified in the input argument. The first entry in the pair contains fine-grid vofs only, and the second entry contains the coar vofs.
Note
This will throw an error if you don't have enough equations for obtaining the specified order.
The return map is always initialized with empty stencils. If computing the pseudoinverse fails, the returned stencils are all empty.
T is the precision used by LAPACK

◆ computeGradSten() [1/2]

VoFStencil LeastSquares::computeGradSten ( const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const int  a_p,
const int  a_order,
const IntVectSet  a_knownTerms 
)
static

Get a least squares gradient stencil solution for computing the gradient at a point. This routine eliminates the value in the point where the gradient is computed (which is assumed to be known.)

Parameters
[in]a_allVofsVofs for which the displacement vectors were computed.
[in]a_displacementsDisplacement vectors from Vofs to the interpolation point
[in]a_pWeighting exponent for system
[in]a_orderDesired order.
Note
This computes weights using makeDiagWeights(a_displacements, a_p) and then calls the other version.
Returns
Stencil for obtaining the gradient in a point. Stencils for each direction are put in the VoFStencil.variable(i).

◆ computeGradSten() [2/2]

VoFStencil LeastSquares::computeGradSten ( const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const Vector< Real > &  a_weights,
const int  a_order,
const IntVectSet  a_knownTerms 
)
static

Get a least squares gradient stencil solution for a system of first-order Taylor extrapolation for computing the gradient at a point.

This routine eliminates the value in the point where the gradient is computed (which is assumed to be known.)

Parameters
[in]a_allVofsVofs for which the displacement vectors were computed.
[in]a_displacementsDisplacement vectors from Vofs to the interpolation point
[in]a_weightsWeights for each system of equations.
[in]a_orderInterpolation order
Returns
Stencil for obtaining the gradient in a point. Stencils for each direction are put in the VoFStencil.variable(i).
Note
This routine will cause a run-time error if you have less than SpaceDim equations, which is the minimum number of equations needed for obtaining a gradient. However, the routine does not check if the inputs are degenerate.

◆ computeInterpolationStencil() [1/2]

VoFStencil LeastSquares::computeInterpolationStencil ( const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const int  a_pow,
const int  a_order 
)
static

Compute an interpolation stencil to specified order by solving a least squares system.

Parameters
[in]a_allVofsVofs to include in the interpolation method.
[in]a_displacementsDisplacement vectors from the Vofs to the interpolation point
[in]a_orderOrder of the interpolation.
[in]a_weightPWeighting order for the least squares system. Must be > 0 to have an effect.
Returns
Stencil for the least squares solution to the interpolation problem.
Note
This computes weights using makeDiagWeights(a_displacements, a_pow) and then calls the other version.

◆ computeInterpolationStencil() [2/2]

VoFStencil LeastSquares::computeInterpolationStencil ( const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const Vector< Real > &  a_weights,
const int  a_order 
)
static

Compute an interpolation stencil to specified order by solving a least squares system.

Parameters
[in]a_allVofsVofs to include in the interpolation method.
[in]a_displacementsDisplacement vectors from the Vofs to the interpolation point
[in]a_orderOrder of the interpolation.
[in]a_weightPWeighting order for the least squares system. Must be > 0 to have an effect.
Returns
Stencil for the least squares solution to the interpolation problem.
Note
This calls the more general version with a_derivs = IntVectSet(IntVect(0,0)).
This will throw an error if you don't have enough equations for obtaining the specified order.

◆ computeSingleLevelStencils() [1/2]

std::map< IntVect, VoFStencil > LeastSquares::computeSingleLevelStencils ( const IntVectSet &  a_derivs,
const IntVectSet &  a_knownTerms,
const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const int  a_p,
const int  a_order 
)
static

Compute a least squares interpolation to a specified order.

This is the general version which lets the caller specify why derivatives he wants out of the interpolation. The user specifies this via a_derivs where each IntVect represent a differentiation. E.g. IntVect(0,0,0) is just f, IntVect(1,0,0) = d/dx, IntVect(1,1,2) = (d^4)/(dx dy dz^2) and so on. The stencils for the directional derivatives are coded onto the return map. E.g. if a_derivs contains IntVect(1,0,0) the stencil for d/dx is found in map.at(IntVect(1,0,0)). The user can solve a smaller system if some of the terms in the expansion are known, typically used when computing an approximation to the gradient at a point in space where the scalar value is known. Note that this will modify the right hand side of the system, and the user will have to figure out how to make sense of the stencil.

Parameters
[in]a_derivsSpecification of which terms to obtain from the series.
[in]a_knownTermsWhich terms in the Taylor series are known, and will be eliminated from the least squares system.
[in]a_allVofsVofs to include in the interpolation method.
[in]a_displacementsDisplacement vectors from the Vofs to the interpolation point
[in]a_pWeighting order for the least squares system. Must be > 0 to have an effect.
[in]a_orderOrder of the interpolation.
Returns
Stencils for each of the derivatives specified in the input argument.
Note
This calls the more general version.

◆ computeSingleLevelStencils() [2/2]

std::map< IntVect, VoFStencil > LeastSquares::computeSingleLevelStencils ( const IntVectSet &  a_derivs,
const IntVectSet &  a_knownTerms,
const Vector< VolIndex > &  a_allVofs,
const Vector< RealVect > &  a_displacements,
const Vector< Real > &  a_weights,
const int  a_order 
)
static

Compute a least squares interpolation to a specified order.

This is the general version which lets the caller specify why derivatives he wants out of the interpolation. The user specifies this via a_derivs where each IntVect represent a differentiation. E.g. IntVect(0,0,0) is just f, IntVect(1,0,0) = d/dx, IntVect(1,1,2) = (d^4)/(dx dy dz^2) and so on. The stencils for the directional derivatives are coded onto the return map. E.g. if a_derivs contains IntVect(1,0,0) the stencil for d/dx is found in map.at(IntVect(1,0,0)). The user can solve a smaller system if some of the terms in the expansion are known, typically used when computing an approximation to the gradient at a point in space where the scalar value is known. Note that this will modify the right hand side of the system, and the user will have to figure out how to make sense of the stencil.

Parameters
[in]a_derivsSpecification of which unknowns in the Taylor series will be returned.
[in]a_knownTermsWhich terms in the Taylor series are known.
[in]a_allVofsVofs to include in the interpolation method.
[in]a_displacementsDisplacement vectors from the Vofs to the interpolation point
[in]a_weightsWeights for the least squares system.
[in]a_orderOrder of the returned interpolation.
Returns
Stencils for each of the derivatives specified in the input argument.
Note
This will throw an error if you don't have enough equations for obtaining the specified order.
The return map is always initialized with empty stencils. If computing the pseudoinverse fails, the returned stencils are all empty.

◆ displacement() [1/3]

RealVect LeastSquares::displacement ( const CellLocation  a_from,
const CellLocation  a_to,
const VolIndex &  a_fromVof,
const VolIndex &  a_toVof,
const EBISBox &  a_ebisbox,
const Real &  a_dx 
)
static

Computes the distance between two Vofs that are defined on the same grid level.

Parameters
[in]a_fromSpecifying position in the cell defined by a_fromVof
[in]a_toSpecifying position in the cell defined by a_toVof
[in]a_fromVofVof to compute the distance from
[in]a_toVofVof to compute the distance to
[in]a_ebisboxEBISBox
[in]a_dxGrid resolution
Returns
The vector pos(a_toVof) - pos(a_fromVof).

◆ displacement() [2/3]

RealVect LeastSquares::displacement ( const CellLocation  a_from,
const CellLocation  a_to,
const VolIndex &  a_fromVof,
const VolIndex &  a_toVof,
const EBISBox &  a_ebisboxFrom,
const EBISBox &  a_ebisboxTo,
const Real &  a_dxFrom,
const Real &  a_dxTo 
)
static

Computes the distance between two Vofs that are defined on two different grid levels.

Parameters
[in]a_fromSpecifying position in the cell defined by a_fromVof
[in]a_toSpecifying position in the cell defined by a_toVof
[in]a_fromVofVof to compute the distance from
[in]a_toVofVof to compute the distance to
[in]a_ebisboxFromEBISBox which can reach a_fromVof
[in]a_ebisboxToEBISBox which can reach a_toVof
[in]a_dxFromGrid resolution for the a_fromVof vof
[in]a_dxToGrid resolution for the a_toVof vof
Returns
The vector pos(a_toVof) - pos(a_fromVof).

◆ displacement() [3/3]

RealVect LeastSquares::displacement ( const FaceLocation  a_fromLoc,
const CellLocation  a_toLoc,
const FaceIndex &  a_fromFace,
const VolIndex &  a_toVof,
const EBISBox &  a_ebisbox,
const Real &  a_dx 
)
static

Computes the distance between a vof and and a face.

Parameters
[in]a_fromLocSpecifying position in the cell defined by a_fromVof
[in]a_toLocSpecifying position in the cell defined by a_toVof
[in]a_fromFaceface to compute the distance from
[in]a_toVofVof to compute the distance to
[in]a_ebisboxEBISBox
[in]a_dxGrid resolution
Returns
The vector pos(a_toVof) - pos(a_fromVof).

◆ getBndryGradSten()

VoFStencil LeastSquares::getBndryGradSten ( const VolIndex &  a_vof,
const Neighborhood  a_neighborhood,
const CellLocation  a_cellPositions,
const EBISBox &  a_ebisbox,
const Real  a_dx,
const int  a_radius,
const int  a_p,
const int  a_order,
const bool  a_addStartingVof 
)
static

Compute a least squares gradient stencil on the EB centroid with specified order.

This routine eliminates the value on the boundary and the user will have to fetch the weight for this point from the returned stencil.

Parameters
[in]a_vofInput vof
[in]a_neighborhoodNeighboorhood specification
[in]a_cellPositionsHow to interpret cell positions
[in]a_ebisboxebisbox
[in]a_radiusStencil radius
[in]a_dxResolution
[in]a_pWeight scaling
[in]a_orderOrder of the gradient.
[in]a_addStartingVofUse a_vof in the expression for the gradient. This can be ill-conditioned for cell-centered expressions.
Returns
Returns a least squares stencil for evaluating an approximation normal derivative on the boundary centroid.

◆ getDisplacements() [1/2]

Vector< RealVect > LeastSquares::getDisplacements ( const CellLocation  a_from,
const CellLocation  a_to,
const VolIndex &  a_fromVof,
const Vector< VolIndex > &  a_toVofs,
const EBISBox &  a_ebisbox,
const Real &  a_dx 
)
static

Get displacement vectors from a cell position to another cell position for a list of Vofs, i.e. x = (xFrom - xTo).

Parameters
[in]a_fromFrom this position
[in]a_toTo this position.
[in]a_curVofOrigin vof
[in]a_toVofsVofs to compute the distance to/from
[in]a_ebisboxEBISBox
[in]a_dxGrid resolution

◆ getDisplacements() [2/2]

Vector< RealVect > LeastSquares::getDisplacements ( const FaceLocation  a_fromLoc,
const CellLocation  a_to,
const FaceIndex &  a_fromFace,
const Vector< VolIndex > &  a_toVofs,
const EBISBox &  a_ebisbox,
const Real &  a_dx 
)
static

Get displacement vectors from a cell position to another cell position for a list of Vofs, i.e. x = (xFrom - xTo).

Parameters
[in]a_fromLocLocation on face
[in]a_toLocLocation in Vofs
[in]a_fromFaceOrigin face
[in]a_toVofsVofs to compute the distance to/from
[in]a_ebisboxEBISBox
[in]a_dxGrid resolution

◆ getGradSten() [1/2]

VoFStencil LeastSquares::getGradSten ( const FaceIndex &  a_face,
const FaceLocation  a_gradLocation,
const CellLocation  a_cellLocation,
const EBISBox &  a_ebisbox,
const Real  a_dx,
const int  a_radius,
const int  a_p,
const int  a_order,
const IntVectSet  a_knownTerms = IntVectSet() 
)
static

Compute a least squares gradient stencil on a grid face.

This routine computes grad(phi) using a least squares reconstruction to specified order.

Parameters
[in]a_faceInput face
[in]a_gradLocationWhere (on the face) the gradient will be computed
[in]a_cellLocationCell location
[in]a_ebisboxebisbox
[in]a_dxResolution
[in]a_radiusStencil radius
[in]a_pWeighting factor for least squares
[in]a_orderTruncation order.
Returns
Returns a least squares stencil for computing the gradient. The directional derivatives are in the components of the returned stencil.

◆ getGradSten() [2/2]

VoFStencil LeastSquares::getGradSten ( const VolIndex &  a_vof,
const CellLocation  a_gradLocation,
const CellLocation  a_cellLocation,
const EBISBox &  a_ebisbox,
const Real  a_dx,
const int  a_radius,
const int  a_p,
const int  a_order,
const IntVectSet  a_knownTerms = IntVectSet() 
)
static

Compute a least squares gradient stencil in a cell.

This routine computes grad(phi) using a least squares reconstruction to specified order.

Parameters
[in]a_vofInput vof
[in]a_gradLocationWhere (in the vof) the gradient is evaluated
[in]a_cellLocationCell locations
[in]a_ebisboxebisbox
[in]a_dxResolution
[in]a_radiusStencil radius
[in]a_pWeighting factor for least squares
[in]a_orderTruncation order.
Returns
Returns a least squares stencil for computing the gradient. The directional derivatives are in the components of the returned stencil.

◆ getInterpolationStencil()

VoFStencil LeastSquares::getInterpolationStencil ( const CellLocation  a_cellPos,
const CellLocation  a_otherCellsPos,
const Connectivity  a_connectivity,
const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const Real  a_dx,
const int  a_p,
const int  a_radius,
const int  a_order,
const bool  a_addStartingVof 
)
static

Get an interpolation stencil to a point in a cell with a specified order and radius.

Parameters
[in]a_cellPosPosition in the cell of the starting Vof.
[in]a_otherCellsPosPositions in the other cells.
[in]a_startVofThe vof to compute for.
[in]a_ebisboxEBISBox.
[in]a_dxGrid resolution.
[in]a_pPower factor for weights.
[in]a_radiusStencil radius.
[in]a_orderInterpolation order.
[in]a_addStartingVofAdd starting vof or not (can't be used with a_p > 0) as it would lead to ill-conditioned systems.

◆ getTaylorExpansionSize()

int LeastSquares::getTaylorExpansionSize ( const int  a_order)
static

Get the size of a Taylor expansion for a given order.

Parameters
[in]a_orderDesired order in Taylor expansion
Returns
Returns number of terms in Taylor expansion.

◆ makeDiagWeights()

Vector< Real > LeastSquares::makeDiagWeights ( const Vector< RealVect > &  a_displacements,
const int  a_pow 
)
inlinestatic

Create a list of weights. This routine returns a list of diagonal weights for a least squares system. The weights are given as 1/||x1-x0||^a where a is the power.

Parameters
[in]a_displacementsDisplacement vectors, i.e. (x1-x0,x2-x0, x3-x0,...,(xN-x0)^T.
[in]a_powerPower factor for weights.

◆ projectGradSten()

VoFStencil LeastSquares::projectGradSten ( const VoFStencil &  a_stencil,
const RealVect &  a_projection 
)
static

Assuming that a_stencil is a gradient stencil, project it along a direction.

Parameters
[in]a_stencilStencil describing a gradient.
[in]a_projectionVector to project stencil along.
Returns
Returns gradient stencil projected along a_project.
Note
Users need to make sure ||a_projection|| = 1 for this routine to make sense.

◆ sumAllWeights()

Real LeastSquares::sumAllWeights ( const VoFStencil &  a_stencil)
static

Compute the sum of all weights in a stencil.

Parameters
[in]a_stencilStencil
Returns
Returns sum of weights in a_stencil (over all variables).

◆ sumWeights()

Real LeastSquares::sumWeights ( const VoFStencil &  a_stencil,
const int  a_variable 
)
static

Return the sum of weights in the stencil, for a specific variable.

Parameters
[in]a_stencilStencil
[in]a_variableWhich variable to sum.
Returns
Returns sum of weights for a specific variable in the stencil.

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