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