fvModels::actuationDiskSource: Added phase support
actuationDiskSource can now be applied to a phase in multiphaseEulerFoam, this is most likely to be useful in regions where a single phase is present.
This commit is contained in:
@ -87,6 +87,9 @@ public:
|
||||
//- Construct given three components
|
||||
inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
|
||||
|
||||
//- Construct from Vector
|
||||
inline explicit DiagTensor(const Vector<Cmpt>& v);
|
||||
|
||||
//- Construct from Istream
|
||||
inline DiagTensor(Istream&);
|
||||
|
||||
@ -103,7 +106,7 @@ public:
|
||||
inline Cmpt& yy();
|
||||
inline Cmpt& zz();
|
||||
|
||||
//- Explicit conversion to vector
|
||||
//- Explicit conversion to Vector
|
||||
explicit inline operator Vector<Cmpt>() const;
|
||||
};
|
||||
|
||||
|
||||
@ -65,6 +65,13 @@ inline Foam::DiagTensor<Cmpt>::DiagTensor
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::DiagTensor<Cmpt>::DiagTensor(const Vector<Cmpt>& v)
|
||||
:
|
||||
VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>(v)
|
||||
{}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::DiagTensor<Cmpt>::DiagTensor(Istream& is)
|
||||
:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,7 +50,14 @@ namespace fv
|
||||
|
||||
void Foam::fv::actuationDiskSource::readCoeffs()
|
||||
{
|
||||
UName_ = coeffs().lookupOrDefault<word>("U", "U");
|
||||
phaseName_ = coeffs().lookupOrDefault<word>("phase", word::null);
|
||||
|
||||
UName_ =
|
||||
coeffs().lookupOrDefault<word>
|
||||
(
|
||||
"U",
|
||||
IOobject::groupName("U", phaseName_)
|
||||
);
|
||||
|
||||
diskDir_ = coeffs().lookup<vector>("diskDir");
|
||||
if (mag(diskDir_) < vSmall)
|
||||
@ -100,6 +107,7 @@ Foam::fv::actuationDiskSource::actuationDiskSource
|
||||
:
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
phaseName_(word::null),
|
||||
UName_(word::null),
|
||||
diskDir_(vector::uniform(NaN)),
|
||||
Cp_(NaN),
|
||||
@ -138,6 +146,7 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
geometricOneField(),
|
||||
U
|
||||
);
|
||||
}
|
||||
@ -162,6 +171,34 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
Usource,
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
rho,
|
||||
U
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::actuationDiskSource::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
const scalarField& cellsV = mesh().V();
|
||||
vectorField& Usource = eqn.source();
|
||||
const vectorField& U = eqn.psi();
|
||||
|
||||
if (set_.V() > vSmall)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
alpha,
|
||||
rho,
|
||||
U
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,8 +54,6 @@ Usage
|
||||
selectionMode cellSet;
|
||||
cellSet actuationDisk1;
|
||||
|
||||
U U; // Name of the velocity field
|
||||
|
||||
diskDir (-1 0 0); // Disk direction
|
||||
Cp 0.1; // Power coefficient
|
||||
Ct 0.5; // Thrust coefficient
|
||||
@ -99,6 +97,9 @@ protected:
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- The name of the phase to which this fvModel applies
|
||||
word phaseName_;
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
|
||||
@ -129,12 +130,13 @@ private:
|
||||
void readCoeffs();
|
||||
|
||||
//- Add resistance to the UEqn
|
||||
template<class RhoFieldType>
|
||||
template<class AlphaFieldType, class RhoFieldType>
|
||||
void addActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& V,
|
||||
const AlphaFieldType& alpha,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const;
|
||||
@ -192,6 +194,15 @@ public:
|
||||
const word& fieldName
|
||||
) const;
|
||||
|
||||
//- Explicit and implicit sources for phase equations
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const word& fieldName
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,38 +28,34 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class RhoFieldType>
|
||||
template<class AlphaFieldType, class RhoFieldType>
|
||||
void Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
(
|
||||
vectorField& Usource,
|
||||
const labelList& cells,
|
||||
const scalarField& Vcells,
|
||||
const AlphaFieldType& alpha,
|
||||
const RhoFieldType& rho,
|
||||
const vectorField& U
|
||||
) const
|
||||
{
|
||||
scalar a = 1.0 - Cp_/Ct_;
|
||||
vector uniDiskDir = diskDir_/mag(diskDir_);
|
||||
tensor E(Zero);
|
||||
E.xx() = uniDiskDir.x();
|
||||
E.yy() = uniDiskDir.y();
|
||||
E.zz() = uniDiskDir.z();
|
||||
const scalar a = 1 - Cp_/Ct_;
|
||||
const diagTensor E(diskDir_/mag(diskDir_));
|
||||
|
||||
vector upU = vector(vGreat, vGreat, vGreat);
|
||||
scalar upRho = vGreat;
|
||||
vector upU(vector::max);
|
||||
if (upstreamCellId_ != -1)
|
||||
{
|
||||
upU = U[upstreamCellId_];
|
||||
upRho = rho[upstreamCellId_];
|
||||
}
|
||||
reduce(upU, minOp<vector>());
|
||||
reduce(upRho, minOp<scalar>());
|
||||
|
||||
scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1 - a);
|
||||
const scalar T = 2*diskArea_*mag(upU)*a*(1 - a);
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/set_.V())*T*E) & upU;
|
||||
Usource[cells[i]] +=
|
||||
alpha[cells[i]]*rho[cells[i]]
|
||||
*(((Vcells[cells[i]]/set_.V())*T*E) & upU);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user