diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 7950d6a0068e0b31dee4137e9b09d0154eaa9fa8..557c8aa1fb79d3f7c50e5a20dd9307dc9800ab06 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -66,6 +66,7 @@ Description #include "Switch.H" #include "bound.H" #include "dynamicRefineFvMesh.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -83,6 +84,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + scalar StCoNum = 0.0; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -94,7 +97,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -163,26 +165,35 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { - #include "bEqn.H" - #include "ftEqn.H" - #include "huEqn.H" - #include "hEqn.H" + #include "UEqn.H" + - if (!ign.ignited()) + // --- PISO loop + for (int corr=1; corr<=pimple.nCorr(); corr++) { - hu == h; + #include "bEqn.H" + #include "ftEqn.H" + #include "huEqn.H" + #include "hEqn.H" + + if (!ign.ignited()) + { + hu == h; + } + + #include "pEqn.H" } - #include "pEqn.H" + if (pimple.turbCorr()) + { + turbulence->correct(); + } } - turbulence->correct(); - runTime.write(); Info<< "\nExecutionTime = " diff --git a/etc/config/settings.csh b/etc/config/settings.csh index fbb9f042702ac6f4bcad21b1c304ae251e8d7cdf..2b0a132ebca31976263356d13850deae79525b33 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -203,10 +203,6 @@ case ThirdParty: switch ("$WM_COMPILER") case Gcc: case Gcc++0x: - set gcc_version=gcc-4.4.3 - set gmp_version=gmp-5.0.1 - set mpfr_version=mpfr-2.4.2 - breaksw case Gcc46: case Gcc46++0x: set gcc_version=gcc-4.6.1 diff --git a/etc/config/settings.sh b/etc/config/settings.sh index bf8f58a34ac3234bcbf2285fc734f0707e213762..e56afffa179418e1b97ff2d6205c6eade342526e 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -222,12 +222,7 @@ fi case "${foamCompiler}" in OpenFOAM | ThirdParty) case "$WM_COMPILER" in - Gcc | Gcc++0x) - gcc_version=gcc-4.4.3 - gmp_version=gmp-5.0.1 - mpfr_version=mpfr-2.4.2 - ;; - Gcc46 | Gcc46++0x) + Gcc | Gcc++0x | Gcc46 | Gcc46++0x) gcc_version=gcc-4.6.1 gmp_version=gmp-5.0.2 mpfr_version=mpfr-3.0.1 diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index f140045d06d995684b431637aac3de6cab3a5d9a..6fcaed2e2eab3df27a80a878edccd0d3e469ed0b 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -164,10 +164,13 @@ Foam::label Foam::objectRegistry::getEvent() const if (event_ == labelMax) { - WarningIn("objectRegistry::getEvent() const") - << "Event counter has overflowed. " - << "Resetting counter on all dependent objects." << nl - << "This might cause extra evaluations." << endl; + if (objectRegistry::debug) + { + WarningIn("objectRegistry::getEvent() const") + << "Event counter has overflowed. " + << "Resetting counter on all dependent objects." << nl + << "This might cause extra evaluations." << endl; + } // Reset event counter curEvent = 1; diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 12a617fc38755697d5eff70ef340e6a5b2825288..3bcd7b80d55dfec16641962a6dbf6ff0e12c12fd 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -334,6 +334,7 @@ $(snGradSchemes)/snGradScheme/snGradSchemes.C $(snGradSchemes)/correctedSnGrad/correctedSnGrads.C $(snGradSchemes)/limitedSnGrad/limitedSnGrads.C $(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C +$(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C /* $(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGradData.C $(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGrads.C diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C index eab4f831462022ce305cbad2586be693ae76864f..4bf1a4dd6b50be8dcc9b24fd2910f1ea749c0aca 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C @@ -110,38 +110,34 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const const labelUList& owner = mesh_.owner(); const labelUList& neighbour = mesh_.neighbour(); - // Build the d-vectors - surfaceVectorField d - ( - mesh_.Sf()/(mesh_.magSf()*mesh_.deltaCoeffs()) - ); - - if (!mesh_.orthogonal()) - { - d -= mesh_.correctionVectors()/mesh_.deltaCoeffs(); - } - + const volVectorField& C = mesh.C(); // Set up temporary storage for the dd tensor (before inversion) symmTensorField dd(mesh_.nCells(), symmTensor::zero); - forAll(owner, faceI) + forAll(owner, facei) { - const symmTensor wdd(1.0/magSqr(d[faceI])*sqr(d[faceI])); + label own = owner[facei]; + label nei = neighbour[facei]; + + vector d = C[nei] - C[own]; - dd[owner[faceI]] += wdd; - dd[neighbour[faceI]] += wdd; + const symmTensor wdd(1.0/magSqr(d[facei])*sqr(d[facei])); + + dd[own] += wdd; + dd[nei] += wdd; } // Visit the boundaries. Coupled boundaries are taken into account // in the construction of d vectors. - forAll(d.boundaryField(), patchI) + forAll(lsP.boundaryField(), patchi) { - const fvsPatchVectorField& pd = d.boundaryField()[patchI]; - - const fvPatch& p = pd.patch(); + const fvPatch& p = lsP.boundaryField()[patchi].patch(); const labelUList& faceCells = p.faceCells(); + // Build the d-vectors + vectorField pd = p.delta(); + forAll(pd, patchFaceI) { dd[faceCells[patchFaceI]] += @@ -232,24 +228,30 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const // Revisit all faces and calculate the lsP and lsN vectors - forAll(owner, faceI) + forAll(owner, facei) { - lsP[faceI] = - (1.0/magSqr(d[faceI]))*(invDd[owner[faceI]] & d[faceI]); + label own = owner[facei]; + label nei = neighbour[facei]; + + vector d = C[nei] - C[own]; - lsN[faceI] = - ((-1.0)/magSqr(d[faceI]))*(invDd[neighbour[faceI]] & d[faceI]); + lsP[facei] = + (1.0/magSqr(d[facei]))*(invDd[owner[facei]] & d); + + lsN[facei] = + ((-1.0)/magSqr(d[facei]))*(invDd[neighbour[facei]] & d); } forAll(lsP.boundaryField(), patchI) { - const fvsPatchVectorField& pd = d.boundaryField()[patchI]; - fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI]; const fvPatch& p = patchLsP.patch(); const labelUList& faceCells = p.faceCells(); + // Build the d-vectors + vectorField pd = p.delta(); + forAll(p, patchFaceI) { patchLsP[patchFaceI] = diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C index b8a3b428ddb63f8fc9be3a11c75465170f0ce320..ead1ed0c2b69b72ff892b4269fe6a4cffa7fb8dd 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C @@ -121,24 +121,12 @@ Foam::fv::fourthGrad<Type>::calcGrad const scalarField& lambdap = lambda.boundaryField()[patchi]; - // Build the d-vectors - vectorField pd - ( - mesh.Sf().boundaryField()[patchi] - / ( - mesh.magSf().boundaryField()[patchi] - * mesh.deltaCoeffs().boundaryField()[patchi] - ) - ); + const fvPatch& p = fGrad.boundaryField()[patchi].patch(); - if (!mesh.orthogonal()) - { - pd -= mesh.correctionVectors().boundaryField()[patchi] - /mesh.deltaCoeffs().boundaryField()[patchi]; - } + const labelUList& faceCells = p.faceCells(); - const labelUList& faceCells = - fGrad.boundaryField()[patchi].patch().faceCells(); + // Build the d-vectors + vectorField pd = p.delta(); const Field<GradType> neighbourSecondfGrad ( diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 293c0e1d64ac556ff2d07d573ab0028989701c13..6002a07e1c1a2f95a39bed80ec4921a3da8a5052 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -130,20 +130,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const labelUList& faceCells = p.patch().faceCells(); // Build the d-vectors - vectorField pd - ( - mesh.Sf().boundaryField()[patchi] - / ( - mesh.magSf().boundaryField()[patchi] - * mesh.deltaCoeffs().boundaryField()[patchi] - ) - ); - - if (!mesh.orthogonal()) - { - pd -= mesh.correctionVectors().boundaryField()[patchi] - /mesh.deltaCoeffs().boundaryField()[patchi]; - } + vectorField pd = p.delta(); if (p.coupled()) { @@ -196,21 +183,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const labelUList& faceCells = p.faceCells(); // Build the d-vectors - vectorField pd - ( - mesh.Sf().boundaryField()[patchi] - /( - mesh.magSf().boundaryField()[patchi] - *mesh.deltaCoeffs().boundaryField()[patchi] - ) - ); - - if (!mesh.orthogonal()) - { - pd -= mesh.correctionVectors().boundaryField()[patchi] - /mesh.deltaCoeffs().boundaryField()[patchi]; - } - + vectorField pd = p.delta(); if (p.coupled()) { diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H index ca1b8dac432661701359a9a6c35003116bf431e9..529e55bdbe9f49276a20dbc4a5e3f09d73aa029f 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H @@ -211,7 +211,7 @@ public: // Add the patch constructor functions to the hash tables -#define makeFvLaplacianTypeScheme(SS, Type, GType) \ +#define makeFvLaplacianTypeScheme(SS, GType, Type) \ \ typedef SS<Type, GType> SS##Type##GType; \ defineNamedTemplateTypeNameAndDebug(SS##Type##GType, 0); \ @@ -224,13 +224,20 @@ public: #define makeFvLaplacianScheme(SS) \ \ makeFvLaplacianTypeScheme(SS, scalar, scalar) \ -makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \ -makeFvLaplacianTypeScheme(SS, scalar, tensor) \ -makeFvLaplacianTypeScheme(SS, vector, scalar) \ -makeFvLaplacianTypeScheme(SS, sphericalTensor, scalar) \ makeFvLaplacianTypeScheme(SS, symmTensor, scalar) \ makeFvLaplacianTypeScheme(SS, tensor, scalar) \ - +makeFvLaplacianTypeScheme(SS, scalar, vector) \ +makeFvLaplacianTypeScheme(SS, symmTensor, vector) \ +makeFvLaplacianTypeScheme(SS, tensor, vector) \ +makeFvLaplacianTypeScheme(SS, scalar, sphericalTensor) \ +makeFvLaplacianTypeScheme(SS, symmTensor, sphericalTensor) \ +makeFvLaplacianTypeScheme(SS, tensor, sphericalTensor) \ +makeFvLaplacianTypeScheme(SS, scalar, symmTensor) \ +makeFvLaplacianTypeScheme(SS, symmTensor, symmTensor) \ +makeFvLaplacianTypeScheme(SS, tensor, symmTensor) \ +makeFvLaplacianTypeScheme(SS, scalar, tensor) \ +makeFvLaplacianTypeScheme(SS, symmTensor, tensor) \ +makeFvLaplacianTypeScheme(SS, tensor, tensor) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C index 83cddf531effbbbe5f4736b85d436fdb2db0faf0..ba7ddcf6fa46e62244908d007cdafa5a01a02a8e 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C @@ -50,7 +50,7 @@ Foam::fv::correctedSnGrad<Type>::fullGradCorrection // construct GeometricField<Type, fvsPatchField, surfaceMesh> tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf = - mesh.correctionVectors() + mesh.nonOrthCorrectionVectors() & linear<typename outerProduct<vector, Type>::type>(mesh).interpolate ( gradScheme<Type>::New @@ -88,7 +88,7 @@ Foam::fv::correctedSnGrad<Type>::correction IOobject::NO_WRITE ), mesh, - vf.dimensions()*mesh.deltaCoeffs().dimensions() + vf.dimensions()*mesh.nonOrthDeltaCoeffs().dimensions() ) ); GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf(); @@ -98,7 +98,7 @@ Foam::fv::correctedSnGrad<Type>::correction ssf.replace ( cmpt, - mesh.correctionVectors() + mesh.nonOrthCorrectionVectors() & linear < typename diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H index a962855181e08521b5f02205cd14fee0b830c1b4..1361ed9de27fdce7db5c39374d1ea3ee4e821039 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H @@ -96,13 +96,13 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const { - return this->mesh().deltaCoeffs(); + return this->mesh().nonOrthDeltaCoeffs(); } //- Return true if this scheme uses an explicit correction virtual bool corrected() const { - return !this->mesh().orthogonal(); + return true; } //- Return the explicit correction to the correctedSnGrad diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H index 0f14823dc28d889602e308d0fc70aee5e3e17853..9dbe0f01143ec668280c78d189c7d3ed133c512e 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H @@ -120,13 +120,13 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const { - return this->mesh().deltaCoeffs(); + return this->mesh().nonOrthDeltaCoeffs(); } //- Return true if this scheme uses an explicit correction virtual bool corrected() const { - return !this->mesh().orthogonal(); + return true; } //- Return the explicit correction to the limitedSnGrad diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C new file mode 100644 index 0000000000000000000000000000000000000000..39866b78ab5f1f9d205a78c0530d555c4bff4519 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +\*---------------------------------------------------------------------------*/ + +#include "orthogonalSnGrad.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +orthogonalSnGrad<Type>::~orthogonalSnGrad() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > +orthogonalSnGrad<Type>::correction +( + const GeometricField<Type, fvPatchField, volMesh>& +) const +{ + notImplemented + ( + "orthogonalSnGrad<Type>::correction" + "(const GeometricField<Type, fvPatchField, volMesh>&)" + ); + return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..5bd76fe5161ab022e929401fb7b36a6ba0a3a51e --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::fv::orthogonalSnGrad + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +SourceFiles + orthogonalSnGrad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef orthogonalSnGrad_H +#define orthogonalSnGrad_H + +#include "snGradScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class orthogonalSnGrad Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class orthogonalSnGrad +: + public snGradScheme<Type> +{ + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const orthogonalSnGrad&); + + +public: + + //- Runtime type information + TypeName("uncorrected"); + + + // Constructors + + //- Construct from mesh + orthogonalSnGrad(const fvMesh& mesh) + : + snGradScheme<Type>(mesh) + {} + + + //- Construct from mesh and data stream + orthogonalSnGrad(const fvMesh& mesh, Istream&) + : + snGradScheme<Type>(mesh) + {} + + + //- Destructor + virtual ~orthogonalSnGrad(); + + + // Member Functions + + //- Return the interpolation weighting factors for the given field + virtual tmp<surfaceScalarField> deltaCoeffs + ( + const GeometricField<Type, fvPatchField, volMesh>& + ) const + { + return this->mesh().deltaCoeffs(); + } + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return false; + } + + //- Return the explicit correction to the orthogonalSnGrad + // for the given field + virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + correction(const GeometricField<Type, fvPatchField, volMesh>&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "orthogonalSnGrad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C new file mode 100644 index 0000000000000000000000000000000000000000..4597bb43ffeaf88235a495e1e2ce36f363f95b11 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +\*---------------------------------------------------------------------------*/ + +#include "orthogonalSnGrad.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + makeSnGradScheme(orthogonalSnGrad) +} +} + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrad.H index e5059d638269020d985b74c315051789572b2d17..b4892095771727fdaaf39ea14e718501a9b4f932 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGrad.H @@ -109,7 +109,7 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const { - return this->mesh().deltaCoeffs(); + return this->mesh().nonOrthDeltaCoeffs(); } //- Return true if this scheme uses an explicit correction diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGradData.C b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGradData.C index b0462cc047976d92d6c09a0ef743bc22d25751fb..fe0858e1c6a6e9d4557e2b5ffdc85ad3336615d9 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGradData.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/quadraticFitSnGrad/quadraticFitSnGradData.C @@ -247,7 +247,7 @@ Foam::label Foam::quadraticFitSnGradData::calcFit scalarList singVals(minSize_); label nSVDzeros = 0; - const scalar deltaCoeff = mesh().deltaCoeffs()[faci]; + const scalar deltaCoeff = deltaCoeffs()[faci]; bool goodFit = false; for (int iIt = 0; iIt < 10 && !goodFit; iIt++) diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H index e52db735f16b9f9a3eda66f6540439b113c6872c..082eeabbd0af37c9f5295878037503314f419b66 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H @@ -96,7 +96,7 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const { - return this->mesh().deltaCoeffs(); + return this->mesh().nonOrthDeltaCoeffs(); } //- Return true if this scheme uses an explicit correction diff --git a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H index 255b20043c5e035efefa23d32287c71b196a7fd7..7fc59ffb9502b3e2785d9281f2361db190a7e4bc 100644 --- a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H @@ -66,9 +66,6 @@ protected: //- Make patch weighting factors virtual void makeWeights(scalarField&) const = 0; - //- Make patch face - neighbour cell distances - virtual void makeDeltaCoeffs(scalarField&) const = 0; - public: diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C index c453c91910fc20946044580716dae8afbcb0b253..d127cf3a022750d308ebe59512c5045d20ecfbdb 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C @@ -57,25 +57,6 @@ void Foam::cyclicFvPatch::makeWeights(scalarField& w) const } -// Make patch face - neighbour cell distances -void Foam::cyclicFvPatch::makeDeltaCoeffs(scalarField& dc) const -{ - //const cyclicPolyPatch& nbrPatch = cyclicPolyPatch_.neighbPatch(); - const cyclicFvPatch& nbrPatch = neighbFvPatch(); - - const scalarField deltas(nf() & fvPatch::delta()); - const scalarField nbrDeltas(nbrPatch.nf() & nbrPatch.fvPatch::delta()); - - forAll(deltas, facei) - { - scalar di = deltas[facei]; - scalar dni = nbrDeltas[facei]; - - dc[facei] = 1.0/(di + dni); - } -} - - // Return delta (P to N) vectors across coupled patch Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H index 107a085927dbe51569f32436708e48865da77924..fe0decf711a262d60b795f0ad03835fd44b7aa54 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.H @@ -66,9 +66,6 @@ protected: //- Make patch weighting factors void makeWeights(scalarField&) const; - //- Make patch face - neighbour cell distances - void makeDeltaCoeffs(scalarField&) const; - public: diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C index a7f9f6592e12b4e49dd9889749509873108c0a65..9717c96e6c10094984da271398f4535c7ce67226 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.C @@ -60,27 +60,6 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const } -void Foam::cyclicAMIFvPatch::makeDeltaCoeffs(scalarField& dc) const -{ - const cyclicAMIFvPatch& nbrPatch = neighbFvPatch(); - - const scalarField deltas(nf() & fvPatch::delta()); - - const scalarField nbrDeltas - ( - interpolate(nbrPatch.nf() & nbrPatch.fvPatch::delta()) - ); - - forAll(deltas, faceI) - { - scalar di = deltas[faceI]; - scalar dni = nbrDeltas[faceI]; - - dc[faceI] = 1.0/(di + dni); - } -} - - Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const { const vectorField patchD(fvPatch::delta()); diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H index 3e29a2be42aacbd49754ea8542e91f08e7397ab4..c53518fb23a7b6266ded7ae2325d75607e5a797f 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H @@ -66,9 +66,6 @@ protected: //- Make patch weighting factors void makeWeights(scalarField&) const; - //- Make patch face - neighbour cell distances - void makeDeltaCoeffs(scalarField&) const; - public: diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C index cbd3575ff1681eb048f1ac2b053a792a4c19ac44..9a2c1568a971c177c422301559c65385db661cea 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C @@ -65,19 +65,6 @@ void processorFvPatch::makeWeights(scalarField& w) const } -void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const -{ - if (Pstream::parRun()) - { - dc = (1.0 - weights())/(nf() & fvPatch::delta()); - } - else - { - dc = 1.0/(nf() & fvPatch::delta()); - } -} - - tmp<vectorField> processorFvPatch::delta() const { if (Pstream::parRun()) diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H index 0058299e77204b2ceb87135fe56ce1661afa1f1f..d0f3b04c7ccf20cd8f88e437d8a6521d63e24db6 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H @@ -65,9 +65,6 @@ protected: //- Make patch weighting factors void makeWeights(scalarField&) const; - //- Make patch face - neighbour cell distances - void makeDeltaCoeffs(scalarField&) const; - public: diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C index f9d1b8aca70042ad542626da8ce84168231816d1..1c9a6ca20c9371d440dfe980b6010b26f2ef6b28 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C @@ -150,12 +150,6 @@ void Foam::fvPatch::makeWeights(scalarField& w) const } -void Foam::fvPatch::makeDeltaCoeffs(scalarField& dc) const -{ - dc = 1.0/(nf() & delta()); -} - - void Foam::fvPatch::initMovePoints() {} diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H index d94363f05f62db8b65f51c36375bec94f751dcf1..be7ee1bda475e0e2210c11ae142b13a65b45b785 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H @@ -86,9 +86,6 @@ protected: //- Make patch weighting factors virtual void makeWeights(scalarField&) const; - //- Make patch face - neighbour cell distances - virtual void makeDeltaCoeffs(scalarField&) const; - //- Initialise the patches for moving points virtual void initMovePoints(); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C index b8f108e73c29387b43cc3d6d811b92aa5dd70740..a7ea3a3374fa5e8cc125a2ee605b77455df238b3 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C @@ -122,20 +122,7 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter ); // Build the d-vectors - vectorField pd - ( - mesh.Sf().boundaryField()[patchi] - / ( - mesh.magSf().boundaryField()[patchi] - * mesh.deltaCoeffs().boundaryField()[patchi] - ) - ); - - if (!mesh.orthogonal()) - { - pd -= mesh.correctionVectors().boundaryField()[patchi] - /mesh.deltaCoeffs().boundaryField()[patchi]; - } + vectorField pd = CDweights.boundaryField()[patchi].patch().delta(); forAll(pLim, face) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C index 183a7684bd604c409c145da70ab4393e35e7bbc3..b513c50e4a060efdc55f61e1e8ddd27699f972bd 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C @@ -111,20 +111,7 @@ Foam::linearUpwind<Type>::correction ); // Build the d-vectors - vectorField pd - ( - mesh.Sf().boundaryField()[patchi] - / ( - mesh.magSf().boundaryField()[patchi] - * mesh.deltaCoeffs().boundaryField()[patchi] - ) - ); - - if (!mesh.orthogonal()) - { - pd -= mesh.correctionVectors().boundaryField()[patchi] - /mesh.deltaCoeffs().boundaryField()[patchi]; - } + vectorField pd = Cf.boundaryField()[patchi].patch().delta(); forAll(pOwner, facei) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C index 747cd83f7f196a5d06fc4ebd5d9263ac957d2cc7..9feff9adaa1409eba853ce0b6d58b85ae7cc3f79 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C @@ -82,21 +82,17 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const const surfaceVectorField& Sf = mesh_.Sf(); const labelUList& owner = mesh_.owner(); + const labelUList& neighbour = mesh_.neighbour(); - // Build the d-vectors - surfaceVectorField d(Sf/(mesh_.magSf()*mesh_.deltaCoeffs())); - - if (!mesh_.orthogonal()) + forAll(owner, facei) { - d -= mesh_.correctionVectors()/mesh_.deltaCoeffs(); - } + label own = owner[facei]; + label nei = neighbour[facei]; - forAll(owner, faceI) - { - vector Cpf = Cf[faceI] - C[owner[faceI]]; + vector d = C[nei] - C[own]; + vector Cpf = Cf[facei] - C[own]; - SkewCorrVecs[faceI] = - Cpf - ((Sf[faceI] & Cpf)/(Sf[faceI] & d[faceI]))*d[faceI]; + SkewCorrVecs[facei] = Cpf - ((Sf[facei] & Cpf)/(Sf[facei] & d))*d; } @@ -115,7 +111,7 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const const labelUList& faceCells = p.faceCells(); const vectorField& patchFaceCentres = Cf.boundaryField()[patchI]; const vectorField& patchSf = Sf.boundaryField()[patchI]; - const vectorField& patchD = d.boundaryField()[patchI]; + const vectorField patchD = p.delta(); forAll(p, patchFaceI) { @@ -136,7 +132,7 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const if (Sf.internalField().size()) { - skewCoeff = max(mag(SkewCorrVecs)/mag(d)).value(); + skewCoeff = max(mag(SkewCorrVecs)*mesh_.deltaCoeffs()).value(); } if (debug) @@ -182,7 +178,7 @@ const Foam::surfaceVectorField& Foam::skewCorrectionVectors::operator()() const if (!skew()) { FatalErrorIn("skewCorrectionVectors::operator()()") - << "Cannot return correctionVectors; mesh is not skewed" + << "Cannot return skewCorrectionVectors; mesh is not skewed" << abort(FatalError); } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index a18ed2367cdebf497e01d8f8fe20af452d17eac1..fe0643c1951bf15056fdf64f6f46039ba560a6f8 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -31,43 +31,38 @@ Description #include "surfaceFields.H" #include "demandDrivenData.H" #include "coupledFvPatch.H" -#include "unitConversion.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(surfaceInterpolation, 0); +defineTypeNameAndDebug(Foam::surfaceInterpolation, 0); // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void surfaceInterpolation::clearOut() +void Foam::surfaceInterpolation::clearOut() { - deleteDemandDrivenData(weightingFactors_); - deleteDemandDrivenData(differenceFactors_); - deleteDemandDrivenData(correctionVectors_); + deleteDemandDrivenData(weights_); + deleteDemandDrivenData(deltaCoeffs_); + deleteDemandDrivenData(nonOrthDeltaCoeffs_); + deleteDemandDrivenData(nonOrthCorrectionVectors_); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm) +Foam::surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm) : mesh_(fvm), - weightingFactors_(NULL), - differenceFactors_(NULL), - orthogonal_(false), - correctionVectors_(NULL) + weights_(NULL), + deltaCoeffs_(NULL), + nonOrthDeltaCoeffs_(NULL), + nonOrthCorrectionVectors_(NULL) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -surfaceInterpolation::~surfaceInterpolation() +Foam::surfaceInterpolation::~surfaceInterpolation() { clearOut(); } @@ -75,66 +70,67 @@ surfaceInterpolation::~surfaceInterpolation() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const surfaceScalarField& surfaceInterpolation::weights() const +const Foam::surfaceScalarField& +Foam::surfaceInterpolation::weights() const { - if (!weightingFactors_) + if (!weights_) { makeWeights(); } - return (*weightingFactors_); + return (*weights_); } -const surfaceScalarField& surfaceInterpolation::deltaCoeffs() const +const Foam::surfaceScalarField& +Foam::surfaceInterpolation::deltaCoeffs() const { - if (!differenceFactors_) + if (!deltaCoeffs_) { makeDeltaCoeffs(); } - return (*differenceFactors_); + return (*deltaCoeffs_); } -bool surfaceInterpolation::orthogonal() const +const Foam::surfaceScalarField& +Foam::surfaceInterpolation::nonOrthDeltaCoeffs() const { - if (orthogonal_ == false && !correctionVectors_) + if (!nonOrthDeltaCoeffs_) { - makeCorrectionVectors(); + makeNonOrthDeltaCoeffs(); } - return orthogonal_; + return (*nonOrthDeltaCoeffs_); } -const surfaceVectorField& surfaceInterpolation::correctionVectors() const +const Foam::surfaceVectorField& +Foam::surfaceInterpolation::nonOrthCorrectionVectors() const { - if (orthogonal()) + if (!nonOrthCorrectionVectors_) { - FatalErrorIn("surfaceInterpolation::correctionVectors()") - << "cannot return correctionVectors; mesh is orthogonal" - << abort(FatalError); + makeNonOrthCorrectionVectors(); } - return (*correctionVectors_); + return (*nonOrthCorrectionVectors_); } // Do what is neccessary if the mesh has moved -bool surfaceInterpolation::movePoints() +bool Foam::surfaceInterpolation::movePoints() { - deleteDemandDrivenData(weightingFactors_); - deleteDemandDrivenData(differenceFactors_); - - orthogonal_ = false; - deleteDemandDrivenData(correctionVectors_); + deleteDemandDrivenData(weights_); + deleteDemandDrivenData(deltaCoeffs_); + deleteDemandDrivenData(nonOrthDeltaCoeffs_); + deleteDemandDrivenData(nonOrthCorrectionVectors_); return true; } -void surfaceInterpolation::makeWeights() const +void Foam::surfaceInterpolation::makeWeights() const { if (debug) { @@ -143,20 +139,18 @@ void surfaceInterpolation::makeWeights() const << endl; } - - weightingFactors_ = new surfaceScalarField + weights_ = new surfaceScalarField ( IOobject ( - "weightingFactors", + "weights", mesh_.pointsInstance(), mesh_ ), mesh_, dimless ); - surfaceScalarField& weightingFactors = *weightingFactors_; - + surfaceScalarField& weights = *weights_; // Set local references to mesh data // (note that we should not use fvMesh sliced fields at this point yet @@ -170,7 +164,7 @@ void surfaceInterpolation::makeWeights() const const vectorField& Sf = mesh_.faceAreas(); // ... and reference to the internal field of the weighting factors - scalarField& w = weightingFactors.internalField(); + scalarField& w = weights.internalField(); forAll(owner, facei) { @@ -188,11 +182,10 @@ void surfaceInterpolation::makeWeights() const { mesh_.boundary()[patchi].makeWeights ( - weightingFactors.boundaryField()[patchi] + weights.boundaryField()[patchi] ); } - if (debug) { Info<< "surfaceInterpolation::makeWeights() : " @@ -202,7 +195,7 @@ void surfaceInterpolation::makeWeights() const } -void surfaceInterpolation::makeDeltaCoeffs() const +void Foam::surfaceInterpolation::makeDeltaCoeffs() const { if (debug) { @@ -215,18 +208,63 @@ void surfaceInterpolation::makeDeltaCoeffs() const // needed to make sure deltaCoeffs are calculated for parallel runs. weights(); - differenceFactors_ = new surfaceScalarField + deltaCoeffs_ = new surfaceScalarField ( IOobject ( - "differenceFactors_", + "deltaCoeffs", mesh_.pointsInstance(), mesh_ ), mesh_, dimless/dimLength ); - surfaceScalarField& DeltaCoeffs = *differenceFactors_; + surfaceScalarField& DeltaCoeffs = *deltaCoeffs_; + + + // Set local references to mesh data + const volVectorField& C = mesh_.C(); + const labelUList& owner = mesh_.owner(); + const labelUList& neighbour = mesh_.neighbour(); + + forAll(owner, facei) + { + DeltaCoeffs[facei] = 1.0/mag(C[neighbour[facei]] - C[owner[facei]]); + } + + forAll(DeltaCoeffs.boundaryField(), patchi) + { + DeltaCoeffs.boundaryField()[patchi] = + 1.0/mag(mesh_.boundary()[patchi].delta()); + } +} + + +void Foam::surfaceInterpolation::makeNonOrthDeltaCoeffs() const +{ + if (debug) + { + Info<< "surfaceInterpolation::makeNonOrthDeltaCoeffs() : " + << "Constructing differencing factors array for face gradient" + << endl; + } + + // Force the construction of the weighting factors + // needed to make sure deltaCoeffs are calculated for parallel runs. + weights(); + + nonOrthDeltaCoeffs_ = new surfaceScalarField + ( + IOobject + ( + "nonOrthDeltaCoeffs", + mesh_.pointsInstance(), + mesh_ + ), + mesh_, + dimless/dimLength + ); + surfaceScalarField& nonOrthDeltaCoeffs = *nonOrthDeltaCoeffs_; // Set local references to mesh data @@ -242,49 +280,49 @@ void surfaceInterpolation::makeDeltaCoeffs() const vector unitArea = Sf[facei]/magSf[facei]; // Standard cell-centre distance form - //DeltaCoeffs[facei] = (unitArea & delta)/magSqr(delta); + //NonOrthDeltaCoeffs[facei] = (unitArea & delta)/magSqr(delta); // Slightly under-relaxed form - //DeltaCoeffs[facei] = 1.0/mag(delta); + //NonOrthDeltaCoeffs[facei] = 1.0/mag(delta); // More under-relaxed form - //DeltaCoeffs[facei] = 1.0/(mag(unitArea & delta) + VSMALL); + //NonOrthDeltaCoeffs[facei] = 1.0/(mag(unitArea & delta) + VSMALL); // Stabilised form for bad meshes - DeltaCoeffs[facei] = 1.0/max(unitArea & delta, 0.05*mag(delta)); + nonOrthDeltaCoeffs[facei] = 1.0/max(unitArea & delta, 0.05*mag(delta)); } - forAll(DeltaCoeffs.boundaryField(), patchi) + forAll(nonOrthDeltaCoeffs.boundaryField(), patchi) { - mesh_.boundary()[patchi].makeDeltaCoeffs - ( - DeltaCoeffs.boundaryField()[patchi] - ); + vectorField delta = mesh_.boundary()[patchi].delta(); + + nonOrthDeltaCoeffs.boundaryField()[patchi] = + 1.0/max(mesh_.boundary()[patchi].nf() & delta, 0.05*mag(delta)); } } -void surfaceInterpolation::makeCorrectionVectors() const +void Foam::surfaceInterpolation::makeNonOrthCorrectionVectors() const { if (debug) { - Info<< "surfaceInterpolation::makeCorrectionVectors() : " + Info<< "surfaceInterpolation::makeNonOrthCorrectionVectors() : " << "Constructing non-orthogonal correction vectors" << endl; } - correctionVectors_ = new surfaceVectorField + nonOrthCorrectionVectors_ = new surfaceVectorField ( IOobject ( - "correctionVectors", + "nonOrthCorrectionVectors", mesh_.pointsInstance(), mesh_ ), mesh_, dimless ); - surfaceVectorField& corrVecs = *correctionVectors_; + surfaceVectorField& corrVecs = *nonOrthCorrectionVectors_; // Set local references to mesh data const volVectorField& C = mesh_.C(); @@ -292,14 +330,14 @@ void surfaceInterpolation::makeCorrectionVectors() const const labelUList& neighbour = mesh_.neighbour(); const surfaceVectorField& Sf = mesh_.Sf(); const surfaceScalarField& magSf = mesh_.magSf(); - const surfaceScalarField& DeltaCoeffs = deltaCoeffs(); + const surfaceScalarField& NonOrthDeltaCoeffs = nonOrthDeltaCoeffs(); forAll(owner, facei) { vector unitArea = Sf[facei]/magSf[facei]; vector delta = C[neighbour[facei]] - C[owner[facei]]; - corrVecs[facei] = unitArea - delta*DeltaCoeffs[facei]; + corrVecs[facei] = unitArea - delta*NonOrthDeltaCoeffs[facei]; } // Boundary correction vectors set to zero for boundary patches @@ -308,18 +346,18 @@ void surfaceInterpolation::makeCorrectionVectors() const forAll(corrVecs.boundaryField(), patchi) { - fvsPatchVectorField& patchcorrVecs = corrVecs.boundaryField()[patchi]; + fvsPatchVectorField& patchCorrVecs = corrVecs.boundaryField()[patchi]; - if (!patchcorrVecs.coupled()) + if (!patchCorrVecs.coupled()) { - patchcorrVecs = vector::zero; + patchCorrVecs = vector::zero; } else { - const fvsPatchScalarField& patchDeltaCoeffs - = DeltaCoeffs.boundaryField()[patchi]; + const fvsPatchScalarField& patchNonOrthDeltaCoeffs + = NonOrthDeltaCoeffs.boundaryField()[patchi]; - const fvPatch& p = patchcorrVecs.patch(); + const fvPatch& p = patchCorrVecs.patch(); const vectorField patchDeltas(mesh_.boundary()[patchi].delta()); @@ -331,60 +369,19 @@ void surfaceInterpolation::makeCorrectionVectors() const const vector& delta = patchDeltas[patchFacei]; - patchcorrVecs[patchFacei] = - unitArea - delta*patchDeltaCoeffs[patchFacei]; + patchCorrVecs[patchFacei] = + unitArea - delta*patchNonOrthDeltaCoeffs[patchFacei]; } } } - scalar NonOrthogCoeff = 0.0; - - // Calculate the non-orthogonality for meshes with 1 face or more - if (returnReduce(magSf.size(), sumOp<label>()) > 0) - { - NonOrthogCoeff = radToDeg - ( - asin - ( - min - ( - (sum(magSf*mag(corrVecs))/sum(magSf)).value(), - 1.0 - ) - ) - ); - } - - if (debug) - { - Info<< "surfaceInterpolation::makeCorrectionVectors() : " - << "non-orthogonality coefficient = " << NonOrthogCoeff << " deg." - << endl; - } - - //NonOrthogCoeff = 0.0; - - if (NonOrthogCoeff < 0.1) - { - orthogonal_ = true; - deleteDemandDrivenData(correctionVectors_); - } - else - { - orthogonal_ = false; - } - if (debug) { - Info<< "surfaceInterpolation::makeCorrectionVectors() : " + Info<< "surfaceInterpolation::makeNonOrthCorrectionVectors() : " << "Finished constructing non-orthogonal correction vectors" << endl; } } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H index 17333be4abe1ab54768d88e611a719a7229e1e12..4a8601cb32a4d4ead857db07cf3cf2314ebb0f6b 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H @@ -59,17 +59,17 @@ class surfaceInterpolation // Demand-driven data - //- Central-differencing weighting factors - mutable surfaceScalarField* weightingFactors_; + //- Linear difference weighting factors + mutable surfaceScalarField* weights_; - //- Face-gradient difference factors - mutable surfaceScalarField* differenceFactors_; + //- Cell-centre difference coefficients + mutable surfaceScalarField* deltaCoeffs_; - //- Is mesh orthogonal - mutable bool orthogonal_; + //- Non-orthogonal cell-centre difference coefficients + mutable surfaceScalarField* nonOrthDeltaCoeffs_; //- Non-orthogonality correction vectors - mutable surfaceVectorField* correctionVectors_; + mutable surfaceVectorField* nonOrthCorrectionVectors_; // Private Member Functions @@ -80,8 +80,11 @@ class surfaceInterpolation //- Construct face-gradient difference factors void makeDeltaCoeffs() const; + //- Construct face-gradient difference factors + void makeNonOrthDeltaCoeffs() const; + //- Construct non-orthogonality correction vectors - void makeCorrectionVectors() const; + void makeNonOrthCorrectionVectors() const; protected: @@ -112,17 +115,18 @@ public: // Member functions - //- Return reference to weighting factors array + //- Return reference to linear difference weighting factors const surfaceScalarField& weights() const; - //- Return reference to difference factors array + //- Return reference to cell-centre difference coefficients const surfaceScalarField& deltaCoeffs() const; - //- Return whether mesh is orthogonal or not - bool orthogonal() const; + //- Return reference to non-orthogonal cell-centre difference + // coefficients + const surfaceScalarField& nonOrthDeltaCoeffs() const; - //- Return reference to non-orthogonality correction vectors array - const surfaceVectorField& correctionVectors() const; + //- Return reference to non-orthogonality correction vectors + const surfaceVectorField& nonOrthCorrectionVectors() const; //- Do what is neccessary if the mesh has moved bool movePoints(); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index 6509ccd1b71fa5cf1e3fd1cfb5a19523196c7c22..a3d313e30285ffb9eaf10ac5c4f658518f6abec0 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -86,7 +86,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField z_(dict.lookup("z")), z0_(readScalar(dict.lookup("z0"))), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - zGround_(readScalar(dict.lookup("zGround"))) + zGround_("zGround", dict, p.size()) { if (mag(z_) < SMALL) { diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index 6b4f7a8d453c04f666dec43019ce0d961114eaec..ab08c621c95da1aa092c751da6192598e066a7d8 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -90,7 +90,7 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField const scalar kappa_; //- Minimum corrdinate value in z direction - const scalar zGround_; + const scalarField zGround_; public: diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index db71b28d2d1d9a75b382f06b1ebb6ef2dc33f748..94eefec0f673c647ada1e3391b19aebede30280e 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -115,7 +115,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField n_ /= mag(n_); z_ /= mag(z_); - Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/min(z0_ , 0.001))); + Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/max(z0_ , 0.001))); evaluate(); } @@ -150,9 +150,11 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs() forAll(coord, i) { - if ((coord[i] - zGround_) < Href_) + if ((coord[i] - zGround_[i]) < Href_) { - Un[i] = (Ustar_/kappa_)*log((coord[i] - zGround_ + z0_)/z0_); + Un[i] = + (Ustar_/kappa_) + * log((coord[i] - zGround_[i] + z0_)/max(z0_, 0.001)); } else { @@ -181,8 +183,7 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const << Uref_ << token::END_STATEMENT << nl; os.writeKeyword("Href") << Href_ << token::END_STATEMENT << nl; - os.writeKeyword("zGround") - << zGround_ << token::END_STATEMENT << nl; + zGround_.writeEntry("zGround", os) ; writeEntry("value", os); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index c2f4e4c2f153a0130c454281c62442574d15d4ed..aa383742b05372ca025a49e7d7a05783fd7dff40 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -113,7 +113,7 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField const scalar Href_; //- Minimum corrdinate value in z direction - const scalar zGround_; + const scalarField zGround_; public: diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution index 346b9ea433a2ef3f6dadaa5f0185d45f62d09baf..8b5f9ccd5ff8c138a1d5a1251807e82e0483a2db 100644 --- a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution +++ b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution @@ -190,7 +190,7 @@ relaxationFactors h 0.95; k 0.9; epsilon 0.9; - }w + } } relaxationFactors0 diff --git a/tutorials/incompressible/windSimpleFoam/turbineSiting/0/include/ABLConditions b/tutorials/incompressible/windSimpleFoam/turbineSiting/0/include/ABLConditions index 495de0f2b8e0f06ac9abd33b8e82a3c8daccc008..be005f46a0764e366af7149e6670fb6ba8826638 100644 --- a/tutorials/incompressible/windSimpleFoam/turbineSiting/0/include/ABLConditions +++ b/tutorials/incompressible/windSimpleFoam/turbineSiting/0/include/ABLConditions @@ -13,5 +13,5 @@ z0 0.1; turbulentKE 1.3; windDirection (1 0 0); zDirection (0 0 1); -zGround 935.0; +zGround uniform 935.0; // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution index 9d4bfea5c024637160060544272ed4ca6a108e46..d09194f954dde0ac71cc6201ac1cb1f475455c51 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution @@ -94,6 +94,7 @@ PIMPLE nCorrectors 2; nNonOrthogonalCorrectors 0; nAlphaCorr 2; + correctAlpha no; } relaxationFactors diff --git a/wmake/rules/linux64Icc/c++Opt b/wmake/rules/linux64Icc/c++Opt index 28a17f783cae1846508385ed35e278b34e6cea64..66638ffe984a81a2145ace8c5e44491fdb8fe2ae 100644 --- a/wmake/rules/linux64Icc/c++Opt +++ b/wmake/rules/linux64Icc/c++Opt @@ -1,3 +1,2 @@ c++DBUG = -#c++OPT = -xSSE3 -O3 -no-prec-div -c++OPT = -xSSE3 -O1 -no-prec-div +c++OPT = -xSSE3 -O2 -no-prec-div diff --git a/wmake/rules/linuxIcc/c++Opt b/wmake/rules/linuxIcc/c++Opt index 62f12c3eb533c5902776749d3e3916f78fe95790..66638ffe984a81a2145ace8c5e44491fdb8fe2ae 100644 --- a/wmake/rules/linuxIcc/c++Opt +++ b/wmake/rules/linuxIcc/c++Opt @@ -1,5 +1,2 @@ c++DBUG = -#c++OPT = -O3 -xP -no-prec-div -c++OPT = -ansi-alias -O3 -ftz -fno-alias \ - -fargument-noalias-global \ - -unroll0 +c++OPT = -xSSE3 -O2 -no-prec-div