Commit 2cdebff3 authored by Henry Weller's avatar Henry Weller
Browse files

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

Resolves bug-report http://bugs.openfoam.org/view.php?id=2108
parent 723b92dd
...@@ -2,7 +2,7 @@ ...@@ -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) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -65,6 +65,22 @@ class LESfilter ...@@ -65,6 +65,22 @@ class LESfilter
LESfilter(const LESfilter&); LESfilter(const LESfilter&);
void operator=(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: public:
......
...@@ -129,6 +129,8 @@ Foam::tmp<Foam::volScalarField> Foam::anisotropicFilter::operator() ...@@ -129,6 +129,8 @@ Foam::tmp<Foam::volScalarField> Foam::anisotropicFilter::operator()
const tmp<volScalarField>& unFilteredField const tmp<volScalarField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> tmpFilteredField = tmp<volScalarField> tmpFilteredField =
unFilteredField unFilteredField
+ ( + (
...@@ -151,6 +153,8 @@ Foam::tmp<Foam::volVectorField> Foam::anisotropicFilter::operator() ...@@ -151,6 +153,8 @@ Foam::tmp<Foam::volVectorField> Foam::anisotropicFilter::operator()
const tmp<volVectorField>& unFilteredField const tmp<volVectorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> tmpFilteredField = tmp<volVectorField> tmpFilteredField =
unFilteredField unFilteredField
+ ( + (
...@@ -173,6 +177,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator() ...@@ -173,6 +177,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator()
const tmp<volSymmTensorField>& unFilteredField const tmp<volSymmTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> tmpFilteredField tmp<volSymmTensorField> tmpFilteredField
( (
new volSymmTensorField new volSymmTensorField
...@@ -207,6 +213,8 @@ Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator() ...@@ -207,6 +213,8 @@ Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator()
const tmp<volTensorField>& unFilteredField const tmp<volTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> tmpFilteredField tmp<volTensorField> tmpFilteredField
( (
new volTensorField new volTensorField
......
...@@ -97,6 +97,8 @@ Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator() ...@@ -97,6 +97,8 @@ Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator()
const tmp<volScalarField>& unFilteredField const tmp<volScalarField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> filteredField = tmp<volScalarField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField()); unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
...@@ -111,6 +113,8 @@ Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator() ...@@ -111,6 +113,8 @@ Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator()
const tmp<volVectorField>& unFilteredField const tmp<volVectorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> filteredField = tmp<volVectorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField()); unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
...@@ -125,6 +129,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator() ...@@ -125,6 +129,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator()
const tmp<volSymmTensorField>& unFilteredField const tmp<volSymmTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> filteredField = tmp<volSymmTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField()); unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
...@@ -139,6 +145,8 @@ Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator() ...@@ -139,6 +145,8 @@ Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator()
const tmp<volTensorField>& unFilteredField const tmp<volTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> filteredField = tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField()); unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
......
...@@ -2,7 +2,7 @@ ...@@ -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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -66,6 +66,8 @@ Foam::tmp<Foam::volScalarField> Foam::simpleFilter::operator() ...@@ -66,6 +66,8 @@ Foam::tmp<Foam::volScalarField> Foam::simpleFilter::operator()
const tmp<volScalarField>& unFilteredField const tmp<volScalarField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volScalarField> filteredField = fvc::surfaceSum tmp<volScalarField> filteredField = fvc::surfaceSum
( (
mesh().magSf()*fvc::interpolate(unFilteredField) mesh().magSf()*fvc::interpolate(unFilteredField)
...@@ -82,6 +84,8 @@ Foam::tmp<Foam::volVectorField> Foam::simpleFilter::operator() ...@@ -82,6 +84,8 @@ Foam::tmp<Foam::volVectorField> Foam::simpleFilter::operator()
const tmp<volVectorField>& unFilteredField const tmp<volVectorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volVectorField> filteredField = fvc::surfaceSum tmp<volVectorField> filteredField = fvc::surfaceSum
( (
mesh().magSf()*fvc::interpolate(unFilteredField) mesh().magSf()*fvc::interpolate(unFilteredField)
...@@ -98,6 +102,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::simpleFilter::operator() ...@@ -98,6 +102,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::simpleFilter::operator()
const tmp<volSymmTensorField>& unFilteredField const tmp<volSymmTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volSymmTensorField> filteredField = fvc::surfaceSum tmp<volSymmTensorField> filteredField = fvc::surfaceSum
( (
mesh().magSf()*fvc::interpolate(unFilteredField) mesh().magSf()*fvc::interpolate(unFilteredField)
...@@ -114,6 +120,8 @@ Foam::tmp<Foam::volTensorField> Foam::simpleFilter::operator() ...@@ -114,6 +120,8 @@ Foam::tmp<Foam::volTensorField> Foam::simpleFilter::operator()
const tmp<volTensorField>& unFilteredField const tmp<volTensorField>& unFilteredField
) const ) const
{ {
correctBoundaryConditions(unFilteredField);
tmp<volTensorField> filteredField = fvc::surfaceSum tmp<volTensorField> filteredField = fvc::surfaceSum
( (
mesh().magSf()*fvc::interpolate(unFilteredField) mesh().magSf()*fvc::interpolate(unFilteredField)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment