From ae8782fe8830e1b3f5881819beebaf77820b45b1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 18 Feb 2014 09:19:25 +0000 Subject: [PATCH] BUG: snappyHexMesh: fixed 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]]]