flowRateInletVelocityFvPatchVectorField: Added optional profile entry to specify the velocity profile

The unreliable extrapolateProfile option has been replaced by the more flexible
and reliable profile option which allows the velocity profile to be specified as
a Function1 of the normalised distance to the wall.  To simplify the
specification of the most common velocity profiles the new laminarBL (quadratic
profile) and turbulentBL (1/7th power law) Function1s are provided.

In addition to the new profile option the flow rate can now be specified as a
meanVelocity, volumetricFlowRate or massFlowRate, all of which are Function1s of
time.

The following tutorials have been updated to use the laminarBL profile:
    multiphase/multiphaseEulerFoam/laminar/titaniaSynthesis
    multiphase/multiphaseEulerFoam/laminar/titaniaSynthesisSurface

The following tutorials have been updated to use the turbulentBL profile:
    combustion/reactingFoam/Lagrangian/verticalChannel
    combustion/reactingFoam/Lagrangian/verticalChannelLTS
    combustion/reactingFoam/Lagrangian/verticalChannelSteady
    compressible/rhoPimpleFoam/RAS/angledDuct
    compressible/rhoPimpleFoam/RAS/angledDuctLTS
    compressible/rhoPimpleFoam/RAS/squareBendLiq
    compressible/rhoPorousSimpleFoam/angledDuctImplicit
    compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff
    compressible/rhoSimpleFoam/squareBend
    compressible/rhoSimpleFoam/squareBendLiq
    heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger
    heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger
    incompressible/porousSimpleFoam/angledDuctImplicit
    incompressible/porousSimpleFoam/straightDuctImplicit
    multiphase/interFoam/RAS/angledDuct

Class
    Foam::flowRateInletVelocityFvPatchVectorField

Description
    Velocity inlet boundary condition creating a velocity field with
    optionally specified profile normal to the patch adjusted to match the
    specified mass flow rate, volumetric flow rate or mean velocity.

    For a mass-based flux:
    - the flow rate should be provided in kg/s
    - if \c rho is "none" the flow rate is in m3/s
    - otherwise \c rho should correspond to the name of the density field
    - if the density field cannot be found in the database, the user must
      specify the inlet density using the \c rhoInlet entry

    For a volumetric-based flux:
    - the flow rate is in m3/s

Usage
    \table
        Property     | Description             | Required    | Default value
        massFlowRate | Mass flow rate [kg/s]   | no          |
        volumetricFlowRate | Volumetric flow rate [m^3/s]| no |
        meanVelocity | Mean velocity [m/s]| no |
        profile      | Velocity profile        | no          |
        rho          | Density field name      | no          | rho
        rhoInlet     | Inlet density           | no          |
        alpha        | Volume fraction field name | no       |
    \endtable

    Example of the boundary condition specification for a volumetric flow rate:
    \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        volumetricFlowRate  0.2;
        profile             laminarBL;
    }
    \endverbatim

    Example of the boundary condition specification for a mass flow rate:
     \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        massFlowRate        0.2;
        profile             turbulentBL;
        rho                 rho;
        rhoInlet            1.0;
    }
    \endverbatim

    Example of the boundary condition specification for a volumetric flow rate:
    \verbatim
    <patchName>
    {
        type                flowRateInletVelocity;
        meanVelocity        5;
        profile             turbulentBL;
    }
    \endverbatim

    The \c volumetricFlowRate, \c massFlowRate or \c meanVelocity entries are
    \c Function1 of time, see Foam::Function1s.

    The \c profile entry is a \c Function1 of the normalised distance to the
    wall.  Any suitable Foam::Function1s can be used including
    Foam::Function1s::codedFunction1 but Foam::Function1s::laminarBL and
    Foam::Function1s::turbulentBL have been created specifically for this
    purpose and are likely to be appropriate for most cases.

