movingWallVelocityFvPatchVectorField: Updated to obtain the velocity field from the dimensionedInteralField

rather than by "lookup" from the database.
This commit is contained in:
Henry Weller
2016-02-09 18:43:48 +00:00
parent ca679a8634
commit 905eaa01e6
2 changed files with 24 additions and 42 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,11 +24,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "movingWallVelocityFvPatchVectorField.H" #include "movingWallVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "fvcMeshPhi.H" #include "fvcMeshPhi.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -39,22 +38,7 @@ movingWallVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF)
UName_("U")
{}
Foam::movingWallVelocityFvPatchVectorField::
movingWallVelocityFvPatchVectorField
(
const movingWallVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
UName_(ptf.UName_)
{} {}
@ -66,21 +50,32 @@ movingWallVelocityFvPatchVectorField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF)
UName_(dict.lookupOrDefault<word>("U", "U"))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
} }
Foam::movingWallVelocityFvPatchVectorField::
movingWallVelocityFvPatchVectorField
(
const movingWallVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
{}
Foam::movingWallVelocityFvPatchVectorField:: Foam::movingWallVelocityFvPatchVectorField::
movingWallVelocityFvPatchVectorField movingWallVelocityFvPatchVectorField
( (
const movingWallVelocityFvPatchVectorField& mwvpvf const movingWallVelocityFvPatchVectorField& mwvpvf
) )
: :
fixedValueFvPatchVectorField(mwvpvf), fixedValueFvPatchVectorField(mwvpvf)
UName_(mwvpvf.UName_)
{} {}
@ -91,8 +86,7 @@ movingWallVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(mwvpvf, iF), fixedValueFvPatchVectorField(mwvpvf, iF)
UName_(mwvpvf.UName_)
{} {}
@ -124,7 +118,9 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
const vectorField Up((pp.faceCentres() - oldFc)/deltaT); const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
const volVectorField& U = db().lookupObject<volVectorField>(UName_); const volVectorField& U =
static_cast<const volVectorField&>(dimensionedInternalField());
scalarField phip scalarField phip
( (
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)) p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
@ -145,7 +141,6 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
void Foam::movingWallVelocityFvPatchVectorField::write(Ostream& os) const void Foam::movingWallVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,21 +32,14 @@ Description
moving walls. In addition, it should also be applied to 'moving' walls moving walls. In addition, it should also be applied to 'moving' walls
for moving reference frame (MRF) calculations. for moving reference frame (MRF) calculations.
\heading Patch usage \heading Patch usage
\table
Property | Description | Required | Default value
U | velociy field name | no | U
\endtable
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
myPatch myPatch
{ {
type movingWallVelocity; type movingWallVelocity;
U U; value uniform (0 0 0); // Initial value
value uniform 0; // initial value
} }
\endverbatim \endverbatim
@ -62,7 +55,6 @@ SourceFiles
#ifndef movingWallVelocityFvPatchVectorField_H #ifndef movingWallVelocityFvPatchVectorField_H
#define movingWallVelocityFvPatchVectorField_H #define movingWallVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,11 +70,6 @@ class movingWallVelocityFvPatchVectorField
: :
public fixedValueFvPatchVectorField public fixedValueFvPatchVectorField
{ {
// Private data
//- Name of velocity field
word UName_;
public: public: