fanFvPatchField, freestreamPressureFvPatchScalarField: added write function

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1942
This commit is contained in:
Henry Weller
2015-12-08 11:57:37 +00:00
parent 80a0fbcb79
commit f89d44292e
6 changed files with 57 additions and 20 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-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,23 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
uniformJumpFvPatchField<Type>(p, iF) uniformJumpFvPatchField<Type>(p, iF),
phiName_("phi"),
rhoName_("rho")
{}
template<class Type>
Foam::fanFvPatchField<Type>::fanFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
uniformJumpFvPatchField<Type>(p, iF, dict),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{} {}
@ -59,19 +75,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
uniformJumpFvPatchField<Type>(ptf, p, iF, mapper) uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
{} phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
template<class Type>
Foam::fanFvPatchField<Type>::fanFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
uniformJumpFvPatchField<Type>(p, iF, dict)
{} {}
@ -81,7 +87,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const fanFvPatchField<Type>& ptf const fanFvPatchField<Type>& ptf
) )
: :
uniformJumpFvPatchField<Type>(ptf) uniformJumpFvPatchField<Type>(ptf),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{} {}
@ -92,7 +100,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
uniformJumpFvPatchField<Type>(ptf, iF) uniformJumpFvPatchField<Type>(ptf, iF),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{} {}
@ -113,4 +123,13 @@ void Foam::fanFvPatchField<Type>::updateCoeffs()
} }
template<class Type>
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
{
uniformJumpFvPatchField<Type>::write(os);
this->template writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
this->template writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -187,6 +187,9 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
}; };

View File

@ -78,7 +78,7 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
: :
uniformJumpFvPatchField<scalar>(p, iF), uniformJumpFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none")) rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{ {
if (this->cyclicPatch().owner()) if (this->cyclicPatch().owner())
{ {

View File

@ -42,7 +42,7 @@ freestreamPressureFvPatchScalarField
zeroGradientFvPatchScalarField(p, iF), zeroGradientFvPatchScalarField(p, iF),
UName_("U"), UName_("U"),
phiName_("phi"), phiName_("phi"),
rhoName_("none") rhoName_("rho")
{} {}
@ -57,7 +57,7 @@ freestreamPressureFvPatchScalarField
zeroGradientFvPatchScalarField(p, iF, dict), zeroGradientFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")), UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none")) rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{} {}
@ -153,6 +153,16 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
} }
void Foam::freestreamPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam

View File

@ -167,6 +167,10 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
}; };

View File

@ -243,6 +243,7 @@ void Foam::syringePressureFvPatchScalarField::write(Ostream& os) const
os.writeKeyword("psI") << psI_ << token::END_STATEMENT << nl; os.writeKeyword("psI") << psI_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psi_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psi_ << token::END_STATEMENT << nl;
os.writeKeyword("ams") << ams_ << token::END_STATEMENT << nl; os.writeKeyword("ams") << ams_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntry("value", os); writeEntry("value", os);
} }