ENH: motionDiffusivity: construct from fvMesh instead of fvMotionSolver

This commit is contained in:
mattijs
2012-08-24 12:24:46 +01:00
parent 4dd13eb29b
commit cddd11fb80
28 changed files with 138 additions and 185 deletions

View File

@ -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"));
}

View File

@ -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"));
}

View File

@ -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"));
}

View File

@ -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&);

View File

@ -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"));
}

View File

@ -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"));
}

View File

@ -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));
}

View File

@ -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

View File

@ -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
)
{}

View File

@ -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

View File

@ -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
);

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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()
void Foam::inverseVolumeDiffusivity::correct()
{
const fvMesh& mesh = mSolver().mesh();
volScalarField V
(
IOobject
(
"V",
mesh.time().timeName(),
mesh
mesh().time().timeName(),
mesh()
),
mesh,
mesh(),
dimless,
zeroGradientFvPatchScalarField::typeName
);
V.internalField() = mesh.V();
V.internalField() = mesh().V();
V.correctBoundaryConditions();
faceDiffusivity_ = 1.0/fvc::interpolate(V);

View File

@ -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
@ -67,12 +67,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
inverseVolumeDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
inverseVolumeDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor

View File

@ -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
@ -46,13 +46,13 @@ namespace Foam
Foam::exponentialDiffusivity::exponentialDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
motionDiffusivity(mSolver),
motionDiffusivity(mesh),
alpha_(readScalar(mdData)),
basicDiffusivityPtr_(motionDiffusivity::New(mSolver, mdData))
basicDiffusivityPtr_(motionDiffusivity::New(mesh, mdData))
{}

View File

@ -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
@ -74,12 +74,8 @@ public:
// Constructors
//- Construct for the given fvMotionSolver and data Istream
exponentialDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
exponentialDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor

View File

@ -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
@ -46,12 +46,12 @@ namespace Foam
Foam::quadraticDiffusivity::quadraticDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
motionDiffusivity(mSolver),
basicDiffusivityPtr_(motionDiffusivity::New(mSolver, mdData))
motionDiffusivity(mesh),
basicDiffusivityPtr_(motionDiffusivity::New(mesh, mdData))
{}

View File

@ -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
quadraticDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
quadraticDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor

View File

@ -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
@ -36,9 +36,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::motionDiffusivity::motionDiffusivity(const fvMotionSolver& mSolver)
Foam::motionDiffusivity::motionDiffusivity(const fvMesh& mesh)
:
mSolver_(mSolver)
mesh_(mesh)
{}
@ -46,7 +46,7 @@ Foam::motionDiffusivity::motionDiffusivity(const fvMotionSolver& mSolver)
Foam::autoPtr<Foam::motionDiffusivity> Foam::motionDiffusivity::New
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
{
@ -61,7 +61,7 @@ Foam::autoPtr<Foam::motionDiffusivity> Foam::motionDiffusivity::New
{
FatalErrorIn
(
"motionDiffusivity::New(const tetPolyMesh& tetMesh, "
"motionDiffusivity::New(const fvMesh&, "
"const Istream& dict)"
) << "Unknown diffusion type "
<< motionType << nl << nl
@ -70,7 +70,7 @@ Foam::autoPtr<Foam::motionDiffusivity> Foam::motionDiffusivity::New
<< exit(FatalError);
}
return autoPtr<motionDiffusivity>(cstrIter()(mSolver, mdData));
return autoPtr<motionDiffusivity>(cstrIter()(mesh, mdData));
}

View File

@ -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
@ -35,8 +35,8 @@ SourceFiles
#ifndef motionDiffusivity_H
#define motionDiffusivity_H
#include "fvMotionSolver.H"
#include "surfaceFieldsFwd.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,8 +51,8 @@ class motionDiffusivity
{
// Private data
//- Motion solver reference
const fvMotionSolver& mSolver_;
//- mesh reference
const fvMesh& mesh_;
public:
@ -68,10 +68,10 @@ public:
motionDiffusivity,
Istream,
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
),
(mSolver, mdData)
(mesh, mdData)
);
@ -80,15 +80,15 @@ public:
//- Select null constructed
static autoPtr<motionDiffusivity> New
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
);
// Constructors
//- Construct for the given fvMotionSolver
motionDiffusivity(const fvMotionSolver& mSolver);
//- Construct for the given fvMesh
motionDiffusivity(const fvMesh& mesh);
//- Destructor
@ -97,10 +97,10 @@ public:
// Member Functions
//- Return reference to the motion solver
const fvMotionSolver& mSolver() const
//- Return reference to the mesh
const fvMesh& mesh() const
{
return mSolver_;
return mesh_;
}
//- Return diffusivity field

View File

@ -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
@ -27,6 +27,7 @@ License
#include "surfaceInterpolate.H"
#include "zeroGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMotionSolver.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -47,11 +48,11 @@ namespace Foam
Foam::motionDirectionalDiffusivity::motionDirectionalDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream& mdData
)
:
uniformDiffusivity(mSolver, mdData),
uniformDiffusivity(mesh, mdData),
diffusivityVector_(mdData)
{}
@ -66,22 +67,20 @@ Foam::motionDirectionalDiffusivity::~motionDirectionalDiffusivity()
void Foam::motionDirectionalDiffusivity::correct()
{
const fvMesh& mesh = mSolver().mesh();
static bool first = true;
if (!first)
{
const volVectorField& cellMotionU =
mesh.lookupObject<volVectorField>("cellMotionU");
mesh().lookupObject<volVectorField>("cellMotionU");
volVectorField D
(
IOobject
(
"D",
mesh.time().timeName(),
mesh
mesh().time().timeName(),
mesh()
),
diffusivityVector_.y()*vector::one
+ (diffusivityVector_.x() - diffusivityVector_.y())*cellMotionU
@ -90,13 +89,17 @@ void Foam::motionDirectionalDiffusivity::correct()
);
D.correctBoundaryConditions();
const surfaceVectorField n(mesh.Sf()/mesh.magSf());
const surfaceVectorField n(mesh().Sf()/mesh().magSf());
faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n));
}
else
{
first = false;
const_cast<fvMotionSolver&>(mSolver()).solve();
const fvMotionSolver& mSolver =
mesh().lookupObject<fvMotionSolver>("dynamicMeshDict");
const_cast<fvMotionSolver&>(mSolver).solve();
correct();
}
}

View File

@ -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
motionDirectionalDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
motionDirectionalDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor

View File

@ -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::uniformDiffusivity::uniformDiffusivity
(
const fvMotionSolver& mSolver,
const fvMesh& mesh,
Istream&
)
:
motionDiffusivity(mSolver),
motionDiffusivity(mesh),
faceDiffusivity_
(
IOobject
(
"faceDiffusivity",
mSolver.mesh().time().timeName(),
mSolver.mesh(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mSolver.mesh(),
mesh,
dimensionedScalar("1.0", dimless, 1.0)
)
{}

View File

@ -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
uniformDiffusivity
(
const fvMotionSolver& mSolver,
Istream& mdData
);
//- Construct for the given fvMesh and data Istream
uniformDiffusivity(const fvMesh& mesh, Istream& mdData);
//- Destructor