Commit 8267f356 authored by sergio's avatar sergio
Browse files

ENH: Creation of fieldSources lib. Remove of fieldSources from

/src/finiteVolume/cfdTools/general
parent 2b320a54
basicSource/basicSource/basicSource.C
basicSource/basicSource/basicSourceIO.C
basicSource/basicSource/basicSourceList.C
basicSource/basicSource/IObasicSourceList.C
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
basicSource/explicitSource/explicitSource.C
basicSource/explicitSetValue/explicitSetValue.C
basicSource/rotorDiskSource/rotorDiskSource.C
basicSource/rotorDiskSource/bladeModel/bladeModel.C
basicSource/rotorDiskSource/profileModel/profileModel.C
basicSource/rotorDiskSource/profileModel/profileModelList.C
basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C
basicSource/rotorDiskSource/profileModel/series/seriesProfile.C
basicSource/actuationDiskSource/actuationDiskSource.C
basicSource/radialActuationDiskSource/radialActuationDiskSource.C
interRegion = basicSource/interRegionHeatTransferModel
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/variableHeatTransfer/variableHeatTransfer.C
LIB = $(FOAM_LIBBIN)/libfieldSources
\ No newline at end of file
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels
LIB_LIBS = \
-lfiniteVolume \
-lsampling \
-lmeshTools \
-lbasicSolidThermo \
-lcompressibleTurbulenceModel
......@@ -38,16 +38,17 @@ namespace Foam
template<> const char* NamedEnum
<
basicSource::selectionModeType,
4
5
>::names[] =
{
"points",
"cellSet",
"cellZone",
"mapRegion",
"all"
};
const NamedEnum<basicSource::selectionModeType, 4>
const NamedEnum<basicSource::selectionModeType, 5>
basicSource::selectionModeTypeNames_;
}
......@@ -73,6 +74,13 @@ void Foam::basicSource::setSelection(const dictionary& dict)
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smMapRegion:
{
dict_.lookup("secondarySourceName") >> secondarySourceName_;
dict_.lookup("mapRegionName") >> mapRegionName_;
master_ = readBool(dict_.lookup("master"));
break;
}
case smAll:
{
break;
......@@ -151,6 +159,47 @@ void Foam::basicSource::setCellSet()
break;
}
case smMapRegion:
{
if(active_)
{
Info<< indent << "- selecting inter region mapping" << endl;
const fvMesh& secondaryMesh =
mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const boundBox primaryBB = mesh_.bounds();
const boundBox secondaryBB = secondaryMesh.bounds();
if (secondaryBB.overlaps(primaryBB))
{
// Dummy patches
wordList cuttingPatches;
HashTable<word> patchMap;
secondaryToPrimaryInterpPtr_.reset
(
new meshToMesh
(
secondaryMesh,
mesh_,
patchMap,
cuttingPatches
)
);
}
else
{
FatalErrorIn
(
"Foam::basicSource::setCellSet()"
) << "regions dont overlap "
<< secondaryMesh.name()
<< " in region " << mesh_.name()
<< nl
<< exit(FatalError);
}
}
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
......@@ -169,16 +218,19 @@ void Foam::basicSource::setCellSet()
}
// Set volume information
V_ = 0.0;
forAll(cells_, i)
if(selectionMode_ != smMapRegion)
{
V_ += mesh_.V()[cells_[i]];
}
reduce(V_, sumOp<scalar>());
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 << decrIndent << endl;
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
}
}
......@@ -205,6 +257,11 @@ Foam::basicSource::basicSource
),
cellSetName_("none"),
V_(0.0),
secondaryToPrimaryInterpPtr_(),
secondarySourceName_("none"),
mapRegionName_("none"),
master_(false),
fieldNames_(),
applied_()
{
......@@ -246,6 +303,13 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
return autoPtr<basicSource>(cstrIter()(name, modelType, coeffs, mesh));
}
Foam::basicSource::~basicSource()
{
if (!secondaryToPrimaryInterpPtr_.empty())
{
secondaryToPrimaryInterpPtr_.clear();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -32,6 +32,7 @@ Description
timeStart 0.0; // start time
duration 1000.0; // duration
selectionMode cellSet; // cellSet // points //cellZone
// mapRegion
On evaluation, source expects to be added to the rhs of the equation
......@@ -48,6 +49,8 @@ SourceFiles
#include "fvMatricesFwd.H"
#include "cellSet.H"
#include "autoPtr.H"
#include "meshToMesh.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -57,6 +60,7 @@ namespace Foam
class fvMesh;
/*---------------------------------------------------------------------------*\
Class basicSource Declaration
\*---------------------------------------------------------------------------*/
......@@ -73,11 +77,13 @@ public:
smPoints,
smCellSet,
smCellZone,
smMapRegion,
smAll
};
//- Word list of selection mode type names
static const NamedEnum<selectionModeType, 4> selectionModeTypeNames_;
static const NamedEnum<selectionModeType, 5>
selectionModeTypeNames_;
protected:
......@@ -120,6 +126,21 @@ protected:
//- Sum of cell volumes
scalar V_;
// Data for smMapRegion only
//- Mesh to mesh mapping for map optiom
autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_;
//- Name of the source in the secondary mesh
word secondarySourceName_;
//- Name of the region to map
word mapRegionName_;
//- Master or slave region
bool master_;
//- Field names to apply source to - populated by derived models
wordList fieldNames_;
......@@ -227,8 +248,8 @@ public:
//- Destructor
virtual ~basicSource()
{}
virtual ~basicSource();
// Member Functions
......@@ -266,6 +287,15 @@ public:
//- Return const access to the total cell volume
inline scalar V() const;
//- Return const access to the secondarySourceName
inline const word secondarySourceName() const;
//- Return const access to the mapToMap Ptr
inline const autoPtr<meshToMesh> secondaryToPrimaryInterpPtr() const;
//- Return const referenc to the mapRegion
inline const word mapRegionName() const;
//- Return const access to the cell set
inline const labelList& cells() const;
......
......@@ -118,4 +118,21 @@ inline Foam::scalar& Foam::basicSource::duration()
}
inline const Foam::word Foam::basicSource::secondarySourceName() const
{
return secondarySourceName_;
}
inline const Foam::autoPtr<Foam::meshToMesh> Foam::basicSource::
secondaryToPrimaryInterpPtr() const
{
return secondaryToPrimaryInterpPtr_;
}
inline const Foam::word Foam::basicSource::mapRegionName() const
{
return mapRegionName_;
}
// ************************************************************************* //
......@@ -72,6 +72,10 @@ void Foam::basicSource::writeData(Ostream& os) const
{
break;
}
case smMapRegion:
{
break;
}
default:
{
FatalErrorIn("basicSource::writeData(Ostream&) const")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment