diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 8a58b394ac..66bc3bcb11 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -83,6 +83,7 @@ label addPatch pp.inGroups().append(groupName); } + // Add patch, create calculated everywhere fvMeshTools::addPatch ( @@ -636,18 +637,17 @@ int main(int argc, char *argv[]) // Note: This is added for the particular case where we want // master and slave in different groupNames // (ie 3D thermal baffles) - bool groupBase = false; - if (patchSource.found("groupBase")) - { - groupBase = readBool(patchSource.lookup("groupBase")); - if (groupBase) - { - groupNameMaster = groupName + "Group_master"; - groupNameSlave = groupName + "Group_slave"; - patchDictMaster.set("coupleGroup", groupNameMaster); - patchDictSlave.set("coupleGroup", groupNameSlave); - } + Switch sameGroup + ( + patchSource.lookupOrDefault("sameGroup", true) + ); + if (!sameGroup) + { + groupNameMaster = groupName + "Group_master"; + groupNameSlave = groupName + "Group_slave"; + patchDictMaster.set("coupleGroup", groupNameMaster); + patchDictSlave.set("coupleGroup", groupNameSlave); } addPatch(mesh, masterName, groupNameMaster, patchDictMaster); @@ -818,11 +818,11 @@ int main(int argc, char *argv[]) else { const dictionary& patchSource = dict.subDict("patchPairs"); - bool groupBase = false; - if (patchSource.found("groupBase")) - { - groupBase = readBool(patchSource.lookup("groupBase")); - } + + Switch sameGroup + ( + patchSource.lookupOrDefault("sameGroup", true) + ); const word& groupName = selectors[selectorI].name(); @@ -833,7 +833,7 @@ int main(int argc, char *argv[]) "patchFields" ); - if (!groupBase) + if (sameGroup) { // Add coupleGroup to all entries forAllIter(dictionary, patchFieldsDict, iter) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 9771757c9e..6d7b9fe688 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1078,7 +1078,6 @@ labelList addRegionPatches mesh.boundaryMesh() ); - //interfacePatches[interI] = addPatch(mesh, patch1); interfacePatches[interI] = fvMeshTools::addPatch ( mesh, @@ -1100,7 +1099,6 @@ labelList addRegionPatches point::zero, // offset mesh.boundaryMesh() ); - //addPatch(mesh, patch2); fvMeshTools::addPatch ( mesh, diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C index f6c3d51061..9263609ee5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.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 @@ -49,7 +49,13 @@ Foam::wallPolyPatch::wallPolyPatch ) : polyPatch(name, size, start, index, bm, patchType) -{} +{ + // wall is not constraint type so add wall group explicitly + if (findIndex(inGroups(), typeName) == -1) + { + inGroups().append(typeName); + } +} Foam::wallPolyPatch::wallPolyPatch @@ -62,7 +68,13 @@ Foam::wallPolyPatch::wallPolyPatch ) : polyPatch(name, dict, index, bm, patchType) -{} +{ + // wall is not constraint type so add wall group explicitly + if (findIndex(inGroups(), typeName) == -1) + { + inGroups().append(typeName); + } +} Foam::wallPolyPatch::wallPolyPatch diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 0bcfcf48a5..d7ea0f0099 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -251,6 +251,8 @@ surfaceInterpolation = interpolation/surfaceInterpolation $(surfaceInterpolation)/surfaceInterpolation/surfaceInterpolation.C $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C +$(surfaceInterpolation)/blendedSchemeBase/blendedSchemeBaseName.C + schemes = $(surfaceInterpolation)/schemes $(schemes)/linear/linear.C $(schemes)/pointLinear/pointLinear.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index c59d8d89ee..e05c34aa20 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -199,10 +199,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() else { // mass flow-rate - if - ( - patch().boundaryMesh().mesh().foundObject(rhoName_) - ) + if (db().foundObject(rhoName_)) { const fvPatchField& rhop = patch().lookupPatchField(rhoName_); diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C index c814f22060..1c68b9cf12 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.C +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.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 @@ -39,6 +39,14 @@ namespace fv // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template +const surfaceInterpolationScheme& +gaussConvectionScheme::interpScheme() const +{ + return tinterpScheme_(); +} + + template tmp > gaussConvectionScheme::interpolate diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H index 61d6c22d37..a3ce0d1ec0 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H @@ -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 @@ -134,6 +134,8 @@ public: // Member Functions + const surfaceInterpolationScheme& interpScheme() const; + tmp > interpolate ( const surfaceScalarField&, diff --git a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C new file mode 100644 index 0000000000..63c718375b --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#include "fvcCellReduce.H" +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fvc +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp > cellReduce +( + const GeometricField& ssf, + const CombineOp& cop +) +{ + typedef GeometricField volFieldType; + + const fvMesh& mesh = ssf.mesh(); + + tmp tresult + ( + new volFieldType + ( + IOobject + ( + "cellReduce(" + ssf.name() + ')', + ssf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensioned("0", ssf.dimensions(), pTraits::zero), + zeroGradientFvPatchField::typeName + ) + ); + + volFieldType& result = tresult(); + + const labelUList& own = mesh.owner(); + const labelUList& nbr = mesh.neighbour(); + + forAll(own, i) + { + label cellI = own[i]; + cop(result[cellI], ssf[i]); + } + forAll(nbr, i) + { + label cellI = nbr[i]; + cop(result[cellI], ssf[i]); + } + + result.correctBoundaryConditions(); + + return tresult; +} + + +template +tmp > cellReduce +( + const tmp&> tssf, + const CombineOp& cop +) +{ + tmp > + tvf(cellReduce(cop, tssf)); + + tssf.clear(); + return tvf; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvc + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H new file mode 100644 index 0000000000..19bd24135a --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +InNamespace + Foam::fvc + +Description + Construct a volume field from a surface field using a combine operator. + +SourceFiles + fvcCellReduce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvcCellReduce_H +#define fvcCellReduce_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace fvc functions Declaration +\*---------------------------------------------------------------------------*/ + +namespace fvc +{ + template + tmp > cellReduce + ( + const GeometricField&, + const CombineOp& cop + ); + + template + tmp > cellReduce + ( + const tmp >&, + const CombineOp& cop + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fvcCellReduce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBase.H b/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBase.H new file mode 100644 index 0000000000..2c485e0147 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBase.H @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +Class + Foam::blendedSchemeBase + +Description + Base class for blended schemes to provide access to the blending factor + surface field + +\*---------------------------------------------------------------------------*/ + +#ifndef blendedSchemeBase_H +#define blendedSchemeBase_H + +#include "className.H" +#include "tmp.H" +#include "surfaceFieldsFwd.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +TemplateName(blendedSchemeBase); + +/*---------------------------------------------------------------------------*\ + Class blendedSchemeBase Declaration +\*---------------------------------------------------------------------------*/ + +template +class blendedSchemeBase +: + public blendedSchemeBaseName +{ + +public: + + //- Constructor + blendedSchemeBase() + {} + + //- Destructor + virtual ~blendedSchemeBase() + {} + + + // Memeber Functions + + //- Return the face-based blending factor + virtual tmp blendingFactor + ( + const GeometricField& vf + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBaseName.C b/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBaseName.C new file mode 100644 index 0000000000..0a97d7f617 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/blendedSchemeBase/blendedSchemeBaseName.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#include "blendedSchemeBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(blendedSchemeBaseName, 0); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/blended/blended.H b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/blended/blended.H index 6d207fcdcd..f58b8c2393 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/blended/blended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/blended/blended.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 @@ -36,6 +36,7 @@ SourceFiles #define blended_H #include "limitedSurfaceInterpolationScheme.H" +#include "blendedSchemeBase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,7 +50,8 @@ namespace Foam template class blended : - public limitedSurfaceInterpolationScheme + public limitedSurfaceInterpolationScheme, + public blendedSchemeBase { // Private data @@ -111,8 +113,40 @@ public: {} + //- Destructor + virtual ~blended() + {} + + // Member Functions + //- Return the face-based blending factor + virtual tmp blendingFactor + ( + const GeometricField& vf + ) const + { + return tmp + ( + new surfaceScalarField + ( + IOobject + ( + vf.name() + "BlendingFactor", + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar + ( + "blendingFactor", + dimless, + blendingFactor_ + ) + ) + ); + } + //- Return the interpolation limiter virtual tmp limiter ( diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H index e8ed67a9d8..3f15520061 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H @@ -63,6 +63,7 @@ SourceFiles #define CoBlended_H #include "surfaceInterpolationScheme.H" +#include "blendedSchemeBase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,7 +77,8 @@ namespace Foam template class CoBlended : - public surfaceInterpolationScheme + public surfaceInterpolationScheme, + public blendedSchemeBase { // Private data @@ -135,10 +137,7 @@ public: ), faceFlux_ ( - mesh.lookupObject - ( - word(is) - ) + mesh.lookupObject(word(is)) ) { if (Co1_ < 0 || Co2_ < 0 || Co1_ >= Co2_) @@ -170,7 +169,7 @@ public: ( surfaceInterpolationScheme::New(mesh, faceFlux, is) ), - faceFlux_(faceFlux) + faceFlux_(faceFlux) { if (Co1_ < 0 || Co2_ < 0 || Co1_ >= Co2_) { @@ -182,17 +181,39 @@ public: } + //- Destructor + virtual ~CoBlended() + {} + + // Member Functions - //- Return the face-based Courant number blending factor - tmp blendingFactor() const + //- Return the face-based blending factor + virtual tmp blendingFactor + ( + const GeometricField& vf + ) const { - const fvMesh& mesh = faceFlux_.mesh(); + const fvMesh& mesh = this->mesh(); - return + tmp tbf ( - scalar(1) - - max + new surfaceScalarField + ( + IOobject + ( + vf.name() + "BlendingFactor", + mesh.time().timeName(), + mesh + ), + mesh, + dimensionedScalar("blendingFactor", dimless, 0.0) + ) + ); + + tbf() = + scalar(1) + - max ( min ( @@ -204,8 +225,9 @@ public: scalar(1) ), scalar(0) - ) - ); + ); + + return tbf; } @@ -216,9 +238,10 @@ public: const GeometricField& vf ) const { - surfaceScalarField bf(blendingFactor()); + surfaceScalarField bf(blendingFactor(vf)); - Info<< "weights " << max(bf) << " " << min(bf) << endl; + Info<< "weights " << max(bf).value() << " " << min(bf).value() + << endl; return bf*tScheme1_().weights(vf) @@ -234,7 +257,7 @@ public: const GeometricField& vf ) const { - surfaceScalarField bf(blendingFactor()); + surfaceScalarField bf(blendingFactor(vf)); return bf*tScheme1_().interpolate(vf) @@ -257,7 +280,7 @@ public: const GeometricField& vf ) const { - surfaceScalarField bf(blendingFactor()); + surfaceScalarField bf(blendingFactor(vf)); if (tScheme1_().corrected()) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localBlended/localBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localBlended/localBlended.H index 5f49be98fd..0e85f0ea76 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localBlended/localBlended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localBlended/localBlended.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 @@ -36,6 +36,7 @@ SourceFiles #define localBlended_H #include "surfaceInterpolationScheme.H" +#include "blendedSchemeBase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,7 +50,8 @@ namespace Foam template class localBlended : - public surfaceInterpolationScheme + public surfaceInterpolationScheme, + public blendedSchemeBase { // Private Member Functions @@ -115,8 +117,27 @@ public: {} + //- Destructor + virtual ~localBlended() + {} + + // Member Functions + //- Return the face-based blending factor + virtual tmp blendingFactor + ( + const GeometricField& vf + ) const + { + return + this->mesh().objectRegistry::template + lookupObject + ( + word(vf.name() + "BlendingFactor") + ); + } + //- Return the interpolation weighting factors tmp weights ( @@ -125,10 +146,10 @@ public: { const surfaceScalarField& blendingFactor = this->mesh().objectRegistry::template - lookupObject - ( - word(vf.name() + "BlendingFactor") - ); + lookupObject + ( + word(vf.name() + "BlendingFactor") + ); return blendingFactor*tScheme1_().weights(vf) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index 35db99fe0d..d4a3ca5a0a 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.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 @@ -139,6 +139,21 @@ Foam::displacementLaplacianFvMotionSolver:: // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::motionDiffusivity& +Foam::displacementLaplacianFvMotionSolver::diffusivity() +{ + if (!diffusivityPtr_.valid()) + { + diffusivityPtr_ = motionDiffusivity::New + ( + fvMesh_, + coeffDict().lookup("diffusivity") + ); + } + return diffusivityPtr_(); +} + + Foam::tmp Foam::displacementLaplacianFvMotionSolver::curPoints() const { @@ -210,14 +225,14 @@ void Foam::displacementLaplacianFvMotionSolver::solve() // the motionSolver accordingly movePoints(fvMesh_.points()); - diffusivityPtr_->correct(); + diffusivity().correct(); pointDisplacement_.boundaryField().updateCoeffs(); Foam::solve ( fvm::laplacian ( - diffusivityPtr_->operator()(), + diffusivity().operator()(), cellDisplacement_, "laplacian(diffusivity,cellDisplacement)" ) @@ -234,12 +249,7 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh // Update diffusivity. Note two stage to make sure old one is de-registered // before creating/registering new one. - diffusivityPtr_.reset(NULL); - diffusivityPtr_ = motionDiffusivity::New - ( - fvMesh_, - coeffDict().lookup("diffusivity") - ); + diffusivityPtr_.clear(); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H index c0b4e9970a..47ad2c672c 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H @@ -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 @@ -53,7 +53,6 @@ class motionDiffusivity; class displacementLaplacianFvMotionSolver : -// public displacementFvMotionSolver public displacementMotionSolver, public fvMotionSolverCore { @@ -120,6 +119,9 @@ public: return cellDisplacement_; } + //- Return reference to the diffusivity field + motionDiffusivity& diffusivity(); + //- Return point location obtained from the current motion field virtual tmp curPoints() const; diff --git a/src/fvOptions/fvOptions/fvIOoptionList.C b/src/fvOptions/fvOptions/fvIOoptionList.C index 287e4171be..0a7ab4e6fc 100644 --- a/src/fvOptions/fvOptions/fvIOoptionList.C +++ b/src/fvOptions/fvOptions/fvIOoptionList.C @@ -45,7 +45,7 @@ Foam::IOobject Foam::fv::IOoptionList::createIOobject if (io.headerOk()) { - Info<< "Creating fintite volume options from " << io.name() << nl + Info<< "Creating finite volume options from " << io.name() << nl << endl; io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C index 8d1729361e..51272f3560 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C @@ -26,7 +26,6 @@ License #include "SurfaceFilmModel.H" #include "surfaceFilmModel.H" #include "mathematicalConstants.H" -#include "mappedPatchBase.H" using namespace Foam::constant; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H index 0f0a4d4196..9098782204 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H @@ -55,8 +55,6 @@ namespace regionModels } } -class mappedPatchBase; - /*---------------------------------------------------------------------------*\ Class SurfaceFilmModel Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C index eb223c8841..b2a142accf 100644 --- a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C @@ -66,7 +66,6 @@ Foam::labelList Foam::medialAxisMeshMover::getFixedValueBCs if (isA >(patchFld)) { adaptPatchIDs.append(patchI); - //Info<< "Detected adapt patch " << patchFld.patch().name() << endl; } } return adaptPatchIDs; @@ -1259,6 +1258,7 @@ handleFeatureAngleLayerTerminations void Foam::medialAxisMeshMover::findIsolatedRegions ( const scalar minCosLayerTermination, + const bool detectExtrusionIsland, const PackedBoolList& isMasterPoint, const PackedBoolList& isMasterEdge, const labelList& meshEdges, @@ -1268,6 +1268,8 @@ void Foam::medialAxisMeshMover::findIsolatedRegions ) const { const indirectPrimitivePatch& pp = adaptPatchPtr_(); + const labelListList& pointFaces = pp.pointFaces(); + Info<< typeName << " : Removing isolated regions ..." << endl; @@ -1292,40 +1294,110 @@ void Foam::medialAxisMeshMover::findIsolatedRegions syncPatchDisplacement(minThickness, patchDisp, extrudeStatus); - // Do not extrude from point where all neighbouring - // faces are not grown - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - boolList extrudedFaces(pp.size(), true); - forAll(pp.localFaces(), faceI) - { - const face& f = pp.localFaces()[faceI]; - forAll(f, fp) - { - if (extrudeStatus[f[fp]] == autoLayerDriver::NOEXTRUDE) - { - extrudedFaces[faceI] = false; - break; - } - } - } - const labelListList& pointFaces = pp.pointFaces(); + // Detect either: + // - point where all surrounding points are not extruded + // (detectExtrusionIsland) + // or + // - point where all the faces surrounding it are not fully + // extruded boolList keptPoints(pp.nPoints(), false); - forAll(keptPoints, patchPointI) - { - const labelList& pFaces = pointFaces[patchPointI]; - forAll(pFaces, i) + if (detectExtrusionIsland) + { + // Do not extrude from point where all neighbouring + // points are not grown + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelList islandPoint(pp.size(), -1); + forAll(pp, faceI) { - label faceI = pFaces[i]; - if (extrudedFaces[faceI]) + const face& f = pp.localFaces()[faceI]; + + forAll(f, fp) { - keptPoints[patchPointI] = true; - break; + label patchPointI = f[fp]; + + if (extrudeStatus[f[fp]] != autoLayerDriver::NOEXTRUDE) + { + if (islandPoint[faceI] == -1) + { + // First point to extrude + islandPoint[faceI] = patchPointI; + } + else + { + // Second or more point to extrude + islandPoint[faceI] = -2; + } + } + } + } + + // islandPoint: + // -1 : no point extruded + // -2 : >= 2 points extruded + // >=0: label of point extruded + + // Check all surrounding faces that I am the islandPoint + boolList keptPoints(pp.nPoints(), false); + forAll(pointFaces, patchPointI) + { + if (extrudeStatus[patchPointI] != autoLayerDriver::NOEXTRUDE) + { + const labelList& pFaces = pointFaces[patchPointI]; + + forAll(pFaces, i) + { + label faceI = pFaces[i]; + if (islandPoint[faceI] != patchPointI) + { + keptPoints[patchPointI] = true; + break; + } + } } } } + else + { + // Do not extrude from point where all neighbouring + // faces are not grown + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + boolList extrudedFaces(pp.size(), true); + forAll(pp.localFaces(), faceI) + { + const face& f = pp.localFaces()[faceI]; + forAll(f, fp) + { + if (extrudeStatus[f[fp]] == autoLayerDriver::NOEXTRUDE) + { + extrudedFaces[faceI] = false; + break; + } + } + } + + const labelListList& pointFaces = pp.pointFaces(); + + forAll(keptPoints, patchPointI) + { + const labelList& pFaces = pointFaces[patchPointI]; + + forAll(pFaces, i) + { + label faceI = pFaces[i]; + if (extrudedFaces[faceI]) + { + keptPoints[patchPointI] = true; + break; + } + } + } + } + syncTools::syncPointList ( @@ -1344,8 +1416,8 @@ void Foam::medialAxisMeshMover::findIsolatedRegions { if (unmarkExtrusion(patchPointI, patchDisp, extrudeStatus)) { - nPointCounter++; - nChanged++; + nPointCounter++; + nChanged++; } } } @@ -1701,6 +1773,13 @@ void Foam::medialAxisMeshMover::calculateDisplacement mesh().globalData().nTotalPoints() ); + //- Use strick extrusionIsland detection + const Switch detectExtrusionIsland = coeffDict.lookupOrDefault