diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C index 895f340479..4d08364389 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,15 +25,10 @@ License #include "coupledFvPatchField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const fvPatch& p, const DimensionedField& iF @@ -45,7 +40,7 @@ coupledFvPatchField::coupledFvPatchField template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const fvPatch& p, const DimensionedField& iF, @@ -58,7 +53,7 @@ coupledFvPatchField::coupledFvPatchField template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const coupledFvPatchField& ptf, const fvPatch& p, @@ -72,7 +67,7 @@ coupledFvPatchField::coupledFvPatchField template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const fvPatch& p, const DimensionedField& iF, @@ -85,7 +80,7 @@ coupledFvPatchField::coupledFvPatchField template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const coupledFvPatchField& ptf ) @@ -96,7 +91,7 @@ coupledFvPatchField::coupledFvPatchField template -coupledFvPatchField::coupledFvPatchField +Foam::coupledFvPatchField::coupledFvPatchField ( const coupledFvPatchField& ptf, const DimensionedField& iF @@ -110,16 +105,29 @@ coupledFvPatchField::coupledFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -tmp > coupledFvPatchField::snGrad() const +Foam::tmp > Foam::coupledFvPatchField::snGrad() const { + notImplemented("coupledFvPatchField::snGrad()"); return - (this->patchNeighbourField() - this->patchInternalField()) - *this->patch().deltaCoeffs(); + this->patch().deltaCoeffs() + *(this->patchNeighbourField() - this->patchInternalField()); } template -void coupledFvPatchField::initEvaluate(const Pstream::commsTypes) +Foam::tmp > Foam::coupledFvPatchField::snGrad +( + const scalarField& deltaCoeffs +) const +{ + return + deltaCoeffs + *(this->patchNeighbourField() - this->patchInternalField()); +} + + +template +void Foam::coupledFvPatchField::initEvaluate(const Pstream::commsTypes) { if (!this->updated()) { @@ -129,7 +137,7 @@ void coupledFvPatchField::initEvaluate(const Pstream::commsTypes) template -void coupledFvPatchField::evaluate(const Pstream::commsTypes) +void Foam::coupledFvPatchField::evaluate(const Pstream::commsTypes) { if (!this->updated()) { @@ -147,7 +155,8 @@ void coupledFvPatchField::evaluate(const Pstream::commsTypes) template -tmp > coupledFvPatchField::valueInternalCoeffs +Foam::tmp > +Foam::coupledFvPatchField::valueInternalCoeffs ( const tmp& w ) const @@ -155,8 +164,10 @@ tmp > coupledFvPatchField::valueInternalCoeffs return Type(pTraits::one)*w; } + template -tmp > coupledFvPatchField::valueBoundaryCoeffs +Foam::tmp > +Foam::coupledFvPatchField::valueBoundaryCoeffs ( const tmp& w ) const @@ -164,30 +175,53 @@ tmp > coupledFvPatchField::valueBoundaryCoeffs return Type(pTraits::one)*(1.0 - w); } + template -tmp > coupledFvPatchField::gradientInternalCoeffs() const +Foam::tmp > +Foam::coupledFvPatchField::gradientInternalCoeffs +( + const scalarField& deltaCoeffs +) const { + return -Type(pTraits::one)*deltaCoeffs; +} + + +template +Foam::tmp > +Foam::coupledFvPatchField::gradientInternalCoeffs() const +{ + notImplemented("coupledFvPatchField::gradientInternalCoeffs()"); return -Type(pTraits::one)*this->patch().deltaCoeffs(); } template -tmp > coupledFvPatchField::gradientBoundaryCoeffs() const +Foam::tmp > +Foam::coupledFvPatchField::gradientBoundaryCoeffs +( + const scalarField& deltaCoeffs +) const { + return -this->gradientInternalCoeffs(deltaCoeffs); +} + + +template +Foam::tmp > +Foam::coupledFvPatchField::gradientBoundaryCoeffs() const +{ + notImplemented("coupledFvPatchField::gradientBoundaryCoeffs()"); return -this->gradientInternalCoeffs(); } template -void coupledFvPatchField::write(Ostream& os) const +void Foam::coupledFvPatchField::write(Ostream& os) const { fvPatchField::write(os); this->writeEntry("value", os); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H index 1f2dcbfb61..aa6610709f 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,6 +138,12 @@ public: // Evaluation functions + //- Return patch-normal gradient + virtual tmp > snGrad + ( + const scalarField& deltaCoeffs + ) const; + //- Return patch-normal gradient virtual tmp > snGrad() const; @@ -167,10 +173,24 @@ public: const tmp& ) const; + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientInternalCoeffs + ( + const scalarField& deltaCoeffs + ) const; + //- Return the matrix diagonal coefficients corresponding to the // evaluation of the gradient of this patchField virtual tmp > gradientInternalCoeffs() const; + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientBoundaryCoeffs + ( + const scalarField& deltaCoeffs + ) const; + //- Return the matrix source coefficients corresponding to the // evaluation of the gradient of this patchField virtual tmp > gradientBoundaryCoeffs() const; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index c9fb2563c1..e670468b69 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,15 +28,10 @@ License #include "demandDrivenData.H" #include "transformField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF @@ -54,7 +49,7 @@ processorFvPatchField::processorFvPatchField template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF, @@ -74,7 +69,7 @@ processorFvPatchField::processorFvPatchField // Construct by mapping given processorFvPatchField template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf, const fvPatch& p, @@ -119,7 +114,7 @@ processorFvPatchField::processorFvPatchField template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF, @@ -157,7 +152,7 @@ processorFvPatchField::processorFvPatchField template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf ) @@ -182,7 +177,7 @@ processorFvPatchField::processorFvPatchField template -processorFvPatchField::processorFvPatchField +Foam::processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf, const DimensionedField& iF @@ -209,14 +204,15 @@ processorFvPatchField::processorFvPatchField // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template -processorFvPatchField::~processorFvPatchField() +Foam::processorFvPatchField::~processorFvPatchField() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -tmp > processorFvPatchField::patchNeighbourField() const +Foam::tmp > +Foam::processorFvPatchField::patchNeighbourField() const { if (debug && !this->ready()) { @@ -230,7 +226,7 @@ tmp > processorFvPatchField::patchNeighbourField() const template -void processorFvPatchField::initEvaluate +void Foam::processorFvPatchField::initEvaluate ( const Pstream::commsTypes commsType ) @@ -272,7 +268,7 @@ void processorFvPatchField::initEvaluate template -void processorFvPatchField::evaluate +void Foam::processorFvPatchField::evaluate ( const Pstream::commsTypes commsType ) @@ -308,14 +304,18 @@ void processorFvPatchField::evaluate template -tmp > processorFvPatchField::snGrad() const +Foam::tmp > +Foam::processorFvPatchField::snGrad +( + const scalarField& deltaCoeffs +) const { - return this->patch().deltaCoeffs()*(*this - this->patchInternalField()); + return deltaCoeffs*(*this - this->patchInternalField()); } template -void processorFvPatchField::initInterfaceMatrixUpdate +void Foam::processorFvPatchField::initInterfaceMatrixUpdate ( scalarField&, const scalarField& psiInternal, @@ -371,7 +371,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate template -void processorFvPatchField::updateInterfaceMatrix +void Foam::processorFvPatchField::updateInterfaceMatrix ( scalarField& result, const scalarField&, @@ -435,7 +435,7 @@ void processorFvPatchField::updateInterfaceMatrix template -void processorFvPatchField::initInterfaceMatrixUpdate +void Foam::processorFvPatchField::initInterfaceMatrixUpdate ( Field&, const Field& psiInternal, @@ -490,7 +490,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate template -void processorFvPatchField::updateInterfaceMatrix +void Foam::processorFvPatchField::updateInterfaceMatrix ( Field& result, const Field&, @@ -553,7 +553,7 @@ void processorFvPatchField::updateInterfaceMatrix template -bool processorFvPatchField::ready() const +bool Foam::processorFvPatchField::ready() const { if ( @@ -587,8 +587,4 @@ bool processorFvPatchField::ready() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index a913aaf606..1e7186efa1 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -198,7 +198,10 @@ public: virtual void evaluate(const Pstream::commsTypes commsType); //- Return patch-normal gradient - virtual tmp > snGrad() const; + virtual tmp > snGrad + ( + const scalarField& deltaCoeffs + ) const; //- Is all data available virtual bool ready() const; diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 975e11ff2b..5635b348be 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -173,15 +173,23 @@ void Foam::fvPatchField::check(const fvPatchField& ptf) const } -// Return gradient at boundary template -Foam::tmp > Foam::fvPatchField::snGrad() const +Foam::tmp > Foam::fvPatchField::snGrad +( + const scalarField& deltaCoeffs +) const { - return (*this - patchInternalField())*patch_.deltaCoeffs(); + return deltaCoeffs*(*this - patchInternalField()); +} + + +template +Foam::tmp > Foam::fvPatchField::snGrad() const +{ + return this->snGrad(patch_.deltaCoeffs()); } -// Return internal field next to patch as patch field template Foam::tmp > Foam::fvPatchField::patchInternalField() const diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index ecace2a051..0167133a03 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -346,6 +346,12 @@ public: // Evaluation functions + //- Return patch-normal gradient + virtual tmp > snGrad + ( + const scalarField& deltaCoeffs + ) const; + //- Return patch-normal gradient virtual tmp > snGrad() const; @@ -413,6 +419,21 @@ public: return *this; } + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientInternalCoeffs + ( + const scalarField& deltaCoeffs + ) const + { + notImplemented + ( + type() + + "::gradientInternalCoeffs(const scalarField& deltaCoeffs)" + ); + return *this; + } + //- Return the matrix diagonal coefficients corresponding to the // evaluation of the gradient of this patchField virtual tmp > gradientInternalCoeffs() const @@ -421,6 +442,21 @@ public: return *this; } + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientBoundaryCoeffs + ( + const scalarField& deltaCoeffs + ) const + { + notImplemented + ( + type() + + "::gradientBoundaryCoeffs(const scalarField& deltaCoeffs)" + ); + return *this; + } + //- Return the matrix source coefficients corresponding to the // evaluation of the gradient of this patchField virtual tmp > gradientBoundaryCoeffs() const diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C index dd9f68ec66..0da6e26eb3 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,12 +65,23 @@ gaussLaplacianScheme::fvmLaplacianUncorrected forAll(vf.boundaryField(), patchi) { - const fvPatchField& psf = vf.boundaryField()[patchi]; - const fvsPatchScalarField& patchGamma = - gammaMagSf.boundaryField()[patchi]; + const fvPatchField& pvf = vf.boundaryField()[patchi]; + const fvsPatchScalarField& pGamma = gammaMagSf.boundaryField()[patchi]; + const fvsPatchScalarField& pDeltaCoeffs = + deltaCoeffs.boundaryField()[patchi]; - fvm.internalCoeffs()[patchi] = patchGamma*psf.gradientInternalCoeffs(); - fvm.boundaryCoeffs()[patchi] = -patchGamma*psf.gradientBoundaryCoeffs(); + if (pvf.coupled()) + { + fvm.internalCoeffs()[patchi] = + pGamma*pvf.gradientInternalCoeffs(pDeltaCoeffs); + fvm.boundaryCoeffs()[patchi] = + -pGamma*pvf.gradientBoundaryCoeffs(pDeltaCoeffs); + } + else + { + fvm.internalCoeffs()[patchi] = pGamma*pvf.gradientInternalCoeffs(); + fvm.boundaryCoeffs()[patchi] = -pGamma*pvf.gradientBoundaryCoeffs(); + } } return tfvm; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C index a88ca9dad7..2f8ef75d9c 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -144,7 +144,17 @@ snGradScheme::snGrad forAll(vf.boundaryField(), patchi) { - ssf.boundaryField()[patchi] = vf.boundaryField()[patchi].snGrad(); + const fvPatchField& pvf = vf.boundaryField()[patchi]; + + if (pvf.coupled()) + { + ssf.boundaryField()[patchi] = + pvf.snGrad(tdeltaCoeffs().boundaryField()[patchi]); + } + else + { + ssf.boundaryField()[patchi] = pvf.snGrad(); + } } return tsf; diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C index 1c9a6ca20c..d396f885d7 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C @@ -161,6 +161,7 @@ void Foam::fvPatch::movePoints() const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const { return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()]; + //return boundaryMesh().mesh().nonOrthDeltaCoeffs().boundaryField()[index()]; }