mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
moved code
This commit is contained in:
@ -52,129 +52,24 @@ const NamedEnum<surfaceSlipDisplacementPointPatchVectorField::followMode, 3>
|
|||||||
surfaceSlipDisplacementPointPatchVectorField::followModeNames_;
|
surfaceSlipDisplacementPointPatchVectorField::followModeNames_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::
|
void surfaceSlipDisplacementPointPatchVectorField::calcProjection
|
||||||
surfaceSlipDisplacementPointPatchVectorField
|
|
||||||
(
|
(
|
||||||
const pointPatch& p,
|
vectorField& displacement
|
||||||
const DimensionedField<vector, pointMesh>& iF
|
) const
|
||||||
)
|
|
||||||
:
|
|
||||||
pointPatchVectorField(p, iF),
|
|
||||||
projectMode_(NEAREST),
|
|
||||||
projectDir_(vector::zero),
|
|
||||||
wedgePlane_(-1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField
|
|
||||||
(
|
|
||||||
const pointPatch& p,
|
|
||||||
const DimensionedField<vector, pointMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pointPatchVectorField(p, iF, dict),
|
|
||||||
surfacesDict_(dict.subDict("geometry")),
|
|
||||||
projectMode_(followModeNames_.read(dict.lookup("followMode"))),
|
|
||||||
projectDir_(dict.lookup("projectDirection")),
|
|
||||||
wedgePlane_(readLabel(dict.lookup("wedgePlane"))),
|
|
||||||
frozenPointsZone_(dict.lookup("frozenPointsZone"))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField
|
|
||||||
(
|
|
||||||
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
|
||||||
const pointPatch& p,
|
|
||||||
const DimensionedField<vector, pointMesh>& iF,
|
|
||||||
const pointPatchFieldMapper&
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pointPatchVectorField(p, iF),
|
|
||||||
surfacesDict_(ppf.surfacesDict()),
|
|
||||||
projectMode_(ppf.projectMode()),
|
|
||||||
projectDir_(ppf.projectDir()),
|
|
||||||
wedgePlane_(ppf.wedgePlane()),
|
|
||||||
frozenPointsZone_(ppf.frozenPointsZone())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField
|
|
||||||
(
|
|
||||||
const surfaceSlipDisplacementPointPatchVectorField& ppf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pointPatchVectorField(ppf),
|
|
||||||
surfacesDict_(ppf.surfacesDict()),
|
|
||||||
projectMode_(ppf.projectMode()),
|
|
||||||
projectDir_(ppf.projectDir()),
|
|
||||||
wedgePlane_(ppf.wedgePlane()),
|
|
||||||
frozenPointsZone_(ppf.frozenPointsZone())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField
|
|
||||||
(
|
|
||||||
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
|
||||||
const DimensionedField<vector, pointMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pointPatchVectorField(ppf, iF),
|
|
||||||
surfacesDict_(ppf.surfacesDict()),
|
|
||||||
projectMode_(ppf.projectMode()),
|
|
||||||
projectDir_(ppf.projectDir()),
|
|
||||||
wedgePlane_(ppf.wedgePlane()),
|
|
||||||
frozenPointsZone_(ppf.frozenPointsZone())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const searchableSurfaces&
|
|
||||||
surfaceSlipDisplacementPointPatchVectorField::surfaces() const
|
|
||||||
{
|
|
||||||
if (surfacesPtr_.empty())
|
|
||||||
{
|
|
||||||
surfacesPtr_.reset
|
|
||||||
(
|
|
||||||
new searchableSurfaces
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"abc", // dummy name
|
|
||||||
db().time().constant(), // directory
|
|
||||||
"triSurface", // instance
|
|
||||||
db().time(), // registry
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
surfacesDict_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return surfacesPtr_();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
|
||||||
(
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const polyMesh& mesh = patch().boundaryMesh().mesh()();
|
const polyMesh& mesh = patch().boundaryMesh().mesh()();
|
||||||
|
const pointField& localPoints = patch().localPoints();
|
||||||
|
const labelList& meshPoints = patch().meshPoints();
|
||||||
|
|
||||||
// const scalar deltaT = mesh.time().deltaT().value();
|
//const scalar deltaT = mesh.time().deltaT().value();
|
||||||
|
|
||||||
// Construct large enough vector in direction of projectDir so
|
// Construct large enough vector in direction of projectDir so
|
||||||
// we're guaranteed to hit something.
|
// we're guaranteed to hit something.
|
||||||
|
|
||||||
const scalar projectLen = mesh.bounds().mag();
|
//- Per point projection vector:
|
||||||
|
const scalar projectLen = mag(mesh.bounds().max()-mesh.bounds().min());
|
||||||
|
|
||||||
// For case of fixed projection vector:
|
// For case of fixed projection vector:
|
||||||
vector projectVec;
|
vector projectVec;
|
||||||
@ -184,18 +79,11 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
|||||||
projectVec = projectLen*n;
|
projectVec = projectLen*n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Per point projection vector:
|
|
||||||
|
|
||||||
const pointField& localPoints = patch().localPoints();
|
|
||||||
const labelList& meshPoints = patch().meshPoints();
|
|
||||||
|
|
||||||
vectorField displacement(this->patchInternalField());
|
|
||||||
|
|
||||||
|
|
||||||
// Get fixed points (bit of a hack)
|
// Get fixed points (bit of a hack)
|
||||||
const pointZone* zonePtr = NULL;
|
const pointZone* zonePtr = NULL;
|
||||||
|
|
||||||
if (frozenPointsZone_.size())
|
if (frozenPointsZone_.size() > 0)
|
||||||
{
|
{
|
||||||
const pointZoneMesh& pZones = mesh.pointZones();
|
const pointZoneMesh& pZones = mesh.pointZones();
|
||||||
|
|
||||||
@ -215,15 +103,14 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
|||||||
const pointField& points0 = motionSolver.points0();
|
const pointField& points0 = motionSolver.points0();
|
||||||
|
|
||||||
|
|
||||||
//XXXXXX
|
|
||||||
|
|
||||||
|
|
||||||
pointField start(meshPoints.size());
|
pointField start(meshPoints.size());
|
||||||
forAll(start, i)
|
forAll(start, i)
|
||||||
{
|
{
|
||||||
start[i] = points0[meshPoints[i]] + displacement[i];
|
start[i] = points0[meshPoints[i]] + displacement[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label nNotProjected = 0;
|
||||||
|
|
||||||
if (projectMode_ == NEAREST)
|
if (projectMode_ == NEAREST)
|
||||||
{
|
{
|
||||||
List<pointIndexHit> nearest;
|
List<pointIndexHit> nearest;
|
||||||
@ -251,10 +138,15 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pout<< " point:" << meshPoints[i]
|
nNotProjected++;
|
||||||
<< " coord:" << localPoints[i]
|
|
||||||
<< " did not find any surface within " << projectLen
|
if (debug)
|
||||||
<< endl;
|
{
|
||||||
|
Pout<< " point:" << meshPoints[i]
|
||||||
|
<< " coord:" << localPoints[i]
|
||||||
|
<< " did not find any surface within " << projectLen
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,17 +272,154 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pout<< " point:" << meshPoints[i]
|
nNotProjected++;
|
||||||
<< " coord:" << localPoints[i]
|
|
||||||
<< " did not find any intersection between ray from "
|
if (debug)
|
||||||
<< start[i]-projectVecs[i]
|
{
|
||||||
<< " to " << start[i]+projectVecs[i]
|
Pout<< " point:" << meshPoints[i]
|
||||||
<< endl;
|
<< " coord:" << localPoints[i]
|
||||||
|
<< " did not find any intersection between"
|
||||||
|
<< " ray from " << start[i]-projectVecs[i]
|
||||||
|
<< " to " << start[i]+projectVecs[i] << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reduce(nNotProjected, sumOp<label>());
|
||||||
|
|
||||||
|
if (nNotProjected > 0)
|
||||||
|
{
|
||||||
|
Info<< "surfaceSlipDisplacement :"
|
||||||
|
<< " on patch " << patch().name()
|
||||||
|
<< " did not project " << nNotProjected
|
||||||
|
<< " out of " << returnReduce(localPoints.size(), sumOp<label>())
|
||||||
|
<< " points." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchVectorField(p, iF),
|
||||||
|
projectMode_(NEAREST),
|
||||||
|
projectDir_(vector::zero),
|
||||||
|
wedgePlane_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchVectorField(p, iF, dict),
|
||||||
|
surfacesDict_(dict.subDict("geometry")),
|
||||||
|
projectMode_(followModeNames_.read(dict.lookup("followMode"))),
|
||||||
|
projectDir_(dict.lookup("projectDirection")),
|
||||||
|
wedgePlane_(readLabel(dict.lookup("wedgePlane"))),
|
||||||
|
frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const pointPatchFieldMapper&
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchVectorField(p, iF),
|
||||||
|
surfacesDict_(ppf.surfacesDict()),
|
||||||
|
projectMode_(ppf.projectMode()),
|
||||||
|
projectDir_(ppf.projectDir()),
|
||||||
|
wedgePlane_(ppf.wedgePlane()),
|
||||||
|
frozenPointsZone_(ppf.frozenPointsZone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const surfaceSlipDisplacementPointPatchVectorField& ppf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchVectorField(ppf),
|
||||||
|
surfacesDict_(ppf.surfacesDict()),
|
||||||
|
projectMode_(ppf.projectMode()),
|
||||||
|
projectDir_(ppf.projectDir()),
|
||||||
|
wedgePlane_(ppf.wedgePlane()),
|
||||||
|
frozenPointsZone_(ppf.frozenPointsZone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointPatchVectorField(ppf, iF),
|
||||||
|
surfacesDict_(ppf.surfacesDict()),
|
||||||
|
projectMode_(ppf.projectMode()),
|
||||||
|
projectDir_(ppf.projectDir()),
|
||||||
|
wedgePlane_(ppf.wedgePlane()),
|
||||||
|
frozenPointsZone_(ppf.frozenPointsZone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const searchableSurfaces&
|
||||||
|
surfaceSlipDisplacementPointPatchVectorField::surfaces() const
|
||||||
|
{
|
||||||
|
if (surfacesPtr_.empty())
|
||||||
|
{
|
||||||
|
surfacesPtr_.reset
|
||||||
|
(
|
||||||
|
new searchableSurfaces
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"abc", // dummy name
|
||||||
|
db().time().constant(), // directory
|
||||||
|
"triSurface", // instance
|
||||||
|
db().time(), // registry
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surfacesDict_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return surfacesPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vectorField displacement(this->patchInternalField());
|
||||||
|
|
||||||
|
// Calculate displacement to project points onto surface
|
||||||
|
calcProjection(displacement);
|
||||||
|
|
||||||
// Get internal field to insert values into
|
// Get internal field to insert values into
|
||||||
Field<vector>& iF = const_cast<Field<vector>&>(this->internalField());
|
Field<vector>& iF = const_cast<Field<vector>&>(this->internalField());
|
||||||
|
|
||||||
@ -412,8 +441,11 @@ void surfaceSlipDisplacementPointPatchVectorField::write(Ostream& os) const
|
|||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("wedgePlane") << wedgePlane_
|
os.writeKeyword("wedgePlane") << wedgePlane_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("frozenPointsZone") << frozenPointsZone_
|
if (frozenPointsZone_ != word::null)
|
||||||
<< token::END_STATEMENT << nl;
|
{
|
||||||
|
os.writeKeyword("frozenPointsZone") << frozenPointsZone_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,9 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Calculate displacement to project onto surface
|
||||||
|
void calcProjection(vectorField& displacement) const;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
|
void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user