extendedBlockLduMatrices - preparation for BlockILUCp algorithm

This commit is contained in:
Vuko Vukcevic 2015-06-27 22:46:49 +02:00 committed by Hrvoje Jasak
parent 52d2c0c099
commit f5d0d8ed0c
9 changed files with 642 additions and 2 deletions

View file

@ -663,6 +663,8 @@ matrices/blockLduMatrix/BlockLduMatrix/symmTensorBlockLduMatrix.C
matrices/blockLduMatrix/BlockLduMatrix/tensorBlockLduMatrix.C
matrices/blockLduMatrix/BlockLduMatrix/blockVectorNMatrices.C
matrices/blockLduMatrix/BlockLduMatrix/BlockConstraint/scalarBlockConstraint.C
matrices/blockLduMatrix/BlockLduMatrix/extendedBlockLduMatrix/extendedBlockLduMatrices.C
matrices/blockLduMatrix/BlockLduMatrix/extendedBlockLduMatrix/extendedBlockVectorNMatrices.C
BlockLduInterfaceField = matrices/blockLduMatrix/BlockLduMatrix/BlockLduInterfaceField
$(BlockLduInterfaceField)/BlockLduInterfaceFields.C

View file

@ -22,7 +22,7 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Block matrix member static data members
Block matrix member static data members
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.

View file

@ -22,7 +22,7 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Block matrix member static data members
Block matrix member static data members
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.

View file

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Description
Extended block matrix static data members
Author
Vuko Vukcevic, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "extendedBlockLduMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineNamedTemplateTypeNameAndDebug(extendedBlockScalarMatrix, 0);
defineNamedTemplateTypeNameAndDebug(extendedBlockVectorMatrix, 0);
defineNamedTemplateTypeNameAndDebug(extendedBlockSphericalTensorMatrix, 0);
defineNamedTemplateTypeNameAndDebug(extendedBlockSymmTensorMatrix, 0);
defineNamedTemplateTypeNameAndDebug(extendedBlockTensorMatrix, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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
extendedBlockLduMatrix
Description
Typedefs for extended block matrices
Author
Vuko Vukcevic, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#ifndef extendedBlockLduMatrices_H
#define extendedBlockLduMatrices_H
#include "extendedBlockLduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef extendedBlockLduMatrix<scalar> extendedBlockScalarMatrix;
typedef extendedBlockLduMatrix<vector> extendedBlockVectorMatrix;
typedef extendedBlockLduMatrix<sphericalTensor>
extendedBlockSphericalTensorMatrix;
typedef extendedBlockLduMatrix<symmTensor> extendedBlockSymmTensorMatrix;
typedef extendedBlockLduMatrix<tensor> extendedBlockTensorMatrix;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,259 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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 "extendedBlockLduMatrix.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::extendedBlockLduMatrix<Type>::extendedBlockLduMatrix
(
const blockLduMatrix& blockLdum,
const label extensionLevel,
const polyMesh& polyMesh
)
:
basicBlockLduMatrix_(blockLdum),
extLduAddr_
(
extendedLduAddressing::New
(
polyMesh,
blockLdum.lduAddr(),
extensionLevel
)
),
extendedLowerPtr_(NULL),
extendedUpperPtr_(NULL)
{
if (debug)
{
Info<< "extendedBlockLduMatrix(lduMatrix&, label, polyMesh&) :"
"Constructing extendedBlockLduMatrix."
<< endl;
}
if (blockLdum.diagonal())
{
WarningIn("extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)")
<< "Attempted to create extended lower/upper coeffs for block "
<< "matrix that is diagonal."
<< nl << endl;
}
else if (blockLdum.symmetric())
{
// Get reference to faceMap in extended addressing
const unallocLabelList& faceMap = extLduAddr_.faceMap();
// Avoid assuming it's upper if the matrix is symmetric
if (blockLdum.hasUpper())
{
// Allocate extended upper only
extendedUpperPtr_ = new TypeCoeffField
(
extLduAddr_.extendedUpperAddr().size(),
pTraits<Type>::zero
);
TypeCoeffField& extUpper = *extendedUpperPtr_;
// Get upper coeffs from underlying lduMatrix
const TypeCoeffField& upper = blockLdum.upper();
// Copy non-zero coeffs from basic lduMatrix into corresponding
// positions
forAll (upper, faceI)
{
extUpper[faceMap[faceI]] = upper[faceI];
}
}
else
{
// Allocate extended lower only
extendedLowerPtr_ = new TypeCoeffField
(
extLduAddr_.extendedLowerAddr().size(),
pTraits<Type>::zero
);
TypeCoeffField& extLower = *extendedLowerPtr_;
// Get lower coeffs from underlying lduMatrix
const TypeCoeffField& lower = blockLdum.lower();
// Copy non-zero coeffs from basic lduMatrix into corresponding
// positions
forAll (lower, faceI)
{
extLower[faceMap[faceI]] = lower[faceI];
}
}
}
else
{
// Get reference to faceMap in extended addressing
const unallocLabelList& faceMap = extLduAddr_.faceMap();
// Get number of extended faces
const label nExtFaces = extLduAddr_.extendedUpperAddr().size();
// Allocate extended upper and lower
extendedUpperPtr_ = new TypeCoeffField(nExtFaces, pTraits<Type>::zero);
TypeCoeffField& extUpper = *extendedUpperPtr_;
extendedLowerPtr_ = new TypeCoeffField(nExtFaces, pTraits<Type>::zero);
TypeCoeffField& extLower = *extendedLowerPtr_;
// Get upper and lower coeffs from underlying lduMatrix
const TypeCoeffField& upper = blockLdum.upper();
const TypeCoeffField& lower = blockLdum.lower();
// Copy non-zero coeffs from basic lduMatrix into corresponding
// positions
forAll (upper, faceI)
{
extUpper[faceMap[faceI]] = upper[faceI];
extLower[faceMap[faceI]] = lower[faceI];
}
}
}
// * * * * * * * * * * * * * * * * Destructor* * * * * * * * * * * * * * * * //
template<class Type>
Foam::extendedBlockLduMatrix<Type>::~extendedBlockLduMatrix()
{
if (extendedLowerPtr_)
{
delete extendedLowerPtr_;
}
if (extendedUpperPtr_)
{
delete extendedUpperPtr_;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
typename Foam::extendedBlockLduMatrix<Type>::TypeCoeffField&
Foam::extendedBlockLduMatrix<Type>::extendedLower()
{
if (!extendedLowerPtr_)
{
if (extendedUpperPtr_)
{
extendedLowerPtr_ = new TypeCoeffField(*extendedUpperPtr_);
}
else
{
extendedLowerPtr_ = new TypeCoeffField
(
extLduAddr_.extendedLowerAddr().size(),
pTraits<Type>::zero
);
}
}
return *extendedLowerPtr_;
}
template<class Type>
typename Foam::extendedBlockLduMatrix<Type>::TypeCoeffField&
Foam::extendedBlockLduMatrix<Type>::extendedUpper()
{
if (!extendedUpperPtr_)
{
if (extendedLowerPtr_)
{
extendedUpperPtr_ = new TypeCoeffField(*extendedLowerPtr_);
}
else
{
extendedUpperPtr_ = new TypeCoeffField
(
extLduAddr_.extendedUpperAddr().size(),
pTraits<Type>::zero
);
}
}
return *extendedUpperPtr_;
}
template<class Type>
const typename Foam::extendedBlockLduMatrix<Type>::TypeCoeffField&
Foam::extendedBlockLduMatrix<Type>::extendedLower() const
{
if (!extendedLowerPtr_ && !extendedUpperPtr_)
{
FatalErrorIn
(
"const CoeffField<Type>& "
"extendedBlockLduMatrix<Type>::extendedLower() const"
) << "extendedLowerPtr_ or extendedUpperPtr_ unallocated"
<< abort(FatalError);
}
if (extendedLowerPtr_)
{
return *extendedLowerPtr_;
}
else
{
return *extendedUpperPtr_;
}
}
template<class Type>
const typename Foam::extendedBlockLduMatrix<Type>::TypeCoeffField&
Foam::extendedBlockLduMatrix<Type>::extendedUpper() const
{
if (!extendedLowerPtr_ && !extendedUpperPtr_)
{
FatalErrorIn
(
"const CoeffField<Type>& "
"extendedBlockLduMatrix<Type>::extendedLower() const"
) << "extendedLowerPtr_ or extendedUpperPtr_ unallocated"
<< abort(FatalError);
}
if (extendedUpperPtr_)
{
return *extendedUpperPtr_;
}
else
{
return *extendedLowerPtr_;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,150 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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
Foam::extendedBlockLduMatrix
Description
Extension of lower and upper coeffs of BlockLduMatrix. Uses faceMap from
extendedLduAddressing to define extended lower and upper coeffs from
ordinary lower and upper coeffs given by ordinary BlockLduMatrix. Used in
ILUCp preconditioner.
SourceFiles
extendedBlockLduMatrix.C
\*---------------------------------------------------------------------------*/
#ifndef extendedBlockLduMatrix_H
#define extendedBlockLduMatrix_H
#include "extendedLduAddressing.H"
#include "polyMesh.H"
#include "className.H"
#include "BlockLduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extendedBlockLduMatrix Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class extendedBlockLduMatrix
{
// Public data type
typedef typename BlockLduMatrix<Type>::TypeCoeffField TypeCoeffField;
private:
// Private data
//- Reference to underlying BlockLduMatrix
const BlockLduMatrix<Type>& basicBlockLduMatrix_;
//- Reference to extended ldu addressing
const extendedLduAddressing& extLduAddr_;
//- Extended lower coeffs
CoeffField<Type>* extendedLowerPtr_;
//- Extended upper coeffs
CoeffField<Type>* extendedUpperPtr_;
// Private member functions
//- Disallow default bitwise copy construct
extendedBlockLduMatrix(const extendedBlockLduMatrix<Type>&);
//- Disallow default bitwise assignement
void operator=(const extendedBlockLduMatrix<Type>&);
public:
ClassName("extendedBlockLduMatrix");
// Constructors
//- Construct given BlockduMatrix, extension level and polyMesh
extendedBlockLduMatrix
(
const BlockLduMatrix<Type>&,
const label,
const polyMesh&
);
// Destructor
~extendedBlockLduMatrix();
// Member functions
// Access
//- Const access to underlying basic BlockLduMatrix
const lduMatrix& basicBlockLduMatrix() const
{
return basicBlockLduMatrix_;
};
//- Const access to extendedLduAddressing
const extendedLduAddressing& extendedLduAddr() const
{
return extLduAddr_;
};
//- Non-const access to extended lower coeffs
TypeCoeffField& extendedLower();
//- Non-const access to extended upper coeffs
TypeCoeffField& extendedUpper();
//- Const access to extended lower coeffs
const TypeCoeffField& extendedLower() const;
//- Const access to extended upper coeffs
const TypeCoeffField& extendedUpper() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Description
Extended block matrix static data members
Author
Vuko Vukcevic, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "coeffFields.H"
#include "extendedBlockVectorNMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
#define makeNamedTemplateTypeNameAndDebug(type, Type, args...) \
defineNamedTemplateTypeNameAndDebug(block##Type##Matrix, 0);
forAllVectorNTypes(makeNamedTemplateTypeNameAndDebug);
#undef makeNamedTemplateTypeNameAndDebug
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
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
extendedBlockLduMatrix
Description
Typedefs for extended block matrices
Author
Vuko Vukcevic, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#ifndef blockVectorNMatrices_H
#define blockVectorNMatrices_H
#include "extendedBlockLduMatrices.H"
#include "VectorTensorNFieldsFwd.H"
#include "ExpandTensorNField.H"
#include "VectorNFieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
#define makeTypedef(type, Type, args...) \
typedef extendedBlockLduMatrix<type> block##Type##Matrix;
forAllVectorNTypes(makeTypedef)
#undef makeTypedef
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //