Initial version: block diag Cholesky precon

This commit is contained in:
Hrvoje Jasak 2015-08-21 08:16:36 +01:00
parent 1685dc4565
commit db2d2ff530
10 changed files with 2111 additions and 0 deletions

View file

@ -689,6 +689,11 @@ matrices/blockLduMatrix/BlockLduPrecons/BlockGaussSeidelPrecon/blockGaussSeidelP
matrices/blockLduMatrix/BlockLduPrecons/BlockCholeskyPrecon/scalarBlockCholeskyPrecon.C
matrices/blockLduMatrix/BlockLduPrecons/BlockCholeskyPrecon/tensorBlockCholeskyPrecon.C
matrices/blockLduMatrix/BlockLduPrecons/BlockCholeskyPrecon/blockCholeskyPrecons.C
matrices/blockLduMatrix/BlockLduPrecons/BlockDiagCholeskyPrecon/scalarBlockDiagCholeskyPrecon.C
matrices/blockLduMatrix/BlockLduPrecons/BlockDiagCholeskyPrecon/tensorBlockDiagCholeskyPrecon.C
matrices/blockLduMatrix/BlockLduPrecons/BlockDiagCholeskyPrecon/blockDiagCholeskyPrecons.C
matrices/blockLduMatrix/BlockLduPrecons/BlockAmgPrecon/blockAmgPrecons.C
matrices/blockLduMatrix/BlockLduSmoothers/BlockLduSmoother/blockLduSmoothers.C

View file

@ -0,0 +1,235 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockDiagCholeskyPrecon
Description
Incomplete Cholesky preconditioning with no fill-in,
using the diagonal-of-diagonal for ILU decomposition.
Currently broken
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
BlockDiagCholeskyPrecon.C
BlockDiagCholeskyPreconDecoupled.C
\*---------------------------------------------------------------------------*/
#ifndef BlockDiagCholeskyPrecon_H
#define BlockDiagCholeskyPrecon_H
#include "BlockLduPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BlockDiagCholeskyPrecon Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class BlockDiagCholeskyPrecon
:
public BlockLduPrecon<Type>
{
// Private Data
//- Preconditioned diagonal
mutable CoeffField<Type> preconDiag_;
//- Off-diag part of diagonal
CoeffField<Type> LUDiag_;
//- Temporary space for updated decoupled source
// Initialised with zero size and resized on first use
mutable Field<Type> bPlusLU_;
// Private Member Functions
//- Disallow default bitwise copy construct
BlockDiagCholeskyPrecon(const BlockDiagCholeskyPrecon&);
//- Disallow default bitwise assignment
void operator=(const BlockDiagCholeskyPrecon&);
//- Precondition the diagonal
void calcPreconDiag();
// Diagonal multiplication, symmetric matrix
template<class DiagType, class ULType>
void diagMultiply
(
Field<DiagType>& dDiag,
const Field<ULType>& upper
);
//- Diagonal multiplication with transpose upper square coeff
// for the symmetric matrix
template<class DiagType, class ULType>
void diagMultiplyCoeffT
(
Field<DiagType>& dDiag,
const Field<ULType>& upper
);
//- Diagonal multiplication, asymmetric matrix
template<class DiagType, class ULType>
void diagMultiply
(
Field<DiagType>& dDiag,
const Field<ULType>& lower,
const Field<ULType>& upper
);
//- ILU multiplication, symmetric matrix
template<class DiagType, class ULType>
void ILUmultiply
(
Field<Type>& x,
const Field<DiagType>& dDiag,
const Field<ULType>& upper,
const Field<Type>& b
) const;
//- ILU multiplication, with transpose upper square coeff
// for a symmetric matrix
template<class DiagType, class ULType>
void ILUmultiplyCoeffT
(
Field<Type>& x,
const Field<DiagType>& dDiag,
const Field<ULType>& upper,
const Field<Type>& b
) const;
//- ILU multiplication, asymmetric matrix
template<class DiagType, class ULType>
void ILUmultiply
(
Field<Type>& x,
const Field<DiagType>& dDiag,
const Field<ULType>& lower,
const Field<ULType>& upper,
const Field<Type>& b
) const;
//- ILU multiplication transposed asymmetric matrix
template<class DiagType, class ULType>
void ILUmultiplyTranspose
(
Field<Type>& x,
const Field<DiagType>& dDiag,
const Field<ULType>& lower,
const Field<ULType>& upper,
const Field<Type>& b
) const;
// Decoupled operations, used in template specialisation
//- Precondition the diagonal, decoupled version
void calcDecoupledPreconDiag();
//- Execute preconditioning, decoupled version
void decoupledPrecondition
(
Field<Type>& x,
const Field<Type>& b
) const;
//- Execute preconditioning with matrix transpose,
// decoupled version
void decoupledPreconditionT
(
Field<Type>& xT,
const Field<Type>& bT
) const;
public:
//- Runtime type information
TypeName("Cholesky");
// Constructors
//- Construct from matrix for smoother use
BlockDiagCholeskyPrecon
(
const BlockLduMatrix<Type>& matrix
);
//- Construct from components
BlockDiagCholeskyPrecon
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict
);
// Destructor
virtual ~BlockDiagCholeskyPrecon();
// Member Functions
//- Execute preconditioning
virtual void precondition
(
Field<Type>& x,
const Field<Type>& b
) const;
//- Execute preconditioning with matrix transpose
virtual void preconditionT
(
Field<Type>& xT,
const Field<Type>& bT
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "BlockDiagCholeskyPrecon.C"
# include "BlockDiagCholeskyPreconDecoupled.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,332 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "BlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::BlockDiagCholeskyPrecon<Type>::calcDecoupledPreconDiag()
{
typedef CoeffField<Type> TypeCoeffField;
// Note: Assuming lower and upper triangle have the same active type
if (this->matrix_.symmetric())
{
const TypeCoeffField& UpperCoeff = this->matrix_.upper();
if (preconDiag_.activeType() == blockCoeffBase::SCALAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
diagMultiply
(
preconDiag_.asScalar(),
UpperCoeff.asScalar()
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
diagMultiply
(
preconDiag_.asLinear(),
UpperCoeff.asLinear()
);
}
}
else if (preconDiag_.activeType() == blockCoeffBase::LINEAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
diagMultiply
(
preconDiag_.asLinear(),
UpperCoeff.asScalar()
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
diagMultiply
(
preconDiag_.asLinear(),
UpperCoeff.asLinear()
);
}
}
}
else // Asymmetric matrix
{
const TypeCoeffField& LowerCoeff = this->matrix_.lower();
const TypeCoeffField& UpperCoeff = this->matrix_.upper();
if (preconDiag_.activeType() == blockCoeffBase::SCALAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
diagMultiply
(
preconDiag_.asScalar(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar()
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
diagMultiply
(
preconDiag_.asLinear(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear()
);
}
}
else if (preconDiag_.activeType() == blockCoeffBase::LINEAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
diagMultiply
(
preconDiag_.asLinear(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar()
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
diagMultiply
(
preconDiag_.asLinear(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear()
);
}
}
}
// Invert the diagonal
// Note: since square diag type does not exist, simple inversion
// covers all cases
preconDiag_ = inv(preconDiag_);
}
template<class Type>
void Foam::BlockDiagCholeskyPrecon<Type>::decoupledPrecondition
(
Field<Type>& x,
const Field<Type>& b
) const
{
typedef CoeffField<Type> TypeCoeffField;
// Note: Assuming lower and upper triangle have the same active type
if (this->matrix_.symmetric())
{
const TypeCoeffField& UpperCoeff = this->matrix_.upper();
if (preconDiag_.activeType() == blockCoeffBase::SCALAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiply
(
x,
preconDiag_.asScalar(),
UpperCoeff.asScalar(),
b
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiply
(
x,
preconDiag_.asScalar(),
UpperCoeff.asLinear(),
b
);
}
}
else if (preconDiag_.activeType() == blockCoeffBase::LINEAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiply
(
x,
preconDiag_.asLinear(),
UpperCoeff.asScalar(),
b
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiply
(
x,
preconDiag_.asLinear(),
UpperCoeff.asLinear(),
b
);
}
}
}
else // Asymmetric matrix
{
const TypeCoeffField& LowerCoeff = this->matrix_.lower();
const TypeCoeffField& UpperCoeff = this->matrix_.upper();
if (preconDiag_.activeType() == blockCoeffBase::SCALAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiply
(
x,
preconDiag_.asScalar(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar(),
b
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiply
(
x,
preconDiag_.asScalar(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear(),
b
);
}
}
else if (preconDiag_.activeType() == blockCoeffBase::LINEAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiply
(
x,
preconDiag_.asLinear(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar(),
b
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiply
(
x,
preconDiag_.asLinear(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear(),
b
);
}
}
}
}
template<class Type>
void Foam::BlockDiagCholeskyPrecon<Type>::decoupledPreconditionT
(
Field<Type>& xT,
const Field<Type>& bT
) const
{
typedef CoeffField<Type> TypeCoeffField;
// Note: Assuming lower and upper triangle have the same active type
if (this->matrix_.symmetric())
{
precondition(xT, bT);
}
else // Asymmetric matrix
{
const TypeCoeffField& LowerCoeff = this->matrix_.lower();
const TypeCoeffField& UpperCoeff = this->matrix_.upper();
if (preconDiag_.activeType() == blockCoeffBase::SCALAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiplyTranspose
(
xT,
preconDiag_.asScalar(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar(),
bT
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiplyTranspose
(
xT,
preconDiag_.asScalar(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear(),
bT
);
}
}
else if (preconDiag_.activeType() == blockCoeffBase::LINEAR)
{
if (UpperCoeff.activeType() == blockCoeffBase::SCALAR)
{
ILUmultiplyTranspose
(
xT,
preconDiag_.asLinear(),
LowerCoeff.asScalar(),
UpperCoeff.asScalar(),
bT
);
}
else if (UpperCoeff.activeType() == blockCoeffBase::LINEAR)
{
ILUmultiplyTranspose
(
xT,
preconDiag_.asLinear(),
LowerCoeff.asLinear(),
UpperCoeff.asLinear(),
bT
);
}
}
}
}
// ************************************************************************* //

View file

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "blockLduMatrices.H"
#include "blockLduPrecons.H"
#include "blockDiagCholeskyPrecons.H"
#include "addToRunTimeSelectionTable.H"
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeBlockPrecons(blockDiagCholeskyPrecon);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockDiagCholeskyPrecon
Description
Typedefs for Incomplete Cholesky preconditioning with no fill-in,
using the diagonal-of-diagonal for ILU decomposition.
Currently broken
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
blockDiagCholeskyPrecons.C
\*---------------------------------------------------------------------------*/
#ifndef blockDiagCholeskyPrecons_H
#define blockDiagCholeskyPrecons_H
#include "scalarBlockDiagCholeskyPrecon.H"
#include "tensorBlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef BlockDiagCholeskyPrecon<scalar> blockDiagCholeskyPreconScalar;
typedef BlockDiagCholeskyPrecon<vector> blockDiagCholeskyPreconVector;
typedef BlockDiagCholeskyPrecon<tensor> blockDiagCholeskyPreconTensor;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,199 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef scalarBlockDiagCholeskyPrecon_H
#define scalarBlockDiagCholeskyPrecon_H
#include "BlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::calcPreconDiag()
{
// Precondition the diagonal
if (matrix_.symmetric())
{
const unallocLabelList& upperAddr = matrix_.lduAddr().upperAddr();
const unallocLabelList& lowerAddr = matrix_.lduAddr().lowerAddr();
// Get off-diagonal matrix coefficients
const scalarField& upper = matrix_.upper();
forAll (upper, coeffI)
{
preconDiag_[upperAddr[coeffI]] -=
sqr(upper[coeffI])/preconDiag_[lowerAddr[coeffI]];
}
}
else if (matrix_.asymmetric())
{
const unallocLabelList& upperAddr = matrix_.lduAddr().upperAddr();
const unallocLabelList& lowerAddr = matrix_.lduAddr().lowerAddr();
// Get off-diagonal matrix coefficients
const scalarField& upper = matrix_.upper();
const scalarField& lower = matrix_.lower();
forAll (upper, coeffI)
{
preconDiag_[upperAddr[coeffI]] -=
upper[coeffI]*lower[coeffI]/preconDiag_[lowerAddr[coeffI]];
}
}
// Invert the diagonal for future use
forAll (preconDiag_, i)
{
preconDiag_[i] = 1.0/preconDiag_[i];
}
}
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::precondition
(
scalarField& x,
const scalarField& b
) const
{
forAll(x, i)
{
x[i] = b[i]*preconDiag_[i];
}
if (matrix_.symmetric())
{
const unallocLabelList& upperAddr = matrix_.lduAddr().upperAddr();
const unallocLabelList& lowerAddr = matrix_.lduAddr().lowerAddr();
// Get off-diagonal matrix coefficients
const scalarField& upper = matrix_.upper();
forAll (upper, coeffI)
{
x[upperAddr[coeffI]] -=
preconDiag_[upperAddr[coeffI]]*
upper[coeffI]*x[lowerAddr[coeffI]];
}
forAllReverse (upper, coeffI)
{
x[lowerAddr[coeffI]] -=
preconDiag_[lowerAddr[coeffI]]*
upper[coeffI]*x[upperAddr[coeffI]];
}
}
else if (matrix_.asymmetric())
{
const unallocLabelList& upperAddr = matrix_.lduAddr().upperAddr();
const unallocLabelList& lowerAddr = matrix_.lduAddr().lowerAddr();
const unallocLabelList& losortAddr = matrix_.lduAddr().losortAddr();
// Get off-diagonal matrix coefficients
const scalarField& upper = matrix_.upper();
const scalarField& lower = matrix_.lower();
label losortCoeff;
forAll (lower, coeffI)
{
losortCoeff = losortAddr[coeffI];
x[upperAddr[losortCoeff]] -=
preconDiag_[upperAddr[losortCoeff]]*
lower[losortCoeff]*x[lowerAddr[losortCoeff]];
}
forAllReverse (upper, coeffI)
{
x[lowerAddr[coeffI]] -=
preconDiag_[lowerAddr[coeffI]]*
upper[coeffI]*x[upperAddr[coeffI]];
}
}
}
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::preconditionT
(
scalarField& xT,
const scalarField& bT
) const
{
if (matrix_.symmetric())
{
precondition(xT, bT);
}
forAll(xT, i)
{
xT[i] = bT[i]*preconDiag_[i];
}
if (matrix_.asymmetric())
{
const unallocLabelList& upperAddr = matrix_.lduAddr().upperAddr();
const unallocLabelList& lowerAddr = matrix_.lduAddr().lowerAddr();
const unallocLabelList& losortAddr = matrix_.lduAddr().losortAddr();
// Get off-diagonal matrix coefficients
const scalarField& upper = matrix_.upper();
const scalarField& lower = matrix_.lower();
label losortCoeff;
forAll (lower, coeffI)
{
xT[upperAddr[coeffI]] -=
preconDiag_[upperAddr[coeffI]]*
upper[coeffI]*xT[lowerAddr[coeffI]];
}
forAllReverse (upper, coeffI)
{
losortCoeff = losortAddr[coeffI];
xT[lowerAddr[losortCoeff]] -=
preconDiag_[lowerAddr[losortCoeff]]*
lower[losortCoeff]*xT[upperAddr[losortCoeff]];
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockDiagCholeskyPrecon
Description
Template specialisation for scalar block Cholesky preconditioning
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
scalarBlockDiagCholeskyPrecon.C
\*---------------------------------------------------------------------------*/
#ifndef scalarBlockDiagCholeskyPrecon_H
#define scalarBlockDiagCholeskyPrecon_H
#include "BlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::calcPreconDiag();
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::precondition
(
scalarField& x,
const scalarField& b
) const;
template<>
void Foam::BlockDiagCholeskyPrecon<scalar>::preconditionT
(
scalarField& xT,
const scalarField& bT
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef tensorBlockDiagCholeskyPrecon_H
#define tensorBlockDiagCholeskyPrecon_H
#include "BlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::calcPreconDiag()
{
// Decoupled version
calcDecoupledPreconDiag();
}
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::precondition
(
tensorField& x,
const tensorField& b
) const
{
// Decoupled version
decoupledPrecondition(x, b);
}
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::preconditionT
(
tensorField& xT,
const tensorField& bT
) const
{
// Decoupled version
decoupledPreconditionT(xT, bT);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockDiagCholeskyPrecon
Description
Template specialisation for tensor block Cholesky preconditioning
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
SourceFiles
tensorBlockDiagCholeskyPrecon.C
\*---------------------------------------------------------------------------*/
#ifndef tensorBlockDiagCholeskyPrecon_H
#define tensorBlockDiagCholeskyPrecon_H
#include "BlockDiagCholeskyPrecon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::calcPreconDiag();
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::precondition
(
tensorField& x,
const tensorField& b
) const;
template<>
void Foam::BlockDiagCholeskyPrecon<tensor>::preconditionT
(
tensorField& xT,
const tensorField& bT
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //