Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2013-03-13 14:37:51 +00:00
10 changed files with 189 additions and 69 deletions

View File

@ -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<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -45,7 +40,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
template<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -58,7 +53,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
template<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const coupledFvPatchField<Type>& ptf,
const fvPatch& p,
@ -72,7 +67,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
template<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -85,7 +80,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
template<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const coupledFvPatchField<Type>& ptf
)
@ -96,7 +91,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
template<class Type>
coupledFvPatchField<Type>::coupledFvPatchField
Foam::coupledFvPatchField<Type>::coupledFvPatchField
(
const coupledFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
@ -110,16 +105,29 @@ coupledFvPatchField<Type>::coupledFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
Foam::tmp<Foam::Field<Type> > Foam::coupledFvPatchField<Type>::snGrad() const
{
notImplemented("coupledFvPatchField<Type>::snGrad()");
return
(this->patchNeighbourField() - this->patchInternalField())
*this->patch().deltaCoeffs();
this->patch().deltaCoeffs()
*(this->patchNeighbourField() - this->patchInternalField());
}
template<class Type>
void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
Foam::tmp<Foam::Field<Type> > Foam::coupledFvPatchField<Type>::snGrad
(
const scalarField& deltaCoeffs
) const
{
return
deltaCoeffs
*(this->patchNeighbourField() - this->patchInternalField());
}
template<class Type>
void Foam::coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
@ -129,7 +137,7 @@ void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
template<class Type>
void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
@ -147,7 +155,8 @@ void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::valueInternalCoeffs
(
const tmp<scalarField>& w
) const
@ -155,8 +164,10 @@ tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
return Type(pTraits<Type>::one)*w;
}
template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::valueBoundaryCoeffs
(
const tmp<scalarField>& w
) const
@ -164,30 +175,53 @@ tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
return Type(pTraits<Type>::one)*(1.0 - w);
}
template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs() const
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::gradientInternalCoeffs
(
const scalarField& deltaCoeffs
) const
{
return -Type(pTraits<Type>::one)*deltaCoeffs;
}
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::gradientInternalCoeffs() const
{
notImplemented("coupledFvPatchField<Type>::gradientInternalCoeffs()");
return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
}
template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::gradientBoundaryCoeffs
(
const scalarField& deltaCoeffs
) const
{
return -this->gradientInternalCoeffs(deltaCoeffs);
}
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
{
notImplemented("coupledFvPatchField<Type>::gradientBoundaryCoeffs()");
return -this->gradientInternalCoeffs();
}
template<class Type>
void coupledFvPatchField<Type>::write(Ostream& os) const
void Foam::coupledFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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<Field<Type> > snGrad
(
const scalarField& deltaCoeffs
) const;
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
@ -167,10 +173,24 @@ public:
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs
(
const scalarField& deltaCoeffs
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientBoundaryCoeffs
(
const scalarField& deltaCoeffs
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;

View File

@ -28,15 +28,10 @@ License
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -54,7 +49,7 @@ processorFvPatchField<Type>::processorFvPatchField
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -74,7 +69,7 @@ processorFvPatchField<Type>::processorFvPatchField
// Construct by mapping given processorFvPatchField<Type>
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const fvPatch& p,
@ -119,7 +114,7 @@ processorFvPatchField<Type>::processorFvPatchField
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -157,7 +152,7 @@ processorFvPatchField<Type>::processorFvPatchField
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf
)
@ -182,7 +177,7 @@ processorFvPatchField<Type>::processorFvPatchField
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
Foam::processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
@ -209,14 +204,15 @@ processorFvPatchField<Type>::processorFvPatchField
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::~processorFvPatchField()
Foam::processorFvPatchField<Type>::~processorFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
Foam::tmp<Foam::Field<Type> >
Foam::processorFvPatchField<Type>::patchNeighbourField() const
{
if (debug && !this->ready())
{
@ -230,7 +226,7 @@ tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
template<class Type>
void processorFvPatchField<Type>::initEvaluate
void Foam::processorFvPatchField<Type>::initEvaluate
(
const Pstream::commsTypes commsType
)
@ -272,7 +268,7 @@ void processorFvPatchField<Type>::initEvaluate
template<class Type>
void processorFvPatchField<Type>::evaluate
void Foam::processorFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
@ -308,14 +304,18 @@ void processorFvPatchField<Type>::evaluate
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
Foam::tmp<Foam::Field<Type> >
Foam::processorFvPatchField<Type>::snGrad
(
const scalarField& deltaCoeffs
) const
{
return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
return deltaCoeffs*(*this - this->patchInternalField());
}
template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate
void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
(
scalarField&,
const scalarField& psiInternal,
@ -371,7 +371,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix
void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
(
scalarField& result,
const scalarField&,
@ -435,7 +435,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate
void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
(
Field<Type>&,
const Field<Type>& psiInternal,
@ -490,7 +490,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix
void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
(
Field<Type>& result,
const Field<Type>&,
@ -553,7 +553,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
template<class Type>
bool processorFvPatchField<Type>::ready() const
bool Foam::processorFvPatchField<Type>::ready() const
{
if
(
@ -587,8 +587,4 @@ bool processorFvPatchField<Type>::ready() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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<Field<Type> > snGrad() const;
virtual tmp<Field<Type> > snGrad
(
const scalarField& deltaCoeffs
) const;
//- Is all data available
virtual bool ready() const;

View File

@ -173,15 +173,23 @@ void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& ptf) const
}
// Return gradient at boundary
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad
(
const scalarField& deltaCoeffs
) const
{
return (*this - patchInternalField())*patch_.deltaCoeffs();
return deltaCoeffs*(*this - patchInternalField());
}
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
{
return this->snGrad(patch_.deltaCoeffs());
}
// Return internal field next to patch as patch field
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::fvPatchField<Type>::patchInternalField() const

View File

@ -346,6 +346,12 @@ public:
// Evaluation functions
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad
(
const scalarField& deltaCoeffs
) const;
//- Return patch-normal gradient
virtual tmp<Field<Type> > 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<Field<Type> > 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<Field<Type> > 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<Field<Type> > 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<Field<Type> > gradientBoundaryCoeffs() const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -387,7 +387,8 @@ SLTSDdtScheme<Type>::fvmDdt
scalarField rDeltaT(SLrDeltaT()().internalField());
Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl;
Info<< "SLTSDdtScheme<Type>::fvmDdt: max/min rDeltaT "
<< gMax(rDeltaT) << " " << gMin(rDeltaT) << endl;
fvm.diag() = rDeltaT*mesh().V();

View File

@ -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<Type, GType>::fvmLaplacianUncorrected
forAll(vf.boundaryField(), patchi)
{
const fvPatchField<Type>& psf = vf.boundaryField()[patchi];
const fvsPatchScalarField& patchGamma =
gammaMagSf.boundaryField()[patchi];
const fvPatchField<Type>& 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;

View File

@ -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<Type>::snGrad
forAll(vf.boundaryField(), patchi)
{
ssf.boundaryField()[patchi] = vf.boundaryField()[patchi].snGrad();
const fvPatchField<Type>& pvf = vf.boundaryField()[patchi];
if (pvf.coupled())
{
ssf.boundaryField()[patchi] =
pvf.snGrad(tdeltaCoeffs().boundaryField()[patchi]);
}
else
{
ssf.boundaryField()[patchi] = pvf.snGrad();
}
}
return tsf;

View File

@ -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()];
}