From 2e40955557972c6c52e469b5ffbd37d98faef6c0 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Thu, 14 Mar 2013 12:25:19 +0000 Subject: [PATCH] energyRegionCoupledFvPatchScalarField: now derived from coupledFvPatchField --- .../energyRegionCoupledFvPatchScalarField.C | 80 +++++-------------- .../energyRegionCoupledFvPatchScalarField.H | 59 ++++---------- 2 files changed, 34 insertions(+), 105 deletions(-) diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C index 83fe6ae2c44..d09ec8ee554 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -59,12 +59,13 @@ void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const { if (method_ == UNDEFINED) { - if ( - this->db().foundObject<compressible::turbulenceModel> - ( - "turbulenceModel" - ) - ) + if + ( + this->db().foundObject<compressible::turbulenceModel> + ( + "turbulenceModel" + ) + ) { method_ = FLUID; } @@ -212,8 +213,7 @@ energyRegionCoupledFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - LduInterfaceField<scalar>(refCast<const lduInterface>(p)), - fvPatchScalarField(p, iF), + coupledFvPatchField<scalar>(p, iF), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), method_(UNDEFINED), nbrThermoPtr_(NULL), @@ -230,8 +230,7 @@ energyRegionCoupledFvPatchScalarField const fvPatchFieldMapper& mapper ) : - LduInterfaceField<scalar>(refCast<const lduInterface>(p)), - fvPatchScalarField(ptf, p, iF, mapper), + coupledFvPatchField<scalar>(ptf, p, iF, mapper), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), method_(ptf.method_), nbrThermoPtr_(NULL), @@ -247,8 +246,7 @@ energyRegionCoupledFvPatchScalarField const dictionary& dict ) : - LduInterfaceField<scalar>(refCast<const lduInterface>(p)), - fvPatchScalarField(p, iF, dict), + coupledFvPatchField<scalar>(p, iF, dict), regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)), method_(UNDEFINED), nbrThermoPtr_(NULL), @@ -287,8 +285,7 @@ energyRegionCoupledFvPatchScalarField const energyRegionCoupledFvPatchScalarField& ptf ) : - LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), - fvPatchScalarField(ptf), + coupledFvPatchField<scalar>(ptf), regionCoupledPatch_(ptf.regionCoupledPatch_), method_(ptf.method_), nbrThermoPtr_(NULL), @@ -303,8 +300,7 @@ energyRegionCoupledFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())), - fvPatchScalarField(ptf, iF), + coupledFvPatchField<scalar>(ptf, iF), regionCoupledPatch_(ptf.regionCoupledPatch_), method_(ptf.method_), nbrThermoPtr_(NULL), @@ -314,24 +310,19 @@ energyRegionCoupledFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: snGrad() const { return - (*this - patchInternalField())*regionCoupledPatch_.patch().deltaCoeffs(); + regionCoupledPatch_.patch().deltaCoeffs() + *(*this - patchInternalField()); } -void Foam::energyRegionCoupledFvPatchScalarField::initEvaluate -( - const Pstream::commsTypes -) +Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField:: +snGrad(const scalarField&) const { - if (!updated()) - { - updateCoeffs(); - } + return snGrad(); } @@ -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::energyRegionCoupledFvPatchScalarField:: patchNeighbourField() const @@ -546,6 +501,7 @@ void Foam::energyRegionCoupledFvPatchScalarField::write(Ostream& os) const this->writeEntry("value", os); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H index 7b0b7df39c3..7103f1f1f12 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,22 +43,23 @@ SourceFiles #include "fvPatchField.H" #include "NamedEnum.H" #include "basicThermo.H" +#include "coupledFvPatchField.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - /*---------------------------------------------------------------------------*\ Class energyRegionCoupledFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class energyRegionCoupledFvPatchScalarField : - public LduInterfaceField<scalar>, - public fvPatchScalarField + public coupledFvPatchField<scalar> { + public: enum kappaMethodType @@ -162,12 +163,6 @@ public: const DimensionedField<scalar, volMesh>& ); - - //- Destructor - virtual ~energyRegionCoupledFvPatchScalarField() - {} - - //- Construct and return a clone setting internal field reference virtual tmp<fvPatchField<scalar> > clone ( @@ -181,16 +176,14 @@ public: } - // Member functions + //- Destructor + virtual ~energyRegionCoupledFvPatchScalarField() + {} - // Access + // Member functions - //- Return true if this patch field is coupled - virtual bool coupled() const - { - return true; - } + // Access //- Method to obtain K word kappaMethod() const @@ -207,11 +200,13 @@ public: //- Return patch-normal gradient virtual tmp<scalarField> snGrad() const; - //- Initialise the evaluation of the patch field - virtual void initEvaluate + //- Return patch-normal gradient + // Note: the deltaCoeffs supplied are not used + virtual tmp<scalarField> snGrad ( - const Pstream::commsTypes commsType - ); + const scalarField& deltaCoeffs + ) const; + //- Evaluate the patch field virtual void evaluate @@ -219,28 +214,6 @@ public: 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 -- GitLab