From fc33d49ae0ea42e3259ea3bcd509711141dfc55f Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 30 Mar 2009 13:20:56 +0100 Subject: [PATCH 1/3] 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/3] 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) From afd820ddd1aa7539fd1c276a0510c2925d689a6b Mon Sep 17 00:00:00 2001 From: henry Date: Wed, 1 Apr 2009 17:02:52 +0100 Subject: [PATCH 3/3] Reintroduced WM_OS because the build system currently uses it. --- etc/bashrc | 6 ++++++ etc/cshrc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/etc/bashrc b/etc/bashrc index ce10b39e78..3b001711bc 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -77,6 +77,12 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty +# Operating System/Platform +# ~~~~~~~~~~~~~~~~~~~~~~~~~ +# WM_OS = Unix | ???? +: ${WM_OS:=Unix}; export WM_OS + + # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : ${WM_COMPILER:=Gcc}; export WM_COMPILER diff --git a/etc/cshrc b/etc/cshrc index a46cf3ee47..034a5bfbfa 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -71,6 +71,12 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty +# Operating System/Platform +# ~~~~~~~~~~~~~~~~~~~~~~~~~ +# WM_OS = Unix | ???? +if ( ! $?WM_OS ) setenv WM_OS Unix + + # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc