mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
wallDist: separate the meshWaveWallDist from the wallDist interface
In preparation for run-time selectable methods
This commit is contained in:
@ -47,8 +47,6 @@ const Foam::volScalarField& Foam::wallDependentModel::yWall() const
|
||||
{
|
||||
if (!mesh_.foundObject<volScalarField>("yWall"))
|
||||
{
|
||||
wallDist w(mesh_);
|
||||
|
||||
volScalarField* yPtr
|
||||
(
|
||||
new volScalarField
|
||||
@ -62,7 +60,7 @@ const Foam::volScalarField& Foam::wallDependentModel::yWall() const
|
||||
IOobject::NO_WRITE,
|
||||
true
|
||||
),
|
||||
w.y()
|
||||
wallDist(mesh_).y()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
if (timeI == 0 || state != fvMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Calculating wall distance\n" << endl;
|
||||
wallDist y(mesh, true);
|
||||
wallDist y(mesh);
|
||||
Info<< "Writing wall distance to field "
|
||||
<< y.name() << nl << endl;
|
||||
y.write();
|
||||
|
||||
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
||||
if (timeI == 0 || state != fvMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Calculating wall distance\n" << endl;
|
||||
wallDist y(mesh, true);
|
||||
wallDist y(mesh);
|
||||
Info<< "Writing wall distance to field " << y.name() << nl << endl;
|
||||
y.write();
|
||||
}
|
||||
|
||||
@ -38,13 +38,14 @@ $(derivedFvPatches)/regionCoupled/regionCoupledWallFvPatch.C
|
||||
|
||||
|
||||
wallDist = fvMesh/wallDist
|
||||
$(wallDist)/patchDist.C
|
||||
$(wallDist)/wallPointYPlus/wallPointYPlus.C
|
||||
$(wallDist)/nearWallDistNoSearch.C
|
||||
$(wallDist)/nearWallDist.C
|
||||
$(wallDist)/wallDist.C
|
||||
$(wallDist)/reflectionVectors.C
|
||||
$(wallDist)/wallDistReflection.C
|
||||
$(wallDist)/nearWallDist/nearWallDistNoSearch.C
|
||||
$(wallDist)/nearWallDist/nearWallDist.C
|
||||
$(wallDist)/wallDist/wallDist.C
|
||||
$(wallDist)/meshWaveWallDist/patchDist.C
|
||||
$(wallDist)/meshWaveWallDist/meshWaveWallDist.C
|
||||
$(wallDist)/wallDistReflection/reflectionVectors.C
|
||||
$(wallDist)/wallDistReflection/wallDistReflection.C
|
||||
|
||||
|
||||
fvMeshMapper = fvMesh/fvMeshMapper
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "meshWaveWallDist.H"
|
||||
#include "fvMesh.H"
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshWaveWallDist::meshWaveWallDist
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const bool correctWalls
|
||||
)
|
||||
:
|
||||
patchDist
|
||||
(
|
||||
mesh,
|
||||
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(),
|
||||
correctWalls
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshWaveWallDist::~meshWaveWallDist()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::meshWaveWallDist
|
||||
|
||||
Description
|
||||
Specialisation of patchDist for wall distance calculation
|
||||
|
||||
SourceFiles
|
||||
meshWaveWallDist.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef meshWaveWallDist_H
|
||||
#define meshWaveWallDist_H
|
||||
|
||||
#include "patchDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class meshWaveWallDist Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class meshWaveWallDist
|
||||
:
|
||||
public patchDist
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
meshWaveWallDist(const meshWaveWallDist&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const meshWaveWallDist&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and flag whether or not to correct wall.
|
||||
// Calculate for all cells. correctWalls : correct wall (face&point)
|
||||
// cells for correct distance, searching neighbours.
|
||||
meshWaveWallDist
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const bool correctWalls = true
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~meshWaveWallDist();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,54 +37,58 @@ Foam::patchDist::patchDist
|
||||
const bool correctWalls
|
||||
)
|
||||
:
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"y",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("y", dimLength, GREAT)
|
||||
),
|
||||
mesh_(mesh),
|
||||
patchIDs_(patchIDs),
|
||||
correctWalls_(correctWalls),
|
||||
nUnset_(0)
|
||||
{
|
||||
patchDist::correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::patchDist::~patchDist()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::patchDist::correct()
|
||||
Foam::tmp<Foam::volScalarField> Foam::patchDist::y() const
|
||||
{
|
||||
tmp<volScalarField> ty
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"y",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("y", dimLength, GREAT)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& y = ty();
|
||||
|
||||
// Calculate distance starting from patch faces
|
||||
patchWave wave(mesh(), patchIDs_, correctWalls_);
|
||||
patchWave wave(mesh_, patchIDs_, correctWalls_);
|
||||
|
||||
// Transfer cell values from wave into *this
|
||||
transfer(wave.distance());
|
||||
y.transfer(wave.distance());
|
||||
|
||||
// Transfer values on patches into boundaryField of *this
|
||||
forAll(boundaryField(), patchI)
|
||||
forAll(y.boundaryField(), patchI)
|
||||
{
|
||||
if (!isA<emptyFvPatchScalarField>(boundaryField()[patchI]))
|
||||
if (!isA<emptyFvPatchScalarField>(y.boundaryField()[patchI]))
|
||||
{
|
||||
scalarField& waveFld = wave.patchDistance()[patchI];
|
||||
|
||||
boundaryField()[patchI].transfer(waveFld);
|
||||
y.boundaryField()[patchI].transfer(waveFld);
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer number of unset values
|
||||
nUnset_ = wave.nUnset();
|
||||
|
||||
return ty;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,14 +25,12 @@ Class
|
||||
Foam::patchDist
|
||||
|
||||
Description
|
||||
Calculation of distance to nearest patch for all cells and boundary.
|
||||
Uses meshWave to do actual calculation.
|
||||
Calculation of distance to nearest patch for all cells and boundary
|
||||
using meshWave.
|
||||
|
||||
Distance correction:
|
||||
|
||||
if correctWalls = true:
|
||||
For each cell with face on wall calculate the true nearest point
|
||||
(by triangle decomposition) on that face and do the same for that face's
|
||||
Distance correction (correctWalls = true):
|
||||
For each cell with face on wall calculate the true nearest point (by
|
||||
triangle decomposition) on that face and do the same for that face's
|
||||
pointNeighbours. This will find the true nearest distance in almost all
|
||||
cases. Only very skewed cells or cells close to another wall might be
|
||||
missed.
|
||||
@ -40,19 +38,6 @@ Description
|
||||
For each cell with only one point on wall the same is done except now it
|
||||
takes the pointFaces() of the wall point to look for the nearest point.
|
||||
|
||||
Note
|
||||
|
||||
correct() : for now does complete recalculation. (which usually is
|
||||
ok since mesh is smoothed). However for topology change where geometry
|
||||
in most of domain does not change you could think of starting from the
|
||||
old cell values. Tried but not done since:
|
||||
- meshWave would have to be called with old cellInfo.
|
||||
This is List\<wallInfo\> of nCells.
|
||||
- cannot construct from distance (y_) only since we don't know a value
|
||||
for origin_. (origin_ = GREAT already used to denote illegal value.)
|
||||
- so we would have to store a List\<wallInfo\> which unfortunately does
|
||||
not get resized/mapped automatically upon mesh changes.
|
||||
|
||||
SourceFiles
|
||||
patchDist.C
|
||||
|
||||
@ -75,23 +60,20 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class patchDist
|
||||
:
|
||||
public volScalarField
|
||||
{
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Data
|
||||
|
||||
//- Reference to the mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Set of patch IDs
|
||||
labelHashSet patchIDs_;
|
||||
const labelHashSet patchIDs_;
|
||||
|
||||
//- Do accurate distance calculation for near-wall cells.
|
||||
bool correctWalls_;
|
||||
const bool correctWalls_;
|
||||
|
||||
//- Number of unset cells and faces.
|
||||
label nUnset_;
|
||||
mutable label nUnset_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -118,24 +100,16 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~patchDist();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const volScalarField& y() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
//- Calculate and return the distance to nearest patch
|
||||
// for all cells and boundary
|
||||
tmp<volScalarField> y() const;
|
||||
|
||||
label nUnset() const
|
||||
{
|
||||
return nUnset_;
|
||||
}
|
||||
|
||||
//- Correct for mesh geom/topo changes
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
@ -24,24 +24,26 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "wallDist.H"
|
||||
#include "fvMesh.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "meshWaveWallDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wallDist::wallDist
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const bool correctWalls
|
||||
)
|
||||
Foam::wallDist::wallDist(const fvMesh& mesh)
|
||||
:
|
||||
patchDist
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"y",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(),
|
||||
correctWalls
|
||||
dimensionedScalar("y", dimLength, GREAT)
|
||||
)
|
||||
{}
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -50,4 +52,12 @@ Foam::wallDist::~wallDist()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::wallDist::correct()
|
||||
{
|
||||
volScalarField::operator=(meshWaveWallDist(mesh()).y());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -35,26 +35,21 @@ SourceFiles
|
||||
#ifndef wallDist_H
|
||||
#define wallDist_H
|
||||
|
||||
#include "patchDist.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallDist Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallDist
|
||||
:
|
||||
public patchDist
|
||||
public volScalarField
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -68,18 +63,23 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and flag whether or not to correct wall.
|
||||
// Calculate for all cells. correctWalls : correct wall (face&point)
|
||||
// cells for correct distance, searching neighbours.
|
||||
wallDist
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const bool correctWalls = true
|
||||
);
|
||||
//- Construct from mesh
|
||||
wallDist(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~wallDist();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const volScalarField& y() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Correct for mesh changes
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -60,9 +60,6 @@ class wallPointYPlus
|
||||
:
|
||||
public wallPointData<scalar>
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Evaluate distance to point. Update distSqr, origin from whomever
|
||||
@ -77,6 +74,7 @@ private:
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
@ -154,7 +152,6 @@ inline bool contiguous<wallPointYPlus>()
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -68,7 +68,7 @@ void contactAngleForce::initialise()
|
||||
|
||||
patchDist dist(owner_.regionMesh(), patchIDs);
|
||||
|
||||
mask_ = pos(dist - dimensionedScalar("dLim", dimLength, dLim));
|
||||
mask_ = pos(dist.y() - dimensionedScalar("dLim", dimLength, dLim));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user