From 54b2d0b41c5bad9e1c272747c291d67fcd9cebfa Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Tue, 9 Feb 2016 18:43:48 +0000
Subject: [PATCH] movingWallVelocityFvPatchVectorField: Updated to obtain the
 velocity field from the dimensionedInteralField rather than by "lookup" from
 the database.

---
 .../movingWallVelocityFvPatchVectorField.C    | 39 ++++++++-----------
 .../movingWallVelocityFvPatchVectorField.H    | 17 +-------
 2 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
index 07c79444cb..46a7c7a90f 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,11 +24,10 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "movingWallVelocityFvPatchVectorField.H"
-#include "addToRunTimeSelectionTable.H"
 #include "volFields.H"
 #include "surfaceFields.H"
 #include "fvcMeshPhi.H"
-
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -39,38 +38,35 @@ movingWallVelocityFvPatchVectorField
     const DimensionedField<vector, volMesh>& iF
 )
 :
-    fixedValueFvPatchVectorField(p, iF),
-    UName_("U")
+    fixedValueFvPatchVectorField(p, iF)
 {}
 
 
 Foam::movingWallVelocityFvPatchVectorField::
 movingWallVelocityFvPatchVectorField
 (
-    const movingWallVelocityFvPatchVectorField& ptf,
     const fvPatch& p,
     const DimensionedField<vector, volMesh>& iF,
-    const fvPatchFieldMapper& mapper
+    const dictionary& dict
 )
 :
-    fixedValueFvPatchVectorField(ptf, p, iF, mapper),
-    UName_(ptf.UName_)
-{}
+    fixedValueFvPatchVectorField(p, iF)
+{
+    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
+}
 
 
 Foam::movingWallVelocityFvPatchVectorField::
 movingWallVelocityFvPatchVectorField
 (
+    const movingWallVelocityFvPatchVectorField& ptf,
     const fvPatch& p,
     const DimensionedField<vector, volMesh>& iF,
-    const dictionary& dict
+    const fvPatchFieldMapper& mapper
 )
 :
-    fixedValueFvPatchVectorField(p, iF),
-    UName_(dict.lookupOrDefault<word>("U", "U"))
-{
-    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
-}
+    fixedValueFvPatchVectorField(ptf, p, iF, mapper)
+{}
 
 
 Foam::movingWallVelocityFvPatchVectorField::
@@ -79,8 +75,7 @@ movingWallVelocityFvPatchVectorField
     const movingWallVelocityFvPatchVectorField& mwvpvf
 )
 :
-    fixedValueFvPatchVectorField(mwvpvf),
-    UName_(mwvpvf.UName_)
+    fixedValueFvPatchVectorField(mwvpvf)
 {}
 
 
@@ -91,8 +86,7 @@ movingWallVelocityFvPatchVectorField
     const DimensionedField<vector, volMesh>& iF
 )
 :
-    fixedValueFvPatchVectorField(mwvpvf, iF),
-    UName_(mwvpvf.UName_)
+    fixedValueFvPatchVectorField(mwvpvf, iF)
 {}
 
 
@@ -124,7 +118,9 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
 
         const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
 
-        const volVectorField& U = db().lookupObject<volVectorField>(UName_);
+        const volVectorField& U =
+            static_cast<const volVectorField&>(dimensionedInternalField());
+
         scalarField phip
         (
             p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
@@ -145,7 +141,6 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
 void Foam::movingWallVelocityFvPatchVectorField::write(Ostream& os) const
 {
     fvPatchVectorField::write(os);
-    writeEntryIfDifferent<word>(os, "U", "U", UName_);
     writeEntry("value", os);
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H
index be5b50e6f8..2885a7d586 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,21 +32,14 @@ Description
     moving walls.  In addition, it should also be applied to 'moving' walls
     for moving reference frame (MRF) calculations.
 
-
     \heading Patch usage
 
-    \table
-        Property     | Description             | Required    | Default value
-        U            | velociy field name      | no          | U
-    \endtable
-
     Example of the boundary condition specification:
     \verbatim
     myPatch
     {
         type            movingWallVelocity;
-        U               U;
-        value           uniform 0; // initial value
+        value           uniform (0 0 0);    // Initial value
     }
     \endverbatim
 
@@ -62,7 +55,6 @@ SourceFiles
 #ifndef movingWallVelocityFvPatchVectorField_H
 #define movingWallVelocityFvPatchVectorField_H
 
-#include "fvPatchFields.H"
 #include "fixedValueFvPatchFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -78,11 +70,6 @@ class movingWallVelocityFvPatchVectorField
 :
     public fixedValueFvPatchVectorField
 {
-    // Private data
-
-       //- Name of velocity field
-       word UName_;
-
 
 public:
 
-- 
GitLab