pressureInletOutletParSlipVelocityFvPatchVectorField: Removed UName option and rationalised operator=

This commit is contained in:
Henry
2013-11-26 10:17:18 +00:00
parent e3e04be28a
commit cc5a7c3d9d
2 changed files with 14 additions and 31 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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,8 +41,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField
: :
mixedFvPatchVectorField(p, iF), mixedFvPatchVectorField(p, iF),
phiName_("phi"), phiName_("phi"),
rhoName_("rho"), rhoName_("rho")
UName_("U")
{ {
refValue() = *this; refValue() = *this;
refGrad() = vector::zero; refGrad() = vector::zero;
@ -61,8 +60,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField
: :
mixedFvPatchVectorField(ptf, p, iF, mapper), mixedFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_), rhoName_(ptf.rhoName_)
UName_(ptf.UName_)
{} {}
@ -76,8 +74,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField
: :
mixedFvPatchVectorField(p, iF), mixedFvPatchVectorField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")), rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
UName_(dict.lookupOrDefault<word>("U", "U"))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
refValue() = *this; refValue() = *this;
@ -94,8 +91,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField
: :
mixedFvPatchVectorField(pivpvf), mixedFvPatchVectorField(pivpvf),
phiName_(pivpvf.phiName_), phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_), rhoName_(pivpvf.rhoName_)
UName_(pivpvf.UName_)
{} {}
@ -108,8 +104,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField
: :
mixedFvPatchVectorField(pivpvf, iF), mixedFvPatchVectorField(pivpvf, iF),
phiName_(pivpvf.phiName_), phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_), rhoName_(pivpvf.rhoName_)
UName_(pivpvf.UName_)
{} {}
@ -122,8 +117,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const label patchI = patch().index();
const surfaceScalarField& phi = const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_); db().lookupObject<surfaceScalarField>(phiName_);
@ -131,23 +124,22 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
const Field<scalar>& magS = patch().magSf(); const Field<scalar>& magSf = patch().magSf();
const volVectorField& U = db().lookupObject<volVectorField>(UName_); // Get the tangential component from the internalField (zero-gradient)
vectorField Ut(patchInternalField());
vectorField Uc(U.boundaryField()[patchI].patchInternalField()); Ut -= n()*(Ut & n());
Uc -= n()*(Uc & n());
if (phi.dimensions() == dimVelocity*dimArea) if (phi.dimensions() == dimVelocity*dimArea)
{ {
refValue() = Uc + n*phip/magS; refValue() = Ut + n*phip/magSf;
} }
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
const fvPatchField<scalar>& rhop = const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = Uc + n*phip/(rhop*magS); refValue() = Ut + n*phip/(rhop*magSf);
} }
else else
{ {
@ -176,7 +168,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntry("value", os); writeEntry("value", os);
} }
@ -188,11 +179,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::operator=
const fvPatchField<vector>& pvf const fvPatchField<vector>& pvf
) )
{ {
fvPatchField<vector>::operator= fvPatchField<vector>::operator=(pvf);
(
valueFraction()*(patch().nf()*(patch().nf() & pvf))
+ (1 - valueFraction())*pvf
);
} }

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,6 @@ Description
Property | Description | Required | Default value Property | Description | Required | Default value
phi | flux field name | no | phi phi | flux field name | no | phi
rho | density field name | no | rho rho | density field name | no | rho
U | velocity field name | no | U
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -95,9 +94,6 @@ class pressureInletOutletParSlipVelocityFvPatchVectorField
//- Density field name //- Density field name
word rhoName_; word rhoName_;
//- Velocity field name
word UName_;
public: public: