diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 92e61cecc016a12717d766bc19de58fc998c8c04..4506679f7b67774dea2bdd3c8649a2bba19137a1 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 3c09e36a1df197f7c28fc31d1b00e8f532f59db1..445bed4f7ebeb4c11b35f49cc2063703c50412fd 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<Type>::fixedValueFvPatchField {} +template<class Type> +Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const Type& value +) +: + fvPatchField<Type>(p, iF, value) +{} + + template<class Type> Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H index 105a1afddc2d476dc3f48dff08dcf36107672618..be4e368ca4d07d2622d1e3e0ab325a01c1c69c00 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<Type, volMesh>& ); + //- Construct from patch, internal field and value + fixedValueFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + 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 0000000000000000000000000000000000000000..da715a6d291000dc2066b5817cdf64b5c82c5c91 --- /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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "noSlipFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(p, iF, vector::zero) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF, vector::zero) +{} + + +Foam::noSlipFvPatchVectorField::noSlipFvPatchVectorField +( + const noSlipFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& 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<vector, volMesh>& 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 0000000000000000000000000000000000000000..a2925e992f183584bfc6c80a7dfc6ee3572528f0 --- /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 <http://www.gnu.org/licenses/>. + +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<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + noSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given noSlipFvPatchVectorField + // onto a new patch + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new noSlipFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + noSlipFvPatchVectorField + ( + const noSlipFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + 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 e46692d50bc03b6cfe6ad4af4a039835d5bae03e..2487e76cc9e74c8a1068c4f60cffc79ab66b4936 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -52,15 +52,15 @@ Foam::fvPatchField<Type>::fvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const word& patchType + const Type& value ) : - Field<Type>(p.size()), + Field<Type>(p.size(), value), patch_(p), internalField_(iF), updated_(false), manipulatedMatrix_(false), - patchType_(patchType) + patchType_(word::null) {} @@ -69,41 +69,33 @@ Foam::fvPatchField<Type>::fvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const Field<Type>& f + const word& patchType ) : - Field<Type>(f), + Field<Type>(p.size()), patch_(p), internalField_(iF), updated_(false), manipulatedMatrix_(false), - patchType_(word::null) + patchType_(patchType) {} template<class Type> Foam::fvPatchField<Type>::fvPatchField ( - const fvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper + const Field<Type>& f ) : - Field<Type>(p.size()), + Field<Type>(f), 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<Type>::operator=(this->patchInternalField()); - } - this->map(ptf, mapper); -} + patchType_(word::null) +{} template<class Type> @@ -144,6 +136,31 @@ Foam::fvPatchField<Type>::fvPatchField } +template<class Type> +Foam::fvPatchField<Type>::fvPatchField +( + const fvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + Field<Type>(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<Type>::operator=(this->patchInternalField()); + } + this->map(ptf, mapper); +} + + template<class Type> Foam::fvPatchField<Type>::fvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index c87a5b1ee0996e00eff26448203188ab84f6edee..496524c76392588128b68f5b4046cd0e0ad2da5b 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -166,6 +166,14 @@ public: const DimensionedField<Type, volMesh>& ); + //- Construct from patch, internal field and value + fvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + 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 885c5b9de439fa3983f723c56d7734369a6248ad..9c15c3c575282f70a09db29cf6481c9afe529340 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