fanFvPatchField -> fanPressureJumpFvPatchScalarField: for consistency with fanPressureFvPatchScalarField
Description
This boundary condition provides a pressure jump condition, using
the \c cyclic condition as a base.
The jump is specified as a \c Function1 type, to enable the use of, e.g.
constant, polynomial, table values. This boundary condition can operate
in two modes - standard and backward compatibility.
In standard mode, jump is specified as a function of total volumetric
flow rate through the patch. In backward compatibility mode, the boundary
conditions serves as a direct replacement for the fanFvPatchField, where
jump is defined as a function of local velocity.
Usage
\table
Property | Description | Required | Default value
patchType | underlying patch type should be \c cyclic| yes |
fanCurve | fan curve, e.g. \c csvFile | yes |
jumpTable | jump data (backward compatibility mode) | no |
reverse | reverse jump direction | no | false
phi | flux field name | no | phi
rho | density field name | no | rho
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type fan;
patchType cyclic;
fanCurve csvFile;
csvFileCoeffs
{
hasHeaderLine 1;
refColumn 0;
componentColumns 1(1);
separator ",";
file "$FOAM_CASE/constant/pressureVsQ";
}
value uniform 0;
}
\endverbatim
The above example shows the use of a comma separated (CSV) file to specify
the jump condition.
Contributed by Daniel Jasinski
Resolves bug-report https://bugs.openfoam.org/view.php?id=3102#c10159
This commit is contained in:
@ -139,7 +139,7 @@ $(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C
|
|||||||
$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C
|
$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
|
$(derivedFvPatchFields)/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
|
$(derivedFvPatchFields)/fanPressureJump/fanPressureJumpFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C
|
||||||
|
|||||||
@ -1,135 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 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 "fanFvPatchField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fanFvPatchField<Type>::calcFanJump()
|
|
||||||
{
|
|
||||||
if (this->cyclicPatch().owner())
|
|
||||||
{
|
|
||||||
this->jump_ = this->jumpTable_->value(this->db().time().value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::fanFvPatchField<Type>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<Type>(p, iF),
|
|
||||||
phiName_("phi"),
|
|
||||||
rhoName_("rho")
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::fanFvPatchField<Type>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<Type>(p, iF, dict),
|
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
|
||||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::fanFvPatchField<Type>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fanFvPatchField<Type>& ptf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
|
|
||||||
phiName_(ptf.phiName_),
|
|
||||||
rhoName_(ptf.rhoName_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::fanFvPatchField<Type>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fanFvPatchField<Type>& ptf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<Type>(ptf),
|
|
||||||
phiName_(ptf.phiName_),
|
|
||||||
rhoName_(ptf.rhoName_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::fanFvPatchField<Type>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fanFvPatchField<Type>& ptf,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<Type>(ptf, iF),
|
|
||||||
phiName_(ptf.phiName_),
|
|
||||||
rhoName_(ptf.rhoName_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fanFvPatchField<Type>::updateCoeffs()
|
|
||||||
{
|
|
||||||
if (this->updated())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
calcFanJump();
|
|
||||||
|
|
||||||
// Call fixedJump variant - uniformJump will overwrite the jump value
|
|
||||||
fixedJumpFvPatchField<Type>::updateCoeffs();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
uniformJumpFvPatchField<Type>::write(os);
|
|
||||||
this->template writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
|
||||||
this->template writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,99 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 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 "fanFvPatchFields.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "Tuple2.H"
|
|
||||||
#include "PolynomialEntry.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
|
||||||
{
|
|
||||||
if (this->cyclicPatch().owner())
|
|
||||||
{
|
|
||||||
const surfaceScalarField& phi =
|
|
||||||
db().lookupObject<surfaceScalarField>(phiName_);
|
|
||||||
|
|
||||||
const fvsPatchField<scalar>& phip =
|
|
||||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
|
||||||
|
|
||||||
scalarField Un(max(phip/patch().magSf(), scalar(0)));
|
|
||||||
|
|
||||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
|
||||||
{
|
|
||||||
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->jump_ = max(this->jumpTable_->value(Un), scalar(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<>
|
|
||||||
Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
uniformJumpFvPatchField<scalar>(p, iF),
|
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
|
||||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
|
||||||
{
|
|
||||||
if (this->cyclicPatch().owner())
|
|
||||||
{
|
|
||||||
this->jumpTable_ = Function1<scalar>::New("jumpTable", dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict.found("value"))
|
|
||||||
{
|
|
||||||
fvPatchScalarField::operator=
|
|
||||||
(
|
|
||||||
scalarField("value", dict, p.size())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->evaluate(Pstream::commsTypes::blocking);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
makeTemplatePatchTypeField(scalar, fan);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 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 fanFvPatchFields_H
|
|
||||||
#define fanFvPatchFields_H
|
|
||||||
|
|
||||||
#include "fanFvPatchField.H"
|
|
||||||
#include "fieldTypes.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makePatchTypeFieldTypedefs(fan);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 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 fanFvPatchFieldsFwd_H
|
|
||||||
#define fanFvPatchFieldsFwd_H
|
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type> class fanFvPatchField;
|
|
||||||
|
|
||||||
makePatchTypeFieldTypedefs(fan);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,228 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2011-2018 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 "fanPressureJumpFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fanPressureJumpFvPatchScalarField::calcFanJump()
|
||||||
|
{
|
||||||
|
const fvsPatchField<scalar>& phip =
|
||||||
|
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||||
|
|
||||||
|
const bool massBasedFlux =
|
||||||
|
phip.internalField().dimensions() == dimDensity*dimVelocity*dimArea;
|
||||||
|
|
||||||
|
const scalar dir = reverse_ ? -1 : 1;
|
||||||
|
|
||||||
|
//- Jump table is defined in backward compatibility mode
|
||||||
|
if(jumpTable_.valid())
|
||||||
|
{
|
||||||
|
//- Patch normal velocity field
|
||||||
|
scalarField Un(max(dir*phip/patch().magSf(), scalar(0)));
|
||||||
|
|
||||||
|
if (massBasedFlux)
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
Un /= rhop;
|
||||||
|
}
|
||||||
|
|
||||||
|
jump_ = dir*max(jumpTable_->value(Un), scalar(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scalar volFlowRate = 0;
|
||||||
|
|
||||||
|
if (massBasedFlux)
|
||||||
|
{
|
||||||
|
const scalarField& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
volFlowRate = gSum(phip/rhop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
volFlowRate = gSum(phip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jump_ = dir*max(fanCurve_->value(max(dir*volFlowRate, 0)), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fanPressureJumpFvPatchScalarField::fanPressureJumpFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchScalarField(p, iF),
|
||||||
|
fanCurve_(),
|
||||||
|
jumpTable_(),
|
||||||
|
reverse_(false),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("rho")
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fanPressureJumpFvPatchScalarField::fanPressureJumpFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchScalarField(p, iF),
|
||||||
|
fanCurve_(),
|
||||||
|
jumpTable_(),
|
||||||
|
reverse_(dict.lookupOrDefault<Switch>("reverse", false)),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||||
|
{
|
||||||
|
if (cyclicPatch().owner())
|
||||||
|
{
|
||||||
|
if (dict.found("jumpTable"))
|
||||||
|
{
|
||||||
|
//- backward compatibility model
|
||||||
|
jumpTable_ = Function1<scalar>::New("jumpTable", dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fanCurve_ = Function1<scalar>::New("fanCurve", dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchScalarField::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evaluate(Pstream::commsTypes::blocking);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fanPressureJumpFvPatchScalarField::fanPressureJumpFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fanPressureJumpFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
fanCurve_(ptf.fanCurve_, false),
|
||||||
|
jumpTable_(ptf.jumpTable_, false),
|
||||||
|
reverse_(ptf.reverse_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fanPressureJumpFvPatchScalarField::fanPressureJumpFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fanPressureJumpFvPatchScalarField& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchScalarField(ptf),
|
||||||
|
fanCurve_(ptf.fanCurve_, false),
|
||||||
|
jumpTable_(ptf.jumpTable_, false),
|
||||||
|
reverse_(ptf.reverse_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fanPressureJumpFvPatchScalarField::fanPressureJumpFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fanPressureJumpFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchScalarField(ptf, iF),
|
||||||
|
fanCurve_(ptf.fanCurve_, false),
|
||||||
|
jumpTable_(ptf.jumpTable_, false),
|
||||||
|
reverse_(ptf.reverse_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fanPressureJumpFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cyclicPatch().owner())
|
||||||
|
{
|
||||||
|
calcFanJump();
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedJumpFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fanPressureJumpFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedJumpFvPatchScalarField::write(os);
|
||||||
|
|
||||||
|
if (jumpTable_.valid()) jumpTable_->writeData(os);
|
||||||
|
if (fanCurve_.valid()) fanCurve_->writeData(os);
|
||||||
|
|
||||||
|
writeEntryIfDifferent<Switch>(os, "reverse", false, reverse_);
|
||||||
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
fanPressureJumpFvPatchScalarField
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -22,22 +22,29 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::fanFvPatchField
|
Foam::fanPressureJumpFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This boundary condition provides a jump condition, using the \c cyclic
|
This boundary condition provides a pressure jump condition, using
|
||||||
condition as a base.
|
the \c cyclic condition as a base.
|
||||||
|
|
||||||
The jump is specified as a \c Function1 type, to enable the use of, e.g.
|
The jump is specified as a \c Function1 type, to enable the use of, e.g.
|
||||||
constant, polynomial, table values.
|
constant, polynomial, table values. This boundary condition can operate
|
||||||
|
in two modes - standard and backward compatibility.
|
||||||
|
In standard mode, jump is specified as a function of total volumetric
|
||||||
|
flow rate through the patch. In backward compatibility mode, the boundary
|
||||||
|
conditions serves as a direct replacement for the fanFvPatchField, where
|
||||||
|
jump is defined as a function of local velocity.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
patchType | underlying patch type should be \c cyclic| yes |
|
patchType | underlying patch type should be \c cyclic| yes |
|
||||||
jumpTable | jump data, e.g. \c csvFile | yes |
|
fanCurve | fan curve, e.g. \c csvFile | yes |
|
||||||
|
jumpTable | jump data (backward compatibility mode) | no |
|
||||||
|
reverse | reverse jump direction | no | false
|
||||||
phi | flux field name | no | phi
|
phi | flux field name | no | phi
|
||||||
rho | density field name | no | none
|
rho | density field name | no | rho
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -46,14 +53,14 @@ Usage
|
|||||||
{
|
{
|
||||||
type fan;
|
type fan;
|
||||||
patchType cyclic;
|
patchType cyclic;
|
||||||
jumpTable csvFile;
|
fanCurve csvFile;
|
||||||
csvFileCoeffs
|
csvFileCoeffs
|
||||||
{
|
{
|
||||||
hasHeaderLine 1;
|
hasHeaderLine 1;
|
||||||
refColumn 0;
|
refColumn 0;
|
||||||
componentColumns 1(1);
|
componentColumns 1(1);
|
||||||
separator ",";
|
separator ",";
|
||||||
file "$FOAM_CASE/constant/pressureVsU";
|
file "$FOAM_CASE/constant/pressureVsQ";
|
||||||
}
|
}
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
}
|
}
|
||||||
@ -69,17 +76,14 @@ See also
|
|||||||
Foam::Function1Types
|
Foam::Function1Types
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fanFvPatchField.C
|
fanPressureJumpFvPatchScalarField.C
|
||||||
fanFvPatchFields.H
|
|
||||||
fanFvPatchFields.C
|
|
||||||
fanFvPatchFieldsFwd.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fanFvPatchField_H
|
#ifndef fanPressureJumpFvPatchScalarField_H
|
||||||
#define fanFvPatchField_H
|
#define fanPressureJumpFvPatchScalarField_H
|
||||||
|
|
||||||
#include "uniformJumpFvPatchField.H"
|
#include "fixedJumpFvPatchFields.H"
|
||||||
#include "Function1.H"
|
#include "Function1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -88,16 +92,24 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fanFvPatchField Declaration
|
Class fanPressureJumpFvPatchScalarField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
class fanPressureJumpFvPatchScalarField
|
||||||
class fanFvPatchField
|
|
||||||
:
|
:
|
||||||
public uniformJumpFvPatchField<Type>
|
public fixedJumpFvPatchScalarField
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Fan curve
|
||||||
|
autoPtr<Function1<scalar>> fanCurve_;
|
||||||
|
|
||||||
|
//- Jump table (backward compatibility)
|
||||||
|
autoPtr<Function1<scalar>> jumpTable_;
|
||||||
|
|
||||||
|
//- Set true to reverse jump direction
|
||||||
|
Switch reverse_;
|
||||||
|
|
||||||
//- Name of the flux transporting the field
|
//- Name of the flux transporting the field
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
@ -115,66 +127,66 @@ class fanFvPatchField
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("fan");
|
TypeName("fanPressureJump");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
fanFvPatchField
|
fanPressureJumpFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<Type, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
//- Construct from patch, internal field and dictionary
|
||||||
fanFvPatchField
|
fanPressureJumpFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<Type, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
const dictionary&
|
const dictionary&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by mapping given fanFvPatchField onto a new patch
|
//- Construct by mapping given patch onto a new patch
|
||||||
fanFvPatchField
|
fanPressureJumpFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fanFvPatchField<Type>&,
|
const fanPressureJumpFvPatchScalarField&,
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<Type, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
const fvPatchFieldMapper&
|
const fvPatchFieldMapper&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
fanFvPatchField
|
fanPressureJumpFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fanFvPatchField<Type>&
|
const fanPressureJumpFvPatchScalarField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<fvPatchField<Type>> clone() const
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
{
|
{
|
||||||
return tmp<fvPatchField<Type>>
|
return tmp<fvPatchScalarField>
|
||||||
(
|
(
|
||||||
new fanFvPatchField<Type>(*this)
|
new fanPressureJumpFvPatchScalarField(*this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
fanFvPatchField
|
fanPressureJumpFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fanFvPatchField<Type>&,
|
const fanPressureJumpFvPatchScalarField&,
|
||||||
const DimensionedField<Type, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<fvPatchField<Type>> clone
|
virtual tmp<fvPatchField<scalar>> clone
|
||||||
(
|
(
|
||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return tmp<fvPatchField<Type>>
|
return tmp<fvPatchField<scalar>>
|
||||||
(
|
(
|
||||||
new fanFvPatchField<Type>(*this, iF)
|
new fanPressureJumpFvPatchScalarField(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,31 +201,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Specialisation of the jump-condition for the pressure
|
|
||||||
template<>
|
|
||||||
void fanFvPatchField<scalar>::calcFanJump();
|
|
||||||
|
|
||||||
template<>
|
|
||||||
fanFvPatchField<scalar>::fanFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<scalar, volMesh>&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "fanFvPatchField.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user