Note
    - \c rhoInlet is required for the case of a mass flow rate, where the
      density field is not available at start-up
    - The value is positive into the domain (as an inlet)
    - May not work correctly for transonic inlets
    - Strange behaviour with potentialFoam since the U equation is not solved

See also
    Foam::fixedValueFvPatchField
    Foam::Function1s::laminarBL
    Foam::Function1s::turbulentBL
    Foam::Function1s
    Foam::flowRateOutletVelocityFvPatchVectorField
This commit is contained in:
Henry Weller
2022-01-24 19:10:39 +00:00
parent db45df2e6e
commit 8bb48df87f
35 changed files with 761 additions and 132 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::Function1s::quadraticRamp
Description
Quadratic ramp function starting from 0 and increasing quadraticRampally
Quadratic ramp function starting from 0 and increasing quadratically
to 1 from \c t_0 over the \c duration and remaining at 1 thereafter.
See also

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,9 +91,6 @@ class squarePulse
//- Duration of the ramp function
scalar duration_;
private:
// Private Member Functions
//- Read the coefficients from the given dictionary

View File

@ -170,6 +170,8 @@ $(derivedFvPatchFields)/fixedMean/fixedMeanFvPatchFields.C
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/flowRateInletVelocity/laminarBL/laminarBL.C
$(derivedFvPatchFields)/flowRateInletVelocity/turbulentBL/turbulentBL.C
$(derivedFvPatchFields)/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/freestream/freestreamFvPatchFields.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,87 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "one.H"
#include "patchPatchDist.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::flowRateInletVelocityFvPatchVectorField::setWallDist()
{
if (profile_.valid())
{
const labelHashSet otherPatchIDs
(
patch().patch().boundaryMesh().findPatchIDs<wallPolyPatch>()
);
const patchPatchDist pwd(patch().patch(), otherPatchIDs);
y_ = pwd/gMax(pwd);
}
area_ = gSum(patch().magSf());
}
template<class ScaleType, class AlphaType, class RhoType>
void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
(
const ScaleType& scale,
const AlphaType& alpha,
const RhoType& rho
)
{
const scalarField profile(this->profile());
const scalar avgU =
-(scale*flowRate_->value(db().time().userTimeValue()))
/gSum(alpha*rho*profile*patch().magSf());
operator==(avgU*profile*patch().nf());
}
template<class AlphaType>
void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
(
const AlphaType& alpha
)
{
if (meanVelocity_)
{
updateValues(area_, alpha, one());
}
else if (volumetric_ || rhoName_ == "none")
{
updateValues(one(), alpha, one());
}
else
{
// Mass flow-rate
if (db().foundObject<volScalarField>(rhoName_))
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
updateValues(one(), alpha, rhop);
}
else
{
// Use constant density
if (rhoInlet_ < 0)
{
FatalErrorInFunction
<< "Did not find registered density field " << rhoName_
<< " and no constant density 'rhoInlet' specified"
<< exit(FatalError);
}
updateValues(one(), alpha, rhoInlet_);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -39,11 +120,13 @@ flowRateInletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(p, iF),
flowRate_(),
profile_(),
meanVelocity_(false),
volumetric_(false),
rhoName_("rho"),
rhoInlet_(0.0),
rhoInlet_(0),
alphaName_(word::null),
extrapolateProfile_(false)
area_(0)
{}
@ -57,20 +140,23 @@ flowRateInletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
rhoInlet_(dict.lookupOrDefault<scalar>("rhoInlet", -vGreat)),
alphaName_(dict.lookupOrDefault<word>("alpha", word::null)),
extrapolateProfile_
(
dict.lookupOrDefault<Switch>("extrapolateProfile", false)
)
alphaName_(dict.lookupOrDefault<word>("alpha", word::null))
{
if (dict.found("volumetricFlowRate"))
if (dict.found("meanVelocity"))
{
meanVelocity_ = true;
volumetric_ = false;
flowRate_ = Function1<scalar>::New("meanVelocity", dict);
}
else if (dict.found("volumetricFlowRate"))
{
meanVelocity_ = false;
volumetric_ = true;
flowRate_ = Function1<scalar>::New("volumetricFlowRate", dict);
rhoName_ = "rho";
}
else if (dict.found("massFlowRate"))
{
meanVelocity_ = false;
volumetric_ = false;
flowRate_ = Function1<scalar>::New("massFlowRate", dict);
rhoName_ = word(dict.lookupOrDefault<word>("rho", "rho"));
@ -80,10 +166,17 @@ flowRateInletVelocityFvPatchVectorField
FatalIOErrorInFunction
(
dict
) << "Please supply either 'volumetricFlowRate' or"
) << "Please supply 'meanVelocity', 'volumetricFlowRate' or"
<< " 'massFlowRate' and 'rho'" << exit(FatalIOError);
}
if (dict.found("profile"))
{
profile_ = Function1<scalar>::New("profile", dict);
}
setWallDist();
// Value field require if mass based
if (dict.found("value"))
{
@ -110,12 +203,15 @@ flowRateInletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(ptf.flowRate_, false),
profile_(ptf.profile_, false),
meanVelocity_(ptf.meanVelocity_),
volumetric_(ptf.volumetric_),
rhoName_(ptf.rhoName_),
rhoInlet_(ptf.rhoInlet_),
alphaName_(ptf.alphaName_),
extrapolateProfile_(ptf.extrapolateProfile_)
{}
alphaName_(ptf.alphaName_)
{
setWallDist();
}
Foam::flowRateInletVelocityFvPatchVectorField::
@ -127,103 +223,57 @@ flowRateInletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(ptf, iF),
flowRate_(ptf.flowRate_, false),
profile_(ptf.profile_, false),
meanVelocity_(ptf.meanVelocity_),
volumetric_(ptf.volumetric_),
rhoName_(ptf.rhoName_),
rhoInlet_(ptf.rhoInlet_),
alphaName_(ptf.alphaName_),
extrapolateProfile_(ptf.extrapolateProfile_)
y_(ptf.y_),
area_(ptf.area_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class AlphaType, class RhoType>
void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
void Foam::flowRateInletVelocityFvPatchVectorField::autoMap
(
const AlphaType& alpha,
const RhoType& rho
const fvPatchFieldMapper& m
)
{
const scalar t = db().time().userTimeValue();
fixedValueFvPatchVectorField::autoMap(m);
setWallDist();
}
const vectorField n(patch().nf());
if (extrapolateProfile_)
void Foam::flowRateInletVelocityFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
)
{
fixedValueFvPatchVectorField::rmap(ptf, addr);
const flowRateInletVelocityFvPatchVectorField& tiptf =
refCast<const flowRateInletVelocityFvPatchVectorField>(ptf);
if (profile_.valid())
{
vectorField Up(this->patchInternalField());
// Patch normal extrapolated velocity
scalarField nUp(n & Up);
// Remove the normal component of the extrapolate patch velocity
Up -= nUp*n;
// Remove any reverse flow
nUp = min(nUp, scalar(0));
const scalar flowRate = flowRate_->value(t);
const scalar estimatedFlowRate =
-gSum(alpha*rho*(this->patch().magSf()*nUp));
if (estimatedFlowRate/flowRate > 0.5)
{
nUp *= mag(flowRate)/mag(estimatedFlowRate);
}
else
{
nUp -=
(flowRate - estimatedFlowRate)
/gSum(alpha*rho*patch().magSf());
}
// Add the corrected normal component of velocity to the patch velocity
Up += nUp*n;
// Correct the patch velocity
this->operator==(Up);
}
else
{
const scalar avgU =
-flowRate_->value(t)/gSum(alpha*rho*patch().magSf());
operator==(avgU*n);
y_.rmap(tiptf.y_, addr);
}
}
template<class AlphaType>
void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
(
const AlphaType& alpha
)
Foam::tmp<Foam::scalarField>
Foam::flowRateInletVelocityFvPatchVectorField::profile()
{
if (volumetric_ || rhoName_ == "none")
if (profile_.valid())
{
updateValues(alpha, one());
return profile_->value(y_);
}
else
{
// Mass flow-rate
if (db().foundObject<volScalarField>(rhoName_))
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
updateValues(alpha, rhop);
}
else
{
// Use constant density
if (rhoInlet_ < 0)
{
FatalErrorInFunction
<< "Did not find registered density field " << rhoName_
<< " and no constant density 'rhoInlet' specified"
<< exit(FatalError);
}
updateValues(alpha, rhoInlet_);
}
return tmp<scalarField>(new scalarField(size(), scalar(1)));
}
}
@ -255,13 +305,16 @@ void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
writeEntry(os, flowRate_());
if (profile_.valid())
{
writeEntry(os, profile_());
}
if (!volumetric_)
{
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<scalar>(os, "rhoInlet", -vGreat, rhoInlet_);
}
writeEntryIfDifferent<word>(os, "alpha", word::null, alphaName_);
writeEntry(os, "extrapolateProfile", extrapolateProfile_);
writeEntry(os, "value", *this);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,9 +25,9 @@ Class
Foam::flowRateInletVelocityFvPatchVectorField
Description
Velocity inlet boundary condition either correcting the extrapolated
velocity or creating a uniform velocity field normal to the patch adjusted
to match the specified flow rate
Velocity inlet boundary condition creating a velocity field with
optionally specified profile normal to the patch adjusted to match the
specified mass flow rate, volumetric flow rate or mean velocity.
For a mass-based flux:
- the flow rate should be provided in kg/s
@ -42,12 +42,13 @@ Description
Usage
\table
Property | Description | Required | Default value
massFlowRate | mass flow rate [kg/s] | no |
volumetricFlowRate | volumetric flow rate [m^3/s]| no |
rho | density field name | no | rho
rhoInlet | inlet density | no |
alpha | volume fraction field name | no |
extrapolateProfile | Extrapolate velocity profile | no | false
massFlowRate | Mass flow rate [kg/s] | no |
volumetricFlowRate | Volumetric flow rate [m^3/s]| no |
meanVelocity | Mean velocity [m/s]| no |
profile | Velocity profile | no |
rho | Density field name | no | rho
rhoInlet | Inlet density | no |
alpha | Volume fraction field name | no |
\endtable
Example of the boundary condition specification for a volumetric flow rate:
@ -56,8 +57,7 @@ Usage
{
type flowRateInletVelocity;
volumetricFlowRate 0.2;
extrapolateProfile yes;
value uniform (0 0 0);
profile laminarBL;
}
\endverbatim
@ -67,14 +67,30 @@ Usage
{
type flowRateInletVelocity;
massFlowRate 0.2;
extrapolateProfile yes;
profile turbulentBL;
rho rho;
rhoInlet 1.0;
value uniform (0 0 0);
}
\endverbatim
The \c flowRate entry is a \c Function1 of time, see Foam::Function1s.
Example of the boundary condition specification for a volumetric flow rate:
\verbatim
<patchName>
{
type flowRateInletVelocity;
meanVelocity 5;
profile turbulentBL;
}
\endverbatim
The \c volumetricFlowRate, \c massFlowRate or \c meanVelocity entries are
\c Function1 of time, see Foam::Function1s.
The \c profile entry is a \c Function1 of the normalised distance to the
wall. Any suitable Foam::Function1s can be used including
Foam::Function1s::codedFunction1 but Foam::Function1s::laminarBL and
Foam::Function1s::turbulentBL have been created specifically for this
purpose and are likely to be appropriate for most cases.
Note
- \c rhoInlet is required for the case of a mass flow rate, where the
@ -85,6 +101,8 @@ Note
See also
Foam::fixedValueFvPatchField
Foam::Function1s::laminarBL
Foam::Function1s::turbulentBL
Foam::Function1s
Foam::flowRateOutletVelocityFvPatchVectorField
@ -117,7 +135,13 @@ class flowRateInletVelocityFvPatchVectorField
//- Inlet integral flow rate
autoPtr<Function1<scalar>> flowRate_;
//- Is volumetric?
//- Optional velocity profile
autoPtr<Function1<scalar>> profile_;
//- Is the flow-rate mean velocity?
bool meanVelocity_;
//- Is the flow-rate volumetric?
bool volumetric_;
//- Name of the density field used to normalise the mass flux
@ -130,16 +154,27 @@ class flowRateInletVelocityFvPatchVectorField
// velocity
word alphaName_;
//- Set true to extrapolate the velocity profile from the interior
Switch extrapolateProfile_;
//- Normalised distance to the wall
scalarField y_;
//- Total area of patch
scalar area_;
// Private Member Functions
//- Set the wall distance field y_
void setWallDist();
//- Update the patch values given the appropriate volume fraction and
// density types and values
template<class AlphaType, class RhoType>
void updateValues(const AlphaType& alpha, const RhoType& rho);
template<class ScaleType, class AlphaType, class RhoType>
void updateValues
(
const ScaleType& scale,
const AlphaType& alpha,
const RhoType& rho
);
//- Update the patch values given the appropriate volume fraction type
// and values
@ -209,6 +244,17 @@ public:
// Member Functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchVectorField&, const labelList&);
//- Return the normalised velocity profile
virtual tmp<scalarField> profile();
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "laminarBL.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1s
{
makeScalarFunction1(laminarBL);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1s::laminarBL::laminarBL
(
const word& name,
const dictionary& dict
)
:
FieldFunction1<scalar, laminarBL>(name)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1s::laminarBL::~laminarBL()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Function1s::laminarBL::write(Ostream& os) const
{}
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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::Function1s::laminarBL
Description
Laminar boundary-layer function yHat*(2 - yHat)
where yHat is the normalised distance to the wall.
Usage:
\verbatim
<name> laminarBL;
\endverbatim
See also
Foam::Function1
Foam::Function1s::turbulentBL
SourceFiles
laminarBL.C
\*---------------------------------------------------------------------------*/
#ifndef laminarBL_H
#define laminarBL_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1s
{
/*---------------------------------------------------------------------------*\
Class laminarBL Declaration
\*---------------------------------------------------------------------------*/
class laminarBL
:
public FieldFunction1<scalar, laminarBL>
{
public:
// Runtime type information
TypeName("laminarBL");
// Constructors
//- Construct from name and dictionary
laminarBL
(
const word& name,
const dictionary& dict
);
//- Destructor
virtual ~laminarBL();
// Member Functions
//- Return value for time t
virtual inline scalar value(const scalar t) const;
//- Return the integral between times t1 and t2
virtual inline scalar integral
(
const scalar t1,
const scalar t2
) const;
//- Write data to dictionary stream
virtual void write(Ostream& os) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const laminarBL&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1s
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "laminarBLI.H"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "laminarBL.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::Function1s::laminarBL::value(const scalar t) const
{
return t*(2 - t);
}
inline Foam::scalar Foam::Function1s::laminarBL::integral
(
const scalar t1,
const scalar t2
) const
{
NotImplemented;
return NaN;
}
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "turbulentBL.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1s
{
makeScalarFunction1(turbulentBL);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::Function1s::turbulentBL::read(const dictionary& dict)
{
exponent_ = dict.lookupOrDefault<scalar>("exponent", 1.0/7.0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1s::turbulentBL::turbulentBL
(
const word& name,
const dictionary& dict
)
:
FieldFunction1<scalar, turbulentBL>(name)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1s::turbulentBL::~turbulentBL()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Function1s::turbulentBL::write(Ostream& os) const
{
writeEntry(os, "exponent", exponent_);
}
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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::Function1s::turbulentBL
Description
Turbulent boundary-layer function pow(yHat, exponent)
where yHat is the normalised distance to the wall and the optional exponent
defaults to 1/7.
Usage:
\verbatim
<name> turbulentBL;
\endverbatim
or
\verbatim
<name>
{
type turbulentBL;
exponent 0.143;
}
\endverbatim
See also
Foam::Function1
Foam::Function1s::laminarBL
SourceFiles
turbulentBL.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentBL_H
#define turbulentBL_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1s
{
/*---------------------------------------------------------------------------*\
Class turbulentBL Declaration
\*---------------------------------------------------------------------------*/
class turbulentBL
:
public FieldFunction1<scalar, turbulentBL>
{
// Private data
//- Exponent of the pow function
scalar exponent_;
// Private Member Functions
//- Read the coefficients from the given dictionary
void read(const dictionary& dict);
public:
// Runtime type information
TypeName("turbulentBL");
// Constructors
//- Construct from name and dictionary
turbulentBL
(
const word& name,
const dictionary& dict
);
//- Destructor
virtual ~turbulentBL();
// Member Functions
//- Return value for time t
virtual inline scalar value(const scalar t) const;
//- Return the integral between times t1 and t2
virtual inline scalar integral
(
const scalar t1,
const scalar t2
) const;
//- Write data to dictionary stream
virtual void write(Ostream& os) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const turbulentBL&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1s
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "turbulentBLI.H"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "turbulentBL.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::Function1s::turbulentBL::value(const scalar t) const
{
return pow(t, exponent_);
}
inline Foam::scalar Foam::Function1s::turbulentBL::integral
(
const scalar t1,
const scalar t2
) const
{
NotImplemented;
return NaN;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -256,10 +256,20 @@ Foam::ThermoCloud<CloudType>::Sh(const volScalarField& hs) const
const volScalarField::Internal
Vdt(this->mesh().V()*this->db().time().deltaT());
return
hsTrans()/Vdt
- fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
+ hsCoeff()/(Cp*Vdt)*hs;
if (hs.dimensions() == dimTemperature)
{
return
hsTrans()/Vdt
- fvm::SuSp(hsCoeff()/Vdt, hs)
+ (hsCoeff()/Vdt)*hs;
}
else
{
return
hsTrans()/Vdt
- fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
+ hsCoeff()/(Cp*Vdt)*hs;
}
}
else
{

View File

@ -33,12 +33,14 @@ boundaryField
type flowRateInletVelocity;
massFlowRate constant 0.00379;
rhoInlet 1.0; // fallback value for e.g. potentialFoam
profile turbulentBL;
}
inletSides
{
type flowRateInletVelocity;
massFlowRate constant 0.00832;
rhoInlet 1.0; // fallback value for e.g. potentialFoam
profile turbulentBL;
}
outlet
{

View File

@ -31,13 +31,13 @@ boundaryField
inletCentral
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.15;
intensity 0.05;
value uniform 3.75e-9;
}
inletSides
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.16;
intensity 0.05;
value uniform 3.75e-9;
}
outlet

View File

@ -33,12 +33,14 @@ boundaryField
type flowRateInletVelocity;
massFlowRate constant 0.00379;
rhoInlet 1.0; // fallback value for e.g. potentialFoam
profile turbulentBL;
}
inletSides
{
type flowRateInletVelocity;
massFlowRate constant 0.00832;
rhoInlet 1.0; // fallback value for e.g. potentialFoam
profile turbulentBL;
}
outlet
{

View File

@ -31,13 +31,13 @@ boundaryField
inletCentral
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.15;
intensity 0.05;
value uniform 3.75e-9;
}
inletSides
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.16;
intensity 0.05;
value uniform 3.75e-9;
}
outlet

View File

@ -33,6 +33,7 @@ boundaryField
type flowRateInletVelocity;
rhoInlet 1.2;
massFlowRate constant 0.00379;
profile turbulentBL;
value uniform (0 14.68 0);
}
inletSides
@ -40,6 +41,7 @@ boundaryField
type flowRateInletVelocity;
rhoInlet 1.2;
massFlowRate constant 0.00832;
profile turbulentBL;
value uniform (0 17.79 0);
}
outlet

View File

@ -31,13 +31,13 @@ boundaryField
inletCentral
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.15;
intensity 0.05;
value uniform 3.75e-9;
}
inletSides
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.16;
intensity 0.05;
value uniform 3.75e-9;
}
outlet

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.1;
profile turbulentBL;
rhoInlet 1; // estimate for initial rho
}

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.1;
profile turbulentBL;
value uniform (0 0 0);
}

View File

@ -29,6 +29,7 @@ boundaryField
type flowRateInletVelocity;
massFlowRate constant 5;
rhoInlet 1000; // Guess for rho
profile turbulentBL;
}
outlet

