Commit 4b30be42 authored by william's avatar william Committed by Andrew Heather
Browse files

BUG: mantis #1365: switched to using wall reflection to calculate wall...

BUG: mantis #1365: switched to using wall reflection to calculate wall normals, and added caching of the wall values
parent 8cc4cab3
......@@ -56,4 +56,6 @@ aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C
aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C
aspectRatioModels/Wellek/Wellek.C
wallDependentModel/wallDependentModel.C
LIB = $(FOAM_LIBBIN)/libcompressibleEulerianInterfacialModels
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/transportModel \
......
......@@ -53,7 +53,7 @@ Foam::aspectRatioModels::TomiyamaAspectRatio::TomiyamaAspectRatio
)
:
VakhrushevEfremov(dict, pair),
yWall_(pair.phase1().mesh().lookupObject<volScalarField>("yWall"))
wallDependentModel(pair.phase1().mesh())
{}
......@@ -72,7 +72,7 @@ Foam::aspectRatioModels::TomiyamaAspectRatio::E() const
VakhrushevEfremov::E()
*max
(
scalar(1) - 0.35*yWall_/pair_.dispersed().d(),
scalar(1) - 0.35*yWall()/pair_.dispersed().d(),
scalar(0.65)
);
}
......
......@@ -45,6 +45,7 @@ SourceFiles
#define TomiyamaAspectRatio_H
#include "VakhrushevEfremov.H"
#include "wallDependentModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -59,16 +60,9 @@ namespace aspectRatioModels
class TomiyamaAspectRatio
:
public VakhrushevEfremov
public VakhrushevEfremov,
public wallDependentModel
{
private:
// Private data
//- Wall distance
const volScalarField& yWall_;
public:
//- Runtime type information
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenCFD Ltd.
\\/ 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 "wallDependentModel.H"
#include "wallDist.H"
#include "wallDistReflection.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallDependentModel::wallDependentModel(const fvMesh& mesh)
:
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallDependentModel::~wallDependentModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::wallDependentModel::yWall() const
{
if (!mesh_.foundObject<volScalarField>("yWall"))
{
wallDist w(mesh_);
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
w.y()
)
);
yPtr->checkIn();
}
return mesh_.lookupObject<volScalarField>("yWall");
}
const Foam::volVectorField& Foam::wallDependentModel::nWall() const
{
if (!mesh_.foundObject<volVectorField>("nWall"))
{
wallDistReflection w(mesh_);
if (!mesh_.foundObject<volScalarField>("yWall"))
{
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
w.y()
)
);
yPtr->checkIn();
}
volVectorField* nPtr
(
new volVectorField
(
IOobject
(
"nWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
w.n()
)
);
nPtr->checkIn();
}
return mesh_.lookupObject<volVectorField>("nWall");
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenCFD Ltd.
\\/ 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::wallDependentModel
Description
A class which provides on-demand creation and caching of wall distance and
wall normal fields for use by multiple models.
SourceFiles
wallDependentModel.C
\*---------------------------------------------------------------------------*/
#ifndef wallDependentModel_H
#define wallDependentModel_H
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class wallDependentModel Declaration
\*---------------------------------------------------------------------------*/
class wallDependentModel
{
// Private data
//- Reference to the mesh
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
wallDependentModel(const wallDependentModel&);
//- Disallow default bitwise assignment
void operator=(const wallDependentModel&);
public:
// Constructors
//- Construct from a mesh
wallDependentModel(const fvMesh& mesh);
//- Destructor
virtual ~wallDependentModel();
// Member Functions
// Return the wall distance, creating and storing it if necessary
const volScalarField& yWall() const;
// Return the wall normal, creating and storing it if necessary
const volVectorField& nWall() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -70,19 +70,19 @@ Foam::wallLubricationModels::Antal::~Antal()
Foam::tmp<Foam::volVectorField> Foam::wallLubricationModels::Antal::F() const
{
volVectorField Ur(pair_.Ur());
volVectorField nWall(- fvc::grad(yWall_));
nWall /= mag(nWall) + SMALL;
const volVectorField& n(nWall());
return
max
(
dimensionedScalar("zero", dimless/dimLength, 0),
Cw1_/pair_.dispersed().d() + Cw2_/yWall_
Cw1_/pair_.dispersed().d() + Cw2_/yWall()
)
*pair_.dispersed()
*pair_.continuous().rho()
*magSqr(Ur - (Ur & nWall)*nWall)
*nWall;
*magSqr(Ur - (Ur & n)*n)
*n;
}
......
......@@ -71,11 +71,12 @@ Foam::wallLubricationModels::Frank::~Frank()
Foam::tmp<Foam::volVectorField> Foam::wallLubricationModels::Frank::F() const
{
volVectorField Ur(pair_.Ur());
volVectorField nWall(- fvc::grad(yWall_));
nWall /= mag(nWall) + SMALL;
const volVectorField& n(nWall());
const volScalarField& y(yWall());
volScalarField Eo(pair_.Eo());
volScalarField yTilde(yWall_/(Cwc_*pair_.dispersed().d()));
volScalarField yTilde(y/(Cwc_*pair_.dispersed().d()));
return
(
......@@ -86,12 +87,12 @@ Foam::tmp<Foam::volVectorField> Foam::wallLubricationModels::Frank::F() const
*max
(
dimensionedScalar("zero", dimless/dimLength, 0.0),
(1.0 - yTilde)/(Cwd_*yWall_*pow(yTilde, p_ - 1.0))
(1.0 - yTilde)/(Cwd_*y*pow(yTilde, p_ - 1.0))
)
*pair_.dispersed()
*pair_.continuous().rho()
*magSqr(Ur - (Ur & nWall)*nWall)
*nWall;
*magSqr(Ur - (Ur & n)*n)
*n;
}
......
......@@ -70,8 +70,9 @@ Foam::tmp<Foam::volVectorField>
Foam::wallLubricationModels::TomiyamaWallLubrication::F() const
{
volVectorField Ur(pair_.Ur());
volVectorField nWall(- fvc::grad(yWall_));
nWall /= mag(nWall) + SMALL;
const volVectorField& n(nWall());
const volScalarField& y(yWall());
volScalarField Eo(pair_.Eo());
......@@ -84,13 +85,13 @@ Foam::wallLubricationModels::TomiyamaWallLubrication::F() const
*0.5
*pair_.dispersed().d()
*(
1/sqr(yWall_)
- 1/sqr(D_ - yWall_)
1/sqr(y)
- 1/sqr(D_ - y)
)
*pair_.dispersed()
*pair_.continuous().rho()
*magSqr(Ur - (Ur & nWall)*nWall)
*nWall;
*magSqr(Ur - (Ur & n)*n)
*n;
}
......
......@@ -45,8 +45,8 @@ Foam::wallLubricationModel::wallLubricationModel
const phasePair& pair
)
:
pair_(pair),
yWall_(pair.phase1().mesh().lookupObject<volScalarField>("yWall"))
wallDependentModel(pair.phase1().mesh()),
pair_(pair)
{}
......
......@@ -37,6 +37,7 @@ SourceFiles
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "wallDependentModel.H"
#include "volFields.H"
#include "dictionary.H"
#include "runTimeSelectionTables.H"
......@@ -51,6 +52,8 @@ class phasePair;
\*---------------------------------------------------------------------------*/
class wallLubricationModel
:
public wallDependentModel
{
protected:
......@@ -59,9 +62,6 @@ protected:
//- Phase pair
const phasePair& pair_;
//- Wall distance
const volScalarField& yWall_;
public:
......
......@@ -32,7 +32,6 @@ License
#include "liftModel.H"
#include "wallLubricationModel.H"
#include "turbulentDispersionModel.H"
#include "wallDist.H"
#include "fvMatrix.H"
#include "surfaceInterpolate.H"
#include "MULES.H"
......@@ -110,17 +109,6 @@ Foam::twoPhaseSystem::twoPhaseSystem
),
mesh,
dimensionedScalar("dgdt", dimless/dimTime, 0)
),
yWall_
(
IOobject
(
"yWall",
mesh.time().timeName(),
mesh
),
wallDist(mesh).y()
)
{
phase2_.volScalarField::operator=(scalar(1) - phase1_);
......
......@@ -83,9 +83,6 @@ private:
//- Dilatation term
volScalarField dgdt_;
//- Wall distance
volScalarField yWall_;
//- Unordered phase pair
autoPtr<phasePair> pair_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment