mantaflow  0.10
A framework for fluid simulation
Functions | Variables
fluidguiding.cpp File Reference
#include "vectorbase.h"
#include "grid.h"
#include "kernel.h"
#include "conjugategrad.h"
#include "rcmatrix.h"

Functions

Matrix Manta::get1DGaussianBlurKernel (const int n, const int sigma)
 creates a 1D (horizontal) Gaussian blur kernel of size n and standard deviation sigma
 
void Manta::apply1DKernelDirX (MACGrid &in, MACGrid &out, const Matrix &kernel)
 
void Manta::apply1DKernelDirY (MACGrid &in, MACGrid &out, const Matrix &kernel)
 
void Manta::apply1DKernelDirZ (MACGrid &in, MACGrid &out, const Matrix &kernel)
 
void Manta::applySeparableKernel2D (MACGrid &grid, FlagGrid &flags, const Matrix &kernel)
 Apply separable Gaussian blur in 2D.
 
void Manta::applySeparableKernel3D (MACGrid &grid, FlagGrid &flags, const Matrix &kernel)
 Apply separable Gaussian blur in 3D.
 
void Manta::applySeparableKernel (MACGrid &grid, FlagGrid &flags, const Matrix &kernel)
 Apply separable Gaussian blur in 2D or 3D depending on input dimensions.
 
Real Manta::getRNorm (const MACGrid &x, const MACGrid &z)
 Compute r-norm for the stopping criterion.
 
Real Manta::getSNorm (const Real rho, const MACGrid &z, const MACGrid &z_prev)
 Compute s-norm for the stopping criterion.
 
Real Manta::getEpsPri (const Real eps_abs, const Real eps_rel, MACGrid &x, MACGrid &z)
 Compute primal eps for the stopping criterion.
 
Real Manta::getEpsDual (const Real eps_abs, const Real eps_rel, MACGrid &y)
 Compute dual eps for the stopping criterion.
 
PYTHON void Manta::getSpiralVelocity2D (const FlagGrid &flags, MACGrid &vel, Real strength=1.0)
 
PYTHON void Manta::setGradientYWeight (Grid< Real > &W, const int minY, const int maxY, const Real valAtMin, const Real valAtMax)
 
void Manta::applySeparableGaussianBlur (MACGrid &grid, FlagGrid &flags, const Matrix &kernel1D)
 Apply Gaussian blur (either 2D or 3D) in a separable way.
 
void Manta::ADMM_precompute_Separable (int blurRadius)
 Precomputation performed before the first PD iteration.
 
void Manta::applyApproxInvM (MACGrid &v, FlagGrid &flags, MACGrid &invA)
 Apply approximate multiplication of inverse(M)
 
void Manta::precomputeQ (MACGrid &Q, FlagGrid &flags, const MACGrid &velT_region, const MACGrid &velC, const Matrix &gBlurKernel, const Real sigma)
 
void Manta::precomputeInvA (MACGrid &invA, Grid< Real > &weight, const Real sigma)
 
void Manta::prox_f (MACGrid &v, FlagGrid &flags, MACGrid &Q, const MACGrid &velC, const Real sigma, MACGrid &invA)
 proximal operator of f , guiding
 
void Manta::solvePressure (MACGrid &vel, Grid< Real > &pressure, FlagGrid &flags, Real cgAccuracy=1e-3, Grid< Real > *phi=0, Grid< Real > *perCellCorr=0, MACGrid *fractions=0, Real gfClamp=1e-04, Real cgMaxIterFac=1.5, bool precondition=true, int preconditioner=1, bool enforceCompatibility=false, bool useL2Norm=false, bool zeroPressureFixing=false, const Grid< Real > *curv=NULL, const Real surfTens=0.0, Grid< Real > *retRhs=NULL)
 
PYTHON void Manta::PD_fluid_guiding (MACGrid &vel, MACGrid &velT, Grid< Real > &pressure, FlagGrid &flags, Grid< Real > &weight, int blurRadius=5, Real theta=1.0, Real tau=1.0, Real sigma=1.0, Real epsRel=1e-3, Real epsAbs=1e-3, int maxIters=200, Grid< Real > *phi=0, Grid< Real > *perCellCorr=0, MACGrid *fractions=0, Real gfClamp=1e-04, Real cgMaxIterFac=1.5, Real cgAccuracy=1e-3, int preconditioner=1, bool zeroPressureFixing=false)
 

Variables

bool Manta::gBlurPrecomputed = false
 
int Manta::gBlurKernelRadius = -1
 
Matrix Manta::gBlurKernel
 

Function Documentation

◆ precomputeInvA()

void Manta::precomputeInvA ( MACGrid invA,
Grid< Real > &  weight,
const Real  sigma 
)

Precompute inverse(A), a reused quantity in the PD iterations A = 2*S^2 + p*I, invA = elementwise 1/A

◆ precomputeQ()

void Manta::precomputeQ ( MACGrid Q,
FlagGrid flags,
const MACGrid velT_region,
const MACGrid velC,
const Matrix &  gBlurKernel,
const Real  sigma 
)

Precompute Q, a reused quantity in the PD iterations Q = 2*G*G*(velT-velC)-sigma*velC