fvModels: Specify source property values in field files

When an fvModel source introduces fluid into a simulation it should also
create a corresponding source term for all properties transported into
the domain by that injection. The source is, effectively, an alternative
form of inlet boundary, on which all transported properties need an
inlet value specified.

These values are now specified in the property field files. The
following is an example of a 0/U file in which the velocity of fluid
introduced by a fvModel source called "injection1" is set to a fixed
value of (-1 0 0):

    dimensions      [0 1 -1 0 0 0 0];

    internalField   uniform (0 0 0);

    boundaryField
    {
        #includeEtc "caseDicts/setConstraintTypes"

        wall
        {
            type            noSlip;
        }

        atmosphere
        {
            type            pressureInletOutletVelocity;
            value           $internalField;
        }
    }

    // *** NEW ***
    sources
    {
        injection1
        {
            type            uniformFixedValue;
            uniformValue    (-1 0 0);
        }
    }

And the following entry in the 0/k file specifies the turbulent kinetic
energy introduced as a fraction of the mean flow kinetic energy:

    sources
    {
        injection1
        {
            type            turbulentIntensityKineticEnergy;
            intensity       0.05;
        }
    }

The specification is directly analogous to boundary conditions. The
conditions are run-time selectable and can be concisely implemented.
They can access each other and be inter-dependent (e.g., the above,
where turbulent kinetic energy depends on velocity). The syntax keeps
field data localised and makes the source model (e.g., massSource,
volumeSource, ...) specification independent from what other models and
fields are present in the simulation. The 'fieldValues' entry previously
required by source models is now no longer required.

If source values need specifying and no source condition has been
supplied in the relevant field file then an error will be generated.
This error is similar to that generated for missing boundary conditions.
This replaces the behaviour where sources such as these would introduce
a value of zero, either silently or with a warning. This is now
considered unacceptable. Zero might be a tolerable default for certain
fields (U, k), but is wholly inappropriate for others (T, epsilon, rho).

This change additionally makes it possible to inject fluid into a
multicomponent solver with a specified temperature. Previously, it was
not possible to do this as there was no means of evaluating the energy
of fluid with the injected composition.
This commit is contained in:
Will Bainbridge
2023-10-12 10:04:40 +01:00
parent 5e03874bbb
commit 171101d1e5
160 changed files with 7453 additions and 1612 deletions

View File

@ -197,7 +197,8 @@ Foam::fvFieldDecomposer::decomposeVolField
procMeshes_[proci],
field.dimensions(),
Field<Type>(field.primitiveField(), cellProcAddressing_[proci]),
patchFields
patchFields,
field.sources().table()
)
);

View File

@ -292,7 +292,8 @@ Foam::fvFieldReconstructor::reconstructVolField
completeMesh_,
procFields[0].dimensions(),
internalField,
patchFields
patchFields,
procFields[0].sources().table()
)
);
}

View File

@ -50,6 +50,7 @@ Description
#include "timeSelector.H"
#include "decompositionMethod.H"
#include "PstreamReduceOps.H"
#include "volFields.H"
#include "fvMeshDistribute.H"
#include "polyDistributionMap.H"
#include "IOobjectList.H"

View File

