1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "movingWallVelocityFvPatchVectorField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
30 #include "fvcMeshPhi.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
42 const DimensionedField<vector, volMesh>& iF
45 fixedValueFvPatchVectorField(p, iF)
49 movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
51 const movingWallVelocityFvPatchVectorField& ptf,
53 const DimensionedField<vector, volMesh>& iF,
54 const fvPatchFieldMapper& mapper
57 fixedValueFvPatchVectorField(ptf, p, iF, mapper)
61 movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
64 const DimensionedField<vector, volMesh>& iF,
65 const dictionary& dict
68 fixedValueFvPatchVectorField(p, iF)
70 fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
74 movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
76 const movingWallVelocityFvPatchVectorField& pivpvf
79 fixedValueFvPatchVectorField(pivpvf)
83 movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
85 const movingWallVelocityFvPatchVectorField& pivpvf,
86 const DimensionedField<vector, volMesh>& iF
89 fixedValueFvPatchVectorField(pivpvf, iF)
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 void movingWallVelocityFvPatchVectorField::updateCoeffs()
102 const fvMesh& mesh = dimensionedInternalField().mesh();
106 const fvPatch& p = patch();
107 const polyPatch& pp = p.patch();
108 const pointField& oldPoints = mesh.oldPoints();
110 vectorField oldFc(pp.size());
114 oldFc[i] = pp[i].centre(oldPoints);
117 // Get wall-parallel mesh motion velocity from geometry
119 (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
121 const volVectorField& U =
122 mesh.lookupObject<volVectorField>
124 dimensionedInternalField().name()
128 p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
130 vectorField n = p.nf();
131 const scalarField& magSf = p.magSf();
132 scalarField Un = phip/(magSf + VSMALL);
134 // Adjust for surface-normal mesh motion flux
135 vectorField::operator=(Up + n*(Un - (n & Up)));
138 fixedValueFvPatchVectorField::updateCoeffs();
142 void movingWallVelocityFvPatchVectorField::write(Ostream& os) const
144 fvPatchVectorField::write(os);
145 writeEntry("value", os);
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 movingWallVelocityFvPatchVectorField
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 } // End namespace Foam
161 // ************************************************************************* //