mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
162 lines
4.5 KiB
C
162 lines
4.5 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 2011 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, write to the Free Software Foundation,
|
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
\*----------------------------------------------------------------------------*/
|
|
|
|
#include "actuationDiskSource.H"
|
|
#include "fvMesh.H"
|
|
#include "fvMatrices.H"
|
|
#include "geometricOneField.H"
|
|
#include "addToRunTimeSelectionTable.H"
|
|
|
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
defineTypeNameAndDebug(actuationDiskSource, 0);
|
|
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
|
|
void Foam::actuationDiskSource::checkData() const
|
|
{
|
|
if (magSqr(diskArea_) <= VSMALL)
|
|
{
|
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
|
<< "diskArea is approximately zero"
|
|
<< exit(FatalIOError);
|
|
}
|
|
if (Cp_ <= VSMALL || Ct_ <= VSMALL)
|
|
{
|
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
|
<< "Cp and Ct must be greater than zero"
|
|
<< exit(FatalIOError);
|
|
}
|
|
if (mag(diskDir_) < VSMALL)
|
|
{
|
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
|
<< "disk direction vector is approximately zero"
|
|
<< exit(FatalIOError);
|
|
}
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
Foam::actuationDiskSource::actuationDiskSource
|
|
(
|
|
const word& name,
|
|
const word& modelType,
|
|
const dictionary& dict,
|
|
const fvMesh& mesh
|
|
)
|
|
:
|
|
basicSource(name, modelType, dict, mesh),
|
|
coeffs_(dict.subDict(modelType + "Coeffs")),
|
|
diskDir_(coeffs_.lookup("diskDir")),
|
|
Cp_(readScalar(coeffs_.lookup("Cp"))),
|
|
Ct_(readScalar(coeffs_.lookup("Ct"))),
|
|
diskArea_(readScalar(coeffs_.lookup("diskArea")))
|
|
{
|
|
Info<< " - creating actuation disk zone: "
|
|
<< this->name() << endl;
|
|
|
|
checkData();
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|
{
|
|
bool compressible = false;
|
|
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
|
{
|
|
compressible = true;
|
|
}
|
|
|
|
const scalarField& cellsV = this->mesh().V();
|
|
vectorField& Usource = UEqn.source();
|
|
const vectorField& U = UEqn.psi();
|
|
|
|
if (V() > VSMALL)
|
|
{
|
|
if (compressible)
|
|
{
|
|
addActuationDiskAxialInertialResistance
|
|
(
|
|
Usource,
|
|
cells_,
|
|
cellsV,
|
|
this->mesh().lookupObject<volScalarField>("rho"),
|
|
U
|
|
);
|
|
}
|
|
else
|
|
{
|
|
addActuationDiskAxialInertialResistance
|
|
(
|
|
Usource,
|
|
cells_,
|
|
cellsV,
|
|
geometricOneField(),
|
|
U
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
|
{
|
|
os << indent << name_ << endl;
|
|
dict_.write(os);
|
|
}
|
|
|
|
|
|
bool Foam::actuationDiskSource::read(const dictionary& dict)
|
|
{
|
|
if (basicSource::read(dict))
|
|
{
|
|
coeffs_ = dict.subDict(typeName + "Coeffs");
|
|
coeffs_.readIfPresent("diskDir", diskDir_);
|
|
coeffs_.readIfPresent("Cp", Cp_);
|
|
coeffs_.readIfPresent("Ct", Ct_);
|
|
coeffs_.readIfPresent("diskArea", diskArea_);
|
|
|
|
checkData();
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|