mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Addition of radialActuationDiskSource
This commit is contained in:
@ -387,6 +387,7 @@ $(basicSource)/basicSource/basicSourceIO.C
|
||||
$(basicSource)/basicSource/basicSourceList.C
|
||||
$(basicSource)/basicSource/IObasicSourceList.C
|
||||
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
||||
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
$(basicSource)/explicitSource/explicitSource.C
|
||||
|
||||
|
||||
|
||||
@ -69,12 +69,13 @@ void Foam::actuationDiskSource::checkData() const
|
||||
Foam::actuationDiskSource::actuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, dict, mesh),
|
||||
dict_(dict.subDict(typeName + "Coeffs")),
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
dict_(dict.subDict(modelType + "Coeffs")),
|
||||
diskDir_(dict_.lookup("diskDir")),
|
||||
Cp_(readScalar(dict_.lookup("Cp"))),
|
||||
Ct_(readScalar(dict_.lookup("Ct"))),
|
||||
@ -97,31 +98,34 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
||||
compressible = true;
|
||||
}
|
||||
|
||||
const scalarField& V = this->mesh().V();
|
||||
const scalarField& cellsV = this->mesh().V();
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
if (compressible)
|
||||
if (V() > VSMALL)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
V,
|
||||
this->mesh().lookupObject<volScalarField>("rho"),
|
||||
U
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
V,
|
||||
geometricOneField(),
|
||||
U
|
||||
);
|
||||
if (compressible)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
cellsV,
|
||||
this->mesh().lookupObject<volScalarField>("rho"),
|
||||
U
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
U
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,10 @@ class actuationDiskSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Sub dictionary with actuationDisk information
|
||||
const dictionary& dict_;
|
||||
@ -87,6 +90,8 @@ class actuationDiskSource
|
||||
scalar diskArea_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check data
|
||||
@ -122,6 +127,7 @@ public:
|
||||
actuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
@ -36,13 +36,12 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& V,
|
||||
const scalarField& Vcells,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const
|
||||
{
|
||||
scalar a = 1.0 - Cp_/Ct_;
|
||||
scalar totVol = 0.0;
|
||||
scalarField T(cells.size());
|
||||
vector uniDiskDir = diskDir_/mag(diskDir_);
|
||||
tensor E(tensor::zero);
|
||||
@ -52,12 +51,11 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
const vectorField U1((1.0 - a)*U);
|
||||
forAll(cells, i)
|
||||
{
|
||||
totVol += V[cells[i]];
|
||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
|
||||
}
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U1[cells[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -188,6 +188,7 @@ void Foam::basicSource::setCellSet()
|
||||
Foam::basicSource::basicSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
@ -198,7 +199,10 @@ Foam::basicSource::basicSource
|
||||
active_(readBool(dict_.lookup("active"))),
|
||||
timeStart_(readScalar(dict_.lookup("timeStart"))),
|
||||
duration_(readScalar(dict_.lookup("duration"))),
|
||||
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
|
||||
selectionMode_
|
||||
(
|
||||
selectionModeTypeNames_.read(dict_.lookup("selectionMode"))
|
||||
),
|
||||
cellSetName_("none"),
|
||||
V_(0.0)
|
||||
{
|
||||
@ -237,7 +241,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<basicSource>(cstrIter()(name, dict, mesh));
|
||||
return autoPtr<basicSource>(cstrIter()(name, modelType, dict, mesh));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -180,10 +180,11 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(name, dict, mesh)
|
||||
(name, modelType, dict, mesh)
|
||||
);
|
||||
|
||||
|
||||
@ -193,6 +194,7 @@ public:
|
||||
basicSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
@ -106,12 +106,13 @@ void Foam::explicitSource::setFieldData(const dictionary& dict)
|
||||
Foam::explicitSource::explicitSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, dict, mesh),
|
||||
dict_(dict.subDict(typeName + "Coeffs")),
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
dict_(dict.subDict(modelType + "Coeffs")),
|
||||
volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
|
||||
{
|
||||
setFieldData(dict_.subDict("fieldData"));
|
||||
|
||||
@ -135,6 +135,7 @@ public:
|
||||
explicitSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "radialActuationDiskSource.H"
|
||||
#include "geometricOneField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(radialActuationDiskSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSource,
|
||||
radialActuationDiskSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radialActuationDiskSource::radialActuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
actuationDiskSource(name, modelType, dict, mesh),
|
||||
dict_(dict.subDict(modelType + "Coeffs")),
|
||||
coeffs_()
|
||||
{
|
||||
dict_.lookup("coeffs") >> coeffs_;
|
||||
Info<< " - creating radial actuation disk zone: "
|
||||
<< this->name() << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::radialActuationDiskSource::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)
|
||||
{
|
||||
addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
cellsV,
|
||||
this->mesh().lookupObject<volScalarField>("rho"),
|
||||
U
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells_,
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
U
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::radialActuationDiskSource::writeData(Ostream& os) const
|
||||
{
|
||||
actuationDiskSource::writeData(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::radialActuationDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
const dictionary& sourceDict = dict.subDict(name());
|
||||
const dictionary& subDictCoeffs =
|
||||
sourceDict.subDict(typeName + "Coeffs");
|
||||
subDictCoeffs.readIfPresent("diskDir", diskDir_);
|
||||
subDictCoeffs.readIfPresent("Cp", Cp_);
|
||||
subDictCoeffs.readIfPresent("Ct", Ct_);
|
||||
subDictCoeffs.readIfPresent("diskArea", diskArea_);
|
||||
subDictCoeffs.lookup("coeffs") >> coeffs_;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
Class
|
||||
Foam::radialActuationDiskSource
|
||||
|
||||
Description
|
||||
Actuation disk zone definition.
|
||||
Constant values for momentum source for actuation disk
|
||||
|
||||
T = 2*rho*A*sqr(Uo)*a*(1-a)
|
||||
U1 = (1 -a)Uo
|
||||
where:
|
||||
A: disk area
|
||||
Uo: upstream velocity
|
||||
a: 1 - Cp/Ct
|
||||
U1: velocity at the disk
|
||||
|
||||
|
||||
The thrust is distributed by a radial function:
|
||||
thrust(r) = T*(C0 + C1*r^2 + C2*r^4)
|
||||
|
||||
|
||||
SourceFiles
|
||||
radialActuationDiskSource.C
|
||||
radialActuationDiskSourceTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radialActuationDiskSource_H
|
||||
#define radialActuationDiskSource_H
|
||||
|
||||
#include "DimensionedField.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "FixedList.H"
|
||||
#include "actuationDiskSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class radialActuationDiskSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class radialActuationDiskSource
|
||||
:
|
||||
public actuationDiskSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Sub dictionary with model information
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Coeffcients for the radial distribution
|
||||
FixedList<scalar, 3> coeffs_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Add resistance to the UEqn
|
||||
template<class RhoFieldType>
|
||||
void addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& V,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
radialActuationDiskSource(const radialActuationDiskSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const radialActuationDiskSource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("radialActuationDiskSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
radialActuationDiskSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~radialActuationDiskSource()
|
||||
{}
|
||||
|
||||
|
||||
// Public Functions
|
||||
|
||||
//-Source term to fvMatrix<vector>
|
||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "radialActuationDiskSourceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "radialActuationDiskSource.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "fvm.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class RhoFieldType>
|
||||
void Foam::radialActuationDiskSource::
|
||||
addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& Vcells,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const
|
||||
{
|
||||
scalar a = 1.0 - Cp_/Ct_;
|
||||
scalarField T(cells.size());
|
||||
scalarField Tr(cells.size());
|
||||
const vector uniDiskDir = diskDir_/mag(diskDir_);
|
||||
|
||||
|
||||
tensor E(tensor::zero);
|
||||
E.xx() = uniDiskDir.x();
|
||||
E.yy() = uniDiskDir.y();
|
||||
E.zz() = uniDiskDir.z();
|
||||
const vectorField U1((1.0 - a)*U);
|
||||
|
||||
const Field<vector> zoneCellCentres(mesh().cellCentres(), cells);
|
||||
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
|
||||
|
||||
const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V();
|
||||
const scalar maxR = mag(max(zoneCellCentres - avgCentre));
|
||||
|
||||
scalar intCoeffs =
|
||||
coeffs_[0]
|
||||
+ coeffs_[1]*sqr(maxR)/2.0
|
||||
+ coeffs_[2]*pow4(maxR)/3.0;
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
|
||||
|
||||
scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre);
|
||||
|
||||
Tr[i] =
|
||||
T[i]*(coeffs_[0] + coeffs_[1]*sqr(r) + coeffs_[2]*pow4(r))
|
||||
/intCoeffs;
|
||||
}
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U1[cells[i]];
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Source name: " << name() << nl
|
||||
<< "Average centre: " << avgCentre << nl
|
||||
<< "Maximum radius: " << maxR << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user