From 4d0125278f00a8a8b2588876e18456d003251b40 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 6 Dec 2016 12:49:27 +0000 Subject: [PATCH] Finite area updates, Matthias Rauter --- src/finiteArea/Make/files | 3 + .../basic/transform/transformFaPatchFields.C | 5 - .../constraint/wedge/wedgeFaPatchFields.C | 5 - .../edgeNormalFixedValueFaPatchVectorField.C | 155 ++++++++ .../edgeNormalFixedValueFaPatchVectorField.H | 173 +++++++++ ...timeVaryingUniformFixedValueFaPatchField.C | 137 +++++++ ...timeVaryingUniformFixedValueFaPatchField.H | 182 ++++++++++ ...imeVaryingUniformFixedValueFaPatchFields.C | 43 +++ ...imeVaryingUniformFixedValueFaPatchFields.H | 49 +++ ...VaryingUniformFixedValueFaPatchFieldsFwd.H | 51 +++ .../faPatchFields/faPatchField/faPatchField.H | 125 ++++--- .../gaussFaDivScheme/gaussFaDivScheme.C | 2 +- src/finiteArea/finiteArea/fac/fac.H | 2 + src/finiteArea/finiteArea/fac/facDiv.C | 65 +++- src/finiteArea/finiteArea/fac/facGrad.C | 34 +- src/finiteArea/finiteArea/fac/facNDiv.C | 333 ++++++++++++++++++ src/finiteArea/finiteArea/fac/facNDiv.H | 187 ++++++++++ src/finiteArea/finiteArea/fac/facNGrad.C | 202 +++++++++++ src/finiteArea/finiteArea/fac/facNGrad.H | 131 +++++++ src/finiteArea/finiteArea/fam/fam.H | 1 + src/finiteArea/finiteArea/fam/famDiv.C | 32 +- src/finiteArea/finiteArea/fam/famDiv.H | 4 + src/finiteArea/finiteArea/fam/famNDiv.C | 108 ++++++ src/finiteArea/finiteArea/fam/famNDiv.H | 100 ++++++ src/finiteArea/finiteArea/fam/vectorFamDiv.C | 69 ++++ src/finiteArea/finiteArea/fam/vectorFamDiv.H | 74 ++++ .../gradSchemes/gaussFaGrad/gaussFaGrad.C | 17 +- .../leastSquaresFaGrad/leastSquaresFaGrad.C | 5 +- 28 files changed, 2196 insertions(+), 98 deletions(-) create mode 100644 src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C create mode 100644 src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.H create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.H create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFieldsFwd.H create mode 100644 src/finiteArea/finiteArea/fac/facNDiv.C create mode 100644 src/finiteArea/finiteArea/fac/facNDiv.H create mode 100644 src/finiteArea/finiteArea/fac/facNGrad.C create mode 100644 src/finiteArea/finiteArea/fac/facNGrad.H create mode 100644 src/finiteArea/finiteArea/fam/famNDiv.C create mode 100644 src/finiteArea/finiteArea/fam/famNDiv.H create mode 100644 src/finiteArea/finiteArea/fam/vectorFamDiv.C create mode 100644 src/finiteArea/finiteArea/fam/vectorFamDiv.H diff --git a/src/finiteArea/Make/files b/src/finiteArea/Make/files index 6cd6d6288..9e8ffce86 100644 --- a/src/finiteArea/Make/files +++ b/src/finiteArea/Make/files @@ -48,6 +48,8 @@ derivedFaPatchFields = $(faPatchFields)/derived $(derivedFaPatchFields)/fixedValueOutflow/fixedValueOutflowFaPatchFields.C $(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C $(derivedFaPatchFields)/slip/slipFaPatchFields.C +$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C +$(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C faePatchFields = fields/faePatchFields $(faePatchFields)/faePatchField/faePatchFields.C @@ -92,6 +94,7 @@ $(ddtSchemes)/backwardFaDdtScheme/backwardFaDdtSchemes.C $(ddtSchemes)/boundedBackwardFaDdtScheme/boundedBackwardFaDdtScheme.C divSchemes = finiteArea/divSchemes +finiteArea/fam/vectorFamDiv.C $(divSchemes)/faDivScheme/faDivSchemes.C $(divSchemes)/gaussFaDivScheme/gaussFaDivSchemes.C diff --git a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.C b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.C index 2c808f7bd..24e9fbfc8 100644 --- a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.C @@ -28,7 +28,6 @@ Description #include "faPatchFields.H" #include "transformFaPatchFields.H" #include "addToRunTimeSelectionTable.H" -// #include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,10 +36,6 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// defineNamedTemplateTypeNameAndDebug(transformFaPatchScalarField, 0); -// defineNamedTemplateTypeNameAndDebug(transformFaPatchVectorField, 0); -// defineNamedTemplateTypeNameAndDebug(transformFaPatchTensorField, 0); - makeFaPatchFieldsTypeName(transform); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.C b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.C index b67ab97c2..be4183c9a 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.C @@ -28,7 +28,6 @@ Description #include "faPatchFields.H" #include "wedgeFaPatchFields.H" #include "addToRunTimeSelectionTable.H" -// #include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,10 +36,6 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// defineNamedTemplateTypeNameAndDebug(wedgeFaPatchScalarField, 0); -// defineNamedTemplateTypeNameAndDebug(wedgeFaPatchVectorField, 0); -// defineNamedTemplateTypeNameAndDebug(wedgeFaPatchTensorField, 0); - makeFaPatchFields(wedge); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C b/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C new file mode 100644 index 000000000..bc0a93108 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "edgeNormalFixedValueFaPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "areaFields.H" +#include "faPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::edgeNormalFixedValueFaPatchVectorField:: +edgeNormalFixedValueFaPatchVectorField +( + const faPatch& p, + const DimensionedField& iF +) +: + fixedValueFaPatchVectorField(p, iF), + refValue_(p.size(), 0) +{} + + +Foam::edgeNormalFixedValueFaPatchVectorField:: +edgeNormalFixedValueFaPatchVectorField +( + const edgeNormalFixedValueFaPatchVectorField& ptf, + const faPatch& p, + const DimensionedField& iF, + const faPatchFieldMapper& mapper +) +: + fixedValueFaPatchVectorField(ptf, p, iF, mapper), + refValue_(ptf.refValue_, mapper) +{} + + +Foam::edgeNormalFixedValueFaPatchVectorField:: +edgeNormalFixedValueFaPatchVectorField +( + const faPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFaPatchVectorField(p, iF, dict), + refValue_("refValue", dict, p.size()) +{} + + +Foam::edgeNormalFixedValueFaPatchVectorField:: +edgeNormalFixedValueFaPatchVectorField +( + const edgeNormalFixedValueFaPatchVectorField& pivpvf +) +: + fixedValueFaPatchVectorField(pivpvf), + refValue_(pivpvf.refValue_) +{} + + +Foam::edgeNormalFixedValueFaPatchVectorField:: +edgeNormalFixedValueFaPatchVectorField +( + const edgeNormalFixedValueFaPatchVectorField& pivpvf, + const DimensionedField& iF +) +: + fixedValueFaPatchVectorField(pivpvf, iF), + refValue_(pivpvf.refValue_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::edgeNormalFixedValueFaPatchVectorField::autoMap +( + const faPatchFieldMapper& m +) +{ + fixedValueFaPatchVectorField::autoMap(m); + refValue_.autoMap(m); +} + + +void Foam::edgeNormalFixedValueFaPatchVectorField::rmap +( + const faPatchVectorField& ptf, + const labelList& addr +) +{ + fixedValueFaPatchVectorField::rmap(ptf, addr); + + const edgeNormalFixedValueFaPatchVectorField& tiptf = + refCast(ptf); + + refValue_.rmap(tiptf.refValue_, addr); +} + + +void Foam::edgeNormalFixedValueFaPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Bug fix: update for moving mesh. HJ, 15/Oct/2010 + operator==(refValue_*patch().edgeNormals()); +} + + +void Foam::edgeNormalFixedValueFaPatchVectorField::write(Ostream& os) const +{ + fixedValueFaPatchVectorField::write(os); + refValue_.writeEntry("refValue", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +makeFaPatchTypeField +( + faPatchVectorField, + edgeNormalFixedValueFaPatchVectorField +); + +} // End namespace Foam + + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.H b/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.H new file mode 100644 index 000000000..0cf215d73 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Class + Foam::edgeNormalFixedValueFaPatchVectorField + +Description + Edge normal fixed value vector field finite area boundary condition + + Describes a surface normal vector boundary condition by its magnitude. + Note: The value is positive for outward-pointing vectors + +SourceFiles + edgeNormalFixedValueFaPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef edgeNormalFixedValueFaPatchVectorField_H +#define edgeNormalFixedValueFaPatchVectorField_H + +#include "faPatchFields.H" +#include "fixedValueFaPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class edgeNormalFixedValueFaPatch Declaration +\*---------------------------------------------------------------------------*/ + +class edgeNormalFixedValueFaPatchVectorField +: + public fixedValueFaPatchVectorField +{ + // Private data + + //- Surface-normal velocity value + scalarField refValue_; + + +public: + + //- Runtime type information + TypeName("edgeNormalFixedValue"); + + + // Constructors + + //- Construct from patch and internal field + edgeNormalFixedValueFaPatchVectorField + ( + const faPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + edgeNormalFixedValueFaPatchVectorField + ( + const faPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // edgeNormalFixedValueFaPatchVectorField + // onto a new patch + edgeNormalFixedValueFaPatchVectorField + ( + const edgeNormalFixedValueFaPatchVectorField&, + const faPatch&, + const DimensionedField&, + const faPatchFieldMapper& + ); + + //- Construct as copy + edgeNormalFixedValueFaPatchVectorField + ( + const edgeNormalFixedValueFaPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new edgeNormalFixedValueFaPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + edgeNormalFixedValueFaPatchVectorField + ( + const edgeNormalFixedValueFaPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new edgeNormalFixedValueFaPatchVectorField + ( + *this, + iF + ) + ); + } + + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const faPatchFieldMapper& + ); + + //- Reverse map the given faPatchField onto this faPatchField + virtual void rmap + ( + const faPatchVectorField&, + const labelList& + ); + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C new file mode 100644 index 000000000..cb2b83c26 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "timeVaryingUniformFixedValueFaPatchField.H" +#include "foamTime.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::timeVaryingUniformFixedValueFaPatchField:: +timeVaryingUniformFixedValueFaPatchField +( + const faPatch& p, + const DimensionedField& iF +) +: + fixedValueFaPatchField(p, iF), + timeSeries_() +{} + + +template +Foam::timeVaryingUniformFixedValueFaPatchField:: +timeVaryingUniformFixedValueFaPatchField +( + const faPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFaPatchField(p, iF), + timeSeries_(dict) +{ + if (dict.found("value")) + { + faPatchField::operator==(Field("value", dict, p.size())); + } + else + { + updateCoeffs(); + } +} + + +template +Foam::timeVaryingUniformFixedValueFaPatchField:: +timeVaryingUniformFixedValueFaPatchField +( + const timeVaryingUniformFixedValueFaPatchField& ptf, + const faPatch& p, + const DimensionedField& iF, + const faPatchFieldMapper& mapper +) +: + fixedValueFaPatchField(ptf, p, iF, mapper), + timeSeries_(ptf.timeSeries_) +{} + + +template +Foam::timeVaryingUniformFixedValueFaPatchField:: +timeVaryingUniformFixedValueFaPatchField +( + const timeVaryingUniformFixedValueFaPatchField& ptf +) +: + fixedValueFaPatchField(ptf), + timeSeries_(ptf.timeSeries_) +{} + + +template +Foam::timeVaryingUniformFixedValueFaPatchField:: +timeVaryingUniformFixedValueFaPatchField +( + const timeVaryingUniformFixedValueFaPatchField& ptf, + const DimensionedField& iF +) +: + fixedValueFaPatchField(ptf, iF), + timeSeries_(ptf.timeSeries_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::timeVaryingUniformFixedValueFaPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + faPatchField::operator== + ( + timeSeries_(this->db().time().timeOutputValue()) + ); + fixedValueFaPatchField::updateCoeffs(); +} + + +template +void Foam::timeVaryingUniformFixedValueFaPatchField::write +( + Ostream& os +) const +{ + faPatchField::write(os); + timeSeries_.write(os); + this->writeEntry("value", os); +} + + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.H new file mode 100644 index 000000000..b59f386c4 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Class + Foam::timeVaryingUniformFixedValueFaPatchField + +Description + A time-varying form of a uniform fixed value finite area + boundary condition. + + Example of the boundary condition specification: + @verbatim + inlet + { + type timeVaryingUniformFixedValue; + fileName "$FOAM_CASE/time-series"; + outOfBounds clamp; // (error|warn|clamp|repeat) + } + @endverbatim + +Note + This class is derived directly from a fixedValue patch rather than from + a uniformFixedValue patch. + +See Also + Foam::interpolationTable and Foam::fixedValueFaPatchField + +SourceFiles + timeVaryingUniformFixedValueFaPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformFixedValueFaPatchField_H +#define timeVaryingUniformFixedValueFaPatchField_H + +#include "fixedValueFaPatchField.H" +#include "interpolationTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class timeVaryingUniformFixedValueFaPatch Declaration +\*---------------------------------------------------------------------------*/ + +template +class timeVaryingUniformFixedValueFaPatchField +: + public fixedValueFaPatchField +{ + // Private data + + //- The time series being used, including the bounding treatment + interpolationTable timeSeries_; + + +public: + + //- Runtime type information + TypeName("timeVaryingUniformFixedValue"); + + + // Constructors + + //- Construct from patch and internal field + timeVaryingUniformFixedValueFaPatchField + ( + const faPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + timeVaryingUniformFixedValueFaPatchField + ( + const faPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patch field onto a new patch + timeVaryingUniformFixedValueFaPatchField + ( + const timeVaryingUniformFixedValueFaPatchField&, + const faPatch&, + const DimensionedField&, + const faPatchFieldMapper& + ); + + //- Construct as copy + timeVaryingUniformFixedValueFaPatchField + ( + const timeVaryingUniformFixedValueFaPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new timeVaryingUniformFixedValueFaPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + timeVaryingUniformFixedValueFaPatchField + ( + const timeVaryingUniformFixedValueFaPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new timeVaryingUniformFixedValueFaPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the time series used + const interpolationTable& timeSeries() const + { + return timeSeries_; + } + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "timeVaryingUniformFixedValueFaPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C new file mode 100644 index 000000000..0610f7e76 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "timeVaryingUniformFixedValueFaPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "areaFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeFaPatchFields(timeVaryingUniformFixedValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H new file mode 100644 index 000000000..71f70dd63 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformFixedValueFaPatchFields_H +#define timeVaryingUniformFixedValueFaPatchFields_H + +#include "timeVaryingUniformFixedValueFaPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFieldsFwd.H b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFieldsFwd.H new file mode 100644 index 000000000..2a8360f27 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFieldsFwd.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformFixedValueFaPatchFieldsFwd_H +#define timeVaryingUniformFixedValueFaPatchFieldsFwd_H + +#include "faPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class timeVaryingUniformFixedValueFaPatchField; + +makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index dc8fefadd..018b276ac 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -468,60 +468,87 @@ public: #endif -#define makeFaPatchTypeFieldTypeName(typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); - -#define makeFaPatchFieldsTypeName(typePatchField) \ - \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchScalarField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchVectorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSphericalTensorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSymmTensorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchTensorField); - -#define makeFaPatchTypeField(PatchTypeField, typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, patch \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, dictionary \ +#define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ + \ +addToRunTimeSelectionTable \ +( \ + PatchTypeField, typePatchTypeField, patch \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + PatchTypeField, typePatchTypeField, dictionary \ ); -#define makeFaPatchFields(type) \ - \ -makeFaPatchTypeField(faPatchScalarField, type##FaPatchScalarField); \ -makeFaPatchTypeField(faPatchVectorField, type##FaPatchVectorField); \ -makeFaPatchTypeField \ -( \ - faPatchSphericalTensorField, \ - type##FaPatchSphericalTensorField \ -); \ -makeFaPatchTypeField(faPatchSymmTensorField, type##FaPatchSymmTensorField);\ -makeFaPatchTypeField(faPatchTensorField, type##FaPatchTensorField); +#define makeFaPatchTypeFieldTypeName(typePatchTypeField) \ + \ +defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); -#define makeFaPatchTypeFieldTypedefs(type) \ - \ -typedef type##FaPatchField type##FaPatchScalarField; \ -typedef type##FaPatchField type##FaPatchVectorField; \ -typedef type##FaPatchField \ - type##FaPatchSphericalTensorField; \ -typedef type##FaPatchField type##FaPatchSymmTensorField; \ +#define makeFaPatchFieldsTypeName(typePatchField) \ + \ +makeFaPatchTypeFieldTypeName(typePatchField##FaPatchScalarField); \ +makeFaPatchTypeFieldTypeName(typePatchField##FaPatchVectorField); \ +makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSphericalTensorField); \ +makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSymmTensorField); \ +makeFaPatchTypeFieldTypeName(typePatchField##FaPatchTensorField); + + +#define makeFaPatchTypeField(PatchTypeField, typePatchTypeField) \ + \ +defineTypeNameAndDebug(typePatchTypeField, 0); \ + \ +addToFaPatchFieldRunTimeSelection \ +( \ + PatchTypeField, typePatchTypeField \ +); + +#define makeTemplateFaPatchTypeField(PatchTypeField, typePatchTypeField) \ + \ +defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ + \ +addToFaPatchFieldRunTimeSelection \ +( \ + PatchTypeField, typePatchTypeField \ +); + + +#define makeFaPatchFields(type) \ + \ +makeTemplateFaPatchTypeField(faPatchScalarField, type##FaPatchScalarField); \ +makeTemplateFaPatchTypeField(faPatchVectorField, type##FaPatchVectorField); \ +makeTemplateFaPatchTypeField \ +( \ + faPatchSphericalTensorField, \ + type##FaPatchSphericalTensorField \ +); \ +makeTemplateFaPatchTypeField \ +( \ + faPatchSymmTensorField, \ + type##FaPatchSymmTensorField \ +); \ +makeTemplateFaPatchTypeField \ +( \ + faPatchTensorField, \ + type##FaPatchTensorField \ +); + + +#define makeFaPatchTypeFieldTypedefs(type) \ + \ +typedef type##FaPatchField type##FaPatchScalarField; \ +typedef type##FaPatchField type##FaPatchVectorField; \ +typedef type##FaPatchField \ + type##FaPatchSphericalTensorField; \ +typedef type##FaPatchField type##FaPatchSymmTensorField; \ typedef type##FaPatchField type##FaPatchTensorField; diff --git a/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.C b/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.C index c4d43aefc..802b543e0 100644 --- a/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.C +++ b/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.C @@ -62,7 +62,7 @@ gaussDivScheme::facDiv ( this->mesh_.Le() & this->tinterpScheme_().interpolate(vf) ) - - this->mesh_.faceCurvatures()*(this->mesh_.faceAreaNormals()&vf) + // Removed for consistencty. Matthias Rauter, 6/Dec/2016 ); tDiv().rename("div(" + vf.name() + ')'); diff --git a/src/finiteArea/finiteArea/fac/fac.H b/src/finiteArea/finiteArea/fac/fac.H index ce5e382b9..2b17490bc 100644 --- a/src/finiteArea/finiteArea/fac/fac.H +++ b/src/finiteArea/finiteArea/fac/fac.H @@ -43,6 +43,8 @@ Description #include "facAverage.H" #include "facLnGrad.H" #include "facDdt.H" +#include "facNGrad.H" +#include "facNDiv.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/finiteArea/fac/facDiv.C b/src/finiteArea/finiteArea/fac/facDiv.C index cc72a13d9..e5f04f9d9 100644 --- a/src/finiteArea/finiteArea/fac/facDiv.C +++ b/src/finiteArea/finiteArea/fac/facDiv.C @@ -28,6 +28,7 @@ License #include "facEdgeIntegrate.H" #include "faDivScheme.H" #include "faConvectionScheme.H" +#include "transformField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +49,17 @@ div const GeometricField& ssf ) { - return fac::edgeIntegrate(ssf); + const areaVectorField& n = ssf.mesh().faceAreaNormals(); + + tmp > tDiv = + fac::edgeIntegrate(ssf); + + GeometricField& Div = tDiv(); + + Div.internalField() = transform(tensor::I - sqr(n), Div.internalField()); + Div.correctBoundaryConditions(); + + return tDiv; } @@ -79,10 +90,34 @@ div const word& name ) { - return fa::divScheme::New + const areaVectorField& n = vf.mesh().faceAreaNormals(); + + tmp + < + GeometricField + < + typename innerProduct::type, + faPatchField, + areaMesh + > + > tDiv ( - vf.mesh(), vf.mesh().schemesDict().divScheme(name) - )().facDiv(vf); + fa::divScheme::New + ( + vf.mesh(), vf.mesh().schemesDict().divScheme(name) + )().facDiv(vf) + ); + GeometricField + < + typename innerProduct::type, + faPatchField, + areaMesh + >& Div = tDiv(); + + Div.internalField() = transform(tensor::I - sqr(n), Div.internalField()); + Div.correctBoundaryConditions(); + + return tDiv; } @@ -159,12 +194,24 @@ div const word& name ) { - return fa::convectionScheme::New + const areaVectorField& n = vf.mesh().faceAreaNormals(); + + tmp > tDiv ( - vf.mesh(), - flux, - vf.mesh().schemesDict().divScheme(name) - )().facDiv(flux, vf); + fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().facDiv(flux, vf) + ); + GeometricField& Div = tDiv(); + + Div.internalField() = transform(tensor::I - sqr(n), Div.internalField()); + Div.correctBoundaryConditions(); + + return tDiv; + } diff --git a/src/finiteArea/finiteArea/fac/facGrad.C b/src/finiteArea/finiteArea/fac/facGrad.C index e7c3b5e88..568f4c2b6 100644 --- a/src/finiteArea/finiteArea/fac/facGrad.C +++ b/src/finiteArea/finiteArea/fac/facGrad.C @@ -55,7 +55,18 @@ grad const GeometricField& ssf ) { - return fac::edgeIntegrate(ssf.mesh().Sf() * ssf); + const areaVectorField &n = ssf.mesh().faceAreaNormals(); + typedef typename outerProduct::type GradType; + + tmp > tgGrad = + fac::edgeIntegrate(ssf.mesh().Sf()*ssf); + + GeometricField& gGrad = tgGrad(); + + gGrad -= (gGrad & n)*n; + gGrad.correctBoundaryConditions(); + + return tgGrad; } template @@ -95,11 +106,22 @@ grad const word& name ) { - return fa::gradScheme::New - ( - vf.mesh(), - vf.mesh().schemesDict().gradScheme(name) - )().grad(vf); + const areaVectorField &n = vf.mesh().faceAreaNormals(); + typedef typename outerProduct::type GradType; + + tmp > tgGrad = + fa::gradScheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().gradScheme(name) + )().grad(vf); + + GeometricField& gGrad = tgGrad(); + + gGrad -= (gGrad & n)*n; + gGrad.correctBoundaryConditions(); + + return tgGrad; } diff --git a/src/finiteArea/finiteArea/fac/facNDiv.C b/src/finiteArea/finiteArea/fac/facNDiv.C new file mode 100644 index 000000000..6a1953961 --- /dev/null +++ b/src/finiteArea/finiteArea/fac/facNDiv.C @@ -0,0 +1,333 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "facNDiv.H" +#include "faMesh.H" +#include "facEdgeIntegrate.H" +#include "faDivScheme.H" +#include "faConvectionScheme.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fac +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp > +ndiv +( + const GeometricField& ssf +) +{ + const areaVectorField &n = ssf.mesh().faceAreaNormals(); + + tmp > v = fac::edgeIntegrate(ssf); + + //v.internalField() = transform(n*n, v.internalField()); + v.internalField() = (v.internalField()&n)*n; + + return v; +} + + +template +tmp > +ndiv +( + const tmp >& tssf +) +{ + tmp > Div(fac::ndiv(tssf())); + tssf.clear(); + return Div; +} + + +template +tmp +< + GeometricField + < + typename innerProduct::type, faPatchField, areaMesh + > +> +ndiv +( + const GeometricField& vf, + const word& name +) +{ + const areaVectorField &n = vf.mesh().faceAreaNormals(); + + tmp > tDiv + ( + fa::divScheme::New + ( + vf.mesh(), vf.mesh().schemesDict().divScheme(name) + )().facDiv(vf) + ); + + GeometricField& Div = tDiv(); + + //Div.internalField() = transform(n*n, Div.internalField()); + Div.internalField() = (Div.internalField()&n)*n; + return tDiv; +} + + +template +tmp +< + GeometricField + < + typename innerProduct::type, faPatchField, areaMesh + > +> +ndiv +( + const tmp >& tvvf, + const word& name +) +{ + typedef typename innerProduct::type DivType; + tmp > Div + ( + fac::ndiv(tvvf(), name) + ); + tvvf.clear(); + return Div; +} + +template +tmp +< + GeometricField + < + typename innerProduct::type, faPatchField, areaMesh + > +> +ndiv +( + const GeometricField& vf +) +{ + return fac::ndiv(vf, "div("+vf.name()+')'); +} + + +template +tmp +< + GeometricField + < + typename innerProduct::type, faPatchField, areaMesh + > +> +ndiv +( + const tmp >& tvvf +) +{ + typedef typename innerProduct::type DivType; + tmp > Div + ( + fac::ndiv(tvvf()) + ); + + tvvf.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const edgeScalarField& flux, + const GeometricField& vf, + const word& name +) +{ + const areaVectorField &n = vf.mesh().faceAreaNormals(); + + tmp > tDiv + ( + fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().facDiv(flux, vf) + ); + + GeometricField& Div = tDiv(); + + //Div.internalField() = transform(n*n, Div.internalField()); + Div.internalField() = (Div.internalField()&n)*n; + + return tDiv; + +} + + +template +tmp > +ndiv +( + const tmp& tflux, + const GeometricField& vf, + const word& name +) +{ + tmp > Div + ( + fac::ndiv(tflux(), vf, name) + ); + tflux.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const edgeScalarField& flux, + const tmp >& tvf, + const word& name +) +{ + tmp > Div + ( + fac::ndiv(flux, tvf(), name) + ); + tvf.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const tmp& tflux, + const tmp >& tvf, + const word& name +) +{ + tmp > Div + ( + fac::ndiv(tflux(), tvf(), name) + ); + tflux.clear(); + tvf.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const edgeScalarField& flux, + const GeometricField& vf +) +{ + return fac::ndiv + ( + flux, vf, "div("+flux.name()+','+vf.name()+')' + ); +} + + +template +tmp > +ndiv +( + const tmp& tflux, + const GeometricField& vf +) +{ + tmp > Div + ( + fac::ndiv(tflux(), vf) + ); + tflux.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const edgeScalarField& flux, + const tmp >& tvf +) +{ + tmp > Div + ( + fac::ndiv(flux, tvf()) + ); + tvf.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const tmp& tflux, + const tmp >& tvf +) +{ + tmp > Div + ( + fac::ndiv(tflux(), tvf()) + ); + tflux.clear(); + tvf.clear(); + return Div; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fac + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fac/facNDiv.H b/src/finiteArea/finiteArea/fac/facNDiv.H new file mode 100644 index 000000000..7aab1da79 --- /dev/null +++ b/src/finiteArea/finiteArea/fac/facNDiv.H @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Namespace + fac + +Description + Calculate the divergence of the given field. + +SourceFiles + facDiv.C + +\*---------------------------------------------------------------------------*/ + + +#ifndef facNDiv_H +#define facNDiv_H + +#include "areaFieldsFwd.H" +#include "edgeFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace fac functions Declaration +\*---------------------------------------------------------------------------*/ + +namespace fac +{ + template + tmp > ndiv + ( + const GeometricField& + ); + + template + tmp > ndiv + ( + const tmp >& + ); + + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ndiv + ( + const GeometricField&, + const word& name + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ndiv + ( + const tmp >&, + const word& name + ); + + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ndiv + ( + const GeometricField& + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ndiv + ( + const tmp >& + ); + + + template + tmp > ndiv + ( + const edgeScalarField&, + const GeometricField&, + const word& name + ); + + template + tmp > ndiv + ( + const tmp&, + const GeometricField&, + const word& name + ); + + template + tmp > ndiv + ( + const edgeScalarField&, + const tmp >&, + const word& name + ); + + template + tmp > ndiv + ( + const tmp&, + const tmp >&, + const word& name + ); + + + template + tmp > ndiv + ( + const edgeScalarField&, + const GeometricField& + ); + + template + tmp > ndiv + ( + const tmp&, + const GeometricField& + ); + + template + tmp > ndiv + ( + const edgeScalarField&, + const tmp >& + ); + + template + tmp > ndiv + ( + const tmp&, + const tmp >& + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "facNDiv.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fac/facNGrad.C b/src/finiteArea/finiteArea/fac/facNGrad.C new file mode 100644 index 000000000..9d4d96070 --- /dev/null +++ b/src/finiteArea/finiteArea/fac/facNGrad.C @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "facNGrad.H" +#include "areaFields.H" +#include "edgeFields.H" +#include "facEdgeIntegrate.H" +#include "faMesh.H" +#include "faGradScheme.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fac +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const GeometricField& ssf +) +{ + const areaVectorField &n = ssf.mesh().faceAreaNormals(); + typedef typename outerProduct::type GradType; + + tmp > tgGrad = fac::edgeIntegrate(ssf.mesh().Sf() * ssf); + + GeometricField& grad = tgGrad(); + + grad = (grad&n)*n; + + return tgGrad; +} + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const tmp >& tssf +) +{ + typedef typename outerProduct::type GradType; + tmp > Grad + ( + fac::ngrad(tssf()) + ); + tssf.clear(); + return Grad; +} + + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const GeometricField& vf, + const word& name +) +{ + const areaVectorField &n = vf.mesh().faceAreaNormals(); + typedef typename outerProduct::type GradType; + + tmp > tgGrad = fa::gradScheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().gradScheme(name) + )().grad(vf); + + GeometricField& grad = tgGrad(); + + grad = (grad&n)*n; + + return tgGrad; +} + + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const tmp >& tvf, + const word& name +) +{ + tmp + < + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > + > tGrad + ( + fac::ngrad(tvf(), name) + ); + tvf.clear(); + return tGrad; +} + + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const GeometricField& vf +) +{ + return fac::ngrad(vf, "grad(" + vf.name() + ')'); +} + + +template +tmp +< + GeometricField + < + typename outerProduct::type, faPatchField, areaMesh + > +> +ngrad +( + const tmp >& tvf +) +{ + typedef typename outerProduct::type GradType; + tmp > Grad + ( + fac::ngrad(tvf()) + ); + tvf.clear(); + return Grad; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fac + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fac/facNGrad.H b/src/finiteArea/finiteArea/fac/facNGrad.H new file mode 100644 index 000000000..0375202bd --- /dev/null +++ b/src/finiteArea/finiteArea/fac/facNGrad.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Namespace + fac + +Description + Calculate the gradient normal to the surface of the given field. + +SourceFiles + facGrad.C + +\*---------------------------------------------------------------------------*/ + + +#ifndef facNGrad_H +#define facNGrad_H + +#include "areaFieldsFwd.H" +#include "edgeFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace fac functions Declaration +\*---------------------------------------------------------------------------*/ + +namespace fac +{ + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ngrad + ( + const GeometricField& + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + > ngrad + ( + const tmp >& + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + >ngrad + ( + const GeometricField&, + const word& name + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + >ngrad + ( + const tmp >&, + const word& name + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + >ngrad + ( + const GeometricField& + ); + + template + tmp + < + GeometricField + ::type, faPatchField, areaMesh> + >ngrad + ( + const tmp >& + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "facNGrad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fam/fam.H b/src/finiteArea/finiteArea/fam/fam.H index 65b1c6905..5e9f7ef33 100644 --- a/src/finiteArea/finiteArea/fam/fam.H +++ b/src/finiteArea/finiteArea/fam/fam.H @@ -43,6 +43,7 @@ SourceFiles #include "famDiv.H" #include "famLaplacian.H" #include "famSup.H" +#include "famNDiv.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/finiteArea/fam/famDiv.C b/src/finiteArea/finiteArea/fam/famDiv.C index b382b60a5..2296b224b 100644 --- a/src/finiteArea/finiteArea/fam/famDiv.C +++ b/src/finiteArea/finiteArea/fam/famDiv.C @@ -49,14 +49,36 @@ div const word& name ) { - return fa::convectionScheme::New + const areaVectorField& n = vf.mesh().faceAreaNormals(); + + tmp > tM ( - vf.mesh(), - flux, - vf.mesh().schemesDict().divScheme(name) - )().famDiv(flux, vf); + fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().famDiv(flux, vf) + ); + faMatrix& M = tM(); + + GeometricField v + ( + fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().facDiv(flux, vf) + ); + + //HJ Check if the product is from left or right. HJ, 6/Dec/2016 + M -= (v & n)*n; + + return tM; } + template tmp > div diff --git a/src/finiteArea/finiteArea/fam/famDiv.H b/src/finiteArea/finiteArea/fam/famDiv.H index 33b92f49d..e8c4f2bb2 100644 --- a/src/finiteArea/finiteArea/fam/famDiv.H +++ b/src/finiteArea/finiteArea/fam/famDiv.H @@ -29,6 +29,7 @@ Description SourceFiles famDiv.C + vectorFamDiv.C \*---------------------------------------------------------------------------*/ @@ -89,6 +90,9 @@ namespace fam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Template specialisation +#include "vectorFamDiv.H" + #ifdef NoRepository # include "famDiv.C" #endif diff --git a/src/finiteArea/finiteArea/fam/famNDiv.C b/src/finiteArea/finiteArea/fam/famNDiv.C new file mode 100644 index 000000000..33c55f3fa --- /dev/null +++ b/src/finiteArea/finiteArea/fam/famNDiv.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "famNDiv.H" +#include "faMesh.H" +#include "faMatrix.H" +#include "faConvectionScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp > +ndiv +( + const edgeScalarField& flux, + GeometricField& vf, + const word& name +) +{ + return fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().famDiv(flux, vf);//TODO calculate normal +} + +template +tmp > +ndiv +( + const tmp& tflux, + GeometricField& vf, + const word& name +) +{ + tmp > Div(fam::ndiv(tflux(), vf, name)); + tflux.clear(); + return Div; +} + + +template +tmp > +ndiv +( + const edgeScalarField& flux, + GeometricField& vf +) +{ + return fam::ndiv(flux, vf, "div("+flux.name()+','+vf.name()+')'); +} + +template +tmp > +ndiv +( + const tmp& tflux, + GeometricField& vf +) +{ + tmp > Div(fam::ndiv(tflux(), vf)); + tflux.clear(); + return Div; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fam/famNDiv.H b/src/finiteArea/finiteArea/fam/famNDiv.H new file mode 100644 index 000000000..0abf49e54 --- /dev/null +++ b/src/finiteArea/finiteArea/fam/famNDiv.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Namespace + fam + +Description + Calculate the matrix for the divergence of the given field and flux. + +SourceFiles + famDiv.C + +\*---------------------------------------------------------------------------*/ + +#ifndef famNDiv_H +#define famNDiv_H + +#include "areaFieldsFwd.H" +#include "edgeFieldsFwd.H" +#include "edgeInterpolationScheme.H" +#include "faMatrix.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace fam functions Declaration +\*---------------------------------------------------------------------------*/ + +namespace fam +{ + template + tmp > ndiv + ( + const edgeScalarField&, + GeometricField&, + const word& name + ); + + template + tmp > ndiv + ( + const tmp&, + GeometricField&, + const word& name + ); + + template + tmp > ndiv + ( + const edgeScalarField&, + GeometricField& + ); + + template + tmp > ndiv + ( + const tmp&, + GeometricField& + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "famNDiv.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fam/vectorFamDiv.C b/src/finiteArea/finiteArea/fam/vectorFamDiv.C new file mode 100644 index 000000000..c3b941a3e --- /dev/null +++ b/src/finiteArea/finiteArea/fam/vectorFamDiv.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "vectorFamDiv.H" +#include "faMesh.H" +#include "faMatrix.H" +#include "faConvectionScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<> +tmp > +div +( + const edgeScalarField& flux, + const GeometricField& vf, + const word& name +) +{ + return fa::convectionScheme::New + ( + vf.mesh(), + flux, + vf.mesh().schemesDict().divScheme(name) + )().famDiv(flux, vf); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/fam/vectorFamDiv.H b/src/finiteArea/finiteArea/fam/vectorFamDiv.H new file mode 100644 index 000000000..53b6d7eb4 --- /dev/null +++ b/src/finiteArea/finiteArea/fam/vectorFamDiv.H @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Typedef + Foam::fam + +Description + Specialisation of fam div for a flux. + +SourceFiles + vectorFamDiv.C + +\*---------------------------------------------------------------------------*/ + +#ifndef vectorFamDiv_H +#define vectorFamDiv_H + +#include "famDiv.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace fam +{ + +/*---------------------------------------------------------------------------*\ + Namespace fam functions Declaration +\*---------------------------------------------------------------------------*/ + +template<> +tmp > +div +( + const edgeScalarField& flux, + const GeometricField& vf, + const word& name +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.C b/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.C index 6ca7b9db2..c9fef3221 100644 --- a/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.C +++ b/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.C @@ -66,12 +66,7 @@ gaussGrad::grad GeometricField& gGrad = tgGrad(); - gGrad -= vsf*fac::edgeIntegrate(vsf.mesh().Le()); - - // Remove component of gradient normal to surface (area) - const areaVectorField& n = vsf.mesh().faceAreaNormals(); - - gGrad -= n*(n & gGrad); + // Removed for consistencty. Matthias Rauter, 6/Dec/2016 gGrad.correctBoundaryConditions(); gGrad.rename("grad(" + vsf.name() + ')'); @@ -96,15 +91,9 @@ void gaussGrad::correctBoundaryConditions if (!vsf.boundaryField()[patchI].coupled()) { vectorField m = - vsf.mesh().Le().boundaryField()[patchI] - /vsf.mesh().magLe().boundaryField()[patchI]; + vsf.mesh().Le().boundaryField()[patchI]/ + vsf.mesh().magLe().boundaryField()[patchI]; - // Zeljko Tukovic -// gGrad.boundaryField()[patchI] = -// m*vsf.boundaryField()[patchI].snGrad(); - - //HJ Not sure: should this be a complete correction or just the - // tangential part? HJ, 24/Jul/2009 gGrad.boundaryField()[patchI] += m* ( vsf.boundaryField()[patchI].snGrad() diff --git a/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaGrad.C b/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaGrad.C index d9796d613..a910159e3 100644 --- a/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaGrad.C +++ b/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaGrad.C @@ -138,11 +138,8 @@ leastSquaresFaGrad::grad } } - // Remove component of gradient normal to surface (area) - const areaVectorField& n = vsf.mesh().faceAreaNormals(); - - lsGrad -= n*(n & lsGrad); + // Removed for consistencty. Matthias Rauter, 6/Dec/2016 lsGrad.correctBoundaryConditions(); gaussGrad::correctBoundaryConditions(vsf, lsGrad);