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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,11 +28,6 @@ Description
Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the
structure of the mesh blocks and boundary conditions on these blocks. 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 The displacementLayeredMotionCoeffs subdict of dynamicMeshDict specifies
per region (=cellZone) the boundary conditions on two opposing patches per region (=cellZone) the boundary conditions on two opposing patches
(=faceZones). It then interpolates the boundary values using topological (=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 Use this for faceZones on boundary faces (so it uses the
proper boundary conditions on the pointDisplacement). 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. fixedValue: fixed value.
timeVaryingUniformFixedValue: table-driven fixed value. timeVaryingUniformFixedValue: table-driven fixed value.