energyRegionCoupledFvPatchScalarField: now derived from coupledFvPatchField

This commit is contained in:
Henry
2013-03-14 12:25:19 +00:00
parent a44b1c44ce
commit 2e40955557
2 changed files with 34 additions and 105 deletions

View File

@ -59,12 +59,13 @@ void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const
{ {
if (method_ == UNDEFINED) if (method_ == UNDEFINED)
{ {
if ( if
this->db().foundObject<compressible::turbulenceModel> (
( this->db().foundObject<compressible::turbulenceModel>
"turbulenceModel" (
) "turbulenceModel"
) )
)
{ {
method_ = FLUID; method_ = FLUID;
} }
@ -212,8 +213,7 @@ energyRegionCoupledFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
LduInterfaceField<scalar>(refCast<const lduInterface>(p)), coupledFvPatchField<scalar>(p, iF),
fvPatchScalarField(p, iF),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED), method_(UNDEFINED),
nbrThermoPtr_(NULL), nbrThermoPtr_(NULL),
@ -230,8 +230,7 @@ energyRegionCoupledFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
LduInterfaceField<scalar>(refCast<const lduInterface>(p)), coupledFvPatchField<scalar>(ptf, p, iF, mapper),
fvPatchScalarField(ptf, p, iF, mapper),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(ptf.method_), method_(ptf.method_),
nbrThermoPtr_(NULL), nbrThermoPtr_(NULL),
@ -247,8 +246,7 @@ energyRegionCoupledFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
LduInterfaceField<scalar>(refCast<const lduInterface>(p)), coupledFvPatchField<scalar>(p, iF, dict),
fvPatchScalarField(p, iF, dict),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED), method_(UNDEFINED),
nbrThermoPtr_(NULL), nbrThermoPtr_(NULL),
@ -287,8 +285,7 @@ energyRegionCoupledFvPatchScalarField
const energyRegionCoupledFvPatchScalarField& ptf const energyRegionCoupledFvPatchScalarField& ptf
) )
: :
LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), coupledFvPatchField<scalar>(ptf),
fvPatchScalarField(ptf),
regionCoupledPatch_(ptf.regionCoupledPatch_), regionCoupledPatch_(ptf.regionCoupledPatch_),
method_(ptf.method_), method_(ptf.method_),
nbrThermoPtr_(NULL), nbrThermoPtr_(NULL),
@ -303,8 +300,7 @@ energyRegionCoupledFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), coupledFvPatchField<scalar>(ptf, iF),
fvPatchScalarField(ptf, iF),
regionCoupledPatch_(ptf.regionCoupledPatch_), regionCoupledPatch_(ptf.regionCoupledPatch_),
method_(ptf.method_), method_(ptf.method_),
nbrThermoPtr_(NULL), nbrThermoPtr_(NULL),
@ -314,24 +310,19 @@ energyRegionCoupledFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
snGrad() const snGrad() const
{ {
return return
(*this - patchInternalField())*regionCoupledPatch_.patch().deltaCoeffs(); regionCoupledPatch_.patch().deltaCoeffs()
*(*this - patchInternalField());
} }
void Foam::energyRegionCoupledFvPatchScalarField::initEvaluate Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
( snGrad(const scalarField&) const
const Pstream::commsTypes
)
{ {
if (!updated()) return snGrad();
{
updateCoeffs();
}
} }
@ -365,42 +356,6 @@ void Foam::energyRegionCoupledFvPatchScalarField::evaluate
} }
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
valueInternalCoeffs
(
const tmp<scalarField>& w
) const
{
return scalar(pTraits<scalar>::one)*w;
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
valueBoundaryCoeffs
(
const tmp<scalarField>& w
) const
{
return scalar(pTraits<scalar>::one)*(1.0 - w);
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
gradientInternalCoeffs() const
{
return
-scalar(pTraits<scalar>::one)
*regionCoupledPatch_.patch().deltaCoeffs();
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
gradientBoundaryCoeffs() const
{
return -this->gradientInternalCoeffs();
}
Foam::tmp<Foam::Field<Foam::scalar> > Foam::tmp<Foam::Field<Foam::scalar> >
Foam::energyRegionCoupledFvPatchScalarField:: Foam::energyRegionCoupledFvPatchScalarField::
patchNeighbourField() const patchNeighbourField() const
@ -546,6 +501,7 @@ void Foam::energyRegionCoupledFvPatchScalarField::write(Ostream& os) const
this->writeEntry("value", os); this->writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam

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) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,22 +43,23 @@ SourceFiles
#include "fvPatchField.H" #include "fvPatchField.H"
#include "NamedEnum.H" #include "NamedEnum.H"
#include "basicThermo.H" #include "basicThermo.H"
#include "coupledFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class energyRegionCoupledFvPatchScalarField Declaration Class energyRegionCoupledFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class energyRegionCoupledFvPatchScalarField class energyRegionCoupledFvPatchScalarField
: :
public LduInterfaceField<scalar>, public coupledFvPatchField<scalar>
public fvPatchScalarField
{ {
public: public:
enum kappaMethodType enum kappaMethodType
@ -162,12 +163,6 @@ public:
const DimensionedField<scalar, volMesh>& const DimensionedField<scalar, volMesh>&
); );
//- Destructor
virtual ~energyRegionCoupledFvPatchScalarField()
{}
//- Construct and return a clone setting internal field reference //- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar> > clone virtual tmp<fvPatchField<scalar> > clone
( (
@ -181,17 +176,15 @@ public:
} }
//- Destructor
virtual ~energyRegionCoupledFvPatchScalarField()
{}
// Member functions // Member functions
// Access // Access
//- Return true if this patch field is coupled
virtual bool coupled() const
{
return true;
}
//- Method to obtain K //- Method to obtain K
word kappaMethod() const word kappaMethod() const
{ {
@ -207,11 +200,13 @@ public:
//- Return patch-normal gradient //- Return patch-normal gradient
virtual tmp<scalarField> snGrad() const; virtual tmp<scalarField> snGrad() const;
//- Initialise the evaluation of the patch field //- Return patch-normal gradient
virtual void initEvaluate // Note: the deltaCoeffs supplied are not used
virtual tmp<scalarField> snGrad
( (
const Pstream::commsTypes commsType const scalarField& deltaCoeffs
); ) const;
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
@ -219,28 +214,6 @@ public:
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
); );
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientBoundaryCoeffs() const;
// Coupled interface functionality // Coupled interface functionality