From fee41701b5ed0edead44b8fb6ee6381856e3a0c1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 17 Feb 2014 16:25:34 +0000 Subject: [PATCH 1/4] ENH: uniformFixedValue: typo in comment --- .../uniformFixedValue/uniformFixedValuePointPatchField.H | 4 ++-- .../nonuniformTransformCyclicPolyPatch.H | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H index 120f1ffe16..0a9ca5c1c9 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,7 +149,7 @@ public: // Access - //- Return the fluctuation scale + //- Return the uniform value const DataEntry& uniformValue() const { return uniformValue_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H index 75431fdaa8..ac86166b5f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class nonuniformTransformCyclicPolyPatch Declaration + Class nonuniformTransformCyclicPolyPatch Declaration \*---------------------------------------------------------------------------*/ class nonuniformTransformCyclicPolyPatch From 61193f4cce3e5c0152a0b2aefad0143eae0240c5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 17 Feb 2014 16:26:23 +0000 Subject: [PATCH 2/4] STYLE: duplicatePoints: indentation --- .../polyTopoChange/polyTopoChange/duplicatePoints.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/duplicatePoints.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/duplicatePoints.C index 928f792f2e..bf639bcaf4 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/duplicatePoints.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/duplicatePoints.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ void Foam::duplicatePoints::setRefinement { duplicates_[localI][i] = meshMod.addPoint ( - mesh_.points()[pointI], // point + mesh_.points()[pointI], // point pointI, // master point -1, // zone for point true // supports a cell From c6cdfd5c731fd9b558c8a550bf7439563c1db4e4 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 17 Feb 2014 16:28:35 +0000 Subject: [PATCH 3/4] BUG: autoHexMesh: allow frozen points --- src/mesh/autoMesh/Make/files | 2 +- .../autoHexMeshDriver/autoLayerDriver.C | 8 +- .../medialAxisMeshMover.C | 11 +- .../medialAxisMeshMover.H | 5 +- .../zeroFixedValuePointPatchField.C | 109 +++++++++++++ .../zeroFixedValuePointPatchField.H | 154 ++++++++++++++++++ .../zeroFixedValuePointPatchFields.C | 43 +++++ .../zeroFixedValuePointPatchFields.H | 57 +++++++ .../meshRefinement/meshRefinement.C | 2 +- 9 files changed, 386 insertions(+), 5 deletions(-) create mode 100644 src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.C create mode 100644 src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.H create mode 100644 src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.C create mode 100644 src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.H diff --git a/src/mesh/autoMesh/Make/files b/src/mesh/autoMesh/Make/files index 510d34353f..be8a5fff15 100644 --- a/src/mesh/autoMesh/Make/files +++ b/src/mesh/autoMesh/Make/files @@ -30,7 +30,7 @@ meshMover = $(autoHexMesh)/externalDisplacementMeshMover $(meshMover)/displacementMeshMoverMotionSolver.C $(meshMover)/externalDisplacementMeshMover.C $(meshMover)/medialAxisMeshMover.C - +$(meshMover)/zeroFixedValue/zeroFixedValuePointPatchFields.C LIB = $(FOAM_LIBBIN)/libautoMesh diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index dd9d7fe2ee..8c10c44001 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -50,6 +50,7 @@ Description #include "PatchTools.H" #include "slipPointPatchFields.H" #include "fixedValuePointPatchFields.H" +#include "zeroFixedValuePointPatchFields.H" #include "calculatedPointPatchFields.H" #include "cyclicSlipPointPatchFields.H" #include "fixedValueFvPatchFields.H" @@ -826,7 +827,12 @@ Foam::autoLayerDriver::makeLayerDisplacementField { // 0 layers: do not allow slip so fixedValue 0 // >0 layers: fixedValue which gets adapted - if (numLayers[patchI] >= 0) + if (numLayers[patchI] == 0) + { + patchFieldTypes[patchI] = + zeroFixedValuePointPatchVectorField::typeName; + } + else if (numLayers[patchI] > 0) { patchFieldTypes[patchI] = fixedValuePointPatchVectorField::typeName; } diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C index 9d535da888..b605ae672b 100644 --- a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C @@ -33,6 +33,7 @@ License #include "PatchTools.H" #include "OBJstream.H" #include "pointData.H" +#include "zeroFixedValuePointPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -64,7 +65,15 @@ Foam::labelList Foam::medialAxisMeshMover::getFixedValueBCs if (isA >(patchFld)) { - adaptPatchIDs.append(patchI); + if (isA >(patchFld)) + { + // Special condition of fixed boundary condition. Does not + // get adapted + } + else + { + adaptPatchIDs.append(patchI); + } } } return adaptPatchIDs; diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.H b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.H index d0d1812c29..12c2d81433 100644 --- a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.H +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.H @@ -28,7 +28,10 @@ Description Mesh motion solver that uses a medial axis algorithm to work out a fraction between the (nearest point on a) moving surface and the (nearest point on a) fixed surface. - This fraction is then used to scale the motion. + This fraction is then used to scale the motion. Use + - fixedValue on all moving patches + - zeroFixedValue on stationary patches + - slip on all slipping patches SourceFiles medialAxisMeshMover.C diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.C b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.C new file mode 100644 index 0000000000..4e3b6745ec --- /dev/null +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.C @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "zeroFixedValuePointPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // + +template +zeroFixedValuePointPatchField:: +zeroFixedValuePointPatchField +( + const pointPatch& p, + const DimensionedField& iF +) +: + fixedValuePointPatchField(p, iF) +{} + + +template +zeroFixedValuePointPatchField:: +zeroFixedValuePointPatchField +( + const pointPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValuePointPatchField(p, iF, dict, false) +{ + fixedValuePointPatchField::operator=(pTraits::zero); +} + + +template +zeroFixedValuePointPatchField:: +zeroFixedValuePointPatchField +( + const zeroFixedValuePointPatchField& ptf, + const pointPatch& p, + const DimensionedField& iF, + const pointPatchFieldMapper& mapper +) +: + fixedValuePointPatchField(ptf, p, iF, mapper) +{ + // For safety re-evaluate + fixedValuePointPatchField::operator=(pTraits::zero); +} + + +template +zeroFixedValuePointPatchField:: +zeroFixedValuePointPatchField +( + const zeroFixedValuePointPatchField& ptf +) +: + fixedValuePointPatchField(ptf) +{} + + +template +zeroFixedValuePointPatchField:: +zeroFixedValuePointPatchField +( + const zeroFixedValuePointPatchField& ptf, + const DimensionedField& iF +) +: + fixedValuePointPatchField(ptf, iF) +{ + // For safety re-evaluate + fixedValuePointPatchField::operator=(pTraits::zero); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.H b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.H new file mode 100644 index 0000000000..f57942147a --- /dev/null +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchField.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::zeroFixedValuePointPatchField + +Description + Enables the specification of a zero fixed value boundary condition. + + Example of the boundary condition specification: + \verbatim + inlet + { + type zeroFixedValue; + } + \endverbatim + +SourceFiles + zeroFixedValuePointPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef zeroFixedValuePointPatchField_H +#define zeroFixedValuePointPatchField_H + +#include "fixedValuePointPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class zeroFixedValuePointPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class zeroFixedValuePointPatchField +: + public fixedValuePointPatchField +{ + +public: + + //- Runtime type information + TypeName("zeroFixedValue"); + + + // Constructors + + //- Construct from patch and internal field + zeroFixedValuePointPatchField + ( + const pointPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + zeroFixedValuePointPatchField + ( + const pointPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patchField onto a new patch + zeroFixedValuePointPatchField + ( + const zeroFixedValuePointPatchField&, + const pointPatch&, + const DimensionedField&, + const pointPatchFieldMapper& + ); + + //- Construct as copy + zeroFixedValuePointPatchField + ( + const zeroFixedValuePointPatchField& + ); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new zeroFixedValuePointPatchField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + zeroFixedValuePointPatchField + ( + const zeroFixedValuePointPatchField&, + const DimensionedField& + ); + + + //- Construct and return a clone setting internal field reference + virtual autoPtr > clone + ( + const DimensionedField& iF + ) const + { + return autoPtr > + ( + new zeroFixedValuePointPatchField + ( + *this, + iF + ) + ); + } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "zeroFixedValuePointPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.C b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.C new file mode 100644 index 0000000000..71ed2c092c --- /dev/null +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "zeroFixedValuePointPatchFields.H" +#include "pointPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePointPatchFields(zeroFixedValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.H b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.H new file mode 100644 index 0000000000..d0826b73d4 --- /dev/null +++ b/src/mesh/autoMesh/autoHexMesh/externalDisplacementMeshMover/zeroFixedValue/zeroFixedValuePointPatchFields.H @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 . + +InClass + Foam::zeroFixedValuePointPatchFields + +Description + +SourceFiles + zeroFixedValuePointPatchFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef zeroFixedValuePointPatchFields_H +#define zeroFixedValuePointPatchFields_H + +#include "zeroFixedValuePointPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePointPatchFieldTypedefs(zeroFixedValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 7bb803ef66..e90ccce3fb 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -1972,7 +1972,7 @@ void Foam::meshRefinement::calculateEdgeWeights const edge& e = edges[edgeI]; scalar eMag = max ( - VSMALL, + SMALL, mag ( pts[meshPoints[e[1]]] From 1eb9ab123843ffd24dd27a32946eb93a06f18aa1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 19 Feb 2014 15:00:51 +0000 Subject: [PATCH 4/4] BUG: snappyHexMesh: put internal faces only in layerFaces --- .../autoHexMesh/autoHexMeshDriver/autoLayerDriver.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 8c10c44001..08c8f7e530 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2463,8 +2463,8 @@ void Foam::autoLayerDriver::getLayerCellsFaces if (layer.size()) { // Layer contains both original boundary face and new boundary - // face so is nLayers+1 - forAll(layer, i) + // face so is nLayers+1. Leave out old internal face. + for (label i = 1; i < layer.size(); i++) { faceRealThickness[layer[i]] = realThickness; } @@ -2608,7 +2608,7 @@ bool Foam::autoLayerDriver::writeLayerData } { label nAdded = 0; - forAll(faceRealThickness, faceI) + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) { if (faceRealThickness[faceI] > 0) { @@ -2617,7 +2617,7 @@ bool Foam::autoLayerDriver::writeLayerData } faceSet layerFacesSet(mesh, "layerFaces", nAdded); - forAll(faceRealThickness, faceI) + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) { if (faceRealThickness[faceI] > 0) { @@ -3405,7 +3405,7 @@ void Foam::autoLayerDriver::addLayers addedCellSet.write(); faceSet layerFacesSet(newMesh, "layerFaces", newMesh.nFaces()/100); - forAll(faceRealThickness, faceI) + for (label faceI = 0; faceI < newMesh.nInternalFaces(); faceI++) { if (faceRealThickness[faceI] > 0) {