View File

@ -30,7 +30,7 @@ divSchemes
{
default none;
div(phi,U) Gauss linearUpwind limited;
div(phi,U) Gauss linearUpwindV limited;
div(phi,e) Gauss linearUpwind limited;
div(phi,epsilon) Gauss linearUpwind limited;
div(phi,k) Gauss linearUpwind limited;

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.1;
profile turbulentBL;
value uniform (0 0 0);
}

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.1;
profile turbulentBL;
value uniform (0 0 0);
}

View File

@ -28,6 +28,7 @@ boundaryField
type flowRateInletVelocity;
massFlowRate constant 0.5;
rhoInlet 0.5; // Guess for rho
profile turbulentBL;
}
outlet
{

View File

@ -28,6 +28,7 @@ boundaryField
type flowRateInletVelocity;
massFlowRate constant 5;
rhoInlet 1000; // Guess for rho
profile turbulentBL;
}
outlet
{

View File

@ -30,7 +30,7 @@ divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind limited;
div(phi,U) bounded Gauss linearUpwindV limited;
div(phi,h) bounded Gauss linearUpwind limited;
div(phi,e) bounded Gauss linearUpwind limited;
div(phi,epsilon) bounded Gauss linearUpwind limited;

View File

@ -31,6 +31,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.05;
profile turbulentBL;
value $internalField;
}
wall

