FreeFOAM The Cross-Platform CFD Toolkit
fvMatrix< Type > Class Template Reference

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

#include <finiteVolume/fvMatrix.H>


Detailed Description

template<class Type>
class Foam::fvMatrix< Type >

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

Source files

Definition at line 113 of file fvMatrix.H.

+ Inheritance diagram for fvMatrix< Type >:
+ Collaboration diagram for fvMatrix< Type >:

List of all members.

Classes

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

Public Types

typedef GeometricField< Type,
fvsPatchField, surfaceMesh > * 
surfaceTypeFieldPtr
 Declare return type of the faceFluxCorrectionPtr() function.

Public Member Functions

 ClassName ("fvMatrix")
 fvMatrix (GeometricField< Type, fvPatchField, volMesh > &, const dimensionSet &)
 Construct given a field to solve for.
 fvMatrix (const fvMatrix< Type > &)
 Construct as copy.
 fvMatrix (GeometricField< Type, fvPatchField, volMesh > &, Istream &)
 Construct as copy of tmp<fvMatrix<Type> > deleting argument.
virtual ~fvMatrix ()
const GeometricField< Type,
fvPatchField, volMesh > & 
psi () const
GeometricField< Type,
fvPatchField, volMesh > & 
psi ()
const dimensionSetdimensions () const
Field< Type > & source ()
const Field< Type > & source () const
FieldField< Field, Type > & internalCoeffs ()
 fvBoundary scalar field containing pseudo-matrix coeffs
FieldField< Field, Type > & boundaryCoeffs ()
 fvBoundary scalar field containing pseudo-matrix coeffs
surfaceTypeFieldPtrfaceFluxCorrectionPtr ()
 Return pointer to face-flux non-orthogonal correction field.
void setValues (const labelList &cells, const Field< Type > &values)
 Set solution in given cells and eliminate corresponding.
void setReference (const label celli, const Type &value, const bool forceReference=false)
 Set reference level for solution.
void setComponentReference (const label patchi, const label facei, const direction cmpt, const scalar value)
 Set reference level for a component of the solution.
void relax (const scalar alpha)
 Relax matrix (for steady-state solution).
void relax ()
 Relax matrix (for steady-state solution).
void boundaryManipulate (typename GeometricField< Type, fvPatchField, volMesh >::GeometricBoundaryField &values)
 Manipulate based on a boundary field.
autoPtr< fvSolversolver (const dictionary &)
 Construct and return the solver.
autoPtr< fvSolversolver ()
 Construct and return the solver.
lduMatrix::solverPerformance solve (const dictionary &)
 Solve returning the solution statistics.
lduMatrix::solverPerformance solve ()
 Solve returning the solution statistics.
tmp< Field< Type > > residual () const
 Return the matrix residual.
tmp< scalarFieldD () const
 Return the matrix scalar diagonal.
tmp< Field< Type > > DD () const
 Return the matrix Type diagonal.
tmp< volScalarFieldA () const
 Return the central coefficient.
tmp< GeometricField< Type,
fvPatchField, volMesh > > 
H () const
 Return the H operation source.
tmp< volScalarFieldH1 () const
 Return H(1)
tmp< GeometricField< Type,
fvsPatchField, surfaceMesh > > 
flux () const
 Return the face-flux field from the matrix.
void operator= (const fvMatrix< Type > &)
void operator= (const tmp< fvMatrix< Type > > &)
void negate ()
void operator+= (const fvMatrix< Type > &)
void operator+= (const tmp< fvMatrix< Type > > &)
void operator-= (const fvMatrix< Type > &)
void operator-= (const tmp< fvMatrix< Type > > &)
void operator+= (const DimensionedField< Type, volMesh > &)
void operator+= (const tmp< DimensionedField< Type, volMesh > > &)
void operator+= (const tmp< GeometricField< Type, fvPatchField, volMesh > > &)
void operator-= (const DimensionedField< Type, volMesh > &)
void operator-= (const tmp< DimensionedField< Type, volMesh > > &)
void operator-= (const tmp< GeometricField< Type, fvPatchField, volMesh > > &)
void operator+= (const dimensioned< Type > &)
void operator-= (const dimensioned< Type > &)
void operator+= (const zeroField &)
void operator-= (const zeroField &)
void operator*= (const DimensionedField< scalar, volMesh > &)
void operator*= (const tmp< DimensionedField< scalar, volMesh > > &)
void operator*= (const tmp< volScalarField > &)
void operator*= (const dimensioned< scalar > &)
template<>
void setComponentReference (const label patchi, const label facei, const direction, const scalar value)
template<>
Foam::autoPtr< Foam::fvMatrix
< Foam::scalar >::fvSolver
solver (const dictionary &solverControls)
template<>
Foam::lduMatrix::solverPerformance solve (const dictionary &solverControls)
template<>
Foam::tmp< Foam::scalarFieldresidual () const
template<>
Foam::tmp< Foam::volScalarFieldH () const
template<>
Foam::tmp< Foam::volScalarFieldH1 () const
template<>
void setComponentReference (const label patchi, const label facei, const direction, const scalar value)
template<>
autoPtr< fvMatrix< scalar >
::fvSolver
solver (const dictionary &)
template<>
lduMatrix::solverPerformance solve (const dictionary &)
template<>
tmp< scalarFieldresidual () const
template<>
tmp< volScalarFieldH () const
template<>
tmp< volScalarFieldH1 () const
- Public Member Functions inherited from refCount
 refCount ()
 Construct null with zero count.
