fvOptions: Separate options for all cells, cellSets and inter-region coupling

by introducing rational base-classes rather than using the hideous
'switch' statement.  Further rationalization of the cell-selection
mechanism will be implemented via an appropriate class hierarchy to
replace the remaining 'switch' statement.

Mesh-motion is currently handled very inefficiently for cellSets and not
at all for inter-region coupling.  The former will be improved when the
cell-selection classes are written and the latter by making the
meshToMesh class a MeshObject after it has been corrected for mapFields.
This commit is contained in:
Henry
2015-05-31 16:38:01 +01:00
parent c3ee2348a6
commit 3a004fda10
75 changed files with 1647 additions and 1068 deletions

View File

@ -1,10 +1,16 @@
fvOptions/fvOption.C
fvOptions/fvOptionIO.C
fvOptions/fvOptionList.C
fvOptions/fvIOoptionList.C
fvOption/fvOption.C
fvOption/fvOptionIO.C
fvOption/fvOptionList.C
fvOption/fvIOoptionList.C
cellSetOption/cellSetOption.C
cellSetOption/cellSetOptionIO.C
interRegionOption/interRegionOption.C
interRegionOption/interRegionOptionIO.C
/* sources */
/* Sources */
generalSources=sources/general
$(generalSources)/codedSource/codedSource.C
@ -32,16 +38,17 @@ $(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C
$(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C
$(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C
interRegion = sources/interRegion
$(interRegion)/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C
$(interRegion)/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C
$(interRegion)/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
/* constraints */
/* Constraints */
generalConstraints=constraints/general
$(generalConstraints)/explicitSetValue/explicitSetValue.C

View File

@ -0,0 +1,237 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "cellSetOption.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(cellSetOption, 0);
}
template<> const char* NamedEnum
<
fv::cellSetOption::selectionModeType,
4
>::names[] =
{
"points",
"cellSet",
"cellZone",
"all"
};
const NamedEnum<fv::cellSetOption::selectionModeType, 4>
fv::cellSetOption::selectionModeTypeNames_;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fv::cellSetOption::setSelection(const dictionary& dict)
{
switch (selectionMode_)
{
case smPoints:
{
dict.lookup("points") >> points_;
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case smCellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn("::setSelection(const dictionary&)")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
void Foam::fv::cellSetOption::setCellSet()
{
switch (selectionMode_)
{
case smPoints:
{
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)
{
WarningIn("cellSetOption::setCellSet()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
cells_ = selectedCells.toc();
break;
}
case smCellSet:
{
Info<< indent
<< "- selecting cells using cellSet " << cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
break;
}
case smCellZone:
{
Info<< indent
<< "- selecting cells using cellZone " << cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
FatalErrorIn("cellSetOption::setCellIds()")
<< "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError);
}
cells_ = mesh_.cellZones()[zoneID];
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
}
default:
{
FatalErrorIn("cellSetOption::setCellSet()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
// Set volume information
V_ = 0.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;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::cellSetOption::cellSetOption
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
timeStart_(-1.0),
duration_(0.0),
selectionMode_
(
selectionModeTypeNames_.read(coeffs_.lookup("selectionMode"))
),
cellSetName_("none"),
V_(0.0)
{
Info<< incrIndent;
read(dict);
setSelection(coeffs_);
setCellSet();
Info<< decrIndent;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::cellSetOption::~cellSetOption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::cellSetOption::isActive()
{
if (option::isActive() && inTimeLimits(mesh_.time().value()))
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,222 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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::cellSetOption
Description
Cell-set options abtract base class. Provides a base set of controls,
e.g.
type scalarExplicitSource // Source type
active on; // on/off switch
scalarExplicitSourceCoeffs
{
timeStart 0.0; // Start time
duration 1000.0; // Duration
selectionMode cellSet; // cellSet, points, cellZone
.
.
.
}
Note:
Source/sink options are to be added to the equation R.H.S.
SourceFiles
cellSetOption.C
cellSetOptionIO.C
\*---------------------------------------------------------------------------*/
#ifndef cellSetOption_H
#define cellSetOption_H
#include "fvOption.H"
#include "cellSet.H"
#include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class cellSetOption Declaration
\*---------------------------------------------------------------------------*/
class cellSetOption
:
public option
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet,
smCellZone,
smAll
};
//- Word list of selection mode type names
static const NamedEnum<selectionModeType, 4>
selectionModeTypeNames_;
protected:
// Protected data
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- 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
labelList cells_;
//- Sum of cell volumes
scalar V_;
// Protected functions
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
//- Runtime type information
TypeName("cellSetOption");
// Constructors
//- Construct from components
cellSetOption
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~cellSetOption();
// Member Functions
// Access
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return true if within time limits
inline bool inTimeLimits(const scalar time) const;
//- 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;
// Edit
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
// Checks
//- Is the source active?
virtual bool isActive();
// I-O
//- Write the source header information
virtual void writeHeader(Ostream&) const;
//- Write the source footer information
virtual void writeFooter(Ostream&) const;
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cellSetOptionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 Foam::scalar Foam::fv::cellSetOption::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::fv::cellSetOption::duration() const
{
return duration_;
}
inline bool Foam::fv::cellSetOption::inTimeLimits(const scalar time) const
{
return
(
(timeStart_ < 0)
||
(
(mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= (timeStart_ + duration_))
)
);
}
inline const Foam::fv::cellSetOption::selectionModeType&
Foam::fv::cellSetOption::selectionMode() const
{
return selectionMode_;
}
inline const Foam::word& Foam::fv::cellSetOption::cellSetName() const
{
return cellSetName_;
}
inline Foam::scalar Foam::fv::cellSetOption::V() const
{
return V_;
}
inline const Foam::labelList& Foam::fv::cellSetOption::cells() const
{
return cells_;
}
inline Foam::scalar& Foam::fv::cellSetOption::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::fv::cellSetOption::duration()
{
return duration_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,26 +23,27 @@ License
\*---------------------------------------------------------------------------*/
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::option::writeHeader(Ostream& os) const
void Foam::fv::cellSetOption::writeHeader(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
void Foam::fv::option::writeFooter(Ostream& os) const
void Foam::fv::cellSetOption::writeFooter(Ostream& os) const
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
void Foam::fv::option::writeData(Ostream& os) const
void Foam::fv::cellSetOption::writeData(Ostream& os) const
{
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
option::writeData(os);
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode")
@ -72,10 +73,6 @@ void Foam::fv::option::writeData(Ostream& os) const
{
break;
}
case smMapRegion:
{
break;
}
default:
{
FatalErrorIn("option::writeData(Ostream&) const")
@ -87,17 +84,16 @@ void Foam::fv::option::writeData(Ostream& os) const
}
bool Foam::fv::option::read(const dictionary& dict)
bool Foam::fv::cellSetOption::read(const dictionary& dict)
{
active_ = readBool(dict.lookup("active"));
if (dict.readIfPresent("timeStart", timeStart_))
if (option::read(dict))
{
dict.lookup("duration") >> duration_;
if (coeffs_.readIfPresent("timeStart", timeStart_))
{
coeffs_.lookup("duration") >> duration_;
}
}
coeffs_ = dict.subDict(modelType_ + "Coeffs");
return true;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,7 +67,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
mode_(temperatureModeNames_.read(coeffs_.lookup("mode"))),
Tuniform_(NULL),
TName_("T")

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,7 +52,7 @@ SourceFiles
#ifndef fixedTemperatureConstraint_H
#define fixedTemperatureConstraint_H
#include "fvOption.H"
#include "cellSetOption.H"
#include "NamedEnum.H"
#include "DataEntry.H"
@ -69,7 +69,7 @@ namespace fv
class fixedTemperatureConstraint
:
public option
public cellSetOption
{
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,7 +54,7 @@ Foam::fv::temperatureLimitsConstraint::temperatureLimitsConstraint
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
Tmin_(readScalar(coeffs_.lookup("Tmin"))),
Tmax_(readScalar(coeffs_.lookup("Tmax")))
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ SourceFiles
#ifndef temperatureLimitsConstraint_H
#define temperatureLimitsConstraint_H
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +60,7 @@ namespace fv
class temperatureLimitsConstraint
:
public option
public cellSetOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,7 +59,7 @@ Foam::fv::ExplicitSetValue<Type>::ExplicitSetValue
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
injectionRate_()
{
read(dict);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,7 +51,7 @@ SourceFiles
#ifndef ExplicitSetValue_H
#define ExplicitSetValue_H
#include "fvOption.H"
#include "cellSetOption.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,7 +68,7 @@ namespace fv
template<class Type>
class ExplicitSetValue
:
public option
public cellSetOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -0,0 +1,335 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "fvOption.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(option, 0);
defineRunTimeSelectionTable(option, dictionary);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::fv::option::alwaysApply() const
{
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::option::option
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
name_(name),
modelType_(modelType),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(dict_.lookupOrDefault<bool>("active", true)),
fieldNames_(),
applied_()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
Info<< decrIndent;
}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::fv::option> Foam::fv::option::New
(
const word& name,
const dictionary& coeffs,
const fvMesh& mesh
)
{
word modelType(coeffs.lookup("type"));
Info<< indent
<< "Selecting finite volume options model type " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"option::New(const word&, const dictionary&, const fvMesh&)"
) << "Unknown Model type " << modelType << nl << nl
<< "Valid model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<option>(cstrIter()(name, modelType, coeffs, mesh));
}
Foam::fv::option::~option()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::option::isActive()
{
return active_;
}
Foam::label Foam::fv::option::applyToField(const word& fieldName) const
{
if (alwaysApply())
{
return 0;
}
return findIndex(fieldNames_, fieldName);
}
void Foam::fv::option::checkApplied() const
{
forAll(applied_, i)
{
if (!applied_[i])
{
WarningIn("void option::checkApplied() const")
<< "Source " << name_ << " defined for field "
<< fieldNames_[i] << " but never used" << endl;
}
}
}
void Foam::fv::option::correct(volScalarField& fld)
{}
void Foam::fv::option::correct(volVectorField& fld)
{}
void Foam::fv::option::correct(volSphericalTensorField& fld)
{}
void Foam::fv::option::correct(volSymmTensorField& fld)
{}
void Foam::fv::option::correct(volTensorField& fld)
{}
void Foam::fv::option::addSup
(
fvMatrix<scalar>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
fvMatrix<vector>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
fvMatrix<tensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<tensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<tensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::setValue(fvMatrix<scalar>& eqn, const label fieldI)
{}
void Foam::fv::option::setValue(fvMatrix<vector>& eqn, const label fieldI)
{}
void Foam::fv::option::setValue
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::setValue
(
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{}
void Foam::fv::option::setValue(fvMatrix<tensor>& eqn, const label fieldI)
{}
// ************************************************************************* //

View File

@ -30,12 +30,9 @@ Description
type scalarExplicitSource // source type
active on; // on/off switch
timeStart 0.0; // start time
duration 1000.0; // duration
selectionMode cellSet; // cellSet // points //cellZone
// mapRegion
Note:
On evaluation, source/sink options are to be added to the equation rhs
On evaluation, source/sink options are to be added to the equation R.H.S.
SourceFiles
fvOption.C
@ -48,10 +45,7 @@ SourceFiles
#include "fvMatricesFwd.H"
#include "volFieldsFwd.H"
#include "cellSet.H"
#include "autoPtr.H"
#include "meshToMesh.H"
#include "dictionary.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,25 +64,6 @@ namespace fv
class option
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet,
smCellZone,
smMapRegion,
smAll
};
//- Word list of selection mode type names
static const NamedEnum<selectionModeType, 5>
selectionModeTypeNames_;
protected:
// Protected data
@ -111,39 +86,6 @@ protected:
//- Source active flag
bool active_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- 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
labelList cells_;
//- Sum of cell volumes
scalar V_;
// Data for smMapRegion only
//- Mesh to mesh interpolation object
autoPtr<meshToMesh> meshInterpPtr_;
//- Name of the neighbour region to map
word nbrRegionName_;
//- Master or slave region
bool master_;
//- Field names to apply source to - populated by derived models
wordList fieldNames_;
@ -156,12 +98,6 @@ protected:
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
@ -194,8 +130,7 @@ public:
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh,
const bool master = false
const fvMesh& mesh
);
//- Return clone
@ -209,8 +144,9 @@ public:
// on the freestore from an Istream
class iNew
{
//- Reference to the mesh database
//- Reference to the mesh
const fvMesh& mesh_;
const word& name_;
public:
@ -253,7 +189,6 @@ public:
virtual ~option();
// Member Functions
// Access
@ -270,34 +205,6 @@ public:
//- Return const access to the source active flag
inline bool active() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return true if within time limits
inline bool inTimeLimits(const scalar time) const;
//- 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 neighbour region name
inline const word& nbrRegionName() const;
//- Return const access to the mapToMap pointer
inline const meshToMesh& meshInterp() const;
//- Return const access to the cell set
inline const labelList& cells() const;
//- Set the applied flag to true for field index fieldI
inline void setApplied(const label fieldI);
@ -307,12 +214,6 @@ public:
//- Return access to the source active flag
inline bool& active();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
// Checks

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,8 +23,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fvMesh.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::fv::option::name() const
@ -51,57 +49,6 @@ inline bool Foam::fv::option::active() const
}
inline Foam::scalar Foam::fv::option::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::fv::option::duration() const
{
return duration_;
}
inline bool Foam::fv::option::inTimeLimits(const scalar time) const
{
return
(
(timeStart_ < 0)
||
(
(mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= (timeStart_ + duration_))
)
);
}
inline const Foam::fv::option::selectionModeType&
Foam::fv::option::selectionMode() const
{
return selectionMode_;
}
inline const Foam::word& Foam::fv::option::cellSetName() const
{
return cellSetName_;
}
inline Foam::scalar Foam::fv::option::V() const
{
return V_;
}
inline const Foam::labelList& Foam::fv::option::cells() const
{
return cells_;
}
inline void Foam::fv::option::setApplied(const label fieldI)
{
applied_[fieldI] = true;
@ -114,35 +61,4 @@ inline bool& Foam::fv::option::active()
}
inline Foam::scalar& Foam::fv::option::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::fv::option::duration()
{
return duration_;
}
inline const Foam::word& Foam::fv::option::nbrRegionName() const
{
return nbrRegionName_;
}
inline const Foam::meshToMesh& Foam::fv::option::meshInterp() const
{
if (!meshInterpPtr_.valid())
{
FatalErrorIn("const meshToMesh& meshInterp() const")
<< "Interpolation object not set"
<< abort(FatalError);
}
return meshInterpPtr_();
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "fvOption.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::option::writeHeader(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
void Foam::fv::option::writeFooter(Ostream& os) const
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
void Foam::fv::option::writeData(Ostream& os) const
{
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
}
bool Foam::fv::option::read(const dictionary& dict)
{
dict.readIfPresent("active", active_);
coeffs_ = dict.subDict(modelType_ + "Coeffs");
return true;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -1,613 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "fvOption.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "volFields.H"
#include "fvsPatchFields.H"
#include "ListOps.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(option, 0);
defineRunTimeSelectionTable(option, dictionary);
}
template<> const char* NamedEnum
<
fv::option::selectionModeType,
5
>::names[] =
{
"points",
"cellSet",
"cellZone",
"mapRegion",
"all"
};
const NamedEnum<fv::option::selectionModeType, 5>
fv::option::selectionModeTypeNames_;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::fv::option::alwaysApply() const
{
return false;
}
void Foam::fv::option::setSelection(const dictionary& dict)
{
switch (selectionMode_)
{
case smPoints:
{
dict.lookup("points") >> points_;
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case smCellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smMapRegion:
{
dict.lookup("nbrRegionName") >> nbrRegionName_;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn("option::setSelection(const dictionary&)")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
void Foam::fv::option::setCellSet()
{
switch (selectionMode_)
{
case smPoints:
{
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)
{
WarningIn("option::setCellSet()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
cells_ = selectedCells.toc();
break;
}
case smCellSet:
{
Info<< indent
<< "- selecting cells using cellSet " << cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
break;
}
case smCellZone:
{
Info<< indent
<< "- selecting cells using cellZone " << cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
FatalErrorIn("option::setCellIds()")
<< "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError);
}
cells_ = mesh_.cellZones()[zoneID];
break;
}
case smMapRegion:
{
if (active_ && master_)
{
Info<< indent << "- selecting inter region mapping" << endl;
const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
if (mesh_.name() == nbrMesh.name())
{
FatalErrorIn("option::setCellIds()")
<< "Inter-region model selected, but local and "
<< "neighbour regions are the same: " << nl
<< " local region: " << mesh_.name() << nl
<< " secondary region: " << nbrMesh.name() << nl
<< exit(FatalError);
}
if (mesh_.bounds().overlaps(nbrMesh.bounds()))
{
meshInterpPtr_.reset
(
new meshToMesh
(
mesh_,
nbrMesh,
meshToMesh::interpolationMethodNames_.read
(
dict_.lookup("interpolationMethod")
),
false // not interpolating patches
)
);
}
else
{
FatalErrorIn("option::setCellSet()")
<< "regions " << mesh_.name() << " and "
<< nbrMesh.name() << " do not intersect"
<< exit(FatalError);
}
V_ = meshInterpPtr_->V();
}
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
}
default:
{
FatalErrorIn("option::setCellSet()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
// Set volume information
if (selectionMode_ != smMapRegion)
{
V_ = 0.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_ << nl << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::option::option
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh,
const bool master
)
:
name_(name),
modelType_(modelType),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(readBool(dict_.lookup("active"))),
timeStart_(-1.0),
duration_(0.0),
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
cellSetName_("none"),
V_(0.0),
meshInterpPtr_(),
nbrRegionName_("none"),
master_(master),
fieldNames_(),
applied_()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
if (dict_.readIfPresent("timeStart", timeStart_))
{
dict_.lookup("duration") >> duration_;
Info<< indent << "- applying source at time " << timeStart_
<< " for duration " << duration_ << endl;
}
else
{
Info<< indent << "- applying source for all time" << endl;
}
setSelection(dict_);
setCellSet();
Info<< decrIndent;
}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::fv::option> Foam::fv::option::New
(
const word& name,
const dictionary& coeffs,
const fvMesh& mesh
)
{
word modelType(coeffs.lookup("type"));
Info<< indent
<< "Selecting finite volume options model type " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"option::New(const word&, const dictionary&, const fvMesh&)"
) << "Unknown Model type " << modelType << nl << nl
<< "Valid model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<option>(cstrIter()(name, modelType, coeffs, mesh));
}
Foam::fv::option::~option()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::option::isActive()
{
if (active_ && inTimeLimits(mesh_.time().value()))
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
return true;
}
else
{
return false;
}
}
Foam::label Foam::fv::option::applyToField(const word& fieldName) const
{
if (alwaysApply())
{
return 0;
}
return findIndex(fieldNames_, fieldName);
}
void Foam::fv::option::checkApplied() const
{
forAll(applied_, i)
{
if (!applied_[i])
{
WarningIn("void option::checkApplied() const")
<< "Source " << name_ << " defined for field "
<< fieldNames_[i] << " but never used" << endl;
}
}
}
void Foam::fv::option::correct(volScalarField& fld)
{
// do nothing
}
void Foam::fv::option::correct(volVectorField& fld)
{
// do nothing
}
void Foam::fv::option::correct(volSphericalTensorField& fld)
{
// do nothing
}
void Foam::fv::option::correct(volSymmTensorField& fld)
{
// do nothing
}
void Foam::fv::option::correct(volTensorField& fld)
{
// do nothing
}
void Foam::fv::option::addSup
(
fvMatrix<scalar>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
fvMatrix<vector>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
fvMatrix<tensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& rho,
fvMatrix<tensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<tensor>& eqn,
const label fieldI
)
{
addSup(alpha*rho, eqn, fieldI);
}
void Foam::fv::option::setValue(fvMatrix<scalar>& eqn, const label fieldI)
{
// do nothing
}
void Foam::fv::option::setValue(fvMatrix<vector>& eqn, const label fieldI)
{
// do nothing
}
void Foam::fv::option::setValue
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::setValue
(
fvMatrix<symmTensor>& eqn,
const label fieldI
)
{
// do nothing
}
void Foam::fv::option::setValue(fvMatrix<tensor>& eqn, const label fieldI)
{
// do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "interRegionOption.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(interRegionOption, 0);
}
}
// * * * * * * * * * * * * Protected member functions * * * * * * * * * * * //
void Foam::fv::interRegionOption::setMapper()
{
if (master_)
{
Info<< indent << "- selecting inter region mapping" << endl;
const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
if (mesh_.name() == nbrMesh.name())
{
FatalErrorIn("interRegionOption::setCellIds()")
<< "Inter-region model selected, but local and "
<< "neighbour regions are the same: " << nl
<< " local region: " << mesh_.name() << nl
<< " secondary region: " << nbrMesh.name() << nl
<< exit(FatalError);
}
if (mesh_.bounds().overlaps(nbrMesh.bounds()))
{
meshInterpPtr_.reset
(
new meshToMesh
(
mesh_,
nbrMesh,
meshToMesh::interpolationMethodNames_.read
(
coeffs_.lookup("interpolationMethod")
),
false // not interpolating patches
)
);
}
else
{
FatalErrorIn("interRegionOption::setCellSet()")
<< "regions " << mesh_.name() << " and "
<< nbrMesh.name() << " do not intersect"
<< exit(FatalError);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::interRegionOption::interRegionOption
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option
(
name,
modelType,
dict,
mesh
),
master_(coeffs_.lookupOrDefault<bool>("master", true)),
nbrRegionName_(coeffs_.lookup("nbrRegionName")),
meshInterpPtr_()
{
if (active())
{
setMapper();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::interRegionOption::~interRegionOption()
{}
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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::interRegionOption
Description
Base class for inter region exchange.
\*---------------------------------------------------------------------------*/
#ifndef interRegionOption_H
#define interRegionOption_H
#include "fvOption.H"
#include "volFields.H"
#include "autoPtr.H"
#include "meshToMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class interRegionOption Declaration
\*---------------------------------------------------------------------------*/
class interRegionOption
:
public option
{
protected:
// Protected data
//- Master or slave region
bool master_;
//- Name of the neighbour region to map
word nbrRegionName_;
//- Mesh to mesh interpolation object
autoPtr<meshToMesh> meshInterpPtr_;
// Protected member functions
//- Set the mesh to mesh interpolation object
void setMapper();
public:
//- Runtime type information
TypeName("interRegionOption");
// Constructors
//- Construct from dictionary
interRegionOption
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~interRegionOption();
// Member Functions
// Access
//- Return const access to the neighbour region name
inline const word& nbrRegionName() const;
//- Return const access to the mapToMap pointer
inline const meshToMesh& meshInterp() const;
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "interRegionOptionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::word&
Foam::fv::interRegionOption::nbrRegionName() const
{
return nbrRegionName_;
}
inline const Foam::meshToMesh&
Foam::fv::interRegionOption::meshInterp() const
{
if (!meshInterpPtr_.valid())
{
FatalErrorIn
(
"const meshToMesh& interRegionOption::meshInterp() const"
) << "Interpolation object not set"
<< abort(FatalError);
}
return meshInterpPtr_();
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "interRegionOption.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::interRegionOption::writeData(Ostream& os) const
{
option::writeData(os);
os.writeKeyword("master") << master_ << token::END_STATEMENT << nl;
os.writeKeyword("nbrRegionName") << nbrRegionName_
<< token::END_STATEMENT << nl;
}
bool Foam::fv::interRegionOption::read(const dictionary& dict)
{
if (option::read(dict))
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,7 +87,7 @@ Foam::fv::actuationDiskSource::actuationDiskSource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
diskDir_(coeffs_.lookup("diskDir")),
Cp_(readScalar(coeffs_.lookup("Cp"))),
Ct_(readScalar(coeffs_.lookup("Ct"))),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,7 +69,7 @@ SourceFiles
#ifndef actuationDiskSource_H
#define actuationDiskSource_H
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -84,7 +84,7 @@ namespace fv
class actuationDiskSource
:
public option
public cellSetOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -151,7 +151,7 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
secondaryMassFlowRate_(readScalar(coeffs_.lookup("secondaryMassFlowRate"))),
secondaryInletT_(readScalar(coeffs_.lookup("secondaryInletT"))),
primaryInletT_(readScalar(coeffs_.lookup("primaryInletT"))),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,12 +66,13 @@ Description
effectivenessHeatExchangerSource1
{
type effectivenessHeatExchangerSource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
effectivenessHeatExchangerSourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
secondaryMassFlowRate 1.0;
secondaryInletT 336;
primaryInletT 293;
@ -133,7 +134,7 @@ SourceFiles
#ifndef effectivenessHeatExchangerSource_H
#define effectivenessHeatExchangerSource_H
#include "fvOption.H"
#include "cellSetOption.H"
#include "autoPtr.H"
#include "interpolation2DTable.H"
@ -150,7 +151,7 @@ namespace fv
class effectivenessHeatExchangerSource
:
public option
public cellSetOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,7 +56,7 @@ Foam::fv::explicitPorositySource::explicitPorositySource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
porosityPtr_(NULL)
{
read(dict);

View File

@ -66,7 +66,7 @@ SourceFiles
#ifndef explicitPorositySource_H
#define explicitPorositySource_H
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,7 +85,7 @@ namespace fv
class explicitPorositySource
:
public option
public cellSetOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ Foam::fv::pressureGradientExplicitSource::pressureGradientExplicitSource
const fvMesh& mesh
)
:
option(sourceName, modelType, dict, mesh),
cellSetOption(sourceName, modelType, dict, mesh),
Ubar_(coeffs_.lookup("Ubar")),
gradP0_(0.0),
dGradP_(0.0),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,7 @@ SourceFiles
#include "cellSet.H"
#include "fvMesh.H"
#include "volFields.H"
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,7 +70,7 @@ namespace fv
class pressureGradientExplicitSource
:
public option
public cellSetOption
{
// Private data

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -478,7 +478,7 @@ Foam::fv::rotorDiskSource::rotorDiskSource
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
rhoRef_(1.0),
omega_(0.0),
nBlades_(0),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,7 +88,7 @@ SourceFiles
#ifndef rotorDiskSource_H
#define rotorDiskSource_H
#include "fvOption.H"
#include "cellSetOption.H"
#include "cylindricalCS.H"
#include "localAxesRotation.H"
#include "NamedEnum.H"
@ -113,7 +113,7 @@ namespace fv
class rotorDiskSource
:
public option
public cellSetOption
{
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "rotorDiskSource.H"
#include "volFields.H"
#include "unitConversion.H"
using namespace Foam::constant;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -235,7 +235,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
const fvMesh& mesh
)
:
option(sourceName, modelType, dict, mesh),
cellSetOption(sourceName, modelType, dict, mesh),
Tmelt_(readScalar(coeffs_.lookup("Tmelt"))),
L_(readScalar(coeffs_.lookup("L"))),
relax_(coeffs_.lookupOrDefault("relax", 0.9)),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,12 +51,13 @@ Description
solidificationMeltingSource1
{
type solidificationMeltingSource;
active on;
selectionMode cellZone;
cellZone iceZone;
active yes;
solidificationMeltingSourceCoeffs
{
selectionMode cellZone;
cellZone iceZone;
Tmelt 273;
L 334000;
thermoMode thermo;
@ -96,7 +97,7 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "fvOption.H"
#include "cellSetOption.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -112,7 +113,7 @@ namespace fv
class solidificationMeltingSource
:
public option
public cellSetOption
{
public:

View File

@ -34,8 +34,7 @@ Description
SBM
{
type tabulatedAccelerationSource;
active true;
selectionMode all;
active yes;
tabulatedAccelerationSourceCoeffs
{
@ -55,6 +54,7 @@ SourceFiles
#include "fvOption.H"
#include "tabulated6DoFAcceleration.H"
#include "dimensionedTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -119,7 +119,7 @@ Foam::fv::CodedSource<Type>::CodedSource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh)
cellSetOption(name, modelType, dict, mesh)
{
read(dict);
}

View File

@ -58,11 +58,12 @@ Description
{
type scalarCodedSource;
active true;
selectionMode all;
active yes;
scalarCodedSourceCoeffs
{
selectionMode all;
fieldNames (h);
redirectType sourceTime;
@ -115,7 +116,7 @@ SourceFiles
#ifndef CodedSource_H
#define CodedSource_H
#include "fvOption.H"
#include "cellSetOption.H"
#include "codedBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -132,7 +133,7 @@ namespace fv
template<class Type>
class CodedSource
:
public option,
public cellSetOption,
public codedBase
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -119,7 +119,7 @@ Foam::fv::SemiImplicitSource<Type>::SemiImplicitSource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
cellSetOption(name, modelType, dict, mesh),
volumeMode_(vmAbsolute),
VDash_(1.0),
injectionRate_()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,7 +69,7 @@ SourceFiles
#define SemiImplicitSource_H
#include "Tuple2.H"
#include "fvOption.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -101,7 +101,7 @@ Ostream& operator<<
template<class Type>
class SemiImplicitSource
:
public option
public cellSetOption
{
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -118,7 +118,7 @@ Foam::fv::interRegionExplicitPorositySource::interRegionExplicitPorositySource
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh, true),
interRegionOption(name, modelType, dict, mesh),
porosityPtr_(NULL),
firstIter_(-1),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,7 +56,7 @@ SourceFiles
#ifndef interRegionExplicitPorositySource_H
#define interRegionExplicitPorositySource_H
#include "fvOption.H"
#include "interRegionOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,7 +75,7 @@ namespace fv
class interRegionExplicitPorositySource
:
public option
public interRegionOption
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,7 +79,7 @@ void Foam::fv::interRegionHeatTransferModel::setNbrModel()
firstIter_ = false;
// set nbr model's nbr model to avoid construction order problems
// Set nbr model's nbr model to avoid construction order problems
nbrModel_->setNbrModel();
}
@ -112,9 +112,15 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh, readBool(dict.lookup("master"))),
interRegionOption
(
name,
modelType,
dict,
mesh
),
nbrModelName_(coeffs_.lookup("nbrModelName")),
nbrModel_(NULL),
nbrModelName_(word::null),
firstIter_(true),
timeIndex_(-1),
htc_
@ -142,8 +148,6 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
{
if (active())
{
coeffs_.lookup("nbrModelName") >> nbrModelName_;
coeffs_.lookup("fieldNames") >> fieldNames_;
applied_.setSize(fieldNames_.size(), false);
@ -274,36 +278,4 @@ void Foam::fv::interRegionHeatTransferModel::addSup
}
void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
{
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
os.writeKeyword("nbrRegionName") << nbrRegionName_
<< token::END_STATEMENT << nl;
os.writeKeyword("nbrModelName") << nbrModelName_
<< token::END_STATEMENT << nl;
os.writeKeyword("master") << master_ << token::END_STATEMENT << nl;
os.writeKeyword("semiImplicit") << semiImplicit_ << token::END_STATEMENT
<< nl;
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
}
}
bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict)
{
if (option::read(dict))
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,10 +38,9 @@ Description
#ifndef interRegionHeatTransferModel_H
#define interRegionHeatTransferModel_H
#include "fvOption.H"
#include "interRegionOption.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -55,30 +54,24 @@ namespace fv
class interRegionHeatTransferModel
:
public option
public interRegionOption
{
protected:
private:
// Private data
//- Pointer to neighbour interRegionHeatTransferModel
interRegionHeatTransferModel* nbrModel_;
// Protected data
//- Name of the model in the neighbour mesh
word nbrModelName_;
//- Pointer to neighbour interRegionHeatTransferModel
interRegionHeatTransferModel* nbrModel_;
//- First iteration
bool firstIter_;
//- Time index - used for updating htc
label timeIndex_;
protected:
// Protected data
//- Heat transfer coefficient [W/m2/k] times area/volume [1/m]
volScalarField htc_;
@ -159,6 +152,12 @@ public:
// Access
//- Return const access to the neighbour region name
inline const word& nbrRegionName() const;
//- Return const access to the mapToMap pointer
inline const meshToMesh& meshInterp() const;
//- Return the heat transfer coefficient
inline const volScalarField& htc() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,9 +23,31 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::word&
Foam::fv::interRegionHeatTransferModel::nbrRegionName() const
{
return nbrRegionName_;
}
inline const Foam::meshToMesh&
Foam::fv::interRegionHeatTransferModel::meshInterp() const
{
if (!meshInterpPtr_.valid())
{
FatalErrorIn
(
"const meshToMesh& interRegionHeatTransferModel::meshInterp() const"
) << "Interpolation object not set"
<< abort(FatalError);
}
return meshInterpPtr_();
}
inline const Foam::volScalarField&
Foam::fv::interRegionHeatTransferModel::htc() const
{

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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 "interRegionHeatTransferModel.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
{
interRegionOption::writeData(os);
os.writeKeyword("nbrModelName") << nbrModelName_
<< token::END_STATEMENT << nl;
os.writeKeyword("semiImplicit") << semiImplicit_ << token::END_STATEMENT
<< nl;
}
bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict)
{
if (option::read(dict))
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -18,12 +18,13 @@ FoamFile
porosity1
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -18,12 +18,13 @@ FoamFile
porosity1
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -20,24 +20,28 @@ FoamFile
front
{
type wall;
inGroups 1(wall);
nFaces 700;
startFace 63400;
}
back
{
type wall;
inGroups 1(wall);
nFaces 700;
startFace 64100;
}
wall
walls
{
type wall;
inGroups 1(wall);
nFaces 1400;
startFace 64800;
}
porosityWall
{
type wall;
inGroups 1(wall);
nFaces 1600;
startFace 66200;
}

View File

@ -19,11 +19,12 @@ porosity1
{
type explicitPorositySource;
active yes;
selectionMode cellZone;
cellZone stator;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone stator;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -20,24 +20,28 @@ FoamFile
rotor
{
type wall;
inGroups 1(wall);
nFaces 192;
startFace 5952;
}
stator
{
type wall;
inGroups 1(wall);
nFaces 192;
startFace 6144;
}
front
{
type empty;
inGroups 1(empty);
nFaces 3072;
startFace 6336;
}
back
{
type empty;
inGroups 1(empty);
nFaces 3072;
startFace 9408;
}

View File

@ -18,12 +18,13 @@ FoamFile
porosity1
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -18,12 +18,13 @@ FoamFile
source1
{
type fixedTemperatureConstraint;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
fixedTemperatureConstraintCoeffs
{
selectionMode cellZone;
cellZone porosity;
mode uniform;
temperature 350;
}

View File

@ -8,7 +8,7 @@
FoamFile
{
version 2.0;
format ascii;
format binary;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;

View File

@ -18,12 +18,12 @@ FoamFile
fixedTemperaure1
{
type fixedTemperatureConstraint;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
fixedTemperatureConstraintCoeffs
{
selectionMode cellZone;
cellZone porosity;
mode uniform;
temperature 350;
}
@ -33,12 +33,12 @@ fixedTemperaure1
porosity1
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
type fixedCoeff;
active yes;
cellZone porosity;

View File

@ -18,14 +18,14 @@ FoamFile
airToporous
{
type constantHeatTransfer;
active on;
selectionMode mapRegion;
interpolationMethod cellVolumeWeight;
nbrRegionName porous;
master false;
active yes;
constantHeatTransferCoeffs
{
interpolationMethod cellVolumeWeight;
nbrRegionName porous;
master false;
nbrModelName porousToair;
fieldNames (h);
semiImplicit no;
@ -35,13 +35,13 @@ airToporous
porosityBlockage
{
type interRegionExplicitPorositySource;
active on;
selectionMode mapRegion;
interpolationMethod cellVolumeWeight;
nbrRegionName porous;
active yes;
interRegionExplicitPorositySourceCoeffs
{
interpolationMethod cellVolumeWeight;
nbrRegionName porous;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -18,18 +18,19 @@ FoamFile
porousToair
{
type constantHeatTransfer;
active on;
selectionMode mapRegion;
interpolationMethod cellVolumeWeight;
nbrRegionName air;
master true;
active yes;
constantHeatTransferCoeffs
{
interpolationMethod cellVolumeWeight;
nbrRegionName air;
master true;
nbrModelName airToporous;
fieldNames (h);
semiImplicit no;
}
}
// ************************************************************************* //

View File

@ -18,13 +18,14 @@ FoamFile
momentumSource
{
type pressureGradientExplicitSource;
active on; //on/off switch
selectionMode all; //cellSet // points //cellZone
active yes;
pressureGradientExplicitSourceCoeffs
{
fieldNames (U);
Ubar ( 0.1335 0 0 );
selectionMode all;
fieldNames (U);
Ubar (0.1335 0 0);
}
}

View File

@ -18,18 +18,19 @@ FoamFile
disk1
{
type actuationDiskSource;
active on; //on/off switch
selectionMode cellSet; //cellSet // points //cellZone
cellSet actuationDisk1;//cellSet name when selectionMode = cellSet
active on;
actuationDiskSourceCoeffs
{
fieldNames (U);
diskDir (1 0 0); // orientation of the disk
Cp 0.386; // Cp
Ct 0.58; // Ct
diskArea 40; // disk area
upstreamPoint (581849 4785810 1065);
fieldNames (U);
selectionMode cellSet;
cellSet actuationDisk1;
diskDir (1 0 0); // Orientation of the disk
Cp 0.386;
Ct 0.58;
diskArea 40;
upstreamPoint (581849 4785810 1065);
}
}
@ -37,18 +38,20 @@ disk2
{
type actuationDiskSource;
active on;
selectionMode cellSet;
cellSet actuationDisk2;
actuationDiskSourceCoeffs
{
fieldNames (U);
diskDir (1 0 0);
Cp 0.53;
Ct 0.58;
diskArea 40;
upstreamPoint (581753 4785663 1070);
fieldNames (U);
selectionMode cellSet;
cellSet actuationDisk2;
diskDir (1 0 0); // Orientation of the disk
Cp 0.53;
Ct 0.58;
diskArea 40;
upstreamPoint (581753 4785663 1070);
}
}
// ************************************************************************* //

View File

@ -18,14 +18,15 @@ FoamFile
source1
{
type fixedTemperatureConstraint;
active true;
timeStart 0.1;
duration 0.4;
selectionMode cellSet;
cellSet ignitionCells;
active yes;
fixedTemperatureConstraintCoeffs
{
timeStart 0.1;
duration 0.4;
selectionMode cellSet;
cellSet ignitionCells;
mode uniform;
temperature 2000;
}

View File

@ -18,12 +18,13 @@ FoamFile
filter1
{
type explicitPorositySource;
selectionMode cellZone;
cellZone filter;
active true;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone filter;
type DarcyForchheimer;
DarcyForchheimerCoeffs
@ -50,17 +51,18 @@ filter1
massSource1
{
type scalarSemiImplicitSource;
active true;
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
active yes;
scalarSemiImplicitSourceCoeffs
{
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
volumeMode absolute;
injectionRateSuSp
{
@ -74,17 +76,18 @@ massSource1
momentumSource1
{
type vectorSemiImplicitSource;
active true;
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
active yes;
vectorSemiImplicitSourceCoeffs
{
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
volumeMode absolute;
injectionRateSuSp
{
@ -97,17 +100,18 @@ momentumSource1
energySource1
{
type scalarSemiImplicitSource;
active true;
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
active yes;
scalarSemiImplicitSourceCoeffs
{
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
volumeMode absolute;
injectionRateSuSp
{

View File

@ -18,12 +18,13 @@ FoamFile
porosity1
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone porosity;
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porosity;
type DarcyForchheimer;
DarcyForchheimerCoeffs

View File

@ -22,13 +22,8 @@ boundaryField
{
outlet
{
type totalPressure;
p0 $internalField;
U U.air;
phi phi.air;
rho thermo:rho.air;
psi none;
gamma 1;
type prghPressure;
p $internalField;
value $internalField;
}

View File

@ -17,8 +17,7 @@ FoamFile
injector1
{
active true;
timeStart 0;
timeStart 0.1;
duration 5;
selectionMode points;
points
@ -32,10 +31,11 @@ options
massSource1
{
type scalarSemiImplicitSource;
$injector1;
scalarSemiImplicitSourceCoeffs
{
$injector1;
volumeMode absolute;
injectionRateSuSp
{
@ -47,10 +47,11 @@ options
momentumSource1
{
type vectorSemiImplicitSource;
$injector1;
vectorSemiImplicitSourceCoeffs
{
$injector1;
volumeMode absolute;
injectionRateSuSp
{
@ -62,10 +63,11 @@ options
energySource1
{
type scalarSemiImplicitSource;
$injector1;
scalarSemiImplicitSourceCoeffs
{
$injector1;
volumeMode absolute;
injectionRateSuSp
{