diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index dd37136533..3d068a4eee 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -181,6 +181,7 @@ $(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVe $(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C +$(derivedFvPatchFields)/uniformFixedGradient/uniformFixedGradientFvPatchFields.C $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C @@ -403,5 +404,4 @@ $(SRF)/SRFModel/rpm/rpm.C $(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C $(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C - LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C new file mode 100644 index 0000000000..877e413dbe --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "uniformFixedGradientFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedGradientFvPatchField(p, iF), + uniformGradient_() +{} + + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const Field& fld +) +: + fixedGradientFvPatchField(p, iF, fld), + uniformGradient_() +{} + + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedGradientFvPatchField(ptf, p, iF, mapper), + uniformGradient_(ptf.uniformGradient_().clone().ptr()) +{ + // For safety re-evaluate + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); +} + + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedGradientFvPatchField(p, iF), + uniformGradient_(DataEntry::New("uniformGradient", dict)) +{ + if (dict.found("gradient")) + { + this->gradient() = Field("gradient", dict, p.size()); + } + else + { + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); + } +} + + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField& ptf +) +: + fixedGradientFvPatchField(ptf), + uniformGradient_ + ( + ptf.uniformGradient_.valid() + ? ptf.uniformGradient_().clone().ptr() + : NULL + ) +{} + + +template +uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField +( + const uniformFixedGradientFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedGradientFvPatchField(ptf, iF), + uniformGradient_ + ( + ptf.uniformGradient_.valid() + ? ptf.uniformGradient_().clone().ptr() + : NULL + ) +{ + // For safety re-evaluate + const scalar t = this->db().time().timeOutputValue(); + + if (ptf.uniformGradient_.valid()) + { + this->gradient() = uniformGradient_->value(t); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void uniformFixedGradientFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const scalar t = this->db().time().timeOutputValue(); + this->gradient() = uniformGradient_->value(t); + + fixedGradientFvPatchField::updateCoeffs(); +} + + +template +void uniformFixedGradientFvPatchField::write(Ostream& os) const +{ + fixedGradientFvPatchField::write(os); + uniformGradient_->writeData(os); + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H new file mode 100644 index 0000000000..5659297fec --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 3 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, see . + +Class + Foam::uniformFixedGradientFvPatchField + +Group + grpGenericBoundaryConditions + +Description + This boundary condition provides a uniform fixed gradient condition. + + \heading Patch usage + + \table + Property | Description | Required | Default value + uniformGradient | uniform gradient | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type uniformFixedGradient; + uniformGradient constant 0.2; + } + \endverbatim + +Note + The uniformGradient entry is a DataEntry type, able to describe time + varying functions. The example above gives the usage for supplying a + constant value. + +SeeAlso + Foam::DataEntry + Foam::fixedGradientFvPatchField + +SourceFiles + uniformFixedGradientFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchField_H +#define uniformFixedGradientFvPatchField_H + +#include "fixedGradientFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class uniformFixedGradientFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class uniformFixedGradientFvPatchField +: + public fixedGradientFvPatchField +{ + // Private data + + //- Gradient + autoPtr > uniformGradient_; + + +public: + + //- Runtime type information + TypeName("uniformFixedGradient"); + + + // Constructors + + //- Construct from patch and internal field + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch and internal field and patch field + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const Field& fld + ); + + //- Construct from patch, internal field and dictionary + uniformFixedGradientFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given uniformFixedGradientFvPatchField + // onto a new patch + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new uniformFixedGradientFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + uniformFixedGradientFvPatchField + ( + const uniformFixedGradientFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new uniformFixedGradientFvPatchField(*this, iF) + ); + } + + + // Member functions + + + // 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 "uniformFixedGradientFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C new file mode 100644 index 0000000000..a0b72644ac --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "uniformFixedGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(uniformFixedGradient); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H new file mode 100644 index 0000000000..83560205a2 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchFields_H +#define uniformFixedGradientFvPatchFields_H + +#include "uniformFixedGradientFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(uniformFixedGradient); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H new file mode 100644 index 0000000000..9eaa07e2a6 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformFixedGradientFvPatchFieldsFwd_H +#define uniformFixedGradientFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class uniformFixedGradientFvPatchField; + +makePatchTypeFieldTypedefs(uniform); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //