Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / translatingWallVelocity / translatingWallVelocityFvPatchVectorField.C
blobc60d0cc3fe05ef3ba6a06b3daedbcebf58d72158
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "translatingWallVelocityFvPatchVectorField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
33 Foam::translatingWallVelocityFvPatchVectorField::
34 translatingWallVelocityFvPatchVectorField
36     const fvPatch& p,
37     const DimensionedField<vector, volMesh>& iF
40     fixedValueFvPatchField<vector>(p, iF),
41     U_(vector::zero)
45 Foam::translatingWallVelocityFvPatchVectorField::
46 translatingWallVelocityFvPatchVectorField
48     const translatingWallVelocityFvPatchVectorField& ptf,
49     const fvPatch& p,
50     const DimensionedField<vector, volMesh>& iF,
51     const fvPatchFieldMapper& mapper
54     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
55     U_(ptf.U_)
59 Foam::translatingWallVelocityFvPatchVectorField::
60 translatingWallVelocityFvPatchVectorField
62     const fvPatch& p,
63     const DimensionedField<vector, volMesh>& iF,
64     const dictionary& dict
67     fixedValueFvPatchField<vector>(p, iF),
68     U_(dict.lookup("U"))
70     // Evaluate the wall velocity
71     updateCoeffs();
75 Foam::translatingWallVelocityFvPatchVectorField::
76 translatingWallVelocityFvPatchVectorField
78     const translatingWallVelocityFvPatchVectorField& twvpvf
81     fixedValueFvPatchField<vector>(twvpvf),
82     U_(twvpvf.U_)
86 Foam::translatingWallVelocityFvPatchVectorField::
87 translatingWallVelocityFvPatchVectorField
89     const translatingWallVelocityFvPatchVectorField& twvpvf,
90     const DimensionedField<vector, volMesh>& iF
93     fixedValueFvPatchField<vector>(twvpvf, iF),
94     U_(twvpvf.U_)
98 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
100 void Foam::translatingWallVelocityFvPatchVectorField::updateCoeffs()
102     if (updated())
103     {
104         return;
105     }
107     // Remove the component of U normal to the wall in case the wall is not flat
108     const vectorField n(patch().nf());
109     vectorField::operator=(U_ - n*(n & U_));
111     fixedValueFvPatchVectorField::updateCoeffs();
115 void Foam::translatingWallVelocityFvPatchVectorField::write(Ostream& os) const
117     fvPatchVectorField::write(os);
118     os.writeKeyword("U") << U_ << token::END_STATEMENT << nl;
119     writeEntry("value", os);
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 namespace Foam
127     makePatchTypeField
128     (
129         fvPatchVectorField,
130         translatingWallVelocityFvPatchVectorField
131     );
134 // ************************************************************************* //