mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "point.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "pointHit.H"
|
||||
#include "cachedRandom.H"
|
||||
#include "Random.H"
|
||||
#include "FixedList.H"
|
||||
#include "UList.H"
|
||||
@ -164,6 +165,10 @@ public:
|
||||
// uniform distribution
|
||||
inline Point randomPoint(Random& rndGen) const;
|
||||
|
||||
//- Return a random point in the tetrahedron from a
|
||||
// uniform distribution
|
||||
inline Point randomPoint(cachedRandom& rndGen) const;
|
||||
|
||||
//- Calculate the barycentric coordinates of the given
|
||||
// point, in the same order as a, b, c, d. Returns the
|
||||
// determinant of the solution.
|
||||
|
||||
@ -240,6 +240,42 @@ inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
|
||||
(
|
||||
cachedRandom& rndGen
|
||||
) const
|
||||
{
|
||||
// Adapted from
|
||||
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
|
||||
|
||||
scalar s = rndGen.sample01<scalar>();
|
||||
scalar t = rndGen.sample01<scalar>();
|
||||
scalar u = rndGen.sample01<scalar>();
|
||||
|
||||
if (s + t > 1.0)
|
||||
{
|
||||
s = 1.0 - s;
|
||||
t = 1.0 - t;
|
||||
}
|
||||
|
||||
if (t + u > 1.0)
|
||||
{
|
||||
scalar tmp = u;
|
||||
u = 1.0 - s - t;
|
||||
t = 1.0 - tmp;
|
||||
}
|
||||
else if (s + t + u > 1.0)
|
||||
{
|
||||
scalar tmp = u;
|
||||
u = s + t + u - 1.0;
|
||||
s = 1.0 - t - tmp;
|
||||
}
|
||||
|
||||
return (1 - s - t - u)*a_ + s*b_ + t*c_ + u*d_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
Foam::scalar Foam::tetrahedron<Point, PointRef>::barycentric
|
||||
(
|
||||
|
||||
@ -109,12 +109,9 @@ void Foam::directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
|
||||
// Get the coupling information from the directMappedPatchBase
|
||||
const directMappedPatchBase& mpp =
|
||||
refCast<const directMappedPatchBase>(this->patch().patch());
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
const fvPatch& nbrPatch =
|
||||
refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
).boundary()[mpp.samplePolyPatch().index()];
|
||||
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
||||
const label samplePatchI = mpp.samplePolyPatch().index();
|
||||
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
@ -127,7 +124,7 @@ void Foam::directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
|
||||
);
|
||||
|
||||
// Retrieve the neighbour patch internal field
|
||||
Field<Type> nbrIntFld = nbrField.patchInternalField();
|
||||
Field<Type> nbrIntFld(nbrField.patchInternalField());
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
|
||||
@ -281,7 +281,7 @@ bool Foam::parcel::move(trackingData& td, const scalar trackTime)
|
||||
sDB.shs()[cellI] += oTotMass*(oH + oPE) - m()*(nH + nPE);
|
||||
|
||||
// Remove evaporated mass from stripped mass
|
||||
ms() -= ms()*(oTotMass-m())/oTotMass;
|
||||
ms() -= ms()*(oTotMass - m())/oTotMass;
|
||||
|
||||
// remove parcel if it is 'small'
|
||||
if (m() < 1.0e-12)
|
||||
|
||||
@ -48,6 +48,7 @@ $(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.
|
||||
$(RADIATION)/scatter/cloudScatter/cloudScatter.C
|
||||
|
||||
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
|
||||
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.C
|
||||
|
||||
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
|
||||
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C
|
||||
|
||||
@ -66,9 +66,15 @@ public:
|
||||
|
||||
// Public typedefs
|
||||
|
||||
//- Redefine particle type as parcel type
|
||||
//- Type of cloud this cloud was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
|
||||
//- Convenience typedef for this cloud type
|
||||
typedef CollidingCloud<CloudType> collidingCloudType;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -116,8 +122,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef CloudType cloudType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
|
||||
@ -99,9 +99,15 @@ public:
|
||||
|
||||
// Public typedefs
|
||||
|
||||
//- Redefine particle type as parcel type
|
||||
//- Type of cloud this cloud was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
|
||||
//- Convenience typedef for this cloud type
|
||||
typedef KinematicCloud<CloudType> kinematicCloudType;
|
||||
|
||||
//- Force type
|
||||
typedef ParticleForceList<KinematicCloud<CloudType> > forceType;
|
||||
|
||||
@ -244,8 +250,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef CloudType cloudType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
|
||||
@ -127,17 +127,19 @@ void Foam::cloudSolution::read()
|
||||
schemes_.setSize(vars.size());
|
||||
forAll(vars, i)
|
||||
{
|
||||
// read solution variable name
|
||||
schemes_[i].first() = vars[i];
|
||||
|
||||
// set semi-implicit (1) explicit (0) flag
|
||||
Istream& is = schemesDict.lookup(vars[i]);
|
||||
const word scheme(is);
|
||||
if (scheme == "semiImplicit")
|
||||
{
|
||||
is >> schemes_[i].second();
|
||||
schemes_[i].second().first() = true;
|
||||
}
|
||||
else if (scheme == "explicit")
|
||||
{
|
||||
schemes_[i].second() = -1;
|
||||
schemes_[i].second().first() = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -145,6 +147,9 @@ void Foam::cloudSolution::read()
|
||||
<< "Invalid scheme " << scheme << ". Valid schemes are "
|
||||
<< "explicit and semiImplicit" << exit(FatalError);
|
||||
}
|
||||
|
||||
// read under-relaxation factor
|
||||
is >> schemes_[i].second().second();
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +160,7 @@ Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
|
||||
{
|
||||
if (fieldName == schemes_[i].first())
|
||||
{
|
||||
return schemes_[i].second();
|
||||
return schemes_[i].second().second();
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +178,7 @@ bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
|
||||
{
|
||||
if (fieldName == schemes_[i].first())
|
||||
{
|
||||
return schemes_[i].second() >= 0;
|
||||
return schemes_[i].second().first();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::cloudSolution
|
||||
|
||||
Description
|
||||
- Stores all relevant solution info
|
||||
Stores all relevant solution info for cloud
|
||||
|
||||
SourceFiles
|
||||
cloudSolutionI.H
|
||||
@ -100,7 +100,7 @@ class cloudSolution
|
||||
Switch resetSourcesOnStartup_;
|
||||
|
||||
//- List schemes, e.g. U semiImplicit 1
|
||||
List<Tuple2<word, scalar> > schemes_;
|
||||
List<Tuple2<word, Tuple2<bool, scalar> > > schemes_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -67,8 +67,16 @@ class ReactingCloud
|
||||
{
|
||||
public:
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
// Public typedefs
|
||||
|
||||
//- Type of cloud this cloud was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
|
||||
//- Convenience typedef for this cloud type
|
||||
typedef ReactingCloud<CloudType> reactingCloudType;
|
||||
|
||||
|
||||
private:
|
||||
@ -146,8 +154,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef CloudType cloudType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
|
||||
@ -69,8 +69,16 @@ class ReactingMultiphaseCloud
|
||||
{
|
||||
public:
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
// Public typedefs
|
||||
|
||||
//- Type of cloud this cloud was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
|
||||
//- Convenience typedef for this cloud type
|
||||
typedef ReactingMultiphaseCloud<CloudType> reactingMultiphaseCloudType;
|
||||
|
||||
|
||||
private:
|
||||
@ -141,8 +149,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef CloudType cloudType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
|
||||
@ -65,8 +65,17 @@ class ThermoCloud
|
||||
{
|
||||
public:
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
// Public typedefs
|
||||
|
||||
//- Type of cloud this cloud was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef typename CloudType::particleType parcelType;
|
||||
|
||||
//- Convenience typedef for this cloud type
|
||||
typedef ThermoCloud<CloudType> thermoCloudType;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -149,8 +158,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef CloudType cloudType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
|
||||
@ -143,7 +143,7 @@ Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
|
||||
|
||||
return
|
||||
hsTrans()/Vdt
|
||||
- fvm::Sp(hsCoeff()/(Cp*Vdt), hs)
|
||||
- fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
|
||||
+ hsCoeff()/(Cp*Vdt)*hs;
|
||||
}
|
||||
else
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CellZoneInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
#include "FieldActivatedInjection.H"
|
||||
#include "InflationInjection.H"
|
||||
@ -43,6 +44,7 @@ License
|
||||
\
|
||||
makeInjectionModel(CloudType); \
|
||||
\
|
||||
makeInjectionModelType(CellZoneInjection, CloudType); \
|
||||
makeInjectionModelType(ConeInjection, CloudType); \
|
||||
makeInjectionModelType(FieldActivatedInjection, CloudType); \
|
||||
makeInjectionModelType(InflationInjection, CloudType); \
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CellZoneInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
#include "FieldActivatedInjection.H"
|
||||
#include "ManualInjection.H"
|
||||
@ -40,6 +41,7 @@ License
|
||||
#define makeReactingMultiphaseParcelInjectionModels(CloudType) \
|
||||
\
|
||||
makeInjectionModel(CloudType); \
|
||||
makeInjectionModelType(CellZoneInjection, CloudType); \
|
||||
makeInjectionModelType(ConeInjection, CloudType); \
|
||||
makeInjectionModelType(FieldActivatedInjection, CloudType); \
|
||||
makeInjectionModelType(ManualInjection, CloudType); \
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CellZoneInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
#include "FieldActivatedInjection.H"
|
||||
#include "ManualInjection.H"
|
||||
@ -40,6 +41,7 @@ License
|
||||
#define makeReactingParcelInjectionModels(CloudType) \
|
||||
\
|
||||
makeInjectionModel(CloudType); \
|
||||
makeInjectionModelType(CellZoneInjection, CloudType); \
|
||||
makeInjectionModelType(ConeInjection, CloudType); \
|
||||
makeInjectionModelType(FieldActivatedInjection, CloudType); \
|
||||
makeInjectionModelType(ManualInjection, CloudType); \
|
||||
|
||||
@ -0,0 +1,369 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ 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 "CellZoneInjection.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "polyMeshTetDecomposition.H"
|
||||
#include "globalIndex.H"
|
||||
#include "Pstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::CellZoneInjection<CloudType>::setPositions
|
||||
(
|
||||
const labelList& cellZoneCells
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = this->owner().mesh();
|
||||
const scalarField& V = mesh.V();
|
||||
const label nCells = cellZoneCells.size();
|
||||
cachedRandom& rnd = this->owner().rndGen();
|
||||
|
||||
DynamicList<vector> positions(nCells); // initial size only
|
||||
DynamicList<label> injectorCells(nCells); // initial size only
|
||||
DynamicList<label> injectorTetFaces(nCells); // initial size only
|
||||
DynamicList<label> injectorTetPts(nCells); // initial size only
|
||||
|
||||
scalar newParticlesTotal = 0.0;
|
||||
label addParticlesTotal = 0;
|
||||
|
||||
forAll(cellZoneCells, i)
|
||||
{
|
||||
const label cellI = cellZoneCells[i];
|
||||
|
||||
// Calc number of particles to add
|
||||
const scalar newParticles = V[cellI]*numberDensity_;
|
||||
newParticlesTotal += newParticles;
|
||||
label addParticles = floor(newParticles);
|
||||
addParticlesTotal += addParticles;
|
||||
|
||||
const scalar diff = newParticlesTotal - addParticlesTotal;
|
||||
if (diff > 1)
|
||||
{
|
||||
label corr = floor(diff);
|
||||
addParticles += corr;
|
||||
addParticlesTotal += corr;
|
||||
}
|
||||
|
||||
// Construct cell tet indices
|
||||
const List<tetIndices> cellTetIs =
|
||||
polyMeshTetDecomposition::cellTetIndices(mesh, cellI);
|
||||
|
||||
// Construct cell tet volume fractions
|
||||
scalarList cTetVFrac(cellTetIs.size(), 0.0);
|
||||
for (label tetI = 1; tetI < cellTetIs.size() - 1; tetI++)
|
||||
{
|
||||
cTetVFrac[tetI] =
|
||||
(cTetVFrac[tetI-1] + cellTetIs[tetI].tet(mesh).mag())/V[cellI];
|
||||
}
|
||||
cTetVFrac.last() = 1.0;
|
||||
|
||||
// Set new particle position and cellId
|
||||
for (label pI = 0; pI < addParticles; pI++)
|
||||
{
|
||||
const scalar volFrac = rnd.sample01<scalar>();
|
||||
label tetI = 0;
|
||||
forAll(cTetVFrac, vfI)
|
||||
{
|
||||
if (cTetVFrac[vfI] > volFrac)
|
||||
{
|
||||
tetI = vfI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
positions.append(cellTetIs[tetI].tet(mesh).randomPoint(rnd));
|
||||
|
||||
injectorCells.append(cellI);
|
||||
injectorTetFaces.append(cellTetIs[tetI].face());
|
||||
injectorTetPts.append(cellTetIs[tetI].faceBasePt());
|
||||
}
|
||||
}
|
||||
|
||||
// Parallel operation manipulations
|
||||
globalIndex globalPositions(positions.size());
|
||||
List<vector> allPositions(globalPositions.size(), point::max);
|
||||
List<label> allInjectorCells(globalPositions.size(), -1);
|
||||
List<label> allInjectorTetFaces(globalPositions.size(), -1);
|
||||
List<label> allInjectorTetPts(globalPositions.size(), -1);
|
||||
|
||||
// Gather all positions on to all processors
|
||||
SubList<vector>
|
||||
(
|
||||
allPositions,
|
||||
globalPositions.localSize(Pstream::myProcNo()),
|
||||
globalPositions.offset(Pstream::myProcNo())
|
||||
).assign(positions);
|
||||
|
||||
Pstream::listCombineGather(allPositions, minEqOp<point>());
|
||||
Pstream::listCombineScatter(allPositions);
|
||||
|
||||
// Gather local cell tet and tet-point Ids, but leave non-local ids set -1
|
||||
SubList<label>
|
||||
(
|
||||
allInjectorCells,
|
||||
globalPositions.localSize(Pstream::myProcNo()),
|
||||
globalPositions.offset(Pstream::myProcNo())
|
||||
).assign(injectorCells);
|
||||
SubList<label>
|
||||
(
|
||||
allInjectorTetFaces,
|
||||
globalPositions.localSize(Pstream::myProcNo()),
|
||||
globalPositions.offset(Pstream::myProcNo())
|
||||
).assign(injectorTetFaces);
|
||||
SubList<label>
|
||||
(
|
||||
allInjectorTetPts,
|
||||
globalPositions.localSize(Pstream::myProcNo()),
|
||||
globalPositions.offset(Pstream::myProcNo())
|
||||
).assign(injectorTetPts);
|
||||
|
||||
// Transfer data
|
||||
positions_.transfer(allPositions);
|
||||
injectorCells_.transfer(allInjectorCells);
|
||||
injectorTetFaces_.transfer(allInjectorTetFaces);
|
||||
injectorTetPts_.transfer(allInjectorTetPts);
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
OFstream points("points.obj");
|
||||
forAll(positions_, i)
|
||||
{
|
||||
meshTools::writeOBJ(points, positions_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::CellZoneInjection<CloudType>::parcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
)
|
||||
{
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return positions_.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::CellZoneInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
)
|
||||
{
|
||||
// All parcels introduced at SOI
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return this->volumeTotal_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::CellZoneInjection<CloudType>::CellZoneInjection
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
cellZoneName_(this->coeffDict().lookup("cellZone")),
|
||||
numberDensity_(readScalar(this->coeffDict().lookup("numberDensity"))),
|
||||
positions_(),
|
||||
injectorCells_(),
|
||||
injectorTetFaces_(),
|
||||
injectorTetPts_(),
|
||||
diameters_(),
|
||||
U0_(this->coeffDict().lookup("U0")),
|
||||
sizeDistribution_
|
||||
(
|
||||
distributionModels::distributionModel::New
|
||||
(
|
||||
this->coeffDict().subDict("sizeDistribution"), owner.rndGen()
|
||||
)
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = owner.mesh();
|
||||
const label zoneI = mesh.cellZones().findZoneID(cellZoneName_);
|
||||
|
||||
if (zoneI < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"CloudType&"
|
||||
")"
|
||||
) << "Unknown cell zone name: " << cellZoneName_
|
||||
<< ". Valid cell zones are: " << mesh.cellZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const labelList& cellZoneCells = mesh.cellZones()[zoneI];
|
||||
const label nCells = cellZoneCells.size();
|
||||
const scalar nCellsTotal = returnReduce(nCells, sumOp<label>());
|
||||
const scalar VCells = sum(scalarField(mesh.V(), cellZoneCells));
|
||||
const scalar VCellsTotal = returnReduce(VCells, sumOp<scalar>());
|
||||
Info<< " cell zone size = " << nCellsTotal << endl;
|
||||
Info<< " cell zone volume = " << VCellsTotal << endl;
|
||||
|
||||
if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"CloudType&"
|
||||
")"
|
||||
) << "Number of particles to be added to cellZone " << cellZoneName_
|
||||
<< " is zero" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPositions(cellZoneCells);
|
||||
|
||||
Info<< " number density = " << numberDensity_ << nl
|
||||
<< " number of particles = " << positions_.size() << endl;
|
||||
|
||||
// Construct parcel diameters
|
||||
diameters_.setSize(positions_.size());
|
||||
forAll(diameters_, i)
|
||||
{
|
||||
diameters_[i] = sizeDistribution_->sample();
|
||||
}
|
||||
}
|
||||
|
||||
// Determine volume of particles to inject
|
||||
this->volumeTotal_ = sum(pow3(diameters_))*constant::mathematical::pi/6.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::CellZoneInjection<CloudType>::CellZoneInjection
|
||||
(
|
||||
const CellZoneInjection<CloudType>& im
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(im),
|
||||
cellZoneName_(im.cellZoneName_),
|
||||
numberDensity_(im.numberDensity_),
|
||||
positions_(im.positions_),
|
||||
injectorCells_(im.injectorCells_),
|
||||
injectorTetFaces_(im.injectorTetFaces_),
|
||||
injectorTetPts_(im.injectorTetPts_),
|
||||
diameters_(im.diameters_),
|
||||
U0_(im.U0_),
|
||||
sizeDistribution_(im.sizeDistribution_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::CellZoneInjection<CloudType>::~CellZoneInjection()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::CellZoneInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
// Not used
|
||||
return this->SOI_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::CellZoneInjection<CloudType>::setPositionAndCell
|
||||
(
|
||||
const label parcelI,
|
||||
const label nParcels,
|
||||
const scalar time,
|
||||
vector& position,
|
||||
label& cellOwner,
|
||||
label& tetFaceI,
|
||||
label& tetPtI
|
||||
)
|
||||
{
|
||||
position = positions_[parcelI];
|
||||
cellOwner = injectorCells_[parcelI];
|
||||
tetFaceI = injectorTetFaces_[parcelI];
|
||||
tetPtI = injectorTetPts_[parcelI];
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::CellZoneInjection<CloudType>::setProperties
|
||||
(
|
||||
const label parcelI,
|
||||
const label,
|
||||
const scalar,
|
||||
typename CloudType::parcelType& parcel
|
||||
)
|
||||
{
|
||||
// set particle velocity
|
||||
parcel.U() = U0_;
|
||||
|
||||
// set particle diameter
|
||||
parcel.d() = diameters_[parcelI];
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::CellZoneInjection<CloudType>::fullyDescribed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::CellZoneInjection<CloudType>::validInjection(const label)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,197 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ 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::CellZoneInjection
|
||||
|
||||
Description
|
||||
Injection positions specified by a particle number density within a cell set
|
||||
|
||||
- User specifies
|
||||
- Number density of particles in cell set (effective)
|
||||
- Total mass to inject
|
||||
- Initial parcel velocity
|
||||
- Parcel diameters obtained by PDF model
|
||||
- All parcels introduced at SOI
|
||||
|
||||
SourceFiles
|
||||
CellZoneInjection.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CellZoneInjection_H
|
||||
#define CellZoneInjection_H
|
||||
|
||||
#include "InjectionModel.H"
|
||||
#include "distributionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CellZoneInjection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class CellZoneInjection
|
||||
:
|
||||
public InjectionModel<CloudType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of cell zone
|
||||
const word& cellZoneName_;
|
||||
|
||||
//- Number density
|
||||
const scalar numberDensity_;
|
||||
|
||||
//- Field of parcel positions
|
||||
List<vector> positions_;
|
||||
|
||||
//- List of cell labels corresponding to injector positions
|
||||
labelList injectorCells_;
|
||||
|
||||
//- List of tetFace labels corresponding to injector positions
|
||||
labelList injectorTetFaces_;
|
||||
|
||||
//- List of tetPt labels corresponding to injector positions
|
||||
labelList injectorTetPts_;
|
||||
|
||||
//- Field of parcel diameters
|
||||
scalarList diameters_;
|
||||
|
||||
//- Initial parcel velocity
|
||||
const vector U0_;
|
||||
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Set the parcel injection positions
|
||||
void setPositions(const labelList& cellZoneCells);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step relative to SOI
|
||||
label parcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
);
|
||||
|
||||
//- Volume of parcels to introduce over the time step relative to SOI
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cellZoneInjection");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
CellZoneInjection(const dictionary& dict, CloudType& owner);
|
||||
|
||||
//- Construct copy
|
||||
CellZoneInjection(const CellZoneInjection<CloudType>& im);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<InjectionModel<CloudType> > clone() const
|
||||
{
|
||||
return autoPtr<InjectionModel<CloudType> >
|
||||
(
|
||||
new CellZoneInjection<CloudType>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~CellZoneInjection();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
|
||||
// Injection geometry
|
||||
|
||||
//- Set the injection position and owner cell, tetFace and tetPt
|
||||
virtual void setPositionAndCell
|
||||
(
|
||||
const label parcelI,
|
||||
const label nParcels,
|
||||
const scalar time,
|
||||
vector& position,
|
||||
label& cellOwner,
|
||||
label& tetFaceI,
|
||||
label& tetPtI
|
||||
);
|
||||
|
||||
//- Set the parcel properties
|
||||
virtual void setProperties
|
||||
(
|
||||
const label parcelI,
|
||||
const label nParcels,
|
||||
const scalar time,
|
||||
typename CloudType::parcelType& parcel
|
||||
);
|
||||
|
||||
//- Flag to identify whether model fully describes the parcel
|
||||
virtual bool fullyDescribed() const;
|
||||
|
||||
//- Return flag to identify whether or not injection of parcelI is
|
||||
// permitted
|
||||
virtual bool validInjection(const label parcelI);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CellZoneInjection.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -32,7 +32,7 @@ Description
|
||||
- number of parcels to inject per injector
|
||||
- parcel velocities
|
||||
- inner and outer cone angles
|
||||
- Parcel diameters obtained by distribution model model
|
||||
- Parcel diameters obtained by distribution model
|
||||
|
||||
SourceFiles
|
||||
ConeInjection.C
|
||||
@ -97,7 +97,7 @@ class ConeInjection
|
||||
//- Outer cone angle relative to SOI [deg]
|
||||
const autoPtr<DataEntry<scalar> > thetaOuter_;
|
||||
|
||||
//- Parcel size distribution model model
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||
|
||||
//- Number of parcels per injector already injected
|
||||
|
||||
@ -110,7 +110,7 @@ class FieldActivatedInjection
|
||||
//- List of parcel diameters
|
||||
scalarList diameters_;
|
||||
|
||||
//- Parcel size distribution model model
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel>
|
||||
sizeDistribution_;
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ class InflationInjection
|
||||
//- Diameter with which to create new seed particles
|
||||
scalar dSeed_;
|
||||
|
||||
//- Parcel size distribution model model
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ Description
|
||||
- Total mass to inject
|
||||
- Parcel positions in file \c positionsFile
|
||||
- Initial parcel velocity
|
||||
- Parcel diameters obtained by distribution model model
|
||||
- Parcel diameters obtained by distribution model
|
||||
- All parcels introduced at SOI
|
||||
|
||||
SourceFiles
|
||||
@ -81,7 +81,7 @@ class ManualInjection
|
||||
//- Initial parcel velocity
|
||||
const vector U0_;
|
||||
|
||||
//- Parcel size distribution model model
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ Description
|
||||
- Injection duration
|
||||
- Initial parcel velocity
|
||||
- Injection volume flow rate
|
||||
- Parcel diameters obtained by distribution model model
|
||||
- Parcel diameters obtained by distribution model
|
||||
- Parcels injected at cell centres adjacent to patch
|
||||
|
||||
SourceFiles
|
||||
@ -84,7 +84,7 @@ class PatchInjection
|
||||
//- Flow rate profile relative to SOI []
|
||||
const autoPtr<DataEntry<scalar> > flowRateProfile_;
|
||||
|
||||
//- Parcel size distribution model model
|
||||
//- Parcel size distribution model
|
||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||
|
||||
//- List of cell labels corresponding to injector positions
|
||||
|
||||
@ -33,9 +33,9 @@ Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
|
||||
const label globalPatchI
|
||||
) const
|
||||
{
|
||||
forAll(patchIds_, patchI)
|
||||
forAll(patchIDs_, patchI)
|
||||
{
|
||||
if (patchIds_[patchI] == globalPatchI)
|
||||
if (patchIDs_[patchI] == globalPatchI)
|
||||
{
|
||||
return patchI;
|
||||
}
|
||||
@ -130,8 +130,8 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
)
|
||||
:
|
||||
PatchInteractionModel<CloudType>(dict, cloud, typeName),
|
||||
patchData_(this->coeffDict().lookup("patches")),
|
||||
patchIds_(patchData_.size()),
|
||||
patchData_(cloud.mesh(), this->coeffDict().lookup("patches")),
|
||||
patchIDs_(patchData_.size()),
|
||||
nEscape0_(patchData_.size(), 0),
|
||||
massEscape0_(patchData_.size(), 0.0),
|
||||
nStick0_(patchData_.size(), 0),
|
||||
@ -141,44 +141,6 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
nStick_(patchData_.size(), 0),
|
||||
massStick_(patchData_.size(), 0.0)
|
||||
{
|
||||
const polyMesh& mesh = cloud.mesh();
|
||||
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
|
||||
|
||||
// check that user patches are valid region patches
|
||||
forAll(patchData_, patchI)
|
||||
{
|
||||
const word& patchName = patchData_[patchI].patchName();
|
||||
patchIds_[patchI] = bMesh.findPatchID(patchName);
|
||||
if (patchIds_[patchI] < 0)
|
||||
{
|
||||
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
|
||||
<< "Patch " << patchName << " not found. Available patches "
|
||||
<< "are: " << bMesh.names() << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// check that all walls are specified
|
||||
DynamicList<word> badWalls;
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<wallPolyPatch>(bMesh[patchI])
|
||||
&& applyToPatch(bMesh[patchI].index()) < 0
|
||||
)
|
||||
{
|
||||
badWalls.append(bMesh[patchI].name());
|
||||
}
|
||||
}
|
||||
|
||||
if (badWalls.size() > 0)
|
||||
{
|
||||
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
|
||||
<< "All wall patches must be specified when employing local patch "
|
||||
<< "interaction. Please specify data for patches:" << nl
|
||||
<< badWalls << nl << exit(FatalError);
|
||||
}
|
||||
|
||||
// check that interactions are valid/specified
|
||||
forAll(patchData_, patchI)
|
||||
{
|
||||
@ -211,7 +173,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
:
|
||||
PatchInteractionModel<CloudType>(pim),
|
||||
patchData_(pim.patchData_),
|
||||
patchIds_(pim.patchIds_),
|
||||
patchIDs_(pim.patchIDs_),
|
||||
nEscape0_(pim.nEscape0_),
|
||||
massEscape0_(pim.massEscape0_),
|
||||
nStick0_(pim.nStick0_),
|
||||
|
||||
@ -33,7 +33,7 @@ Description
|
||||
#define LocalInteraction_H
|
||||
|
||||
#include "PatchInteractionModel.H"
|
||||
#include "patchInteractionData.H"
|
||||
#include "patchInteractionDataList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,10 +51,10 @@ class LocalInteraction
|
||||
// Private data
|
||||
|
||||
//- List of participating patches
|
||||
const List<patchInteractionData> patchData_;
|
||||
const patchInteractionDataList patchData_;
|
||||
|
||||
//- List of participating patch ids
|
||||
List<label> patchIds_;
|
||||
List<label> patchIDs_;
|
||||
|
||||
|
||||
// Counters for initial particle fates
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ 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 "patchInteractionDataList.H"
|
||||
#include "stringListOps.H"
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::patchInteractionDataList::patchInteractionDataList()
|
||||
:
|
||||
List<patchInteractionData>(),
|
||||
patchGroupIDs_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::patchInteractionDataList::patchInteractionDataList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
List<patchInteractionData>(dict.lookup("patches")),
|
||||
patchGroupIDs_(this->size())
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
|
||||
const wordList allPatchNames = bMesh.names();
|
||||
|
||||
const List<patchInteractionData>& items = *this;
|
||||
forAllReverse(items, i)
|
||||
{
|
||||
const word& patchName = items[i].patchName();
|
||||
labelList patchIDs = findStrings(patchName, allPatchNames);
|
||||
|
||||
if (patchIDs.empty())
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::patchInteractionDataList::patchInteractionDataList"
|
||||
"("
|
||||
"const polyMesh&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
) << "Cannot find any patch names matching " << patchName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
patchGroupIDs_[i].transfer(patchIDs);
|
||||
}
|
||||
|
||||
// check that all walls are specified
|
||||
DynamicList<word> badWalls;
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
const polyPatch& pp = bMesh[patchI];
|
||||
if (isA<wallPolyPatch>(pp) && applyToPatch(pp.index()) < 0)
|
||||
{
|
||||
badWalls.append(pp.name());
|
||||
}
|
||||
}
|
||||
|
||||
if (badWalls.size() > 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::patchInteractionDataList::patchInteractionDataList"
|
||||
"("
|
||||
"const polyMesh&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
) << "All wall patches must be specified when employing local patch "
|
||||
<< "interaction. Please specify data for patches:" << nl
|
||||
<< badWalls << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::patchInteractionDataList::patchInteractionDataList
|
||||
(
|
||||
const patchInteractionDataList& pidl
|
||||
)
|
||||
:
|
||||
List<patchInteractionData>(pidl),
|
||||
patchGroupIDs_(pidl.patchGroupIDs_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const
|
||||
{
|
||||
forAll(patchGroupIDs_, groupI)
|
||||
{
|
||||
const labelList& patchIDs = patchGroupIDs_[groupI];
|
||||
forAll(patchIDs, patchI)
|
||||
{
|
||||
if (patchIDs[patchI] == id)
|
||||
{
|
||||
return groupI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ 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::patchInteractionDataList
|
||||
|
||||
Description
|
||||
List container for patchInteractionData class
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef patchInteractionDataList_H
|
||||
#define patchInteractionDataList_H
|
||||
|
||||
#include "patchInteractionData.H"
|
||||
#include "polyMesh.H"
|
||||
#include "dictionary.H"
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class patchInteractionDataList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class patchInteractionDataList
|
||||
:
|
||||
public List<patchInteractionData>
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- List of patch IDs for each patch group
|
||||
labelListList patchGroupIDs_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
|
||||
//- Construct null
|
||||
patchInteractionDataList();
|
||||
|
||||
//- Construct copy
|
||||
patchInteractionDataList(const patchInteractionDataList& pidl);
|
||||
|
||||
//- Construct from Istream
|
||||
patchInteractionDataList(const polyMesh& mesh, const dictionary& dict);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return label of group containing patch id
|
||||
// Returns -1 if patch id is not present
|
||||
label applyToPatch(const label id) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "PatchPostProcessing.H"
|
||||
#include "Pstream.H"
|
||||
#include "stringListOps.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -35,12 +36,15 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
|
||||
const label globalPatchI
|
||||
) const
|
||||
{
|
||||
forAll(patchIds_, patchI)
|
||||
label patchI = 0;
|
||||
forAllConstIter(labelHashSet, patchIDs_, iter)
|
||||
{
|
||||
if (patchIds_[patchI] == globalPatchI)
|
||||
if (iter.key() == globalPatchI)
|
||||
{
|
||||
return patchI;
|
||||
}
|
||||
|
||||
patchI++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -52,16 +56,18 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
|
||||
template<class CloudType>
|
||||
void Foam::PatchPostProcessing<CloudType>::write()
|
||||
{
|
||||
forAll(patchData_, patchI)
|
||||
forAll(patchData_, i)
|
||||
{
|
||||
List<List<string> > procData(Pstream::nProcs());
|
||||
procData[Pstream::myProcNo()] = patchData_[patchI];
|
||||
procData[Pstream::myProcNo()] = patchData_[i];
|
||||
|
||||
Pstream::gatherList(procData);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir = this->owner().time().path();
|
||||
const fvMesh& mesh = this->owner().mesh();
|
||||
|
||||
fileName outputDir = mesh.time().path();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
@ -69,24 +75,26 @@ void Foam::PatchPostProcessing<CloudType>::write()
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
outputDir/".."/"postProcessing"/cloud::prefix/
|
||||
this->owner().name()/this->owner().time().timeName();
|
||||
this->owner().name()/mesh.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir =
|
||||
outputDir/"postProcessing"/cloud::prefix/
|
||||
this->owner().name()/this->owner().time().timeName();
|
||||
this->owner().name()/mesh.time().timeName();
|
||||
}
|
||||
|
||||
// Create directory if it doesn't exist
|
||||
mkDir(outputDir);
|
||||
|
||||
const word& patchName = mesh.boundaryMesh()[patchIDs_[i]].name();
|
||||
|
||||
OFstream patchOutFile
|
||||
(
|
||||
outputDir/patchNames_[patchI] + ".post",
|
||||
outputDir/patchName + ".post",
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
this->owner().time().writeCompression()
|
||||
mesh.time().writeCompression()
|
||||
);
|
||||
|
||||
List<string> globalData;
|
||||
@ -99,13 +107,13 @@ void Foam::PatchPostProcessing<CloudType>::write()
|
||||
|
||||
patchOutFile<< "# Time " + parcelType::propHeader << nl;
|
||||
|
||||
forAll(globalData, i)
|
||||
forAll(globalData, dataI)
|
||||
{
|
||||
patchOutFile<< globalData[i].c_str() << nl;
|
||||
patchOutFile<< globalData[dataI].c_str() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
patchData_[patchI].clearStorage();
|
||||
patchData_[i].clearStorage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,29 +129,36 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
||||
:
|
||||
PostProcessingModel<CloudType>(dict, owner, typeName),
|
||||
maxStoredParcels_(readLabel(this->coeffDict().lookup("maxStoredParcels"))),
|
||||
patchNames_(this->coeffDict().lookup("patches")),
|
||||
patchData_(patchNames_.size()),
|
||||
patchIds_(patchNames_.size())
|
||||
patchIDs_(),
|
||||
patchData_()
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = this->owner().mesh().boundaryMesh();
|
||||
forAll(patchNames_, patchI)
|
||||
const wordList allPatchNames = owner.mesh().boundaryMesh().names();
|
||||
wordList patchName(this->coeffDict().lookup("patches"));
|
||||
|
||||
forAllReverse(patchName, i)
|
||||
{
|
||||
const label id = bMesh.findPatchID(patchNames_[patchI]);
|
||||
if (id < 0)
|
||||
labelList patchIDs = findStrings(patchName[i], allPatchNames);
|
||||
|
||||
if (patchIDs.empty())
|
||||
{
|
||||
FatalErrorIn
|
||||
WarningIn
|
||||
(
|
||||
"PatchPostProcessing<CloudType>::PatchPostProcessing"
|
||||
"Foam::PatchPostProcessing<CloudType>::PatchPostProcessing"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"CloudType& owner"
|
||||
"CloudType& "
|
||||
")"
|
||||
)<< "Requested patch " << patchNames_[patchI] << " not found" << nl
|
||||
<< "Available patches are: " << bMesh.names() << nl
|
||||
<< exit(FatalError);
|
||||
) << "Cannot find any patch names matching " << patchName[i]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(patchIDs, j)
|
||||
{
|
||||
patchIDs_.insert(patchIDs[j]);
|
||||
}
|
||||
patchIds_[patchI] = id;
|
||||
}
|
||||
|
||||
patchData_.setSize(patchIDs_.size());
|
||||
}
|
||||
|
||||
|
||||
@ -155,9 +170,8 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
|
||||
:
|
||||
PostProcessingModel<CloudType>(ppm),
|
||||
maxStoredParcels_(ppm.maxStoredParcels_),
|
||||
patchNames_(ppm.patchNames_),
|
||||
patchData_(ppm.patchData_),
|
||||
patchIds_(ppm.patchIds_)
|
||||
patchIDs_(ppm.patchIDs_),
|
||||
patchData_(ppm.patchData_)
|
||||
{}
|
||||
|
||||
|
||||
@ -177,8 +191,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
|
||||
const label patchI
|
||||
)
|
||||
{
|
||||
label localPatchI = applyToPatch(patchI);
|
||||
if (localPatchI >= 0 && patchData_[localPatchI].size() < maxStoredParcels_)
|
||||
const label localPatchI = applyToPatch(patchI);
|
||||
if (localPatchI != -1 && patchData_[localPatchI].size() < maxStoredParcels_)
|
||||
{
|
||||
OStringStream data;
|
||||
data<< this->owner().time().timeName() << ' ' << p;
|
||||
|
||||
@ -58,15 +58,12 @@ class PatchPostProcessing
|
||||
//- Maximum number of parcels to store
|
||||
label maxStoredParcels_;
|
||||
|
||||
//- List of patch names
|
||||
wordList patchNames_;
|
||||
//- List of patch indices to post-process
|
||||
labelHashSet patchIDs_;
|
||||
|
||||
//- List of output data per patch
|
||||
List<DynamicList<string> > patchData_;
|
||||
|
||||
//- Mapping from local to global patch ids
|
||||
labelList patchIds_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -117,11 +114,8 @@ public:
|
||||
//- Return maximum number of parcels to store per patch
|
||||
inline label maxStoredParcels() const;
|
||||
|
||||
//- Return const access to the list of patch names
|
||||
inline const wordList& patchNames() const;
|
||||
|
||||
//- Return const mapping from local to global patch ids
|
||||
inline const labelList& patchIds() const;
|
||||
inline const labelList& patchIDs() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,17 +31,9 @@ Foam::label Foam::PatchPostProcessing<CloudType>::maxStoredParcels() const
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::wordList& Foam::PatchPostProcessing<CloudType>::patchNames() const
|
||||
const Foam::labelList& Foam::PatchPostProcessing<CloudType>::patchIDs() const
|
||||
{
|
||||
return patchNames_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::labelList&
|
||||
Foam::PatchPostProcessing<CloudType>::patchIds() const
|
||||
{
|
||||
return patchIds_;
|
||||
return patchIDs_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -90,6 +90,9 @@ public:
|
||||
//- Destructor
|
||||
virtual ~SubModelBase();
|
||||
|
||||
//- Type of cloud this model was instantiated for
|
||||
typedef CloudType cloudType;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ void Foam::filmHeightInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
const fvPatchField<scalar>& deltafp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(deltafName_);
|
||||
|
||||
vectorField n = patch().nf();
|
||||
const vectorField& n = patch().nf();
|
||||
const scalarField& magSf = patch().magSf();
|
||||
|
||||
operator==(deltafp*n*phip/(rhop*magSf*sqr(deltafp) + ROOTVSMALL));
|
||||
|
||||
@ -123,7 +123,7 @@ tmp<scalarField> mutkFilmWallFunctionFvPatchScalarField::calcMut() const
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
const scalarField magGradU = mag(Uw.snGrad());
|
||||
const scalarField magGradU(mag(Uw.snGrad()));
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
|
||||
@ -899,9 +899,11 @@ scalar kinematicSingleLayer::CourantNumber() const
|
||||
{
|
||||
const scalar deltaT = time_.deltaTValue();
|
||||
|
||||
const surfaceScalarField SfUfbyDelta =
|
||||
regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_);
|
||||
const surfaceScalarField rhoDelta = fvc::interpolate(rho_*delta_);
|
||||
const surfaceScalarField SfUfbyDelta
|
||||
(
|
||||
regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_)
|
||||
);
|
||||
const surfaceScalarField rhoDelta(fvc::interpolate(rho_*delta_));
|
||||
const surfaceScalarField& magSf = regionMesh().magSf();
|
||||
|
||||
forAll(rhoDelta, i)
|
||||
|
||||
@ -121,10 +121,10 @@ void standardPhaseChange::correct
|
||||
const scalarField& rhoInf = film.rhoPrimary();
|
||||
const scalarField& muInf = film.muPrimary();
|
||||
const scalarField& magSf = film.magSf();
|
||||
const scalarField hInf = film.htcs().h();
|
||||
const scalarField hFilm = film.htcw().h();
|
||||
const vectorField dU = film.UPrimary() - film.Us();
|
||||
const scalarField availableMass = (delta - deltaMin_)*rho*magSf;
|
||||
const scalarField hInf(film.htcs().h());
|
||||
const scalarField hFilm(film.htcw().h());
|
||||
const vectorField dU(film.UPrimary() - film.Us());
|
||||
const scalarField availableMass((delta - deltaMin_)*rho*magSf);
|
||||
|
||||
|
||||
forAll(dMass, cellI)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -231,28 +231,43 @@ void Foam::sampledSets::write()
|
||||
void Foam::sampledSets::read(const dictionary& dict)
|
||||
{
|
||||
dict_ = dict;
|
||||
dict_.lookup("fields") >> fieldSelection_;
|
||||
clearFieldGroups();
|
||||
|
||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||
dict.lookup("setFormat") >> writeFormat_;
|
||||
bool setsFound = dict_.found("sets");
|
||||
if (setsFound)
|
||||
{
|
||||
dict_.lookup("fields") >> fieldSelection_;
|
||||
clearFieldGroups();
|
||||
|
||||
PtrList<sampledSet> newList
|
||||
(
|
||||
dict_.lookup("sets"),
|
||||
sampledSet::iNew(mesh_, searchEngine_)
|
||||
);
|
||||
transfer(newList);
|
||||
combineSampledSets(masterSampledSets_, indexSets_);
|
||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||
dict.lookup("setFormat") >> writeFormat_;
|
||||
|
||||
PtrList<sampledSet> newList
|
||||
(
|
||||
dict_.lookup("sets"),
|
||||
sampledSet::iNew(mesh_, searchEngine_)
|
||||
);
|
||||
transfer(newList);
|
||||
combineSampledSets(masterSampledSets_, indexSets_);
|
||||
|
||||
if (this->size())
|
||||
{
|
||||
Info<< "Reading set description:" << nl;
|
||||
forAll(*this, setI)
|
||||
{
|
||||
Info<< " " << operator[](setI).name() << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
Pout<< "sample fields:" << fieldSelection_ << nl
|
||||
<< "sample sets:" << nl << "(" << nl;
|
||||
|
||||
forAll(*this, si)
|
||||
forAll(*this, setI)
|
||||
{
|
||||
Pout<< " " << operator[](si) << endl;
|
||||
Pout<< " " << operator[](setI) << endl;
|
||||
}
|
||||
Pout<< ")" << endl;
|
||||
}
|
||||
@ -261,19 +276,23 @@ void Foam::sampledSets::read(const dictionary& dict)
|
||||
|
||||
void Foam::sampledSets::correct()
|
||||
{
|
||||
// reset interpolation
|
||||
pointMesh::Delete(mesh_);
|
||||
volPointInterpolation::Delete(mesh_);
|
||||
bool setsFound = dict_.found("sets");
|
||||
if (setsFound)
|
||||
{
|
||||
// reset interpolation
|
||||
pointMesh::Delete(mesh_);
|
||||
volPointInterpolation::Delete(mesh_);
|
||||
|
||||
searchEngine_.correct();
|
||||
searchEngine_.correct();
|
||||
|
||||
PtrList<sampledSet> newList
|
||||
(
|
||||
dict_.lookup("sets"),
|
||||
sampledSet::iNew(mesh_, searchEngine_)
|
||||
);
|
||||
transfer(newList);
|
||||
combineSampledSets(masterSampledSets_, indexSets_);
|
||||
PtrList<sampledSet> newList
|
||||
(
|
||||
dict_.lookup("sets"),
|
||||
sampledSet::iNew(mesh_, searchEngine_)
|
||||
);
|
||||
transfer(newList);
|
||||
combineSampledSets(masterSampledSets_, indexSets_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -216,34 +216,49 @@ void Foam::sampledSurfaces::write()
|
||||
|
||||
void Foam::sampledSurfaces::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSelection_;
|
||||
clearFieldGroups();
|
||||
bool surfacesFound = dict.found("surfaces");
|
||||
|
||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||
const word writeType(dict.lookup("surfaceFormat"));
|
||||
|
||||
// define the surface formatter
|
||||
// optionally defined extra controls for the output formats
|
||||
formatter_ = surfaceWriter::New
|
||||
(
|
||||
writeType,
|
||||
dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType)
|
||||
);
|
||||
|
||||
PtrList<sampledSurface> newList
|
||||
(
|
||||
dict.lookup("surfaces"),
|
||||
sampledSurface::iNew(mesh_)
|
||||
);
|
||||
transfer(newList);
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (surfacesFound)
|
||||
{
|
||||
mergeList_.setSize(size());
|
||||
}
|
||||
dict.lookup("fields") >> fieldSelection_;
|
||||
clearFieldGroups();
|
||||
|
||||
// ensure all surfaces and merge information are expired
|
||||
expire();
|
||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||
const word writeType(dict.lookup("surfaceFormat"));
|
||||
|
||||
// define the surface formatter
|
||||
// optionally defined extra controls for the output formats
|
||||
formatter_ = surfaceWriter::New
|
||||
(
|
||||
writeType,
|
||||
dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType)
|
||||
);
|
||||
|
||||
PtrList<sampledSurface> newList
|
||||
(
|
||||
dict.lookup("surfaces"),
|
||||
sampledSurface::iNew(mesh_)
|
||||
);
|
||||
transfer(newList);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
mergeList_.setSize(size());
|
||||
}
|
||||
|
||||
// ensure all surfaces and merge information are expired
|
||||
expire();
|
||||
|
||||
if (this->size())
|
||||
{
|
||||
Info<< "Reading surface description:" << nl;
|
||||
forAll(*this, surfI)
|
||||
{
|
||||
Info<< " " << operator[](surfI).name() << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
|
||||
@ -115,10 +115,10 @@ void htcConvFvPatchScalarField::updateCoeffs()
|
||||
const vectorField& Uc = rasModel.U();
|
||||
const vectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
const scalarField& Tw = rasModel.thermo().T().boundaryField()[patchI];
|
||||
const scalarField Cpw = rasModel.thermo().Cp(Tw, patchI);
|
||||
const scalarField Cpw(rasModel.thermo().Cp(Tw, patchI));
|
||||
|
||||
const scalarField kappaw = Cpw*alphaEffw;
|
||||
const scalarField Pr = muw*Cpw/kappaw;
|
||||
const scalarField kappaw(Cpw*alphaEffw);
|
||||
const scalarField Pr(muw*Cpw/kappaw);
|
||||
|
||||
scalarField& htc = *this;
|
||||
forAll(htc, faceI)
|
||||
|
||||
Reference in New Issue
Block a user