Changed handling of coupled interfaces for ldu - compilation update

This commit is contained in:
Hrvoje Jasak 2013-05-31 11:11:14 +01:00
parent 542c19da79
commit b23535ae7a
23 changed files with 101 additions and 116 deletions

View file

@ -1,9 +1,4 @@
OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C
OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C
OpenFOAM/Fields/DiagTensorNFields.C
OpenFOAM/Fields/SphericalTensorNFields.C
OpenFOAM/DimensionedTypes/dimensionedVectorTensorN/dimensionedVectorTensorN.C
finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C
finiteVolume/fields/fvPatchFields/genericFvPatchVectorNFields.C

View file

@ -34,51 +34,62 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#define VectorNMatrixInterfaceFunc(Type) \
template<> \
void cyclicFvPatchField<Type>::updateInterfaceMatrix \
( \
const Field<Type>& psiInternal, \
Field<Type>& result, \
const BlockLduMatrix<Type>&, \
const CoeffField<Type>& coeffs, \
const Pstream::commsTypes commsType \
) const \
{ \
Field<Type> pnf(this->size()); \
\
label sizeby2 = this->size()/2; \
const unallocLabelList& faceCells = cyclicPatch_.faceCells(); \
\
for (label facei=0; facei<sizeby2; facei++) \
{ \
pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; \
pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; \
} \
\
if (coeffs.activeType() == blockCoeffBase::SCALAR) \
{ \
pnf = coeffs.asScalar() * pnf; \
} \
else if (coeffs.activeType() == blockCoeffBase::LINEAR) \
{ \
pnf = cmptMultiply(coeffs.asLinear(), pnf); \
} \
else if (coeffs.activeType() == blockCoeffBase::SQUARE) \
{ \
pnf = coeffs.asSquare() & pnf; \
} \
\
forAll(faceCells, elemI) \
{ \
result[faceCells[elemI]] -= pnf[elemI]; \
} \
#define VectorNMatrixInterfaceFunc(Type) \
template<> \
void cyclicFvPatchField<Type>::updateInterfaceMatrix \
( \
const Field<Type>& psiInternal, \
Field<Type>& result, \
const BlockLduMatrix<Type>&, \
const CoeffField<Type>& coeffs, \
const Pstream::commsTypes commsType, \
const bool switchToLhs \
) const \
{ \
Field<Type> pnf(this->size()); \
\
label sizeby2 = this->size()/2; \
const unallocLabelList& faceCells = cyclicPatch_.faceCells(); \
\
for (label facei=0; facei<sizeby2; facei++) \
{ \
pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; \
pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; \
} \
\
if (coeffs.activeType() == blockCoeffBase::SCALAR) \
{ \
pnf = coeffs.asScalar() * pnf; \
} \
else if (coeffs.activeType() == blockCoeffBase::LINEAR) \
{ \
pnf = cmptMultiply(coeffs.asLinear(), pnf); \
} \
else if (coeffs.activeType() == blockCoeffBase::SQUARE) \
{ \
pnf = coeffs.asSquare() & pnf; \
} \
\
if (switchToLhs) \
{ \
forAll(faceCells, elemI) \
{ \
result[faceCells[elemI]] += pnf[elemI]; \
} \
} \
else \
{ \
forAll(faceCells, elemI) \
{ \
result[faceCells[elemI]] -= pnf[elemI]; \
} \
} \
}
#define doMakePatchTypeField(type, Type, args...) \
VectorNMatrixInterfaceFunc(type) \
\
#define doMakePatchTypeField(type, Type, args...) \
VectorNMatrixInterfaceFunc(type) \
\
makePatchTypeField(fvPatch##Type##Field, cyclicFvPatch##Type##Field);
forAllVectorNTypes(doMakePatchTypeField)

View file

@ -42,7 +42,8 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate \
Field<Type>&, \
const BlockLduMatrix<Type>&, \
const CoeffField<Type>&, \
const Pstream::commsTypes commsType \
const Pstream::commsTypes commsType, \
const bool switchToLhs \
) const \
{ \
procPatch_.compressedSend \
@ -59,7 +60,8 @@ void processorFvPatchField<Type>::updateInterfaceMatrix \
Field<Type>& result, \
const BlockLduMatrix<Type>&, \
const CoeffField<Type>& coeffs, \
const Pstream::commsTypes commsType \
const Pstream::commsTypes commsType, \
const bool switchToLhs \
) const \
{ \
Field<Type> pnf(this->size()); \
@ -83,9 +85,19 @@ void processorFvPatchField<Type>::updateInterfaceMatrix \
\
const unallocLabelList& faceCells = this->patch().faceCells(); \
\
forAll(faceCells, facei) \
if (switchToLhs) \
{ \
result[faceCells[facei]] -= pnf[facei]; \
forAll(faceCells, elemI) \
{ \
result[faceCells[elemI]] += pnf[elemI]; \
} \
} \
else \
{ \
forAll(faceCells, elemI) \
{ \
result[faceCells[elemI]] -= pnf[elemI]; \
} \
} \
}

View file

@ -25,8 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fvmAdjDiv.H"
#include "fvMesh.H"
#include "fvMatrix.H"
#include "adjConvectionScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -39,7 +39,7 @@ SourceFiles
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "surfaceInterpolationScheme.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvmD2dt2.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrix.H"
#include "d2dt2Scheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -37,7 +37,7 @@ SourceFiles
#define fvmD2dt2_H
#include "volFieldsFwd.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvmDdt.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrix.H"
#include "ddtScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -37,7 +37,7 @@ SourceFiles
#define fvmDdt_H
#include "volFieldsFwd.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
#include "geometricOneField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -26,7 +26,6 @@ License
#include "fvmDiv.H"
#include "fvMesh.H"
#include "fvMatrix.H"
#include "convectionScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -39,7 +39,7 @@ SourceFiles
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "surfaceInterpolationScheme.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,9 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrix.H"
#include "fvmLaplacian.H"
#include "laplacianScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -38,7 +38,7 @@ SourceFiles
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
#include "geometricOneField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvmSup.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -37,7 +37,7 @@ SourceFiles
#define fvmSup_H
#include "volFieldsFwd.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -27,7 +27,7 @@ License
#include "fv.H"
#include "HashTable.H"
#include "linear.H"
#include "fvMatrix.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -69,17 +69,8 @@ Foam::symGaussSeidelPrecon::symGaussSeidelPrecon
coupleIntCoeffs,
interfaces
),
mBouCoeffs_(coupleBouCoeffs.size()),
bPrime_(matrix.lduAddr().size())
{
forAll(mBouCoeffs_, i)
{
if (interfaces_.set(i))
{
mBouCoeffs_.set(i, -coupleBouCoeffs_[i]);
}
}
}
{}
Foam::symGaussSeidelPrecon::symGaussSeidelPrecon
@ -98,17 +89,8 @@ Foam::symGaussSeidelPrecon::symGaussSeidelPrecon
coupleIntCoeffs,
interfaces
),
mBouCoeffs_(coupleBouCoeffs.size()),
bPrime_(matrix.lduAddr().size())
{
forAll(mBouCoeffs_, i)
{
if (interfaces_.set(i))
{
mBouCoeffs_.set(i, -coupleBouCoeffs_[i]);
}
}
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -152,20 +134,22 @@ void Foam::symGaussSeidelPrecon::precondition
{
matrix_.initMatrixInterfaces
(
mBouCoeffs_,
coupleBouCoeffs_,
interfaces_,
x,
bPrime_,
cmpt
cmpt,
true // switch to lhs of system
);
matrix_.updateMatrixInterfaces
(
mBouCoeffs_,
coupleBouCoeffs_,
interfaces_,
x,
bPrime_,
cmpt
cmpt,
true // switch to lhs of system
);
}
@ -269,20 +253,22 @@ void Foam::symGaussSeidelPrecon::preconditionT
{
matrix_.initMatrixInterfaces
(
mBouCoeffs_,
coupleBouCoeffs_,
interfaces_,
x,
bPrime_,
cmpt
cmpt,
true // switch to lhs of system
);
matrix_.updateMatrixInterfaces
(
mBouCoeffs_,
coupleBouCoeffs_,
interfaces_,
x,
bPrime_,
cmpt
cmpt,
true // switch to lhs of system
);
}

View file

@ -56,20 +56,6 @@ class symGaussSeidelPrecon
{
// Private Data
// NOTE: Coupled boundary is treated as an effective Jacobi
// interface in the boundary. Note: there is a change of sign
// in the coupled interface update. The reason for this is
// that the internal coefficients are all located at the
// l.h.s. of the matrix whereas the "implicit" coefficients on
// the coupled boundaries are all created as if the
// coefficient contribution is of a source-kind (i.e. they
// have a sign as if they are on the r.h.s. of the matrix. To
// compensate for this, it is necessary to turn the sign of
// the contribution.
//- Negative boundary coefficients
FieldField<Field, scalar> mBouCoeffs_;
//- Temporary space for solution intermediate
mutable scalarField bPrime_;

View file

@ -133,7 +133,7 @@ bool Foam::mixingPlaneCheckFunctionObject::execute()
// single processor when running in parallel
scalar sumMasterAreas = sum(masterAreas);
scalar sumShadowAreas = sum(shadowAreas);
scalar sumMixingAreas = sum(mixingPlanePatchAreas);
// scalar sumMixingAreas = sum(mixingPlanePatchAreas);
#if 0 // Remove this for now
Info<< "Mixing plane functionObject: area check " << nl
@ -215,7 +215,7 @@ bool Foam::mixingPlaneCheckFunctionObject::execute()
scalar localFluxMag = mag(localFlux);
scalar shadowFlux = shadowPatchScaleFactor_ * sum(phi.boundaryField()[shadowPatchI]);
scalar shadowFluxMag = mag(shadowFlux);
// scalar shadowFluxMag = mag(shadowFlux);
Info<< "Mixing plane pair "
<< "(" << mixingMaster.name() << ", "

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvPatchFields.H"
#include "alphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "fvPatchFields.H"
#include "constantAlphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "volMesh.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvPatchFields.H"
#include "dynamicAlphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "fvPatchFields.H"
#include "timeVaryingAlphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volMesh.H"
#include "Time.H"