surfaceFilmModels: Replaced removeInjection with patchInjection

patchInjection accumulates mass exchanges on a per-patch basis which are
reported by injectionModelList
This commit is contained in:
Henry 2015-05-08 13:19:59 +01:00
parent e0b2369cc0
commit ae184d1f85
6 changed files with 263 additions and 171 deletions

View file

@ -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

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
@ -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;
//- Correct
virtual void correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
) = 0;
//- Return the total mass injected
virtual scalar injectedMassTotal() const;
//- Return the total mass injected
scalar injectedMassTotal() const;
//- Accumulate the total mass injected for the patches into the
// scalarField provided
virtual void patchInjectedMassTotals(scalarField& patchMasses) const
{}
};

View file

@ -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;
}
}

View file

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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 "patchInjection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(patchInjection, 0);
addToRunTimeSelectionTable(injectionModel, patchInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
patchInjection::patchInjection
(
surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
deltaStable_(coeffDict_.lookupOrDefault<scalar>("deltaStable", 0.0))
{
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;
label pidi = 0;
forAllConstIter(labelHashSet, patchSet, iter)
{
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;
forAll(patchIDs_, patchi)
{
patchIDs_[patchi] = patchi;
}
patchInjectedMasses_.setSize(pbm.size(), 0);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
patchInjection::~patchInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void patchInjection::correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
)
{
const scalarField& delta = owner().delta();
const scalarField& rho = owner().rho();
const scalarField& magSf = owner().magSf();
const polyBoundaryMesh& pbm = owner().regionMesh().boundaryMesh();
forAll(patchIDs_, pidi)
{
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)
{
label celli = faceCells[fci];
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];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

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) 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
// scalarField provided
virtual void patchInjectedMassTotals
(
scalarField& patchMasses
) const;
};

View file

@ -1,121 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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 "removeInjection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(removeInjection, 0);
addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
removeInjection::removeInjection
(
surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
deltaStable_(coeffDict_.lookupOrDefault<scalar>("deltaStable", 0.0)),
mask_(owner.regionMesh().nCells(), -1)
{
wordReList patches;
if (coeffDict_.readIfPresent("patches", patches))
{
Info<< " applying to patches:" << nl;
const polyBoundaryMesh& pbm = owner.regionMesh().boundaryMesh();
const labelHashSet patchSet = pbm.patchSet(patches);
forAllConstIter(labelHashSet, patchSet, iter)
{
label patchI = iter.key();
const polyPatch& pp = pbm[patchI];
UIndirectList<scalar>(mask_, pp.faceCells()) = 1.0;
Info<< " " << pp.name() << endl;
}
}
else
{
Info<< " applying to all patches" << endl;
mask_ = 1.0;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
removeInjection::~removeInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void removeInjection::correct
(
scalarField& availableMass,
scalarField& massToInject,
scalarField& diameterToInject
)
{
const scalarField& delta = owner().delta();
const scalarField& rho = owner().rho();
const scalarField& magSf = owner().magSf();
forAll(delta, cellI)
{
if (mask_[cellI] > 0)
{
scalar ddelta = max(0.0, delta[cellI] - deltaStable_);
scalar dMass = ddelta*rho[cellI]*magSf[cellI];
massToInject[cellI] += dMass;
availableMass[cellI] -= dMass;
addToInjectedMass(dMass);
}
}
injectionModel::correct();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //