fvCellSet: The selectionMode entry is now optional
Description
General cell set selection class for models that apply to sub-sets
of the mesh.
Currently supports cell selection from a set of points, a specified cellSet
or cellZone or all of the cells. The selection method can either be
specified explicitly using the \c selectionMode entry or inferred from the
presence of either a \c cellSet, \c cellZone or \c points entry. The \c
selectionMode entry is required to select \c all cells.
Usage
Examples:
\verbatim
// Apply everywhere
selectionMode all;
// Apply within a given cellSet
selectionMode cellSet; // Optional
cellSet rotor;
// Apply within a given cellZone
selectionMode cellZone; // Optional
cellSet rotor;
// Apply in cells containing a list of points
selectionMode points; // Optional
points
(
(2.25 0.5 0)
(2.75 0.5 0)
);
\endverbatim
All tutorials updated and simplified.
This commit is contained in:
@ -50,7 +50,7 @@ Usage
|
||||
origin (0 0 0);
|
||||
axis (0 0 1);
|
||||
|
||||
rpm 6.28319;
|
||||
omega 6.28319;
|
||||
}
|
||||
\endverbatim
|
||||
or for a tabulated ramped rotational speed of a solid body:
|
||||
|
||||
@ -61,10 +61,10 @@ Foam::solidBodyMotionSolver::solidBodyMotionSolver
|
||||
moveAllCells_(false),
|
||||
transform_(SBMFPtr_().transformation())
|
||||
{
|
||||
word cellZoneName =
|
||||
const word cellZoneName =
|
||||
coeffDict().lookupOrDefault<word>("cellZone", "none");
|
||||
|
||||
word cellSetName =
|
||||
const word cellSetName =
|
||||
coeffDict().lookupOrDefault<word>("cellSet", "none");
|
||||
|
||||
if ((cellZoneName != "none") && (cellSetName != "none"))
|
||||
@ -105,7 +105,7 @@ Foam::solidBodyMotionSolver::solidBodyMotionSolver
|
||||
cellIDs = set.toc();
|
||||
}
|
||||
|
||||
label nCells = returnReduce(cellIDs.size(), sumOp<label>());
|
||||
const label nCells = returnReduce(cellIDs.size(), sumOp<label>());
|
||||
moveAllCells_ = nCells == 0;
|
||||
|
||||
if (moveAllCells_)
|
||||
|
||||
@ -222,7 +222,7 @@ Foam::MRFZone::MRFZone
|
||||
mesh_(mesh),
|
||||
name_(name),
|
||||
coeffs_(dict),
|
||||
cellSet_(mesh, coeffs_, fvCellSet::selectionModeType::cellZone),
|
||||
cellSet_(mesh, coeffs_),
|
||||
origin_(coeffs_.lookup("origin")),
|
||||
axis_(coeffs_.lookup("axis")),
|
||||
omega_(coeffs_)
|
||||
|
||||
@ -142,44 +142,6 @@ void Foam::fvCellSet::setV()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvCellSet::setSet(const dictionary& dict)
|
||||
{
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case selectionModeType::points:
|
||||
{
|
||||
dict.lookup("points") >> points_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellSet:
|
||||
{
|
||||
dict.lookup("cellSet") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellZone:
|
||||
{
|
||||
dict.lookup("cellZone") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::all:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown selectionMode "
|
||||
<< selectionModeTypeNames_[selectionMode_]
|
||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
setCells();
|
||||
setV();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvCellSet::fvCellSet
|
||||
@ -197,22 +159,6 @@ Foam::fvCellSet::fvCellSet
|
||||
}
|
||||
|
||||
|
||||
Foam::fvCellSet::fvCellSet
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const selectionModeType defaultSelectionMode
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
selectionMode_(defaultSelectionMode),
|
||||
cellSetName_(word::null),
|
||||
V_(NaN)
|
||||
{
|
||||
read(dict, defaultSelectionMode);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvCellSet::~fvCellSet()
|
||||
@ -254,31 +200,64 @@ void Foam::fvCellSet::distribute(const polyDistributionMap&)
|
||||
|
||||
bool Foam::fvCellSet::read(const dictionary& dict)
|
||||
{
|
||||
selectionMode_ =
|
||||
selectionModeTypeNames_.read(dict.lookup("selectionMode"));
|
||||
if (dict.found("selectionMode"))
|
||||
{
|
||||
selectionMode_ =
|
||||
selectionModeTypeNames_.read(dict.lookup("selectionMode"));
|
||||
}
|
||||
else if (dict.found("points"))
|
||||
{
|
||||
selectionMode_ = selectionModeType::points;
|
||||
}
|
||||
else if (dict.found("cellSet"))
|
||||
{
|
||||
selectionMode_ = selectionModeType::cellSet;
|
||||
}
|
||||
else if (dict.lookup("cellZone"))
|
||||
{
|
||||
selectionMode_ = selectionModeType::cellZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "selectionMode, points, cellSet or cellZone not specified. "
|
||||
<< "Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
setSet(dict);
|
||||
switch (selectionMode_)
|
||||
{
|
||||
case selectionModeType::points:
|
||||
{
|
||||
dict.lookup("points") >> points_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellSet:
|
||||
{
|
||||
dict.lookup("cellSet") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::cellZone:
|
||||
{
|
||||
dict.lookup("cellZone") >> cellSetName_;
|
||||
break;
|
||||
}
|
||||
case selectionModeType::all:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown selectionMode "
|
||||
<< selectionModeTypeNames_[selectionMode_]
|
||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fvCellSet::read
|
||||
(
|
||||
const dictionary& dict,
|
||||
const selectionModeType defaultSelectionMode
|
||||
)
|
||||
{
|
||||
selectionMode_ = selectionModeTypeNames_
|
||||
[
|
||||
dict.lookupOrDefault<word>
|
||||
(
|
||||
"selectionMode",
|
||||
selectionModeTypeNames_[defaultSelectionMode]
|
||||
)
|
||||
];
|
||||
|
||||
setSet(dict);
|
||||
setCells();
|
||||
setV();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -25,33 +25,36 @@ Class
|
||||
Foam::fv::fvCellSet
|
||||
|
||||
Description
|
||||
Cell-set fvConstraint abstract base class. Provides a base set of controls
|
||||
regarding the location where the fvConstraint is applied.
|
||||
General cell set selection class for models that apply to sub-sets
|
||||
of the mesh.
|
||||
|
||||
Currently supports cell selection from a set of points, a specified cellSet
|
||||
or cellZone or all of the cells. The selection method can either be
|
||||
specified explicitly using the \c selectionMode entry or inferred from the
|
||||
presence of either a \c cellSet, \c cellZone or \c points entry. The \c
|
||||
selectionMode entry is required to select \c all cells.
|
||||
|
||||
Usage
|
||||
Example usage:
|
||||
Examples:
|
||||
\verbatim
|
||||
constraint1
|
||||
{
|
||||
type <constraintType>
|
||||
|
||||
// Apply everywhere
|
||||
selectionMode all;
|
||||
|
||||
// // Apply within a given cell set
|
||||
// selectionMode cellSet;
|
||||
// cellSet c0;
|
||||
// Apply within a given cellSet
|
||||
selectionMode cellSet; // Optional
|
||||
cellSet rotor;
|
||||
|
||||
// // Apply in cells containing a list of points
|
||||
// selectionMode points;
|
||||
// points
|
||||
// (
|
||||
// (2.25 0.5 0)
|
||||
// (2.75 0.5 0)
|
||||
// );
|
||||
// Apply within a given cellZone
|
||||
selectionMode cellZone; // Optional
|
||||
cellSet rotor;
|
||||
|
||||
...
|
||||
}
|
||||
// Apply in cells containing a list of points
|
||||
selectionMode points; // Optional
|
||||
points
|
||||
(
|
||||
(2.25 0.5 0)
|
||||
(2.75 0.5 0)
|
||||
);
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
@ -130,9 +133,6 @@ private:
|
||||
//- Set the sum of scalar volumes
|
||||
void setV();
|
||||
|
||||
//- Set the set for the selectionMode
|
||||
void setSet(const dictionary& dict);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -145,14 +145,6 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from mesh, dictionary and default selectionMode
|
||||
fvCellSet
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const selectionModeType defaultSelectionMode
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~fvCellSet();
|
||||
@ -195,13 +187,6 @@ public:
|
||||
|
||||
//- Read coefficients dictionary
|
||||
bool read(const dictionary& dict);
|
||||
|
||||
//- Read coefficients dictionary and default selectionMode
|
||||
bool read
|
||||
(
|
||||
const dictionary& dict,
|
||||
const selectionModeType defaultSelectionMode
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ source1
|
||||
{
|
||||
type fixedTemperatureConstraint;
|
||||
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
mode uniform;
|
||||
|
||||
@ -18,7 +18,6 @@ ignition
|
||||
{
|
||||
type fixedTemperatureConstraint;
|
||||
|
||||
selectionMode cellSet;
|
||||
cellSet ignition;
|
||||
|
||||
mode uniform;
|
||||
|
||||
@ -20,7 +20,6 @@ porosity1
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
@ -20,7 +20,6 @@ porosity
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
type fixedCoeff;
|
||||
|
||||
@ -26,7 +26,6 @@ fixedTemperature
|
||||
{
|
||||
type fixedTemperatureConstraint;
|
||||
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
mode uniform;
|
||||
@ -38,7 +37,6 @@ porosityTurbulence
|
||||
{
|
||||
type fixedValueConstraint;
|
||||
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
fieldValues
|
||||
|
||||
@ -20,7 +20,6 @@ porosity1
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
@ -20,7 +20,6 @@ porosity1
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone stator;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
@ -20,7 +20,6 @@ porosity
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone porousBlockage;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
@ -17,7 +17,6 @@ disk
|
||||
{
|
||||
type rotorDisk;
|
||||
|
||||
selectionMode cellZone;
|
||||
cellZone rotatingZone;
|
||||
|
||||
nBlades 3; // Number of blades
|
||||
|
||||
@ -18,7 +18,6 @@ disk1
|
||||
{
|
||||
type actuationDiskSource;
|
||||
|
||||
selectionMode cellSet;
|
||||
cellSet actuationDisk1;
|
||||
|
||||
diskDir (1 0 0); // Orientation of the disk
|
||||
@ -32,7 +31,6 @@ disk2
|
||||
{
|
||||
type actuationDiskSource;
|
||||
|
||||
selectionMode cellSet;
|
||||
cellSet actuationDisk2;
|
||||
|
||||
diskDir (1 0 0); // Orientation of the disk
|
||||
|
||||
@ -31,7 +31,6 @@ filter1
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone filter;
|
||||
|
||||
type DarcyForchheimer;
|
||||
@ -57,7 +56,6 @@ massSource
|
||||
{
|
||||
type massSource;
|
||||
|
||||
selectionMode points;
|
||||
points
|
||||
(
|
||||
(2.75 0.5 0)
|
||||
|
||||
@ -21,7 +21,6 @@ source1
|
||||
timeStart 0.1;
|
||||
duration 0.4;
|
||||
|
||||
selectionMode cellSet;
|
||||
cellSet ignitionCells;
|
||||
|
||||
mode uniform;
|
||||
|
||||
@ -20,7 +20,6 @@ porosity1
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
selectionMode cellZone;
|
||||
cellZone porosity;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
@ -18,7 +18,6 @@ massSource
|
||||
{
|
||||
type massSource;
|
||||
|
||||
selectionMode cellZone;
|
||||
cellZone injection;
|
||||
|
||||
massFlowRate 6e-7;
|
||||
|
||||
@ -18,7 +18,6 @@ massSource
|
||||
{
|
||||
type massSource;
|
||||
|
||||
selectionMode points;
|
||||
points ((0.075 0.925 0.05));
|
||||
|
||||
massFlowRate
|
||||
|
||||
@ -18,7 +18,6 @@ massSource
|
||||
{
|
||||
type massSource;
|
||||
|
||||
selectionMode points;
|
||||
points
|
||||
(
|
||||
(0.075 0.2 0.05)
|
||||
|
||||
@ -18,7 +18,6 @@ massSource
|
||||
{
|
||||
type massSource;
|
||||
|
||||
selectionMode points;
|
||||
points
|
||||
(
|
||||
(0.075 0.2 0.05)
|
||||
|
||||
Reference in New Issue
Block a user