Commit 2f8e51ae authored by Henry's avatar Henry
Browse files

surfaceFilmModels: Replaced removeInjection with patchInjection

patchInjection accumulates mass exchanges on a per-patch basis which are
reported by injectionModelList
parent cd2aa39e
......@@ -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
......@@ -158,9 +158,7 @@ bool Foam::subModelBase::active() const
void Foam::subModelBase::cacheFields(const bool)
{
// do nothing
}
{}
bool Foam::subModelBase::outputTime() const
......@@ -171,8 +169,6 @@ bool Foam::subModelBase::outputTime() const
void Foam::subModelBase::write(Ostream& os) const
{
// not writing complete cloud dictionary, only coeffs
// os << dict_;
os << coeffDict_;
}
......
......@@ -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,8 +51,6 @@ namespace Foam
class subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise assignment
......@@ -181,6 +179,10 @@ public:
// Model properties
//- Retrieve generic property from the sub-model
template<class Type>
void getModelProperty(const word& entryName, Type& value) const;
//- Retrieve generic property from the sub-model
template<class Type>
Type getModelProperty
......@@ -189,10 +191,6 @@ public:
const Type& defaultValue = pTraits<Type>::zero
) const;
//- Retrieve generic property from the sub-model
template<class Type>
void getModelProperty(const word& entryName, Type& value) const;
//- Add generic property to the sub-model
template<class Type>
void setModelProperty(const word& entryName, const Type& value);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -80,52 +80,38 @@ void Foam::subModelBase::setBaseProperty
template<class Type>
Type Foam::subModelBase::getModelProperty
void Foam::subModelBase::getModelProperty
(
const word& entryName,
const Type& defaultValue
Type& value
) const
{
Type result = defaultValue;
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, result);
baseDict.subDict(modelName_).readIfPresent(entryName, value);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, result);
baseDict.subDict(modelType_).readIfPresent(entryName, value);
}
}
return result;
}
template<class Type>
void Foam::subModelBase::getModelProperty
Type Foam::subModelBase::getModelProperty
(
const word& entryName,
Type& value
const Type& defaultValue
) const
{
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, value);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, value);
}
}
Type result = defaultValue;
getModelProperty(entryName, result);
return result;
}
......
......@@ -20,7 +20,7 @@ $(KINEMATICMODELS)/injectionModel/injectionModel/injectionModel.C
$(KINEMATICMODELS)/injectionModel/injectionModel/injectionModelNew.C
$(KINEMATICMODELS)/injectionModel/injectionModelList/injectionModelList.C
$(KINEMATICMODELS)/injectionModel/drippingInjection/drippingInjection.C
$(KINEMATICMODELS)/injectionModel/removeInjection/removeInjection.C
$(KINEMATICMODELS)/injectionModel/patchInjection/patchInjection.C
$(KINEMATICMODELS)/injectionModel/curvatureSeparation/curvatureSeparation.C
$(KINEMATICMODELS)/filmThermoModel/filmThermoModel/filmThermoModel.C
......
......@@ -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
......@@ -58,8 +58,6 @@ class injectionModel
:
public filmSubModelBase
{
private:
// Private data
//- Injected mass
......@@ -106,6 +104,7 @@ public:
(owner, dict)
);
// Constructors
//- Construct null
......@@ -137,18 +136,21 @@ public:
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
) = 0;
//- Return the total mass injected
scalar injectedMassTotal() const;
//- Correct
virtual void correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
) = 0;
//- Return the total mass injected
virtual scalar injectedMassTotal() const;
//- Accumulate the total mass injected for the patches into the
// scalarField provided
virtual void patchInjectedMassTotals(scalarField& patchMasses) const
{}
};
......
......@@ -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
......@@ -118,44 +118,57 @@ void injectionModelList::correct
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
label patchi = patchIDs[i];
massInjected_[i] =
massInjected_[i] + sum(massToInject.boundaryField()[patchI]);
massInjected_[i] + sum(massToInject.boundaryField()[patchi]);
}
}
void injectionModelList::info(Ostream& os)
{
scalar injectedMass = 0.0;
const polyBoundaryMesh& pbm = owner().regionMesh().boundaryMesh();
scalar injectedMass = 0;
scalarField patchInjectedMasses(pbm.size(), 0);
forAll(*this, i)
{
const injectionModel& im = operator[](i);
injectedMass += im.injectedMassTotal();
im.patchInjectedMassTotals(patchInjectedMasses);
}
os << indent << "injected mass = " << injectedMass << nl;
scalarList mass0(massInjected_.size(), 0.0);
this->getModelProperty("massInjected", mass0);
forAll(pbm, patchi)
{
if (mag(patchInjectedMasses[patchi]) > VSMALL)
{
os << indent << indent << "from patch " << pbm[patchi].name()
<< " = " << patchInjectedMasses[patchi] << nl;
}
}
scalarList mass(massInjected_);
scalarField mass0(massInjected_.size(), 0.0);
this->getBaseProperty("massInjected", mass0);
scalarField mass(massInjected_);
Pstream::listCombineGather(mass, plusEqOp<scalar>());
mass = mass + mass0;
mass += mass0;
const polyBoundaryMesh& pbm = owner().regionMesh().boundaryMesh();
const labelList& patchIDs = owner().intCoupledPatchIDs();
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
Info<< indent << " - patch: " << pbm[patchI].name() << ": "
label patchi = patchIDs[i];
Info<< indent << " - patch: " << pbm[patchi].name() << ": "
<< mass[i] << endl;
}
if (owner().time().outputTime())
{
setModelProperty("massInjected", mass);
setBaseProperty("massInjected", mass);
massInjected_ = 0.0;
}
}
......
......@@ -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) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "removeInjection.H"
#include "patchInjection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -37,54 +37,63 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(removeInjection, 0);
addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary);
defineTypeNameAndDebug(patchInjection, 0);
addToRunTimeSelectionTable(injectionModel, patchInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
removeInjection::removeInjection
patchInjection::patchInjection
(
surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
deltaStable_(coeffDict_.lookupOrDefault<scalar>("deltaStable", 0.0)),
mask_(owner.regionMesh().nCells(), -1)
deltaStable_(coeffDict_.lookupOrDefault<scalar>("deltaStable", 0.0))
{
wordReList patches;
if (coeffDict_.readIfPresent("patches", patches))
const polyBoundaryMesh& pbm = owner.regionMesh().boundaryMesh();
patchIDs_.setSize(pbm.size());
if (coeffDict_.found("patches"))
{
wordReList patchNames(coeffDict_.lookup("patches"));
const labelHashSet patchSet = pbm.patchSet(patchNames);
Info<< " applying to patches:" << nl;
const polyBoundaryMesh& pbm = owner.regionMesh().boundaryMesh();
const labelHashSet patchSet = pbm.patchSet(patches);
label pidi = 0;
forAllConstIter(labelHashSet, patchSet, iter)
{
label patchI = iter.key();
const polyPatch& pp = pbm[patchI];
UIndirectList<scalar>(mask_, pp.faceCells()) = 1.0;
Info<< " " << pp.name() << endl;
label patchi = iter.key();
patchIDs_[pidi++] = patchi;
Info<< " " << pbm[patchi].name() << endl;
}
patchIDs_.setSize(pidi);
patchInjectedMasses_.setSize(pidi, 0);
}
else
{
Info<< " applying to all patches" << endl;
mask_ = 1.0;
forAll(patchIDs_, patchi)
{
patchIDs_[patchi] = patchi;
}
patchInjectedMasses_.setSize(pbm.size(), 0);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
removeInjection::~removeInjection()
patchInjection::~patchInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void removeInjection::correct
void patchInjection::correct
(
scalarField& availableMass,
scalarField& massToInject,
......@@ -95,20 +104,81 @@ void removeInjection::correct
const scalarField& rho = owner().rho();
const scalarField& magSf = owner().magSf();
forAll(delta, cellI)
const polyBoundaryMesh& pbm = owner().regionMesh().boundaryMesh();
forAll(patchIDs_, pidi)
{
if (mask_[cellI] > 0)
label patchi = patchIDs_[pidi];
const polyPatch& pp = pbm[patchi];
const labelList& faceCells = pp.faceCells();
// Accumulate the total mass removed from patch
scalar dMassPatch = 0;
forAll(faceCells, fci)
{
scalar ddelta = max(0.0, delta[cellI] - deltaStable_);
scalar dMass = ddelta*rho[cellI]*magSf[cellI];
massToInject[cellI] += dMass;
availableMass[cellI] -= dMass;
label celli = faceCells[fci];
addToInjectedMass(dMass);
scalar ddelta = max(0.0, delta[celli] - deltaStable_);
scalar dMass = ddelta*rho[celli]*magSf[celli];
massToInject[celli] += dMass;
availableMass[celli] -= dMass;
dMassPatch += dMass;
}
patchInjectedMasses_[pidi] += dMassPatch;
addToInjectedMass(dMassPatch);
}
injectionModel::correct();
if (outputTime())
{
scalarField patchInjectedMasses0
(
getModelProperty<scalarField>
(
"patchInjectedMasses",
scalarField(patchInjectedMasses_.size(), 0)
)
);
scalarField patchInjectedMassTotals(patchInjectedMasses_);
Pstream::listCombineGather(patchInjectedMassTotals, plusEqOp<scalar>());
patchInjectedMasses0 += patchInjectedMassTotals;
setModelProperty<scalarField>
(
"patchInjectedMasses",
patchInjectedMasses0
);
patchInjectedMasses_ = 0;
}
}
void patchInjection::patchInjectedMassTotals(scalarField& patchMasses) const
{
scalarField patchInjectedMasses
(
getModelProperty<scalarField>
(
"patchInjectedMasses",
scalarField(patchInjectedMasses_.size(), 0)
)
);
scalarField patchInjectedMassTotals(patchInjectedMasses_);
//combineReduce(patchInjectedMassTotals, plusEqOp<scalarField>());
Pstream::listCombineGather(patchInjectedMassTotals, plusEqOp<scalar>());
forAll(patchIDs_, pidi)
{
label patchi = patchIDs_[pidi];
patchMasses[patchi] +=
patchInjectedMasses[pidi] + patchInjectedMassTotals[pidi];
}
}
......
......@@ -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) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -22,18 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::removeInjection
Foam::patchInjection
Description
All mass available to be removed from the system is removed.
Remove and inject the mass in the film as it passes over the selected
patches.
SourceFiles
removeInjection.C
patchInjection.C
\*---------------------------------------------------------------------------*/
#ifndef removeInjection_H
#define removeInjection_H
#ifndef patchInjection_H
#define patchInjection_H
#include "injectionModel.H"
......@@ -47,22 +48,20 @@ namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class removeInjection Declaration
Class patchInjection Declaration
\*---------------------------------------------------------------------------*/
class removeInjection
class patchInjection
:
public injectionModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
removeInjection(const removeInjection&);
patchInjection(const patchInjection&);
//- Disallow default bitwise assignment
void operator=(const removeInjection&);
void operator=(const patchInjection&);
protected:
......@@ -71,37 +70,45 @@ protected:
// this threhold value
scalar deltaStable_;
//- Mask per cell to indicate whether mass can be removed
scalarField mask_;
//- List of patch IDs at which the film is removed
labelList patchIDs_;
//- Injected mass for each patch at which the film is removed
scalarField patchInjectedMasses_;
public:
//- Runtime type information
TypeName("removeInjection");
TypeName("patchInjection");
// Constructors
//- Construct from surface film model
removeInjection(surfaceFilmModel& owner, const dictionary& dict);
patchInjection(surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~removeInjection();
virtual ~patchInjection();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
);
//- Correct
virtual void correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
);
//- Accumulate the total mass injected for the patches into the