/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023-2026 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 .
\*---------------------------------------------------------------------------*/
#include "uniformFixedEnergyTemperatureFvScalarFieldSource.H"
#include "fvSource.H"
#include "volFields.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const DimensionedField& iF,
const dictionary& dict
)
:
energyCalculatedTemperatureFvScalarFieldSource(iF, dict),
uniformHe_
(
Function1::New
(
"uniformHe",
time().userUnits(),
dimensions::specificEnergy,
dict
)
)
{}
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
uniformFixedEnergyTemperatureFvScalarFieldSource
(
const uniformFixedEnergyTemperatureFvScalarFieldSource& field,
const DimensionedField& iF
)
:
energyCalculatedTemperatureFvScalarFieldSource(field, iF),
uniformHe_(field.uniformHe_, false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::
~uniformFixedEnergyTemperatureFvScalarFieldSource()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp>
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::sourceHeValue
(
const fvSource& model,
const DimensionedField& source
) const
{
return
DimensionedField::New
(
model.name() + ":" + this->internalField().name() + "SourceHeValue",
this->internalField().mesh(),
dimensionedScalar
(
this->internalField().dimensions(),
uniformHe_->value(this->time().value())
)
);
}
Foam::tmp
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::sourceHeValue
(
const fvSource& model,
const scalarField& source,
const labelUList& cells
) const
{
const scalar v = uniformHe_->value(time().value());
return tmp(new scalarField(source.size(), v));
}
Foam::tmp>
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::internalCoeff
(
const fvSource& model,
const DimensionedField& source
) const
{
return
DimensionedField::New
(
model.name() + ":" + this->internalField().name() + "InternalCoeff",
this->internalField().mesh(),
dimensionedScalar(dimless, scalar(0))
);
}
Foam::tmp
Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::internalCoeff
(
const fvSource& model,
const scalarField& source,
const labelUList& cells
) const
{
return tmp(new scalarField(source.size(), scalar(0)));
}
void Foam::uniformFixedEnergyTemperatureFvScalarFieldSource::write
(
Ostream& os
) const
{
fvScalarFieldSource::write(os);
writeEntry
(
os,
time().userUnits(),
dimensions::specificEnergy,
uniformHe_()
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTypeFieldSource
(
fvScalarFieldSource,
uniformFixedEnergyTemperatureFvScalarFieldSource
);
}
// ************************************************************************* //