Commit f2842e76 authored by graham's avatar graham
Browse files

BUG: discrete tut tweaks and fixes to make them run.

parent 9eb1ae73
......@@ -686,8 +686,14 @@ public:
// Useful derived info
//- Is the point in the cell bounding box
bool pointInCellBB(const point& p, label celli) const;
//- Is the point in the cell bounding box, option relative
// tolerance to increase the effective size of the boundBox
bool pointInCellBB
(
const point& p,
label celli,
scalar tol = 0
) const;
//- Is the point in the cell
bool pointInCell(const point& p, label celli) const;
......
......@@ -30,16 +30,33 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box
bool Foam::primitiveMesh::pointInCellBB(const point& p, label celli) const
bool Foam::primitiveMesh::pointInCellBB
(
const point& p,
label celli,
scalar tol
) const
{
return boundBox
boundBox bb
(
cells()[celli].points
(
faces(),
points()
)
).contains(p);
),
false
);
if (tol > SMALL)
{
bb = boundBox
(
bb.min() - tol*bb.span(),
bb.max() + tol*bb.span()
);
}
return bb.contains(p);
}
......
......@@ -970,11 +970,12 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
// number, but hasn't been able to find a cell to
// occupy.
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI))
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI, 0.1))
{
// If the position is not inside the bound-box of
// the cell that it thought it should be in, then
// this is considered an error.
// If the position is not inside the (slightly
// extended) bound-box of the cell that it thought
// it should be in, then this is considered an
// error.
FatalErrorIn
(
......@@ -985,18 +986,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< "for requested cell " << oldCellI << nl
<< abort(FatalError);
}
// The position is in the bound-box of the cell. This
// situation may arise because the face decomposition
// of the cell is not the same as when the particle
// acquired the cell index. For example, it has been
// read into a mesh that has made a different face
// base-point decision for a boundary face and now
// this particle is in a position that is not in the
// mesh. Gradually move the particle towards the
// centre of the cell that it thought that it was in.
// The position is in the (slightly extended)
// bound-box of the cell. This situation may arise
// because the face decomposition of the cell is not
// the same as when the particle acquired the cell
// index. For example, it has been read into a mesh
// that has made a different face base-point decision
// for a boundary face and now this particle is in a
// position that is not in the mesh. Gradually move
// the particle towards the centre of the cell that it
// thought that it was in.
cellI_ = oldCellI;
......
......@@ -1108,7 +1108,7 @@ Foam::moleculeCloud::moleculeCloud
mesh_(mesh),
pot_(pot),
cellOccupancy_(mesh_.nCells()),
il_(mesh_, pot_.pairPotentials().rCutMax(), true),
il_(mesh_, pot_.pairPotentials().rCutMax(), false),
constPropList_(),
rndGen_(clock::getTime())
{
......
......@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file
......@@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) (20 16 16) simpleGrading (1 1 1)
);
patches
boundary
(
cyclic
xPeriodic
(
(1 2 6 5)
(0 4 7 3)
)
xPeriodic_half0
{
type cyclic;
faces ((1 2 6 5));
neighbourPatch xPeriodic_half1;
}
cyclic
yPeriodic
(
(2 3 7 6)
(0 1 5 4)
)
xPeriodic_half1
{
type cyclic;
faces ((0 4 7 3));
neighbourPatch xPeriodic_half0;
}
cyclic
zPeriodic
(
(4 5 6 7)
(0 3 2 1)
)
)
yPeriodic_half0
{
type cyclic;
faces ((2 3 7 6));
neighbourPatch yPeriodic_half1;
}
yPeriodic_half1
{
type cyclic;
faces ((0 1 5 4));
neighbourPatch yPeriodic_half0;
}
zPeriodic_half0
{
type cyclic;
faces ((4 5 6 7));
neighbourPatch zPeriodic_half1;
}
zPeriodic_half1
{
type cyclic;
faces ((0 3 2 1));
neighbourPatch zPeriodic_half0;
}
);
mergePatchPairs
(
......
......@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file
......@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file
......@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file
......@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # run from this directory
(
cd periodicCubeArgon || exit
rm -rf 0/*
rm -rf 0/lagrangian 0/uniform
rm -f Ar-Ar
rm -f electrostatic
rm -f constant/idList
......@@ -19,7 +19,7 @@ cd ${0%/*} || exit 1 # run from this directory
(
cd periodicCubeWater || exit
rm -rf 0/*
rm -rf 0/lagrangian 0/uniform
rm -f O-O
rm -f electrostatic
rm -f constant/idList
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
internalField uniform ( 0 0 0 );
boundaryField
{
periodicX_half0
{
type cyclic;
}
periodicY_half0
{
type cyclic;
}
periodicZ_half0
{
type cyclic;
}
periodicY_half1
{
type cyclic;
}
periodicZ_half1
{
type cyclic;
}
periodicX_half1
{
type cyclic;
}
}
// ************************************************************************* //
......@@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) liquid (12 12 12) simpleGrading (1 1 1)
);
patches
boundary
(
cyclic
periodicX
(
(1 2 6 5)
(0 4 7 3)
)
periodicX_half0
{
type cyclic;
faces ((1 2 6 5));
neighbourPatch periodicX_half1;
}
cyclic
periodicY
(
(2 3 7 6)
(0 1 5 4)
)
periodicX_half1
{
type cyclic;
faces ((0 4 7 3));
neighbourPatch periodicX_half0;
}
cyclic
periodicZ
(
(0 3 2 1)
(4 5 6 7)
)
)
periodicY_half0
{
type cyclic;
faces ((2 3 7 6));
neighbourPatch periodicY_half1;
}
periodicY_half1
{
type cyclic;
faces ((0 1 5 4));
neighbourPatch periodicY_half0;
}
periodicZ_half0
{
type cyclic;
faces ((4 5 6 7));
neighbourPatch periodicZ_half1;
}
periodicZ_half1
{
type cyclic;
faces ((0 3 2 1));
neighbourPatch periodicZ_half0;
}
);
mergePatchPairs
(
......
......@@ -22,7 +22,7 @@ startTime 0;
stopAt endTime;
endTime 1e-10;
endTime 5e-11;
deltaT 1e-14;
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
internalField uniform ( 0 0 0 );
boundaryField
{
periodicX_half0
{
type cyclic;
}
periodicY_half0
{
type cyclic;
}
periodicZ_half0
{
type cyclic;
}
periodicY_half1
{
type cyclic;
}
periodicZ_half1
{
type cyclic;
}
periodicX_half1
{
type cyclic;
}
}
// ************************************************************************* //
......@@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) liquid (12 12 11) simpleGrading (1 1 1)
);
patches
boundary
(
cyclic
periodicX
(
(1 2 6 5)
(0 4 7 3)
)
periodicX_half0
{
type cyclic;
faces ((1 2 6 5));
neighbourPatch periodicX_half1;
}
cyclic
periodicY
(
(2 3 7 6)
(0 1 5 4)
)
periodicX_half1
{
type cyclic;
faces ((0 4 7 3));
neighbourPatch periodicX_half0;
}
cyclic
periodicZ
(
(0 3 2 1)
(4 5 6 7)
)
)
periodicY_half0
{
type cyclic;
faces ((2 3 7 6));
neighbourPatch periodicY_half1;
}
periodicY_half1
{
type cyclic;
faces ((0 1 5 4));
neighbourPatch periodicY_half0;
}
periodicZ_half0
{
type cyclic;
faces ((4 5 6 7));
neighbourPatch periodicZ_half1;
}
periodicZ_half1
{
type cyclic;
faces ((0 3 2 1));
neighbourPatch periodicZ_half0;
}
);
mergePatchPairs
(
......
......@@ -22,13 +22,13 @@ startTime 0;
stopAt endTime;
endTime 5e-12;
endTime 2e-13;
deltaT 1e-15;
writeControl runTime;
writeInterval 2e-13;
writeInterval 5e-14;
purgeWrite 0;
......
Markdown is supported
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