faMatrix< Type > Class Template Reference

A special matrix type and solver, designed for finite area solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise. More...

Classes

class  faSolver
 Solver class returned by the solver function. More...
 

Public Types

typedef GeometricField< Type, faePatchField, edgeMesh > * edgeTypeFieldPtr
 Declare return type of the faceFluxCorrectionPtr() function. More...
 

Public Member Functions

 ClassName ("faMatrix")
 
 faMatrix (const GeometricField< Type, faPatchField, areaMesh > &, const dimensionSet &)
 Construct given a field to solve for. More...
 
 faMatrix (const faMatrix< Type > &)
 Construct as copy. More...
 
 faMatrix (const GeometricField< Type, faPatchField, areaMesh > &, Istream &)
 Construct from Istream given field to solve for. More...
 
tmp< faMatrix< Type > > clone () const
 Clone. More...
 
virtual ~faMatrix ()
 Destructor. More...
 
const GeometricField< Type, faPatchField, areaMesh > & psi () const
 
const dimensionSetdimensions () const
 
Field< Type > & source ()
 
const Field< Type > & source () const
 
FieldField< Field, Type > & internalCoeffs ()
 faBoundary scalar field containing pseudo-matrix coeffs More...
 
FieldField< Field, Type > & boundaryCoeffs ()
 faBoundary scalar field containing pseudo-matrix coeffs More...
 
edgeTypeFieldPtrfaceFluxCorrectionPtr ()
 Return pointer to face-flux non-orthogonal correction field. More...
 
void setValues (const labelUList &faces, const UList< Type > &values)
 Set solution in given cells and eliminate corresponding. More...
 
void setReference (const label facei, const Type &value)
 Set reference level for solution. More...
 
void setComponentReference (const label patchi, const label facei, const direction cmpt, const scalar value)
 Set reference level for a component of the solution. More...
 
void relax (const scalar alpha)
 Relax matrix (for steady-state solution). More...
 
void relax ()
 Relax matrix (for steady-state solution). More...
 
SolverPerformance< Type > solve (const dictionary &)
 Solve returning the solution statistics. More...
 
SolverPerformance< Type > solve ()
 Solve returning the solution statistics. More...
 
tmp< Field< Type > > residual () const
 Return the matrix residual. More...
 
tmp< scalarFieldD () const
 Return the matrix diagonal. More...
 
tmp< areaScalarFieldA () const
 Return the central coefficient. More...
 
tmp< GeometricField< Type, faPatchField, areaMesh > > H () const
 Return the H operation source. More...
 
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux () const
 Return the face-flux field from the matrix. More...
 
void operator= (const faMatrix< Type > &)
 
void operator= (const tmp< faMatrix< Type >> &)
 
void negate ()
 
void operator+= (const faMatrix< Type > &)
 
void operator+= (const tmp< faMatrix< Type >> &)
 
void operator-= (const faMatrix< Type > &)
 
void operator-= (const tmp< faMatrix< Type >> &)
 
void operator+= (const GeometricField< Type, faPatchField, areaMesh > &)
 
void operator+= (const tmp< GeometricField< Type, faPatchField, areaMesh >> &)
 
void operator-= (const GeometricField< Type, faPatchField, areaMesh > &)
 
void operator-= (const tmp< GeometricField< Type, faPatchField, areaMesh >> &)
 
void operator+= (const dimensioned< Type > &)
 
void operator-= (const dimensioned< Type > &)
 
void operator*= (const areaScalarField &)
 
void operator*= (const tmp< areaScalarField > &)
 
void operator*= (const dimensioned< scalar > &)
 
template<>
void setComponentReference (const label patchI, const label edgeI, const direction, const scalar value)
 
template<>
Foam::solverPerformance solve (const dictionary &solverControls)
 
template<>
Foam::tmp< Foam::scalarFieldresidual () const
 
template<>
Foam::tmp< Foam::areaScalarFieldH () const
 
template<>
void setComponentReference (const label patchi, const label facei, const direction, const scalar value)
 
template<>
SolverPerformance< scalar > solve (const dictionary &)
 
template<>
tmp< scalarFieldresidual () const
 
