From fc33d49ae0ea42e3259ea3bcd509711141dfc55f Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 30 Mar 2009 13:20:56 +0100 Subject: [PATCH 1/2] Added flux handling to the correction functions. --- .../lduMatrix/lduMatrix/lduMatrixTemplates.C | 54 +++++++++---------- .../fvMatrices/fvMatrix/fvMatrix.C | 21 +++++++- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C index fa5236bd99..11ece2171d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C @@ -57,22 +57,7 @@ Foam::tmp > Foam::lduMatrix::H(const Field& psi) const for (register label face=0; face Foam::tmp > Foam::lduMatrix::faceH(const Field& psi) const { - const scalarField& Lower = const_cast(*this).lower(); - const scalarField& Upper = const_cast(*this).upper(); - - // Take refereces to addressing - const unallocLabelList& l = lduAddr().lowerAddr(); - const unallocLabelList& u = lduAddr().upperAddr(); - - tmp > tfaceHpsi(new Field (Lower.size())); - Field & faceHpsi = tfaceHpsi(); - - for (register label face=0; face(*this).lower(); + const scalarField& Upper = const_cast(*this).upper(); - return tfaceHpsi; + const unallocLabelList& l = lduAddr().lowerAddr(); + const unallocLabelList& u = lduAddr().upperAddr(); + + tmp > tfaceHpsi(new Field (Lower.size())); + Field & faceHpsi = tfaceHpsi(); + + for (register label face=0; face& psi) const") + << "Cannot calculate faceH" + " the matrix does not have any off-diagonal coefficients." + << exit(FatalError); + + return tmp >(NULL); + } } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 0fcf2e626d..78fede73f8 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -1303,7 +1303,14 @@ Foam::tmp > Foam::correction const fvMatrix& A ) { - return A - (A & A.psi()); + tmp > tAcorr = A - (A & A.psi()); + + if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name())) + { + tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr(); + } + + return tAcorr; } @@ -1313,7 +1320,17 @@ Foam::tmp > Foam::correction const tmp >& tA ) { - return tA - (tA() & tA().psi()); + tmp > tAcorr = tA - (tA() & tA().psi()); + + // Note the matrix coefficients are still that of matrix A + const fvMatrix& A = tAcorr(); + + if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name())) + { + tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr(); + } + + return tAcorr; } From 4dedd47382433ebad365cb7943ff8906a3837512 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 31 Mar 2009 20:14:40 +0100 Subject: [PATCH 2/2] Changed the option to select the generation of a C++ scanner to the backward compatible -+. --- wmake/rules/General/flex++ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++ index 6f68d78001..304b131c6d 100644 --- a/wmake/rules/General/flex++ +++ b/wmake/rules/General/flex++ @@ -1,6 +1,6 @@ .SUFFIXES: .L -Ltoo = flex --c++ -f $$SOURCE ; mv lex.yy.cc $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@ +Ltoo = flex -+ -f $$SOURCE ; mv lex.yy.cc $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@ .L.dep: $(MAKE_DEP)