@ -56,11 +56,15 @@ fWallFunctions = $(wallFunctions)/fWallFunctions
$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C
RASBCs = RAS/derivedFvPatchFields
# Inlet turbulence BCs
$(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
$(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
# Turbulence model values
RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.C
RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.C
generalisedNewtonianViscosityModels = laminar/generalisedNewtonian/generalisedNewtonianViscosityModels
$(generalisedNewtonianViscosityModels)/generalisedNewtonianViscosityModel/generalisedNewtonianViscosityModel.C

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "turbulentMixingLengthDissipationRateFvScalarFieldSource.H"
#include "addToRunTimeSelectionTable.H"
#include "fvCellSet.H"
#include "volFields.H"
#include "momentumTransportModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::
turbulentMixingLengthDissipationRateFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fvScalarFieldSource(iF, dict),
mixingLength_(dict.lookup<scalar>("mixingLength")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{}
Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::
turbulentMixingLengthDissipationRateFvScalarFieldSource
(
const turbulentMixingLengthDissipationRateFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(field, iF),
mixingLength_(field.mixingLength_),
kName_(field.kName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::
~turbulentMixingLengthDissipationRateFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::sourceValue
(
const fvSource& source
) const
{
const scalarField ks(this->value<scalar>(kName_, source));
const momentumTransportModel& turbModel =
db().lookupType<momentumTransportModel>(internalField().group());
const scalar Cmu =
turbModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu75 = pow(Cmu, 0.75);
return Cmu75*ks*sqrt(ks)/mixingLength_;
}
Foam::tmp<Foam::scalarField>
Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::internalCoeff
(
const fvSource& source
) const
{
return
neg0(source.source(internalField().name()))
*scalarField(source.nCells(), scalar(1));
}
void Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry(os, "mixingLength", mixingLength_);
writeEntryIfDifferent<word>(os, "k", "k", kName_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
turbulentMixingLengthDissipationRateFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::turbulentMixingLengthDissipationRateFvScalarFieldSource
Description
This source condition provides a turbulence dissipation, \f$\epsilon\f$
(epsilon), based on a specified mixing length. The source values are
calculated using:
\f[
\epsilon = \frac{C_{\mu}^{0.75} k^{1.5}}{L}
\f]
where
\vartable
\epsilon | epsilon values
C_{\mu} | Model coefficient, set to 0.09
k | turbulence kinetic energy
L | length scale
\endvartable
In the case of a sink, the current cell values are used instead.
Usage
\table
Property | Description | Required | Default value
mixingLength | Length scale [m] | yes |
k | turbulence kinetic energy field name | no | k
\endtable
Example of the source condition specification:
\verbatim
<patchName>
{
type turbulentMixingLengthDissipationRate;
mixingLength 0.005;
}
\endverbatim
SourceFiles
turbulentMixingLengthDissipationRateFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentMixingLengthDissipationRateFvScalarFieldSource_H
#define turbulentMixingLengthDissipationRateFvScalarFieldSource_H
#include "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class turbulentMixingLengthDissipationRateFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class turbulentMixingLengthDissipationRateFvScalarFieldSource
:
public fvScalarFieldSource
{
private:
// Private Data
//- Turbulent length scale
scalar mixingLength_;
//- Name of the turbulent kinetic energy field
word kName_;
public:
//- Runtime type information
TypeName("turbulentMixingLengthDissipationRate");
// Constructors
//- Construct from internal field and dictionary
turbulentMixingLengthDissipationRateFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
turbulentMixingLengthDissipationRateFvScalarFieldSource
(
const turbulentMixingLengthDissipationRateFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new turbulentMixingLengthDissipationRateFvScalarFieldSource
(
*this,
iF
)
);
}
//- Destructor
virtual ~turbulentMixingLengthDissipationRateFvScalarFieldSource();
// Member Functions
//- Return the source value
virtual tmp<scalarField> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "turbulentMixingLengthFrequencyFvScalarFieldSource.H"
#include "addToRunTimeSelectionTable.H"
#include "fvCellSet.H"
#include "volFields.H"
#include "momentumTransportModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::
turbulentMixingLengthFrequencyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fvScalarFieldSource(iF, dict),
mixingLength_(dict.lookup<scalar>("mixingLength")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{}
Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::
turbulentMixingLengthFrequencyFvScalarFieldSource
(
const turbulentMixingLengthFrequencyFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(field, iF),
mixingLength_(field.mixingLength_),
kName_(field.kName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::
~turbulentMixingLengthFrequencyFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::sourceValue
(
const fvSource& source
) const
{
const scalarField ks(this->value<scalar>(kName_, source));
const momentumTransportModel& turbModel =
db().lookupType<momentumTransportModel>(internalField().group());
const scalar Cmu =
turbModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu25 = pow(Cmu, 0.25);
return ks*sqrt(ks)/(Cmu25*mixingLength_);
}
Foam::tmp<Foam::scalarField>
Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::internalCoeff
(
const fvSource& source
) const
{
return
neg0(source.source(internalField().name()))
*scalarField(source.nCells(), scalar(1));
}
void Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry(os, "mixingLength", mixingLength_);
writeEntryIfDifferent<word>(os, "k", "k", kName_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
turbulentMixingLengthFrequencyFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::turbulentMixingLengthFrequencyFvScalarFieldSource
Description
This source condition provides a turbulence specific dissipation,
\f$\omega\f$ (omega), based on a specified mixing length. The source values
are calculated using:
\f[
\omega = \frac{k^{0.5}}{C_{\mu}^{0.25} L}
\f]
where
\vartable
\omega | omega values
C_{\mu} | Model coefficient, set to 0.09
k | turbulence kinetic energy
L | length scale
\endvartable
In the case of a sink, the current cell values are used instead.
Usage
\table
Property | Description | Required | Default value
mixingLength | Length scale [m] | yes |
k | turbulence kinetic energy field name | no | k
\endtable
Example of the source condition specification:
\verbatim
<patchName>
{
type turbulentMixingLengthFrequency;
mixingLength 0.005;
}
\endverbatim
SourceFiles
turbulentMixingLengthFrequencyFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentMixingLengthFrequencyFvScalarFieldSource_H
#define turbulentMixingLengthFrequencyFvScalarFieldSource_H
#include "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class turbulentMixingLengthFrequencyFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class turbulentMixingLengthFrequencyFvScalarFieldSource
:
public fvScalarFieldSource
{
private:
// Private Data
//- Turbulent length scale
scalar mixingLength_;
//- Name of the turbulent kinetic energy field
word kName_;
public:
//- Runtime type information
TypeName("turbulentMixingLengthFrequency");
// Constructors
//- Construct from internal field and dictionary
turbulentMixingLengthFrequencyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
turbulentMixingLengthFrequencyFvScalarFieldSource
(
const turbulentMixingLengthFrequencyFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new turbulentMixingLengthFrequencyFvScalarFieldSource
(
*this,
iF
)
);
}
//- Destructor
virtual ~turbulentMixingLengthFrequencyFvScalarFieldSource();
// Member Functions
//- Return the source value
virtual tmp<scalarField> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -55,6 +55,17 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields
boundaryField_.readField(*this, dict.subDict("boundaryField"));
// Don't use subOrEmptyDict here, or line numbers will be lost from any IO
// error messages. Use an actual sub-dict reference here if possible.
if (dict.found("sources"))
{
sources_.readField(*this, dict.subDict("sources"));
}
else
{
sources_.readField(*this, dictionary(dict, dictionary()));
}
if (dict.found("referenceLevel"))
{
Type fieldAverage(pTraits<Type>(dict.lookup("referenceLevel")));
@ -191,7 +202,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, patchFieldType)
boundaryField_(mesh.boundary(), *this, patchFieldType),
sources_()
{
if (debug)
{
@ -209,14 +221,16 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const Mesh& mesh,
const dimensionSet& ds,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
:
Internal(io, mesh, ds, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes)
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes),
sources_(*this, fieldSourceTypes)
{
if (debug)
{
@ -240,7 +254,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, patchFieldType)
boundaryField_(mesh.boundary(), *this, patchFieldType),
sources_()
{
if (debug)
{
@ -260,14 +275,16 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const Mesh& mesh,
const dimensioned<Type>& dt,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
:
Internal(io, mesh, dt, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes)
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes),
sources_(*this, fieldSourceTypes)
{
if (debug)
{
@ -285,14 +302,16 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Internal& diField,
const PtrList<PatchField<Type>>& ptfl
const PtrList<PatchField<Type>>& ptfl,
const HashPtrTable<Source>& stft
)
:
Internal(io, diField),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, ptfl)
boundaryField_(this->mesh().boundary(), *this, ptfl),
sources_(*this, stft)
{
if (debug)
{
@ -311,14 +330,16 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const Mesh& mesh,
const dimensionSet& ds,
const Field<Type>& iField,
const PtrList<PatchField<Type>>& ptfl
const PtrList<PatchField<Type>>& ptfl,
const HashPtrTable<Source>& stft
)
:
Internal(io, mesh, ds, iField),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, ptfl)
boundaryField_(mesh.boundary(), *this, ptfl),
sources_(*this, stft)
{
if (debug)
{
@ -341,7 +362,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary())
boundaryField_(mesh.boundary()),
sources_()
{
readFields();
@ -377,7 +399,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary())
boundaryField_(mesh.boundary()),
sources_()
{
readFields(dict);
@ -410,7 +433,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(gf.timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, gf.boundaryField_)
boundaryField_(*this, gf.boundaryField_),
sources_(*this, gf.sources_)
{
if (debug)
{
@ -440,7 +464,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(gf.timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, gf.boundaryField_)
boundaryField_(*this, gf.boundaryField_),
sources_(*this, gf.sources_)
{
if (debug)
{
@ -472,7 +497,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(tgf().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, tgf().boundaryField_)
boundaryField_(*this, tgf().boundaryField_),
sources_(*this, tgf().sources_)
{
if (debug)
{
@ -497,7 +523,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(gf.timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, gf.boundaryField_)
boundaryField_(*this, gf.boundaryField_),
sources_(*this, gf.sources_)
{
if (debug)
{
@ -533,7 +560,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(tgf().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, tgf().boundaryField_)
boundaryField_(*this, tgf().boundaryField_),
sources_(*this, tgf().sources_)
{
if (debug)
{
@ -559,7 +587,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(gf.timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, gf.boundaryField_)
boundaryField_(*this, gf.boundaryField_),
sources_(*this, gf.sources_)
{
if (debug)
{
@ -595,7 +624,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(tgf().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(*this, tgf().boundaryField_)
boundaryField_(*this, tgf().boundaryField_),
sources_(*this, tgf().sources_)
{
if (debug)
{
@ -620,7 +650,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
timeIndex_(gf.timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, patchFieldType)
boundaryField_(this->mesh().boundary(), *this, patchFieldType),
sources_(*this, gf.sources_)
{
if (debug)
{
@ -648,8 +679,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const IOobject& io,
const GeometricField<Type, PatchField, GeoMesh>& gf,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
:
Internal(io, gf),
@ -662,7 +693,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
*this,
patchFieldTypes,
actualPatchTypes
)
),
sources_(*this, fieldSourceTypes)
{
if (debug)
{
@ -690,7 +722,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const IOobject& io,
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
:
Internal
@ -708,7 +741,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
*this,
patchFieldTypes,
actualPatchTypes
)
),
sources_(*this, fieldSourceTypes)
{
if (debug)
{
@ -766,7 +800,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
(
const word& name,
const Internal& diField,
const PtrList<PatchField<Type>>& ptfl
const PtrList<PatchField<Type>>& ptfl,
const HashPtrTable<Source>& stft
)
{
const bool cacheTmp = diField.mesh().thisDb().cacheTemporaryObject(name);
@ -785,7 +820,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
cacheTmp
),
diField,
ptfl
ptfl,
stft
),
cacheTmp
);
@ -869,7 +905,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
const Mesh& mesh,
const dimensioned<Type>& dt,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
{
const bool cacheTmp = mesh.thisDb().cacheTemporaryObject(name);
@ -890,7 +927,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
mesh,
dt,
patchFieldTypes,
actualPatchTypes
actualPatchTypes,
fieldSourceTypes
),
cacheTmp
);
@ -968,7 +1006,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
const word& newName,
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes
const wordList& actualPatchTypes,
const HashTable<word>& fieldSourceTypes
)
{
const bool cacheTmp = tgf().db().cacheTemporaryObject(newName);
@ -989,7 +1028,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
),
tgf,
patchFieldTypes,
actualPatchTypes
actualPatchTypes,
fieldSourceTypes
),
cacheTmp
);
@ -1297,6 +1337,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::reset
Internal::reset(gf);
boundaryField_.reset(gf.boundaryField());
sources_.reset(gf.sources());
tgf.clear();
}
@ -1785,6 +1826,12 @@ Foam::Ostream& Foam::operator<<
os << nl;
gf.boundaryField().writeEntry("boundaryField", os);
if (!gf.sources_.empty())
{
os << nl;
gf.sources().writeEntry("sources", os);
}
// Check state of IOstream
os.check
(

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,7 @@ SourceFiles
#include "lduInterfaceFieldPtrsList.H"
#include "LduInterfaceFieldPtrsList.H"
#include "GeometricBoundaryField.H"
#include "GeometricFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -103,6 +104,12 @@ public:
//- Type of the boundary field
typedef GeometricBoundaryField<Type, PatchField, GeoMesh> Boundary;
//- Type of the field source of which the Sources is composed
typedef typename GeoMesh::template FieldSource<Type> Source;
//- Type of the field sources
typedef GeometricFieldSources<Type, GeoMesh> Sources;
private:
@ -121,6 +128,9 @@ private:
//- Boundary Type field containing boundary field values
Boundary boundaryField_;
//- Type field sources containing field source values
Sources sources_;
// Private Member Functions
@ -163,7 +173,7 @@ public:
const IOobject&,
const Mesh&,
const dimensionSet&,
const word& patchFieldType=PatchField<Type>::calculatedType()
const word& patchFieldType = PatchField<Type>::calculatedType()
);
//- Constructor given IOobject, mesh, dimensions and patch field types.
@ -175,7 +185,8 @@ public:
const Mesh&,
const dimensionSet&,
const wordList& wantedPatchTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
//- Constructor given IOobject, mesh, dimensioned<Type>
@ -185,7 +196,7 @@ public:
const IOobject&,
const Mesh&,
const dimensioned<Type>&,
const word& patchFieldType=PatchField<Type>::calculatedType()
const word& patchFieldType = PatchField<Type>::calculatedType()
);
//- Constructor given IOobject, mesh, dimensioned<Type>
@ -196,7 +207,8 @@ public:
const Mesh&,
const dimensioned<Type>&,
const wordList& wantedPatchTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
//- Constructor from components
@ -204,7 +216,8 @@ public:
(
const IOobject&,
const Internal&,
const PtrList<PatchField<Type>>&
const PtrList<PatchField<Type>>&,
const HashPtrTable<Source>& = HashPtrTable<Source>()
);
//- Constructor from components
@ -214,7 +227,8 @@ public:
const Mesh&,
const dimensionSet&,
const Field<Type>&,
const PtrList<PatchField<Type>>&
const PtrList<PatchField<Type>>&,
const HashPtrTable<Source>& = HashPtrTable<Source>()
);
//- Construct and read given IOobject
@ -283,7 +297,8 @@ public:
const IOobject&,
const GeometricField<Type, PatchField, GeoMesh>&,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
//- Construct as copy resetting IO parameters and boundary types
@ -292,7 +307,8 @@ public:
const IOobject&,
const tmp<GeometricField<Type, PatchField, GeoMesh>>&,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
//- Clone
@ -307,7 +323,8 @@ public:
(
const word& name,
const Internal&,
const PtrList<PatchField<Type>>&
const PtrList<PatchField<Type>>&,
const HashPtrTable<Source>& = HashPtrTable<Source>()
);
//- Return a temporary field constructed from name, mesh, dimensionSet
@ -317,7 +334,7 @@ public:
const word& name,
const Mesh&,
const dimensionSet&,
const word& patchFieldType=PatchField<Type>::calculatedType()
const word& patchFieldType = PatchField<Type>::calculatedType()
);
//- Return a temporary field constructed from mesh, dimensioned<Type>
@ -327,7 +344,7 @@ public:
const word& name,
const Mesh&,
const dimensioned<Type>&,
const word& patchFieldType=PatchField<Type>::calculatedType()
const word& patchFieldType = PatchField<Type>::calculatedType()
);
//- Return a temporary field constructed from mesh, dimensioned<Type>
@ -338,7 +355,8 @@ public:
const Mesh&,
const dimensioned<Type>&,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
//- Rename temporary field and return
@ -353,7 +371,7 @@ public:
(
const word& newName,
const tmp<GeometricField<Type, PatchField, GeoMesh>>&,
const word&
const word& patchFieldType
);
//- Rename and reset patch fields types of temporary field and return
@ -362,7 +380,8 @@ public:
const word& newName,
const tmp<GeometricField<Type, PatchField, GeoMesh>>&,
const wordList& patchFieldTypes,
const wordList& actualPatchTypes = wordList()
const wordList& actualPatchTypes = wordList(),
const HashTable<word>& fieldSourceTypes = HashTable<word>()
);
@ -401,6 +420,9 @@ public:
//- Return const-reference to the boundary field
inline const Boundary& boundaryField() const;
//- Return const-reference to the sources
inline const Sources& sources() const;
//- Return the time index of the field
inline label timeIndex() const;

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-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,6 +63,15 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField() const
}
template<class Type, template<class> class PatchField, class GeoMesh>
inline const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::Sources&
Foam::GeometricField<Type, PatchField, GeoMesh>::sources() const
{
return sources_;
}
template<class Type, template<class> class PatchField, class GeoMesh>
inline Foam::label
Foam::GeometricField<Type, PatchField, GeoMesh>::timeIndex() const

View File

@ -0,0 +1,260 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "GeometricFieldSources.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::GeometricFieldSources()
:
HashPtrTable<Source>(),
errorLocation_()
{}
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::GeometricFieldSources
(
const DimensionedField<Type, GeoMesh>& iF,
const HashPtrTable<Source>& mtf
)
:
HashPtrTable<Source>(mtf.capacity()),
errorLocation_()
{
forAllConstIter(typename HashPtrTable<Source>, mtf, iter)
{
this->set(iter.key(), iter()->clone(iF).ptr());
}
}
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::GeometricFieldSources
(
const DimensionedField<Type, GeoMesh>& iF,
const GeometricFieldSources<Type, GeoMesh>& mtf
)
:
GeometricFieldSources(iF, static_cast<const HashPtrTable<Source>&>(mtf))
{}
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::GeometricFieldSources
(
const DimensionedField<Type, GeoMesh>& iF,
const dictionary& dict
)
:
HashPtrTable<Source>(),
errorLocation_()
{
readField(iF, dict);
}
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::GeometricFieldSources
(
const DimensionedField<Type, GeoMesh>& iF,
const HashTable<word>& types
)
:
HashPtrTable<Source>(),
errorLocation_()
{
forAllConstIter(typename HashTable<word>, types, iter)
{
this->set
(
iter.key(),
Source::New(iter(), iF).ptr()
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
Foam::GeometricFieldSources<Type, GeoMesh>::
~GeometricFieldSources()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
const Foam::HashPtrTable
<
typename Foam::GeometricFieldSources<Type, GeoMesh>::Source
>&
Foam::GeometricFieldSources<Type, GeoMesh>::table() const
{
return *this;
}
template<class Type, class GeoMesh>
Foam::HashPtrTable
<
typename Foam::GeometricFieldSources<Type, GeoMesh>::Source
>&
Foam::GeometricFieldSources<Type, GeoMesh>::table()
{
return *this;
}
template<class Type, class GeoMesh>
Foam::HashTable<Foam::word>
Foam::GeometricFieldSources<Type, GeoMesh>::types() const
{
HashTable<word> result;
forAllConstIter(typename HashPtrTable<Source>, *this, iter)
{
result.insert(iter.key(), iter()->type());
}
return result;
}
template<class Type, class GeoMesh>
void Foam::GeometricFieldSources<Type, GeoMesh>::readField
(
const DimensionedField<Type, GeoMesh>& field,
const dictionary& dict
)
{
this->clear();
errorLocation_ = IOerrorLocation(dict);
forAllConstIter(dictionary, dict, iter)
{
if (iter().isDict())
{
this->set
(
iter().keyword(),
Source::New(field, iter().dict()).ptr()
);
}
}
}
template<class Type, class GeoMesh>
void Foam::GeometricFieldSources<Type, GeoMesh>::reset
(
const GeometricFieldSources<Type, GeoMesh>& mtf
)
{
this->clear();
if (mtf.empty()) return;
const DimensionedField<Type, GeoMesh>& iF =
(**mtf.HashPtrTable<Source>::begin()).internalField();
errorLocation_ = mtf.errorLocation_;
forAllConstIter(typename HashPtrTable<Source>, mtf, iter)
{
this->set(iter.key(), iter()->clone(iF).ptr());
}
}
template<class Type, class GeoMesh>
void Foam::GeometricFieldSources<Type, GeoMesh>::writeEntry
(
const word& keyword,
Ostream& os
) const
{
os << keyword << nl << token::BEGIN_BLOCK << incrIndent << nl;
forAllConstIter(typename HashPtrTable<Source>, *this, iter)
{
os << indent << iter.key() << nl
<< indent << token::BEGIN_BLOCK << nl
<< incrIndent << *iter() << decrIndent
<< indent << token::END_BLOCK << endl;
}
os << decrIndent << token::END_BLOCK << endl;
// Check state of IOstream
os.check
(
"GeometricFieldSources<Type, GeoMesh>::"
"writeEntry(const word& keyword, Ostream& os) const"
);
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
const typename Foam::GeometricFieldSources<Type, GeoMesh>::Source&
Foam::GeometricFieldSources<Type, GeoMesh>::operator[]
(
const word& sourceName
) const
{
typename HashPtrTable<Source>::const_iterator iter = this->find(sourceName);
if (iter == this->end())
{
FatalIOErrorInFunction(errorLocation_)
<< "Cannot find fieldSource entry for " << sourceName
<< exit(FatalIOError);
}
return **iter;
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const GeometricFieldSources<Type, GeoMesh>& bf
)
{
typedef typename GeoMesh::template FieldSource<Type> Source;
os << static_cast<const HashPtrTable<Source>&>(bf);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,252 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::GeometricFieldSources
Description
Part of a geometric field used for setting the values associated with
optional sources
SourceFiles
GeometricFieldSources.C
\*---------------------------------------------------------------------------*/
#ifndef GeometricFieldSources_H
#define GeometricFieldSources_H
#include "dimensionedTypes.H"
#include "DimensionedField.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class dictionary;
/*---------------------------------------------------------------------------*\
Class GeometricFieldSources Declaration
\*---------------------------------------------------------------------------*/
template<class Type, class GeoMesh>
class GeometricFieldSources
:
private HashPtrTable<typename GeoMesh::template FieldSource<Type>>
{
public:
// Public Typedefs
//- Type of the internal field from which this GeometricField is derived
typedef DimensionedField<Type, GeoMesh> Internal;
//- Type of the field source of which this field sources is composed
typedef typename GeoMesh::template FieldSource<Type> Source;
private:
// Private Data
//- Cached IO error location for delayed error messages
IOerrorLocation errorLocation_;
public:
// Constructors
//- Construct null
GeometricFieldSources();
//- Construct from a table of field sources
GeometricFieldSources(const Internal&, const HashPtrTable<Source>&);
//- Construct as copy setting the reference to the internal field
GeometricFieldSources(const Internal&, const GeometricFieldSources&);
//- Construct from dictionary
GeometricFieldSources(const Internal&, const dictionary&);
//- Construct from types
GeometricFieldSources(const Internal&, const HashTable<word>&);
//- Copy constructor deleted
// as it would not set the internalField reference correctly
GeometricFieldSources(const GeometricFieldSources&) = delete;
//- Move constructor deleted
// as it would not set the internalField reference correctly
GeometricFieldSources(GeometricFieldSources&&) = delete;
//- Destructor
~GeometricFieldSources();
// Member Functions
//- Access the underlying field table
const HashPtrTable<Source>& table() const;
//- Access the underlying field table
HashPtrTable<Source>& table();
//- Inherit empty test
using HashPtrTable<Source>::empty;
//- Return a map from the source name to the field source type
HashTable<word> types() const;
//- Read the sources
void readField(const Internal& field, const dictionary& dict);
//- Reset the boundary field contents to the given field
// Used for mesh to mesh mapping
void reset(const GeometricFieldSources&);
//- Write sources as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const;
// Member operators
//- Find and return a field source
const Source& operator[](const word& sourceName) const;
};
template<class Type, class GeoMesh>
Ostream& operator<<
(
Ostream&,
const GeometricFieldSources<Type, GeoMesh>&
);
/*---------------------------------------------------------------------------*\
Class NoFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type, class GeoMesh>
class NoFieldSource
{
// Private Data
//- Reference to internal field
const DimensionedField<Type, GeoMesh>& internalField_;
public:
// Constructors
//- Construct from internal field
NoFieldSource<Type, GeoMesh>
(
const DimensionedField<Type, GeoMesh>& iF
)
:
internalField_(iF)
{}
//- Dummy clone
autoPtr<NoFieldSource<Type, GeoMesh>> clone
(
const DimensionedField<Type, GeoMesh>& iF
) const
{
return
autoPtr<NoFieldSource<Type, GeoMesh>>
(
new NoFieldSource<Type, GeoMesh>(iF)
);
}
// Selectors
//- Dummy selector
static autoPtr<NoFieldSource<Type, GeoMesh>> New
(
const word& fieldSourceType,
const DimensionedField<Type, GeoMesh>& iF
)
{
return
autoPtr<NoFieldSource<Type, GeoMesh>>
(
new NoFieldSource<Type, GeoMesh>(iF)
);
}
//- Dummy selector
static autoPtr<NoFieldSource<Type, GeoMesh>> New
(
const DimensionedField<Type, GeoMesh>& iF,
const dictionary& dict
)
{
return
autoPtr<NoFieldSource<Type, GeoMesh>>
(
new NoFieldSource<Type, GeoMesh>(iF)
);
}
// Member Functions
//- Return the internal field reference
const DimensionedField<Type, GeoMesh>& internalField() const
{
return internalField_;
}
};
template<class Type, class GeoMesh>
Ostream& operator<<(Ostream& os, const NoFieldSource<Type, GeoMesh>&)
{
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "GeometricFieldSources.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,12 +48,18 @@ class pointMesh;
template<class Type>
class pointPatchField;
template<class Type, class GeoMesh>
class NoFieldSource;
template<class Type, template<class> class PatchField, class GeoMesh>
class GeometricField;
template<class Type>
using PointField = GeometricField<Type, pointPatchField, pointMesh>;
template<class Type>
using pointFieldSource = NoFieldSource<Type, pointMesh>;
typedef PointField<label> pointLabelField;
typedef PointField<scalar> pointScalarField;
typedef PointField<vector> pointVectorField;

View File

@ -36,6 +36,7 @@ Description
#include "DemandDrivenMeshObject.H"
#include "polyMesh.H"
#include "pointBoundaryMesh.H"
#include "pointFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,9 +72,16 @@ public:
// Public Typedefs
//- Mesh type
typedef pointMesh Mesh;
//- Boundary mesh type
typedef pointBoundaryMesh BoundaryMesh;
//- Field source type
template<class Type>
using FieldSource = pointFieldSource<Type>;
// Declare name of the class and its debug switch
ClassName("pointMesh");

View File

@ -279,6 +279,15 @@ derivedFvsPatchFields = $(fvsPatchFields)/derived
$(derivedFvsPatchFields)/polyFaces/polyFacesFvsPatchLabelField.C
$(derivedFvsPatchFields)/nonConformalPolyFaces/nonConformalPolyFacesFvsPatchLabelField.C
fvFieldSources = fields/fvFieldSources
$(fvFieldSources)/fvFieldSource/fvFieldSources.C
derivedFvFieldSources = $(fvFieldSources)/derived
$(derivedFvFieldSources)/internal/internalFvFieldSources.C
$(derivedFvFieldSources)/uniformFixedValue/uniformFixedValueFvFieldSources.C
$(derivedFvFieldSources)/uniformInletOutlet/uniformInletOutletFvFieldSources.C
$(derivedFvFieldSources)/turbulentIntensityKineticEnergy/turbulentIntensityKineticEnergyFvScalarFieldSource.C
fields/volFields/volFields.C
fields/surfaceFields/surfaceFields.C
@ -509,6 +518,9 @@ $(fvConstraints)/fvConstraint.C
$(fvConstraints)/fvConstraints.C
$(fvConstraints)/includeFvConstraintEntry/includeFvConstraintEntry.C
$(general)/fvSource/fvSource.C
$(general)/fvSource/fvTotalSource.C
cellSources = sets/cellSources
$(cellSources)/fieldToCell/fieldToCell.C

View File

@ -35,12 +35,7 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::fvModel::addSupType(fvMatrix<Type>& eqn) const
{}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::fvModel::addSupType
@ -180,7 +175,8 @@ Foam::scalar Foam::fvModel::maxDeltaT() const
}
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_SUP, fvModel)
void Foam::fvModel::addSup(fvMatrix<scalar>& eqn) const
{}
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_FIELD_SUP, fvModel)

View File

@ -36,7 +36,7 @@ SourceFiles
#define fvModel_H
#include "fvMatricesFwd.H"
#include "volFields.H"
#include "volFieldsFwd.H"
#include "dictionary.H"
#include "dimensionSet.H"
#include "fvModelM.H"
@ -80,10 +80,6 @@ protected:
// Protected Member Functions
//- Add a source term to an equation
template<class Type>
void addSupType(fvMatrix<Type>& eqn) const;
//- Add a source term to an equation
template<class Type>
void addSupType
@ -274,8 +270,8 @@ public:
// Sources
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_SUP)
//- Add a source term to a field-less proxy equation
virtual void addSup(fvMatrix<scalar>& eqn) const;
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_FIELD_SUP)

View File

@ -23,15 +23,6 @@ License
\*---------------------------------------------------------------------------*/
#define DEFINE_FV_MODEL_ADD_SUP(Type, nullArg) \
virtual void addSup(fvMatrix<Type>& eqn) const;
#define IMPLEMENT_FV_MODEL_ADD_SUP(Type, modelType) \
void Foam::modelType::addSup(fvMatrix<Type>& eqn) const \
{ \
addSupType(eqn); \
}
#define DEFINE_FV_MODEL_ADD_FIELD_SUP(Type, nullArg) \
virtual void addSup \
( \

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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 "fvSource.H"
#include "fvCellSet.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fvSource, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvSource::fvSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvModel(name, modelType, mesh, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fvSource::~fvSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fvSource::addSupFields() const
{
return wordList::null();
}
Foam::label Foam::fvSource::nCells() const
{
return cells().size();
}
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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::fvSource
Description
Base class for finite volume sources
SourceFiles
fvSource.C
\*---------------------------------------------------------------------------*/
#ifndef fvSource_H
#define fvSource_H
#include "fvModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvSource Declaration
\*---------------------------------------------------------------------------*/
class fvSource
:
public fvModel
{
public:
//- Runtime type information
TypeName("fvSource");
// Constructors
//- Construct from explicit source name and mesh
fvSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Disallow default bitwise copy construction
fvSource(const fvSource&) = delete;
//- Destructor
virtual ~fvSource();
// Member Functions
// Checks
//- Return true if the fvModel adds a source term to the given
// field's transport equation. Must be provided by sources.
// Sources potentially apply to every field (or every field of a
// phase) and it is not known in advance what all the fields are.
// So, this function returns a logical test (e.g., is this the
// phase of which there is a source?) rather than testing whether
// the name is in a pre-determined set of names.
virtual bool addsSupToField(const word& fieldName) const = 0;
//- Return the list of fields for which the fvModel adds source term
// to the transport equation. Sources return null, as all this
// logic is handled in addsSupToField.
virtual wordList addSupFields() const;
// Access
//- Return the cells that the source applies to
virtual labelUList cells() const = 0;
//- Return the number of cells that the source applies to
virtual label nCells() const;
// Sources
//- Return the source value
virtual tmp<scalarField> source(const word& fieldName) const = 0;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const fvSource&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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 "fvTotalSource.H"
#include "fvCellSet.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fvTotalSource, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fvTotalSource::readCoeffs()
{
phaseName_ = coeffs().lookupOrDefault<word>("phase", word::null);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fvTotalSource::addSource(fvMatrix<scalar>& eqn) const
{
DebugInFunction
<< "eqnField=" << eqn.psi().name() << endl;
const labelUList cells = this->cells();
const scalar V = this->V();
const dimensionedScalar S = this->S();
// Check the dimensions
eqn.dimensions() = S.dimensions();
// Apply the source
forAll(cells, i)
{
const scalar f = mesh().V()[cells[i]]/V;
eqn.source()[cells[i]] -= f*S.value();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvTotalSource::fvTotalSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvSource(name, modelType, mesh, dict),
phaseName_()
{
readCoeffs();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fvTotalSource::~fvTotalSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fvTotalSource::addsSupToField(const word& fieldName) const
{
const word group = IOobject::group(fieldName);
return group == word::null || group == phaseName_;
}
Foam::tmp<Foam::scalarField> Foam::fvTotalSource::source
(
const word& fieldName
) const
{
return
tmp<scalarField>
(
new scalarField
(
nCells(),
(IOobject::group(fieldName) == phaseName_ ? S().value()/V() : 0)
)
);
}
bool Foam::fvTotalSource::read(const dictionary& dict)
{
if (fvModel::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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::fvTotalSource
Description
Base class for sources which are specified as a total value (e.g., volume
or mass flow rate), rather than a specific value (e.g., mass flow rate per
unit volume).
SourceFiles
fvTotalSource.C
\*---------------------------------------------------------------------------*/
#ifndef fvTotalSource_H
#define fvTotalSource_H
#include "fvSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvCellSet;
/*---------------------------------------------------------------------------*\
Class fvTotalSource Declaration
\*---------------------------------------------------------------------------*/
class fvTotalSource
:
public fvSource
{
private:
// Private Data
//- Name of the phase
word phaseName_;
// Private Member Functions
//- Non-virtual read
void readCoeffs();
protected:
// Protected Member Functions
// Sources
//- Add a source term to a field-less proxy equation
void addSource(fvMatrix<scalar>& eqn) const;
//- Add a source term to an equation
template<class Type>
void addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a compressible equation
template<class Type>
void addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a phase equation
template<class Type>
void addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
public:
//- Runtime type information
TypeName("fvTotalSource");
// Constructors
//- Construct from explicit source name and mesh
fvTotalSource
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~fvTotalSource();
// Member Functions
// Checks
//- Return true if the fvModel adds a source term to the given
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
// Access
//- Return the phase name
inline const word& phaseName() const;
//- Return the volume of cells that the source applies to
virtual scalar V() const = 0;
// Sources
//- Return the source value
virtual dimensionedScalar S() const = 0;
//- Return the source value
virtual tmp<scalarField> source(const word& fieldName) const;
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "fvTotalSourceI.H"
#ifdef NoRepository
#include "fvTotalSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "fvTotalSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word& Foam::fvTotalSource::phaseName() const
{
return phaseName_;
}
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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 "fvTotalSource.H"
#include "fvCellSet.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::fvTotalSource::addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
const labelUList cells = this->cells();
const scalar V = this->V();
const dimensionedScalar S = this->S();
// Check the dimensions
eqn.dimensions() = S.dimensions()*field.dimensions();
if (&field == &eqn.psi())
{
// Get the field source coefficients
const Field<Type> sourceCoeff
(
field.sources()[name()].sourceCoeff(*this)
);
const scalarField internalCoeff
(
field.sources()[name()].internalCoeff(*this)
);
// Apply the source
forAll(cells, i)
{
const scalar f = mesh().V()[cells[i]]/V;
eqn.source()[cells[i]] -= f*S.value()*sourceCoeff[i];
eqn.diag()[cells[i]] += f*S.value()*internalCoeff[i];
}
}
else
{
// Get the field source value
const Field<Type> value
(
field.sources()[name()].value(*this)
);
// Apply the source
forAll(cells, i)
{
const scalar f = mesh().V()[cells[i]]/V;
eqn.source()[cells[i]] -= f*S.value()*value[i];
}
}
}
template<class Type>
void Foam::fvTotalSource::addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "rho=" << rho.name()
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
addSupType(field, eqn);
}
template<class Type>
void Foam::fvTotalSource::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "alpha=" << alpha.name()
<< ", rho=" << rho.name()
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
addSupType(rho, field, eqn);
}
// ************************************************************************* //

View File

@ -0,0 +1,85 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "internalFvFieldSource.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::internalFvFieldSource<Type>::internalFvFieldSource
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fvFieldSource<Type>(iF, dict)
{}
template<class Type>
Foam::internalFvFieldSource<Type>::internalFvFieldSource
(
const internalFvFieldSource<Type>& field,
const DimensionedField<Type, volMesh>& iF
)
:
fvFieldSource<Type>(field, iF)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::internalFvFieldSource<Type>::~internalFvFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::internalFvFieldSource<Type>::sourceValue(const fvSource& source) const
{
// This value doesn't matter in principle, as this condition takes 100% of
// its value from the internal field. However, this value does, at least,
// need to be physical to prevent things like thermo evaluations from
// failing. So, just take the internal values.
return
tmp<Field<Type>>
(
new Field<Type>(this->internalField(), source.cells())
);
}
template<class Type>
Foam::tmp<Foam::scalarField>
Foam::internalFvFieldSource<Type>::internalCoeff(const fvSource& source) const
{
return tmp<scalarField>(new scalarField(source.nCells(), scalar(1)));
}
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::internalFvFieldSource
Description
This source condition provides the internal value.
Usage
Example of the source condition specification:
\verbatim
<patchName>
{
type internal;
}
\endverbatim
SourceFiles
internalFvFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef internalFvFieldSource_H
#define internalFvFieldSource_H
#include "fvFieldSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class internalFvFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class internalFvFieldSource
:
public fvFieldSource<Type>
{
public:
//- Runtime type information
TypeName("internal");
// Constructors
//- Construct from internal field and dictionary
internalFvFieldSource
(
const DimensionedField<Type, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
internalFvFieldSource
(
const internalFvFieldSource<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvFieldSource<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return autoPtr<fvFieldSource<Type>>
(
new internalFvFieldSource<Type>(*this, iF)
);
}
//- Destructor
virtual ~internalFvFieldSource();
// Member Functions
//- Return the source value
virtual tmp<Field<Type>> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "internalFvFieldSource.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "internalFvFieldSources.H"
#include "fvFieldSourcesFwd.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFieldSources(internal);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 internalFvFieldSources_H
#define internalFvFieldSources_H
#include "internalFvFieldSource.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTypeFieldSourceTypedefs(internal);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 internalFvFieldSourcesFwd_H
#define internalFvFieldSourcesFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class internalFvFieldSource;
makeTypeFieldSourceTypedefs(internal);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "turbulentIntensityKineticEnergyFvScalarFieldSource.H"
#include "fvSource.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::
turbulentIntensityKineticEnergyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fvScalarFieldSource(iF, dict),
intensity_(dict.lookup<scalar>("intensity")),
UName_(dict.lookupOrDefault<word>("U", "U"))
{}
Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::
turbulentIntensityKineticEnergyFvScalarFieldSource
(
const turbulentIntensityKineticEnergyFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(field, iF),
intensity_(field.intensity_),
UName_(field.UName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::
~turbulentIntensityKineticEnergyFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::sourceValue
(
const fvSource& source
) const
{
const vectorField Us(this->value<vector>(UName_, source));
return 1.5*sqr(intensity_)*magSqr(Us);
}
Foam::tmp<Foam::scalarField>
Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::internalCoeff
(
const fvSource& source
) const
{
return
neg0(source.source(internalField().name()))
*scalarField(source.nCells(), scalar(1));
}
void Foam::turbulentIntensityKineticEnergyFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry(os, "intensity", intensity_);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
turbulentIntensityKineticEnergyFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::turbulentIntensityKineticEnergyFvScalarFieldSource
Description
This source condition provides a turbulent kinetic energy based on
user-supplied turbulence intensity, defined as a fraction of the
mean velocity:
\f[
k = 1.5 (I |U|)^2
\f]
where
\vartable
k | kinetic energy values
I | turbulence intensity
U | velocity field
\endvartable
In the case of a sink, the current cell values are used instead.
Usage
\table
Property | Description | Required | Default value
intensity | fraction of mean field [0-1] | yes |
U | velocity field name | no | U
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.05; // 5% turbulence
}
\endverbatim
SourceFiles
turbulentIntensityKineticEnergyFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentIntensityKineticEnergyFvScalarFieldSource_H
#define turbulentIntensityKineticEnergyFvScalarFieldSource_H
#include "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class turbulentIntensityKineticEnergyFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class turbulentIntensityKineticEnergyFvScalarFieldSource
:
public fvScalarFieldSource
{
private:
// Private Data
//- Turbulent intensity as fraction of mean velocity
scalar intensity_;
//- Name of the velocity field
word UName_;
public:
//- Runtime type information
TypeName("turbulentIntensityKineticEnergy");
// Constructors
//- Construct from internal field and dictionary
turbulentIntensityKineticEnergyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
turbulentIntensityKineticEnergyFvScalarFieldSource
(
const turbulentIntensityKineticEnergyFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new turbulentIntensityKineticEnergyFvScalarFieldSource
(
*this,
iF
)
);
}
//- Destructor
virtual ~turbulentIntensityKineticEnergyFvScalarFieldSource();
// Member Functions
//- Return the source value
virtual tmp<scalarField> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformFixedValueFvFieldSource.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformFixedValueFvFieldSource<Type>::uniformFixedValueFvFieldSource
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fvFieldSource<Type>(iF, dict),
uniformValue_(Function1<Type>::New("uniformValue", dict))
{}
template<class Type>
Foam::uniformFixedValueFvFieldSource<Type>::uniformFixedValueFvFieldSource
(
const uniformFixedValueFvFieldSource<Type>& field,
const DimensionedField<Type, volMesh>& iF
)
:
fvFieldSource<Type>(field, iF),
uniformValue_(field.uniformValue_, false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformFixedValueFvFieldSource<Type>::~uniformFixedValueFvFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::uniformFixedValueFvFieldSource<Type>::sourceValue
(
const fvSource& source
) const
{
const scalar t = this->db().time().userTimeValue();
const Type v = uniformValue_->value(t);
return tmp<Field<Type>>(new Field<Type>(source.nCells(), v));
}
template<class Type>
Foam::tmp<Foam::scalarField>
Foam::uniformFixedValueFvFieldSource<Type>::internalCoeff
(
const fvSource& source
) const
{
return tmp<scalarField>(new scalarField(source.nCells(), scalar(0)));
}
template<class Type>
void Foam::uniformFixedValueFvFieldSource<Type>::write(Ostream& os) const
{
fvFieldSource<Type>::write(os);
writeEntry(os, uniformValue_());
}
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::uniformFixedValueFvFieldSource
Description
This source condition provides a uniform fixed value.
Usage
\table
Property | Description | Required | Default value
uniformValue | uniform value | yes |
\endtable
Example of the source condition specification with a constant value:
\verbatim
<patchName>
{
type uniformFixedValue;
uniformValue 0.1;
}
\endverbatim
Example of the source condition specification with a time-varying value:
\verbatim
<patchName>
{
type uniformFixedValue;
uniformValue
{
type table;
values
(
(0 0)
(1 0.1)
(9 0.1)
(10 0)
);
}
}
\endverbatim
SourceFiles
uniformFixedValueFvFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef uniformFixedValueFvFieldSource_H
#define uniformFixedValueFvFieldSource_H
#include "fvFieldSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformFixedValueFvFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class uniformFixedValueFvFieldSource
:
public fvFieldSource<Type>
{
private:
// Private Data
//- Uniform value
autoPtr<Function1<Type>> uniformValue_;
public:
//- Runtime type information
TypeName("uniformFixedValue");
// Constructors
//- Construct from internal field and dictionary
uniformFixedValueFvFieldSource
(
const DimensionedField<Type, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
uniformFixedValueFvFieldSource
(
const uniformFixedValueFvFieldSource<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvFieldSource<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return autoPtr<fvFieldSource<Type>>
(
new uniformFixedValueFvFieldSource<Type>(*this, iF)
);
}
//- Destructor
virtual ~uniformFixedValueFvFieldSource();
// Member Functions
//- Return the source value
virtual tmp<Field<Type>> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "uniformFixedValueFvFieldSource.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformFixedValueFvFieldSources.H"
#include "fvFieldSourcesFwd.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFieldSources(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 uniformFixedValueFvFieldSources_H
#define uniformFixedValueFvFieldSources_H
#include "uniformFixedValueFvFieldSource.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTypeFieldSourceTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 uniformFixedValueFvFieldSourcesFwd_H
#define uniformFixedValueFvFieldSourcesFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class uniformFixedValueFvFieldSource;
makeTypeFieldSourceTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformInletOutletFvFieldSource.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformInletOutletFvFieldSource<Type>::uniformInletOutletFvFieldSource
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fvFieldSource<Type>(iF, dict),
uniformInletValue_(Function1<Type>::New("uniformInletValue", dict))
{}
template<class Type>
Foam::uniformInletOutletFvFieldSource<Type>::uniformInletOutletFvFieldSource
(
const uniformInletOutletFvFieldSource<Type>& field,
const DimensionedField<Type, volMesh>& iF
)
:
fvFieldSource<Type>(field, iF),
uniformInletValue_(field.uniformInletValue_, false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformInletOutletFvFieldSource<Type>::~uniformInletOutletFvFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::uniformInletOutletFvFieldSource<Type>::sourceValue
(
const fvSource& source
) const
{
const scalar t = this->db().time().userTimeValue();
const Type v = uniformInletValue_->value(t);
return tmp<Field<Type>>(new Field<Type>(source.nCells(), v));
}
template<class Type>
Foam::tmp<Foam::scalarField>
Foam::uniformInletOutletFvFieldSource<Type>::internalCoeff
(
const fvSource& source
) const
{
return
neg0(source.source(this->internalField().name()))
*scalarField(source.nCells(), scalar(1));
}
template<class Type>
void Foam::uniformInletOutletFvFieldSource<Type>::write(Ostream& os) const
{
fvFieldSource<Type>::write(os);
writeEntry(os, uniformInletValue_());
}
// ************************************************************************* //

View File

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::uniformInletOutletFvFieldSource
Description
This source condition provides a uniform fixed value when the source is
positive, and the internal value when it is negative (i.e., a sink)
Usage
\table
Property | Description | Required | Default value
uniformInletValue | uniform inlet value | yes |
\endtable
Example of the source condition specification with a constant value:
\verbatim
<patchName>
{
type uniformInletOutletValue;
uniformInletValue 0.1;
}
\endverbatim
Example of the source condition specification with a time-varying value:
\verbatim
<patchName>
{
type uniformInletOutletValue;
uniformInletValue
{
type table;
values
(
(0 0)
(1 0.1)
(9 0.1)
(10 0)
);
}
}
\endverbatim
SourceFiles
uniformInletOutletFvFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef uniformInletOutletFvFieldSource_H
#define uniformInletOutletFvFieldSource_H
#include "fvFieldSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformInletOutletFvFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class uniformInletOutletFvFieldSource
:
public fvFieldSource<Type>
{
private:
// Private Data
//- Uniform inlet value
autoPtr<Function1<Type>> uniformInletValue_;
public:
//- Runtime type information
TypeName("uniformInletOutlet");
// Constructors
//- Construct from internal field and dictionary
uniformInletOutletFvFieldSource
(
const DimensionedField<Type, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
uniformInletOutletFvFieldSource
(
const uniformInletOutletFvFieldSource<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvFieldSource<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return autoPtr<fvFieldSource<Type>>
(
new uniformInletOutletFvFieldSource<Type>(*this, iF)
);
}
//- Destructor
virtual ~uniformInletOutletFvFieldSource();
// Member Functions
//- Return the source value
virtual tmp<Field<Type>> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "uniformInletOutletFvFieldSource.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformInletOutletFvFieldSources.H"
#include "fvFieldSourcesFwd.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFieldSources(uniformInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 uniformInletOutletFvFieldSources_H
#define uniformInletOutletFvFieldSources_H
#include "uniformInletOutletFvFieldSource.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTypeFieldSourceTypedefs(uniformInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 uniformInletOutletFvFieldSourcesFwd_H
#define uniformInletOutletFvFieldSourcesFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class uniformInletOutletFvFieldSource;
makeTypeFieldSourceTypedefs(uniformInletOutlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,231 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "fvFieldSource.H"
#include "fvSource.H"
#include "volMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fvFieldSource<Type>::fvFieldSource
(
const DimensionedField<Type, volMesh>& iF
)
:
libs_(fileNameList::null()),
internalField_(iF)
{}
template<class Type>
Foam::fvFieldSource<Type>::fvFieldSource
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
libs_(dict.lookupOrDefault("libs", fileNameList::null())),
internalField_(iF)
{}
template<class Type>
Foam::fvFieldSource<Type>::fvFieldSource
(
const fvFieldSource<Type>& field,
const DimensionedField<Type, volMesh>& iF
)
:
libs_(field.libs_),
internalField_(iF)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::fvFieldSource<Type>>
Foam::fvFieldSource<Type>::New
(
const word& fieldSourceType,
const DimensionedField<Type, volMesh>& iF
)
{
typename nullConstructorTable::iterator cstrIter =
nullConstructorTablePtr_->find(fieldSourceType);
if (cstrIter == nullConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown null-constructable fieldSource type " << fieldSourceType
<< nl << nl << "Valid fieldSource types are :" << endl
<< nullConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return cstrIter()(iF);
}
template<class Type>
Foam::autoPtr<Foam::fvFieldSource<Type>>
Foam::fvFieldSource<Type>::New
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
{
const word fieldSourceType(dict.lookup("type"));
libs.open(dict, "libs", dictionaryConstructorTablePtr_);
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(fieldSourceType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
if (!disallowGenericFvFieldSource)
{
cstrIter = dictionaryConstructorTablePtr_->find("generic");
}
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalIOErrorInFunction(dict)
<< "Unknown fieldSource type " << fieldSourceType
<< " for model " << dict.dictName() << nl << nl
<< "Valid fieldSource types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
}
return cstrIter()(iF, dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::fvFieldSource<Type>::~fvFieldSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::objectRegistry& Foam::fvFieldSource<Type>::db() const
{
return internalField_.mesh();
}
template<class Type>
const Foam::DimensionedField<Type, Foam::volMesh>&
Foam::fvFieldSource<Type>::internalField() const
{
return internalField_;
}
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::fvFieldSource<Type>::sourceCoeff
(
const fvSource& source
) const
{
return (1 - internalCoeff(source))*sourceValue(source);
}
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::fvFieldSource<Type>::value
(
const fvSource& source
) const
{
const Field<Type> setInternalField
(
UIndirectList<Type>(internalField(), source.cells())
);
return sourceCoeff(source) + internalCoeff(source)*setInternalField;
}
template<class Type>
template<class OtherType>
const Foam::fvFieldSource<OtherType>& Foam::fvFieldSource<Type>::fieldSource
(
const word& name,
const fvSource& source
) const
{
const VolField<OtherType>& vf =
db().template lookupObject<VolField<OtherType>>(name);
return vf.sources()[source.name()];
}
template<class Type>
template<class OtherType>
Foam::tmp<Foam::Field<OtherType>> Foam::fvFieldSource<Type>::value
(
const word& name,
const fvSource& source
) const
{
return fieldSource<OtherType>(name, source).value(source);
}
template<class Type>
void Foam::fvFieldSource<Type>::write(Ostream& os) const
{
writeEntry(os, "type", type());
if (libs_.size())
{
writeEntry(os, "libs", libs_);
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<(Ostream& os, const fvFieldSource<Type>& ptf)
{
ptf.write(os);
os.check("Ostream& operator<<(Ostream&, const fvFieldSource<Type>&");
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,326 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::fvFieldSource
Description
Base class for finite-volume field sources
SourceFiles
fvFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef fvFieldSource_H
#define fvFieldSource_H
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class volMesh;
class dictionary;
class fvSource;
template<class Type>
class fvFieldSource;
// Forward declaration of friend functions and operators
template<class Type>
Ostream& operator<<(Ostream&, const fvFieldSource<Type>&);
/*---------------------------------------------------------------------------*\
Class fvFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fvFieldSource
{
// Private Data
//- Optional list of libraries required for this field source value
fileNameList libs_;
//- Reference to internal field
const DimensionedField<Type, volMesh>& internalField_;
public:
//- Runtime type information
TypeName("fvFieldSource");
//- Debug switch to disallow the use of genericFvFieldSource
static int disallowGenericFvFieldSource;
// Declare run-time constructor selection tables
//- Select given internal field
declareRunTimeSelectionTable
(
autoPtr,
fvFieldSource,
null,
(const DimensionedField<Type, volMesh>& iF),
(iF)
);
//- Select given internal field and dictionary
declareRunTimeSelectionTable
(
autoPtr,
fvFieldSource,
dictionary,
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
),
(iF, dict)
);
// Constructors
//- Construct from internal field
fvFieldSource(const DimensionedField<Type, volMesh>&);
//- Construct from internal field and dictionary
fvFieldSource
(
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Disallow copy without setting internal field reference
fvFieldSource(const fvFieldSource<Type>&) = delete;
//- Disallow clone without setting internal field reference
autoPtr<fvFieldSource<Type>> clone() const
{
NotImplemented;
return autoPtr<fvFieldSource<Type>>(nullptr);
}
//- Copy constructor setting internal field reference
fvFieldSource
(
const fvFieldSource<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvFieldSource<Type>> clone
(
const DimensionedField<Type, volMesh>&
) const = 0;
// Selectors
//- Return a pointer to a new field source
static autoPtr<fvFieldSource<Type>> New
(
const word& fieldSourceType,
const DimensionedField<Type, volMesh>&
);
//- Return a pointer to a new field source created from a dictionary
static autoPtr<fvFieldSource<Type>> New
(
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Destructor
virtual ~fvFieldSource();
// Member Functions
//- Return the local object registry
const objectRegistry& db() const;
//- Return the internal field reference
const DimensionedField<Type, volMesh>& internalField() const;
//- Return the source value
virtual tmp<Field<Type>> sourceValue(const fvSource&) const = 0;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const = 0;
//- Return the source coefficient
tmp<Field<Type>> sourceCoeff(const fvSource&) const;
//- Return the value
tmp<Field<Type>> value(const fvSource&) const;
//- Lookup and return another field source
template<class OtherType>
const fvFieldSource<OtherType>& fieldSource
(
const word& name,
const fvSource&
) const;
//- Lookup and return the value of another field source
template<class OtherType>
tmp<Field<OtherType>> value
(
const word& name,
const fvSource&
) const;
//- Write
virtual void write(Ostream&) const;
//- Ostream operator
friend Ostream& operator<< <Type>(Ostream&, const fvFieldSource<Type>&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fvFieldSource.C"
#endif
#define makeFvFieldSource(fvTypeFieldSource) \
defineNamedTemplateTypeNameAndDebug(fvTypeFieldSource, 0); \
template<> \
int fvTypeFieldSource::disallowGenericFvFieldSource \
( \
debug::debugSwitch("disallowGenericFvFieldSource", 0) \
); \
defineTemplateRunTimeSelectionTable(fvTypeFieldSource, null); \
defineTemplateRunTimeSelectionTable(fvTypeFieldSource, dictionary)
#define addToFieldSourceRunTimeSelection(TypeFieldSource, typeTypeFieldSource) \
addToRunTimeSelectionTable \
( \
TypeFieldSource, \
typeTypeFieldSource, \
dictionary \
)
#define addNullConstructableToFieldSourceRunTimeSelection( \
TypeFieldSource, typeTypeFieldSource) \
addToRunTimeSelectionTable \
( \
TypeFieldSource, \
typeTypeFieldSource, \
null \
); \
addToFieldSourceRunTimeSelection(TypeFieldSource, typeTypeFieldSource)
#define makeTypeFieldSource(TypeFieldSource, typeTypeFieldSource) \
defineTypeNameAndDebug(typeTypeFieldSource, 0); \
addToFieldSourceRunTimeSelection(TypeFieldSource, typeTypeFieldSource)
#define makeNullConstructableTypeFieldSource( \
TypeFieldSource, typeTypeFieldSource) \
defineTypeNameAndDebug(typeTypeFieldSource, 0); \
addNullConstructableToFieldSourceRunTimeSelection \
( \
TypeFieldSource, \
typeTypeFieldSource \
)
#define makeTemplateTypeFieldSource(fieldType, type) \
defineNamedTemplateTypeNameAndDebug \
( \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource), \
0 \
); \
addToFieldSourceRunTimeSelection \
( \
CAT3(fv, CAPITALIZE(fieldType), FieldSource), \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource) \
);
#define makeNullConstructableTemplateTypeFieldSource(fieldType, type) \
defineNamedTemplateTypeNameAndDebug \
( \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource), \
0 \
); \
addNullConstructableToFieldSourceRunTimeSelection \
( \
CAT3(fv, CAPITALIZE(fieldType), FieldSource), \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource) \
);
#define makeFieldSources(type) \
FOR_ALL_FIELD_TYPES(makeTemplateTypeFieldSource, type)
#define makeNullConstructableFieldSources(type) \
FOR_ALL_FIELD_TYPES(makeNullConstructableTemplateTypeFieldSource, type)
#define makeFieldSourceTypeName(fieldType, type) \
defineNamedTemplateTypeNameAndDebug \
( \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource), \
0 \
);
#define makeFieldSourceTypeNames(type) \
FOR_ALL_FIELD_TYPES(makeFieldSourceTypeName, type)
#define makeTypeFieldSourceTypedef(fieldType, type) \
typedef type##FvFieldSource<fieldType> \
CAT4(type, Fv, CAPITALIZE(fieldType), FieldSource);
#define makeTypeFieldSourceTypedefs(type) \
FOR_ALL_FIELD_TYPES(makeTypeFieldSourceTypedef, type)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvFieldSource(fvLabelFieldSource);
makeFvFieldSource(fvScalarFieldSource);
makeFvFieldSource(fvVectorFieldSource);
makeFvFieldSource(fvSphericalTensorFieldSource);
makeFvFieldSource(fvSymmTensorFieldSource);
makeFvFieldSource(fvTensorFieldSource);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 fvFieldSources_H
#define fvFieldSources_H
#include "fvFieldSource.H"
#include "fvFieldSourcesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 fvFieldSourcesFwd_H
#define fvFieldSourcesFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class fvFieldSource;
typedef fvFieldSource<label> fvLabelFieldSource;
#define makeFieldSourceTypedef(fieldType, dummy) \
typedef fvFieldSource<fieldType> \
CAT3(fv, CAPITALIZE(fieldType), FieldSource);
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,12 +48,18 @@ class surfaceMesh;
template<class Type>
class fvsPatchField;
template<class Type, class GeoMesh>
class NoFieldSource;
template<class Type, template<class> class PatchField, class GeoMesh>
class GeometricField;
template<class Type>
using SurfaceField = GeometricField<Type, fvsPatchField, surfaceMesh>;
template<class Type>
using fvsFieldSource = NoFieldSource<Type, surfaceMesh>;
typedef SurfaceField<label> surfaceLabelField;
typedef SurfaceField<scalar> surfaceScalarField;
typedef SurfaceField<vector> surfaceVectorField;

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,6 +38,7 @@ SourceFiles
#include "volMesh.H"
#include "fvMesh.H"
#include "fvPatchField.H"
#include "fvFieldSource.H"
#include "volFieldsFwd.H"
#include "calculatedFvPatchFields.H"

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,6 +54,9 @@ class GeometricField;
template<class Type>
using VolField = GeometricField<Type, fvPatchField, volMesh>;
template<class Type>
class fvFieldSource;
template<class Type>
using VolInternalField = typename VolField<Type>::Internal;

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,24 +48,39 @@ class surfaceMesh
:
public GeoMesh<fvMesh>
{
public:
// Public typedefs
//- Field source type
template<class Type>
using FieldSource = fvsFieldSource<Type>;
// Constructors
//- Construct from fvMesh
explicit surfaceMesh(const fvMesh& mesh)
:
GeoMesh<fvMesh>(mesh)
{}
// Member Functions
//- Return size
label size() const
{
return size(mesh_);
}
//- Return size
static label size(const Mesh& mesh)
{
return mesh.nInternalFaces();
}
//- Return face centres
const surfaceVectorField& C()
{
return mesh_.Cf();

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-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,6 +59,13 @@ class volMesh
public:
// Public typedefs
//- Field source type
template<class Type>
using FieldSource = fvFieldSource<Type>;
// Constructors
//- Construct from fvMesh

View File

@ -81,8 +81,9 @@ void Foam::fv::zeroDimensionalFixedPressureModel::addSupType
) const
{
FatalErrorInFunction
<< "Cannot add a fixed pressure source of field " << field.name()
<< " because this field's equation is not in mass-conservative form"
<< "Cannot add a fixed pressure source for field " << field.name()
<< " to equation for " << eqn.psi().name() << " because this field's "
<< "equation was not recognised as being in mass-conservative form"
<< exit(FatalError);
}

View File

@ -24,9 +24,11 @@ derived/accelerationSource/accelerationSource.C
derived/volumeFractionSource/volumeFractionSource.C
derived/solidEquilibriumEnergySource/solidEquilibriumEnergySource.C
derived/volumeSource/volumeSource.C
derived/massSource/massSourceBase.C
derived/massSource/massSource.C
derived/heatSource/heatSource.C
derived/heatTransfer/heatTransfer.C
derived/zeroDimensionalMassSource/zeroDimensionalMassSourceBase.C
derived/zeroDimensionalMassSource/zeroDimensionalMassSource.C
interRegion/interRegionModel/interRegionModel.C

View File

@ -25,7 +25,6 @@ License
#include "massSource.H"
#include "fvMatrices.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -34,7 +33,6 @@ namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(massSourceBase, 0);
defineTypeNameAndDebug(massSource, 0);
addToRunTimeSelectionTable(fvModel, massSource, dictionary);
}
@ -43,211 +41,9 @@ namespace fv
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::massSourceBase::readCoeffs()
{
phaseName_ = coeffs().lookupOrDefault<word>("phase", word::null);
rhoName_ =
coeffs().lookupOrDefault<word>
(
"rho",
IOobject::groupName("rho", phaseName_)
);
if
(
mesh().foundObject<basicThermo>
(
IOobject::groupName(physicalProperties::typeName, phaseName_)
)
)
{
const basicThermo& thermo =
mesh().lookupObject<basicThermo>
(
IOobject::groupName(physicalProperties::typeName, phaseName_)
);
heName_ = thermo.he().name();
TName_ = thermo.T().name();
}
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
FatalErrorInFunction
<< "Cannot add a mass source for field " << field.name()
<< " because this field's equation is not in mass-conservative form"
<< exit(FatalError);
}
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& field,
fvMatrix<scalar>& eqn
) const
{
// Continuity equation. Add the mass flow rate.
if (field.name() == rhoName_)
{
const labelUList cells = set_.cells();
const scalar massFlowRate = this->massFlowRate();
forAll(cells, i)
{
eqn.source()[cells[i]] -=
mesh().V()[cells[i]]/set_.V()*massFlowRate;
}
return;
}
// Non-mass conservative property equation. Fail.
addSupType<scalar>(field, eqn);
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
const labelUList cells = set_.cells();
const scalar massFlowRate = this->massFlowRate();
// Property equation. If the source is positive, introduce the value
// specified by the user. If negative, then sink the current internal value
// using an implicit term.
if (massFlowRate > 0)
{
const Type value =
fieldValues_[field.name()]->template value<Type>
(
mesh().time().userTimeValue()
);
forAll(cells, i)
{
eqn.source()[cells[i]] -=
mesh().V()[cells[i]]/set_.V()*massFlowRate*value;
}
}
else
{
forAll(cells, i)
{
eqn.diag()[cells[i]] +=
mesh().V()[cells[i]]/set_.V()*massFlowRate;
}
}
}
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& rho,
const volScalarField& field,
fvMatrix<scalar>& eqn
) const
{
// Multiphase continuity equation. Same source as single-phase case.
if (field.name() == rhoName_)
{
addSupType(field, eqn);
return;
}
// Energy equation. Special handling for if temperature is specified.
if (field.name() == heName_ && fieldValues_.found(TName_))
{
const labelUList cells = set_.cells();
const scalar massFlowRate = this->massFlowRate();
if (massFlowRate > 0)
{
if (fieldValues_.found(heName_))
{
WarningInFunction
<< "Source " << name() << " defined for both field "
<< heName_ << " and " << TName_
<< ". Only one of these should be present." << endl;
}
const basicThermo& thermo =
mesh().lookupObject<basicThermo>
(
IOobject::groupName
(
physicalProperties::typeName,
phaseName_
)
);
const scalar T =
fieldValues_[TName_]->value<scalar>
(
mesh().time().userTimeValue()
);
const scalarField hs
(
thermo.hs(scalarField(cells.size(), T), cells)
);
forAll(cells, i)
{
eqn.source()[cells[i]] -=
mesh().V()[cells[i]]/set_.V()*massFlowRate*hs[i];
}
}
else
{
forAll(cells, i)
{
eqn.diag()[cells[i]] +=
mesh().V()[cells[i]]/set_.V()*massFlowRate;
}
}
return;
}
// Property equation
addSupType<scalar>(rho, field, eqn);
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
// Multiphase property equation. Same source as the single phase case.
addSupType(rho, field, eqn);
}
void Foam::fv::massSource::readCoeffs()
{
readSet();
readFieldValues();
setPtr_->read(coeffs());
massFlowRate_.reset
(
@ -256,57 +52,8 @@ void Foam::fv::massSource::readCoeffs()
}
Foam::scalar Foam::fv::massSource::massFlowRate() const
{
return massFlowRate_->value(mesh().time().userTimeValue());
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fv::massSourceBase::readSet()
{
set_.read(coeffs());
}
void Foam::fv::massSourceBase::readFieldValues()
{
fieldValues_.clear();
const dictionary& fieldCoeffs = coeffs().subDict("fieldValues");
forAllConstIter(dictionary, fieldCoeffs, iter)
{
fieldValues_.set
(
iter().keyword(),
new unknownTypeFunction1(iter().keyword(), fieldCoeffs)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::massSourceBase::massSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvModel(name, modelType, mesh, dict),
phaseName_(),
rhoName_(),
heName_(),
TName_(),
set_(fvCellSet(mesh)),
fieldValues_()
{
readCoeffs();
}
Foam::fv::massSource::massSource
(
const word& name,
@ -316,6 +63,7 @@ Foam::fv::massSource::massSource
)
:
massSourceBase(name, modelType, mesh, dict),
setPtr_(new fvCellSet(mesh)),
massFlowRate_()
{
readCoeffs();
@ -324,101 +72,57 @@ Foam::fv::massSource::massSource
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::massSourceBase::addsSupToField(const word& fieldName) const
Foam::labelUList Foam::fv::massSource::cells() const
{
const bool isMixture = IOobject::group(fieldName) == word::null;
const bool isThisPhase = IOobject::group(fieldName) == phaseName_;
return setPtr_->cells();
}
if
Foam::label Foam::fv::massSource::nCells() const
{
return setPtr_->nCells();
}
Foam::scalar Foam::fv::massSource::V() const
{
return setPtr_->V();
}
Foam::dimensionedScalar Foam::fv::massSource::S() const
{
return
dimensionedScalar
(
(isMixture || isThisPhase)
&& massFlowRate() > 0
&& !(fieldName == rhoName_)
&& !(fieldName == heName_ && fieldValues_.found(TName_))
&& !fieldValues_.found(fieldName)
)
{
WarningInFunction
<< "No value supplied for field " << fieldName << " in "
<< type() << " fvModel " << name() << endl;
return false;
}
return isMixture || isThisPhase;
dimMass/dimTime,
massFlowRate_->value(mesh().time().userTimeValue())
);
}
Foam::wordList Foam::fv::massSourceBase::addSupFields() const
bool Foam::fv::massSource::movePoints()
{
wordList fieldNames = fieldValues_.toc();
if (fieldValues_.found(TName_))
{
fieldNames[findIndex(fieldNames, TName_)] = heName_;
}
return fieldNames;
}
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_FIELD_SUP,
fv::massSourceBase
)
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP,
fv::massSourceBase
)
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP,
fv::massSourceBase
)
bool Foam::fv::massSourceBase::movePoints()
{
set_.movePoints();
setPtr_->movePoints();
return true;
}
void Foam::fv::massSourceBase::topoChange(const polyTopoChangeMap& map)
void Foam::fv::massSource::topoChange(const polyTopoChangeMap& map)
{
set_.topoChange(map);
setPtr_->topoChange(map);
}
void Foam::fv::massSourceBase::mapMesh(const polyMeshMap& map)
void Foam::fv::massSource::mapMesh(const polyMeshMap& map)
{
set_.mapMesh(map);
setPtr_->mapMesh(map);
}
void Foam::fv::massSourceBase::distribute(const polyDistributionMap& map)
void Foam::fv::massSource::distribute(const polyDistributionMap& map)
{
set_.distribute(map);
}
bool Foam::fv::massSourceBase::read(const dictionary& dict)
{
if (fvModel::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
setPtr_->distribute(map);
}

View File

@ -30,12 +30,11 @@ Description
isothermalFluid, compressibleVoF and multiphaseEuler. For incompressible
solvers, use the volumeSource model instead.
If the mass flow rate is positive then user-supplied fixed property values
are introduced to the field equations. If the mass flow rate is negative
then properties are removed at their current value.
This model requires a corresponding field source to be specified for all
solved-for fields.
Usage
Example usage:
Example usage for a constant mass flow rate applied to a cell set:
\verbatim
massSource
{
@ -45,21 +44,28 @@ Usage
cellSet massSource;
massFlowRate 1e-4;
fieldValues
{
U (10 0 0);
T 300;
k 0.375;
epsilon 14.855;
}
}
\endverbatim
If the mass flow rate is positive then values should be provided for all
solved for fields. Warnings will be issued if values are not provided for
fields for which transport equations are solved. Warnings will also be
issued if values are provided for fields which are not solved for.
Example usage for a pulsing flow rate applied at a point:
\verbatim
massSource
{
type massSource;
select points;
points ((2.75 0.5 0));
massFlowRate
{
type scale;
scale squarePulse;
start 0.2;
duration 2;
value 1e-4;
}
}
\endverbatim
SourceFiles
massSource.C
@ -72,10 +78,8 @@ See also
#ifndef massSource_H
#define massSource_H
#include "fvModel.H"
#include "fvCellSet.H"
#include "HashPtrTable.H"
#include "unknownTypeFunction1.H"
#include "massSourceBase.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -84,176 +88,6 @@ namespace Foam
namespace fv
{
/*---------------------------------------------------------------------------*\
Class massSourceBase Declaration
\*---------------------------------------------------------------------------*/
class massSourceBase
:
public fvModel
{
private:
// Private Data
//- Name of the phase
word phaseName_;
//- Name of the density field
word rhoName_;
//- Name of the energy field
word heName_;
//- Name of the temperature field
word TName_;
//- The set of cells the fvConstraint applies to
fvCellSet set_;
//- Field values
HashPtrTable<unknownTypeFunction1> fieldValues_;
// Private Member Functions
//- Non-virtual read
void readCoeffs();
//- Return the mass flow rate
virtual scalar massFlowRate() const = 0;
// Sources
//- Add a source term to an equation
template<class Type>
void addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a scalar equation
void addSupType
(
const volScalarField& field,
fvMatrix<scalar>& eqn
) const;
//- Add a source term to a compressible equation
template<class Type>
void addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a compressible scalar equation
void addSupType
(
const volScalarField& rho,
const volScalarField& field,
fvMatrix<scalar>& eqn
) const;
//- Add a source term to a phase equation
template<class Type>
void addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
protected:
// Protected Member Functions
//- Read the set
void readSet();
//- Read the field values
void readFieldValues();
public:
//- Runtime type information
TypeName("massSourceBase");
// Constructors
//- Construct from explicit source name and mesh
massSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Disallow default bitwise copy construction
massSourceBase(const massSourceBase&) = delete;
// Member Functions
// Checks
//- Return true if the fvModel adds a source term to the given
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// Sources
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_FIELD_SUP)
//- Add a source term to a compressible equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP)
//- Add a source term to a phase equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP)
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
// Member Operators
//- Disallow default bitwise assignment
void operator=(const massSourceBase&) = delete;
};
/*---------------------------------------------------------------------------*\
Class massSource Declaration
\*---------------------------------------------------------------------------*/
@ -266,6 +100,9 @@ private:
// Private Data
//- The set of cells the source applies to
autoPtr<fvCellSet> setPtr_;
//- Mass flow rate
autoPtr<Function1<scalar>> massFlowRate_;
@ -275,9 +112,6 @@ private:
//- Non-virtual read
void readCoeffs();
//- Return the mass flow rate
virtual scalar massFlowRate() const;
public:
@ -299,7 +133,38 @@ public:
// Member Functions
// IO
// Access
//- Return the cells that the source applies to
virtual labelUList cells() const;
//- Return the number of cells that the source applies to
virtual label nCells() const;
//- Return the volume of cells that the source applies to
virtual scalar V() const;
// Sources
//- Return the source value
virtual dimensionedScalar S() const;
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
//- Read source dictionary
virtual bool read(const dictionary& dict);

View File

@ -0,0 +1,235 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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 "massSourceBase.H"
#include "fvMatrices.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(massSourceBase, 0);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::massSourceBase::readCoeffs()
{
rhoName_ =
coeffs().lookupOrDefault<word>
(
"rho",
IOobject::groupName("rho", phaseName())
);
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
FatalErrorInFunction
<< "Cannot add a mass source for field " << field.name()
<< " to equation for " << eqn.psi().name() << " because this field's "
<< "equation was not recognised as being in mass-conservative form"
<< exit(FatalError);
}
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& rhoOrField,
fvMatrix<scalar>& eqn
) const
{
DebugInFunction
<< "rhoOrField=" << rhoOrField.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Single-phase continuity equation
if (phaseName() == word::null && rhoOrField.name() == rhoName_)
{
fvTotalSource::addSource(eqn);
}
// Not recognised. Fail.
else
{
addSupType<scalar>(rhoOrField, eqn);
}
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "rho=" << rho.name()
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Single-phase property equation
if (phaseName() == word::null && rho.name() == rhoName_)
{
fvTotalSource::addSupType(rho, field, eqn);
}
// Multiphase mass-weighted mixture property equation
else if
(
phaseName() != word::null
&& rho.group() == word::null
&& rho.dimensions() == dimDensity
&& field.group() == word::null
)
{
fvTotalSource::addSupType(rho, field, eqn);
}
// Not recognised. Fail.
else
{
addSupType<Type>(field, eqn);
}
}
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& alphaOrRho,
const volScalarField& rhoOrField,
fvMatrix<scalar>& eqn
) const
{
DebugInFunction
<< "alphaOrRho=" << alphaOrRho.name()
<< ", rhoOrField=" << rhoOrField.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Multiphase continuity equation
if (rhoOrField.name() == rhoName_)
{
fvTotalSource::addSource(eqn);
}
// Try the general type method
else
{
addSupType<scalar>(alphaOrRho, rhoOrField, eqn);
}
}
template<class Type>
void Foam::fv::massSourceBase::addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "alpha=" << alpha.name()
<< ", rho=" << rho.name()
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Multiphase property equation
fvTotalSource::addSupType(alpha, rho, field, eqn);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::massSourceBase::massSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
fvTotalSource(name, modelType, mesh, dict),
rhoName_()
{
readCoeffs();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::massSourceBase::addSup(fvMatrix<scalar>& eqn) const
{
DebugInFunction
<< "eqnField=" << eqn.psi().name() << endl;
FatalErrorInFunction
<< "Field-less mass sources are not possible"
<< exit(FatalError);
}
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_FIELD_SUP, fv::massSourceBase);
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP, fv::massSourceBase);
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP,
fv::massSourceBase
);
bool Foam::fv::massSourceBase::read(const dictionary& dict)
{
if (fvTotalSource::read(dict))
{
readCoeffs();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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::fv::massSourceBase
Description
Base class for mass source models
SourceFiles
massSourceBase.C
\*---------------------------------------------------------------------------*/
#ifndef massSourceBase_H
#define massSourceBase_H
#include "fvTotalSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class massSourceBase Declaration
\*---------------------------------------------------------------------------*/
class massSourceBase
:
public fvTotalSource
{
private:
// Private Data
//- Name of the density field
word rhoName_;
// Private Member Functions
//- Non-virtual read
void readCoeffs();
// Sources
//- Add a source term to an equation
template<class Type>
void addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a scalar equation
void addSupType
(
const volScalarField& rhoOrField,
fvMatrix<scalar>& eqn
) const;
//- Add a source term to a compressible equation
template<class Type>
void addSupType
(
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to a compressible scalar equation
void addSupType
(
const volScalarField& alphaOrRho,
const volScalarField& rhoOrField,
fvMatrix<scalar>& eqn
) const;
//- Add a source term to a phase equation
template<class Type>
void addSupType
(
const volScalarField& alpha,
const volScalarField& rho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
public:
//- Runtime type information
TypeName("massSourceBase");
// Constructors
//- Construct from explicit source name and mesh
massSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
// Member Functions
// Sources
//- Add a source term to a field-less proxy equation
virtual void addSup(fvMatrix<scalar>& eqn) const;
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_FIELD_SUP);
//- Add a source term to a compressible equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP);
//- Add a source term to a phase equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP);
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,20 +44,16 @@ namespace fv
void Foam::fv::volumeSource::readCoeffs()
{
phaseName_ = coeffs().lookupOrDefault<word>("phase", word::null);
alphaName_ =
phaseName_ == word::null
phaseName() == word::null
? word::null
: coeffs().lookupOrDefault<word>
(
"alpha",
IOobject::groupName("alpha", phaseName_)
IOobject::groupName("alpha", phaseName())
);
readSet();
readFieldValues();
setPtr_->read(coeffs());
volumetricFlowRate_.reset
(
@ -66,130 +62,100 @@ void Foam::fv::volumeSource::readCoeffs()
}
Foam::scalar Foam::fv::volumeSource::volumetricFlowRate() const
{
return volumetricFlowRate_->value(mesh().time().userTimeValue());
}
template<class Type>
void Foam::fv::volumeSource::addSupType(fvMatrix<Type>& eqn) const
{
FatalErrorInFunction
<< "Continuity sources for non-scalar types are not supported"
<< exit(FatalError);
}
void Foam::fv::volumeSource::addSupType(fvMatrix<scalar>& eqn) const
{
const labelUList cells = set_.cells();
const scalar volumetricFlowRate = this->volumetricFlowRate();
// Continuity equation. Add the volumetric flow rate.
forAll(cells, i)
{
eqn.source()[cells[i]] -=
mesh().V()[cells[i]]/set_.V()*volumetricFlowRate;
}
}
template<class Type>
void Foam::fv::volumeSource::addSupType
(
const dimensionedScalar& oneOrRho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
const labelUList cells = set_.cells();
DebugInFunction
<< "field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
const scalar flowRate = this->volumetricFlowRate()*oneOrRho.value();
// Property equation. If the source is positive, introduce the value
// specified by the user. If negative, then sink the current internal value
// using an implicit term.
if (flowRate > 0)
// Single-phase property equation
if (phaseName() == word::null && field.group() == word::null)
{
const Type value =
fieldValues_[field.name()]->template value<Type>
(
mesh().time().userTimeValue()
);
forAll(cells, i)
fvTotalSource::addSupType(field, eqn);
}
// Multiphase volume-weighted mixture property equation (e.g., a turbulence
// equation if running standard incompressible transport modelling in the
// incompressibleVoF solver)
else if (phaseName() != word::null && field.group() == word::null)
{
eqn.source()[cells[i]] -=
mesh().V()[cells[i]]/set_.V()*flowRate*value;
}
fvTotalSource::addSupType(field, eqn);
}
// Not recognised. Fail.
else
{
forAll(cells, i)
{
eqn.diag()[cells[i]] +=
mesh().V()[cells[i]]/set_.V()*flowRate;
const volScalarField& null = NullObjectRef<volScalarField>();
addSupType(null, null, field, eqn);
}
}
}
template<class Type>
void Foam::fv::volumeSource::addSupType
(
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
// Property equation
addSupType(dimensionedScalar(dimless, scalar(1)), field, eqn);
}
void Foam::fv::volumeSource::addSupType
(
const volScalarField& field,
const volScalarField& alphaOrField,
fvMatrix<scalar>& eqn
) const
{
// Multiphase continuity equation. Same source as single-phase case.
if (field.name() == alphaName_)
{
addSupType(eqn);
return;
}
DebugInFunction
<< "alphaOrField=" << alphaOrField.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Property equation
addSupType<scalar>(field, eqn);
// Multiphase continuity equation
if (phaseName() != word::null && alphaOrField.name() == alphaName_)
{
fvTotalSource::addSource(eqn);
}
// Try the general type method
else
{
addSupType<scalar>(alphaOrField, eqn);
}
}
template<class Type>
void Foam::fv::volumeSource::addSupType
(
const volScalarField& rho,
const volScalarField& alphaOrRho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const
{
// Multiphase property equation (e.g., turbulence equation if running
DebugInFunction
<< "alphaOrRho=" << alphaOrRho.name()
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
// Multiphase property equation (e.g., a turbulence equation if running
// two-phase transport modelling in the incompressibleVoF solver)
if (rho.name() == alphaName_)
if (phaseName() != word::null && alphaOrRho.name() == alphaName_)
{
addSupType(dimensionedScalar(dimless, scalar(1)), field, eqn);
return;
fvTotalSource::addSupType(field, eqn);
}
// Multiphase mass-weighted mixture property equation (e.g., the momentum
// equation in the incompressibleVoF solver)
else if
(
phaseName() != word::null
&& alphaOrRho.group() == word::null
&& alphaOrRho.dimensions() == dimDensity
&& field.group() == word::null
)
{
// First we construct the volumetric source...
fvMatrix<Type> volEqn(eqn.psi(), eqn.dimensions()/dimDensity);
fvTotalSource::addSupType(field, volEqn);
// Mixture property equation (e.g., the momentum equation in the
// incompressibleVoF solver)...
// We need to know the density of the phase of which this is a source in
// order to create the relevant term. There is no solver-agnostic
// interface, at present, that lets us do this. So, read the density from
// the physical properties file. This is clunky, but it should work in all
// circumstances. This is what the clouds fvModel does,
// Then, to apply it to the mixture equation, we need to multiply by
// the density of the phase of which this is a source. There is no
// solver-agnostic interface, at present, that lets us obtain this
// density. So, we read it from the physical properties file. This is
// clunky, but it should work in all circumstances. This is what the
// clouds fvModel does,
const dimensionedScalar rhoi
(
"rho",
@ -199,12 +165,18 @@ void Foam::fv::volumeSource::addSupType
IOobject::groupName
(
physicalProperties::typeName,
phaseName_
phaseName()
)
)
);
addSupType(rhoi, field, eqn);
eqn += rhoi*volEqn;
}
// Not recognised. Fail.
else
{
const volScalarField& null = NullObjectRef<volScalarField>();
addSupType(null, alphaOrRho, field, eqn);
}
}
@ -217,36 +189,20 @@ void Foam::fv::volumeSource::addSupType
fvMatrix<Type>& eqn
) const
{
DebugInFunction
<< "alpha=" << (isNull(alpha) ? word::null : alpha.name())
<< ", rho=" << (isNull(rho) ? word::null : rho.name())
<< ", field=" << field.name()
<< ", eqnField=" << eqn.psi().name() << endl;
FatalErrorInFunction
<< "Cannot add a volume source for field " << field.name()
<< " because this field's equation is not in volume-conservative form"
<< " to equation for " << eqn.psi().name() << " because this field's "
<< "equation was not recognised as being in volume-conservative form"
<< exit(FatalError);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fv::volumeSource::readSet()
{
set_.read(coeffs());
}
void Foam::fv::volumeSource::readFieldValues()
{
fieldValues_.clear();
const dictionary& fieldCoeffs = coeffs().subDict("fieldValues");
forAllConstIter(dictionary, fieldCoeffs, iter)
{
fieldValues_.set
(
iter().keyword(),
new unknownTypeFunction1(iter().keyword(), fieldCoeffs)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::volumeSource::volumeSource
@ -257,10 +213,9 @@ Foam::fv::volumeSource::volumeSource
const dictionary& dict
)
:
fvModel(name, modelType, mesh, dict),
phaseName_(),
set_(fvCellSet(mesh)),
fieldValues_(),
fvTotalSource(name, modelType, mesh, dict),
alphaName_(),
setPtr_(new fvCellSet(mesh)),
volumetricFlowRate_()
{
readCoeffs();
@ -269,55 +224,49 @@ Foam::fv::volumeSource::volumeSource
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::volumeSource::addsSupToField(const word& fieldName) const
Foam::labelUList Foam::fv::volumeSource::cells() const
{
const bool isMixture = IOobject::group(fieldName) == word::null;
const bool isThisPhase = IOobject::group(fieldName) == phaseName_;
return setPtr_->cells();
}
if
Foam::label Foam::fv::volumeSource::nCells() const
{
return setPtr_->nCells();
}
Foam::scalar Foam::fv::volumeSource::V() const
{
return setPtr_->V();
}
Foam::dimensionedScalar Foam::fv::volumeSource::S() const
{
return
dimensionedScalar
(
(isMixture || isThisPhase)
&& volumetricFlowRate() > 0
&& !(fieldName == alphaName_)
&& !fieldValues_.found(fieldName)
)
{
WarningInFunction
<< "No value supplied for field " << fieldName << " in "
<< type() << " fvModel " << name() << endl;
return false;
}
return isMixture || isThisPhase;
dimVolume/dimTime,
volumetricFlowRate_->value(mesh().time().userTimeValue())
);
}
Foam::wordList Foam::fv::volumeSource::addSupFields() const
void Foam::fv::volumeSource::addSup(fvMatrix<scalar>& eqn) const
{
return fieldValues_.toc();
DebugInFunction
<< "eqnField=" << eqn.psi().name() << endl;
// Single-phase continuity equation
fvTotalSource::addSource(eqn);
}
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_SUP,
fv::volumeSource
)
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_FIELD_SUP, fv::volumeSource)
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_FIELD_SUP,
fv::volumeSource
)
FOR_ALL_FIELD_TYPES
(
IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP,
fv::volumeSource
)
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_RHO_FIELD_SUP, fv::volumeSource)
FOR_ALL_FIELD_TYPES
@ -329,32 +278,32 @@ FOR_ALL_FIELD_TYPES
bool Foam::fv::volumeSource::movePoints()
{
set_.movePoints();
setPtr_->movePoints();
return true;
}
void Foam::fv::volumeSource::topoChange(const polyTopoChangeMap& map)
{
set_.topoChange(map);
setPtr_->topoChange(map);
}
void Foam::fv::volumeSource::mapMesh(const polyMeshMap& map)
{
set_.mapMesh(map);
setPtr_->mapMesh(map);
}
void Foam::fv::volumeSource::distribute(const polyDistributionMap& map)
{
set_.distribute(map);
setPtr_->distribute(map);
}
bool Foam::fv::volumeSource::read(const dictionary& dict)
{
if (fvModel::read(dict))
if (fvTotalSource::read(dict))
{
readCoeffs();
return true;

View File

@ -71,10 +71,8 @@ See also
#ifndef volumeSource_H
#define volumeSource_H
#include "fvModel.H"
#include "fvCellSet.H"
#include "HashPtrTable.H"
#include "unknownTypeFunction1.H"
#include "fvTotalSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -89,23 +87,17 @@ namespace fv
class volumeSource
:
public fvModel
public fvTotalSource
{
private:
// Private Data
//- Name of the phase
word phaseName_;
//- Name of the volume fraction field
//- Name of the volume fraction field (if any)
word alphaName_;
//- The set of cells the fvConstraint applies to
fvCellSet set_;
//- Field values
HashPtrTable<unknownTypeFunction1> fieldValues_;
//- The set of cells the source applies to
autoPtr<fvCellSet> setPtr_;
//- Volumetric flow rate
autoPtr<Function1<scalar>> volumetricFlowRate_;
@ -116,28 +108,9 @@ private:
//- Non-virtual read
void readCoeffs();
//- Return the volumetric flow rate
scalar volumetricFlowRate() const;
// Sources
//- Add a source term to an equation
template<class Type>
void addSupType(fvMatrix<Type>& eqn) const;
//- Add a source term to a scalar equation
void addSupType(fvMatrix<scalar>& eqn) const;
//- Add a source term to an equation
template<class Type>
void addSupType
(
const dimensionedScalar& oneOrRho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
//- Add a source term to an equation
template<class Type>
void addSupType
@ -149,7 +122,7 @@ private:
//- Add a source term to a scalar equation
void addSupType
(
const volScalarField& field,
const volScalarField& alphaOrField,
fvMatrix<scalar>& eqn
) const;
@ -157,7 +130,7 @@ private:
template<class Type>
void addSupType
(
const volScalarField& rho,
const volScalarField& alphaOrRho,
const VolField<Type>& field,
fvMatrix<Type>& eqn
) const;
@ -173,17 +146,6 @@ private:
) const;
protected:
// Protected Member Functions
//- Read the set
void readSet();
//- Read the field values
void readFieldValues();
public:
//- Runtime type information
@ -201,27 +163,28 @@ public:
const dictionary& dict
);
//- Disallow default bitwise copy construction
volumeSource(const volumeSource&) = delete;
// Member Functions
// Checks
// Access
//- Return true if the fvModel adds a source term to the given
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
//- Return the cells that the source applies to
virtual labelUList cells() const;
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
//- Return the number of cells that the source applies to
virtual label nCells() const;
//- Return the volume of cells that the source applies to
virtual scalar V() const;
// Sources
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_SUP)
//- Return the source value
virtual dimensionedScalar S() const;
//- Add a source term to a field-less proxy equation
virtual void addSup(fvMatrix<scalar>& eqn) const;
//- Add a source term to an equation
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_FIELD_SUP)
@ -252,12 +215,6 @@ public:
//- Read source dictionary
virtual bool read(const dictionary& dict);
// Member Operators
//- Disallow default bitwise assignment
void operator=(const volumeSource&) = delete;
};

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "zeroDimensionalMassSource.H"
#include "fvCellSet.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
@ -33,7 +34,6 @@ namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(zeroDimensionalMassSourceBase, 0);
defineTypeNameAndDebug(zeroDimensionalMassSource, 0);
addToRunTimeSelectionTable(fvModel, zeroDimensionalMassSource, dictionary);
}
@ -42,144 +42,8 @@ namespace fv
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::fv::zeroDimensionalMassSourceBase::calcM0D() const
{
tmp<volScalarField> tm =
volScalarField::New
(
typedName("m0D"),
mesh(),
dimensionedScalar(dimMass, 0)
);
HashTable<const basicThermo*> thermos(mesh().lookupClass<basicThermo>());
forAllConstIter(HashTable<const basicThermo*>, thermos, thermoIter)
{
const basicThermo& thermo = *thermoIter();
tmp<volScalarField> tRho = thermo.rho();
const volScalarField& rho = tRho();
const word phaseName = thermo.phaseName();
if (thermo.phaseName() != word::null)
{
const volScalarField& alpha =
mesh().lookupObject<volScalarField>
(
IOobject::groupName("alpha", phaseName)
);
tm.ref().ref() += alpha()*rho()*mesh().V();
}
else
{
tm.ref().ref() += rho()*mesh().V();
}
}
return tm;
}
Foam::volScalarField& Foam::fv::zeroDimensionalMassSourceBase::initM0D() const
{
if (!mesh().foundObject<volScalarField>(typedName("m0D")))
{
volScalarField* mPtr =
new volScalarField
(
calcM0D()
);
mPtr->store();
}
return mesh().lookupObjectRef<volScalarField>(typedName("m0D"));
}
const Foam::volScalarField& Foam::fv::zeroDimensionalMassSourceBase::m() const
{
// If not registered, then read or create the mass field
if (!mesh().foundObject<volScalarField>(typedName("m")))
{
typeIOobject<volScalarField> mIo
(
typedName("m"),
mesh().time().timeName(),
mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
);
volScalarField* mPtr =
new volScalarField
(
mIo,
mesh(),
dimensionedScalar(dimMass, 0)
);
mPtr->store();
if (!mIo.headerOk())
{
*mPtr = m0D_;
}
volScalarField* factorPtr =
new volScalarField
(
IOobject
(
typedName("factor"),
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
*mPtr/m0D_
);
factorPtr->store();
}
volScalarField& m =
mesh().lookupObjectRef<volScalarField>(typedName("m"));
volScalarField& factor =
mesh().lookupObjectRef<volScalarField>(typedName("factor"));
// Update the mass if changes are available
if (mesh().foundObject<volScalarField>(typedName("deltaM")))
{
volScalarField& deltaM =
mesh().lookupObjectRef<volScalarField>(typedName("deltaM"));
m = m.oldTime() + deltaM;
factor = m/m0D_;
deltaM.checkOut();
}
return m;
}
Foam::scalar Foam::fv::zeroDimensionalMassSourceBase::massFlowRate() const
{
return zeroDimensionalMassFlowRate()*m0D_[0]/m()[0];
}
void Foam::fv::zeroDimensionalMassSource::readCoeffs()
{
readFieldValues();
zeroDimensionalMassFlowRate_.reset
(
Function1<scalar>::New("massFlowRate", coeffs()).ptr()
@ -188,7 +52,7 @@ void Foam::fv::zeroDimensionalMassSource::readCoeffs()
Foam::scalar
Foam::fv::zeroDimensionalMassSource::zeroDimensionalMassFlowRate() const
Foam::fv::zeroDimensionalMassSource::massFlowRate() const
{
return zeroDimensionalMassFlowRate_->value(mesh().time().userTimeValue());
}
@ -196,27 +60,6 @@ Foam::fv::zeroDimensionalMassSource::zeroDimensionalMassFlowRate() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalMassSourceBase::zeroDimensionalMassSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
massSourceBase(name, modelType, mesh, dict),
m0D_(initM0D())
{
if (mesh.nGeometricD() != 0)
{
FatalIOErrorInFunction(dict)
<< "Zero-dimensional fvModel applied to a "
<< mesh.nGeometricD() << "-dimensional mesh"
<< exit(FatalIOError);
}
}
Foam::fv::zeroDimensionalMassSource::zeroDimensionalMassSource
(
const word& name,
@ -234,39 +77,6 @@ Foam::fv::zeroDimensionalMassSource::zeroDimensionalMassSource
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::zeroDimensionalMassSourceBase::correct()
{
// Correct the zero-dimensional mass
m0D_ = calcM0D();
// Create the mass change
if (!mesh().foundObject<volScalarField>(typedName("deltaM")))
{
volScalarField* dMPtr =
new volScalarField
(
IOobject
(
typedName("deltaM"),
mesh().time().timeName(),
mesh()
),
mesh(),
dimensionedScalar(dimMass, 0)
);
dMPtr->store();
}
volScalarField& deltaM =
mesh().lookupObjectRef<volScalarField>(typedName("deltaM"));
deltaM +=
mesh().time().deltaT()
*dimensionedScalar(dimMass/dimTime, zeroDimensionalMassFlowRate());
}
bool Foam::fv::zeroDimensionalMassSource::read(const dictionary& dict)
{
if (zeroDimensionalMassSourceBase::read(dict))

View File

@ -30,6 +30,9 @@ Description
for the mass that exits the domain due to expansion in space, so that the
model correctly applies a total mass flow rate.
This model requires a corresponding field source to be specified for all
solved-for fields.
This model will write out additional fields, zeroDimensionalMassSource:m
and zeroDimensionalMassSource:factor. The zeroDimensionalMassSource:m field
is the total accumulated mass; the sum of the starting mass, plus all mass
@ -39,10 +42,6 @@ Description
the ratio between the current mass or volume and the total accumulated mass
or volume.
If the mass flow rate is positive then user-supplied fixed property values
are introduced to the field equations. If the mass flow rate is negative
then properties are removed at their current value.
Usage
Example usage:
\verbatim
@ -51,22 +50,9 @@ Usage
type zeroDimensionalMassSource;
massFlowRate 1e-4;
fieldValues
{
U (10 0 0);
T 300;
k 0.375;
epsilon 14.855;
}
}
\endverbatim
If the mass flow rate is positive then values should be provided for all
solved for fields. Warnings will be issued if values are not provided for
fields for which transport equations are solved. Warnings will also be
issued if values are provided for fields which are not solved for.
SourceFiles
zeroDimensionalMassSource.C
@ -75,7 +61,8 @@ SourceFiles
#ifndef zeroDimensionalMassSource_H
#define zeroDimensionalMassSource_H
#include "massSource.H"
#include "zeroDimensionalMassSourceBase.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -84,65 +71,6 @@ namespace Foam
namespace fv
{
/*---------------------------------------------------------------------------*\
Class zeroDimensionalMassSourceBase Declaration
\*---------------------------------------------------------------------------*/
class zeroDimensionalMassSourceBase
:
public massSourceBase
{
private:
// Private Data
//- Reference to the zero-dimensional mass
volScalarField& m0D_;
// Private Member Functions
//- Calculate and return the zero-dimensional mass
tmp<volScalarField> calcM0D() const;
//- Initialise and return a reference to the zero-dimensional mass
volScalarField& initM0D() const;
//- Get a reference to the mass
const volScalarField& m() const;
//- Return the zero-dimensional mass flow rate
virtual scalar zeroDimensionalMassFlowRate() const = 0;
//- Return the mass flow rate
virtual scalar massFlowRate() const;
public:
//- Runtime type information
TypeName("zeroDimensionalMassSourceBase");
// Constructors
//- Construct from explicit source name and mesh
zeroDimensionalMassSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
// Member Functions
//- Update the model
virtual void correct();
};
/*---------------------------------------------------------------------------*\
Class zeroDimensionalMassSource Declaration
\*---------------------------------------------------------------------------*/
@ -164,8 +92,8 @@ private:
//- Non-virtual read
void readCoeffs();
//- Return the zero-dimensional mass flow rate
virtual scalar zeroDimensionalMassFlowRate() const;
//- Return the mass flow rate
virtual scalar massFlowRate() const;
public:
@ -188,8 +116,6 @@ public:
// Member Functions
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -0,0 +1,287 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 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 "zeroDimensionalMassSourceBase.H"
#include "fvCellSet.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(zeroDimensionalMassSourceBase, 0);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::fv::zeroDimensionalMassSourceBase::calcM0D() const
{
tmp<volScalarField> tm =
volScalarField::New
(
typedName("m0D"),
mesh(),
dimensionedScalar(dimMass, 0)
);
HashTable<const basicThermo*> thermos(mesh().lookupClass<basicThermo>());
forAllConstIter(HashTable<const basicThermo*>, thermos, thermoIter)
{
const basicThermo& thermo = *thermoIter();
tmp<volScalarField> tRho = thermo.rho();
const volScalarField& rho = tRho();
const word phaseName = thermo.phaseName();
if (thermo.phaseName() != word::null)
{
const volScalarField& alpha =
mesh().lookupObject<volScalarField>
(
IOobject::groupName("alpha", phaseName)
);
tm.ref().ref() += alpha()*rho()*mesh().V();
}
else
{
tm.ref().ref() += rho()*mesh().V();
}
}
return tm;
}
Foam::volScalarField& Foam::fv::zeroDimensionalMassSourceBase::initM0D() const
{
if (!mesh().foundObject<volScalarField>(typedName("m0D")))
{
volScalarField* mPtr =
new volScalarField
(
calcM0D()
);
mPtr->store();
}
return mesh().lookupObjectRef<volScalarField>(typedName("m0D"));
}
const Foam::volScalarField& Foam::fv::zeroDimensionalMassSourceBase::m() const
{
// If not registered, then read or create the mass field
if (!mesh().foundObject<volScalarField>(typedName("m")))
{
typeIOobject<volScalarField> mIo
(
typedName("m"),
mesh().time().timeName(),
mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
);
volScalarField* mPtr =
new volScalarField
(
mIo,
mesh(),
dimensionedScalar(dimMass, 0)
);
mPtr->store();
if (!mIo.headerOk())
{
*mPtr = m0D_;
}
volScalarField* factorPtr =
new volScalarField
(
IOobject
(
typedName("factor"),
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
*mPtr/m0D_
);
factorPtr->store();
}
volScalarField& m =
mesh().lookupObjectRef<volScalarField>(typedName("m"));
volScalarField& factor =
mesh().lookupObjectRef<volScalarField>(typedName("factor"));
// Update the mass if changes are available
if (mesh().foundObject<volScalarField>(typedName("deltaM")))
{
volScalarField& deltaM =
mesh().lookupObjectRef<volScalarField>(typedName("deltaM"));
m = m.oldTime() + deltaM;
factor = m/m0D_;
deltaM.checkOut();
}
return m;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::zeroDimensionalMassSourceBase::zeroDimensionalMassSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
massSourceBase(name, modelType, mesh, dict),
m0D_(initM0D())
{
if (mesh.nGeometricD() != 0)
{
FatalIOErrorInFunction(dict)
<< "Zero-dimensional fvModel applied to a "
<< mesh.nGeometricD() << "-dimensional mesh"
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelUList Foam::fv::zeroDimensionalMassSourceBase::cells() const
{
static labelList zero(1, 0);
return labelUList(zero);
}
Foam::label Foam::fv::zeroDimensionalMassSourceBase::nCells() const
{
return 1;
}
Foam::scalar Foam::fv::zeroDimensionalMassSourceBase::V() const
{
return mesh().V()[0];
}
Foam::dimensionedScalar Foam::fv::zeroDimensionalMassSourceBase::S() const
{
return
dimensionedScalar
(
dimMass/dimTime,
massFlowRate()*m0D_[0]/m()[0]
);
}
bool Foam::fv::zeroDimensionalMassSourceBase::movePoints()
{
return true;
}
void Foam::fv::zeroDimensionalMassSourceBase::topoChange
(
const polyTopoChangeMap& map
)
{}
void Foam::fv::zeroDimensionalMassSourceBase::mapMesh
(
const polyMeshMap& map
)
{}
void Foam::fv::zeroDimensionalMassSourceBase::distribute
(
const polyDistributionMap& map
)
{}
void Foam::fv::zeroDimensionalMassSourceBase::correct()
{
// Correct the zero-dimensional mass
m0D_ = calcM0D();
// Create the mass change
if (!mesh().foundObject<volScalarField>(typedName("deltaM")))
{
volScalarField* dMPtr =
new volScalarField
(
IOobject
(
typedName("deltaM"),
mesh().time().timeName(),
mesh()
),
mesh(),
dimensionedScalar(dimMass, 0)
);
dMPtr->store();
}
volScalarField& deltaM =
mesh().lookupObjectRef<volScalarField>(typedName("deltaM"));
deltaM +=
mesh().time().deltaT()
*dimensionedScalar(dimMass/dimTime, massFlowRate());
}
// ************************************************************************* //

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-2023 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::fv::zeroDimensionalMassSourceBase
Description
Base class for zero-dimensional mass source models
SourceFiles
zeroDimensionalMassSource.C
\*---------------------------------------------------------------------------*/
#ifndef zeroDimensionalMassSourceBase_H
#define zeroDimensionalMassSourceBase_H
#include "massSourceBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class zeroDimensionalMassSourceBase Declaration
\*---------------------------------------------------------------------------*/
class zeroDimensionalMassSourceBase
:
public massSourceBase
{
private:
// Private Data
//- Reference to the zero-dimensional mass
volScalarField& m0D_;
// Private Member Functions
//- Calculate and return the zero-dimensional mass
tmp<volScalarField> calcM0D() const;
//- Initialise and return a reference to the zero-dimensional mass
volScalarField& initM0D() const;
//- Get a reference to the mass
const volScalarField& m() const;
//- Return the mass flow rate
virtual scalar massFlowRate() const = 0;
public:
//- Runtime type information
TypeName("zeroDimensionalMassSourceBase");
// Constructors
//- Construct from explicit source name and mesh
zeroDimensionalMassSourceBase
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
// Member Functions
// Access
//- Return the cells that the source applies to
virtual labelUList cells() const;
//- Return the number of cells that the source applies to
virtual label nCells() const;
//- Return the volume of cells that the source applies to
virtual scalar V() const;
// Sources
//- Return the source value
virtual dimensionedScalar S() const;
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
//- Update the model
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,3 +1,4 @@
genericFvPatchField/genericFvPatchFields.C
genericFvFieldSource/genericFvFieldSources.C
LIB = $(FOAM_LIBBIN)/libgenericFvFields

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "genericFvFieldSource.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::genericFvFieldSource<Type>::genericFvFieldSource
(
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
genericFieldBase(dict.lookup("type")),
fvFieldSource<Type>(iF, dict),
dict_(dict)
{}
template<class Type>
Foam::genericFvFieldSource<Type>::genericFvFieldSource
(
const genericFvFieldSource<Type>& stf,
const DimensionedField<Type, volMesh>& iF
)
:
genericFieldBase(stf),
fvFieldSource<Type>(stf, iF),
dict_(stf.dict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::genericFvFieldSource<Type>::~genericFvFieldSource()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::genericFvFieldSource<Type>::sourceValue
(
const fvSource& source
) const
{
FatalErrorInFunction
<< "cannot be called for a genericFvFieldSource"
" (actual type " << actualTypeName() << ")"
<< "\n on source " << source.name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic source condition."
<< abort(FatalError);
return NullObjectRef<Field<Type>>();
}
template<class Type>
Foam::tmp<Foam::scalarField>
Foam::genericFvFieldSource<Type>::internalCoeff
(
const fvSource& source
) const
{
FatalErrorInFunction
<< "cannot be called for a genericFvFieldSource"
" (actual type " << actualTypeName() << ")"
<< "\n on source " << source.name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic source condition."
<< abort(FatalError);
return NullObjectRef<scalarField>();
}
template<class Type>
void Foam::genericFvFieldSource<Type>::write(Ostream& os) const
{
writeEntry(os, "type", actualTypeName());
forAllConstIter(dictionary, dict_, iter)
{
if (iter().keyword() != "type")
{
iter().write(os);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::genericFvFieldSource
Description
This provides a generic source condition, useful as a fallback for handling
unknown types when post-processing or running mesh manipulation utilities.
Not generally applicable as a user-specified condition.
SourceFiles
genericFvFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef genericFvFieldSource_H
#define genericFvFieldSource_H
#include "genericFieldBase.H"
#include "fvFieldSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class genericFvFieldSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class genericFvFieldSource
:
public genericFieldBase,
public fvFieldSource<Type>
{
// Private Data
//- Patch field dictionary
dictionary dict_;
public:
//- Runtime type information
TypeName("generic");
// Constructors
//- Construct internal field and dictionary
genericFvFieldSource
(
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Copy constructor setting internal field reference
genericFvFieldSource
(
const genericFvFieldSource<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvFieldSource<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return autoPtr<fvFieldSource<Type>>
(
new genericFvFieldSource<Type>(*this, iF)
);
}
//- Destructor
virtual ~genericFvFieldSource();
// Member Functions
//- Return the source energy value
virtual tmp<Field<Type>> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "genericFvFieldSource.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "genericFvFieldSources.H"
#include "fvFieldSourcesFwd.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFieldSources(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 genericFvFieldSources_H
#define genericFvFieldSources_H
#include "genericFvFieldSource.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTypeFieldSourceTypedefs(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,6 +28,7 @@ Description
#include "snappyLayerDriver.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
#include "meshRefinement.H"
#include "removePoints.H"

View File

@ -24,4 +24,9 @@ derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchSc
derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C
derivedFvFieldSources/energy/energyFvScalarFieldSource.C
derivedFvFieldSources/energy/energyCalculatedTemperatureFvScalarFieldSource.C
derivedFvFieldSources/uniformFixedEnergyTemperature/uniformFixedEnergyTemperatureFvScalarFieldSource.C
derivedFvFieldSources/uniformInletOutletEnergyTemperature/uniformInletOutletEnergyTemperatureFvScalarFieldSource.C
LIB = $(FOAM_LIBBIN)/libfluidThermophysicalModels

View File

@ -103,12 +103,11 @@ Foam::BasicThermo<MixtureType, BasicThermoType>::cellSetProperty
auto Yslicer = this->Yslicer();
forAll(cells, celli)
forAll(cells, i)
{
auto composition = this->cellComposition(Yslicer, cells[celli]);
auto composition = this->cellComposition(Yslicer, cells[i]);
psi[celli] =
((this->*mixture)(composition).*psiMethod)(args[celli] ...);
psi[i] = ((this->*mixture)(composition).*psiMethod)(args[i] ...);
}
return tPsi;
@ -147,12 +146,43 @@ Foam::BasicThermo<MixtureType, BasicThermoType>::patchFieldProperty
}
template<class MixtureType, class BasicThermoType>
template<class Mixture, class Method, class ... Args>
Foam::tmp<Foam::scalarField>
Foam::BasicThermo<MixtureType, BasicThermoType>::fieldSourceProperty
(
Mixture mixture,
Method psiMethod,
const fvSource& source,
const Args& ... args
) const
{
const labelUList cells = source.cells();
tmp<scalarField> tPsi(new scalarField(cells.size()));
scalarField& psi = tPsi.ref();
auto Yslicer = this->Yslicer(source);
forAll(cells, i)
{
auto composition =
this->sourceCellComposition(Yslicer, i);
psi[i] =
((this->*mixture)(composition).*psiMethod)(args[i] ...);
}
return tPsi;
}
template<class MixtureType, class BasicThermoType>
Foam::UIndirectList<Foam::scalar>
Foam::BasicThermo<MixtureType, BasicThermoType>::cellSetScalarList
(
const volScalarField& psi,
const labelList& cells
const labelUList& cells
)
{
return UIndirectList<scalar>(psi, cells);
@ -164,7 +194,7 @@ Foam::UniformField<Foam::scalar>
Foam::BasicThermo<MixtureType, BasicThermoType>::cellSetScalarList
(
const uniformGeometricScalarField& psi,
const labelList&
const labelUList&
)
{
return psi.primitiveField();
@ -230,7 +260,8 @@ Foam::BasicThermo<MixtureType, BasicThermoType>::BasicThermo
this->T_
),
this->heBoundaryTypes(),
this->heBoundaryBaseTypes()
this->heBoundaryBaseTypes(),
this->heSourcesTypes()
),
Cp_
@ -343,6 +374,25 @@ Foam::BasicThermo<MixtureType, BasicThermoType>::he
}
template<class MixtureType, class BasicThermoType>
Foam::tmp<Foam::scalarField>
Foam::BasicThermo<MixtureType, BasicThermoType>::he
(
const scalarField& T,
const fvSource& source
) const
{
return fieldSourceProperty
(
&MixtureType::thermoMixture,
&MixtureType::thermoMixtureType::HE,
source,
cellSetScalarList(this->p_, source.cells()),
T
);
}
template<class MixtureType, class BasicThermoType>
Foam::tmp<Foam::volScalarField>
Foam::BasicThermo<MixtureType, BasicThermoType>::hs() const

View File

@ -112,18 +112,28 @@ protected:
const Args& ... args
) const;
//- Return a scalarField of the given property for a source
template<class Mixture, class Method, class ... Args>
tmp<scalarField> fieldSourceProperty
(
Mixture mixture,
Method psiMethod,
const fvSource& source,
const Args& ... args
) const;
//- Return an indirect list of a field for the given set of cells
static UIndirectList<scalar> cellSetScalarList
(
const volScalarField& psi,
const labelList& cells
const labelUList& cells
);
//- Return an indirect list of a field for the given set of cells
static UniformField<scalar> cellSetScalarList
(
const uniformGeometricScalarField& psi,
const labelList&
const labelUList&
);
//- Correct the enthalpy/internal energy field boundaries
@ -254,6 +264,13 @@ public:
const label patchi
) const;
//- Enthalpy/Internal energy for source [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const fvSource& source
) const;
//- Sensible enthalpy [J/kg/K]
virtual tmp<volScalarField> hs() const;

View File

@ -32,7 +32,7 @@ License
#include "mixedEnergyCalculatedTemperatureFvPatchScalarField.H"
#include "fixedJumpFvPatchFields.H"
#include "energyJumpFvPatchScalarField.H"
#include "energyFvScalarFieldSource.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,42 +77,6 @@ Foam::volScalarField& Foam::basicThermo::lookupOrConstruct
}
const Foam::basicThermo& Foam::basicThermo::lookupThermo
(
const fvPatchScalarField& pf
)
{
if (pf.db().foundObject<basicThermo>(physicalProperties::typeName))
{
return pf.db().lookupObject<basicThermo>(physicalProperties::typeName);
}
else
{
HashTable<const basicThermo*> thermos =
pf.db().lookupClass<basicThermo>();
for
(
HashTable<const basicThermo*>::iterator iter = thermos.begin();
iter != thermos.end();
++iter
)
{
if
(
&(iter()->he().internalField())
== &(pf.internalField())
)
{
return *iter();
}
}
}
return pf.db().lookupObject<basicThermo>(physicalProperties::typeName);
}
Foam::wordList Foam::basicThermo::splitThermoName
(
const word& thermoName,
@ -258,6 +222,20 @@ Foam::wordList Foam::basicThermo::heBoundaryTypes()
}
Foam::HashTable<Foam::word> Foam::basicThermo::heSourcesTypes()
{
const HashTable<word> tst = T().sources().types();
HashTable<word> hst;
forAllConstIter(typename HashTable<word>, tst, iter)
{
hst.set(iter.key(), energyFvScalarFieldSource::typeName);
}
return hst;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicThermo::implementation::implementation

View File

@ -121,6 +121,10 @@ protected:
// by interrogating the temperature field boundary types
wordList heBoundaryBaseTypes();
//- Enthalpy/internal energy field sources types
// by interrogating the temperature field sources types
HashTable<word> heSourcesTypes();
public:
@ -153,8 +157,9 @@ public:
return IOobject::groupName(name, phaseName);
}
//- Lookup the thermo associated with the given patch field
static const basicThermo& lookupThermo(const fvPatchScalarField& pf);
//- Lookup the thermo associated with the given field
template<class FieldType>
static const basicThermo& lookupThermo(const FieldType& f);
//- Split name of thermo package into a list of the components names
static wordList splitThermoName
@ -284,6 +289,13 @@ public:
const label patchi
) const = 0;
//- Enthalpy/Internal energy for source [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const fvSource& source
) const = 0;
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const = 0;

View File

@ -244,6 +244,42 @@ typename Table::iterator Foam::basicThermo::lookupCstrIter
}
template<class FieldType>
const Foam::basicThermo& Foam::basicThermo::lookupThermo
(
const FieldType& f
)
{
const word& name = physicalProperties::typeName;
if (f.db().template foundObject<basicThermo>(name))
{
return f.db().template lookupObject<basicThermo>(name);
}
else
{
HashTable<const basicThermo*> thermos =
f.db().template lookupClass<basicThermo>();
for
(
HashTable<const basicThermo*>::iterator iter = thermos.begin();
iter != thermos.end();
++iter
)
{
if (&(iter()->he().internalField()) == &(f.internalField()))
{
return *iter();
}
}
}
return f.db().template lookupObject<basicThermo>(name);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class Thermo>

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "energyCalculatedTemperatureFvScalarFieldSource.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug
(
energyCalculatedTemperatureFvScalarFieldSource,
0
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::energyCalculatedTemperatureFvScalarFieldSource::
energyCalculatedTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fvScalarFieldSource(iF, dict)
{}
Foam::energyCalculatedTemperatureFvScalarFieldSource::
energyCalculatedTemperatureFvScalarFieldSource
(
const energyCalculatedTemperatureFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(field, iF)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::energyCalculatedTemperatureFvScalarFieldSource::
~energyCalculatedTemperatureFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::energyCalculatedTemperatureFvScalarFieldSource::sourceValue
(
const fvSource& source
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
// ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::energyCalculatedTemperatureFvScalarFieldSource
Description
Base class for temperature source conditions in which the parameters of the
corresponding energy condition can be set directly.
SourceFiles
energyCalculatedTemperatureFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef energyCalculatedTemperatureFvScalarFieldSource_H
#define energyCalculatedTemperatureFvScalarFieldSource_H
#include "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class energyCalculatedTemperatureFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class energyCalculatedTemperatureFvScalarFieldSource
:
public fvScalarFieldSource
{
public:
//- Runtime type information
TypeName("energyCalculatedTemperature");
// Constructors
//- Construct from internal field and dictionary
energyCalculatedTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
energyCalculatedTemperatureFvScalarFieldSource
(
const energyCalculatedTemperatureFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Destructor
virtual ~energyCalculatedTemperatureFvScalarFieldSource();
// Member Functions
//- Return the source energy value
virtual tmp<scalarField> sourceHeValue(const fvSource&) const = 0;
//- Return the source value. Not implemented.
virtual tmp<scalarField> sourceValue(const fvSource&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "energyFvScalarFieldSource.H"
#include "energyCalculatedTemperatureFvScalarFieldSource.H"
#include "fvSource.H"
#include "volFields.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::energyFvScalarFieldSource::energyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(iF)
{}
Foam::energyFvScalarFieldSource::energyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fvScalarFieldSource(iF, dict)
{}
Foam::energyFvScalarFieldSource::energyFvScalarFieldSource
(
const energyFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
fvScalarFieldSource(field, iF)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::energyFvScalarFieldSource::~energyFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::energyFvScalarFieldSource::sourceValue(const fvSource& source) const
{
const basicThermo& thermo = basicThermo::lookupThermo(*this);
const fvScalarFieldSource& Ts = thermo.T().sources()[source.name()];
if (isA<energyCalculatedTemperatureFvScalarFieldSource>(Ts))
{
return
refCast<const energyCalculatedTemperatureFvScalarFieldSource>(Ts)
.sourceHeValue(source);
}
else
{
return thermo.he(Ts.sourceValue(source), source);
}
}
Foam::tmp<Foam::scalarField>
Foam::energyFvScalarFieldSource::internalCoeff(const fvSource& source) const
{
const basicThermo& thermo = basicThermo::lookupThermo(*this);
const fvScalarFieldSource& Ts = thermo.T().sources()[source.name()];
return Ts.internalCoeff(source);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeNullConstructableTypeFieldSource
(
fvScalarFieldSource,
energyFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::energyFvScalarFieldSource
Description
This source condition provides a value for the energy derived from the
corresponding condition for the temperature, and the conditions for other
relevant thermodynamic variables. This is constructed automatically by the
thermodynamic model. The user does not specify it.
SourceFiles
energyFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef energyFvScalarFieldSource_H
#define energyFvScalarFieldSource_H
#include "fvFieldSources.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class energyFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class energyFvScalarFieldSource
:
public fvScalarFieldSource
{
public:
//- Runtime type information
TypeName("energy");
// Constructors
//- Construct from internal field
energyFvScalarFieldSource(const DimensionedField<scalar, volMesh>&);
//- Construct from internal field and dictionary
energyFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
energyFvScalarFieldSource
(
const energyFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new energyFvScalarFieldSource(*this, iF)
);
}
//- Destructor
virtual ~energyFvScalarFieldSource();
// Member Functions
//- Return the source value
virtual tmp<scalarField> sourceValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformFixedEnergyTemperatureFvScalarFieldSource.H"
#include "fvSource.H"
#include "volFields.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
energyCalculatedTemperatureFvScalarFieldSource(iF, dict),
uniformHe_(Function1<scalar>::New("uniformHe", dict))
{}
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const uniformFixedEnergyTemperatureFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
energyCalculatedTemperatureFvScalarFieldSource(field, iF),
uniformHe_(field.uniformHe_, false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
~uniformFixedEnergyTemperatureFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::sourceHeValue
(
const fvSource& source
) const
{
const scalar t = this->db().time().userTimeValue();
const scalar v = uniformHe_->value(t);
return tmp<scalarField>(new scalarField(source.nCells(), v));
}
Foam::tmp<Foam::scalarField>
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::internalCoeff
(
const fvSource& source
) const
{
return tmp<scalarField>(new scalarField(source.nCells(), scalar(0)));
}
void Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry(os, uniformHe_());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
uniformFixedEnergyTemperatureFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::uniformFixedEnergyTemperatureFvScalarFieldSource
Description
This source condition is applied to the temperature field, but provides a
uniform fixed energy into the energy equation
Usage
\table
Property | Description | Required | Default value
uniformHe | uniform energy value | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type uniformFixedEnergyTemperature;
uniformHe 3700000;
}
\endverbatim
SourceFiles
uniformFixedEnergyTemperatureFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef uniformFixedEnergyTemperatureFvScalarFieldSource_H
#define uniformFixedEnergyTemperatureFvScalarFieldSource_H
#include "energyCalculatedTemperatureFvScalarFieldSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformFixedEnergyTemperatureFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class uniformFixedEnergyTemperatureFvScalarFieldSource
:
public energyCalculatedTemperatureFvScalarFieldSource
{
private:
// Private Data
//- Uniform value
autoPtr<Function1<scalar>> uniformHe_;
public:
//- Runtime type information
TypeName("uniformFixedEnergyTemperature");
// Constructors
//- Construct from internal field and dictionary
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const uniformFixedEnergyTemperatureFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new uniformFixedEnergyTemperatureFvScalarFieldSource(*this, iF)
);
}
//- Destructor
virtual ~uniformFixedEnergyTemperatureFvScalarFieldSource();
// Member Functions
//- Return the source energy value
virtual tmp<scalarField> sourceHeValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "uniformInletOutletEnergyTemperatureFvScalarFieldSource.H"
#include "fvSource.H"
#include "volFields.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::
uniformInletOutletEnergyTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
energyCalculatedTemperatureFvScalarFieldSource(iF, dict),
uniformInletHe_(Function1<scalar>::New("uniformInletHe", dict))
{}
Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::
uniformInletOutletEnergyTemperatureFvScalarFieldSource
(
const uniformInletOutletEnergyTemperatureFvScalarFieldSource& field,
const DimensionedField<scalar, volMesh>& iF
)
:
energyCalculatedTemperatureFvScalarFieldSource(field, iF),
uniformInletHe_(field.uniformInletHe_, false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::
~uniformInletOutletEnergyTemperatureFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::sourceHeValue
(
const fvSource& source
) const
{
const scalar t = this->db().time().userTimeValue();
const scalar v = uniformInletHe_->value(t);
return tmp<scalarField>(new scalarField(source.nCells(), v));
}
Foam::tmp<Foam::scalarField>
Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::internalCoeff
(
const fvSource& source
) const
{
return
neg0(source.source(internalField().name()))
*scalarField(source.nCells(), scalar(1));
}
void Foam::uniformInletOutletEnergyTemperatureFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry(os, uniformInletHe_());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
uniformInletOutletEnergyTemperatureFvScalarFieldSource
);
}
// ************************************************************************* //

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::uniformInletOutletEnergyTemperatureFvScalarFieldSource
Description
This source condition is applied to the temperature field, but provides a
uniform fixed energy into the energy equation when the source is positive,
and the internal value when it is negative (i.e., a sink)
Usage
\table
Property | Description | Required | Default value
uniformInletHe | uniform inlet energy value | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type uniformInletOutletEnergyTemperature;
uniformInletHe 3700000;
}
\endverbatim
SourceFiles
uniformInletOutletEnergyTemperatureFvScalarFieldSource.C
\*---------------------------------------------------------------------------*/
#ifndef uniformInletOutletEnergyTemperatureFvScalarFieldSource_H
#define uniformInletOutletEnergyTemperatureFvScalarFieldSource_H
#include "energyCalculatedTemperatureFvScalarFieldSource.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformInletOutletEnergyTemperatureFvScalarFieldSource Declaration
\*---------------------------------------------------------------------------*/
class uniformInletOutletEnergyTemperatureFvScalarFieldSource
:
public energyCalculatedTemperatureFvScalarFieldSource
{
private:
// Private Data
//- Uniform value
autoPtr<Function1<scalar>> uniformInletHe_;
public:
//- Runtime type information
TypeName("uniformInletOutletEnergyTemperature");
// Constructors
//- Construct from internal field and dictionary
uniformInletOutletEnergyTemperatureFvScalarFieldSource
(
const DimensionedField<scalar, volMesh>&,
const dictionary& dict
);
//- Copy constructor setting internal field reference
uniformInletOutletEnergyTemperatureFvScalarFieldSource
(
const uniformInletOutletEnergyTemperatureFvScalarFieldSource&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<fvScalarFieldSource> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return autoPtr<fvScalarFieldSource>
(
new uniformInletOutletEnergyTemperatureFvScalarFieldSource
(
*this,
iF
)
);
}
//- Destructor
virtual ~uniformInletOutletEnergyTemperatureFvScalarFieldSource();
// Member Functions
//- Return the source energy value
virtual tmp<scalarField> sourceHeValue(const fvSource&) const;
//- Return the internal coefficient
virtual tmp<scalarField> internalCoeff(const fvSource&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -78,6 +78,12 @@ public:
const label patchi,
const label facei
) const;
//- Get the slicer for the given source
inline nil Yslicer(const fvSource&) const;
//- Get the composition of a source cell
inline nil sourceCellComposition(const nil, const label i) const;
};

View File

@ -54,4 +54,20 @@ inline Foam::nil Foam::pureThermo::patchFaceComposition
}
inline Foam::nil Foam::pureThermo::Yslicer(const fvSource&) const
{
return nil();
}
inline Foam::nil Foam::pureThermo::sourceCellComposition
(
const nil,
const label i
) const
{
return nil();
}
// ************************************************************************* //

View File

@ -73,6 +73,20 @@ public:
elementi_(elementi)
{}
//- Construct from a list of fields and an element index
inline FieldListSlice
(
const UPtrList<Field<Type>>& fields,
const label elementi
)
:
FieldListSlice
(
reinterpret_cast<const UPtrList<const Field<Type>>&>(fields),
elementi
)
{}
// Member Functions

View File

@ -78,12 +78,26 @@ public:
inline GeometricFieldListSlicer
(
const typename geoFieldType::Mesh& mesh,
const PtrList<geoFieldType>& geoFields
const UPtrList<const geoFieldType>& geoFields
)
{
set(mesh, geoFields);
}
//- Construct from a mesh and a list of fields
inline GeometricFieldListSlicer
(
const typename geoFieldType::Mesh& mesh,
const UPtrList<geoFieldType>& geoFields
)
:
GeometricFieldListSlicer
(
mesh,
reinterpret_cast<const UPtrList<const geoFieldType>&>(geoFields)
)
{}
// Member Functions
@ -91,7 +105,7 @@ public:
inline void set
(
const typename geoFieldType::Mesh& mesh,
const PtrList<geoFieldType>& geoFields
const UPtrList<const geoFieldType>& geoFields
)
{
fields_.resize(geoFields.size());

View File

@ -353,6 +353,16 @@ public:
const label patchi,
const label facei
) const;
//- Get the slicer for the given source
inline PtrList<scalarField> Yslicer(const fvSource& source) const;
//- Get the composition of a source cell
inline scalarFieldListSlice sourceCellComposition
(
const PtrList<scalarField>& Yslicer,
const label i
) const;
};

View File

@ -134,4 +134,36 @@ Foam::multicomponentThermo::implementation::patchFaceComposition
}
Foam::PtrList<Foam::scalarField>
Foam::multicomponentThermo::implementation::Yslicer
(
const fvSource& source
) const
{
PtrList<scalarField> result(Y_.size());
forAll(Y_, i)
{
result.set
(
i,
Y_[i].sources()[source.name()].sourceValue(source).ptr()
);
}
return result;
}
inline Foam::scalarFieldListSlice
Foam::multicomponentThermo::implementation::sourceCellComposition
(
const PtrList<scalarField>& Yslicer,
const label i
) const
{
return scalarFieldListSlice(Yslicer, i);
}
// ************************************************************************* //

View File

@ -270,6 +270,16 @@ public:
const label patchi,
const label facei
) const;
//- Get the slicer for the given source
inline PtrList<scalarField> Yslicer(const fvSource& source) const;
//- Get the composition of a source cell
inline scalarFieldListSlice sourceCellComposition
(
const PtrList<scalarField>& Yslicer,
const label i
) const;
};

View File

@ -85,4 +85,36 @@ Foam::psiuMulticomponentThermo::implementation::patchFaceComposition
}
Foam::PtrList<Foam::scalarField>
Foam::psiuMulticomponentThermo::implementation::Yslicer
(
const fvSource& source
) const
{
PtrList<scalarField> result(Y_.size());
forAll(Y_, i)
{
result.set
(
i,
Y_[i].sources()[source.name()].sourceValue(source).ptr()
);
}
return result;
}
inline Foam::scalarFieldListSlice
Foam::psiuMulticomponentThermo::implementation::sourceCellComposition
(
const PtrList<scalarField>& Yslicer,
const label i
) const
{
return scalarFieldListSlice(Yslicer, i);
}
// ************************************************************************* //

View File

@ -59,7 +59,8 @@ Foam::constSolidThermo::constSolidThermo
),
Cv_*T_,
this->heBoundaryTypes(),
this->heBoundaryBaseTypes()
this->heBoundaryBaseTypes(),
this->heSourcesTypes()
)
{
rho_ = readProperty<scalar>("rho", rho_.dimensions());
@ -139,6 +140,17 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::he
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::he
(
const scalarField& T,
const fvSource& source
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::hs() const
{
NotImplemented;

View File

@ -262,6 +262,13 @@ public:
const label patchi
) const;
//- Enthalpy/Internal energy for source [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const fvSource& source
) const;
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const;

View File

@ -20,4 +20,12 @@ internalField uniform (0 0 0);
boundaryField {}
sources
{
waterSink
{
type internal;
}
}
// ************************************************************************* //

View File

@ -18,15 +18,11 @@ waterSink
{
type massSource;
phase water;
select all;
massFlowRate -21.86682;
phase water;
rho rho.water;
fieldValues
{}
}
// ************************************************************************* //

View File

@ -34,4 +34,13 @@ boundaryField
}
}
sources
{
massSource
{
type uniformFixedValue;
uniformValue (0 0 0);
}
}
// ************************************************************************* //

View File

@ -34,4 +34,13 @@ boundaryField
}
}
sources
{
massSource
{
type uniformFixedValue;
uniformValue 1;
}
}
// ************************************************************************* //

View File

@ -34,4 +34,13 @@ boundaryField
}
}
sources
{
massSource
{
type uniformFixedValue;
uniformValue 0;
}
}
// ************************************************************************* //

View File

@ -18,24 +18,11 @@ massSource
{
type massSource;
select cellZone;
phase air1;
cellZone injection;
massFlowRate 1e-3;
phase air1;
rho rho.air1;
fieldValues
{
f0.air1 1;
f1.air1 0;
f2.air1 0;
f3.air1 0;
f4.air1 0;
f5.air1 0;
U.air1 (0 0 0);
}
}
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More