1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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 "movingWallSlipFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
31 #include "fvcMeshPhi.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 movingWallSlipFvPatchVectorField::movingWallSlipFvPatchVectorField
43 const DimensionedField<vector, volMesh>& iF
46 basicSymmetryFvPatchVectorField(p, iF)
50 movingWallSlipFvPatchVectorField::movingWallSlipFvPatchVectorField
52 const movingWallSlipFvPatchVectorField& ptf,
54 const DimensionedField<vector, volMesh>& iF,
55 const fvPatchFieldMapper& mapper
58 basicSymmetryFvPatchVectorField(ptf, p, iF, mapper)
62 movingWallSlipFvPatchVectorField::movingWallSlipFvPatchVectorField
65 const DimensionedField<vector, volMesh>& iF,
66 const dictionary& dict
69 basicSymmetryFvPatchVectorField(p, iF)
71 fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
75 movingWallSlipFvPatchVectorField::movingWallSlipFvPatchVectorField
77 const movingWallSlipFvPatchVectorField& pivpvf
80 basicSymmetryFvPatchVectorField(pivpvf)
84 movingWallSlipFvPatchVectorField::movingWallSlipFvPatchVectorField
86 const movingWallSlipFvPatchVectorField& pivpvf,
87 const DimensionedField<vector, volMesh>& iF
90 basicSymmetryFvPatchVectorField(pivpvf, iF)
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 void movingWallSlipFvPatchVectorField::evaluate()
98 const fvPatch& p = patch();
99 const polyPatch& pp = p.patch();
100 const fvMesh& mesh = dimensionedInternalField().mesh();
102 const pointField& oldAllPoints = mesh.oldAllPoints();
104 vectorField oldFc(pp.size());
108 oldFc[i] = pp[i].centre(oldAllPoints);
111 vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
113 const volVectorField& U =
114 db().lookupObject<volVectorField>(dimensionedInternalField().name());
116 p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
118 vectorField nHat = p.nf();
119 const scalarField& magSf = p.magSf();
120 scalarField Un = phip/(magSf + VSMALL);
122 vectorField tangentialPart =
124 this->patchInternalField()
125 + transform(I - 2.0*sqr(nHat), this->patchInternalField())
128 vectorField normalPart = Up + nHat*(Un - (nHat & Up));
130 vectorField::operator=(normalPart + tangentialPart);
134 void movingWallSlipFvPatchVectorField::write(Ostream& os) const
136 fvPatchVectorField::write(os);
137 writeEntry("value", os);
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 movingWallSlipFvPatchVectorField
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // ************************************************************************* //