template<>
tmp< areaScalarFieldH () const
 

Friends

Ostreamoperator (Ostream &, const faMatrix< Type > &)
 

Detailed Description

template<class Type>
class Foam::faMatrix< Type >

A special matrix type and solver, designed for finite area solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.

Finite-Area matrix.

Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.

Source files
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.

Definition at line 60 of file faMatrix.H.

Member Typedef Documentation

◆ edgeTypeFieldPtr

Declare return type of the faceFluxCorrectionPtr() function.

Definition at line 258 of file faMatrix.H.

Constructor & Destructor Documentation

◆ faMatrix() [1/3]

faMatrix ( const GeometricField< Type, faPatchField, areaMesh > &  psi,
const dimensionSet ds 
)

Construct given a field to solve for.

Definition at line 181 of file faMatrix.C.

References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), DebugInFunction, Foam::endl(), forAll, psi, and Foam::Zero.

Here is the call graph for this function:

◆ faMatrix() [2/3]

faMatrix ( const faMatrix< Type > &  fam)

Construct as copy.

Definition at line 233 of file faMatrix.C.

References DebugInFunction, and Foam::endl().

Here is the call graph for this function:

◆ faMatrix() [3/3]

faMatrix ( const GeometricField< Type, faPatchField, areaMesh > &  psi,
Istream is 
)

Construct from Istream given field to solve for.

Definition at line 261 of file faMatrix.C.

References DebugInFunction, Foam::endl(), forAll, psi, and Foam::Zero.

Here is the call graph for this function:

◆ ~faMatrix()

~faMatrix ( )
virtual

Destructor.

Definition at line 319 of file faMatrix.C.

References DebugInFunction, Foam::deleteDemandDrivenData(), and Foam::endl().

Here is the call graph for this function:

Member Function Documentation

◆ ClassName()

ClassName ( "faMatrix< Type >"  )

◆ clone()

Foam::tmp< Foam::faMatrix< Type > > clone ( ) const

Clone.

Definition at line 306 of file faMatrix.C.

◆ psi()

const GeometricField<Type, faPatchField, areaMesh>& psi ( ) const
inline

Definition at line 221 of file faMatrix.H.

Referenced by Foam::checkMethod(), and faMatrix< Type >::solve().

Here is the caller graph for this function:

◆ dimensions()

const dimensionSet& dimensions ( ) const
inline

Definition at line 226 of file faMatrix.H.

Referenced by Foam::checkMethod(), and faMatrix< Type >::operator*=().

Here is the caller graph for this function:

◆ source() [1/2]

Field<Type>& source ( )
inline

Definition at line 231 of file faMatrix.H.

◆ source() [2/2]

const Field<Type>& source ( ) const
inline

Definition at line 236 of file faMatrix.H.

◆ internalCoeffs()

FieldField<Field, Type>& internalCoeffs ( )
inline

faBoundary scalar field containing pseudo-matrix coeffs

for internal cells

Definition at line 243 of file faMatrix.H.

◆ boundaryCoeffs()

FieldField<Field, Type>& boundaryCoeffs ( )
inline

faBoundary scalar field containing pseudo-matrix coeffs

for boundary cells

Definition at line 250 of file faMatrix.H.

◆ faceFluxCorrectionPtr()

edgeTypeFieldPtr& faceFluxCorrectionPtr ( )
inline

Return pointer to face-flux non-orthogonal correction field.

Definition at line 261 of file faMatrix.H.

Referenced by gaussLaplacianScheme< Type >::famLaplacian().

Here is the caller graph for this function:

◆ setValues()

void setValues ( const labelUList faces,
const UList< Type > &  values 
)

Set solution in given cells and eliminate corresponding.

equations from the matrix

Definition at line 333 of file faMatrix.C.

