From c0c7199441f561d726275a3c4334fa41b4708465 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 11 May 2010 18:48:00 +0100 Subject: [PATCH] timeVaryingUniformInletOutletFvPatchField: New BC. --- src/finiteVolume/Make/files | 1 + .../timeVaryingUniformInletOutletFvPatchField.C | 139 ++++++++++++++++ .../timeVaryingUniformInletOutletFvPatchField.H | 182 +++++++++++++++++++++ .../timeVaryingUniformInletOutletFvPatchFields.C | 45 +++++ .../timeVaryingUniformInletOutletFvPatchFields.H | 50 ++++++ ...timeVaryingUniformInletOutletFvPatchFieldsFwd.H | 51 ++++++ 6 files changed, 468 insertions(+) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.H create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.H create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFieldsFwd.H diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 9c8d4102..07f73f52 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -143,6 +143,7 @@ $(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C $(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C +$(derivedFvPatchFields)/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.C $(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C $(derivedFvPatchFields)/timeVaryingMappedTotalPressure/timeVaryingMappedTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.C new file mode 100644 index 00000000..b277453f --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.C @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "timeVaryingUniformInletOutletFvPatchField.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::timeVaryingUniformInletOutletFvPatchField:: +timeVaryingUniformInletOutletFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + inletOutletFvPatchField(p, iF), + timeSeries_() +{} + + +template +Foam::timeVaryingUniformInletOutletFvPatchField:: +timeVaryingUniformInletOutletFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + inletOutletFvPatchField(p, iF), + timeSeries_(dict) +{ + this->refValue() = timeSeries_(this->db().time().timeOutputValue()); + this->refGrad() = pTraits::zero; + this->valueFraction() = 0.0; + + if (dict.found("value")) + { + fvPatchField::operator==(Field("value", dict, p.size())); + } + else + { + fvPatchField::operator=(this->refValue()); + } +} + + +template +Foam::timeVaryingUniformInletOutletFvPatchField:: +timeVaryingUniformInletOutletFvPatchField +( + const timeVaryingUniformInletOutletFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + inletOutletFvPatchField(ptf, p, iF, mapper), + timeSeries_(ptf.timeSeries_) +{} + + +template +Foam::timeVaryingUniformInletOutletFvPatchField:: +timeVaryingUniformInletOutletFvPatchField +( + const timeVaryingUniformInletOutletFvPatchField& ptf +) +: + inletOutletFvPatchField(ptf), + timeSeries_(ptf.timeSeries_) +{} + + +template +Foam::timeVaryingUniformInletOutletFvPatchField:: +timeVaryingUniformInletOutletFvPatchField +( + const timeVaryingUniformInletOutletFvPatchField& ptf, + const DimensionedField& iF +) +: + inletOutletFvPatchField(ptf, iF), + timeSeries_(ptf.timeSeries_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::timeVaryingUniformInletOutletFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + this->refValue() = timeSeries_(this->db().time().timeOutputValue()); + inletOutletFvPatchField::updateCoeffs(); +} + + +template +void Foam::timeVaryingUniformInletOutletFvPatchField::write +( + Ostream& os +) const +{ + fvPatchField::write(os); + timeSeries_.write(os); + this->writeEntry("value", os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.H new file mode 100644 index 00000000..f194aaaf --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchField.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::timeVaryingUniformInletOutletFvPatchField + +Description + A time-varying form of a uniform fixed value boundary condition. + + Example of the boundary condition specification: + @verbatim + inlet + { + type timeVaryingUniformInletOutlet; + fileName "$FOAM_CASE/time-series"; + outOfBounds clamp; // (error|warn|clamp|repeat) + } + @endverbatim + +Note + This class is derived directly from a inletOutlet patch rather than from + a uniformInletOutlet patch. + +See Also + Foam::interpolationTable and Foam::inletOutletFvPatchField + +SourceFiles + timeVaryingUniformInletOutletFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformInletOutletFvPatchField_H +#define timeVaryingUniformInletOutletFvPatchField_H + +#include "inletOutletFvPatchField.H" +#include "interpolationTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class timeVaryingUniformInletOutletFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +template +class timeVaryingUniformInletOutletFvPatchField +: + public inletOutletFvPatchField +{ + // Private data + + //- The time series being used, including the bounding treatment + interpolationTable timeSeries_; + + +public: + + //- Runtime type information + TypeName("timeVaryingUniformInletOutlet"); + + + // Constructors + + //- Construct from patch and internal field + timeVaryingUniformInletOutletFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + timeVaryingUniformInletOutletFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patch field onto a new patch + timeVaryingUniformInletOutletFvPatchField + ( + const timeVaryingUniformInletOutletFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + timeVaryingUniformInletOutletFvPatchField + ( + const timeVaryingUniformInletOutletFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new timeVaryingUniformInletOutletFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + timeVaryingUniformInletOutletFvPatchField + ( + const timeVaryingUniformInletOutletFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new timeVaryingUniformInletOutletFvPatchField(*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 "timeVaryingUniformInletOutletFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.C new file mode 100644 index 00000000..3fb47baa --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.C @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "volFields.H" +#include "surfaceFields.H" +#include "timeVaryingUniformInletOutletFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(timeVaryingUniformInletOutlet); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.H new file mode 100644 index 00000000..4d1db54f --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFields.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformInletOutletFvPatchFields_H +#define timeVaryingUniformInletOutletFvPatchFields_H + +#include "timeVaryingUniformInletOutletFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(timeVaryingUniformInletOutlet) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFieldsFwd.H new file mode 100644 index 00000000..feab46e7 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingUniformInletOutlet/timeVaryingUniformInletOutletFvPatchFieldsFwd.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#ifndef timeVaryingUniformInletOutletFvPatchFieldsFwd_H +#define timeVaryingUniformInletOutletFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class timeVaryingUniformInletOutletFvPatchField; + +makePatchTypeFieldTypedefs(timeVaryingUniformInletOutlet); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // -- 2.11.4.GIT