Changed handling of non-parallel cyclic implicit interfaces

This commit is contained in:
Hrvoje Jasak 2013-05-31 13:39:44 +01:00
parent ce26313610
commit afdf469c1d
4 changed files with 60 additions and 17 deletions

View file

@ -178,6 +178,35 @@ void Foam::fvMatrix<Type>::addBoundarySource
}
template<class Type>
void Foam::fvMatrix<Type>::correctImplicitBoundarySource
(
const FieldField<Field, scalar>& bouCoeffsCmpt,
scalarField& sourceCmpt,
const direction cmpt
) const
{
forAll(psi_.boundaryField(), patchI)
{
const fvPatchField<Type>& ptf = psi_.boundaryField()[patchI];
const scalarField& pbc = bouCoeffsCmpt[patchI];
if (ptf.coupled())
{
scalarField pnf = ptf.patchNeighbourField()().component(cmpt);
const unallocLabelList& addr = lduAddr().patchAddr(patchI);
forAll (addr, facei)
{
// Note opposite sign of the one in addBoundarySource
sourceCmpt[addr[facei]] -= pbc[facei]*pnf[facei];
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View file

@ -326,6 +326,7 @@ public:
// Matrix completion functionality
//- Add the diagonal contribution from boundary
void addBoundaryDiag
(
scalarField& diag,
@ -334,12 +335,21 @@ public:
void addCmptAvBoundaryDiag(scalarField& diag) const;
//- Add the source coefficient from boundary
void addBoundarySource
(
Field<Type>& source,
const bool couples = true
) const;
//- Correct the boundary source by removing the implicit part
// of boundary source for the solving component
void correctImplicitBoundarySource
(
const FieldField<Field, scalar>& bouCoeffsCmpt,
scalarField& sourceCmpt,
const direction cmpt
) const;
// Operations

View file

@ -77,8 +77,13 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
Field<Type> source = source_;
// At this point include the boundary source from the coupled boundaries.
// This is corrected for the implicit part by updateMatrixInterfaces within
// the component loop.
// This is corrected for the implicit part by correctCmptBoundarySource
// within the component loop.
// Note: this is related to non-parallel coupled implicit boundaries
// such as cyclic or cyclicGGI, which include transformation.
// See also correctImplicitBoundarySource below.
// HJ, 31/May/2013
addBoundarySource(source);
typename Type::labelType validComponents
@ -115,23 +120,15 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
internalCoeffs_.component(cmpt)
);
// Use the initMatrixInterfaces and updateMatrixInterfaces to correct
// bouCoeffsCmpt for the explicit part of the coupled boundary
// conditions
initMatrixInterfaces
// Correct component boundary source for the explicit part of the
// coupled boundary conditions. At the moment, the whole
// coefficient-field product hass been added into the source,
// but the implicit part for the current element needs to be taken out
// (because it is implicit).
// HJ, 31/May/2013
correctImplicitBoundarySource
(
bouCoeffsCmpt,
interfaces,
psiCmpt,
sourceCmpt,
cmpt
);
updateMatrixInterfaces
(
bouCoeffsCmpt,
interfaces,
psiCmpt,
sourceCmpt,
cmpt
);

View file

@ -104,6 +104,13 @@ Foam::fvMatrix<Foam::scalar>::fvSolver::solve
const dictionary& solverControls
)
{
if (debug)
{
Info<< "fvScalarMatrix::solve(const dictionary&) : "
"solving fvScalarMatrix"
<< endl;
}
// Complete matrix assembly. HJ, 17/Apr/2012
fvMat_.completeAssembly();