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 @@
========= |
\\ / 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:
......
......@@ -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
......
......@@ -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());
......
......@@ -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)
......
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