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 |
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 > &psi, const dimensionSet &ds) | |
Construct given a field to solve for. More... | |
faMatrix (const faMatrix< Type > &) | |
Copy construct. More... | |
faMatrix (const GeometricField< Type, faPatchField, areaMesh > &psi, Istream &is) | |
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 dimensionSet & | dimensions () const |
Field< Type > & | source () |
const Field< Type > & | source () const |
const FieldField< Field, Type > & | internalCoeffs () const |
FieldField< Field, Type > & | internalCoeffs () |
const FieldField< Field, Type > & | boundaryCoeffs () const |
FieldField< Field, Type > & | boundaryCoeffs () |
edgeTypeFieldPtr & | faceFluxCorrectionPtr () |
Return pointer to face-flux non-orthogonal correction field. More... | |
void | setValues (const labelUList &faceLabels, const Type &value) |
void | setValues (const labelUList &faceLabels, const UList< Type > &values) |
void | setValues (const labelUList &faceLabels, const UIndirectList< Type > &values) |
void | setReference (const label facei, const Type &value, const bool forceReference=false) |
Set reference level for solution. More... | |
void | setReferences (const labelUList &faceLabels, const Type &value, const bool forceReference=false) |
Set reference level for solution. More... | |
void | setReferences (const labelUList &faceLabels, const UList< Type > &values, const bool forceReference=false) |
Set reference level for solution. More... | |
void | setComponentReference (const label patchi, const label facei, const direction cmpt, const scalar value) |
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< scalarField > | D () const |
Return the matrix diagonal. More... | |
tmp< areaScalarField > | A () 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::scalarField > | residual () const |
template<> | |
Foam::tmp< Foam::areaScalarField > | H () const |
template<> | |
void | setComponentReference (const label patchi, const label facei, const direction, const scalar value) |
template<> | |
SolverPerformance< scalar > | solve (const dictionary &) |
template<> | |
tmp< scalarField > | residual () const |
template<> | |
tmp< areaScalarField > | H () const |
Protected Member Functions | |
template<class Type2 > | |
void | addToInternalField (const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const |
Add patch contribution to internal field. More... | |
template<class Type2 > | |
void | addToInternalField (const labelUList &addr, const tmp< Field< Type2 >> &tpf, Field< Type2 > &intf) const |
template<class Type2 > | |
void | subtractFromInternalField (const labelUList &addr, const Field< Type2 > &pf, Field< Type2 > &intf) const |
Subtract patch contribution from internal field. More... | |
template<class Type2 > | |
void | subtractFromInternalField (const labelUList &addr, const tmp< Field< Type2 >> &tpf, Field< Type2 > &intf) const |
void | addBoundaryDiag (scalarField &diag, const direction cmpt) const |
void | addCmptAvBoundaryDiag (scalarField &diag) const |
void | addBoundarySource (Field< Type > &source, const bool couples=true) const |
template<template< class > class ListType> | |
void | setValuesFromList (const labelUList &faceLabels, const ListType< Type > &values) |
Set solution in given faces to the specified values. More... | |
Friends | |
class | faSolver |
Declare friendship with the faSolver class. More... | |
Ostream & | operator (Ostream &, const 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.
Definition at line 59 of file faMatrix.H.
typedef GeometricField<Type, faePatchField, edgeMesh>* edgeTypeFieldPtr |
Declare return type of the faceFluxCorrectionPtr() function.
Definition at line 290 of file faMatrix.H.
faMatrix | ( | const GeometricField< Type, faPatchField, areaMesh > & | psi, |
const dimensionSet & | ds | ||
) |
Construct given a field to solve for.
Definition at line 185 of file faMatrix.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), DebugInFunction, Foam::endl(), forAll, psi, GeometricField< Type, PatchField, GeoMesh >::Boundary::updateCoeffs(), and Foam::Zero.
Copy construct.
Definition at line 237 of file faMatrix.C.
References DebugInFunction, and Foam::endl().
faMatrix | ( | const GeometricField< Type, faPatchField, areaMesh > & | psi, |
Istream & | is | ||
) |
Construct from Istream given field to solve for.
Definition at line 265 of file faMatrix.C.
References DebugInFunction, Foam::endl(), forAll, psi, and Foam::Zero.
|
virtual |
Destructor.
Definition at line 322 of file faMatrix.C.
References DebugInFunction, Foam::deleteDemandDrivenData(), and Foam::endl().
|
protected |
Add patch contribution to internal field.
Definition at line 42 of file faMatrix.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, and UList< T >::size().
|
protected |
Definition at line 66 of file faMatrix.C.
|
protected |
Subtract patch contribution from internal field.
Definition at line 80 of file faMatrix.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, and UList< T >::size().
|
protected |
Definition at line 104 of file faMatrix.C.
|
protected |
Definition at line 117 of file faMatrix.C.
References Foam::component(), Foam::diag(), and forAll.
Referenced by faMatrix< Type >::residual().
|
protected |
Definition at line 135 of file faMatrix.C.
References Foam::cmptAv(), Foam::diag(), and forAll.
Definition at line 151 of file faMatrix.C.
References Foam::cmptMultiply(), faPatchField< Type >::coupled(), forAll, and faPatchField< Type >::patchNeighbourField().
Referenced by faMatrix< Type >::residual().
|
protected |
Set solution in given faces to the specified values.
Definition at line 336 of file faMatrix.C.
References fvMesh::boundary(), Foam::diag(), primitiveMesh::faceEdges(), forAll, Foam::stringOps::lower(), mesh, fvMesh::neighbour(), fvMesh::owner(), primitiveFieldRef(), psi, Foam::stringOps::upper(), Foam::HashTableOps::values(), and Foam::Zero.
ClassName | ( | "faMatrix< Type >" | ) |
Foam::tmp< Foam::faMatrix< Type > > clone | ( | ) | const |
Clone.
Definition at line 309 of file faMatrix.C.
|
inline |
Definition at line 239 of file faMatrix.H.
Referenced by externalFileSource::addSup(), contactHeatFluxSource::addSup(), jouleHeatingSource::addSup(), externalHeatFluxSource::addSup(), Foam::checkMethod(), optionList::constrain(), and faMatrix< Type >::solve().
|
inline |
Definition at line 244 of file faMatrix.H.
Referenced by Foam::checkMethod(), and faMatrix< Type >::operator*=().
|
inline |
Definition at line 249 of file faMatrix.H.
|
inline |
Definition at line 254 of file faMatrix.H.
|
inline |
faBoundary scalar field containing pseudo-matrix coeffs for internal cells
Definition at line 261 of file faMatrix.H.
|
inline |
faBoundary scalar field containing pseudo-matrix coeffs for internal cells
Definition at line 268 of file faMatrix.H.
|
inline |
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition at line 275 of file faMatrix.H.
|
inline |
faBoundary scalar field containing pseudo-matrix coeffs for boundary cells
Definition at line 282 of file faMatrix.H.
|
inline |
Return pointer to face-flux non-orthogonal correction field.
Definition at line 293 of file faMatrix.H.
Referenced by gaussLaplacianScheme< Type >::famLaplacian().
void setValues | ( | const labelUList & | faceLabels, |
const Type & | value | ||
) |
Set solution in given faces to the specified value and eliminate the corresponding equations from the matrix.
Definition at line 425 of file faMatrix.C.
void setValues | ( | const labelUList & | faceLabels, |
const UList< Type > & | values | ||
) |
Set solution in given faces to the specified values and eliminate the corresponding equations from the matrix.
Definition at line 436 of file faMatrix.C.
References Foam::HashTableOps::values().
void setValues | ( | const labelUList & | faceLabels, |
const UIndirectList< Type > & | values | ||
) |
Set solution in given faces to the specified values and eliminate the corresponding equations from the matrix.
Definition at line 447 of file faMatrix.C.
References Foam::HashTableOps::values().
void setReference | ( | const label | facei, |
const Type & | value, | ||
const bool | forceReference = false |
||
) |
Set reference level for solution.
Definition at line 458 of file faMatrix.C.
References Foam::diag(), and UPstream::master().
void setReferences | ( | const labelUList & | faceLabels, |
const Type & | value, | ||
const bool | forceReference = false |
||
) |
Set reference level for solution.
Definition at line 477 of file faMatrix.C.
References Foam::diag(), faceId(), and forAll.
void setReferences | ( | const labelUList & | faceLabels, |
const UList< Type > & | values, | ||
const bool | forceReference = false |
||
) |
Set reference level for solution.
Definition at line 500 of file faMatrix.C.
References Foam::diag(), faceId(), forAll, and Foam::HashTableOps::values().
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().
void relax | ( | const scalar | alpha | ) |
Relax matrix (for steady-state solution).
alpha = 1 : diagonally equal alpha < 1 : ,, dominant alpha = 0 : do nothing Note: Requires positive diagonal.
Definition at line 522 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.
Referenced by jouleHeatingSource::addSup().
void relax | ( | ) |
Relax matrix (for steady-state solution).
alpha is read from controlDict
Definition at line 612 of file faMatrix.C.
References DebugInFunction, Foam::endl(), and relax().
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, refPtr< Container< Type > >::ref(), solve(), and SolverPerformance< Type >::solverName().
Referenced by jouleHeatingSource::addSup(), and KirchhoffShell::solveDisplacement().
Foam::SolverPerformance< Type > solve | ( | ) |
Solve returning the solution statistics.
Solver controls read from faSolution
Definition at line 172 of file faMatrixSolve.C.
References mesh, Foam::name(), and faMatrix< Type >::psi().
Foam::tmp< Foam::Field< Type > > residual | ( | ) | const |
Return the matrix residual.
Definition at line 179 of file faMatrixSolve.C.
References faMatrix< Type >::addBoundaryDiag(), faMatrix< Type >::addBoundarySource(), Field< Type >::component(), tmp< T >::ref(), Field< Type >::replace(), lduMatrix::residual(), and Foam::Zero.
Foam::tmp< Foam::scalarField > D | ( | ) | const |
Return the matrix diagonal.
Definition at line 628 of file faMatrix.C.
References Foam::diag(), and tmp< T >::ref().
Foam::tmp< Foam::areaScalarField > A | ( | ) | const |
Return the central coefficient.
Definition at line 637 of file faMatrix.C.
References GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), D, Foam::dimArea, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), and tmp< T >::ref().
Foam::tmp< Foam::GeometricField< Type, Foam::faPatchField, Foam::areaMesh > > H | ( | ) | const |
Return the H operation source.
Definition at line 664 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.
Foam::tmp< Foam::GeometricField< Type, Foam::faePatchField, Foam::edgeMesh > > flux | ( | ) | const |
Return the face-flux field from the matrix.
Definition at line 708 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().
Definition at line 790 of file faMatrix.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and lduMatrix::operator=().
Definition at line 823 of file faMatrix.C.
void negate | ( | ) |
Definition at line 831 of file faMatrix.C.
References lduMatrix::negate().
Definition at line 846 of file faMatrix.C.
References Foam::checkMethod(), and lduMatrix::operator+=().
Definition at line 872 of file faMatrix.C.
Definition at line 880 of file faMatrix.C.
References Foam::checkMethod(), and lduMatrix::operator-=().
Definition at line 904 of file faMatrix.C.
void operator+= | ( | const GeometricField< Type, faPatchField, areaMesh > & | su | ) |
Definition at line 913 of file faMatrix.C.
References Foam::checkMethod().
void operator+= | ( | const tmp< GeometricField< Type, faPatchField, areaMesh >> & | tsu | ) |
Definition at line 924 of file faMatrix.C.
void operator-= | ( | const GeometricField< Type, faPatchField, areaMesh > & | su | ) |
Definition at line 935 of file faMatrix.C.
References Foam::checkMethod().
void operator-= | ( | const tmp< GeometricField< Type, faPatchField, areaMesh >> & | tsu | ) |
Definition at line 946 of file faMatrix.C.
void operator+= | ( | const dimensioned< Type > & | su | ) |
Definition at line 957 of file faMatrix.C.
void operator-= | ( | const dimensioned< Type > & | su | ) |
Definition at line 967 of file faMatrix.C.
void operator*= | ( | const areaScalarField & | vsf | ) |
Definition at line 977 of file faMatrix.C.
References Foam::abort(), faMatrix< Type >::dimensions(), Foam::FatalError, FatalErrorInFunction, forAll, and lduMatrix::operator*=().
void operator*= | ( | const tmp< areaScalarField > & | tvsf | ) |
Definition at line 1003 of file faMatrix.C.
void operator*= | ( | const dimensioned< scalar > & | ds | ) |
Definition at line 1014 of file faMatrix.C.
References lduMatrix::operator*=().
void setComponentReference | ( | const label | patchI, |
const label | edgeI, | ||
const | direction, | ||
const scalar | value | ||
) |
Definition at line 40 of file faScalarMatrix.C.
References Foam::diag().
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().
Foam::tmp< Foam::scalarField > residual | ( | ) | const |
Definition at line 101 of file faScalarMatrix.C.
References psi, refPtr< Container< Type > >::ref(), and Foam::Zero.
Foam::tmp< Foam::areaScalarField > H | ( | ) | const |
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().
void setComponentReference | ( | const label | patchi, |
const label | facei, | ||
const | direction, | ||
const scalar | value | ||
) |
SolverPerformance< scalar > solve | ( | const dictionary & | ) |
tmp< scalarField > residual | ( | ) | const |
tmp< areaScalarField > H | ( | ) | const |
|
friend |
Declare friendship with the faSolver class.
Definition at line 104 of file faMatrix.H.