References fvMesh::boundary(), Foam::constant::universal::c, Foam::diag(), primitiveMesh::faceEdges(), forAll, HashTable< T, Key, Hash >::insert(), Foam::stringOps::lower(), mesh, fvMesh::neighbour(), fvMesh::owner(), psi, Foam::stringOps::upper(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ setReference()

void setReference ( const label  facei,
const Type &  value 
)

Set reference level for solution.

Definition at line 427 of file faMatrix.C.

References Foam::diag(), and UPstream::master().

Here is the call graph for this function:

◆ setComponentReference() [1/3]

void setComponentReference ( const label  patchi,
const label  facei,
const direction  cmpt,
const scalar  value 
)

Set reference level for a component of the solution.

on a given patch face

Definition at line 38 of file faMatrixSolve.C.

References Foam::diag().

Here is the call graph for this function:

◆ relax() [1/2]

void relax ( const scalar  alpha)

Relax matrix (for steady-state solution).

alpha = 1 : diagonally equal alpha < 1 : ,, dominant alpha = 0 : do nothing

Definition at line 444 of file faMatrix.C.

References Foam::constant::atomic::alpha, Foam::cmptMag(), Foam::cmptMin(), Foam::cmptMultiply(), Foam::component(), faPatchField< Type >::coupled(), D, Foam::diag(), forAll, Foam::mag(), Foam::max(), and Foam::Zero.

Here is the call graph for this function:

◆ relax() [2/2]

void relax ( )

Relax matrix (for steady-state solution).

alpha is read from controlDict

Definition at line 534 of file faMatrix.C.

References DebugInFunction, Foam::endl(), and relax().

Here is the call graph for this function:

◆ solve() [1/4]

Foam::SolverPerformance< Type > solve ( const dictionary solverControls)

Solve returning the solution statistics.

Solver controls read Istream

Definition at line 55 of file faMatrixSolve.C.

References Field< Type >::component(), DebugInFunction, Foam::diag(), Foam::endl(), Foam::Info, Foam::New(), SolverPerformance< Type >::print(), psi, PrecisionAdaptor< Type, InputType, Container >::ref(), solve(), and SolverPerformance< Type >::solverName().

Here is the call graph for this function:

◆ solve() [2/4]

Foam::SolverPerformance< Type > solve ( )

Solve returning the solution statistics.

Solver controls read from faSolution

Definition at line 170 of file faMatrixSolve.C.

References mesh, Foam::name(), and faMatrix< Type >::psi().

Here is the call graph for this function:

◆ residual() [1/3]

Foam::tmp< Foam::Field< Type > > residual ( ) const

Return the matrix residual.

Definition at line 177 of file faMatrixSolve.C.

References Field< Type >::component(), tmp< T >::ref(), Field< Type >::replace(), lduMatrix::residual(), and Foam::Zero.

Here is the call graph for this function:

◆ D()

Foam::tmp< Foam::scalarField > D ( ) const

Return the matrix diagonal.

Definition at line 550 of file faMatrix.C.

References Foam::diag(), and tmp< T >::ref().

Here is the call graph for this function:

◆ A()

Return the central coefficient.

Definition at line 559 of file faMatrix.C.

References GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), D, Foam::dimArea, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), and tmp< T >::ref().

Here is the call graph for this function:

◆ H() [1/3]

Return the H operation source.

Definition at line 586 of file faMatrix.C.

References GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), Foam::dimArea, lduMatrix::H(), GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), tmp< T >::ref(), and Foam::Zero.

Here is the call graph for this function:

◆ flux()

Return the face-flux field from the matrix.

Definition at line 630 of file faMatrix.C.

References Foam::abort(), GeometricField< Type, PatchField, GeoMesh >::boundaryField(), GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), Foam::cmptMultiply(), lduMatrix::faceH(), Foam::FatalError, FatalErrorInFunction, forAll, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), and tmp< T >::ref().

Here is the call graph for this function:

◆ operator=() [1/2]

void operator= ( const faMatrix< Type > &  famv)

Definition at line 712 of file faMatrix.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and lduMatrix::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

void operator= ( const tmp< faMatrix< Type >> &  tfamv)

Definition at line 745 of file faMatrix.C.

◆ negate()

void negate ( )

Definition at line 753 of file faMatrix.C.

References lduMatrix::negate().

Here is the call graph for this function:

◆ operator+=() [1/5]

void operator+= ( const faMatrix< Type > &  famv)

Definition at line 768 of file faMatrix.C.