View File

@ -26,6 +26,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.05;
profile turbulentBL;
value $internalField;
}
upper

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
volumetricFlowRate constant 0.1;
profile turbulentBL;
}
outlet

View File

@ -40,7 +40,7 @@ boundaryField
{
type flowRateInletVelocity;
volumetricFlowRate constant 0.1;
// value uniform (0.1 0 0);
profile turbulentBL;
}
outlet
{

View File

@ -34,6 +34,7 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.1;
profile turbulentBL;
value uniform (0 0 0);
}

View File

@ -24,8 +24,9 @@ boundaryField
inlet
{
type flowRateInletVelocity;
massFlowRate 2.173893E-07;
massFlowRate 2.173893e-07;
rho thermo:rho.vapor;
profile laminarBL;
value $internalField;
}

View File

@ -24,8 +24,9 @@ boundaryField
inlet
{
type flowRateInletVelocity;
massFlowRate 2.173893E-07;
massFlowRate 2.173893e-07;
rho thermo:rho.vapor;
profile laminarBL;
value $internalField;
}

View File

@ -58,8 +58,8 @@ vertices #codeStream
points = transform(Rz(degToRad($angle)), points);
// Append points 6 and 7
points.append(points[0] - point($lenInlet, 0, 0)); // pt 6
points.append(points[3] - point($lenInlet, 0, 0)); // pt 7
points.append(point(-$lenInlet, points[0].y(), points[0].z())); // pt 6
points.append(point(-$lenInlet, points[3].y(), points[3].z())); // pt 7
// Duplicate z points
points.append(cmptMultiply(points, vector(1, 1, -1)));