mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Updates, corrections, improvements and docs.
This commit is contained in:
@ -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_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of phi to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
@ -136,10 +167,7 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
virtual void operator=(const fvPatchField<vector>& pvf)
|
||||
{
|
||||
fvPatchField<vector>::operator=(pvf);
|
||||
}
|
||||
virtual void operator=(const fvPatchField<vector>& pvf);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,201 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pressureNormalInletOutletVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{
|
||||
refValue() = *this;
|
||||
refGrad() = vector::zero;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{
|
||||
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||
refValue() = *this;
|
||||
refGrad() = vector::zero;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(pivpvf),
|
||||
phiName_(pivpvf.phiName_),
|
||||
rhoName_(pivpvf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField& pivpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchVectorField(pivpvf, iF),
|
||||
phiName_(pivpvf.phiName_),
|
||||
rhoName_(pivpvf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
vectorField n = patch().nf();
|
||||
const Field<scalar>& magS = patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
refValue() = n*phip/magS;
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
refValue() = n*phip/(rhop*magS);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"pressureNormalInletOutletVelocityFvPatchVectorField::"
|
||||
"updateCoeffs()"
|
||||
) << "dimensions of phi are not correct"
|
||||
<< "\n on patch " << this->patch().name()
|
||||
<< " of field " << this->dimensionedInternalField().name()
|
||||
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
valueFraction() = 1.0 - pos(phip);
|
||||
|
||||
mixedFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void pressureNormalInletOutletVelocityFvPatchVectorField::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void pressureNormalInletOutletVelocityFvPatchVectorField::operator=
|
||||
(
|
||||
const fvPatchField<vector>& pvf
|
||||
)
|
||||
{
|
||||
fvPatchField<vector>::operator=
|
||||
(
|
||||
valueFraction()*(patch().nf()*(patch().nf() & pvf))
|
||||
+ (1 - valueFraction())*pvf
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,191 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Velocity inlet/outlet boundary condition for patches 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 a direction
|
||||
normal to the patch faces.
|
||||
|
||||
SourceFiles
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pressureNormalInletOutletVelocityFvPatchVectorField_H
|
||||
#define pressureNormalInletOutletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pressureNormalInletOutletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
:
|
||||
public mixedFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
word phiName_;
|
||||
word rhoName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("pressureNormalInletOutletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
// onto a new patch
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const pressureNormalInletOutletVelocityFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new pressureNormalInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 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_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
virtual void operator=(const fvPatchField<vector>& pvf);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -26,7 +26,10 @@ Class
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
Velocity inlet/outlet boundary condition in a rotating frame
|
||||
for patches 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 a direction normal to the patch faces.
|
||||
|
||||
SourceFiles
|
||||
rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
||||
|
||||
Reference in New Issue
Block a user