LESfilters: Ensure the coupled BCs of the field are updated before filtering

Resolves bug-report http://bugs.openfoam.org/view.php?id=2108
This commit is contained in:
Henry Weller
2016-06-02 12:14:51 +01:00
parent 723b92ddc1
commit 2cdebff3b7
4 changed files with 42 additions and 2 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,6 +65,22 @@ class LESfilter
LESfilter(const LESfilter&);
void operator=(const LESfilter&);
protected:
//- Temporary function to ensure the coupled boundary conditions of the
// field are correct for filtering.
//
// Following the rewrite of the turbulence models to use
// GeometricField::InternalField for sources etc. delta() will return a
// GeometricField::InternalField and filters will take a
// tmp<GeometricField::InternalField> argument and handle the coupled BCs
// appropriately
template<class GeoFieldType>
void correctBoundaryConditions(const tmp<GeoFieldType>& tgf) const
{
const_cast<GeoFieldType&>(tgf()).correctBoundaryConditions();
}
public:

View File

@ -129,6 +129,8 @@ Foam::tmp<Foam::volScalarField> Foam::anisotropicFilter::operator()
const tmp<volScalarField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> tmpFilteredField =
unFilteredField
+ (
@ -151,6 +153,8 @@ Foam::tmp<Foam::volVectorField> Foam::anisotropicFilter::operator()
const tmp<volVectorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> tmpFilteredField =
unFilteredField
+ (
@ -173,6 +177,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator()
const tmp<volSymmTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> tmpFilteredField
(
new volSymmTensorField
@ -207,6 +213,8 @@ Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator()
const tmp<volTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> tmpFilteredField
(
new volTensorField

View File

@ -97,6 +97,8 @@ Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator()
const tmp<volScalarField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
@ -111,6 +113,8 @@ Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator()
const tmp<volVectorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
@ -125,6 +129,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator()
const tmp<volSymmTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
@ -139,6 +145,8 @@ Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator()
const tmp<volTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());

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-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,6 +66,8 @@ Foam::tmp<Foam::volScalarField> Foam::simpleFilter::operator()
const tmp<volScalarField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
@ -82,6 +84,8 @@ Foam::tmp<Foam::volVectorField> Foam::simpleFilter::operator()
const tmp<volVectorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
@ -98,6 +102,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::simpleFilter::operator()
const tmp<volSymmTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
@ -114,6 +120,8 @@ Foam::tmp<Foam::volTensorField> Foam::simpleFilter::operator()
const tmp<volTensorField>& unFilteredField
) const
{
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)