References Foam::checkMethod(), and lduMatrix::operator+=().

Here is the call graph for this function:

◆ operator+=() [2/5]

void operator+= ( const tmp< faMatrix< Type >> &  tfamv)

Definition at line 794 of file faMatrix.C.

◆ operator-=() [1/5]

void operator-= ( const faMatrix< Type > &  famv)

Definition at line 802 of file faMatrix.C.

References Foam::checkMethod(), and lduMatrix::operator-=().

Here is the call graph for this function:

◆ operator-=() [2/5]

void operator-= ( const tmp< faMatrix< Type >> &  tfamv)

Definition at line 826 of file faMatrix.C.

◆ operator+=() [3/5]

void operator+= ( const GeometricField< Type, faPatchField, areaMesh > &  su)

Definition at line 835 of file faMatrix.C.

References Foam::checkMethod().

Here is the call graph for this function:

◆ operator+=() [4/5]

void operator+= ( const tmp< GeometricField< Type, faPatchField, areaMesh >> &  tsu)

Definition at line 846 of file faMatrix.C.

◆ operator-=() [3/5]

void operator-= ( const GeometricField< Type, faPatchField, areaMesh > &  su)

Definition at line 857 of file faMatrix.C.

References Foam::checkMethod().

Here is the call graph for this function:

◆ operator-=() [4/5]

void operator-= ( const tmp< GeometricField< Type, faPatchField, areaMesh >> &  tsu)

Definition at line 868 of file faMatrix.C.

◆ operator+=() [5/5]

void operator+= ( const dimensioned< Type > &  su)

Definition at line 879 of file faMatrix.C.

◆ operator-=() [5/5]

void operator-= ( const dimensioned< Type > &  su)

Definition at line 889 of file faMatrix.C.

◆ operator*=() [1/3]

void operator*= ( const areaScalarField vsf)

Definition at line 899 of file faMatrix.C.

References Foam::abort(), faMatrix< Type >::dimensions(), Foam::FatalError, FatalErrorInFunction, forAll, and lduMatrix::operator*=().

Here is the call graph for this function:

◆ operator*=() [2/3]

void operator*= ( const tmp< areaScalarField > &  tvsf)

Definition at line 925 of file faMatrix.C.

◆ operator*=() [3/3]

void operator*= ( const dimensioned< scalar > &  ds)

Definition at line 936 of file faMatrix.C.

References lduMatrix::operator*=().

Here is the call graph for this function:

◆ setComponentReference() [2/3]

void setComponentReference ( const label  patchI,
const label  edgeI,
const  direction,
const scalar  value 
)

Definition at line 40 of file faScalarMatrix.C.

References Foam::diag().

Here is the call graph for this function:

◆ solve() [3/4]

Foam::solverPerformance solve ( const dictionary solverControls)

Definition at line 57 of file faScalarMatrix.C.

References Foam::expressions::patchExpr::debug, DebugInFunction, Foam::diag(), Foam::endl(), Foam::Info, Foam::New(), SolverPerformance< Type >::print(), psi, and solve().

Here is the call graph for this function:

◆ residual() [2/3]

Foam::tmp< Foam::scalarField > residual ( ) const

Definition at line 101 of file faScalarMatrix.C.

References psi, tmpNrc< Container< Type > >::ref(), and Foam::Zero.

Here is the call graph for this function:

◆ H() [2/3]

Definition at line 130 of file faScalarMatrix.C.

References GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), Foam::dimArea, H(), DimensionedField< Type, GeoMesh >::mesh(), GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), tmp< T >::ref(), and GeometricField< Type, PatchField, GeoMesh >::ref().

Here is the call graph for this function:

◆ setComponentReference() [3/3]

void setComponentReference ( const label  patchi,
const label  facei,
const  direction,
const scalar  value 
)

◆ solve() [4/4]

SolverPerformance< scalar > solve ( const dictionary )

◆ residual() [3/3]

tmp< scalarField > residual ( ) const

◆ H() [3/3]

tmp< areaScalarField > H ( ) const

Friends And Related Function Documentation

◆ operator

Ostream& operator ( Ostream ,
const faMatrix< Type > &   
)
friend

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