diff --git a/etc/bashrc b/etc/bashrc index ce10b39e78f5a061f317dcdd27d7a4a68d6ba3e7..3b001711bc0649acee98e87b9fe78e763ec6d13d 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 a46cf3ee475c2221815473daec70d7cf87870fcf..034a5bfbfa25ce4571d0191b73e9e338f2f8b0d1 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 diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C index fa5236bd99f4f5ef0fd61e800bf42780b50e1768..11ece2171d01042c1f0d9f9eb4b565f7a90f170d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTemplates.C @@ -57,22 +57,7 @@ Foam::tmp<Foam::Field<Type> > Foam::lduMatrix::H(const Field<Type>& psi) const for (register label face=0; face<nFaces; face++) { - #ifdef ICC_IA64_PREFETCH - __builtin_prefetch (&uPtr[face+32],0,0); - __builtin_prefetch (&lPtr[face+32],0,0); - __builtin_prefetch (&lowerPtr[face+32],0,1); - __builtin_prefetch (&psiPtr[lPtr[face+32]],0,1); - __builtin_prefetch (&HpsiPtr[uPtr[face+32]],0,1); - #endif - HpsiPtr[uPtr[face]] -= lowerPtr[face]*psiPtr[lPtr[face]]; - - #ifdef ICC_IA64_PREFETCH - __builtin_prefetch (&upperPtr[face+32],0,1); - __builtin_prefetch (&psiPtr[uPtr[face+32]],0,1); - __builtin_prefetch (&HpsiPtr[lPtr[face+32]],0,1); - #endif - HpsiPtr[lPtr[face]] -= upperPtr[face]*psiPtr[uPtr[face]]; } } @@ -94,22 +79,33 @@ template<class Type> Foam::tmp<Foam::Field<Type> > Foam::lduMatrix::faceH(const Field<Type>& psi) const { - const scalarField& Lower = const_cast<const lduMatrix&>(*this).lower(); - const scalarField& Upper = const_cast<const lduMatrix&>(*this).upper(); + if (lowerPtr_ || upperPtr_) + { + const scalarField& Lower = const_cast<const lduMatrix&>(*this).lower(); + const scalarField& Upper = const_cast<const lduMatrix&>(*this).upper(); - // Take refereces to addressing - const unallocLabelList& l = lduAddr().lowerAddr(); - const unallocLabelList& u = lduAddr().upperAddr(); + const unallocLabelList& l = lduAddr().lowerAddr(); + const unallocLabelList& u = lduAddr().upperAddr(); - tmp<Field<Type> > tfaceHpsi(new Field<Type> (Lower.size())); - Field<Type> & faceHpsi = tfaceHpsi(); + tmp<Field<Type> > tfaceHpsi(new Field<Type> (Lower.size())); + Field<Type> & faceHpsi = tfaceHpsi(); - for (register label face=0; face<l.size(); face++) - { - faceHpsi[face] = Upper[face]*psi[u[face]] - Lower[face]*psi[l[face]]; + for (register label face=0; face<l.size(); face++) + { + faceHpsi[face] = Upper[face]*psi[u[face]] - Lower[face]*psi[l[face]]; + } + + return tfaceHpsi; } + else + { + FatalErrorIn("lduMatrix::faceH(const Field<Type>& psi) const") + << "Cannot calculate faceH" + " the matrix does not have any off-diagonal coefficients." + << exit(FatalError); - return tfaceHpsi; + return tmp<Field<Type> >(NULL); + } } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 0fcf2e626d61b212bd0efec2983c0766da413146..78fede73f8d929d9a84515e74c4874e262de4c11 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -1303,7 +1303,14 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::correction const fvMatrix<Type>& A ) { - return A - (A & A.psi()); + tmp<Foam::fvMatrix<Type> > 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::fvMatrix<Type> > Foam::correction const tmp<fvMatrix<Type> >& tA ) { - return tA - (tA() & tA().psi()); + tmp<Foam::fvMatrix<Type> > tAcorr = tA - (tA() & tA().psi()); + + // Note the matrix coefficients are still that of matrix A + const fvMatrix<Type>& A = tAcorr(); + + if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name())) + { + tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr(); + } + + return tAcorr; } diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++ index 6f68d78001b65064e3407c2d4bf0453d271384f9..304b131c6dc22705e5b638ee21241038340fb90e 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)