int count () const
 Return the reference count.
bool okToDelete () const
 Return true if the reference count is zero.
void resetRefCount ()
 Reset the reference count to zero.
void operator++ ()
 Increment the reference count.
void operator++ (int)
 Increment the reference count.
void operator-- ()
 Decrement the reference count.
void operator-- (int)
 Decrement the reference count.
- Public Member Functions inherited from lduMatrix
 ClassName ("lduMatrix")
 lduMatrix (const lduMesh &)
 Construct given an LDU addressed mesh.
 lduMatrix (const lduMatrix &)
 Construct as copy.
 lduMatrix (lduMatrix &, bool reUse)
 Construct as copy or re-use as specified.
 lduMatrix (const lduMesh &, Istream &)
 Construct given an LDU addressed mesh and an Istream.
 ~lduMatrix ()
const lduMeshmesh () const
 Return the LDU mesh from which the addressing is obtained.
const lduAddressinglduAddr () const
 Return the LDU addressing.
const lduSchedulepatchSchedule () const
 Return the patch evaluation schedule.
scalarFieldlower ()
scalarFielddiag ()
scalarFieldupper ()
const scalarFieldlower () const
const scalarFielddiag () const
const scalarFieldupper () const
bool hasDiag () const
bool hasUpper () const
bool hasLower () const
bool diagonal () const
bool symmetric () const
bool asymmetric () const
void sumDiag ()
void negSumDiag ()
void sumMagOffDiag (scalarField &sumOff) const
void Amul (scalarField &, const tmp< scalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
 Matrix multiplication with updated interfaces.
void Tmul (scalarField &, const tmp< scalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
 Matrix transpose multiplication with updated interfaces.
void sumA (scalarField &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &) const
 Sum the coefficients on each row of the matrix.
void residual (scalarField &rA, const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
tmp< scalarFieldresidual (const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
void initMatrixInterfaces (const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const scalarField &psiif, scalarField &result, const direction cmpt) const
 Initialise the update of interfaced interfaces.
void updateMatrixInterfaces (const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const scalarField &psiif, scalarField &result, const direction cmpt) const
 Update interfaced interfaces for matrix operations.
template<class Type >
tmp< Field< Type > > H (const Field< Type > &) const
template<class Type >
tmp< Field< Type > > H (const tmp< Field< Type > > &) const
template<class Type >
tmp< Field< Type > > faceH (const Field< Type > &) const
template<class Type >
tmp< Field< Type > > faceH (const tmp< Field< Type > > &) const
void operator= (const lduMatrix &)
void operator+= (const lduMatrix &)
void operator-= (const lduMatrix &)
void operator*= (const scalarField &)
void operator*= (scalar)

Friends

tmp< GeometricField< Type,
fvPatchField, volMesh > > 
operator& (const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
tmp< GeometricField< Type,
fvPatchField, volMesh > > 
operator& (const fvMatrix< Type > &, const tmp< GeometricField< Type, fvPatchField, volMesh > > &)
tmp< GeometricField< Type,
fvPatchField, volMesh > > 
operator& (const tmp< fvMatrix< Type > > &, const DimensionedField< Type, volMesh > &)
tmp< GeometricField< Type,
fvPatchField, volMesh > > 
operator& (const tmp< fvMatrix< Type > > &, const tmp< GeometricField< Type, fvPatchField, volMesh > > &)
Ostreamoperator (Ostream &, const fvMatrix< Type > &)

Additional Inherited Members

- Static Public Attributes inherited from lduMatrix
static const scalar great_ = 1.0e+20
 Large scalar for the use in solvers.
static const scalar small_ = 1.0e-20
 Small scalar for the use in solvers.

Member Typedef Documentation

Declare return type of the faceFluxCorrectionPtr() function.

Definition at line 307 of file fvMatrix.H.


Constructor & Destructor Documentation

fvMatrix ( GeometricField< Type, fvPatchField, volMesh > &  psi,
const dimensionSet ds 
)

Construct given a field to solve for.

Definition at line 184 of file fvMatrix.C.

References fvMesh::boundary(), Foam::endl(), forAll, Foam::Info, DimensionedField< Type, GeoMesh >::mesh(), and PtrList< T >::size().

fvMatrix ( const fvMatrix< Type > &  fvm)

Construct as copy.

Definition at line 234 of file fvMatrix.C.

References Foam::endl(), Foam::Info, and IOobject::name().

fvMatrix ( GeometricField< Type, fvPatchField, volMesh > &  psi,
Istream is 
)

Construct as copy of tmp<fvMatrix<Type> > deleting argument.

Construct from Istream given field to solve for

Definition at line 323 of file fvMatrix.C.

References fvMesh::boundary(), Foam::endl(), forAll, Foam::Info, DimensionedField< Type, GeoMesh >::mesh(), and PtrList< T >::size().

~fvMatrix ( )
virtual

Definition at line 372 of file fvMatrix.C.

References Foam::endl(), and Foam::Info.


Member Function Documentation

ClassName ( "fvMatrix< Type >"  )
GeometricField<Type, fvPatchField, volMesh>& psi ( )
inline

Definition at line 270 of file fvMatrix.H.

const dimensionSet& dimensions ( ) const
inline
const Field<Type>& source ( ) const
inline

Definition at line 285 of file fvMatrix.H.

FieldField<Field, Type>& internalCoeffs ( )
inline

fvBoundary scalar field containing pseudo-matrix coeffs

for internal cells

Definition at line 292 of file fvMatrix.H.

Referenced by gaussConvectionScheme< Type >::fvmDiv().

FieldField<Field, Type>& boundaryCoeffs ( )
inline

fvBoundary scalar field containing pseudo-matrix coeffs

for boundary cells

Definition at line 299 of file fvMatrix.H.

Referenced by gaussConvectionScheme< Type >::fvmDiv().

surfaceTypeFieldPtr& faceFluxCorrectionPtr ( )
inline

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

Definition at line 310 of file fvMatrix.H.

Referenced by gaussLaplacianScheme< Type, GType >::fvmLaplacian().

void setValues ( const labelList cells,
const Field< Type > &  values 
)

Set solution in given cells and eliminate corresponding.

equations from the matrix

Definition at line 394 of file fvMatrix.C.

References polyMesh::boundaryMesh(), cells, primitiveMesh::cells(), Foam::diag(), forAll, primitiveMesh::isInternalFace(), mesh, fvMesh::neighbour(), fvMesh::owner(), patchi, and polyBoundaryMesh::whichPatch().

Referenced by fixedInternalValueFvPatchField< Type >::manipulateMatrix().

void setReference ( const label  celli,
const Type &  value,
const bool  forceReference = false 
)

Set reference level for solution.

Definition at line 476 of file fvMatrix.C.

References Foam::diag().

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 30 of file fvMatrixSolve.C.

References Foam::diag(), and patchi.

void relax ( )

Relax matrix (for steady-state solution).

alpha is read from controlDict

Definition at line 581 of file fvMatrix.C.

References relax().

void boundaryManipulate ( typename GeometricField< Type, fvPatchField, volMesh >::GeometricBoundaryField &  values)

Manipulate based on a boundary field.

Definition at line 592 of file fvMatrix.C.

References forAll.

Construct and return the solver.

Use the given solver controls

Referenced by radiativeIntensityRay::correct().

Foam::autoPtr< typename Foam::fvMatrix< Type >::fvSolver > solver ( )

Construct and return the solver.

Solver controls read from fvSolution

Definition at line 170 of file fvMatrixSolve.C.

Solve returning the solution statistics.

Solver controls read from fvSolution

Definition at line 183 of file fvMatrixSolve.C.

References DimensionedField< Type, GeoMesh >::mesh(), IOobject::name(), and solution::solverDict().

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

Return the matrix scalar diagonal.

Definition at line 605 of file fvMatrix.C.

References Foam::diag().

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

Return the matrix Type diagonal.

Definition at line 614 of file fvMatrix.C.

References fvPatchField< Type >::coupled(), Foam::diag(), forAll, and List< Type >::size().

Return the central coefficient.

Definition at line 638 of file fvMatrix.C.

References Foam::dimVol, IOobject::NO_READ, and IOobject::NO_WRITE.

Return H(1)

Reimplemented from lduMatrix.

Definition at line 733 of file fvMatrix.C.

References Foam::dimVol, lduMatrix::H1(), IOobject::NO_READ, and IOobject::NO_WRITE.

void operator= ( const fvMatrix< Type > &  fvmv)

Definition at line 867 of file fvMatrix.C.

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

void operator= ( const tmp< fvMatrix< Type > > &  tfvmv)

Definition at line 902 of file fvMatrix.C.

void negate ( )

Reimplemented from lduMatrix.

Definition at line 910 of file fvMatrix.C.

References lduMatrix::negate().

void operator+= ( const fvMatrix< Type > &  fvmv)

Definition at line 925 of file fvMatrix.C.

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

void operator+= ( const tmp< fvMatrix< Type > > &  tfvmv)

Definition at line 951 of file fvMatrix.C.

void operator-= ( const fvMatrix< Type > &  fvmv)

Definition at line 959 of file fvMatrix.C.

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

void operator-= ( const tmp< fvMatrix< Type > > &  tfvmv)

Definition at line 983 of file fvMatrix.C.

void operator+= ( const DimensionedField< Type, volMesh > &  su)

Definition at line 992 of file fvMatrix.C.

References Foam::checkMethod().

void operator+= ( const tmp< DimensionedField< Type, volMesh > > &  tsu)

Definition at line 1003 of file fvMatrix.C.

void operator+= ( const tmp< GeometricField< Type, fvPatchField, volMesh > > &  tsu)

Definition at line 1014 of file fvMatrix.C.

void operator-= ( const DimensionedField< Type, volMesh > &  su)

Definition at line 1025 of file fvMatrix.C.

References Foam::checkMethod().

void operator-= ( const tmp< DimensionedField< Type, volMesh > > &  tsu)

Definition at line 1036 of file fvMatrix.C.

void operator-= ( const tmp< GeometricField< Type, fvPatchField, volMesh > > &  tsu)

Definition at line 1047 of file fvMatrix.C.

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

Definition at line 1058 of file fvMatrix.C.

References DimensionedField< Type, GeoMesh >::mesh(), psi, and fvMesh::V().

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

Definition at line 1068 of file fvMatrix.C.

References DimensionedField< Type, GeoMesh >::mesh(), psi, and fvMesh::V().

void operator+= ( const zeroField )

Definition at line 1078 of file fvMatrix.C.

void operator-= ( const zeroField )

Definition at line 1086 of file fvMatrix.C.

void operator*= ( const tmp< DimensionedField< scalar, volMesh > > &  tdsf)

Definition at line 1127 of file fvMatrix.C.

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

Definition at line 1138 of file fvMatrix.C.

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

Definition at line 1149 of file fvMatrix.C.

References lduMatrix::operator*=().

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

Definition at line 33 of file fvScalarMatrix.C.

References Foam::diag(), and patchi.

Foam::autoPtr< Foam::fvMatrix< Foam::scalar >::fvSolver > solver ( const dictionary solverControls)

Definition at line 58 of file fvScalarMatrix.C.

References Foam::diag(), Foam::endl(), and Foam::Info.

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

Definition at line 164 of file fvScalarMatrix.C.

Reimplemented from lduMatrix.

Definition at line 220 of file fvScalarMatrix.C.

References Foam::dimVol.

void setComponentReference ( const label  patchi,
const label  facei,
const direction  ,
const scalar  value 
)
autoPtr< fvMatrix< scalar >::fvSolver > solver ( const dictionary )
tmp< scalarField > residual ( ) const
tmp< volScalarField > H ( ) const
tmp< volScalarField > H1 ( ) const

Reimplemented from lduMatrix.


Friends And Related Function Documentation

tmp<GeometricField<Type, fvPatchField, volMesh> > operator& ( const fvMatrix< Type > &  ,
const DimensionedField< Type, volMesh > &   
)
friend
tmp<GeometricField<Type, fvPatchField, volMesh> > operator& ( const fvMatrix< Type > &  ,
const tmp< GeometricField< Type, fvPatchField, volMesh > > &   
)
friend
tmp<GeometricField<Type, fvPatchField, volMesh> > operator& ( const tmp< fvMatrix< Type > > &  ,
const DimensionedField< Type, volMesh > &   
)
friend
tmp<GeometricField<Type, fvPatchField, volMesh> > operator& ( const tmp< fvMatrix< Type > > &  ,
const tmp< GeometricField< Type, fvPatchField, volMesh > > &   
)
friend
Ostream& operator ( Ostream ,
const fvMatrix< Type > &   
)
friend

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