From b77d52e39babc7510fa6cb3c2dda2b9a225bd7c1 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 13 Dec 2017 18:58:31 +0000 Subject: [PATCH] Added constrained types for immersedBoundary patch --- .../immersedBoundary/Make/files | 3 +- .../immersedBoundaryFvPatchField.C | 227 ++++++++++++++++++ .../immersedBoundaryFvPatchField.H | 200 +++++++++++++++ .../immersedBoundaryFvPatchFields.C | 44 ++++ .../immersedBoundaryFvPatchFields.H | 49 ++++ .../immersedBoundaryFvPatchFieldsFwd.H | 51 ++++ .../immersedBoundaryFvsPatchField.C | 146 ++++++++++- .../immersedBoundaryFvsPatchField.H | 48 +++- .../immersedBoundaryFvsPatchFields.C | 1 - .../mixedIbFvPatchField/mixedIbFvPatchField.C | 9 +- .../mixedIbFvPatchField/mixedIbFvPatchField.H | 14 +- 11 files changed, 760 insertions(+), 32 deletions(-) create mode 100644 src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.C create mode 100644 src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.H create mode 100644 src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.C create mode 100644 src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.H create mode 100644 src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFieldsFwd.H diff --git a/src/immersedBoundary/immersedBoundary/Make/files b/src/immersedBoundary/immersedBoundary/Make/files index 02ebb6426..22b990195 100644 --- a/src/immersedBoundary/immersedBoundary/Make/files +++ b/src/immersedBoundary/immersedBoundary/Make/files @@ -4,7 +4,8 @@ immersedPoly/distanceFunctions/triSurfaceDistance/triSurfaceDistance.C immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C immersedBoundaryPointPatch/immersedBoundaryPointPatch.C immersedBoundaryFvPatch/immersedBoundaryFvPatch.C +immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.C +immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C mixedIbFvPatchField/mixedIbFvPatchFields.C -/* immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C */ LIB = $(FOAM_LIBBIN)/libimmersedBoundary diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.C new file mode 100644 index 000000000..3f68104cb --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.C @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "immersedBoundaryFvPatchField.H" +#include "fvPatchFieldMapper.H" +#include "fvMatrix.H" +#include "surfaceWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +immersedBoundaryFvPatchField::immersedBoundaryFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fvPatchField(p, iF), + ibPatch_(refCast(p)) +{} + + +template +immersedBoundaryFvPatchField::immersedBoundaryFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fvPatchField(p, iF), // Do not read mixed data + ibPatch_(refCast(p)) +{ + if (!isType(p)) + { + FatalIOErrorIn + ( + "immersedBoundaryFvPatchField::" + "immersedBoundaryFvPatchField\n" + "(\n" + " const fvPatch& p,\n" + " const Field& field,\n" + " const dictionary& dict\n" + ")\n", + dict + ) << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + Field::operator=(this->patchInternalField()); +} + + +template +immersedBoundaryFvPatchField::immersedBoundaryFvPatchField +( + const immersedBoundaryFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fvPatchField(p, iF), // Do not map base data + ibPatch_(refCast(p)) +{ + // Note: NO MAPPING. Fields are created on the immersed boundary + // HJ, 12/Apr/2012 + if (!isType(p)) + { + FatalErrorIn + ( + "immersedBoundaryFvPatchField::" + "immersedBoundaryFvPatchField\n" + "(\n" + " const immersedBoundaryFvPatchField&,\n" + " const fvPatch& p,\n" + " const DimensionedField& iF,\n" + " const fvPatchFieldMapper& mapper\n" + ")\n" + ) << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + // On creation of the mapped field, the internal field is dummy and + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + Field::operator=(Field(p.size(), pTraits::zero)); +} + + +template +immersedBoundaryFvPatchField::immersedBoundaryFvPatchField +( + const immersedBoundaryFvPatchField& ptf +) +: + fvPatchField(ptf), + ibPatch_(ptf.ibPatch()) +{} + + +template +immersedBoundaryFvPatchField::immersedBoundaryFvPatchField +( + const immersedBoundaryFvPatchField& ptf, + const DimensionedField& iF +) +: + fvPatchField(ptf, iF), + ibPatch_(ptf.ibPatch()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void immersedBoundaryFvPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + // Use internal values + Field::operator=(this->patchInternalField()); +} + + +template +void immersedBoundaryFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& +) +{ + // Use internal values + Field::operator=(this->patchInternalField()); +} + + +template +void immersedBoundaryFvPatchField::evaluate +( + const Pstream::commsTypes +) +{ + // Use internal values + Field::operator=(this->patchInternalField()); + + fvPatchField::evaluate(); +} + + +template +void immersedBoundaryFvPatchField::write(Ostream& os) const +{ + // Resolve post-processing issues. HJ, 1/Dec/2017 + fvPatchField::write(os); + + // The value entry needs to be written with zero size + Field::null().writeEntry("value", os); + + // Write VTK on master only + if (Pstream::master()) + { + // Add parallel reduction of all faces and data to proc 0 + // and write the whola patch together + + // Write immersed boundary data as a vtk file + autoPtr > writerPtr = + surfaceWriter::New("vtk"); + + // Get the intersected patch + const standAlonePatch& ts = ibPatch_.ibPolyPatch().ibPatch(); + + writerPtr->write + ( + this->dimensionedInternalField().path(), + ibPatch_.name(), + ts.points(), + ts, + this->dimensionedInternalField().name(), + *this, + surfaceWriterBase::FACE_DATA + ); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.H b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.H new file mode 100644 index 000000000..afeaf210e --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchField.H @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::immersedBoundaryFvPatchField + +Description + Constrained immersedBoundaryFvPatchField of calculated functionality + with appropriate resizing on topo change or motion of the immersed surface. + The patch field shall take the values of intersected cells. + + Note: This patch field is used instead of the calculated type in the + immersedBoundaryFvPatch. It does not support discretisation. + For matrix operations, use the mixedIbFvPatchField. + +Author + Hrvoje Jasak + +SourceFiles + immersedBoundaryFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryFvPatchField_H +#define immersedBoundaryFvPatchField_H + +#include "fvPatchField.H" +#include "immersedBoundaryFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class immersedBoundaryFvPatchField +: + public fvPatchField +{ + // Private data + + //- Local reference to immersed boundary patch + const immersedBoundaryFvPatch& ibPatch_; + + +public: + + //- Runtime type information: constrained type + TypeName(immersedBoundaryFvPatch::typeName_()); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given immersedBoundaryFvPatchField + // onto a new patch + immersedBoundaryFvPatchField + ( + const immersedBoundaryFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryFvPatchField + ( + const immersedBoundaryFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new immersedBoundaryFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryFvPatchField + ( + const immersedBoundaryFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new immersedBoundaryFvPatchField(*this, iF) + ); + } + + + //- Destructor + virtual ~immersedBoundaryFvPatchField() + {} + + + // Member functions + + // Access + + //- Return reference to immersed boundary patch + const immersedBoundaryFvPatch& ibPatch() const + { + return ibPatch_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField&, + const labelList& + ); + + + // Evaluation functions + + //- Evaluate the patch field + virtual void evaluate + ( + const Pstream::commsTypes commsType = Pstream::blocking + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "immersedBoundaryFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.C new file mode 100644 index 000000000..312727469 --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "volFields.H" +#include "surfaceFields.H" +#include "immersedBoundaryFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(immersedBoundary); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.H b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.H new file mode 100644 index 000000000..1084dbc7f --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryFvPatchFields_H +#define immersedBoundaryFvPatchFields_H + +#include "immersedBoundaryFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(immersedBoundary) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFieldsFwd.H b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFieldsFwd.H new file mode 100644 index 000000000..9948e1491 --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatchField/immersedBoundaryFvPatchFieldsFwd.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryFvPatchFieldsFwd_H +#define immersedBoundaryFvPatchFieldsFwd_H + +#include "fvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class immersedBoundaryFvPatchField; + +makePatchTypeFieldTypedefs(immersedBoundary) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.C index 75bbe935d..954c84230 100644 --- a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.C +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.C @@ -32,6 +32,19 @@ License namespace Foam { +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void immersedBoundaryFvsPatchField::updateSize() +{ + if (this->patch().size() != this->size()) + { + Info<< "RESIZING immersedBoundaryFvsPatchField" << endl; + this->setSize(this->patch().size()); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -96,18 +109,47 @@ immersedBoundaryFvsPatchField::immersedBoundaryFvsPatchField {} -// template -// void immersedBoundaryFvsPatchField::operator= -// ( -// const fvPatchField& ptf -// ) -// { -// const immersedBoundaryFvPatchField& ibf = -// refCast > (ptf); +template +void immersedBoundaryFvsPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + Info<< "immersedBoundaryFvsPatchField::autoMap" << endl; + Field::operator= + ( + Field(this->patch().size(), pTraits::zero) + ); +} -// this->check(ptf); -// fvsPatchField::operator=(ptf); -// } + +template +void immersedBoundaryFvsPatchField::rmap +( + const fvsPatchField& ptf, + const labelList& addr +) +{ + Field::operator= + ( + Field(this->patch().size(), pTraits::zero) + ); +} + + +template +void immersedBoundaryFvsPatchField::evaluate +( + const Pstream::commsTypes +) +{ + Info<< "immersedBoundaryFvsPatchField::evaluate" << endl; + this->updateSize(); + Field::operator= + ( + Field(this->patch().size(), pTraits::zero) + ); +} template @@ -118,6 +160,88 @@ void immersedBoundaryFvsPatchField::write(Ostream& os) const } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +void immersedBoundaryFvsPatchField::operator= +( + const UList& ul +) +{ + this->updateSize(); + Field::operator=(ul); +} + + +template +void immersedBoundaryFvsPatchField::operator= +( + const fvsPatchField& ptf +) +{ + this->check(ptf); + this->updateSize(); + Field::operator=(ptf); +} + + +template +void immersedBoundaryFvsPatchField::operator= +( + const fvPatchField& ptf +) +{ + this->check(ptf); + this->updateSize(); + fvsPatchField::operator=(ptf); +} + + +template +void immersedBoundaryFvsPatchField::operator= +( + const Type& t +) +{ + this->updateSize(); + Field::operator=(t); +} + + +// Force an assignment, overriding fixedValue status +template +void immersedBoundaryFvsPatchField::operator== +( + const fvsPatchField& ptf +) +{ + this->updateSize(); + Field::operator=(ptf); +} + + +template +void immersedBoundaryFvsPatchField::operator== +( + const Field& tf +) +{ + this->updateSize(); + Field::operator=(tf); +} + + +template +void immersedBoundaryFvsPatchField::operator== +( + const Type& t +) +{ + this->updateSize(); + Field::operator=(t); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.H b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.H index 9fb58e9b1..00c293fb5 100644 --- a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.H +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchField.H @@ -66,6 +66,12 @@ class immersedBoundaryFvsPatchField const immersedBoundaryFvPatch& ibPatch_; + // Private Member Functions + + //- Update field size to match the patch + void updateSize(); + + public: //- Runtime type information @@ -141,6 +147,15 @@ public: // Member functions + // Access + + //- Return reference to immersed boundary patch + const immersedBoundaryFvPatch& ibPatch() const + { + return ibPatch_; + } + + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -152,18 +167,19 @@ public: //- Reverse map the given fvsPatchField onto this fvsPatchField virtual void rmap ( - const fvPatchField&, + const fvsPatchField&, const labelList& ); - // Member functions + // Evaluation functions + + //- Evaluate the patch field, sets Updated to false + virtual void evaluate + ( + const Pstream::commsTypes commsType = Pstream::blocking + ); - //- Return reference to immersed boundary patch - const immersedBoundaryFvPatch& ibPatch() const - { - return ibPatch_; - } //- Write virtual void write(Ostream&) const; @@ -171,7 +187,23 @@ public: // Member operators -// virtual void operator=(const fvPatchField&); + // Note: All assignment operators can check size and resize + // Other operators cannot, as they assume an existing valid value + // HJ, 13/Dec/2017 + + + virtual void operator=(const UList&); + virtual void operator=(const fvsPatchField&); + virtual void operator=(const fvPatchField&); + + virtual void operator=(const Type&); + + + // Force an assignment irrespective of form of patch + + virtual void operator==(const fvsPatchField&); + virtual void operator==(const Field&); + virtual void operator==(const Type&); }; diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C index 8b099ff54..1152cd89d 100644 --- a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvsPatchField/immersedBoundaryFvsPatchFields.C @@ -27,7 +27,6 @@ License #include "fvsPatchFields.H" #include "volFields.H" #include "surfaceFields.H" -#include "immersedBoundaryFvPatchFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.C b/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.C index 10ab431f9..80cf4b1c3 100644 --- a/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.C +++ b/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.C @@ -31,9 +31,6 @@ License namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -320,8 +317,10 @@ void mixedIbFvPatchField::evaluate template void mixedIbFvPatchField::write(Ostream& os) const { - // to resolve the post-processing issues. HJ, 1/Dec/2017 + // Resolve post-processing issues. HJ, 1/Dec/2017 fvPatchField::write(os); + os.writeKeyword("patchType") + << immersedBoundaryFvPatch::typeName << token::END_STATEMENT << nl; triValue_.writeEntry("triValue", os); triGrad_.writeEntry("triGradient", os); triValueFraction_.writeEntry("triValueFraction", os); @@ -338,7 +337,7 @@ void mixedIbFvPatchField::write(Ostream& os) const { // Add parallel reduction of all faces and data to proc 0 // and write the whola patch together - + // Write immersed boundary data as a vtk file autoPtr > writerPtr = surfaceWriter::New("vtk"); diff --git a/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.H b/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.H index 5ca923a03..f86f46a22 100644 --- a/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.H +++ b/src/immersedBoundary/immersedBoundary/mixedIbFvPatchField/mixedIbFvPatchField.H @@ -47,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class mixedIbFvPatchField Declaration + Class mixedIbFvPatchField Declaration \*---------------------------------------------------------------------------*/ template @@ -176,11 +176,13 @@ public: // Member functions - //- Return reference to immersed boundary patch - const immersedBoundaryFvPatch& ibPatch() const - { - return ibPatch_; - } + // Access + + //- Return reference to immersed boundary patch + const immersedBoundaryFvPatch& ibPatch() const + { + return ibPatch_; + } // Return defining fields