From 7c1ca1b9ea1b0481fc302a80e2920a2390045979 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 May 2017 14:33:58 +0100 Subject: [PATCH] Added missing overlap ggi enthalpy jump condition --- .../overlapGgiEnthalpyJumpFvPatchField.C | 165 +++++++++++++++ .../overlapGgiEnthalpyJumpFvPatchField.H | 196 ++++++++++++++++++ .../overlapGgiEnthalpyJumpFvPatchFields.C | 120 +++++++++++ .../overlapGgiEnthalpyJumpFvPatchFields.H | 58 ++++++ .../overlapGgiEnthalpyJumpFvPatchFieldsFwd.H | 60 ++++++ 5 files changed, 599 insertions(+) create mode 100644 src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.C create mode 100644 src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.H create mode 100644 src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.C create mode 100644 src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.H create mode 100644 src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFieldsFwd.H diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.C new file mode 100644 index 000000000..5ba8b29a1 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.C @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Author + Ilaria De Dominicis, General Electric Power, (March 2016) + +Contributor + Hrvoje Jasak, Wikki Ltd. + Gregor Cvijetic, FMENA Zagreb. + +GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved + +\*---------------------------------------------------------------------------*/ + +#include "overlapGgiEnthalpyJumpFvPatchField.H" +#include "IOmanip.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +overlapGgiEnthalpyJumpFvPatchField::overlapGgiEnthalpyJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + jumpOverlapGgiFvPatchField(p, iF), + rotating_(false), + jump_(this->size(), pTraits::zero) +{ +} + + +template +overlapGgiEnthalpyJumpFvPatchField::overlapGgiEnthalpyJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + jumpOverlapGgiFvPatchField(p, iF), + rotating_(dict.lookup("rotating")), + jump_(this->size(), pTraits::zero) +{ + if (dict.found("value")) + { + fvPatchField::operator= + ( + Field("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} + + +template +overlapGgiEnthalpyJumpFvPatchField::overlapGgiEnthalpyJumpFvPatchField +( + const overlapGgiEnthalpyJumpFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + jumpOverlapGgiFvPatchField(ptf, p, iF, mapper), + rotating_(ptf.rotating_), + jump_(ptf.jump_, mapper) +{ +} + + +template +overlapGgiEnthalpyJumpFvPatchField::overlapGgiEnthalpyJumpFvPatchField +( + const overlapGgiEnthalpyJumpFvPatchField& ptf, + const DimensionedField& iF +) +: + jumpOverlapGgiFvPatchField(ptf, iF), + rotating_(ptf.rotating_), + jump_(ptf.jump_) +{ +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void overlapGgiEnthalpyJumpFvPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + jumpOverlapGgiFvPatchField::autoMap(m); + jump_.autoMap(m); +} + + +template +void overlapGgiEnthalpyJumpFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& addr +) +{ + jumpOverlapGgiFvPatchField::rmap(ptf, addr); + + // rmap jump + const overlapGgiEnthalpyJumpFvPatchField& ejPtf = + refCast >(ptf); + + jump_.rmap(ejPtf.jump_, addr); +} + + +template +void overlapGgiEnthalpyJumpFvPatchField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeKeyword("patchType") + << overlapGgiFvPatch::typeName << token::END_STATEMENT << nl; + os.writeKeyword("rotating") + << rotating_ << token::END_STATEMENT << nl; + + IOstream::streamFormat fmt0 = os.format(IOstream::ASCII); + os.format(fmt0); + + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.H new file mode 100644 index 000000000..d57683f00 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchField.H @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::overlapGgiEnthalpyJumpFvPatchField + +Description + Foam::overlapGgiEnthalpyJumpFvPatchField + +Author + Ilaria De Dominicis, General Electric Power, (March 2016) + +Contributor + Hrvoje Jasak, Wikki Ltd. + Gregor Cvijetic, FMENA Zagreb. + +GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved + +SourceFiles + overlapGgiEnthalpyJumpFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef overlapGgiEnthalpyJumpFvPatchField_H +#define overlapGgiEnthalpyJumpFvPatchField_H + +#include "jumpOverlapGgiFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class overlapGgiEnthalpyJumpFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class overlapGgiEnthalpyJumpFvPatchField +: + public jumpOverlapGgiFvPatchField +{ + // Private data + + //- Is the patch on the rotating side? + Switch rotating_; + + //- "jump" field + Field jump_; + + +public: + + //- Runtime type information + TypeName("overlapGgiEnthalpyJump"); + + +// Constructors + + //- Construct from patch and internal field + overlapGgiEnthalpyJumpFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + overlapGgiEnthalpyJumpFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given overlapGgiEnthalpyJumpFvPatchField + // onto a new patch + overlapGgiEnthalpyJumpFvPatchField + ( + const overlapGgiEnthalpyJumpFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + overlapGgiEnthalpyJumpFvPatchField + ( + const overlapGgiEnthalpyJumpFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new overlapGgiEnthalpyJumpFvPatchField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new overlapGgiEnthalpyJumpFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Is the patch rotating + bool rotating() const + { + return rotating_; + } + + //- Return the "jump" across the patch as a "half" field + virtual tmp > jump() const + { + return jump_; + } + + + // 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 + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +//- Specialisation of the jump-condition for the enthalpy +template<> +void overlapGgiEnthalpyJumpFvPatchField::updateCoeffs(); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "overlapGgiEnthalpyJumpFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.C b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.C new file mode 100644 index 000000000..ef8278cec --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Author + Ilaria De Dominicis, General Electric Power, (March 2016) + +Contributor + Hrvoje Jasak, Wikki Ltd. + Gregor Cvijetic, FMENA Zagreb. + +GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved + +\*---------------------------------------------------------------------------*/ + +#include "overlapGgiEnthalpyJumpFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeTemplatePatchTypeField + ( + fvPatchScalarField, + overlapGgiEnthalpyJumpFvPatchScalarField + ); +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<> +void Foam::overlapGgiEnthalpyJumpFvPatchField::updateCoeffs() +{ + if (updated()) + { + return; + } + + + // Get access to relative and rotational velocity + const word URotName("URot"); + const word UThetaName("UTheta"); + + jump_ = 0; + + if + ( + !this->db().objectRegistry::found(URotName) + || !this->db().objectRegistry::found(UThetaName) + ) + { + // Velocities not available, do not update + InfoIn + ( + "void gradientEnthalpyFvPatchScalarField::" + "updateCoeffs(const vectorField& Up)" + ) << "Velocity fields " << URotName << " or " + << UThetaName << " not found. " + << "Performing enthalpy value update" << endl; + + jump_ = 0; + } + else + { + const fvPatchVectorField& URotp = + lookupPatchField(URotName); + + const fvPatchScalarField& UThetap = + lookupPatchField(UThetaName); + + if (rotating_) + { + // We can either make jump_ on neighbour field and interpolate (in + // jumpOverlapGgi) or interpolate first, then add jump_ for + // internalField + const scalarField UThetaIn = UThetap.patchInternalField(); + + jump_ = - ( + mag(UThetaIn) + *mag(URotp.patchInternalField()) + ); + } + else + { + const scalarField UThetaIn = UThetap.patchNeighbourField(); + + jump_ = ( + mag(UThetaIn) + *mag(URotp.patchNeighbourField()) + ); + + } + } + + jumpOverlapGgiFvPatchField::updateCoeffs(); +} + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.H b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.H new file mode 100644 index 000000000..424295e15 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFields.H @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Author + Ilaria De Dominicis, General Electric Power, (March 2016) + +Contributor + Hrvoje Jasak, Wikki Ltd. + Gregor Cvijetic, FMENA Zagreb. + +GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved + +\*---------------------------------------------------------------------------*/ + +#ifndef overlapGgiEnthalpyJumpFvPatchFields_H +#define overlapGgiEnthalpyJumpFvPatchFields_H + +#include "overlapGgiEnthalpyJumpFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(overlapGgiEnthalpyJump) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFieldsFwd.H b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFieldsFwd.H new file mode 100644 index 000000000..6d1c76f81 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/overlapGgiEnthalpyJump/overlapGgiEnthalpyJumpFvPatchFieldsFwd.H @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Author + Ilaria De Dominicis, General Electric Power, (March 2016) + +Contributor + Hrvoje Jasak, Wikki Ltd. + Gregor Cvijetic, FMENA Zagreb. + +GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved + +\*---------------------------------------------------------------------------*/ + +#ifndef overlapGgiEnthalpyJumpFvPatchFieldsFwd_H +#define overlapGgiEnthalpyJumpFvPatchFieldsFwd_H + +#include "fvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class overlapGgiEnthalpyJumpFvPatchField; + +makePatchTypeFieldTypedefs(overlapGgiEnthalpyJump) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //