Commit cddd11fb authored by mattijs's avatar mattijs
Browse files

ENH: motionDiffusivity: construct from fvMesh instead of fvMotionSolver

parent 4dd13eb2
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -91,7 +91,7 @@ Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
)
{}
......@@ -128,7 +128,7 @@ Foam::displacementSBRStressFvMotionSolver::curPoints() const
void Foam::displacementSBRStressFvMotionSolver::solve()
{
// The points have moved so before interpolation update
// the fvMotionSolver accordingly
// the motionSolver accordingly
movePoints(fvMesh_.points());
diffusivityPtr_->correct();
......@@ -197,7 +197,7 @@ void Foam::displacementSBRStressFvMotionSolver::updateMesh
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -141,7 +141,7 @@ displacementComponentLaplacianFvMotionSolver
pointLocation_(NULL),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
),
frozenPointsZone_
(
......@@ -388,7 +388,7 @@ void Foam::displacementComponentLaplacianFvMotionSolver::updateMesh
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -90,7 +90,7 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
pointLocation_(NULL),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
),
frozenPointsZone_
(
......@@ -245,7 +245,7 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -109,7 +109,7 @@ public:
virtual void solve() = 0;
//- Update the pointMesh corresponding to the new points
void movePoints(const pointField&);
virtual void movePoints(const pointField&);
//- Update the mesh corresponding to given map
virtual void updateMesh(const mapPolyMesh&);
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -89,7 +89,7 @@ velocityComponentLaplacianFvMotionSolver
),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
)
{
if (cmptName_ == "x")
......@@ -181,7 +181,7 @@ void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -86,7 +86,7 @@ Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
)
{}
......@@ -151,7 +151,7 @@ void Foam::velocityLaplacianFvMotionSolver::updateMesh
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New(mesh(), lookup("diffusivity"));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -45,11 +45,11 @@ namespace Foam
Foam::directionalDiffusivity::directionalDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData),
uniformDiffusivity(mesh, mdData),
diffusivityVector_(mdData)
{
correct();
......@@ -66,9 +66,7 @@ Foam::directionalDiffusivity::~directionalDiffusivity()
void Foam::directionalDiffusivity::correct()
{
const fvMesh& mesh = mSolver().mesh();
const surfaceVectorField n(mesh.Sf()/mesh.magSf());
const surfaceVectorField n(mesh().Sf()/mesh().magSf());
faceDiffusivity_ == (n & cmptMultiply(diffusivityVector_, n));
}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -72,12 +72,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
directionalDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
directionalDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -45,22 +45,22 @@ namespace Foam
Foam::fileDiffusivity::fileDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
motionDiffusivity(mSolver),
motionDiffusivity(mesh),
faceDiffusivity_
(
IOobject
(
word(mdData),
mSolver.mesh().time().constant(),
mSolver.mesh(),
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mSolver.mesh()
mesh
)
{}
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -78,12 +78,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
fileDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
fileDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -49,11 +49,11 @@ namespace Foam
Foam::inverseDistanceDiffusivity::inverseDistanceDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData),
uniformDiffusivity(mesh, mdData),
patchNames_(mdData)
{
correct();
......@@ -70,37 +70,33 @@ Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity()
Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const
{
const polyMesh& mesh = mSolver().mesh();
labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_));
labelHashSet patchSet(mesh().boundaryMesh().patchSet(patchNames_));
if (patchSet.size())
{
return tmp<scalarField>
(
new scalarField(patchWave(mesh, patchSet, false).distance())
new scalarField(patchWave(mesh(), patchSet, false).distance())
);
}
else
{
return tmp<scalarField>(new scalarField(mesh.nCells(), 1.0));
return tmp<scalarField>(new scalarField(mesh().nCells(), 1.0));
}
}
void Foam::inverseDistanceDiffusivity::correct()
{
const fvMesh& mesh = mSolver().mesh();
volScalarField y_
(
IOobject
(
"y",
mesh.time().timeName(),
mesh
mesh().time().timeName(),
mesh()
),
mesh,
mesh(),
dimless,
zeroGradientFvPatchScalarField::typeName
);
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -78,12 +78,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
inverseDistanceDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
inverseDistanceDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -48,11 +48,11 @@ namespace Foam
Foam::inverseFaceDistanceDiffusivity::inverseFaceDistanceDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData),
uniformDiffusivity(mesh, mdData),
patchNames_(mdData)
{
correct();
......@@ -69,8 +69,7 @@ Foam::inverseFaceDistanceDiffusivity::~inverseFaceDistanceDiffusivity()
void Foam::inverseFaceDistanceDiffusivity::correct()
{
const polyMesh& mesh = mSolver().mesh();
const polyBoundaryMesh& bdry = mesh.boundaryMesh();
const polyBoundaryMesh& bdry = mesh().boundaryMesh();
labelHashSet patchSet(bdry.size());
......@@ -112,16 +111,16 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
MeshWave<wallPoint> waveInfo
(
mesh,
mesh(),
changedFaces,
faceDist,
mesh.globalData().nTotalCells()+1 // max iterations
mesh().globalData().nTotalCells()+1 // max iterations
);
const List<wallPoint>& faceInfo = waveInfo.allFaceInfo();
const List<wallPoint>& cellInfo = waveInfo.allCellInfo();
for (label faceI=0; faceI<mesh.nInternalFaces(); faceI++)
for (label faceI=0; faceI<mesh().nInternalFaces(); faceI++)
{
scalar dist = faceInfo[faceI].distSqr();
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -73,12 +73,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
inverseFaceDistanceDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
inverseFaceDistanceDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor
......
......@@ -48,11 +48,11 @@ namespace Foam
Foam::inversePointDistanceDiffusivity::inversePointDistanceDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData),
uniformDiffusivity(mesh, mdData),
patchNames_(mdData)
{
correct();
......@@ -69,8 +69,7 @@ Foam::inversePointDistanceDiffusivity::~inversePointDistanceDiffusivity()
void Foam::inversePointDistanceDiffusivity::correct()
{
const polyMesh& mesh = mSolver().mesh();
const polyBoundaryMesh& bdry = mesh.boundaryMesh();
const polyBoundaryMesh& bdry = mesh().boundaryMesh();
labelHashSet patchSet(bdry.patchSet(patchNames_));
......@@ -82,8 +81,8 @@ void Foam::inversePointDistanceDiffusivity::correct()
}
// Distance to wall on points and edges.
List<pointEdgePoint> pointWallDist(mesh.nPoints());
List<pointEdgePoint> edgeWallDist(mesh.nEdges());
List<pointEdgePoint> pointWallDist(mesh().nPoints());
List<pointEdgePoint> edgeWallDist(mesh().nEdges());
int dummyTrackData = 0;
......@@ -110,7 +109,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
// Not yet seeded
seedInfo[nPatchEdges] = pointEdgePoint
(
mesh.points()[pointI],
mesh().points()[pointI],
0.0
);
seedPoints[nPatchEdges] = pointI;
......@@ -126,21 +125,21 @@ void Foam::inversePointDistanceDiffusivity::correct()
// Do calculations
PointEdgeWave<pointEdgePoint> waveInfo
(
mesh,
mesh(),
seedPoints,
seedInfo,
pointWallDist,
edgeWallDist,
mesh.globalData().nTotalPoints(),// max iterations
mesh().globalData().nTotalPoints(),// max iterations
dummyTrackData
);
}
for (label faceI=0; faceI<mesh.nInternalFaces(); faceI++)
for (label faceI=0; faceI<mesh().nInternalFaces(); faceI++)
{
const face& f = mesh.faces()[faceI];
const face& f = mesh().faces()[faceI];
scalar dist = 0;
......@@ -163,7 +162,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(bfld, i)
{
const cell& ownFaces = mesh.cells()[faceCells[i]];
const cell& ownFaces = mesh().cells()[faceCells[i]];
labelHashSet cPoints(4*ownFaces.size());
......@@ -171,7 +170,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(ownFaces, ownFaceI)
{
const face& f = mesh.faces()[ownFaces[ownFaceI]];
const face& f = mesh().faces()[ownFaces[ownFaceI]];
forAll(f, fp)
{
......@@ -192,7 +191,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(bfld, i)
{
const face& f = mesh.faces()[start+i];
const face& f = mesh().faces()[start+i];
scalar dist = 0;
......
......@@ -73,12 +73,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
inversePointDistanceDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
inversePointDistanceDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor
......
......@@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -49,11 +49,11 @@ namespace Foam
Foam::inverseVolumeDiffusivity::inverseVolumeDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData)
uniformDiffusivity(mesh, mdData)
{
correct();
}
......@@ -69,22 +69,20 @@ Foam::inverseVolumeDiffusivity::~inverseVolumeDiffusivity()