mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote branch 'OpenCFD/master' into olesenm
This commit is contained in:
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
|||||||
@ -124,6 +124,41 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::K() const
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||||
|
|
||||||
|
if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
|
||||||
|
{
|
||||||
|
return patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||||
|
}
|
||||||
|
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
|
||||||
|
{
|
||||||
|
const symmTensorField& KWall =
|
||||||
|
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
|
||||||
|
|
||||||
|
vectorField n = patch().nf();
|
||||||
|
|
||||||
|
return n & KWall & n;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"solidWallHeatFluxTemperatureFvPatchScalarField::K()"
|
||||||
|
" const"
|
||||||
|
) << "Did not find field " << KName_
|
||||||
|
<< " on mesh " << mesh.name() << " patch " << patch().name()
|
||||||
|
<< endl
|
||||||
|
<< "Please set 'K' to a valid volScalarField"
|
||||||
|
<< " or a valid volSymmTensorField." << exit(FatalError);
|
||||||
|
|
||||||
|
return scalarField(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (updated())
|
if (updated())
|
||||||
@ -131,12 +166,7 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField& Kw = patch().lookupPatchField<volScalarField, scalar>
|
gradient() = q_/K();
|
||||||
(
|
|
||||||
KName_
|
|
||||||
);
|
|
||||||
|
|
||||||
gradient() = q_/Kw;
|
|
||||||
|
|
||||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,9 +31,10 @@ Description
|
|||||||
myWallPatch
|
myWallPatch
|
||||||
{
|
{
|
||||||
type solidWallHeatFluxTemperature;
|
type solidWallHeatFluxTemperature;
|
||||||
K K; // Name of K field
|
K K; // Name of K field
|
||||||
q uniform 1000; // Heat flux / [W/m2]
|
q uniform 1000; // Heat flux / [W/m2]
|
||||||
value 300.0; // Initial temperature / [K]
|
value uniform 300.0; // Initial temperature / [K]
|
||||||
|
gradient uniform 0.0; // Initial gradient / [K/m]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -140,6 +141,11 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
// Helper
|
||||||
|
|
||||||
|
//- Get K field on this patch
|
||||||
|
tmp<scalarField> K() const;
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
|
|||||||
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
|||||||
@ -508,19 +508,11 @@ bool Foam::Time::run() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return running;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::Time::loop()
|
|
||||||
{
|
|
||||||
bool running = run();
|
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
if (!subCycling_)
|
if (!subCycling_)
|
||||||
{
|
{
|
||||||
readModifiedObjects();
|
const_cast<Time&>(*this).readModifiedObjects();
|
||||||
|
|
||||||
if (timeIndex_ == startTimeIndex_)
|
if (timeIndex_ == startTimeIndex_)
|
||||||
{
|
{
|
||||||
@ -532,14 +524,22 @@ bool Foam::Time::loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check update the "running" status following the "++" operation
|
// Update the "running" status following the
|
||||||
// to take into account possible side-effects from functionObjects
|
// possible side-effects from functionObjects
|
||||||
running = run();
|
running = value() < (endTime_ - 0.5*deltaT_);
|
||||||
|
}
|
||||||
|
|
||||||
if (running)
|
return running;
|
||||||
{
|
}
|
||||||
operator++();
|
|
||||||
}
|
|
||||||
|
bool Foam::Time::loop()
|
||||||
|
{
|
||||||
|
bool running = run();
|
||||||
|
|
||||||
|
if (running)
|
||||||
|
{
|
||||||
|
operator++();
|
||||||
}
|
}
|
||||||
|
|
||||||
return running;
|
return running;
|
||||||
|
|||||||
@ -72,7 +72,8 @@ GeometricBoundaryField
|
|||||||
(
|
(
|
||||||
const BoundaryMesh& bmesh,
|
const BoundaryMesh& bmesh,
|
||||||
const DimensionedField<Type, GeoMesh>& field,
|
const DimensionedField<Type, GeoMesh>& field,
|
||||||
const wordList& patchFieldTypes
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& constraintTypes
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
FieldField<PatchField, Type>(bmesh.size()),
|
FieldField<PatchField, Type>(bmesh.size()),
|
||||||
@ -83,18 +84,22 @@ GeometricBoundaryField
|
|||||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||||
"GeometricBoundaryField::"
|
"GeometricBoundaryField::"
|
||||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||||
"const Field<Type>&, const wordList&)"
|
"const Field<Type>&, const wordList&, const wordList&)"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patchFieldTypes.size() != this->size())
|
if
|
||||||
|
(
|
||||||
|
patchFieldTypes.size() != this->size()
|
||||||
|
|| (constraintTypes.size() && (constraintTypes.size() != this->size()))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||||
"GeometricBoundaryField::"
|
"GeometricBoundaryField::"
|
||||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||||
"const Field<Type>&, const wordList&)"
|
"const Field<Type>&, const wordList&, const wordList&)"
|
||||||
) << "Incorrect number of patch type specifications given" << nl
|
) << "Incorrect number of patch type specifications given" << nl
|
||||||
<< " Number of patches in mesh = " << bmesh.size()
|
<< " Number of patches in mesh = " << bmesh.size()
|
||||||
<< " number of patch type specifications = "
|
<< " number of patch type specifications = "
|
||||||
@ -102,18 +107,38 @@ GeometricBoundaryField
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(bmesh_, patchi)
|
if (constraintTypes.size())
|
||||||
{
|
{
|
||||||
set
|
forAll(bmesh_, patchi)
|
||||||
(
|
{
|
||||||
patchi,
|
set
|
||||||
PatchField<Type>::New
|
|
||||||
(
|
(
|
||||||
patchFieldTypes[patchi],
|
patchi,
|
||||||
bmesh_[patchi],
|
PatchField<Type>::New
|
||||||
field
|
(
|
||||||
)
|
patchFieldTypes[patchi],
|
||||||
);
|
constraintTypes[patchi],
|
||||||
|
bmesh_[patchi],
|
||||||
|
field
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(bmesh_, patchi)
|
||||||
|
{
|
||||||
|
set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
|
PatchField<Type>::New
|
||||||
|
(
|
||||||
|
patchFieldTypes[patchi],
|
||||||
|
bmesh_[patchi],
|
||||||
|
field
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -231,14 +231,15 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
|||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const Mesh& mesh,
|
const Mesh& mesh,
|
||||||
const dimensionSet& ds,
|
const dimensionSet& ds,
|
||||||
const wordList& patchFieldTypes
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
DimensionedField<Type, GeoMesh>(io, mesh, ds),
|
DimensionedField<Type, GeoMesh>(io, mesh, ds),
|
||||||
timeIndex_(this->time().timeIndex()),
|
timeIndex_(this->time().timeIndex()),
|
||||||
field0Ptr_(NULL),
|
field0Ptr_(NULL),
|
||||||
fieldPrevIterPtr_(NULL),
|
fieldPrevIterPtr_(NULL),
|
||||||
boundaryField_(mesh.boundary(), *this, patchFieldTypes)
|
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -287,14 +288,15 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
|||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const Mesh& mesh,
|
const Mesh& mesh,
|
||||||
const dimensioned<Type>& dt,
|
const dimensioned<Type>& dt,
|
||||||
const wordList& patchFieldTypes
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
DimensionedField<Type, GeoMesh>(io, mesh, dt),
|
DimensionedField<Type, GeoMesh>(io, mesh, dt),
|
||||||
timeIndex_(this->time().timeIndex()),
|
timeIndex_(this->time().timeIndex()),
|
||||||
field0Ptr_(NULL),
|
field0Ptr_(NULL),
|
||||||
fieldPrevIterPtr_(NULL),
|
fieldPrevIterPtr_(NULL),
|
||||||
boundaryField_(mesh.boundary(), *this, patchFieldTypes)
|
boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -653,14 +655,22 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
|||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const GeometricField<Type, PatchField, GeoMesh>& gf,
|
const GeometricField<Type, PatchField, GeoMesh>& gf,
|
||||||
const wordList& patchFieldTypes
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes
|
||||||
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
DimensionedField<Type, GeoMesh>(io, gf),
|
DimensionedField<Type, GeoMesh>(io, gf),
|
||||||
timeIndex_(gf.timeIndex()),
|
timeIndex_(gf.timeIndex()),
|
||||||
field0Ptr_(NULL),
|
field0Ptr_(NULL),
|
||||||
fieldPrevIterPtr_(NULL),
|
fieldPrevIterPtr_(NULL),
|
||||||
boundaryField_(this->mesh().boundary(), *this, patchFieldTypes)
|
boundaryField_
|
||||||
|
(
|
||||||
|
this->mesh().boundary(),
|
||||||
|
*this,
|
||||||
|
patchFieldTypes,
|
||||||
|
actualPatchTypes
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,12 +128,14 @@ public:
|
|||||||
|
|
||||||
//- Construct from a BoundaryMesh,
|
//- Construct from a BoundaryMesh,
|
||||||
// reference to the internal field
|
// reference to the internal field
|
||||||
// and a wordList of patch types
|
// and a wordList of patch types and optional the actual patch
|
||||||
|
// types (to override constraint patches)
|
||||||
GeometricBoundaryField
|
GeometricBoundaryField
|
||||||
(
|
(
|
||||||
const BoundaryMesh&,
|
const BoundaryMesh&,
|
||||||
const DimensionedInternalField&,
|
const DimensionedInternalField&,
|
||||||
const wordList&
|
const wordList& wantedPatchTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from a BoundaryMesh,
|
//- Construct from a BoundaryMesh,
|
||||||
@ -283,7 +285,8 @@ public:
|
|||||||
const IOobject&,
|
const IOobject&,
|
||||||
const Mesh&,
|
const Mesh&,
|
||||||
const dimensionSet&,
|
const dimensionSet&,
|
||||||
const wordList& patchFieldTypes
|
const wordList& wantedPatchTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Constructor given IOobject, mesh, dimensioned<Type> and patch type.
|
//- Constructor given IOobject, mesh, dimensioned<Type> and patch type.
|
||||||
@ -301,7 +304,8 @@ public:
|
|||||||
const IOobject&,
|
const IOobject&,
|
||||||
const Mesh&,
|
const Mesh&,
|
||||||
const dimensioned<Type>&,
|
const dimensioned<Type>&,
|
||||||
const wordList& patchFieldTypes
|
const wordList& wantedPatchTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Constructor from components
|
//- Constructor from components
|
||||||
@ -387,7 +391,8 @@ public:
|
|||||||
(
|
(
|
||||||
const IOobject&,
|
const IOobject&,
|
||||||
const GeometricField<Type, PatchField, GeoMesh>&,
|
const GeometricField<Type, PatchField, GeoMesh>&,
|
||||||
const wordList& patchFieldTypes
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pointPatchField.C
|
pointPatchField.C
|
||||||
newpointPatchField.C
|
newPointPatchField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -199,6 +199,18 @@ public:
|
|||||||
const DimensionedField<Type, pointMesh>&
|
const DimensionedField<Type, pointMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return a pointer to a new patchField created on freestore given
|
||||||
|
// patch and internal field
|
||||||
|
// (does not set the patch field values).
|
||||||
|
// Allows override of constraint type
|
||||||
|
static autoPtr<pointPatchField<Type> > New
|
||||||
|
(
|
||||||
|
const word&,
|
||||||
|
const word& actualPatchType,
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<Type, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore from
|
//- Return a pointer to a new patchField created on freestore from
|
||||||
// a given pointPatchField mapped onto a new patch
|
// a given pointPatchField mapped onto a new patch
|
||||||
static autoPtr<pointPatchField<Type> > New
|
static autoPtr<pointPatchField<Type> > New
|
||||||
|
|||||||
@ -29,6 +29,7 @@ template<class Type>
|
|||||||
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
||||||
(
|
(
|
||||||
const word& patchFieldType,
|
const word& patchFieldType,
|
||||||
|
const word& actualPatchType,
|
||||||
const pointPatch& p,
|
const pointPatch& p,
|
||||||
const DimensionedField<Type, pointMesh>& iF
|
const DimensionedField<Type, pointMesh>& iF
|
||||||
)
|
)
|
||||||
@ -36,7 +37,8 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "PointPatchField<Type>::"
|
Info<< "PointPatchField<Type>::"
|
||||||
"New(const word&, const pointPatch&, const Field<Type>&) : "
|
"New(const word&, const word&"
|
||||||
|
", const pointPatch&, const Field<Type>&) : "
|
||||||
"constructing pointPatchField<Type>"
|
"constructing pointPatchField<Type>"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -49,7 +51,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"PointPatchField<Type>::New"
|
"PointPatchField<Type>::New"
|
||||||
"(const word&, const pointPatch&, const Field<Type>&)"
|
"(const word&, const word&, const pointPatch&, const Field<Type>&)"
|
||||||
) << "Unknown patchFieldType type "
|
) << "Unknown patchFieldType type "
|
||||||
<< patchFieldType
|
<< patchFieldType
|
||||||
<< endl << endl
|
<< endl << endl
|
||||||
@ -60,31 +62,48 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
|||||||
|
|
||||||
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));
|
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));
|
||||||
|
|
||||||
if (pfPtr().constraintType() == p.constraintType())
|
if
|
||||||
|
(
|
||||||
|
actualPatchType == word::null
|
||||||
|
|| actualPatchType != p.type()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Compatible (constraint-wise) with the patch type
|
if (pfPtr().constraintType() != p.constraintType())
|
||||||
return pfPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use default constraint type
|
|
||||||
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
|
|
||||||
pointPatchConstructorTablePtr_->find(p.type());
|
|
||||||
|
|
||||||
if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
|
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
// Use default constraint type
|
||||||
(
|
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
|
||||||
"PointPatchField<Type>::New"
|
pointPatchConstructorTablePtr_->find(p.type());
|
||||||
"(const word&, const pointPatch&, const Field<Type>&)"
|
|
||||||
) << "inconsistent patch and patchField types for \n"
|
|
||||||
<< " patch type " << p.type()
|
|
||||||
<< " and patchField type " << patchFieldType
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return patchTypeCstrIter()(p, iF);
|
if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"PointPatchField<Type>::New"
|
||||||
|
"(const word&, const word&"
|
||||||
|
", const pointPatch&, const Field<Type>&)"
|
||||||
|
) << "inconsistent patch and patchField types for \n"
|
||||||
|
<< " patch type " << p.type()
|
||||||
|
<< " and patchField type " << patchFieldType
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return patchTypeCstrIter()(p, iF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pfPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
|
||||||
|
(
|
||||||
|
const word& patchFieldType,
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<Type, pointMesh>& iF
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return New(patchFieldType, word::null, p, iF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -226,6 +226,18 @@ public:
|
|||||||
const DimensionedField<Type, volMesh>&
|
const DimensionedField<Type, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return a pointer to a new patchField created on freestore given
|
||||||
|
// patch and internal field
|
||||||
|
// (does not set the patch field values).
|
||||||
|
// Allows override of constraint type
|
||||||
|
static tmp<fvPatchField<Type> > New
|
||||||
|
(
|
||||||
|
const word&,
|
||||||
|
const word& actualPatchType,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore from
|
//- Return a pointer to a new patchField created on freestore from
|
||||||
// a given fvPatchField mapped onto a new patch
|
// a given fvPatchField mapped onto a new patch
|
||||||
static tmp<fvPatchField<Type> > New
|
static tmp<fvPatchField<Type> > New
|
||||||
|
|||||||
@ -29,14 +29,16 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
||||||
(
|
(
|
||||||
const word& patchFieldType,
|
const word& patchFieldType,
|
||||||
|
const word& actualPatchType,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "fvPatchField<Type>::New(const word&, const fvPatch&, "
|
Info<< "fvPatchField<Type>::New(const word&, const word&, "
|
||||||
"const DimensionedField<Type, volMesh>&) : patchFieldType="
|
"const fvPatch&, const DimensionedField<Type, volMesh>&) :"
|
||||||
|
" patchFieldType="
|
||||||
<< patchFieldType
|
<< patchFieldType
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"fvPatchField<Type>::New(const word&, const fvPatch&, "
|
"fvPatchField<Type>::New(const word&, const word&, const fvPatch&, "
|
||||||
"const DimensionedField<Type, volMesh>&)"
|
"const DimensionedField<Type, volMesh>&)"
|
||||||
) << "Unknown patchTypefield type " << patchFieldType
|
) << "Unknown patchTypefield type " << patchFieldType
|
||||||
<< endl << endl
|
<< endl << endl
|
||||||
@ -57,12 +59,23 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename patchConstructorTable::iterator patchTypeCstrIter =
|
if
|
||||||
patchConstructorTablePtr_->find(p.type());
|
(
|
||||||
|
actualPatchType == word::null
|
||||||
if (patchTypeCstrIter != patchConstructorTablePtr_->end())
|
|| actualPatchType != p.type()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return patchTypeCstrIter()(p, iF);
|
typename patchConstructorTable::iterator patchTypeCstrIter =
|
||||||
|
patchConstructorTablePtr_->find(p.type());
|
||||||
|
|
||||||
|
if (patchTypeCstrIter != patchConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
return patchTypeCstrIter()(p, iF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return cstrIter()(p, iF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -71,6 +84,18 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
||||||
|
(
|
||||||
|
const word& patchFieldType,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return New(patchFieldType, word::null, p, iF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
|
||||||
(
|
(
|
||||||
|
|||||||
@ -216,6 +216,18 @@ public:
|
|||||||
const DimensionedField<Type, surfaceMesh>&
|
const DimensionedField<Type, surfaceMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return a pointer to a new patchField created on freestore given
|
||||||
|
// patch and internal field
|
||||||
|
// (does not set the patch field values)
|
||||||
|
// Allows override of constraint type
|
||||||
|
static tmp<fvsPatchField<Type> > New
|
||||||
|
(
|
||||||
|
const word&,
|
||||||
|
const word& actualPatchType,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, surfaceMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore from
|
//- Return a pointer to a new patchField created on freestore from
|
||||||
// a given fvsPatchField mapped onto a new patch
|
// a given fvsPatchField mapped onto a new patch
|
||||||
static tmp<fvsPatchField<Type> > New
|
static tmp<fvsPatchField<Type> > New
|
||||||
|
|||||||
@ -34,14 +34,15 @@ template<class Type>
|
|||||||
tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
||||||
(
|
(
|
||||||
const word& patchFieldType,
|
const word& patchFieldType,
|
||||||
|
const word& actualPatchType,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<Type, surfaceMesh>& iF
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "fvsPatchField<Type>::New(const word&, const fvPatch&, "
|
Info<< "fvsPatchField<Type>::New(const word&, const word&"
|
||||||
"const Field<Type>&) : "
|
", const fvPatch&, const Field<Type>&) : "
|
||||||
"constructing fvsPatchField<Type>"
|
"constructing fvsPatchField<Type>"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -53,8 +54,8 @@ tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"fvsPatchField<Type>::New(const word&, const fvPatch&, "
|
"fvsPatchField<Type>::New(const word&, const word&, const fvPatch&"
|
||||||
"const Field<Type>&)"
|
", const Field<Type>&)"
|
||||||
) << "Unknown patchTypefield type " << patchFieldType
|
) << "Unknown patchTypefield type " << patchFieldType
|
||||||
<< endl << endl
|
<< endl << endl
|
||||||
<< "Valid patchField types are :" << endl
|
<< "Valid patchField types are :" << endl
|
||||||
@ -62,12 +63,23 @@ tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename patchConstructorTable::iterator patchTypeCstrIter =
|
if
|
||||||
patchConstructorTablePtr_->find(p.type());
|
(
|
||||||
|
actualPatchType == word::null
|
||||||
if (patchTypeCstrIter != patchConstructorTablePtr_->end())
|
|| actualPatchType != p.type()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return patchTypeCstrIter()(p, iF);
|
typename patchConstructorTable::iterator patchTypeCstrIter =
|
||||||
|
patchConstructorTablePtr_->find(p.type());
|
||||||
|
|
||||||
|
if (patchTypeCstrIter != patchConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
return patchTypeCstrIter()(p, iF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return cstrIter()(p, iF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -76,6 +88,18 @@ tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
||||||
|
(
|
||||||
|
const word& patchFieldType,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return New(patchFieldType, word::null, p, iF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
|
||||||
(
|
(
|
||||||
|
|||||||
@ -160,10 +160,27 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
|
|||||||
const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL;
|
const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL;
|
||||||
|
|
||||||
// Momentum source due to particle forces
|
// Momentum source due to particle forces
|
||||||
const vector FCoupled =
|
const vector FCoupled = mass*td.cloud().forces().calcCoupled
|
||||||
mass*td.cloud().forces().calcCoupled(cellI, dt, rhoc_, rho, Uc_, U);
|
(
|
||||||
const vector FNonCoupled =
|
cellI,
|
||||||
mass*td.cloud().forces().calcNonCoupled(cellI, dt, rhoc_, rho, Uc_, U);
|
dt,
|
||||||
|
rhoc_,
|
||||||
|
rho,
|
||||||
|
Uc_,
|
||||||
|
U,
|
||||||
|
d
|
||||||
|
);
|
||||||
|
|
||||||
|
const vector FNonCoupled = mass*td.cloud().forces().calcNonCoupled
|
||||||
|
(
|
||||||
|
cellI,
|
||||||
|
dt,
|
||||||
|
rhoc_,
|
||||||
|
rho,
|
||||||
|
Uc_,
|
||||||
|
U,
|
||||||
|
d
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// New particle velocity
|
// New particle velocity
|
||||||
|
|||||||
@ -27,6 +27,8 @@ License
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "fvcGrad.H"
|
#include "fvcGrad.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
#include "electromagneticConstants.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -45,12 +47,20 @@ Foam::particleForces::particleForces
|
|||||||
virtualMass_(dict_.lookup("virtualMass")),
|
virtualMass_(dict_.lookup("virtualMass")),
|
||||||
Cvm_(0.0),
|
Cvm_(0.0),
|
||||||
pressureGradient_(dict_.lookup("pressureGradient")),
|
pressureGradient_(dict_.lookup("pressureGradient")),
|
||||||
UName_(dict_.lookupOrDefault<word>("U", "U"))
|
paramagnetic_(dict_.lookup("paramagnetic")),
|
||||||
|
magneticSusceptibility_(0.0),
|
||||||
|
UName_(dict_.lookupOrDefault<word>("U", "U")),
|
||||||
|
HdotGradHName_(dict_.lookupOrDefault<word>("HdotGradH", "HdotGradH"))
|
||||||
{
|
{
|
||||||
if (virtualMass_)
|
if (virtualMass_)
|
||||||
{
|
{
|
||||||
dict_.lookup("Cvm") >> Cvm_;
|
dict_.lookup("Cvm") >> Cvm_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paramagnetic_)
|
||||||
|
{
|
||||||
|
dict_.lookup("magneticSusceptibility") >> magneticSusceptibility_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +74,10 @@ Foam::particleForces::particleForces(const particleForces& f)
|
|||||||
virtualMass_(f.virtualMass_),
|
virtualMass_(f.virtualMass_),
|
||||||
Cvm_(f.Cvm_),
|
Cvm_(f.Cvm_),
|
||||||
pressureGradient_(f.pressureGradient_),
|
pressureGradient_(f.pressureGradient_),
|
||||||
UName_(f.UName_)
|
paramagnetic_(f.paramagnetic_),
|
||||||
|
magneticSusceptibility_(f.magneticSusceptibility_),
|
||||||
|
UName_(f.UName_),
|
||||||
|
HdotGradHName_(f.HdotGradHName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -102,18 +115,42 @@ Foam::Switch Foam::particleForces::virtualMass() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::particleForces::Cvm() const
|
||||||
|
{
|
||||||
|
return Cvm_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Switch Foam::particleForces::pressureGradient() const
|
Foam::Switch Foam::particleForces::pressureGradient() const
|
||||||
{
|
{
|
||||||
return pressureGradient_;
|
return pressureGradient_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Switch Foam::particleForces::paramagnetic() const
|
||||||
|
{
|
||||||
|
return paramagnetic_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::particleForces::magneticSusceptibility() const
|
||||||
|
{
|
||||||
|
return magneticSusceptibility_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::word& Foam::particleForces::UName() const
|
const Foam::word& Foam::particleForces::UName() const
|
||||||
{
|
{
|
||||||
return UName_;
|
return UName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::word& Foam::particleForces::HdotGradHName() const
|
||||||
|
{
|
||||||
|
return HdotGradHName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::particleForces::cacheFields(const bool store)
|
void Foam::particleForces::cacheFields(const bool store)
|
||||||
{
|
{
|
||||||
if (store && pressureGradient_)
|
if (store && pressureGradient_)
|
||||||
@ -139,10 +176,11 @@ Foam::vector Foam::particleForces::calcCoupled
|
|||||||
const scalar rhoc,
|
const scalar rhoc,
|
||||||
const scalar rho,
|
const scalar rho,
|
||||||
const vector& Uc,
|
const vector& Uc,
|
||||||
const vector& U
|
const vector& U,
|
||||||
|
const scalar d
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector Ftot = vector::zero;
|
vector accelTot = vector::zero;
|
||||||
|
|
||||||
// Virtual mass force
|
// Virtual mass force
|
||||||
if (virtualMass_)
|
if (virtualMass_)
|
||||||
@ -151,17 +189,17 @@ Foam::vector Foam::particleForces::calcCoupled
|
|||||||
(
|
(
|
||||||
"Foam::particleForces::calcCoupled(...) - virtual mass force"
|
"Foam::particleForces::calcCoupled(...) - virtual mass force"
|
||||||
);
|
);
|
||||||
// Ftot += Cvm_*rhoc/rho*d(Uc - U)/dt;
|
// accelTot += Cvm_*rhoc/rho*d(Uc - U)/dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pressure gradient force
|
// Pressure gradient force
|
||||||
if (pressureGradient_)
|
if (pressureGradient_)
|
||||||
{
|
{
|
||||||
const volTensorField& gradU = *gradUPtr_;
|
const volTensorField& gradU = *gradUPtr_;
|
||||||
Ftot += rhoc/rho*(U & gradU[cellI]);
|
accelTot += rhoc/rho*(U & gradU[cellI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ftot;
|
return accelTot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -172,20 +210,47 @@ Foam::vector Foam::particleForces::calcNonCoupled
|
|||||||
const scalar rhoc,
|
const scalar rhoc,
|
||||||
const scalar rho,
|
const scalar rho,
|
||||||
const vector& Uc,
|
const vector& Uc,
|
||||||
const vector& U
|
const vector& U,
|
||||||
|
const scalar d
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector Ftot = vector::zero;
|
vector accelTot = vector::zero;
|
||||||
|
|
||||||
// Gravity force
|
// Gravity force
|
||||||
if (gravity_)
|
if (gravity_)
|
||||||
{
|
{
|
||||||
Ftot += g_*(1.0 - rhoc/rho);
|
accelTot += g_*(1.0 - rhoc/rho);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ftot;
|
// Magnetic field force
|
||||||
|
|
||||||
|
if (paramagnetic_)
|
||||||
|
{
|
||||||
|
const volVectorField& HdotGradH = mesh_.lookupObject<volVectorField>
|
||||||
|
(
|
||||||
|
HdotGradHName_
|
||||||
|
);
|
||||||
|
|
||||||
|
accelTot +=
|
||||||
|
3.0*constant::electromagnetic::mu0.value()/rho
|
||||||
|
*magneticSusceptibility_/(magneticSusceptibility_ + 3)
|
||||||
|
*HdotGradH[cellI];
|
||||||
|
|
||||||
|
// force is:
|
||||||
|
|
||||||
|
// 4.0
|
||||||
|
// *constant::mathematical::pi
|
||||||
|
// *constant::electromagnetic::mu0.value()
|
||||||
|
// *pow3(d/2)
|
||||||
|
// *magneticSusceptibility_/(magneticSusceptibility_ + 3)
|
||||||
|
// *HdotGradH[cellI];
|
||||||
|
|
||||||
|
// which is divided by mass ((4/3)*pi*r^3*rho) to produce
|
||||||
|
// acceleration
|
||||||
|
}
|
||||||
|
|
||||||
|
return accelTot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|||||||
@ -84,12 +84,22 @@ class particleForces
|
|||||||
//- Pressure gradient
|
//- Pressure gradient
|
||||||
Switch pressureGradient_;
|
Switch pressureGradient_;
|
||||||
|
|
||||||
|
//- Paramagnetic force
|
||||||
|
Switch paramagnetic_;
|
||||||
|
|
||||||
|
//- Magnetic susceptibility of particle
|
||||||
|
scalar magneticSusceptibility_;
|
||||||
|
|
||||||
|
|
||||||
// Additional info
|
// Additional info
|
||||||
|
|
||||||
//- Name of velucity field - default = "U"
|
//- Name of velocity field - default = "U"
|
||||||
const word UName_;
|
const word UName_;
|
||||||
|
|
||||||
|
//- Name of paramagnetic field strength field - default =
|
||||||
|
// "HdotGradH"
|
||||||
|
const word HdotGradHName_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -128,7 +138,7 @@ public:
|
|||||||
Switch virtualMass() const;
|
Switch virtualMass() const;
|
||||||
|
|
||||||
//- Return virtual mass force coefficient
|
//- Return virtual mass force coefficient
|
||||||
Switch Cvm() const;
|
scalar Cvm() const;
|
||||||
|
|
||||||
//- Return pressure gradient force activate switch
|
//- Return pressure gradient force activate switch
|
||||||
Switch pressureGradient() const;
|
Switch pressureGradient() const;
|
||||||
@ -136,6 +146,15 @@ public:
|
|||||||
//- Return name of velocity field
|
//- Return name of velocity field
|
||||||
const word& UName() const;
|
const word& UName() const;
|
||||||
|
|
||||||
|
//- Return paramagnetic force activate switch
|
||||||
|
Switch paramagnetic() const;
|
||||||
|
|
||||||
|
//- Return magnetic susceptibility
|
||||||
|
scalar magneticSusceptibility() const;
|
||||||
|
|
||||||
|
//- Return name of paramagnetic field strength field
|
||||||
|
const word& HdotGradHName() const;
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
@ -150,7 +169,8 @@ public:
|
|||||||
const scalar rhoc,
|
const scalar rhoc,
|
||||||
const scalar rho,
|
const scalar rho,
|
||||||
const vector& Uc,
|
const vector& Uc,
|
||||||
const vector& U
|
const vector& U,
|
||||||
|
const scalar d
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate external forces applied to the particles
|
//- Calculate external forces applied to the particles
|
||||||
@ -161,7 +181,8 @@ public:
|
|||||||
const scalar rhoc,
|
const scalar rhoc,
|
||||||
const scalar rho,
|
const scalar rho,
|
||||||
const vector& Uc,
|
const vector& Uc,
|
||||||
const vector& U
|
const vector& U,
|
||||||
|
const scalar d
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -215,6 +215,43 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Return the minimum face between two cells. Only relevant for
|
||||||
|
// cells with multiple faces inbetween.
|
||||||
|
Foam::label Foam::decompositionMethod::masterFace
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const label own,
|
||||||
|
const label nei
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label minFaceI = labelMax;
|
||||||
|
|
||||||
|
// Count multiple faces between own and nei only once
|
||||||
|
const cell& ownFaces = mesh.cells()[own];
|
||||||
|
forAll(ownFaces, i)
|
||||||
|
{
|
||||||
|
label otherFaceI = ownFaces[i];
|
||||||
|
|
||||||
|
if (mesh.isInternalFace(otherFaceI))
|
||||||
|
{
|
||||||
|
label nbrCellI =
|
||||||
|
(
|
||||||
|
mesh.faceNeighbour()[otherFaceI] != own
|
||||||
|
? mesh.faceNeighbour()[otherFaceI]
|
||||||
|
: mesh.faceOwner()[otherFaceI]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nbrCellI == nei)
|
||||||
|
{
|
||||||
|
minFaceI = min(minFaceI, otherFaceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return minFaceI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::decompositionMethod::calcCSR
|
void Foam::decompositionMethod::calcCSR
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -222,61 +259,15 @@ void Foam::decompositionMethod::calcCSR
|
|||||||
List<int>& xadj
|
List<int>& xadj
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Make Metis CSR (Compressed Storage Format) storage
|
// Make Metis CSR (Compressed Storage Format) storage
|
||||||
// adjncy : contains neighbours (= edges in graph)
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
xadj.setSize(mesh.nCells()+1);
|
|
||||||
|
|
||||||
// Initialise the number of internal faces of the cells to twice the
|
// Count unique faces between cells
|
||||||
// number of internal faces
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
label nInternalFaces = 2*mesh.nInternalFaces();
|
|
||||||
|
|
||||||
// Check the boundary for coupled patches and add to the number of
|
|
||||||
// internal faces
|
|
||||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
forAll(pbm, patchi)
|
|
||||||
{
|
|
||||||
if (isA<cyclicPolyPatch>(pbm[patchi]))
|
|
||||||
{
|
|
||||||
nInternalFaces += pbm[patchi].size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the adjncy array the size of the total number of internal and
|
|
||||||
// coupled faces
|
|
||||||
adjncy.setSize(nInternalFaces);
|
|
||||||
|
|
||||||
// Fill in xadj
|
|
||||||
// ~~~~~~~~~~~~
|
|
||||||
label freeAdj = 0;
|
|
||||||
|
|
||||||
for (label cellI = 0; cellI < mesh.nCells(); cellI++)
|
|
||||||
{
|
|
||||||
xadj[cellI] = freeAdj;
|
|
||||||
|
|
||||||
const labelList& cFaces = mesh.cells()[cellI];
|
|
||||||
|
|
||||||
forAll(cFaces, i)
|
|
||||||
{
|
|
||||||
label faceI = cFaces[i];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
mesh.isInternalFace(faceI)
|
|
||||||
|| isA<cyclicPolyPatch>(pbm[pbm.whichPatch(faceI)])
|
|
||||||
)
|
|
||||||
{
|
|
||||||
freeAdj++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xadj[mesh.nCells()] = freeAdj;
|
|
||||||
|
|
||||||
|
|
||||||
// Fill in adjncy
|
|
||||||
// ~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
labelList nFacesPerCell(mesh.nCells(), 0);
|
labelList nFacesPerCell(mesh.nCells(), 0);
|
||||||
|
|
||||||
@ -286,26 +277,95 @@ void Foam::decompositionMethod::calcCSR
|
|||||||
label own = mesh.faceOwner()[faceI];
|
label own = mesh.faceOwner()[faceI];
|
||||||
label nei = mesh.faceNeighbour()[faceI];
|
label nei = mesh.faceNeighbour()[faceI];
|
||||||
|
|
||||||
adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
if (faceI == masterFace(mesh, own, nei))
|
||||||
adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
{
|
||||||
|
nFacesPerCell[own]++;
|
||||||
|
nFacesPerCell[nei]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Coupled faces. Only cyclics done.
|
// Coupled faces. Only cyclics done.
|
||||||
forAll(pbm, patchi)
|
HashSet<edge, Hash<edge> > cellPair(mesh.nFaces()-mesh.nInternalFaces());
|
||||||
|
|
||||||
|
forAll(pbm, patchI)
|
||||||
{
|
{
|
||||||
if (isA<cyclicPolyPatch>(pbm[patchi]))
|
if (isA<cyclicPolyPatch>(pbm[patchI]))
|
||||||
{
|
{
|
||||||
const unallocLabelList& faceCells = pbm[patchi].faceCells();
|
const unallocLabelList& faceCells = pbm[patchI].faceCells();
|
||||||
|
|
||||||
label sizeby2 = faceCells.size()/2;
|
label sizeby2 = faceCells.size()/2;
|
||||||
|
|
||||||
for (label facei=0; facei<sizeby2; facei++)
|
for (label faceI=0; faceI<sizeby2; faceI++)
|
||||||
{
|
{
|
||||||
label own = faceCells[facei];
|
label own = faceCells[faceI];
|
||||||
label nei = faceCells[facei + sizeby2];
|
label nei = faceCells[faceI + sizeby2];
|
||||||
|
|
||||||
adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
if (cellPair.insert(edge(own, nei)))
|
||||||
adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
{
|
||||||
|
nFacesPerCell[own]++;
|
||||||
|
nFacesPerCell[nei]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Size tables
|
||||||
|
// ~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Sum nFacesPerCell
|
||||||
|
xadj.setSize(mesh.nCells()+1);
|
||||||
|
|
||||||
|
label nConnections = 0;
|
||||||
|
|
||||||
|
for (label cellI = 0; cellI < mesh.nCells(); cellI++)
|
||||||
|
{
|
||||||
|
xadj[cellI] = nConnections;
|
||||||
|
nConnections += nFacesPerCell[cellI];
|
||||||
|
}
|
||||||
|
xadj[mesh.nCells()] = nConnections;
|
||||||
|
adjncy.setSize(nConnections);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Fill tables
|
||||||
|
// ~~~~~~~~~~~
|
||||||
|
|
||||||
|
nFacesPerCell = 0;
|
||||||
|
|
||||||
|
// Internal faces
|
||||||
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
|
{
|
||||||
|
label own = mesh.faceOwner()[faceI];
|
||||||
|
label nei = mesh.faceNeighbour()[faceI];
|
||||||
|
|
||||||
|
if (faceI == masterFace(mesh, own, nei))
|
||||||
|
{
|
||||||
|
adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
||||||
|
adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Coupled faces. Only cyclics done.
|
||||||
|
cellPair.clear();
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
if (isA<cyclicPolyPatch>(pbm[patchI]))
|
||||||
|
{
|
||||||
|
const unallocLabelList& faceCells = pbm[patchI].faceCells();
|
||||||
|
|
||||||
|
label sizeby2 = faceCells.size()/2;
|
||||||
|
|
||||||
|
for (label faceI=0; faceI<sizeby2; faceI++)
|
||||||
|
{
|
||||||
|
label own = faceCells[faceI];
|
||||||
|
label nei = faceCells[faceI + sizeby2];
|
||||||
|
|
||||||
|
if (cellPair.insert(edge(own, nei)))
|
||||||
|
{
|
||||||
|
adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
||||||
|
adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,12 +380,24 @@ void Foam::decompositionMethod::calcCSR
|
|||||||
List<int>& xadj
|
List<int>& xadj
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
labelHashSet nbrCells;
|
||||||
|
|
||||||
// Count number of internal faces
|
// Count number of internal faces
|
||||||
label nConnections = 0;
|
label nConnections = 0;
|
||||||
|
|
||||||
forAll(cellCells, coarseI)
|
forAll(cellCells, coarseI)
|
||||||
{
|
{
|
||||||
nConnections += cellCells[coarseI].size();
|
nbrCells.clear();
|
||||||
|
|
||||||
|
const labelList& cCells = cellCells[coarseI];
|
||||||
|
|
||||||
|
forAll(cCells, i)
|
||||||
|
{
|
||||||
|
if (nbrCells.insert(cCells[i]))
|
||||||
|
{
|
||||||
|
nConnections++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the adjncy array as twice the size of the total number of
|
// Create the adjncy array as twice the size of the total number of
|
||||||
@ -343,11 +415,16 @@ void Foam::decompositionMethod::calcCSR
|
|||||||
{
|
{
|
||||||
xadj[coarseI] = freeAdj;
|
xadj[coarseI] = freeAdj;
|
||||||
|
|
||||||
|
nbrCells.clear();
|
||||||
|
|
||||||
const labelList& cCells = cellCells[coarseI];
|
const labelList& cCells = cellCells[coarseI];
|
||||||
|
|
||||||
forAll(cCells, i)
|
forAll(cCells, i)
|
||||||
{
|
{
|
||||||
adjncy[freeAdj++] = cCells[i];
|
if (nbrCells.insert(cCells[i]))
|
||||||
|
{
|
||||||
|
adjncy[freeAdj++] = cCells[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xadj[cellCells.size()] = freeAdj;
|
xadj[cellCells.size()] = freeAdj;
|
||||||
@ -413,15 +490,21 @@ void Foam::decompositionMethod::calcDistributedCSR
|
|||||||
// Number of faces per cell
|
// Number of faces per cell
|
||||||
List<int> nFacesPerCell(mesh.nCells(), 0);
|
List<int> nFacesPerCell(mesh.nCells(), 0);
|
||||||
|
|
||||||
// Number of coupled faces
|
|
||||||
label nCoupledFaces = 0;
|
|
||||||
|
|
||||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
{
|
{
|
||||||
nFacesPerCell[faceOwner[faceI]]++;
|
label own = faceOwner[faceI];
|
||||||
nFacesPerCell[faceNeighbour[faceI]]++;
|
label nei = faceNeighbour[faceI];
|
||||||
|
|
||||||
|
if (faceI == masterFace(mesh, own, nei))
|
||||||
|
{
|
||||||
|
nFacesPerCell[own]++;
|
||||||
|
nFacesPerCell[nei]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle coupled faces
|
// Handle coupled faces
|
||||||
|
HashSet<edge, Hash<edge> > cellPair(mesh.nFaces()-mesh.nInternalFaces());
|
||||||
|
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
@ -429,11 +512,18 @@ void Foam::decompositionMethod::calcDistributedCSR
|
|||||||
if (pp.coupled())
|
if (pp.coupled())
|
||||||
{
|
{
|
||||||
label faceI = pp.start();
|
label faceI = pp.start();
|
||||||
|
label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||||
|
|
||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
nCoupledFaces++;
|
label own = faceOwner[faceI];
|
||||||
nFacesPerCell[faceOwner[faceI++]]++;
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
|
if (cellPair.insert(edge(own, globalNei)))
|
||||||
|
{
|
||||||
|
nFacesPerCell[own]++;
|
||||||
|
}
|
||||||
|
faceI++;
|
||||||
|
bFaceI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -459,7 +549,7 @@ void Foam::decompositionMethod::calcDistributedCSR
|
|||||||
// Fill in adjncy
|
// Fill in adjncy
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
adjncy.setSize(2*mesh.nInternalFaces() + nCoupledFaces);
|
adjncy.setSize(freeAdj);
|
||||||
|
|
||||||
nFacesPerCell = 0;
|
nFacesPerCell = 0;
|
||||||
|
|
||||||
@ -469,10 +559,17 @@ void Foam::decompositionMethod::calcDistributedCSR
|
|||||||
label own = faceOwner[faceI];
|
label own = faceOwner[faceI];
|
||||||
label nei = faceNeighbour[faceI];
|
label nei = faceNeighbour[faceI];
|
||||||
|
|
||||||
adjncy[xadj[own] + nFacesPerCell[own]++] = globalCells.toGlobal(nei);
|
if (faceI == masterFace(mesh, own, nei))
|
||||||
adjncy[xadj[nei] + nFacesPerCell[nei]++] = globalCells.toGlobal(own);
|
{
|
||||||
|
adjncy[xadj[own] + nFacesPerCell[own]++] =
|
||||||
|
globalCells.toGlobal(nei);
|
||||||
|
adjncy[xadj[nei] + nFacesPerCell[nei]++] =
|
||||||
|
globalCells.toGlobal(own);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For boundary faces is offsetted coupled neighbour
|
// For boundary faces is offsetted coupled neighbour
|
||||||
|
cellPair.clear();
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
@ -485,9 +582,11 @@ void Foam::decompositionMethod::calcDistributedCSR
|
|||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
label own = faceOwner[faceI];
|
label own = faceOwner[faceI];
|
||||||
adjncy[xadj[own] + nFacesPerCell[own]++] =
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
globalNeighbour[bFaceI];
|
if (cellPair.insert(edge(own, globalNei)))
|
||||||
|
{
|
||||||
|
adjncy[xadj[own] + nFacesPerCell[own]++] = globalNei;
|
||||||
|
}
|
||||||
faceI++;
|
faceI++;
|
||||||
bFaceI++;
|
bFaceI++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,10 @@ protected:
|
|||||||
labelListList& cellCells
|
labelListList& cellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Calculate the minimum face between two neighbouring cells
|
||||||
|
// (usually there is only one)
|
||||||
|
static label masterFace(const polyMesh&, const label, const label);
|
||||||
|
|
||||||
// From mesh to compact row storage format
|
// From mesh to compact row storage format
|
||||||
// (like CompactListList)
|
// (like CompactListList)
|
||||||
static void calcCSR
|
static void calcCSR
|
||||||
|
|||||||
@ -19,6 +19,6 @@ streamLine/streamLine.C
|
|||||||
streamLine/streamLineParticle.C
|
streamLine/streamLineParticle.C
|
||||||
streamLine/streamLineParticleCloud.C
|
streamLine/streamLineParticleCloud.C
|
||||||
streamLine/streamLineFunctionObject.C
|
streamLine/streamLineFunctionObject.C
|
||||||
|
streamLine/vectorIOFieldField.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||||
|
|||||||
@ -80,10 +80,11 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cellId_.setSize(count);
|
cellId_.setSize(count);
|
||||||
|
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Original cell zone size = " << cZone.size()
|
Pout<< "Original cell zone size = " << cZone.size()
|
||||||
<< ", new size = " << count << endl;
|
<< ", new size = " << count << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,8 +110,8 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name_ << ":" << nl
|
||||||
<< " total cells = " << cellId_.size() << nl
|
<< " total cells = " << nCells_ << nl
|
||||||
<< " total volume = " << sum(filterField(mesh().V()))
|
<< " total volume = " << gSum(filterField(mesh().V()))
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
if (operation_ == opWeightedAverage)
|
if (operation_ == opWeightedAverage)
|
||||||
@ -144,7 +145,7 @@ void Foam::fieldValues::cellSource::writeFileHeader()
|
|||||||
{
|
{
|
||||||
outputFilePtr_()
|
outputFilePtr_()
|
||||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||||
<< sourceName_ << nl << "# Cells : " << cellId_.size() << nl
|
<< sourceName_ << nl << "# Cells : " << nCells_ << nl
|
||||||
<< "# Time" << tab << "sum(V)";
|
<< "# Time" << tab << "sum(V)";
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
@ -172,6 +173,7 @@ Foam::fieldValues::cellSource::cellSource
|
|||||||
fieldValue(name, obr, dict, loadFromFiles),
|
fieldValue(name, obr, dict, loadFromFiles),
|
||||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
|
nCells_(0),
|
||||||
cellId_()
|
cellId_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|||||||
@ -133,6 +133,9 @@ protected:
|
|||||||
//- Operation to apply to values
|
//- Operation to apply to values
|
||||||
operationType operation_;
|
operationType operation_;
|
||||||
|
|
||||||
|
//- Global number of cells
|
||||||
|
label nCells_;
|
||||||
|
|
||||||
//- Local list of cell IDs
|
//- Local list of cell IDs
|
||||||
labelList cellId_;
|
labelList cellId_;
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
|||||||
|
|
||||||
faceId_.setSize(fZone.size());
|
faceId_.setSize(fZone.size());
|
||||||
facePatchId_.setSize(fZone.size());
|
facePatchId_.setSize(fZone.size());
|
||||||
flipMap_.setSize(fZone.size());
|
faceSign_.setSize(fZone.size());
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
@ -134,11 +134,11 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
|||||||
{
|
{
|
||||||
if (fZone.flipMap()[i])
|
if (fZone.flipMap()[i])
|
||||||
{
|
{
|
||||||
flipMap_[count] = -1;
|
faceSign_[count] = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flipMap_[count] = 1;
|
faceSign_[count] = 1;
|
||||||
}
|
}
|
||||||
faceId_[count] = faceId;
|
faceId_[count] = faceId;
|
||||||
facePatchId_[count] = facePatchId;
|
facePatchId_[count] = facePatchId;
|
||||||
@ -148,11 +148,12 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
|||||||
|
|
||||||
faceId_.setSize(count);
|
faceId_.setSize(count);
|
||||||
facePatchId_.setSize(count);
|
facePatchId_.setSize(count);
|
||||||
flipMap_.setSize(count);
|
faceSign_.setSize(count);
|
||||||
|
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Original face zone size = " << fZone.size()
|
Pout<< "Original face zone size = " << fZone.size()
|
||||||
<< ", new size = " << count << endl;
|
<< ", new size = " << count << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,13 +188,14 @@ void Foam::fieldValues::faceSource::setPatchFaces()
|
|||||||
|
|
||||||
faceId_.setSize(nFaces);
|
faceId_.setSize(nFaces);
|
||||||
facePatchId_.setSize(nFaces);
|
facePatchId_.setSize(nFaces);
|
||||||
flipMap_.setSize(nFaces);
|
faceSign_.setSize(nFaces);
|
||||||
|
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||||
|
|
||||||
forAll(faceId_, faceI)
|
forAll(faceId_, faceI)
|
||||||
{
|
{
|
||||||
faceId_[faceI] = faceI;
|
faceId_[faceI] = faceI;
|
||||||
facePatchId_[faceI] = patchId;
|
facePatchId_[faceI] = patchId;
|
||||||
flipMap_[faceI] = 1;
|
faceSign_[faceI] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +218,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("faceSource::initiliase()")
|
FatalErrorIn("faceSource::initialise()")
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name_ << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||||
<< nl << " Unknown source type. Valid source types are:"
|
<< nl << " Unknown source type. Valid source types are:"
|
||||||
@ -225,8 +227,10 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name_ << ":" << nl
|
||||||
<< " total faces = " << faceId_.size() << nl
|
<< " total faces = " << nFaces_
|
||||||
<< " total area = " << sum(filterField(mesh().magSf())) << nl;
|
<< nl
|
||||||
|
<< " total area = " << gSum(filterField(mesh().magSf(), false))
|
||||||
|
<< nl;
|
||||||
|
|
||||||
if (operation_ == opWeightedAverage)
|
if (operation_ == opWeightedAverage)
|
||||||
{
|
{
|
||||||
@ -260,7 +264,7 @@ void Foam::fieldValues::faceSource::writeFileHeader()
|
|||||||
{
|
{
|
||||||
outputFilePtr_()
|
outputFilePtr_()
|
||||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||||
<< sourceName_ << nl << "# Faces : " << faceId_.size() << nl
|
<< sourceName_ << nl << "# Faces : " << nFaces_ << nl
|
||||||
<< "# Time" << tab << "sum(magSf)";
|
<< "# Time" << tab << "sum(magSf)";
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
@ -288,9 +292,10 @@ Foam::fieldValues::faceSource::faceSource
|
|||||||
fieldValue(name, obr, dict, loadFromFiles),
|
fieldValue(name, obr, dict, loadFromFiles),
|
||||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
facePatchId_(),
|
facePatchId_(),
|
||||||
flipMap_(),
|
faceSign_(),
|
||||||
weightFieldName_("undefinedWeightedFieldName")
|
weightFieldName_("undefinedWeightedFieldName")
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -326,7 +331,7 @@ void Foam::fieldValues::faceSource::write()
|
|||||||
{
|
{
|
||||||
outputFilePtr_()
|
outputFilePtr_()
|
||||||
<< obr_.time().value() << tab
|
<< obr_.time().value() << tab
|
||||||
<< sum(filterField(mesh().magSf()));
|
<< sum(filterField(mesh().magSf(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fields_, i)
|
forAll(fields_, i)
|
||||||
|
|||||||
@ -53,6 +53,15 @@ Description
|
|||||||
- areaAverage
|
- areaAverage
|
||||||
- areaIntegrate
|
- areaIntegrate
|
||||||
- weightedAverage
|
- weightedAverage
|
||||||
|
- min
|
||||||
|
- max
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- faces on empty patches get ignored
|
||||||
|
- if the field is a volField the faceZone can only consist of boundary
|
||||||
|
faces.
|
||||||
|
- all fields get oriented according to the faceZone (so you might e.g. see
|
||||||
|
negative pressure)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceSource.C
|
faceSource.C
|
||||||
@ -64,7 +73,6 @@ SourceFiles
|
|||||||
|
|
||||||
#include "NamedEnum.H"
|
#include "NamedEnum.H"
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "labelList.H"
|
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
@ -136,14 +144,17 @@ protected:
|
|||||||
//- Operation to apply to values
|
//- Operation to apply to values
|
||||||
operationType operation_;
|
operationType operation_;
|
||||||
|
|
||||||
|
//- Global number of faces
|
||||||
|
label nFaces_;
|
||||||
|
|
||||||
//- Local list of face IDs
|
//- Local list of face IDs
|
||||||
labelList faceId_;
|
labelList faceId_;
|
||||||
|
|
||||||
//- Local list of patch ID per face
|
//- Local list of patch ID per face
|
||||||
labelList facePatchId_;
|
labelList facePatchId_;
|
||||||
|
|
||||||
//- List of +1/-1 representing face flip map
|
//- List of +1/-1 representing face flip map (1 use as is, -1 negate)
|
||||||
labelList flipMap_;
|
labelList faceSign_;
|
||||||
|
|
||||||
//- Weight field name - only used for opWeightedAverage mode
|
//- Weight field name - only used for opWeightedAverage mode
|
||||||
word weightFieldName_;
|
word weightFieldName_;
|
||||||
@ -209,7 +220,7 @@ public:
|
|||||||
inline const labelList& facePatch() const;
|
inline const labelList& facePatch() const;
|
||||||
|
|
||||||
//- Return the list of +1/-1 representing face flip map
|
//- Return the list of +1/-1 representing face flip map
|
||||||
inline const labelList& flipMap() const;
|
inline const labelList& faceSign() const;
|
||||||
|
|
||||||
|
|
||||||
// Function object functions
|
// Function object functions
|
||||||
@ -228,14 +239,16 @@ public:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > filterField
|
tmp<Field<Type> > filterField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||||
|
const bool applyOrientation
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Filter a volume field according to faceIds
|
//- Filter a volume field according to faceIds
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > filterField
|
tmp<Field<Type> > filterField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||||
|
const bool applyOrientation
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -49,9 +49,9 @@ Foam::fieldValues::faceSource::facePatch() const
|
|||||||
|
|
||||||
|
|
||||||
inline const Foam::labelList&
|
inline const Foam::labelList&
|
||||||
Foam::fieldValues::faceSource::flipMap() const
|
Foam::fieldValues::faceSource::faceSign() const
|
||||||
{
|
{
|
||||||
return flipMap_;
|
return faceSign_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -60,14 +60,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::setFieldValues
|
|||||||
|
|
||||||
if (obr_.foundObject<sf>(fieldName))
|
if (obr_.foundObject<sf>(fieldName))
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<sf>(fieldName));
|
return filterField(obr_.lookupObject<sf>(fieldName), true);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<vf>(fieldName))
|
else if (obr_.foundObject<vf>(fieldName))
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<vf>(fieldName));
|
return filterField(obr_.lookupObject<vf>(fieldName), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp<Field<Type> >(new Field<Type>(0.0));
|
return tmp<Field<Type> >(new Field<Type>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,10 +131,13 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
// Get (correctly oriented) field
|
||||||
Field<Type> values = combineFields(setFieldValues<Type>(fieldName));
|
Field<Type> values = combineFields(setFieldValues<Type>(fieldName));
|
||||||
|
|
||||||
scalarField magSf = combineFields(filterField(mesh().magSf()));
|
// Get unoriented magSf
|
||||||
|
scalarField magSf = combineFields(filterField(mesh().magSf(), false));
|
||||||
|
|
||||||
|
// Get (correctly oriented) weighting field
|
||||||
scalarField weightField =
|
scalarField weightField =
|
||||||
combineFields(setFieldValues<scalar>(weightFieldName_));
|
combineFields(setFieldValues<scalar>(weightFieldName_));
|
||||||
|
|
||||||
@ -177,7 +180,8 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||||
|
const bool applyOrientation
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||||
@ -205,8 +209,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
|||||||
<< " Unable to process internal faces for volume field "
|
<< " Unable to process internal faces for volume field "
|
||||||
<< field.name() << nl << abort(FatalError);
|
<< field.name() << nl << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
values[i] *= flipMap_[i];
|
if (applyOrientation)
|
||||||
|
{
|
||||||
|
forAll(values, i)
|
||||||
|
{
|
||||||
|
values[i] *= faceSign_[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tvalues;
|
return tvalues;
|
||||||
@ -216,7 +226,8 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||||
|
const bool applyOrientation
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||||
@ -234,8 +245,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
|||||||
{
|
{
|
||||||
values[i] = field[faceI];
|
values[i] = field[faceI];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
values[i] *= flipMap_[i];
|
if (applyOrientation)
|
||||||
|
{
|
||||||
|
forAll(values, i)
|
||||||
|
{
|
||||||
|
values[i] *= faceSign_[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tvalues;
|
return tvalues;
|
||||||
|
|||||||
@ -32,11 +32,6 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldValue, 0);
|
defineTypeNameAndDebug(fieldValue, 0);
|
||||||
|
|
||||||
defineTemplateTypeNameAndDebug(IOField<vector>, 0);
|
|
||||||
defineTemplateTypeNameAndDebug(IOField<sphericalTensor>, 0);
|
|
||||||
defineTemplateTypeNameAndDebug(IOField<symmTensor>, 0);
|
|
||||||
defineTemplateTypeNameAndDebug(IOField<tensor>, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -206,12 +206,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//#ifdef NoRepository
|
|
||||||
//# include "streamLineTemplates.C"
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,22 +24,14 @@ License
|
|||||||
\*----------------------------------------------------------------------------*/
|
\*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "streamLineParticle.H"
|
#include "streamLineParticle.H"
|
||||||
|
#include "vectorIOFieldField.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(streamLineParticle, 0);
|
|
||||||
|
|
||||||
defineParticleTypeNameAndDebug(streamLineParticle, 0);
|
defineParticleTypeNameAndDebug(streamLineParticle, 0);
|
||||||
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
IOField<vectorField>,
|
|
||||||
"vectorFieldField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -402,13 +394,13 @@ void Foam::streamLineParticle::readFields(Cloud<streamLineParticle>& c)
|
|||||||
);
|
);
|
||||||
c.checkFieldIOobject(c, lifeTime);
|
c.checkFieldIOobject(c, lifeTime);
|
||||||
|
|
||||||
IOField<pointField> sampledPositions
|
vectorIOFieldField sampledPositions
|
||||||
(
|
(
|
||||||
c.fieldIOobject("sampledPositions", IOobject::MUST_READ)
|
c.fieldIOobject("sampledPositions", IOobject::MUST_READ)
|
||||||
);
|
);
|
||||||
c.checkFieldIOobject(c, sampledPositions);
|
c.checkFieldIOobject(c, sampledPositions);
|
||||||
|
|
||||||
// IOField<pointField> sampleVelocity
|
// vectorIOFieldField sampleVelocity
|
||||||
// (
|
// (
|
||||||
// c.fieldIOobject("sampleVelocity", IOobject::MUST_READ)
|
// c.fieldIOobject("sampleVelocity", IOobject::MUST_READ)
|
||||||
// );
|
// );
|
||||||
@ -436,12 +428,12 @@ void Foam::streamLineParticle::writeFields(const Cloud<streamLineParticle>& c)
|
|||||||
c.fieldIOobject("lifeTime", IOobject::NO_READ),
|
c.fieldIOobject("lifeTime", IOobject::NO_READ),
|
||||||
np
|
np
|
||||||
);
|
);
|
||||||
IOField<pointField> sampledPositions
|
vectorIOFieldField sampledPositions
|
||||||
(
|
(
|
||||||
c.fieldIOobject("sampledPositions", IOobject::NO_READ),
|
c.fieldIOobject("sampledPositions", IOobject::NO_READ),
|
||||||
np
|
np
|
||||||
);
|
);
|
||||||
// IOField<pointField> sampleVelocity
|
// vectorIOFieldField sampleVelocity
|
||||||
// (
|
// (
|
||||||
// c.fieldIOobject("sampleVelocity", IOobject::NO_READ),
|
// c.fieldIOobject("sampleVelocity", IOobject::NO_READ),
|
||||||
// np
|
// np
|
||||||
|
|||||||
@ -134,11 +134,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
|
||||||
TypeName("streamLineParticle");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 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/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
vectorFieldField with IO.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vectorIOFieldField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTemplateTypeNameAndDebugWithName
|
||||||
|
(
|
||||||
|
vectorIOFieldField,
|
||||||
|
"vectorFieldField",
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 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/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::vectorIOFieldField
|
||||||
|
|
||||||
|
Description
|
||||||
|
vectorField with IO.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef vectorIOFieldField_H
|
||||||
|
#define vectorIOFieldField_H
|
||||||
|
|
||||||
|
#include "vectorField.H"
|
||||||
|
#include "IOField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOField<vectorField> vectorIOFieldField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -53,9 +53,11 @@ functions
|
|||||||
{
|
{
|
||||||
probes
|
probes
|
||||||
{
|
{
|
||||||
type probes;
|
|
||||||
// Where to load it from
|
// Where to load it from
|
||||||
functionObjectLibs ( "libsampling.so" );
|
functionObjectLibs ( "libsampling.so" );
|
||||||
|
|
||||||
|
type probes;
|
||||||
|
|
||||||
// Name of the directory for probe data
|
// Name of the directory for probe data
|
||||||
name probes;
|
name probes;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user