BUG: displacementLayeredMotionSolver: too early evaluation of boundary conditions

This commit is contained in:
mattijs
2013-06-12 10:33:36 +01:00
parent 54b212e769
commit dee88bcedd
3 changed files with 57 additions and 62 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,9 +36,6 @@ Description
Tables are in the \a constant/tables directory.
Note
could be a motionSolver - does not use any fvMesh structure.
SourceFiles
displacementInterpolationMotionSolver.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -253,6 +253,16 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate
// Only on boundary faces - follow boundary conditions
fld = vectorField(pointDisplacement_, meshPoints);
}
else if (type == "uniformFollow")
{
// Reads name of name of patch. Then get average point dislacement on
// patch. That becomes the value of fld.
const word patchName(dict.lookup("patch"));
label patchID = mesh().boundaryMesh().findPatchID(patchName);
pointField pdf =
pointDisplacement_.boundaryField()[patchID].patchInternalField();
fld = gAverage(pdf);
}
else
{
FatalIOErrorIn
@ -399,22 +409,6 @@ Info<< "For cellZone:" << cellZoneI
// Implement real bc.
patchDisp[patchI].correctBoundaryConditions();
//Info<< "Writing displacement for faceZone " << fz.name()
// << " to " << patchDisp[patchI].name() << endl;
//patchDisp[patchI].write();
// // Copy into pointDisplacement for other fields to use
// forAll(isZonePoint, pointI)
// {
// if (isZonePoint[pointI])
// {
// pointDisplacement_[pointI] = patchDisp[patchI][pointI];
// }
// }
// pointDisplacement_.correctBoundaryConditions();
patchI++;
}
@ -423,37 +417,40 @@ Info<< "For cellZone:" << cellZoneI
// ~~~~~
// solving the interior is just interpolating
// // Get normalised distance
// pointScalarField distance
// (
// IOobject
// (
// "distance",
// mesh().time().timeName(),
// mesh(),
// IOobject::NO_READ,
// IOobject::NO_WRITE,
// false
// ),
// pointMesh::New(mesh()),
// dimensionedScalar("distance", dimLength, 0.0)
// );
// forAll(distance, pointI)
// {
// if (isZonePoint[pointI])
// {
// scalar d1 = patchDist[0][pointI];
// scalar d2 = patchDist[1][pointI];
// if (d1+d2 > SMALL)
// {
// scalar s = d1/(d1+d2);
// distance[pointI] = s;
// }
// }
// }
// Info<< "Writing distance pointScalarField to " << mesh().time().timeName()
// << endl;
// distance.write();
if (debug)
{
// Get normalised distance
pointScalarField distance
(
IOobject
(
"distance",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pointMesh::New(mesh()),
dimensionedScalar("distance", dimLength, 0.0)
);
forAll(distance, pointI)
{
if (isZonePoint[pointI])
{
scalar d1 = patchDist[0][pointI];
scalar d2 = patchDist[1][pointI];
if (d1+d2 > SMALL)
{
scalar s = d1/(d1+d2);
distance[pointI] = s;
}
}
}
Info<< "Writing distance pointScalarField to "
<< mesh().time().timeName() << endl;
distance.write();
}
// Average
forAll(pointDisplacement_, pointI)
@ -470,7 +467,6 @@ Info<< "For cellZone:" << cellZoneI
+ s*patchDisp[1][pointI];
}
}
pointDisplacement_.correctBoundaryConditions();
}
@ -484,9 +480,7 @@ displacementLayeredMotionMotionSolver
)
:
displacementMotionSolver(mesh, dict, typeName)
{
pointDisplacement_.correctBoundaryConditions();
}
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -518,6 +512,9 @@ void Foam::displacementLayeredMotionMotionSolver::solve()
// the motionSolver accordingly
movePoints(mesh().points());
// Apply boundary conditions
pointDisplacement_.boundaryField().updateCoeffs();
// Apply all regions (=cellZones)
const dictionary& regionDicts = coeffDict().subDict("regions");
@ -544,6 +541,9 @@ void Foam::displacementLayeredMotionMotionSolver::solve()
cellZoneSolve(zoneI, regionDict);
}
// Update pointDisplacement for solved values
pointDisplacement_.correctBoundaryConditions();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,11 +28,6 @@ Description
Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the
structure of the mesh blocks and boundary conditions on these blocks.
Note: should not be an fvMotionSolver but just a motionSolver. Only here
so we can reuse displacementFvMotionSolver functionality (e.g. surface
following boundary conditions)
The displacementLayeredMotionCoeffs subdict of dynamicMeshDict specifies
per region (=cellZone) the boundary conditions on two opposing patches
(=faceZones). It then interpolates the boundary values using topological
@ -44,6 +39,9 @@ Description
Use this for faceZones on boundary faces (so it uses the
proper boundary conditions on the pointDisplacement).
uniformFollow: like 'follow' but takes the average value of
a specified 'patch' (which is not necessarily colocated)
fixedValue: fixed value.
timeVaryingUniformFixedValue: table-driven fixed value.