diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 92e61cecc..4506679f7 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -156,6 +156,7 @@ $(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternal $(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C $(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C +$(derivedFvPatchFields)/noSlip/noSlipFvPatchVectorField.C $(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C $(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C $(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C index 3c09e36a1..445bed4f7 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C @@ -38,6 +38,18 @@ Foam::fixedValueFvPatchField::fixedValueFvPatchField {} +template +Foam::fixedValueFvPatchField::fixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const Type& value +) +: + fvPatchField(p, iF, value) +{} + + template Foam::fixedValueFvPatchField::fixedValueFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H index 105a1afdd..be4e368ca 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H @@ -87,6 +87,14 @@ public: const DimensionedField& ); + //- Construct from patch, internal field and value + fixedValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const Type& value + ); + //- Construct from patch, internal field and dictionary fixedValueFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.C new file mode 100644 index 000000000..da715a6d2 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 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 "noSlipFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF, vector::zero) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF, vector::zero) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const noSlipFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(p, iF, vector::zero) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const noSlipFvPatchVectorField& mwvpvf +) +: + fixedValueFvPatchVectorField(mwvpvf) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const noSlipFvPatchVectorField& mwvpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(mwvpvf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::noSlipFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + noSlipFvPatchVectorField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.H new file mode 100644 index 000000000..a2925e992 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/noSlip/noSlipFvPatchVectorField.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 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::noSlipFvPatchVectorField + +Group + grpWallBoundaryConditions + +Description + This boundary condition fixes the velocity to zero at walls. + + \heading Patch usage + + Example of the boundary condition specification: + \verbatim + myPatch + { + type noSlip; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchVectorField + +SourceFiles + noSlipFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noSlipFvPatchVectorField_H +#define noSlipFvPatchVectorField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class noSlipFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class noSlipFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + +public: + + //- Runtime type information + TypeName("noSlip"); + + + // Constructors + + //- Construct from patch and internal field + noSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + noSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given noSlipFvPatchVectorField + // onto a new patch + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new noSlipFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new noSlipFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index e46692d50..2487e76cc 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -47,6 +47,23 @@ Foam::fvPatchField::fvPatchField {} +template +Foam::fvPatchField::fvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const Type& value +) +: + Field(p.size(), value), + patch_(p), + internalField_(iF), + updated_(false), + manipulatedMatrix_(false), + patchType_(word::null) +{} + + template Foam::fvPatchField::fvPatchField ( @@ -81,31 +98,6 @@ Foam::fvPatchField::fvPatchField {} -template -Foam::fvPatchField::fvPatchField -( - const fvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - Field(p.size()), - patch_(p), - internalField_(iF), - updated_(false), - manipulatedMatrix_(false), - patchType_(ptf.patchType_) -{ - // For unmapped faces set to internal field value (zero-gradient) - if (notNull(iF) && iF.size()) - { - fvPatchField::operator=(this->patchInternalField()); - } - this->map(ptf, mapper); -} - - template Foam::fvPatchField::fvPatchField ( @@ -144,6 +136,31 @@ Foam::fvPatchField::fvPatchField } +template +Foam::fvPatchField::fvPatchField +( + const fvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + Field(p.size()), + patch_(p), + internalField_(iF), + updated_(false), + manipulatedMatrix_(false), + patchType_(ptf.patchType_) +{ + // For unmapped faces set to internal field value (zero-gradient) + if (notNull(iF) && iF.size()) + { + fvPatchField::operator=(this->patchInternalField()); + } + this->map(ptf, mapper); +} + + template Foam::fvPatchField::fvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index c87a5b1ee..496524c76 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -166,6 +166,14 @@ public: const DimensionedField& ); + //- Construct from patch, internal field and value + fvPatchField + ( + const fvPatch&, + const DimensionedField&, + const Type& value + ); + //- Construct from patch and internal field and patch type fvPatchField ( diff --git a/tutorials/incompressible/simpleFoam/pitzDaily/0/U b/tutorials/incompressible/simpleFoam/pitzDaily/0/U index 885c5b9de..9c15c3c57 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily/0/U +++ b/tutorials/incompressible/simpleFoam/pitzDaily/0/U @@ -33,14 +33,12 @@ boundaryField upperWall { - type fixedValue; - value uniform (0 0 0); + type noSlip; } lowerWall { - type fixedValue; - value uniform (0 0 0); + type noSlip; } frontAndBack