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

This commit is contained in:
graham
2010-10-08 20:34:59 +01:00
parent 9eb1ae7307
commit f2842e76b9
16 changed files with 280 additions and 89 deletions

View File

@ -686,8 +686,14 @@ public:
// Useful derived info // Useful derived info
//- Is the point in the cell bounding box //- Is the point in the cell bounding box, option relative
bool pointInCellBB(const point& p, label celli) const; // 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 //- Is the point in the cell
bool pointInCell(const point& p, label celli) const; bool pointInCell(const point& p, label celli) const;

View File

@ -30,16 +30,33 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box // 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 cells()[celli].points
( (
faces(), faces(),
points() points()
) ),
).contains(p); false
);
if (tol > SMALL)
{
bb = boundBox
(
bb.min() - tol*bb.span(),
bb.max() + tol*bb.span()
);
}
return bb.contains(p);
} }

View File

@ -970,11 +970,12 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
// number, but hasn't been able to find a cell to // number, but hasn't been able to find a cell to
// occupy. // 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 // If the position is not inside the (slightly
// the cell that it thought it should be in, then // extended) bound-box of the cell that it thought
// this is considered an error. // it should be in, then this is considered an
// error.
FatalErrorIn FatalErrorIn
( (
@ -985,18 +986,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
")" ")"
) << "cell, tetFace and tetPt search failure at position " ) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl << position_ << nl
<< "for requested cell " << oldCellI << nl
<< abort(FatalError); << abort(FatalError);
} }
// The position is in the bound-box of the cell. This // The position is in the (slightly extended)
// situation may arise because the face decomposition // bound-box of the cell. This situation may arise
// of the cell is not the same as when the particle // because the face decomposition of the cell is not
// acquired the cell index. For example, it has been // the same as when the particle acquired the cell
// read into a mesh that has made a different face // index. For example, it has been read into a mesh
// base-point decision for a boundary face and now // that has made a different face base-point decision
// this particle is in a position that is not in the // for a boundary face and now this particle is in a
// mesh. Gradually move the particle towards the // position that is not in the mesh. Gradually move
// centre of the cell that it thought that it was in. // the particle towards the centre of the cell that it
// thought that it was in.
cellI_ = oldCellI; cellI_ = oldCellI;

View File

@ -1108,7 +1108,7 @@ Foam::moleculeCloud::moleculeCloud
mesh_(mesh), mesh_(mesh),
pot_(pot), pot_(pot),
cellOccupancy_(mesh_.nCells()), cellOccupancy_(mesh_.nCells()),
il_(mesh_, pot_.pairPotentials().rCutMax(), true), il_(mesh_, pot_.pairPotentials().rCutMax(), false),
constPropList_(), constPropList_(),
rndGen_(clock::getTime()) rndGen_(clock::getTime())
{ {

View File

@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions . $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) (20 16 16) simpleGrading (1 1 1) hex (0 1 2 3 4 5 6 7) (20 16 16) simpleGrading (1 1 1)
); );
patches boundary
( (
cyclic xPeriodic_half0
xPeriodic {
( type cyclic;
(1 2 6 5) faces ((1 2 6 5));
(0 4 7 3) neighbourPatch xPeriodic_half1;
) }
cyclic xPeriodic_half1
yPeriodic {
( type cyclic;
(2 3 7 6) faces ((0 4 7 3));
(0 1 5 4) neighbourPatch xPeriodic_half0;
) }
cyclic yPeriodic_half0
zPeriodic {
( type cyclic;
(4 5 6 7) faces ((2 3 7 6));
(0 3 2 1) 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 mergePatchPairs
( (

View File

@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions . $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions . $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions . $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase cleanCase
rm -rf 0/lagrangian 0/dsmcSigmaTcRMax rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # run from this directory
( (
cd periodicCubeArgon || exit cd periodicCubeArgon || exit
rm -rf 0/* rm -rf 0/lagrangian 0/uniform
rm -f Ar-Ar rm -f Ar-Ar
rm -f electrostatic rm -f electrostatic
rm -f constant/idList rm -f constant/idList
@ -19,7 +19,7 @@ cd ${0%/*} || exit 1 # run from this directory
( (
cd periodicCubeWater || exit cd periodicCubeWater || exit
rm -rf 0/* rm -rf 0/lagrangian 0/uniform
rm -f O-O rm -f O-O
rm -f electrostatic rm -f electrostatic
rm -f constant/idList rm -f constant/idList

View File

@ -0,0 +1,51 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) liquid (12 12 12) simpleGrading (1 1 1) hex (0 1 2 3 4 5 6 7) liquid (12 12 12) simpleGrading (1 1 1)
); );
patches boundary
( (
cyclic periodicX_half0
periodicX {
( type cyclic;
(1 2 6 5) faces ((1 2 6 5));
(0 4 7 3) neighbourPatch periodicX_half1;
) }
cyclic periodicX_half1
periodicY {
( type cyclic;
(2 3 7 6) faces ((0 4 7 3));
(0 1 5 4) neighbourPatch periodicX_half0;
) }
cyclic periodicY_half0
periodicZ {
( type cyclic;
(0 3 2 1) faces ((2 3 7 6));
(4 5 6 7) 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 mergePatchPairs
( (

View File

@ -22,7 +22,7 @@ startTime 0;
stopAt endTime; stopAt endTime;
endTime 1e-10; endTime 5e-11;
deltaT 1e-14; deltaT 1e-14;

View File

@ -0,0 +1,51 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -34,29 +34,50 @@ blocks
hex (0 1 2 3 4 5 6 7) liquid (12 12 11) simpleGrading (1 1 1) hex (0 1 2 3 4 5 6 7) liquid (12 12 11) simpleGrading (1 1 1)
); );
patches boundary
( (
cyclic periodicX_half0
periodicX {
( type cyclic;
(1 2 6 5) faces ((1 2 6 5));
(0 4 7 3) neighbourPatch periodicX_half1;
) }
cyclic periodicX_half1
periodicY {
( type cyclic;
(2 3 7 6) faces ((0 4 7 3));
(0 1 5 4) neighbourPatch periodicX_half0;
) }
cyclic periodicY_half0
periodicZ {
( type cyclic;
(0 3 2 1) faces ((2 3 7 6));
(4 5 6 7) 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 mergePatchPairs
( (

View File

@ -22,13 +22,13 @@ startTime 0;
stopAt endTime; stopAt endTime;
endTime 5e-12; endTime 2e-13;
deltaT 1e-15; deltaT 1e-15;
writeControl runTime; writeControl runTime;
writeInterval 2e-13; writeInterval 5e-14;
purgeWrite 0; purgeWrite 0;