From 28a3c54b9bfcbf846d3d5b581171322bd9047584 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 22 May 2018 11:53:22 +0100 Subject: [PATCH] Added block-coupled form of symmetry plane --- src/finiteVolume/Make/files | 2 + .../blockSymmPlaneFvPatchVectorField.C | 208 ++++++++++++++++++ .../blockSymmPlaneFvPatchVectorField.H | 202 +++++++++++++++++ 3 files changed, 412 insertions(+) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.H diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 33e3bb31d..dbc7cacd5 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -188,6 +188,8 @@ $(derivedFvPatchFields)/waveTransmissiveInlet/waveTransmissiveInletFvPatchFields $(derivedFvPatchFields)/noSlipWall/noSlipWallFvPatchVectorField.C $(derivedFvPatchFields)/noSlipMovingWall/noSlipMovingWallFvPatchVectorField.C +$(derivedFvPatchFields)/blockSymmPlane/blockSymmPlaneFvPatchVectorField.C + fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.C new file mode 100644 index 000000000..659f91dfb --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.C @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "blockSymmPlaneFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blockSymmPlaneFvPatchVectorField::blockSymmPlaneFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + basicSymmetryFvPatchVectorField(p, iF) +{} + + +Foam::blockSymmPlaneFvPatchVectorField::blockSymmPlaneFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + basicSymmetryFvPatchVectorField(p, iF, dict) +{} + + +Foam::blockSymmPlaneFvPatchVectorField::blockSymmPlaneFvPatchVectorField +( + const blockSymmPlaneFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + basicSymmetryFvPatchVectorField(ptf, p, iF, mapper) +{} + + +Foam::blockSymmPlaneFvPatchVectorField::blockSymmPlaneFvPatchVectorField +( + const blockSymmPlaneFvPatchVectorField& ptf +) +: + basicSymmetryFvPatchVectorField(ptf) +{} + + +Foam::blockSymmPlaneFvPatchVectorField::blockSymmPlaneFvPatchVectorField +( + const blockSymmPlaneFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + basicSymmetryFvPatchVectorField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// Disabled: see coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::valueInternalCoeffs +( + const tmp& +) const +{ + return tmp(new vectorField(this->size(), vector::zero)); +} + + +// Disabled: see coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::valueBoundaryCoeffs +( + const tmp& +) const +{ + return tmp(new vectorField(this->size(), vector::zero)); +} + + +// Disabled: see coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::gradientInternalCoeffs() const +{ + return tmp(new vectorField(this->size(), vector::zero)); +} + + +// Disabled: see coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::gradientBoundaryCoeffs() const +{ + return tmp(new vectorField(this->size(), vector::zero)); +} + + +// Coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::blockValueInternalCoeffs +( + const tmp& +) const +{ + tmp tcoeff + ( + new vectorCoeffField(this->size()) + ); + + tcoeff().asSquare() = I - this->patch().nf()*this->patch().nf(); + + return tcoeff; +} + + +// Coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::blockValueBoundaryCoeffs +( + const tmp& +) const +{ + return + *this + - transform + ( + I - sqr(this->patch().nf()), + this->patchInternalField() + ); +} + + +// Coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::blockGradientInternalCoeffs() const +{ + tmp tcoeff + ( + new vectorCoeffField(this->size()) + ); + + tcoeff().asSquare() = + -this->patch().deltaCoeffs()*this->patch().nf()*this->patch().nf(); + + return tcoeff; +} + + +// Coupled coefficient +Foam::tmp +Foam::blockSymmPlaneFvPatchVectorField::blockGradientBoundaryCoeffs() const +{ + return + ( + sqr(this->patch().nf()) + & ( + this->snGrad() + - transform + ( + -this->patch().deltaCoeffs()*sqr(this->patch().nf()), + this->patchInternalField() + ) + ) + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +makePatchTypeField +( + fvPatchVectorField, + blockSymmPlaneFvPatchVectorField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.H new file mode 100644 index 000000000..365d5959b --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/blockSymmPlane/blockSymmPlaneFvPatchVectorField.H @@ -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 . + +Class + Foam::blockSymmPlaneFvPatchVectorField + +Description + Block-coupled symmetry plane. Experimental + +Author + Hrvoje Jasak, Wikki Ltd, All rights reserved + +SourceFiles + blockSymmPlaneFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef blockSymmPlaneFvPatchVectorField_H +#define blockSymmPlaneFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "basicSymmetryFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class blockSymmPlaneFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class blockSymmPlaneFvPatchVectorField +: + public basicSymmetryFvPatchVectorField +{ +public: + + //- Runtime type information + TypeName("blockSymmPlane"); + + + // Constructors + + //- Construct from patch and internal field + blockSymmPlaneFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + blockSymmPlaneFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // blockSymmPlaneFvPatchVectorField onto a new patch + blockSymmPlaneFvPatchVectorField + ( + const blockSymmPlaneFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + blockSymmPlaneFvPatchVectorField + ( + const blockSymmPlaneFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new blockSymmPlaneFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + blockSymmPlaneFvPatchVectorField + ( + const blockSymmPlaneFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new blockSymmPlaneFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return true if this patch field is block-coupled in the + // boundary condition, ie. if the coupling coefficient is a + // rank x rank implicit block + virtual bool blockCoupled() const + { + return true; + } + + + // Evaluation functions + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the value of this patchField with given weights + // Disabled. HJ, 28/Mar/2016 + virtual tmp valueInternalCoeffs + ( + const tmp& + ) const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the value of this patchField with given weights + // Disabled. HJ, 28/Mar/2016 + virtual tmp valueBoundaryCoeffs + ( + const tmp& + ) const; + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + // Disabled. HJ, 28/Mar/2016 + virtual tmp gradientInternalCoeffs() const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + // Disabled. HJ, 28/Mar/2016 + virtual tmp gradientBoundaryCoeffs() const; + + + // Block-coupled coefficients + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp blockValueInternalCoeffs + ( + const tmp& + ) const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp blockValueBoundaryCoeffs + ( + const tmp& + ) const; + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp + blockGradientInternalCoeffs() const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp blockGradientBoundaryCoeffs() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //