mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add time ramping to surfaceNormalFixedValue (#1407)
- alternatively can use uniformNormalFixedValue with PatchFunction1 specification and temporal ramping. TUT: add ramped example for simpleCar
This commit is contained in:
committed by
Andrew Heather
parent
de487f0f0a
commit
8d7b8043a4
@ -209,6 +209,7 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
|||||||
$(derivedFvPatchFields)/uniformInletOutlet/uniformInletOutletFvPatchFields.C
|
$(derivedFvPatchFields)/uniformInletOutlet/uniformInletOutletFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C
|
$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C
|
$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C
|
||||||
|
$(derivedFvPatchFields)/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C
|
$(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C
|
||||||
$(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -40,7 +40,8 @@ surfaceNormalFixedValueFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(p, iF),
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
refValue_(p.size())
|
refValue_(p.size()),
|
||||||
|
ramp_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -53,9 +54,22 @@ surfaceNormalFixedValueFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(p, iF, dict, false),
|
fixedValueFvPatchVectorField(p, iF, dict, false),
|
||||||
refValue_("refValue", dict, p.size())
|
refValue_("refValue", dict, p.size()),
|
||||||
|
ramp_(nullptr)
|
||||||
{
|
{
|
||||||
fvPatchVectorField::operator=(refValue_*patch().nf());
|
if (dict.found("ramp"))
|
||||||
|
{
|
||||||
|
ramp_ = Function1<scalar>::New("ramp", dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<vectorField> tvalues(refValue_*patch().nf());
|
||||||
|
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchVectorField::operator=(tvalues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,36 +83,47 @@ surfaceNormalFixedValueFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(p, iF),
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
refValue_(ptf.refValue_, mapper, pTraits<scalar>::zero)
|
refValue_(ptf.refValue_, mapper, pTraits<scalar>::zero),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
{
|
{
|
||||||
// Note: refValue_ will have default value of 0 for unmapped faces. This
|
// Note: refValue_ will have default value of 0 for unmapped faces. This
|
||||||
// can temporarily happen during e.g. redistributePar. We should not
|
// can temporarily happen during e.g. redistributePar. We should not
|
||||||
// access ptf.patch() instead since redistributePar has destroyed this
|
// access ptf.patch() instead since redistributePar has destroyed this
|
||||||
// at the time of mapping.
|
// at the time of mapping.
|
||||||
fvPatchVectorField::operator=(refValue_*patch().nf());
|
|
||||||
|
tmp<vectorField> tvalues(refValue_*patch().nf());
|
||||||
|
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchVectorField::operator=(tvalues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfaceNormalFixedValueFvPatchVectorField::
|
Foam::surfaceNormalFixedValueFvPatchVectorField::
|
||||||
surfaceNormalFixedValueFvPatchVectorField
|
surfaceNormalFixedValueFvPatchVectorField
|
||||||
(
|
(
|
||||||
const surfaceNormalFixedValueFvPatchVectorField& pivpvf
|
const surfaceNormalFixedValueFvPatchVectorField& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(pivpvf),
|
fixedValueFvPatchVectorField(ptf),
|
||||||
refValue_(pivpvf.refValue_)
|
refValue_(ptf.refValue_),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfaceNormalFixedValueFvPatchVectorField::
|
Foam::surfaceNormalFixedValueFvPatchVectorField::
|
||||||
surfaceNormalFixedValueFvPatchVectorField
|
surfaceNormalFixedValueFvPatchVectorField
|
||||||
(
|
(
|
||||||
const surfaceNormalFixedValueFvPatchVectorField& pivpvf,
|
const surfaceNormalFixedValueFvPatchVectorField& ptf,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(pivpvf, iF),
|
fixedValueFvPatchVectorField(ptf, iF),
|
||||||
refValue_(pivpvf.refValue_)
|
refValue_(ptf.refValue_),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -106,11 +131,11 @@ surfaceNormalFixedValueFvPatchVectorField
|
|||||||
|
|
||||||
void Foam::surfaceNormalFixedValueFvPatchVectorField::autoMap
|
void Foam::surfaceNormalFixedValueFvPatchVectorField::autoMap
|
||||||
(
|
(
|
||||||
const fvPatchFieldMapper& m
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fixedValueFvPatchVectorField::autoMap(m);
|
fixedValueFvPatchVectorField::autoMap(mapper);
|
||||||
refValue_.autoMap(m);
|
refValue_.autoMap(mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +161,14 @@ void Foam::surfaceNormalFixedValueFvPatchVectorField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fvPatchVectorField::operator=(refValue_*patch().nf());
|
tmp<vectorField> tvalues(refValue_*patch().nf());
|
||||||
|
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchVectorField::operator=(tvalues);
|
||||||
fvPatchVectorField::updateCoeffs();
|
fvPatchVectorField::updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +177,10 @@ void Foam::surfaceNormalFixedValueFvPatchVectorField::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
fvPatchVectorField::write(os);
|
fvPatchVectorField::write(os);
|
||||||
refValue_.writeEntry("refValue", os);
|
refValue_.writeEntry("refValue", os);
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
ramp_->writeData(os);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -35,8 +35,9 @@ Description
|
|||||||
|
|
||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default
|
||||||
refValue | reference value | yes |
|
refValue | reference value | yes |
|
||||||
|
ramp | time-based ramping | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -65,6 +66,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvPatchFields.H"
|
#include "fvPatchFields.H"
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -79,10 +81,13 @@ class surfaceNormalFixedValueFvPatchVectorField
|
|||||||
:
|
:
|
||||||
public fixedValueFvPatchVectorField
|
public fixedValueFvPatchVectorField
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
scalarField refValue_;
|
scalarField refValue_;
|
||||||
|
|
||||||
|
//- Optional time ramping
|
||||||
|
autoPtr<Function1<scalar>> ramp_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,205 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2019 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 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 "uniformNormalFixedValueFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::uniformNormalFixedValueFvPatchVectorField::
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
uniformValue_(nullptr),
|
||||||
|
ramp_(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::uniformNormalFixedValueFvPatchVectorField::
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF, dict, false),
|
||||||
|
uniformValue_(PatchFunction1<scalar>::New(p.patch(), "uniformValue", dict)),
|
||||||
|
ramp_(nullptr)
|
||||||
|
{
|
||||||
|
if (dict.found("ramp"))
|
||||||
|
{
|
||||||
|
ramp_ = Function1<scalar>::New("ramp", dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=
|
||||||
|
(
|
||||||
|
vectorField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::uniformNormalFixedValueFvPatchVectorField::
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF), // Don't map
|
||||||
|
uniformValue_(ptf.uniformValue_.clone(p.patch())),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
|
{
|
||||||
|
if (mapper.direct() && !mapper.hasUnmapped())
|
||||||
|
{
|
||||||
|
// Use mapping instead of re-evaluation
|
||||||
|
this->map(ptf, mapper);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Evaluate since value not mapped
|
||||||
|
this->evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::uniformNormalFixedValueFvPatchVectorField::
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf),
|
||||||
|
uniformValue_(ptf.uniformValue_.clone(this->patch().patch())),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::uniformNormalFixedValueFvPatchVectorField::
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField& ptf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf, iF),
|
||||||
|
uniformValue_(ptf.uniformValue_.clone(this->patch().patch())),
|
||||||
|
ramp_(ptf.ramp_.clone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::uniformNormalFixedValueFvPatchVectorField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchVectorField::autoMap(mapper);
|
||||||
|
uniformValue_().autoMap(mapper);
|
||||||
|
|
||||||
|
if (uniformValue_().constant())
|
||||||
|
{
|
||||||
|
// If mapper is not dependent on time we're ok to evaluate
|
||||||
|
this->evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::uniformNormalFixedValueFvPatchVectorField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchVectorField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchVectorField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField& tiptf =
|
||||||
|
refCast<const uniformNormalFixedValueFvPatchVectorField>(ptf);
|
||||||
|
|
||||||
|
uniformValue_().rmap(tiptf.uniformValue_(), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::uniformNormalFixedValueFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalar t = this->db().time().timeOutputValue();
|
||||||
|
|
||||||
|
tmp<vectorField> tvalues(uniformValue_->value(t)*patch().nf());
|
||||||
|
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
tvalues.ref() *= ramp_->value(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchVectorField::operator=(tvalues);
|
||||||
|
fvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::uniformNormalFixedValueFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
uniformValue_->writeData(os);
|
||||||
|
if (ramp_)
|
||||||
|
{
|
||||||
|
ramp_->writeData(os);
|
||||||
|
}
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,203 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2019 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 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::uniformNormalFixedValueFvPatchVectorField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpGenericBoundaryConditions grpInletBoundaryConditions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a uniform surface-normal
|
||||||
|
vector boundary condition by its magnitude.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
uniformValue | uniform value | yes |
|
||||||
|
ramp | time-based ramping | no |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
type uniformNormalFixedValue;
|
||||||
|
uniformValue constant -10; // 10 INTO the domain
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
Sign conventions:
|
||||||
|
- the value is positive for outward-pointing vectors
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types
|
||||||
|
Foam::fixedValueFvPatchField
|
||||||
|
Foam::surfaceNormalFixedValueFvPatchVectorField
|
||||||
|
Foam::uniformFixedValueFvPatchVectorField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
uniformNormalFixedValueFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef uniformNormalFixedValueFvPatchVectorField_H
|
||||||
|
#define uniformNormalFixedValueFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "PatchFunction1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class uniformNormalFixedValueFvPatchVectorField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class uniformNormalFixedValueFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
autoPtr<PatchFunction1<scalar>> uniformValue_;
|
||||||
|
|
||||||
|
//- Optional time ramping
|
||||||
|
autoPtr<Function1<scalar>> ramp_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("uniformNormalFixedValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// uniformNormalFixedValueFvPatchVectorField
|
||||||
|
// onto a new patch
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new uniformNormalFixedValueFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
const uniformNormalFixedValueFvPatchVectorField&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchVectorField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new uniformNormalFixedValueFvPatchVectorField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// 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 fvPatchVectorField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation Functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -18,12 +18,42 @@ dimensions [0 1 -1 0 0 0 0];
|
|||||||
|
|
||||||
internalField uniform (10 0 0);
|
internalField uniform (10 0 0);
|
||||||
|
|
||||||
|
// Surface normal with time ramping
|
||||||
|
intakeType1
|
||||||
|
{
|
||||||
|
type surfaceNormalFixedValue;
|
||||||
|
refValue uniform 1.2;
|
||||||
|
ramp table ((0 0) (10 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uniform surface normal with Function1 for ramping
|
||||||
|
intakeType2
|
||||||
|
{
|
||||||
|
type uniformNormalFixedValue;
|
||||||
|
uniformValue table ((0 0) (10 1.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uniform surface normal with time ramping
|
||||||
|
intakeType3
|
||||||
|
{
|
||||||
|
// Or directly with uniform value (ramping also possible)
|
||||||
|
type uniformNormalFixedValue;
|
||||||
|
uniformValue constant 1.2;
|
||||||
|
ramp table ((0 0) (10 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value uniform (10 0 0);
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
airIntake
|
||||||
|
{
|
||||||
|
$intakeType1;
|
||||||
}
|
}
|
||||||
|
|
||||||
outlet
|
outlet
|
||||||
@ -44,4 +74,8 @@ boundaryField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#remove "intakeType.*"
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,40 +24,27 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value uniform 0.125;
|
value $internalField;
|
||||||
}
|
}
|
||||||
outlet
|
|
||||||
{
|
"(body|upperWall|lowerWall)"
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
upperWall
|
|
||||||
{
|
{
|
||||||
type epsilonWallFunction;
|
type epsilonWallFunction;
|
||||||
value uniform 0.125;
|
value $internalField;
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
}
|
|
||||||
lowerWall
|
|
||||||
{
|
|
||||||
type epsilonWallFunction;
|
|
||||||
value uniform 0.125;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
}
|
|
||||||
body
|
|
||||||
{
|
|
||||||
type epsilonWallFunction;
|
|
||||||
value uniform 0.125;
|
|
||||||
Cmu 0.09;
|
Cmu 0.09;
|
||||||
kappa 0.41;
|
kappa 0.41;
|
||||||
E 9.8;
|
E 9.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,31 +24,21 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value uniform 0.375;
|
value $internalField;
|
||||||
}
|
}
|
||||||
outlet
|
"(body|upperWall|lowerWall)"
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
upperWall
|
|
||||||
{
|
{
|
||||||
type kqRWallFunction;
|
type kqRWallFunction;
|
||||||
value uniform 0.375;
|
value $internalField;
|
||||||
}
|
|
||||||
lowerWall
|
|
||||||
{
|
|
||||||
type kqRWallFunction;
|
|
||||||
value uniform 0.375;
|
|
||||||
}
|
|
||||||
body
|
|
||||||
{
|
|
||||||
type kqRWallFunction;
|
|
||||||
value uniform 0.375;
|
|
||||||
}
|
}
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,44 +21,25 @@ internalField uniform 0;
|
|||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
inlet
|
"(body|upperWall|lowerWall)"
|
||||||
{
|
|
||||||
type calculated;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
outlet
|
|
||||||
{
|
|
||||||
type calculated;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
upperWall
|
|
||||||
{
|
{
|
||||||
type nutkWallFunction;
|
type nutkWallFunction;
|
||||||
Cmu 0.09;
|
Cmu 0.09;
|
||||||
kappa 0.41;
|
kappa 0.41;
|
||||||
E 9.8;
|
E 9.8;
|
||||||
value uniform 0;
|
value $internalField;
|
||||||
}
|
|
||||||
lowerWall
|
|
||||||
{
|
|
||||||
type nutkWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
body
|
|
||||||
{
|
|
||||||
type nutkWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,26 +20,22 @@ internalField uniform 0;
|
|||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
inlet
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
|
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value uniform 0;
|
value $internalField;
|
||||||
}
|
|
||||||
|
|
||||||
"(body|upperWall|lowerWall)"
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -4,6 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
|
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
runApplication topoSet
|
runApplication topoSet
|
||||||
|
runApplication createPatch -overwrite
|
||||||
runApplication $(getApplication)
|
runApplication $(getApplication)
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1906 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object createPatchDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pointSync false;
|
||||||
|
|
||||||
|
// Patches to create
|
||||||
|
patches
|
||||||
|
(
|
||||||
|
{
|
||||||
|
// Name of new patch
|
||||||
|
name airIntake;
|
||||||
|
|
||||||
|
// Dictionary to construct new patch from
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How to construct: either from 'patches' or 'set'
|
||||||
|
constructFrom set;
|
||||||
|
|
||||||
|
// If constructFrom = patches : names of patches. Wildcards allowed.
|
||||||
|
patches ();
|
||||||
|
|
||||||
|
// If constructFrom = set : name of faceSet
|
||||||
|
set airIntake;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -31,6 +31,23 @@ actions
|
|||||||
source setToCellZone;
|
source setToCellZone;
|
||||||
set porousCells;
|
set porousCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name airIntake;
|
||||||
|
type faceSet;
|
||||||
|
action new;
|
||||||
|
source patchToFace;
|
||||||
|
patch body;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name airIntake;
|
||||||
|
type faceSet;
|
||||||
|
action subset;
|
||||||
|
source boxToFace;
|
||||||
|
box (2.6 0.75 0)(2.64 0.8 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user