diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/resetPhiPatches.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/resetPhiPatches.H deleted file mode 100644 index fe428b6e3b..0000000000 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/resetPhiPatches.H +++ /dev/null @@ -1,8 +0,0 @@ -FieldField& phibf = phi.boundaryField(); -const FieldField& Ubf = U.boundaryField(); -const FieldField& Sfbf = mesh.Sf().boundaryField(); - -forAll(phibf, patchI) -{ - phibf[patchI] = (Ubf[patchI] & Sfbf[patchI]); -} diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/Make/files b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/files similarity index 100% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/Make/files rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/files diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/Make/options b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options similarity index 100% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/Make/options rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H similarity index 100% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/createFields.H similarity index 100% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/createFields.H diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H similarity index 88% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H index 888d06a889..11dfa8a520 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H @@ -1,5 +1,3 @@ -#include "resetPhiPatches.H" - volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rAUf("Dp", fvc::interpolate(rAU)); @@ -22,6 +20,9 @@ adjustPhi(phiHbyA, U, p_gh); fvOptions.relativeFlux(phiHbyA); +// Update the phi BCs from U before p BCs are updated +phi.boundaryField() = mesh.Sf().boundaryField() & U.boundaryField(); + // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C similarity index 100% rename from applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C rename to applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 34f9716285..e87f64bc30 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1783,7 +1783,7 @@ int main(int argc, char *argv[]) { extrudeMeshShadowFaces[nShadowFaces] = fz[j]; zoneShadowFlipMap[nShadowFaces] = fz.flipMap()[j]; - zoneShadowID[nShadowFaces] = zoneShadowIDs[i]; + zoneShadowID[nShadowFaces] = i; nShadowFaces++; } } diff --git a/applications/utilities/mesh/generation/foamyHexMesh/foamyHexMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/foamyHexMesh.C index 87c1dbe22d..f71a17cfcb 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/foamyHexMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/foamyHexMesh.C @@ -111,6 +111,8 @@ int main(int argc, char *argv[]) conformalVoronoiMesh::debug = true; + Info<< "Create mesh for time = " << runTime.timeName() << nl << endl; + conformalVoronoiMesh mesh(runTime, foamyHexMeshDict); diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H index ff6e106377..8e80383990 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,6 +79,9 @@ public: class const_iterator; friend class const_iterator; + class const_reverse_iterator; + friend class const_reverse_iterator; + // Constructors @@ -254,6 +257,48 @@ public: }; + // STL const_reverse_iterator + + typedef typename LListBase::const_reverse_iterator + LListBase_const_reverse_iterator; + + //- An STL-conforming const_reverse_iterator + class const_reverse_iterator + : + public LListBase_const_reverse_iterator + { + + public: + + //- Construct from base const_reverse_iterator + const_reverse_iterator(LListBase_const_reverse_iterator baseIter) + : + LListBase_const_reverse_iterator(baseIter) + {} + + + // Member operators + + const T& operator*() + { + return + static_cast + (LListBase_const_reverse_iterator::operator*()); + } + + const T& operator()() + { + return operator*(); + } + + const_reverse_iterator& operator++() + { + LListBase_const_reverse_iterator::operator++(); + return *this; + } + }; + + // STL member operators //- Equality operation on ULists of the same type. diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C index 95476fd89a..4757dbb0f7 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,12 @@ Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter_ reinterpret_cast(0) ); +Foam::DLListBase::const_reverse_iterator Foam::DLListBase::endConstRevIter_ +( + static_cast(DLListBase()), + reinterpret_cast(0) +); + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index 3af1b2b1bc..2894931bce 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,6 +100,9 @@ public: class const_iterator; friend class const_iterator; + class const_reverse_iterator; + friend class const_reverse_iterator; + // Constructors @@ -260,6 +263,43 @@ public: inline const_iterator begin() const; inline const const_iterator& end() const; + // STL const_reverse_iterator + + //- An STL-conforming const_reverse_iterator + class const_reverse_iterator + { + // Private data + + //- Reference to the list this is an reverse_iterator for + const DLListBase& curList_; + + //- Current element + const link* curElmt_; + + public: + + //- Construct for a given DLListBase and link + inline const_reverse_iterator(const DLListBase&, const link*); + + // Member operators + + inline void operator=(const const_reverse_iterator&); + + inline bool operator==(const const_reverse_iterator&) const; + inline bool operator!=(const const_reverse_iterator&) const; + + inline const link& operator*(); + + inline const_reverse_iterator& operator++(); + inline const_reverse_iterator operator++(int); + }; + + inline const_reverse_iterator crbegin() const; + inline const const_reverse_iterator& crend() const; + + inline const_reverse_iterator rbegin() const; + inline const const_reverse_iterator& rend() const; + private: //- iterator returned by end() @@ -268,6 +308,9 @@ private: //- const_iterator returned by end() static const_iterator endConstIter_; + //- const_reverse_iterator returned by end() + static const_reverse_iterator endConstRevIter_; + }; diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H index 9e7eeacd23..fd33c5efac 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -383,4 +383,111 @@ Foam::DLListBase::end() const } +// * * * * * * * * * * STL const_reverse_iterator * * * * * * * * * * * * * // + +inline Foam::DLListBase::const_reverse_iterator::const_reverse_iterator +( + const DLListBase& s, + const link* elmt +) +: + curList_(s), + curElmt_(elmt) +{} + + +inline void Foam::DLListBase::const_reverse_iterator::operator= +( + const const_reverse_iterator& iter +) +{ + curElmt_ = iter.curElmt_; +} + + +inline bool Foam::DLListBase::const_reverse_iterator::operator== +( + const const_reverse_iterator& iter +) const +{ + return curElmt_ == iter.curElmt_; +} + + +inline bool Foam::DLListBase::const_reverse_iterator::operator!= +( + const const_reverse_iterator& iter +) const +{ + return curElmt_ != iter.curElmt_; +} + + +inline const Foam::DLListBase::link& +Foam::DLListBase::const_reverse_iterator::operator*() +{ + return *curElmt_; +} + + +inline Foam::DLListBase::const_reverse_iterator& +Foam::DLListBase::const_reverse_iterator::operator++() +{ + if (curElmt_ == curList_.first_) + { + curElmt_ = 0; + } + else + { + curElmt_ = curElmt_->prev_; + } + + return *this; +} + + +inline Foam::DLListBase::const_reverse_iterator +Foam::DLListBase::const_reverse_iterator::operator++(int) +{ + const_reverse_iterator tmp = *this; + ++*this; + return tmp; +} + + +inline Foam::DLListBase::const_reverse_iterator +Foam::DLListBase::crbegin() const +{ + if (size()) + { + return const_reverse_iterator(*this, last()); + } + else + { + return endConstRevIter_; + } +} + + +inline const Foam::DLListBase::const_reverse_iterator& +Foam::DLListBase::crend() const +{ + return endConstRevIter_; +} + + +inline Foam::DLListBase::const_reverse_iterator +Foam::DLListBase::rbegin() const +{ + return this->crbegin(); +} + + +inline const Foam::DLListBase::const_reverse_iterator& +Foam::DLListBase::rend() const +{ + return endConstRevIter_; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C index fd79d3835a..7c68958b15 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -628,197 +628,245 @@ BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define PRODUCT_OPERATOR(product, op, opFunc) \ - \ -template class Field, class Type1, class Type2> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const FieldField& f1, \ - const FieldField& f2 \ -) \ -{ \ - forAll(f, i) \ - { \ - opFunc(f[i], f1[i], f2[i]); \ - } \ -} \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const FieldField& f2 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - FieldField::NewCalculatedType(f1) \ - ); \ - opFunc(tRes(), f1, f2); \ - return tRes; \ -} \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const tmp >& tf2 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - reuseTmpFieldField::New(tf2) \ - ); \ - opFunc(tRes(), f1, tf2()); \ - reuseTmpFieldField::clear(tf2); \ - return tRes; \ -} \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const FieldField& f2 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - reuseTmpFieldField::New(tf1) \ - ); \ - opFunc(tRes(), tf1(), f2); \ - reuseTmpFieldField::clear(tf1); \ - return tRes; \ -} \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const tmp >& tf2 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - reuseTmpTmpFieldField::New \ - (tf1, tf2) \ - ); \ - opFunc(tRes(), tf1(), tf2()); \ - reuseTmpTmpFieldField::clear \ - (tf1, tf2); \ - return tRes; \ -} \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const FieldField& f1, \ - const VectorSpace& vs \ -) \ -{ \ - forAll(f, i) \ - { \ - opFunc(f[i], f1[i], vs); \ - } \ -} \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const VectorSpace& vs \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - FieldField::NewCalculatedType(f1) \ - ); \ - opFunc(tRes(), f1, static_cast(vs)); \ - return tRes; \ -} \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const VectorSpace& vs \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - reuseTmpFieldField::New(tf1) \ - ); \ - opFunc(tRes(), tf1(), static_cast(vs)); \ - reuseTmpFieldField::clear(tf1); \ - return tRes; \ -} \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const VectorSpace& vs, \ - const FieldField& f1 \ -) \ -{ \ - forAll(f, i) \ - { \ - opFunc(f[i], vs, f1[i]); \ - } \ -} \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -tmp::type> > \ -operator op \ -( \ - const VectorSpace& vs, \ - const FieldField& f1 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - FieldField::NewCalculatedType(f1) \ - ); \ - opFunc(tRes(), static_cast(vs), f1); \ - return tRes; \ -} \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -tmp::type> > \ -operator op \ -( \ - const VectorSpace& vs, \ - const tmp >& tf1 \ -) \ -{ \ - typedef typename product::type productType; \ - tmp > tRes \ - ( \ - reuseTmpFieldField::New(tf1) \ - ); \ - opFunc(tRes(), static_cast(vs), tf1()); \ - reuseTmpFieldField::clear(tf1); \ - return tRes; \ +#define PRODUCT_OPERATOR(product, op, opFunc) \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const FieldField& f1, \ + const FieldField& f2 \ +) \ +{ \ + forAll(f, i) \ + { \ + opFunc(f[i], f1[i], f2[i]); \ + } \ +} \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const FieldField& f2 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + FieldField::NewCalculatedType(f1) \ + ); \ + opFunc(tRes(), f1, f2); \ + return tRes; \ +} \ + \ +template class Field, class Type1, class Type2> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const tmp >& tf2 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + reuseTmpFieldField::New(tf2) \ + ); \ + opFunc(tRes(), f1, tf2()); \ + reuseTmpFieldField::clear(tf2); \ + return tRes; \ +} \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const tmp >& tf2 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + FieldField::NewCalculatedType(f1) \ + ); \ + opFunc(tRes(), f1, tf2()); \ + tf2.clear(); \ + return tRes; \ +} \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const FieldField& f2 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + reuseTmpFieldField::New(tf1) \ + ); \ + opFunc(tRes(), tf1(), f2); \ + reuseTmpFieldField::clear(tf1); \ + return tRes; \ +} \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const tmp >& tf2 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + reuseTmpTmpFieldField::New \ + (tf1, tf2) \ + ); \ + opFunc(tRes(), tf1(), tf2()); \ + reuseTmpTmpFieldField::clear \ + (tf1, tf2); \ + return tRes; \ +} \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const FieldField& f1, \ + const VectorSpace& vs \ +) \ +{ \ + forAll(f, i) \ + { \ + opFunc(f[i], f1[i], vs); \ + } \ +} \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const VectorSpace& vs \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + FieldField::NewCalculatedType(f1) \ + ); \ + opFunc(tRes(), f1, static_cast(vs)); \ + return tRes; \ +} \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const VectorSpace& vs \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + reuseTmpFieldField::New(tf1) \ + ); \ + opFunc(tRes(), tf1(), static_cast(vs)); \ + reuseTmpFieldField::clear(tf1); \ + return tRes; \ +} \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const VectorSpace& vs, \ + const FieldField& f1 \ +) \ +{ \ + forAll(f, i) \ + { \ + opFunc(f[i], vs, f1[i]); \ + } \ +} \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +tmp::type> > \ +operator op \ +( \ + const VectorSpace& vs, \ + const FieldField& f1 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + FieldField::NewCalculatedType(f1) \ + ); \ + opFunc(tRes(), static_cast(vs), f1); \ + return tRes; \ +} \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +tmp::type> > \ +operator op \ +( \ + const VectorSpace& vs, \ + const tmp >& tf1 \ +) \ +{ \ + typedef typename product::type productType; \ + tmp > tRes \ + ( \ + reuseTmpFieldField::New(tf1) \ + ); \ + opFunc(tRes(), static_cast(vs), tf1()); \ + reuseTmpFieldField::clear(tf1); \ + return tRes; \ } PRODUCT_OPERATOR(typeOfSum, +, add) diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H index ba4be61880..65f68b34ec 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -267,100 +267,138 @@ BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define PRODUCT_OPERATOR(product, op, opFunc) \ - \ -template class Field, class Type1, class Type2> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const FieldField& f1, \ - const FieldField& f2 \ -); \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const FieldField& f2 \ -); \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const tmp >& tf2 \ -); \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const FieldField& f2 \ -); \ - \ -template class Field, class Type1, class Type2> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const tmp >& tf2 \ -); \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const FieldField& f1, \ - const VectorSpace& vs \ -); \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -tmp::type> > \ -operator op \ -( \ - const FieldField& f1, \ - const VectorSpace& vs \ -); \ - \ -template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ -tmp::type> > \ -operator op \ -( \ - const tmp >& tf1, \ - const VectorSpace& vs \ -); \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -void opFunc \ -( \ - FieldField::type>& f, \ - const VectorSpace& vs, \ - const FieldField& f1 \ -); \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -tmp::type> > \ -operator op \ -( \ - const VectorSpace& vs, \ - const FieldField& f1 \ -); \ - \ -template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ -tmp::type> > \ -operator op \ -( \ - const VectorSpace& vs, \ - const tmp >& tf1 \ +#define PRODUCT_OPERATOR(product, op, opFunc) \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const FieldField& f1, \ + const FieldField& f2 \ +); \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const FieldField& f2 \ +); \ + \ +template class Field, class Type1, class Type2> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const tmp >& tf2 \ +); \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const tmp >& tf2 \ +); \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const FieldField& f2 \ +); \ + \ +template \ +< \ + template class Field1, \ + template class Field2, \ + class Type1, \ + class Type2 \ +> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const tmp >& tf2 \ +); \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const FieldField& f1, \ + const VectorSpace& vs \ +); \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +tmp::type> > \ +operator op \ +( \ + const FieldField& f1, \ + const VectorSpace& vs \ +); \ + \ +template \ + class Field, class Type, class Form, class Cmpt, int nCmpt> \ +tmp::type> > \ +operator op \ +( \ + const tmp >& tf1, \ + const VectorSpace& vs \ +); \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +void opFunc \ +( \ + FieldField::type>& f, \ + const VectorSpace& vs, \ + const FieldField& f1 \ +); \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +tmp::type> > \ +operator op \ +( \ + const VectorSpace& vs, \ + const FieldField& f1 \ +); \ + \ +template \ + class Field, class Form, class Cmpt, int nCmpt, class Type> \ +tmp::type> > \ +operator op \ +( \ + const VectorSpace& vs, \ + const tmp >& tf1 \ ); PRODUCT_OPERATOR(typeOfSum, +, add) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index c024d98389..a13a24b0d4 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -50,7 +50,8 @@ readField } - // 1. Handle explicit patch names + // 1. Handle explicit patch names. Note that there can be only one explicit + // patch name since is key of dictionary. forAllConstIter(dictionary, dict, iter) { if (iter().isDict() && !iter().keyword().isPattern()) @@ -76,33 +77,45 @@ readField // 2. Patch-groups. (using non-wild card entries of dictionaries) // (patchnames already matched above) - // Note: in order of entries in the dictionary (first patchGroups wins) - forAllConstIter(dictionary, dict, iter) + // Note: in reverse order of entries in the dictionary (last + // patchGroups wins). This is so is consistent with dictionary wildcard + // behaviour + if (dict.size()) { - if (iter().isDict() && !iter().keyword().isPattern()) + for + ( + IDLList::const_reverse_iterator iter = dict.rbegin(); + iter != dict.rend(); + ++iter + ) { - const labelList patchIDs = bmesh_.findIndices - ( - iter().keyword(), - true // use patchGroups - ); + const entry& e = iter(); - forAll(patchIDs, i) + if (e.isDict() && !e.keyword().isPattern()) { - label patchi = patchIDs[i]; + const labelList patchIDs = bmesh_.findIndices + ( + e.keyword(), + true // use patchGroups + ); - if (!this->set(patchi)) + forAll(patchIDs, i) { - this->set - ( - patchi, - PatchField::New + label patchi = patchIDs[i]; + + if (!this->set(patchi)) + { + this->set ( - bmesh_[patchi], - field, - iter().dict() - ) - ); + patchi, + PatchField::New + ( + bmesh_[patchi], + field, + e.dict() + ) + ); + } } } } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C index 6c18b43d0a..3cdf3a6e4e 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C @@ -90,10 +90,6 @@ void Foam::GAMGSolver::interpolate { corrC[restrictAddressing[celli]] += diagPtr[celli]*psiPtr[celli]; diagC[restrictAddressing[celli]] += diagPtr[celli]; - //corrC[restrictAddressing[celli]] += psiPtr[celli]/diagPtr[celli]; - //diagC[restrictAddressing[celli]] += 1.0/diagPtr[celli]; - //corrC[restrictAddressing[celli]] += psiPtr[celli]; - //diagC[restrictAddressing[celli]] += 1.0; } for (register label ccelli=0; ccelli(ACf.operator const scalarField&()); - if (interpolateCorrection_ && leveli < coarsestLevel - 2) + if (interpolateCorrection_) //&& leveli < coarsestLevel - 2) { interpolate ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H index 80ad919547..f1d07d79b9 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,16 +98,6 @@ public: //- Destructor virtual ~coupledPointPatch(); - - // Member Functions - - // Access - - //- Return true because this patch is coupled - virtual bool coupled() const - { - return true; - } }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index da777d683c..6699795bfc 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -115,19 +115,6 @@ public: // Member functions - //- Return true if running parallel - virtual bool coupled() const - { - if (Pstream::parRun()) - { - return true; - } - else - { - return false; - } - } - //- Return message tag to use for communication virtual int tag() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H index c59234c66c..f5958be5e0 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -171,6 +171,12 @@ public: return polyPatch_.index(); } + //- Return true if this patch field is coupled + virtual bool coupled() const + { + return polyPatch_.coupled(); + } + //- Return mesh points virtual const labelList& meshPoints() const { diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C index 4d32bfa89f..311df77f7d 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C @@ -38,7 +38,7 @@ makeCompactCellFaceAddressingAndFaceWeights const lduAddressing& fineAddressing, List& cellCells, List& cellCellOffsets, - const vectorField& Si, + const scalarField& magSi, List& faceWeights ) { @@ -87,8 +87,8 @@ makeCompactCellFaceAddressingAndFaceWeights cellCells[l1] = nei; cellCells[l2] = own; - faceWeights[l1] = mag(Si[facei]); - faceWeights[l2] = mag(Si[facei]); + faceWeights[l1] = magSi[facei]; + faceWeights[l2] = magSi[facei]; } } @@ -100,8 +100,8 @@ Foam::tmp Foam::MGridGenGAMGAgglomeration::agglomerate const label maxSize, const lduAddressing& fineAddressing, const scalarField& V, - const vectorField& Sf, - const scalarField& Sb + const scalarField& magSf, + const scalarField& magSb ) { const label nFineCells = fineAddressing.size(); @@ -119,15 +119,15 @@ Foam::tmp Foam::MGridGenGAMGAgglomeration::agglomerate fineAddressing, cellCells, cellCellOffsets, - Sf, + magSf, faceWeights ); // agglomeration options. List options(4, 0); - options[0] = 4; // globular agglom - options[1] = 6; // objective F3 and F2 - options[2] = 128; // debugging output level + options[0] = 4; // globular agglom + options[1] = 6; // objective F3 and F2 + options[2] = 128; // debugging output level options[3] = fvMesh_.nGeometricD(); // Dimensionality of the grid @@ -140,7 +140,7 @@ Foam::tmp Foam::MGridGenGAMGAgglomeration::agglomerate nFineCells, cellCellOffsets.begin(), const_cast(V.begin()), - const_cast(Sb.begin()), + const_cast(magSb.begin()), cellCells.begin(), faceWeights.begin(), minSize, @@ -157,8 +157,7 @@ Foam::tmp Foam::MGridGenGAMGAgglomeration::agglomerate bool ok = checkRestriction ( newRestrictAddr, - nNewCoarseCells -, + nNewCoarseCells, fineAddressing, finalAgglom, nCoarseCells diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C index cc259c5038..dd912465a0 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C @@ -25,6 +25,7 @@ License #include "MGridGenGAMGAgglomeration.H" #include "fvMesh.H" +#include "processorPolyPatch.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -60,20 +61,19 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration // Start geometric agglomeration from the cell volumes and areas of the mesh scalarField* VPtr = const_cast(&fvMesh_.cellVolumes()); - vectorField magFaceAreas(vector::one*mag(fvMesh_.faceAreas())); - SubField Sf(magFaceAreas, fvMesh_.nInternalFaces()); - //SubField Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces()); + scalarField magFaceAreas(sqrt(3.0)*mag(fvMesh_.faceAreas())); + SubField magSf(magFaceAreas, fvMesh_.nInternalFaces()); - vectorField* SfPtr = const_cast + scalarField* magSfPtr = const_cast ( - &Sf.operator const vectorField&() + &magSf.operator const scalarField&() ); // Create the boundary area cell field - scalarField* SbPtr(new scalarField(fvMesh_.nCells(), 0)); + scalarField* magSbPtr(new scalarField(fvMesh_.nCells(), 0)); { - scalarField& Sb = *SbPtr; + scalarField& magSb = *magSbPtr; const labelList& own = fvMesh_.faceOwner(); const vectorField& Sf = fvMesh_.faceAreas(); @@ -82,11 +82,32 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration { if (!fvMesh_.isInternalFace(facei)) { - Sb[own[facei]] += mag(Sf[facei]); + magSb[own[facei]] += mag(Sf[facei]); } } } + /* + { + scalarField& magSb = *magSbPtr; + const polyBoundaryMesh& patches = fvMesh_.boundaryMesh(); + + forAll(patches, patchi) + { + const polyPatch& pp = patches[patchi]; + + if (!(Pstream::parRun() && isA(pp))) + { + const labelUList& faceCells = pp.faceCells(); + const vectorField& pSf = pp.faceAreas(); + forAll(faceCells, pfi) + { + magSb[faceCells[pfi]] += mag(pSf[pfi]); + } + } + } + } + */ // Agglomerate until the required number of cells in the coarsest level // is reached @@ -104,8 +125,8 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration maxSize, meshLevel(nCreatedLevels).lduAddr(), *VPtr, - *SfPtr, - *SbPtr + *magSfPtr, + *magSbPtr ); if (continueAgglomerating(nCoarseCells)) @@ -140,37 +161,37 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration // Agglomerate the face areas field for the next level { - vectorField* aggSfPtr + scalarField* aggMagSfPtr ( - new vectorField + new scalarField ( meshLevels_[nCreatedLevels].upperAddr().size(), - vector::zero + 0 ) ); - restrictFaceField(*aggSfPtr, *SfPtr, nCreatedLevels); + restrictFaceField(*aggMagSfPtr, *magSfPtr, nCreatedLevels); if (nCreatedLevels) { - delete SfPtr; + delete magSfPtr; } - SfPtr = aggSfPtr; + magSfPtr = aggMagSfPtr; } // Agglomerate the cell boundary areas field for the next level { - scalarField* aggSbPtr + scalarField* aggMagSbPtr ( new scalarField(meshLevels_[nCreatedLevels].size()) ); // Restrict but no parallel agglomeration (not supported) - restrictField(*aggSbPtr, *SbPtr, nCreatedLevels, false); + restrictField(*aggMagSbPtr, *magSbPtr, nCreatedLevels, false); - delete SbPtr; - SbPtr = aggSbPtr; + delete magSbPtr; + magSbPtr = aggMagSbPtr; } nCreatedLevels++; @@ -183,9 +204,9 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration if (nCreatedLevels) { delete VPtr; - delete SfPtr; + delete magSfPtr; } - delete SbPtr; + delete magSbPtr; } diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.H b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.H index ea6b5e9c19..5ed8e2a401 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.H +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,7 +73,7 @@ class MGridGenGAMGAgglomeration const lduAddressing& fineAddressing, List& cellCells, List& cellCellOffsets, - const vectorField& Si, + const scalarField& magSi, List& faceWeights ); @@ -85,8 +85,8 @@ class MGridGenGAMGAgglomeration const label maxSize, const lduAddressing& fineAddressing, const scalarField& V, - const vectorField& Sf, - const scalarField& Sb + const scalarField& magSf, + const scalarField& magSb ); diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index 8a3cd26b68..bd9eb4c006 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,7 +72,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection const scalar projectLen = mag(mesh.bounds().max()-mesh.bounds().min()); // For case of fixed projection vector: - vector projectVec; + vector projectVec(vector::zero); if (projectMode_ == FIXEDNORMAL) { vector n = projectDir_/mag(projectDir_); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 6fd254c46e..6a61832cd6 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2501,7 +2501,8 @@ void Foam::autoLayerDriver::addLayers if (debug&meshRefinement::MESH) { const_cast(mesh.time())++; - Info<< "Writing baffled mesh to " << meshRefiner_.timeName() << endl; + Info<< "Writing baffled mesh to time " + << meshRefiner_.timeName() << endl; meshRefiner_.write ( debug, @@ -2923,7 +2924,8 @@ void Foam::autoLayerDriver::addLayers ); const_cast(mesh.time())++; - Info<< "Writing shrunk mesh to " << meshRefiner_.timeName() << endl; + Info<< "Writing shrunk mesh to time " + << meshRefiner_.timeName() << endl; // See comment in autoSnapDriver why we should not remove meshPhi // using mesh.clearOut(). @@ -3057,7 +3059,8 @@ void Foam::autoLayerDriver::addLayers if (debug&meshRefinement::MESH) { - Info<< "Writing layer mesh to " << meshRefiner_.timeName() << endl; + Info<< "Writing layer mesh to time " << meshRefiner_.timeName() + << endl; newMesh.write(); cellSet addedCellSet ( diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index 014c616287..9f881a52f3 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -958,13 +958,15 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells // Because of isCollapsedFace one side can decide not to baffle whereas // the other side does so sync. Baffling is prefered over not baffling. - syncTools::syncFaceList - ( - mesh_, - facePatch, - maxEqOp