Commit ea270583 authored by henry's avatar henry
Browse files

Updates, corrections, improvements and docs.

parent d61b3024
......@@ -84,6 +84,7 @@ $(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
$(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C
$(derivedFvPatchFields)/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C
......
......@@ -74,20 +74,10 @@ fluxCorrectedVelocityFvPatchVectorField
)
:
zeroGradientFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho")
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
fvPatchVectorField::operator=(patchInternalField());
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("rho"))
{
dict.lookup("rho") >> rhoName_;
}
}
......@@ -118,10 +108,8 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate
zeroGradientFvPatchVectorField::evaluate();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
(
phiName_
);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
......
......@@ -26,7 +26,10 @@ Class
Foam::fluxCorrectedVelocityFvPatchVectorField
Description
Foam::fluxCorrectedVelocityFvPatchVectorField
Velocity outlet boundary condition for patches where the pressure is
specified. The outflow velocity is obtained by "zeroGradient" and then
corrected from the flux. If reverse flow is possible or expected use
the "pressureInletOutletVelocityFvPatchVectorField" BC instead.
SourceFiles
fluxCorrectedVelocityFvPatchVectorField.C
......
......@@ -158,6 +158,22 @@ void inletOutletFvPatchField<Type>::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void inletOutletFvPatchField<Type>::operator=
(
const fvPatchField<Type>& ptf
)
{
fvPatchField<Type>::operator=
(
this->valueFraction()*this->refValue()
+ (1 - this->valueFraction())*ptf
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -134,6 +134,11 @@ public:
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<Type>& pvf);
};
......
......@@ -45,6 +45,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField
)
:
mixedFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho"),
inletDir_(p.size())
{
refValue() = *this;
......@@ -63,6 +65,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField
)
:
mixedFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
inletDir_(ptf.inletDir_, mapper)
{}
......@@ -76,6 +80,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField
)
:
mixedFvPatchVectorField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
inletDir_("inletDirection", dict, p.size())
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
......@@ -92,6 +98,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField
)
:
mixedFvPatchVectorField(pivpvf),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_),
inletDir_(pivpvf.inletDir_)
{}
......@@ -104,6 +112,8 @@ pressureDirectedInletOutletVelocityFvPatchVectorField
)
:
mixedFvPatchVectorField(pivpvf, iF),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_),
inletDir_(pivpvf.inletDir_)
{}
......@@ -129,7 +139,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::rmap
mixedFvPatchVectorField::rmap(ptf, addr);
const pressureDirectedInletOutletVelocityFvPatchVectorField& tiptf =
refCast<const pressureDirectedInletOutletVelocityFvPatchVectorField>(ptf);
refCast<const pressureDirectedInletOutletVelocityFvPatchVectorField>
(ptf);
inletDir_.rmap(tiptf.inletDir_, addr);
}
......@@ -143,7 +154,7 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs()
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
......@@ -158,7 +169,7 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs()
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho");
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = inletDir_*phip/(rhop*ndmagS);
}
......@@ -185,11 +196,28 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::
write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void pressureDirectedInletOutletVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
fvPatchField<vector>::operator=
(
valueFraction()*(inletDir_*(inletDir_ & pvf))
+ (1 - valueFraction())*pvf
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
......
......@@ -26,7 +26,10 @@ Class
Foam::pressureDirectedInletOutletVelocityFvPatchVectorField
Description
Foam::pressureDirectedInletOutletVelocityFvPatchVectorField
Velocity inlet/outlet boundary condition for pressure boundary where the
pressure is specified. zero-gradient is applied for outflow (as defined
by the flux) and for inflow the velocity is obtained from the flux with
the specified `inletDirection'.
SourceFiles
pressureDirectedInletOutletVelocityFvPatchVectorField.C
......@@ -53,7 +56,9 @@ class pressureDirectedInletOutletVelocityFvPatchVectorField
public mixedFvPatchVectorField
{
// Private data
word phiName_;
word rhoName_;
vectorField inletDir_;
......@@ -133,9 +138,35 @@ public:
}
// Member functions
// Access
//- Return the name of rho
const word& rhoName() const
{
return rhoName_;
}
//- Return reference to the name of rho to allow adjustment
word& rhoName()
{
return rhoName_;
}
//- Return the name of phi
const word& phiName() const
{
return phiName_;
}
//- Return reference to the name of phi to allow adjustment
word& phiName()
{
return phiName_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
......@@ -157,6 +188,11 @@ public:
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<vector>& pvf);
};
......
......@@ -45,6 +45,8 @@ pressureDirectedInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho"),
inletDir_(p.size())
{}
......@@ -59,6 +61,8 @@ pressureDirectedInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
inletDir_(ptf.inletDir_, mapper)
{}
......@@ -72,6 +76,8 @@ pressureDirectedInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
inletDir_("inletDirection", dict, p.size())
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
......@@ -85,6 +91,8 @@ pressureDirectedInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(pivpvf),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_),
inletDir_(pivpvf.inletDir_)
{}
......@@ -97,6 +105,8 @@ pressureDirectedInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(pivpvf, iF),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_),
inletDir_(pivpvf.inletDir_)
{}
......@@ -135,8 +145,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
return;
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
......@@ -151,7 +161,7 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho");
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(inletDir_*phip/(rhop*ndmagS));
}
......@@ -174,11 +184,24 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void pressureDirectedInletVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
fvPatchField<vector>::operator=(inletDir_*(inletDir_ & pvf));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
......
......@@ -23,10 +23,14 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pressureDirectedInletVelocityFvPatchVectorField
Foam::pressureDirectedInletVelocityFvPatchVectorField
Description
Foam::pressureDirectedInletOutletVelocityFvPatchVectorField
Velocity inlet boundary condition for patches where the pressure is
specified. The inflow velocity is obtained from the flux with the
specified "inletDirection" direction. If reverse flow is possible or
expected use the "pressureDirectedInletOutletVelocityFvPatchVectorField"
BC instead.
SourceFiles
pressureDirectedInletVelocityFvPatchVectorField.C
......@@ -53,7 +57,9 @@ class pressureDirectedInletVelocityFvPatchVectorField
public fixedValueFvPatchVectorField
{
// Private data
word phiName_;
word rhoName_;
vectorField inletDir_;
......@@ -130,9 +136,35 @@ public:
}
// Member functions
// Access
//- Return the name of rho
const word& rhoName() const
{
return rhoName_;
}
//- Return reference to the name of rho to allow adjustment
word& rhoName()
{
return rhoName_;
}
//- Return the name of phi
const word& phiName() const
{
return phiName_;
}
//- Return reference to the name of phi to allow adjustment
word& phiName()
{
return phiName_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
......@@ -154,6 +186,11 @@ public:
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<vector>& pvf);
};
......
......@@ -26,7 +26,10 @@ Class
Foam::pressureInletOutletVelocityFvPatchVectorField
Description
Foam::pressureInletOutletVelocityFvPatchVectorField
Velocity inlet/outlet boundary condition patches for where the pressure is
specified. zero-gradient is applied for outflow (as defined by the flux)
and for inflow the velocity is obtained from the patch-face normal
component of the internal-cell value.
SourceFiles
pressureInletOutletVelocityFvPatchVectorField.C
......
......@@ -108,6 +108,17 @@ void pressureInletUniformVelocityFvPatchVectorField::updateCoeffs()
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void pressureInletUniformVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
operator==(patch().nf()*sum(patch().Sf() & pvf)/sum(patch().magSf()));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
......
......@@ -26,7 +26,9 @@ Class
Foam::pressureInletUniformVelocityFvPatchVectorField
Description
Foam::pressureInletUniformVelocityFvPatchVectorField
Velocity inlet boundary condition for patches where the pressure is
specified. The uniform inflow velocity is obtained by averaging the flux
over the patch and apply it in the direction normal to the patch faces.
SourceFiles
pressureInletUniformVelocityFvPatchVectorField.C
......@@ -124,6 +126,11 @@ public:
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// Member operators
virtual void operator=(const fvPatchField<vector>& pvf);
};
......
......@@ -70,20 +70,10 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho")
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("rho"))
{
dict.lookup("rho") >> rhoName_;
}
}
......@@ -164,6 +154,17 @@ void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void pressureInletVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
fvPatchField<vector>::operator=(patch().nf()*(patch().nf() & pvf));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
......
......@@ -26,7 +26,10 @@ Class
Foam::pressureInletVelocityFvPatchVectorField
Description
Foam::pressureInletVelocityFvPatchVectorField
Velocity inlet boundary condition for patches where the pressure is
specified. The inflow velocity is obtained from the flux with a direction
normal to the patch faces. If reverse flow is possible or expected use
the "pressureInletOutletVelocityFvPatchVectorField" BC instead.
SourceFiles
pressureInletVelocityFvPatchVectorField.C
......@@ -57,6 +60,7 @@ class pressureInletVelocityFvPatchVectorField
word phiName_;
word rhoName_;
public:
//- Runtime type information
......@@ -127,6 +131,33 @@ public:
// Member functions
// Access
//- Return the name of rho
const word& rhoName() const
{
return rhoName_;
}
//- Return reference to the name of rho to allow adjustment
word& rhoName()
{
return rhoName_;
}
//- Return the name of phi
const word& phiName() const
{
return phiName_;