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_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
void surfaceSlipDisplacementPointPatchVectorField::calcProjection
|
||||
(
|
||||
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.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
|
||||
)
|
||||
vectorField& displacement
|
||||
) const
|
||||
{
|
||||
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
|
||||
// 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:
|
||||
vector projectVec;
|
||||
@ -184,18 +79,11 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
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)
|
||||
const pointZone* zonePtr = NULL;
|
||||
|
||||
if (frozenPointsZone_.size())
|
||||
if (frozenPointsZone_.size() > 0)
|
||||
{
|
||||
const pointZoneMesh& pZones = mesh.pointZones();
|
||||
|
||||
@ -215,15 +103,14 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
const pointField& points0 = motionSolver.points0();
|
||||
|
||||
|
||||
//XXXXXX
|
||||
|
||||
|
||||
pointField start(meshPoints.size());
|
||||
forAll(start, i)
|
||||
{
|
||||
start[i] = points0[meshPoints[i]] + displacement[i];
|
||||
}
|
||||
|
||||
label nNotProjected = 0;
|
||||
|
||||
if (projectMode_ == NEAREST)
|
||||
{
|
||||
List<pointIndexHit> nearest;
|
||||
@ -250,6 +137,10 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
- points0[meshPoints[i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
nNotProjected++;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " point:" << meshPoints[i]
|
||||
<< " coord:" << localPoints[i]
|
||||
@ -258,6 +149,7 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do tests on all points. Combine later on.
|
||||
@ -379,17 +271,154 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
displacement[i] = interPt.rawPoint()-points0[meshPoints[i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
nNotProjected++;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " point:" << meshPoints[i]
|
||||
<< " coord:" << localPoints[i]
|
||||
<< " did not find any intersection between ray from "
|
||||
<< start[i]-projectVecs[i]
|
||||
<< " to " << start[i]+projectVecs[i]
|
||||
<< endl;
|
||||
<< " 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
|
||||
Field<vector>& iF = const_cast<Field<vector>&>(this->internalField());
|
||||
@ -412,8 +441,11 @@ void surfaceSlipDisplacementPointPatchVectorField::write(Ostream& os) const
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("wedgePlane") << wedgePlane_
|
||||
<< token::END_STATEMENT << nl;
|
||||
if (frozenPointsZone_ != word::null)
|
||||
{
|
||||
os.writeKeyword("frozenPointsZone") << frozenPointsZone_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,6 +107,9 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate displacement to project onto surface
|
||||
void calcProjection(vectorField& displacement) const;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user