fvModels: Simplified structure using fvCellSet member data
which will allow for a run-time selectable and hence extensible fvCellSet in the future.
This commit is contained in:
@ -86,7 +86,7 @@ void Foam::fv::VoFSolidificationMeltingSource::update() const
|
||||
const volScalarField CpVoF(thermo.thermo1().Cp());
|
||||
const volScalarField& alphaVoF = thermo.alpha1();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -126,13 +126,14 @@ Foam::word Foam::fv::VoFSolidificationMeltingSource::alphaSolidName() const
|
||||
|
||||
Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(sourceName, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
alphaSolidT_(),
|
||||
L_("L", dimEnergy/dimMass, NaN),
|
||||
relax_(NaN),
|
||||
@ -218,7 +219,7 @@ void Foam::fv::VoFSolidificationMeltingSource::addSup
|
||||
scalarField& Sp = eqn.diag();
|
||||
const scalarField& V = mesh().V();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -233,10 +234,20 @@ void Foam::fv::VoFSolidificationMeltingSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::VoFSolidificationMeltingSource::updateMesh
|
||||
(
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -78,9 +78,10 @@ SourceFiles
|
||||
#ifndef VoFSolidificationMeltingSource_H
|
||||
#define VoFSolidificationMeltingSource_H
|
||||
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "cellSetModel.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -96,10 +97,13 @@ namespace fv
|
||||
|
||||
class VoFSolidificationMeltingSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Solid fraction as a function of temperature
|
||||
autoPtr<Function1<scalar>> alphaSolidT_;
|
||||
|
||||
@ -149,7 +153,7 @@ public:
|
||||
//- Construct from explicit source name and mesh
|
||||
VoFSolidificationMeltingSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
@ -190,6 +194,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
@ -100,7 +100,8 @@ ${typeName}FvModel${SourceType}
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh)
|
||||
fvModel(name, modelType, dict, mesh)
|
||||
set_(coeffs(), mesh),
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
|
||||
@ -32,7 +32,8 @@ SourceFiles
|
||||
#ifndef codedFvModelTemplate_H
|
||||
#define codedFvModelTemplate_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,8 +49,14 @@ namespace fv
|
||||
|
||||
class ${typeName}FvModel${SourceType}
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Information about the SHA1 of the code itself
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
cellSetModel/cellSetModel.C
|
||||
interRegionModel/interRegionModel.C
|
||||
|
||||
general/codedFvModel/codedFvModel.C
|
||||
|
||||
@ -1,236 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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 "cellSetModel.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
defineTypeNameAndDebug(cellSetModel, 0);
|
||||
}
|
||||
|
||||
template<> const char* NamedEnum
|
||||
<
|
||||
fv::cellSetModel::selectionModeType,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"points",
|
||||
"cellSet",
|
||||
"cellZone",
|
||||
"all"
|
||||
};
|
||||
|
||||
const NamedEnum<fv::cellSetModel::selectionModeType, 4>
|
||||
fv::cellSetModel::selectionModeTypeNames_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::cellSetModel::readCoeffs()
|
||||
{
|
||||
selectionMode_ =
|
||||
selectionModeTypeNames_.read(coeffs().lookup("selectionMode"));
|
||||
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case selectionModeType::points:
|
||||
{
|
||||
coeffs().lookup("points") >> points_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellSet:
|
||||
{
|
||||
coeffs().lookup("cellSet") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellZone:
|
||||
{
|
||||
coeffs().lookup("cellZone") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::all:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown selectionMode "
|
||||
<< selectionModeTypeNames_[selectionMode_]
|
||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::cellSetModel::setCellSet()
|
||||
{
|
||||
Info<< incrIndent;
|
||||
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case selectionModeType::points:
|
||||
{
|
||||
Info<< indent << "- selecting cells using points" << endl;
|
||||
|
||||
labelHashSet selectedCells;
|
||||
|
||||
forAll(points_, i)
|
||||
{
|
||||
label celli = mesh().findCell(points_[i]);
|
||||
if (celli >= 0)
|
||||
{
|
||||
selectedCells.insert(celli);
|
||||
}
|
||||
|
||||
label globalCelli = returnReduce(celli, maxOp<label>());
|
||||
if (globalCelli < 0)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Unable to find owner cell for point " << points_[i]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cells_ = selectedCells.toc();
|
||||
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellSet:
|
||||
{
|
||||
Info<< indent
|
||||
<< "- selecting cells using cellSet " << cellSetName_ << endl;
|
||||
|
||||
cellSet selectedCells(mesh(), cellSetName_);
|
||||
cells_ = selectedCells.toc();
|
||||
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellZone:
|
||||
{
|
||||
Info<< indent
|
||||
<< "- selecting cells using cellZone " << cellSetName_ << endl;
|
||||
|
||||
label zoneID = mesh().cellZones().findZoneID(cellSetName_);
|
||||
if (zoneID == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find cellZone " << cellSetName_ << endl
|
||||
<< "Valid cellZones are " << mesh().cellZones().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
cells_ = mesh().cellZones()[zoneID];
|
||||
|
||||
break;
|
||||
}
|
||||
case selectionModeType::all:
|
||||
{
|
||||
Info<< indent << "- selecting all cells" << endl;
|
||||
cells_ = identity(mesh().nCells());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set volume information
|
||||
V_ = 0;
|
||||
forAll(cells_, i)
|
||||
{
|
||||
V_ += mesh().V()[cells_[i]];
|
||||
}
|
||||
reduce(V_, sumOp<scalar>());
|
||||
|
||||
Info<< indent
|
||||
<< "- selected " << returnReduce(cells_.size(), sumOp<label>())
|
||||
<< " cell(s) with volume " << V_ << endl;
|
||||
|
||||
Info<< decrIndent;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::cellSetModel::cellSetModel
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
selectionMode_(selectionModeType::all),
|
||||
cellSetName_(word::null),
|
||||
V_(NaN)
|
||||
{
|
||||
readCoeffs();
|
||||
setCellSet();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::cellSetModel::~cellSetModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::cellSetModel::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
setCellSet();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::cellSetModel::movePoints()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::cellSetModel::read(const dictionary& dict)
|
||||
{
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
readCoeffs();
|
||||
setCellSet();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,201 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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::cellSetModel
|
||||
|
||||
Description
|
||||
Cell-set fvModels abstract base class. Provides a base set of controls
|
||||
regarding the location where the fvModel is applied.
|
||||
|
||||
Usage
|
||||
Example usage:
|
||||
\verbatim
|
||||
fvModel1
|
||||
{
|
||||
type <fvModelType>
|
||||
|
||||
// Apply everywhere
|
||||
selectionMode all;
|
||||
|
||||
// // Apply within a given cell set
|
||||
// selectionMode cellSet;
|
||||
// cellSet c0;
|
||||
|
||||
// // Apply in cells containing a list of points
|
||||
// selectionMode points;
|
||||
// points
|
||||
// (
|
||||
// (2.25 0.5 0)
|
||||
// (2.75 0.5 0)
|
||||
// );
|
||||
|
||||
...
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
cellSetModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellSetModel_H
|
||||
#define cellSetModel_H
|
||||
|
||||
#include "fvModel.H"
|
||||
#include "cellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellSetModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellSetModel
|
||||
:
|
||||
public fvModel
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Enumeration for selection mode types
|
||||
enum class selectionModeType
|
||||
{
|
||||
points,
|
||||
cellSet,
|
||||
cellZone,
|
||||
all
|
||||
};
|
||||
|
||||
//- Word list of selection mode type names
|
||||
static const NamedEnum<selectionModeType, 4>
|
||||
selectionModeTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Cell selection mode
|
||||
selectionModeType selectionMode_;
|
||||
|
||||
//- Name of cell set for "cellSet" and "cellZone" selectionMode
|
||||
word cellSetName_;
|
||||
|
||||
//- List of points for "points" selectionMode
|
||||
List<point> points_;
|
||||
|
||||
//- Set of cells to apply source to
|
||||
mutable labelList cells_;
|
||||
|
||||
//- Sum of cell volumes
|
||||
mutable scalar V_;
|
||||
|
||||
|
||||
// Private functions
|
||||
|
||||
//- Non-virtual read
|
||||
void readCoeffs();
|
||||
|
||||
//- Set the cell set based on the user input selection mode
|
||||
void setCellSet();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cellSetModel");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cellSetModel
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cellSetModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the cell selection mode
|
||||
inline const selectionModeType& selectionMode() const;
|
||||
|
||||
//- Return const access to the name of cell set for "cellSet"
|
||||
// selectionMode
|
||||
inline const word& cellSetName() const;
|
||||
|
||||
//- Return const access to the total cell volume
|
||||
inline scalar V() const;
|
||||
|
||||
//- Return const access to the cell set
|
||||
inline const labelList& cells() const;
|
||||
|
||||
|
||||
// Mesh changes
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for mesh motion
|
||||
virtual bool movePoints();
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "cellSetModelI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,53 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fv::cellSetModel::selectionModeType&
|
||||
Foam::fv::cellSetModel::selectionMode() const
|
||||
{
|
||||
return selectionMode_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::fv::cellSetModel::cellSetName() const
|
||||
{
|
||||
return cellSetName_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::fv::cellSetModel::V() const
|
||||
{
|
||||
return V_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList& Foam::fv::cellSetModel::cells() const
|
||||
{
|
||||
return cells_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -61,7 +61,8 @@ Foam::fv::accelerationSource::accelerationSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
UName_(word::null),
|
||||
velocity_(nullptr)
|
||||
{
|
||||
@ -110,10 +111,17 @@ void Foam::fv::accelerationSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::accelerationSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::accelerationSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -58,7 +58,8 @@ SourceFiles
|
||||
#ifndef accelerationSource_H
|
||||
#define accelerationSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -74,10 +75,13 @@ namespace fv
|
||||
|
||||
class accelerationSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
|
||||
@ -159,6 +163,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
|
||||
@ -40,7 +40,7 @@ void Foam::fv::accelerationSource::add
|
||||
const vector dU = velocity_->value(t) - velocity_->value(t - dt);
|
||||
const vector a = dU/mesh().time().deltaTValue();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
|
||||
@ -98,7 +98,8 @@ Foam::fv::actuationDiskSource::actuationDiskSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
UName_(word::null),
|
||||
diskDir_(vector::uniform(NaN)),
|
||||
Cp_(NaN),
|
||||
@ -129,12 +130,12 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
vectorField& Usource = eqn.source();
|
||||
const vectorField& U = eqn.psi();
|
||||
|
||||
if (V() > vSmall)
|
||||
if (set_.V() > vSmall)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells(),
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
U
|
||||
@ -154,12 +155,12 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
vectorField& Usource = eqn.source();
|
||||
const vectorField& U = eqn.psi();
|
||||
|
||||
if (V() > vSmall)
|
||||
if (set_.V() > vSmall)
|
||||
{
|
||||
addActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells(),
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
rho,
|
||||
U
|
||||
@ -168,10 +169,17 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::actuationDiskSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::actuationDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -74,7 +74,8 @@ SourceFiles
|
||||
#ifndef actuationDiskSource_H
|
||||
#define actuationDiskSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -89,11 +90,14 @@ namespace fv
|
||||
|
||||
class actuationDiskSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
@ -189,6 +193,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
|
||||
@ -59,7 +59,7 @@ void Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T*E) & upU;
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/set_.V())*T*E) & upU;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,13 +65,13 @@ void Foam::fv::buoyancyEnergy::readCoeffs()
|
||||
|
||||
Foam::fv::buoyancyEnergy::buoyancyEnergy
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
fvModel(sourceName, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
phaseName_(word::null),
|
||||
UName_(word::null)
|
||||
{
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
//- Construct from explicit source name and mesh
|
||||
buoyancyEnergy
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
|
||||
@ -64,13 +64,13 @@ void Foam::fv::buoyancyForce::readCoeffs()
|
||||
|
||||
Foam::fv::buoyancyForce::buoyancyForce
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
fvModel(sourceName, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
phaseName_(word::null),
|
||||
UName_(word::null),
|
||||
g_
|
||||
|
||||
@ -94,7 +94,7 @@ public:
|
||||
//- Construct from explicit source name and mesh
|
||||
buoyancyForce
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
|
||||
@ -175,7 +175,8 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
secondaryMassFlowRate_(NaN),
|
||||
secondaryInletT_(NaN),
|
||||
primaryInletT_(NaN),
|
||||
@ -249,8 +250,10 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
*(secondaryInletT_ - primaryInletT_)
|
||||
*(CpfMean/faceZoneArea_)*mag(totalphi);
|
||||
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
const volScalarField& T = mesh().lookupObject<volScalarField>(TName_);
|
||||
const scalarField TCells(T, cells());
|
||||
const scalarField TCells(T, cells);
|
||||
scalar Tref = 0;
|
||||
if (Qt > 0)
|
||||
{
|
||||
@ -263,7 +266,7 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
reduce(Tref, minOp<scalar>());
|
||||
}
|
||||
|
||||
scalarField deltaTCells(cells().size(), 0);
|
||||
scalarField deltaTCells(cells.size(), 0);
|
||||
forAll(deltaTCells, i)
|
||||
{
|
||||
if (Qt > 0)
|
||||
@ -280,15 +283,13 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
const scalarField& V = mesh().V();
|
||||
scalar sumWeight = 0;
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
sumWeight += V[cells[i]]*mag(U[cells[i]])*deltaTCells[i];
|
||||
}
|
||||
reduce(sumWeight, sumOp<scalar>());
|
||||
|
||||
if (this->V() > vSmall && mag(Qt) > vSmall)
|
||||
if (set_.V() > vSmall && mag(Qt) > vSmall)
|
||||
{
|
||||
scalarField& heSource = eqn.source();
|
||||
|
||||
@ -310,10 +311,20 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::effectivenessHeatExchangerSource::updateMesh
|
||||
(
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
setZone();
|
||||
return true;
|
||||
|
||||
@ -95,7 +95,8 @@ SourceFiles
|
||||
#ifndef effectivenessHeatExchangerSource_H
|
||||
#define effectivenessHeatExchangerSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "Function2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -111,10 +112,13 @@ namespace fv
|
||||
|
||||
class effectivenessHeatExchangerSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Secondary flow mass rate [kg/s]
|
||||
scalar secondaryMassFlowRate_;
|
||||
|
||||
@ -213,6 +217,9 @@ public:
|
||||
const word& fieldName
|
||||
) const;
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ void Foam::fv::explicitPorositySource::readCoeffs()
|
||||
name(),
|
||||
mesh(),
|
||||
coeffs(),
|
||||
cellSetName()
|
||||
set_.cellSetName()
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
@ -83,7 +83,8 @@ Foam::fv::explicitPorositySource::explicitPorositySource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
UNames_(),
|
||||
porosityPtr_(nullptr)
|
||||
{
|
||||
@ -138,10 +139,17 @@ void Foam::fv::explicitPorositySource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::explicitPorositySource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -65,7 +65,8 @@ SourceFiles
|
||||
#ifndef explicitPorositySource_H
|
||||
#define explicitPorositySource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -84,10 +85,13 @@ namespace fv
|
||||
|
||||
class explicitPorositySource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Names of the velocity fields
|
||||
wordList UNames_;
|
||||
|
||||
@ -172,6 +176,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
|
||||
@ -123,10 +123,12 @@ void Foam::fv::massSource::addGeneralSupType
|
||||
const scalar massFlowRate = massFlowRate_->value(t);
|
||||
const Type value = fieldValues_[fieldName]->value<Type>(t);
|
||||
|
||||
forAll(cells(), i)
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
eqn.source()[cells()[i]] -=
|
||||
mesh().V()[cells()[i]]/V()*massFlowRate*value;
|
||||
eqn.source()[cells[i]] -=
|
||||
mesh().V()[cells[i]]/set_.V()*massFlowRate*value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,14 +150,17 @@ void Foam::fv::massSource::addSupType
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
if (fieldName == rhoName_)
|
||||
{
|
||||
const scalar t = mesh().time().value();
|
||||
const scalar massFlowRate = massFlowRate_->value(t);
|
||||
|
||||
forAll(cells(), i)
|
||||
forAll(cells, i)
|
||||
{
|
||||
eqn.source()[cells()[i]] -= mesh().V()[cells()[i]]/V()*massFlowRate;
|
||||
eqn.source()[cells[i]] -=
|
||||
mesh().V()[cells[i]]/set_.V()*massFlowRate;
|
||||
}
|
||||
}
|
||||
else if (fieldName == heName_ && fieldValues_.found(TName_))
|
||||
@ -178,13 +183,13 @@ void Foam::fv::massSource::addSupType
|
||||
);
|
||||
const scalarField hs
|
||||
(
|
||||
thermo.hs(scalarField(cells().size(), T), cells())
|
||||
thermo.hs(scalarField(cells.size(), T), cells)
|
||||
);
|
||||
|
||||
forAll(cells(), i)
|
||||
forAll(cells, i)
|
||||
{
|
||||
eqn.source()[cells()[i]] -=
|
||||
mesh().V()[cells()[i]]/V()*massFlowRate*hs[i];
|
||||
eqn.source()[cells[i]] -=
|
||||
mesh().V()[cells[i]]/set_.V()*massFlowRate*hs[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -229,7 +234,8 @@ Foam::fv::massSource::massSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
phaseName_(),
|
||||
rhoName_(),
|
||||
heName_(),
|
||||
@ -288,10 +294,17 @@ FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_RHO_SUP, fv::massSource);
|
||||
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP, fv::massSource);
|
||||
|
||||
|
||||
void Foam::fv::massSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::massSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ SourceFiles
|
||||
#ifndef massSource_H
|
||||
#define massSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "objectFunction1.H"
|
||||
|
||||
@ -80,10 +81,13 @@ namespace fv
|
||||
|
||||
class massSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Name of the phase
|
||||
word phaseName_;
|
||||
|
||||
@ -161,7 +165,7 @@ public:
|
||||
//- Construct from explicit source name and mesh
|
||||
massSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
@ -205,6 +209,12 @@ public:
|
||||
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_SUP);
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
@ -80,12 +80,12 @@ void Foam::fv::radialActuationDiskSource::addSup
|
||||
vectorField& Usource = eqn.source();
|
||||
const vectorField& U = eqn.psi();
|
||||
|
||||
if (V() > vSmall)
|
||||
if (set_.V() > vSmall)
|
||||
{
|
||||
addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells(),
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
geometricOneField(),
|
||||
U
|
||||
@ -105,12 +105,12 @@ void Foam::fv::radialActuationDiskSource::addSup
|
||||
vectorField& Usource = eqn.source();
|
||||
const vectorField& U = eqn.psi();
|
||||
|
||||
if (V() > vSmall)
|
||||
if (set_.V() > vSmall)
|
||||
{
|
||||
addRadialActuationDiskAxialInertialResistance
|
||||
(
|
||||
Usource,
|
||||
cells(),
|
||||
set_.cells(),
|
||||
cellsV,
|
||||
rho,
|
||||
U
|
||||
|
||||
@ -54,7 +54,7 @@ addRadialActuationDiskAxialInertialResistance
|
||||
const Field<vector> zoneCellCentres(mesh().cellCentres(), cells);
|
||||
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
|
||||
|
||||
const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V();
|
||||
const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/set_.V();
|
||||
const scalar maxR = gMax(mag(zoneCellCentres - avgCentre));
|
||||
|
||||
scalar intCoeffs =
|
||||
@ -82,7 +82,7 @@ addRadialActuationDiskAxialInertialResistance
|
||||
*(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*sqr(r2))
|
||||
/intCoeffs;
|
||||
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & upU;
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/set_.V())*Tr[i]*E) & upU;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -111,11 +111,11 @@ void Foam::fv::rotorDiskSource::readCoeffs()
|
||||
void Foam::fv::rotorDiskSource::checkData()
|
||||
{
|
||||
// Set inflow type
|
||||
switch (selectionMode())
|
||||
switch (set_.selectionMode())
|
||||
{
|
||||
case selectionModeType::cellSet:
|
||||
case selectionModeType::cellZone:
|
||||
case selectionModeType::all:
|
||||
case fvCellSet::selectionModeType::cellSet:
|
||||
case fvCellSet::selectionModeType::cellZone:
|
||||
case fvCellSet::selectionModeType::all:
|
||||
{
|
||||
// Set the profile ID for each blade section
|
||||
profiles_.connectBlades(blade_.profileName(), blade_.profileID());
|
||||
@ -151,11 +151,14 @@ void Foam::fv::rotorDiskSource::checkData()
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Source cannot be used with '"
|
||||
<< selectionModeTypeNames_[selectionMode()]
|
||||
<< fvCellSet::selectionModeTypeNames_[set_.selectionMode()]
|
||||
<< "' mode. Please use one of: " << nl
|
||||
<< selectionModeTypeNames_[selectionModeType::cellSet] << nl
|
||||
<< selectionModeTypeNames_[selectionModeType::cellZone] << nl
|
||||
<< selectionModeTypeNames_[selectionModeType::all]
|
||||
<< fvCellSet::selectionModeTypeNames_
|
||||
[fvCellSet::selectionModeType::cellSet] << nl
|
||||
<< fvCellSet::selectionModeTypeNames_
|
||||
[fvCellSet::selectionModeType::cellZone] << nl
|
||||
<< fvCellSet::selectionModeTypeNames_
|
||||
[fvCellSet::selectionModeType::all]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -177,7 +180,8 @@ void Foam::fv::rotorDiskSource::setFaceArea(vector& axis, const bool correct)
|
||||
|
||||
// Calculate cell addressing for selected cells
|
||||
labelList cellAddr(mesh().nCells(), -1);
|
||||
UIndirectList<label>(cellAddr, cells()) = identity(cells().size());
|
||||
UIndirectList<label>(cellAddr, set_.cells()) =
|
||||
identity(set_.cells().size());
|
||||
labelList nbrFaceCellAddr(mesh().nFaces() - nInternalFaces, -1);
|
||||
forAll(pbm, patchi)
|
||||
{
|
||||
@ -288,7 +292,7 @@ void Foam::fv::rotorDiskSource::setFaceArea(vector& axis, const bool correct)
|
||||
mesh(),
|
||||
dimensionedScalar(dimArea, 0)
|
||||
);
|
||||
UIndirectList<scalar>(area.primitiveField(), cells()) = area_;
|
||||
UIndirectList<scalar>(area.primitiveField(), set_.cells()) = area_;
|
||||
|
||||
Info<< type() << ": " << name() << " writing field " << area.name()
|
||||
<< endl;
|
||||
@ -317,7 +321,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
||||
const scalarField& V = mesh().V();
|
||||
const vectorField& C = mesh().C();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -398,7 +402,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
||||
(
|
||||
axis,
|
||||
origin,
|
||||
UIndirectList<vector>(mesh().C(), this->cells())()
|
||||
UIndirectList<vector>(mesh().C(), set_.cells())()
|
||||
)
|
||||
);
|
||||
|
||||
@ -433,7 +437,7 @@ void Foam::fv::rotorDiskSource::constructGeometry()
|
||||
{
|
||||
const vectorField& C = mesh().C();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -509,7 +513,8 @@ Foam::fv::rotorDiskSource::rotorDiskSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
UName_(word::null),
|
||||
omega_(0),
|
||||
nBlades_(0),
|
||||
@ -517,10 +522,10 @@ Foam::fv::rotorDiskSource::rotorDiskSource
|
||||
inletVelocity_(Zero),
|
||||
tipEffect_(1),
|
||||
flap_(),
|
||||
x_(cells().size(), Zero),
|
||||
R_(cells().size(), I),
|
||||
invR_(cells().size(), I),
|
||||
area_(cells().size(), Zero),
|
||||
x_(set_.cells().size(), Zero),
|
||||
R_(set_.cells().size(), I),
|
||||
invR_(set_.cells().size(), I),
|
||||
area_(set_.cells().size(), Zero),
|
||||
coordSys_("rotorCoordSys", vector::zero, axesRotation(sphericalTensor::I)),
|
||||
cylindrical_(),
|
||||
rMax_(0),
|
||||
@ -625,10 +630,17 @@ void Foam::fv::rotorDiskSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::rotorDiskSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::rotorDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -100,7 +100,8 @@ SourceFiles
|
||||
#ifndef rotorDiskSource_H
|
||||
#define rotorDiskSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "cylindricalCS.H"
|
||||
#include "cylindrical.H"
|
||||
#include "NamedEnum.H"
|
||||
@ -125,7 +126,7 @@ namespace fv
|
||||
|
||||
class rotorDiskSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
public:
|
||||
|
||||
@ -145,7 +146,7 @@ public:
|
||||
static const NamedEnum<inletFlowType, 3> inletFlowTypeNames_;
|
||||
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
// Helper structures to encapsulate flap and trim data
|
||||
// Note: all input in degrees (converted to radians internally)
|
||||
@ -158,7 +159,10 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// Protected data
|
||||
// Private data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
@ -282,6 +286,8 @@ public:
|
||||
// Positive anti-clockwise when looking along -ve lift direction
|
||||
inline scalar omega() const;
|
||||
|
||||
inline const fvCellSet& set() const;
|
||||
|
||||
//- Return the cell centre positions in local rotor frame
|
||||
// (Cylindrical r, theta, z)
|
||||
inline const List<point>& x() const;
|
||||
@ -330,6 +336,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
@ -27,25 +27,31 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const
|
||||
inline Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const
|
||||
{
|
||||
return rhoRef_;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::fv::rotorDiskSource::omega() const
|
||||
inline Foam::scalar Foam::fv::rotorDiskSource::omega() const
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::List<Foam::point>& Foam::fv::rotorDiskSource::x() const
|
||||
inline const Foam::fvCellSet& Foam::fv::rotorDiskSource::set() const
|
||||
{
|
||||
return set_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::List<Foam::point>& Foam::fv::rotorDiskSource::x() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::coordinateSystems::cylindrical&
|
||||
inline const Foam::coordinateSystems::cylindrical&
|
||||
Foam::fv::rotorDiskSource::coordSys() const
|
||||
{
|
||||
return coordSys_;
|
||||
|
||||
@ -51,7 +51,7 @@ void Foam::fv::rotorDiskSource::calculate
|
||||
scalar AOAmax = -great;
|
||||
scalar powerEff = 0;
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -187,13 +187,13 @@ void Foam::fv::rotorDiskSource::writeField
|
||||
|
||||
Field<Type>& field = tfield.ref().primitiveFieldRef();
|
||||
|
||||
if (cells().size() != values.size())
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
if (cells.size() != values.size())
|
||||
{
|
||||
FatalErrorInFunction << abort(FatalError);
|
||||
}
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
field[cells[i]] = values[i];
|
||||
|
||||
@ -49,7 +49,7 @@ Foam::fixedTrim::fixedTrim
|
||||
)
|
||||
:
|
||||
trimModel(rotor, dict, typeName),
|
||||
thetag_(rotor.cells().size(), 0.0)
|
||||
thetag_(rotor.set().cells().size(), 0.0)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ Foam::vector Foam::targetCoeffTrim::calcCoeffs
|
||||
{
|
||||
rotor_.calculate(rho, U, thetag, force, false, false);
|
||||
|
||||
const labelList& cells = rotor_.cells();
|
||||
const labelList& cells = rotor_.set().cells();
|
||||
const vectorField& C = rotor_.mesh().C();
|
||||
const List<point>& x = rotor_.x();
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ void Foam::fv::solidificationMeltingSource::update
|
||||
|
||||
const volScalarField& T = mesh().lookupObject<volScalarField>(TName_);
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -218,13 +218,14 @@ void Foam::fv::solidificationMeltingSource::update
|
||||
|
||||
Foam::fv::solidificationMeltingSource::solidificationMeltingSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(sourceName, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
Tsol_(NaN),
|
||||
Tliq_(NaN),
|
||||
alpha1e_(NaN),
|
||||
@ -243,7 +244,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name() + ":alpha1",
|
||||
this->name() + ":alpha1",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
@ -254,7 +255,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
),
|
||||
curTimeIndex_(-1),
|
||||
deltaT_(cells().size(), 0)
|
||||
deltaT_(set_.cells().size(), 0)
|
||||
{
|
||||
readCoeffs();
|
||||
}
|
||||
@ -325,7 +326,7 @@ void Foam::fv::solidificationMeltingSource::addSup
|
||||
vectorField& Su = eqn.source();
|
||||
const scalarField& V = mesh().V();
|
||||
|
||||
const labelList& cells = this->cells();
|
||||
const labelList& cells = set_.cells();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -355,10 +356,17 @@ void Foam::fv::solidificationMeltingSource::addSup
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::solidificationMeltingSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -120,9 +120,10 @@ SourceFiles
|
||||
#ifndef solidificationMeltingSource_H
|
||||
#define solidificationMeltingSource_H
|
||||
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "cellSetModel.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -138,7 +139,7 @@ namespace fv
|
||||
|
||||
class solidificationMeltingSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
public:
|
||||
|
||||
@ -155,6 +156,9 @@ private:
|
||||
|
||||
// Private Data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Temperature at which isotherm melting occurs
|
||||
// and not isotherm melting starts e.g. eutectic [K]
|
||||
scalar Tsol_;
|
||||
@ -240,7 +244,7 @@ public:
|
||||
//- Construct from explicit source name and mesh
|
||||
solidificationMeltingSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
@ -298,6 +302,12 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
@ -238,7 +238,8 @@ Foam::fv::codedFvModel::codedFvModel
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
fieldName_(word::null)
|
||||
{
|
||||
readCoeffs();
|
||||
@ -262,10 +263,17 @@ FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_RHO_SUP, fv::codedFvModel);
|
||||
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP, fv::codedFvModel);
|
||||
|
||||
|
||||
void Foam::fv::codedFvModel::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::codedFvModel::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,7 +73,8 @@ SourceFiles
|
||||
#ifndef codedFvModel_H
|
||||
#define codedFvModel_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "codedBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -89,7 +90,7 @@ namespace fv
|
||||
|
||||
class codedFvModel
|
||||
:
|
||||
public cellSetModel,
|
||||
public fvModel,
|
||||
public codedBase
|
||||
{
|
||||
// Private static data
|
||||
@ -100,6 +101,9 @@ class codedFvModel
|
||||
|
||||
// Private data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- The name
|
||||
word name_;
|
||||
|
||||
@ -209,6 +213,12 @@ public:
|
||||
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_SUP);
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Foam
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
cellSetModel,
|
||||
fvModel,
|
||||
semiImplicitSource,
|
||||
dictionary
|
||||
);
|
||||
@ -68,7 +68,7 @@ void Foam::fv::semiImplicitSource::readCoeffs()
|
||||
switch (volumeMode_)
|
||||
{
|
||||
case volumeMode::absolute:
|
||||
VDash_ = V();
|
||||
VDash_ = set_.V();
|
||||
break;
|
||||
case volumeMode::specific:
|
||||
VDash_ = 1;
|
||||
@ -143,7 +143,7 @@ void Foam::fv::semiImplicitSource::addSupType
|
||||
);
|
||||
|
||||
// Explicit source function for the field
|
||||
UIndirectList<Type>(Su, cells()) =
|
||||
UIndirectList<Type>(Su, set_.cells()) =
|
||||
fieldSu_[fieldName]->value<Type>(t)/VDash_;
|
||||
|
||||
volScalarField::Internal Sp
|
||||
@ -167,7 +167,7 @@ void Foam::fv::semiImplicitSource::addSupType
|
||||
);
|
||||
|
||||
// Implicit source function for the field
|
||||
UIndirectList<scalar>(Sp, cells()) =
|
||||
UIndirectList<scalar>(Sp, set_.cells()) =
|
||||
fieldSp_[fieldName]->value(t)/VDash_;
|
||||
|
||||
eqn += Su + fvm::SuSp(Sp, psi);
|
||||
@ -209,7 +209,8 @@ Foam::fv::semiImplicitSource::semiImplicitSource
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
cellSetModel(name, modelType, dict, mesh),
|
||||
fvModel(name, modelType, dict, mesh),
|
||||
set_(coeffs(), mesh),
|
||||
volumeMode_(volumeMode::absolute),
|
||||
VDash_(1)
|
||||
{
|
||||
@ -244,10 +245,17 @@ FOR_ALL_FIELD_TYPES
|
||||
);
|
||||
|
||||
|
||||
void Foam::fv::semiImplicitSource::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
set_.updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::semiImplicitSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetModel::read(dict))
|
||||
if (fvModel::read(dict))
|
||||
{
|
||||
set_.read(coeffs());
|
||||
readCoeffs();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -92,7 +92,8 @@ SourceFiles
|
||||
#ifndef semiImplicitSource_H
|
||||
#define semiImplicitSource_H
|
||||
|
||||
#include "cellSetModel.H"
|
||||
#include "fvModel.H"
|
||||
#include "fvCellSet.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "objectFunction1.H"
|
||||
|
||||
@ -109,7 +110,7 @@ namespace fv
|
||||
|
||||
class semiImplicitSource
|
||||
:
|
||||
public cellSetModel
|
||||
public fvModel
|
||||
{
|
||||
public:
|
||||
|
||||
@ -130,6 +131,9 @@ private:
|
||||
|
||||
// Private member data
|
||||
|
||||
//- The set of cells the fvConstraint applies to
|
||||
fvCellSet set_;
|
||||
|
||||
//- Volume mode
|
||||
volumeMode volumeMode_;
|
||||
|
||||
@ -217,6 +221,12 @@ public:
|
||||
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_ALPHA_RHO_SUP);
|
||||
|
||||
|
||||
// Mesh motion
|
||||
|
||||
//- Update for mesh changes
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read source dictionary
|
||||
|
||||
Reference in New Issue
Block a user