New BC for translating walls.
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / translatingWallVelocity / translatingWallVelocityFvPatchVectorField.C
blobef3fb96aa148e0697c536e71ce49178248a6865a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "translatingWallVelocityFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 translatingWallVelocityFvPatchVectorField::
40 translatingWallVelocityFvPatchVectorField
42     const fvPatch& p,
43     const DimensionedField<vector, volMesh>& iF
46     fixedValueFvPatchField<vector>(p, iF),
47     U_(vector::zero)
51 translatingWallVelocityFvPatchVectorField::
52 translatingWallVelocityFvPatchVectorField
54     const translatingWallVelocityFvPatchVectorField& ptf,
55     const fvPatch& p,
56     const DimensionedField<vector, volMesh>& iF,
57     const fvPatchFieldMapper& mapper
60     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
61     U_(ptf.U_)
65 translatingWallVelocityFvPatchVectorField::
66 translatingWallVelocityFvPatchVectorField
68     const fvPatch& p,
69     const DimensionedField<vector, volMesh>& iF,
70     const dictionary& dict
73     fixedValueFvPatchField<vector>(p, iF),
74     U_(dict.lookup("U"))
76     // Evaluate the wall velocity
77     updateCoeffs();
81 translatingWallVelocityFvPatchVectorField::
82 translatingWallVelocityFvPatchVectorField
84     const translatingWallVelocityFvPatchVectorField& twvpvf
87     fixedValueFvPatchField<vector>(twvpvf),
88     U_(twvpvf.U_)
92 translatingWallVelocityFvPatchVectorField::
93 translatingWallVelocityFvPatchVectorField
95     const translatingWallVelocityFvPatchVectorField& twvpvf,
96     const DimensionedField<vector, volMesh>& iF
99     fixedValueFvPatchField<vector>(twvpvf, iF),
100     U_(twvpvf.U_)
104 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
106 void translatingWallVelocityFvPatchVectorField::updateCoeffs()
108     if (updated())
109     {
110         return;
111     }
113     // Remove the component of U normal to the wall in case the wall is not flat
114     vectorField n = patch().nf();
115     vectorField::operator=(U_ - n*(n & U_));
117     fixedValueFvPatchVectorField::updateCoeffs();
121 void translatingWallVelocityFvPatchVectorField::write(Ostream& os) const
123     fvPatchVectorField::write(os);
124     os.writeKeyword("U") << U_ << token::END_STATEMENT << nl;
125     writeEntry("value", os);
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 makePatchTypeField
133     fvPatchVectorField,
134     translatingWallVelocityFvPatchVectorField
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // ************************************************************************* //