ENH: Added new uniformFixedGradient boundary condition

This commit is contained in:
andy
2013-05-03 17:30:31 +01:00
parent 8b52b700d0
commit 476f19091a
6 changed files with 508 additions and 1 deletions

View File

@ -181,6 +181,7 @@ $(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVe
$(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C $(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C
$(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/uniformFixedGradient/uniformFixedGradientFvPatchFields.C
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C $(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C
$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C
@ -403,5 +404,4 @@ $(SRF)/SRFModel/rpm/rpm.C
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C $(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
$(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C $(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "uniformFixedGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedGradientFvPatchField<Type>(p, iF),
uniformGradient_()
{}
template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& fld
)
:
fixedGradientFvPatchField<Type>(p, iF, fld),
uniformGradient_()
{}
template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchField<Type>(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<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchField<Type>(p, iF),
uniformGradient_(DataEntry<Type>::New("uniformGradient", dict))
{
if (dict.found("gradient"))
{
this->gradient() = Field<Type>("gradient", dict, p.size());
}
else
{
const scalar t = this->db().time().timeOutputValue();
this->gradient() = uniformGradient_->value(t);
}
}
template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>& ptf
)
:
fixedGradientFvPatchField<Type>(ptf),
uniformGradient_
(
ptf.uniformGradient_.valid()
? ptf.uniformGradient_().clone().ptr()
: NULL
)
{}
template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedGradientFvPatchField<Type>(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<class Type>
void uniformFixedGradientFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalar t = this->db().time().timeOutputValue();
this->gradient() = uniformGradient_->value(t);
fixedGradientFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void uniformFixedGradientFvPatchField<Type>::write(Ostream& os) const
{
fixedGradientFvPatchField<Type>::write(os);
uniformGradient_->writeData(os);
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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 Type>
class uniformFixedGradientFvPatchField
:
public fixedGradientFvPatchField<Type>
{
// Private data
//- Gradient
autoPtr<DataEntry<Type> > uniformGradient_;
public:
//- Runtime type information
TypeName("uniformFixedGradient");
// Constructors
//- Construct from patch and internal field
uniformFixedGradientFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
uniformFixedGradientFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>& fld
);
//- Construct from patch, internal field and dictionary
uniformFixedGradientFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given uniformFixedGradientFvPatchField
// onto a new patch
uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new uniformFixedGradientFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
uniformFixedGradientFvPatchField
(
const uniformFixedGradientFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new uniformFixedGradientFvPatchField<Type>(*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
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "uniformFixedGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(uniformFixedGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef uniformFixedGradientFvPatchFields_H
#define uniformFixedGradientFvPatchFields_H
#include "uniformFixedGradientFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(uniformFixedGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef uniformFixedGradientFvPatchFieldsFwd_H
#define uniformFixedGradientFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class uniformFixedGradientFvPatchField;
makePatchTypeFieldTypedefs(uniform);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //