2010-05-12 13:27:55 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
\\ / F ield | foam-extend: Open Source CFD
|
2018-05-29 07:35:20 +00:00
|
|
|
\\ / O peration | Version: 4.1
|
2015-05-17 13:32:07 +00:00
|
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
2010-05-12 13:27:55 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
License
|
2013-12-11 16:09:41 +00:00
|
|
|
This file is part of foam-extend.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
2010-05-12 13:27:55 +00:00
|
|
|
under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
2010-05-12 13:27:55 +00:00
|
|
|
option) any later version.
|
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend 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.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
Description
|
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "freeSurface.H"
|
2010-11-25 13:16:12 +00:00
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
#include "volFields.H"
|
2010-11-25 13:16:12 +00:00
|
|
|
#include "transformField.H"
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
#include "emptyFaPatch.H"
|
2010-11-25 13:16:12 +00:00
|
|
|
#include "wedgeFaPatch.H"
|
|
|
|
#include "wallFvPatch.H"
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
#include "EulerDdtScheme.H"
|
2015-04-23 14:22:00 +00:00
|
|
|
#include "CrankNicolsonDdtScheme.H"
|
2010-05-12 13:27:55 +00:00
|
|
|
#include "backwardDdtScheme.H"
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
#include "tetFemMatrices.H"
|
|
|
|
#include "tetPointFields.H"
|
|
|
|
#include "faceTetPolyPatch.H"
|
|
|
|
#include "tetPolyPatchInterpolation.H"
|
|
|
|
#include "fixedValueTetPolyPatchFields.H"
|
|
|
|
#include "fixedValuePointPatchFields.H"
|
|
|
|
#include "twoDPointCorrector.H"
|
|
|
|
|
|
|
|
#include "slipFvPatchFields.H"
|
|
|
|
#include "symmetryFvPatchFields.H"
|
|
|
|
#include "fixedGradientFvPatchFields.H"
|
|
|
|
#include "zeroGradientCorrectedFvPatchFields.H"
|
|
|
|
#include "fixedGradientCorrectedFvPatchFields.H"
|
|
|
|
#include "fixedValueCorrectedFvPatchFields.H"
|
|
|
|
|
|
|
|
#include "primitivePatchInterpolation.H"
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
namespace Foam
|
|
|
|
{
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
defineTypeNameAndDebug(freeSurface, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
|
|
|
|
|
|
void freeSurface::clearOut()
|
|
|
|
{
|
|
|
|
deleteDemandDrivenData(interpolatorABPtr_);
|
|
|
|
deleteDemandDrivenData(interpolatorBAPtr_);
|
|
|
|
deleteDemandDrivenData(controlPointsPtr_);
|
|
|
|
deleteDemandDrivenData(motionPointsMaskPtr_);
|
|
|
|
deleteDemandDrivenData(pointsDisplacementDirPtr_);
|
|
|
|
deleteDemandDrivenData(facesDisplacementDirPtr_);
|
|
|
|
deleteDemandDrivenData(totalDisplacementPtr_);
|
|
|
|
deleteDemandDrivenData(aMeshPtr_);
|
|
|
|
deleteDemandDrivenData(UsPtr_);
|
|
|
|
deleteDemandDrivenData(phisPtr_);
|
|
|
|
deleteDemandDrivenData(surfactConcPtr_);
|
|
|
|
deleteDemandDrivenData(surfaceTensionPtr_);
|
|
|
|
deleteDemandDrivenData(surfactantPtr_);
|
|
|
|
deleteDemandDrivenData(fluidIndicatorPtr_);
|
|
|
|
}
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
freeSurface::freeSurface
|
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
dynamicFvMesh& m,
|
2010-05-12 13:27:55 +00:00
|
|
|
const volScalarField& rho,
|
2011-08-14 16:39:59 +00:00
|
|
|
volVectorField& Ub,
|
|
|
|
volScalarField& Pb,
|
2010-11-25 13:16:12 +00:00
|
|
|
const surfaceScalarField& sfPhi
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
:
|
|
|
|
IOdictionary
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"freeSurfaceProperties",
|
|
|
|
Ub.mesh().time().constant(),
|
|
|
|
Ub.mesh(),
|
|
|
|
IOobject::MUST_READ,
|
|
|
|
IOobject::NO_WRITE
|
|
|
|
)
|
|
|
|
),
|
|
|
|
mesh_(m),
|
|
|
|
rho_(rho),
|
|
|
|
U_(Ub),
|
|
|
|
p_(Pb),
|
2010-11-25 13:16:12 +00:00
|
|
|
phi_(sfPhi),
|
2010-05-12 13:27:55 +00:00
|
|
|
curTimeIndex_(Ub.mesh().time().timeIndex()),
|
|
|
|
twoFluids_
|
|
|
|
(
|
|
|
|
this->lookup("twoFluids")
|
|
|
|
),
|
|
|
|
normalMotionDir_
|
|
|
|
(
|
|
|
|
this->lookup("normalMotionDir")
|
|
|
|
),
|
2010-11-25 13:16:12 +00:00
|
|
|
motionDir_(0, 0, 0),
|
2010-05-12 13:27:55 +00:00
|
|
|
cleanInterface_
|
|
|
|
(
|
|
|
|
this->lookup("cleanInterface")
|
|
|
|
),
|
|
|
|
aPatchID_(-1),
|
|
|
|
bPatchID_(-1),
|
|
|
|
muFluidA_
|
|
|
|
(
|
|
|
|
this->lookup("muFluidA")
|
|
|
|
),
|
|
|
|
muFluidB_
|
|
|
|
(
|
|
|
|
this->lookup("muFluidB")
|
|
|
|
),
|
|
|
|
rhoFluidA_
|
|
|
|
(
|
|
|
|
this->lookup("rhoFluidA")
|
|
|
|
),
|
|
|
|
rhoFluidB_
|
|
|
|
(
|
|
|
|
this->lookup("rhoFluidB")
|
|
|
|
),
|
|
|
|
g_(this->lookup("g")),
|
|
|
|
cleanInterfaceSurfTension_
|
|
|
|
(
|
|
|
|
this->lookup("surfaceTension")
|
|
|
|
),
|
|
|
|
fixedFreeSurfacePatches_
|
|
|
|
(
|
|
|
|
this->lookup("fixedFreeSurfacePatches")
|
|
|
|
),
|
2010-11-25 13:16:12 +00:00
|
|
|
pointNormalsCorrectionPatches_
|
|
|
|
(
|
|
|
|
this->lookup("pointNormalsCorrectionPatches")
|
|
|
|
),
|
|
|
|
nFreeSurfCorr_
|
|
|
|
(
|
|
|
|
readInt(this->lookup("nFreeSurfaceCorrectors"))
|
|
|
|
),
|
|
|
|
smoothing_(false),
|
2010-05-12 13:27:55 +00:00
|
|
|
interpolatorABPtr_(NULL),
|
|
|
|
interpolatorBAPtr_(NULL),
|
|
|
|
controlPointsPtr_(NULL),
|
|
|
|
motionPointsMaskPtr_(NULL),
|
|
|
|
pointsDisplacementDirPtr_(NULL),
|
|
|
|
facesDisplacementDirPtr_(NULL),
|
|
|
|
totalDisplacementPtr_(NULL),
|
|
|
|
aMeshPtr_(NULL),
|
|
|
|
UsPtr_(NULL),
|
|
|
|
phisPtr_(NULL),
|
|
|
|
surfactConcPtr_(NULL),
|
|
|
|
surfaceTensionPtr_(NULL),
|
|
|
|
surfactantPtr_(NULL),
|
|
|
|
fluidIndicatorPtr_(NULL)
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
//Read motion direction
|
|
|
|
if (!normalMotionDir_)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
motionDir_ = vector(this->lookup("motionDir"));
|
|
|
|
motionDir_ /= mag(motionDir_) + SMALL;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Set point normal correction patches
|
|
|
|
boolList& correction = aMesh().correctPatchPointNormals();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (pointNormalsCorrectionPatches_, patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
word patchName = pointNormalsCorrectionPatches_[patchI];
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
label patchID = aMesh().boundary().findPatchID(patchName);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (patchID == -1)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
FatalErrorIn
|
|
|
|
(
|
|
|
|
"freeSurface::freeSurface(...)"
|
|
|
|
) << "Patch name for point normals correction does not exist"
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
correction[patchID] = true;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Clear geometry
|
2011-08-14 16:39:59 +00:00
|
|
|
aMesh().movePoints();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Detect the free surface patch
|
|
|
|
forAll (mesh().boundary(), patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (mesh().boundary()[patchI].name() == "freeSurface")
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
aPatchID_ = patchI;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Info<< "Found free surface patch. ID: " << aPatchID_
|
|
|
|
<< endl;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (aPatchID() == -1)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::freeSurface(...)")
|
|
|
|
<< "Free surface patch not defined. Please make sure that "
|
|
|
|
<< " the free surface patches is named as freeSurface"
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Detect the free surface shadow patch
|
|
|
|
if (twoFluids())
|
|
|
|
{
|
2010-05-12 13:27:55 +00:00
|
|
|
forAll (mesh().boundary(), patchI)
|
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (mesh().boundary()[patchI].name() == "freeSurfaceShadow")
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
bPatchID_ = patchI;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Info<< "Found free surface shadow patch. ID: "
|
|
|
|
<< bPatchID_ << endl;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (bPatchID() == -1)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::freeSurface(...)")
|
2010-11-25 13:16:12 +00:00
|
|
|
<< "Free surface shadow patch not defined. "
|
|
|
|
<< "Please make sure that the free surface shadow patch "
|
|
|
|
<< "is named as freeSurfaceShadow."
|
|
|
|
<< abort(FatalError);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// Mark free surface boundary points
|
2010-11-25 13:16:12 +00:00
|
|
|
// which belonge to processor patches
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (aMesh().boundary(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
aMesh().boundary()[patchI].type()
|
|
|
|
== processorFaPatch::typeName
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
const labelList& patchPoints =
|
|
|
|
aMesh().boundary()[patchI].pointLabels();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (patchPoints, pointI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
motionPointsMask()[patchPoints[pointI]] = -1;
|
2011-08-14 16:39:59 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// Mark fixed free surface boundary points
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (fixedFreeSurfacePatches_, patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
label fixedPatchID =
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().boundary().findPatchID
|
|
|
|
(
|
|
|
|
fixedFreeSurfacePatches_[patchI]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (fixedPatchID == -1)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
FatalErrorIn("freeSurface::freeSurface(...)")
|
|
|
|
<< "Wrong faPatch name in the fixedFreeSurfacePatches list"
|
|
|
|
<< " defined in the freeSurfaceProperties dictionary"
|
|
|
|
<< abort(FatalError);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const labelList& patchPoints =
|
|
|
|
aMesh().boundary()[fixedPatchID].pointLabels();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (patchPoints, pointI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
motionPointsMask()[patchPoints[pointI]] = 0;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// Mark free-surface boundary point
|
2010-11-25 13:16:12 +00:00
|
|
|
// at the axis of 2-D axisymmetic cases
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (aMesh().boundary(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
aMesh().boundary()[patchI].type()
|
|
|
|
== wedgeFaPatch::typeName
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
const wedgeFaPatch& wedgePatch =
|
|
|
|
refCast<const wedgeFaPatch>(aMesh().boundary()[patchI]);
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (wedgePatch.axisPoint() > -1)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
motionPointsMask()[wedgePatch.axisPoint()] = 0;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
Info << "Axis point: "
|
2010-11-25 13:16:12 +00:00
|
|
|
<< wedgePatch.axisPoint()
|
2011-08-14 16:39:59 +00:00
|
|
|
<< "vector: "
|
2010-11-25 13:16:12 +00:00
|
|
|
<< aMesh().points()[wedgePatch.axisPoint()] << endl;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Read free-surface points total displacement if present
|
|
|
|
readTotalDisplacement();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Read control points positions if present
|
|
|
|
controlPoints();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Check if smoothing switch is set
|
|
|
|
if (this->found("smoothing"))
|
|
|
|
{
|
|
|
|
smoothing_ = Switch(this->lookup("smoothing"));
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
freeSurface::~freeSurface()
|
|
|
|
{
|
|
|
|
clearOut();
|
|
|
|
}
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
void freeSurface::updateDisplacementDirections()
|
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (normalMotionDir())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
// Update point displacement correction
|
|
|
|
pointsDisplacementDir() = aMesh().pointAreaNormals();
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// Correcte point displacement direction
|
2010-11-25 13:16:12 +00:00
|
|
|
// at the "centerline" symmetryPlane which represents the axis
|
|
|
|
// of an axisymmetric case
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (aMesh().boundary(), patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (aMesh().boundary()[patchI].type() == wedgeFaPatch::typeName)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
const wedgeFaPatch& wedgePatch =
|
|
|
|
refCast<const wedgeFaPatch>(aMesh().boundary()[patchI]);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vector axis = wedgePatch.axis();
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
label centerLinePatchID =
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().boundary().findPatchID("centerline");
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (centerLinePatchID != -1)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& pointLabels =
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().boundary()[centerLinePatchID].pointLabels();
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (pointLabels, pointI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
vector dir =
|
2010-11-25 13:16:12 +00:00
|
|
|
pointsDisplacementDir()[pointLabels[pointI]];
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
dir = (dir&axis)*axis;
|
|
|
|
dir /= mag(dir);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointsDisplacementDir()[pointLabels[pointI]] = dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
Info << "Warning: centerline polyPatch does not exist. "
|
2010-11-25 13:16:12 +00:00
|
|
|
<< "Free surface points displacement directions "
|
2011-08-14 16:39:59 +00:00
|
|
|
<< "will not be corrected at the axis (centerline)"
|
|
|
|
<< endl;
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2011-08-14 16:39:59 +00:00
|
|
|
|
|
|
|
break;
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Update face displacement direction
|
|
|
|
facesDisplacementDir() =
|
|
|
|
aMesh().faceAreaNormals().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Correction of control points postion
|
|
|
|
const vectorField& Cf = aMesh().areaCentres().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
controlPoints() =
|
2010-11-25 13:16:12 +00:00
|
|
|
facesDisplacementDir()
|
|
|
|
*(facesDisplacementDir()&(controlPoints() - Cf))
|
|
|
|
+ Cf;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
bool freeSurface::predictPoints()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
// Smooth interface
|
|
|
|
|
|
|
|
if (smoothing_)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
controlPoints() = aMesh().areaCentres().internalField();
|
|
|
|
movePoints(scalarField(controlPoints().size(), 0));
|
|
|
|
movePoints(-fvc::meshPhi(rho(),U())().boundaryField()[aPatchID()]);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
for
|
|
|
|
(
|
|
|
|
int freeSurfCorr=0;
|
|
|
|
freeSurfCorr<nFreeSurfCorr_;
|
|
|
|
freeSurfCorr++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
movePoints(phi_.boundaryField()[aPatchID()]);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool freeSurface::correctPoints()
|
|
|
|
{
|
|
|
|
for
|
|
|
|
(
|
2017-08-10 19:30:05 +00:00
|
|
|
int freeSurfCorr = 0;
|
|
|
|
freeSurfCorr < nFreeSurfCorr_;
|
2010-11-25 13:16:12 +00:00
|
|
|
freeSurfCorr++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
movePoints(phi_.boundaryField()[aPatchID()]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool freeSurface::movePoints(const scalarField& interfacePhi)
|
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
pointField newMeshPoints = mesh().allPoints();
|
2010-11-25 13:16:12 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
scalarField sweptVolCorr =
|
2010-11-25 13:16:12 +00:00
|
|
|
interfacePhi
|
|
|
|
- fvc::meshPhi(rho(),U())().boundaryField()[aPatchID()];
|
|
|
|
|
|
|
|
word ddtScheme
|
|
|
|
(
|
2011-08-14 16:39:59 +00:00
|
|
|
mesh().schemesDict().ddtScheme
|
|
|
|
(
|
|
|
|
"ddt(" + rho().name() + ',' + U().name()+')'
|
|
|
|
)
|
2010-11-25 13:16:12 +00:00
|
|
|
);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
if
|
2010-11-25 13:16:12 +00:00
|
|
|
(
|
|
|
|
ddtScheme
|
2015-04-23 14:22:00 +00:00
|
|
|
== fv::CrankNicolsonDdtScheme<vector>::typeName
|
2010-11-25 13:16:12 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
sweptVolCorr *= (1.0/2.0)*DB().deltaT().value();
|
|
|
|
}
|
|
|
|
else if
|
|
|
|
(
|
|
|
|
ddtScheme
|
|
|
|
== fv::EulerDdtScheme<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
sweptVolCorr *= DB().deltaT().value();
|
|
|
|
}
|
|
|
|
else if
|
|
|
|
(
|
|
|
|
ddtScheme
|
|
|
|
== fv::backwardDdtScheme<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (DB().timeIndex() == 1)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVolCorr *= DB().deltaT().value();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVolCorr *= (2.0/3.0)*DB().deltaT().value();
|
|
|
|
}
|
2011-08-14 16:39:59 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::movePoints()")
|
|
|
|
<< "Unsupported temporal differencing scheme : "
|
2010-05-12 13:27:55 +00:00
|
|
|
<< ddtScheme
|
|
|
|
<< abort(FatalError);
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const scalarField& Sf = aMesh().S();
|
|
|
|
const vectorField& Nf = aMesh().faceAreaNormals().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField deltaH =
|
|
|
|
sweptVolCorr/(Sf*(Nf & facesDisplacementDir()));
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointField displacement = pointDisplacement(deltaH);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Move only free-surface points
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& meshPointsA =
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().boundaryMesh()[aPatchID()].meshPoints();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
forAll (displacement, pointI)
|
|
|
|
{
|
|
|
|
newMeshPoints[meshPointsA[pointI]] += displacement[pointI];
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (twoFluids_)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& meshPointsB =
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().boundaryMesh()[bPatchID_].meshPoints();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointField displacementB =
|
|
|
|
interpolatorAB().pointInterpolate
|
|
|
|
(
|
|
|
|
displacement
|
|
|
|
);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
forAll (displacementB, pointI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
newMeshPoints[meshPointsB[pointI]] += displacementB[pointI];
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Update total displacement field
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (totalDisplacementPtr_ && (curTimeIndex_ < DB().timeIndex()))
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::movePoints()")
|
|
|
|
<< "Total displacement of free surface points "
|
2017-08-10 19:30:05 +00:00
|
|
|
<< "from previous time step is not absorbed by the mesh."
|
|
|
|
<< abort(FatalError);
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
|
|
|
else if (curTimeIndex_ < DB().timeIndex())
|
|
|
|
{
|
|
|
|
totalDisplacement() = displacement;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
curTimeIndex_ = DB().timeIndex();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
totalDisplacement() += displacement;
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
twoDPointCorrector twoDPointCorr(mesh());
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
twoDPointCorr.correctPoints(newMeshPoints);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().movePoints(newMeshPoints);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// faMesh motion is done automatically, using meshObject
|
|
|
|
// HJ, 8/Aug/2011
|
|
|
|
// aMesh().movePoints(mesh().points());
|
2010-11-25 13:16:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Move correctedFvPatchField fvSubMeshes
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (U().boundaryField(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
correctedFvPatchField<vector>& pU =
|
|
|
|
refCast<correctedFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pU.movePatchSubMesh();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (p().boundaryField(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
correctedFvPatchField<scalar>& pP =
|
|
|
|
refCast<correctedFvPatchField<scalar> >
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI]
|
|
|
|
);
|
|
|
|
|
|
|
|
pP.movePatchSubMesh();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool freeSurface::moveMeshPointsForOldFreeSurfDisplacement()
|
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (totalDisplacementPtr_)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
pointField newPoints = mesh().points();
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& meshPointsA =
|
2010-05-12 13:27:55 +00:00
|
|
|
mesh().boundaryMesh()[aPatchID()].meshPoints();
|
|
|
|
|
|
|
|
forAll (totalDisplacement(), pointI)
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
newPoints[meshPointsA[pointI]] -= totalDisplacement()[pointI];
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// Check mesh motion solver type
|
|
|
|
bool feMotionSolver =
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().objectRegistry::foundObject<tetPointVectorField>
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
"motionU"
|
|
|
|
);
|
|
|
|
bool fvMotionSolver =
|
|
|
|
mesh().objectRegistry::foundObject<pointVectorField>
|
|
|
|
(
|
|
|
|
"pointMotionU"
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if (feMotionSolver)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
tetPointVectorField& motionU =
|
|
|
|
const_cast<tetPointVectorField&>
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().objectRegistry::
|
|
|
|
lookupObject<tetPointVectorField>
|
|
|
|
(
|
|
|
|
"motionU"
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
2010-11-25 13:16:12 +00:00
|
|
|
|
|
|
|
fixedValueTetPolyPatchVectorField& motionUaPatch =
|
|
|
|
refCast<fixedValueTetPolyPatchVectorField>
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
motionU.boundaryField()[aPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tetPolyPatchInterpolation tppiAPatch
|
|
|
|
(
|
|
|
|
refCast<const faceTetPolyPatch>
|
|
|
|
(
|
|
|
|
motionUaPatch.patch()
|
|
|
|
)
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
motionUaPatch ==
|
|
|
|
tppiAPatch.pointToPointInterpolate
|
|
|
|
(
|
|
|
|
totalDisplacement()/DB().deltaT().value()
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (twoFluids_)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& meshPointsB =
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().boundaryMesh()[bPatchID()].meshPoints();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointField totDisplacementB =
|
|
|
|
interpolatorAB().pointInterpolate
|
|
|
|
(
|
|
|
|
totalDisplacement()
|
|
|
|
);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
forAll (totDisplacementB, pointI)
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
newPoints[meshPointsB[pointI]] -=
|
|
|
|
totDisplacementB[pointI];
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValueTetPolyPatchVectorField& motionUbPatch =
|
|
|
|
refCast<fixedValueTetPolyPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[bPatchID()]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tetPolyPatchInterpolation tppiBPatch
|
|
|
|
(
|
|
|
|
refCast<const faceTetPolyPatch>(motionUbPatch.patch())
|
|
|
|
);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
motionUbPatch ==
|
2010-11-25 13:16:12 +00:00
|
|
|
tppiBPatch.pointToPointInterpolate
|
|
|
|
(
|
|
|
|
totDisplacementB/DB().deltaT().value()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (fvMotionSolver)
|
|
|
|
{
|
|
|
|
pointVectorField& motionU =
|
|
|
|
const_cast<pointVectorField&>
|
|
|
|
(
|
|
|
|
mesh().objectRegistry::
|
|
|
|
lookupObject<pointVectorField>
|
|
|
|
(
|
|
|
|
"pointMotionU"
|
|
|
|
)
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValuePointPatchVectorField& motionUaPatch =
|
|
|
|
refCast<fixedValuePointPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[aPatchID()]
|
|
|
|
);
|
|
|
|
|
|
|
|
motionUaPatch ==
|
|
|
|
totalDisplacement()/DB().deltaT().value();
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (twoFluids_)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
const labelList& meshPointsB =
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().boundaryMesh()[bPatchID()].meshPoints();
|
|
|
|
|
|
|
|
pointField totDisplacementB =
|
|
|
|
interpolatorAB().pointInterpolate
|
|
|
|
(
|
|
|
|
totalDisplacement()
|
|
|
|
);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
forAll (totDisplacementB, pointI)
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
newPoints[meshPointsB[pointI]] -=
|
|
|
|
totDisplacementB[pointI];
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValuePointPatchVectorField& motionUbPatch =
|
|
|
|
refCast<fixedValuePointPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[bPatchID()]
|
|
|
|
);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
motionUbPatch ==
|
2010-11-25 13:16:12 +00:00
|
|
|
totDisplacementB/DB().deltaT().value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
twoDPointCorrector twoDPointCorr(mesh());
|
|
|
|
|
|
|
|
twoDPointCorr.correctPoints(newPoints);
|
|
|
|
|
|
|
|
mesh().movePoints(newPoints);
|
|
|
|
|
|
|
|
deleteDemandDrivenData(totalDisplacementPtr_);
|
|
|
|
|
|
|
|
mesh().update();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// faMesh motion is done automatically, using meshObject
|
|
|
|
// HJ, 8/Aug/2011
|
|
|
|
// aMesh().movePoints(mesh().points());
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Move correctedFvPatchField fvSubMeshes
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (U().boundaryField(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
correctedFvPatchField<vector>& aU =
|
|
|
|
refCast<correctedFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI]
|
|
|
|
);
|
|
|
|
|
|
|
|
aU.movePatchSubMesh();
|
|
|
|
}
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (p().boundaryField(), patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
correctedFvPatchField<scalar>& aP =
|
|
|
|
refCast<correctedFvPatchField<scalar> >
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI]
|
|
|
|
);
|
|
|
|
|
|
|
|
aP.movePatchSubMesh();
|
|
|
|
}
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool freeSurface::moveMeshPoints()
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
scalarField sweptVolCorr =
|
2010-11-25 13:16:12 +00:00
|
|
|
phi_.boundaryField()[aPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
- fvc::meshPhi(rho(),U())().boundaryField()[aPatchID()];
|
|
|
|
|
|
|
|
word ddtScheme
|
|
|
|
(
|
2011-08-14 16:39:59 +00:00
|
|
|
mesh().schemesDict().ddtScheme
|
|
|
|
(
|
|
|
|
"ddt(" + rho().name() + ',' + U().name()+')'
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
if
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
ddtScheme
|
2015-04-23 14:22:00 +00:00
|
|
|
== fv::CrankNicolsonDdtScheme<vector>::typeName
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVolCorr *= (1.0/2.0)*DB().deltaT().value();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
else if
|
|
|
|
(
|
|
|
|
ddtScheme
|
|
|
|
== fv::EulerDdtScheme<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVolCorr *= DB().deltaT().value();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
else if
|
|
|
|
(
|
|
|
|
ddtScheme
|
|
|
|
== fv::backwardDdtScheme<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVolCorr *= (2.0/3.0)*DB().deltaT().value();
|
2011-08-14 16:39:59 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::movePoints()")
|
|
|
|
<< "Unsupported temporal differencing scheme : "
|
|
|
|
<< ddtScheme
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const scalarField& Sf = aMesh().S();
|
|
|
|
const vectorField& Nf = aMesh().faceAreaNormals().internalField();
|
|
|
|
|
|
|
|
scalarField deltaH =
|
|
|
|
sweptVolCorr/(Sf*(Nf & facesDisplacementDir()));
|
|
|
|
|
|
|
|
|
|
|
|
pointField displacement = pointDisplacement(deltaH);
|
|
|
|
|
|
|
|
|
|
|
|
//-- Set mesh motion boundary conditions
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tetPointVectorField& motionU =
|
|
|
|
const_cast<tetPointVectorField&>
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().objectRegistry::
|
|
|
|
lookupObject<tetPointVectorField>
|
|
|
|
(
|
|
|
|
"motionU"
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValueTetPolyPatchVectorField& motionUaPatch =
|
|
|
|
refCast<fixedValueTetPolyPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[aPatchID()]
|
|
|
|
);
|
|
|
|
|
|
|
|
tetPolyPatchInterpolation tppiAPatch
|
|
|
|
(
|
|
|
|
refCast<const faceTetPolyPatch>
|
|
|
|
(
|
|
|
|
motionUaPatch.patch()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
motionUaPatch ==
|
|
|
|
tppiAPatch.pointToPointInterpolate
|
|
|
|
(
|
|
|
|
displacement/DB().deltaT().value()
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
if (twoFluids())
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValueTetPolyPatchVectorField& motionUbPatch =
|
|
|
|
refCast<fixedValueTetPolyPatchVectorField>
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
motionU.boundaryField()[bPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tetPolyPatchInterpolation tppiBPatch
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
refCast<const faceTetPolyPatch>(motionUbPatch.patch())
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
motionUbPatch ==
|
2010-11-25 13:16:12 +00:00
|
|
|
tppiBPatch.pointToPointInterpolate
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
interpolatorAB().pointInterpolate
|
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
displacement/DB().deltaT().value()
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
mesh().update();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
// faMesh motion is done automatically, using meshObject
|
|
|
|
// HJ, 8/Aug/2011
|
|
|
|
// aMesh().movePoints(mesh().points());
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Move correctedFvPatchField fvSubMeshes
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (U().boundaryField(), patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
correctedFvPatchField<vector>& aU =
|
|
|
|
refCast<correctedFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[patchI]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aU.movePatchSubMesh();
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (p().boundaryField(), patchI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== zeroGradientCorrectedFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
correctedFvPatchField<scalar>& aP =
|
|
|
|
refCast<correctedFvPatchField<scalar> >
|
|
|
|
(
|
|
|
|
p().boundaryField()[patchI]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aP.movePatchSubMesh();
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updateBoundaryConditions()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
updateVelocity();
|
|
|
|
updateSurfactantConcentration();
|
|
|
|
updatePressure();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updateVelocity()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (twoFluids())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField nA = mesh().boundary()[aPatchID()].nf();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField nB = mesh().boundary()[bPatchID()].nf();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField DnB = interpolatorBA().faceInterpolate
|
|
|
|
(
|
|
|
|
mesh().boundary()[bPatchID()].deltaCoeffs()
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField DnA = mesh().boundary()[aPatchID()].deltaCoeffs();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
vectorField UtPA =
|
2010-11-25 13:16:12 +00:00
|
|
|
U().boundaryField()[aPatchID()].patchInternalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientCorrectedFvPatchField<vector>& aU =
|
|
|
|
refCast<fixedGradientCorrectedFvPatchField<vector> >
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
U().boundaryField()[aPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtPA += aU.corrVecGrad();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtPA -= nA*(nA & UtPA);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField UtPB = interpolatorBA().faceInterpolate
|
|
|
|
(
|
|
|
|
U().boundaryField()[bPatchID()].patchInternalField()
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
U().boundaryField()[bPatchID()].type()
|
|
|
|
== fixedValueCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedValueCorrectedFvPatchField<vector>& bU =
|
|
|
|
refCast<fixedValueCorrectedFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[bPatchID()]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtPB += interpolatorBA().faceInterpolate(bU.corrVecGrad());
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtPB -= nA*(nA & UtPB);
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
vectorField UtFs = muFluidA().value()*DnA*UtPA
|
2010-11-25 13:16:12 +00:00
|
|
|
+ muFluidB().value()*DnB*UtPB;
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
vectorField UnFs =
|
2010-11-25 13:16:12 +00:00
|
|
|
nA*phi_.boundaryField()[aPatchID()]
|
|
|
|
/mesh().boundary()[aPatchID()].magSf();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Us().internalField() += UnFs - nA*(nA&Us().internalField());
|
|
|
|
correctUsBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtFs -= (muFluidA().value() - muFluidB().value())*
|
|
|
|
(fac::grad(Us())&aMesh().faceAreaNormals())().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField tangentialSurfaceTensionForce(nA.size(), vector::zero);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (!cleanInterface())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
tangentialSurfaceTensionForce =
|
2010-11-25 13:16:12 +00:00
|
|
|
surfaceTensionGrad()().internalField();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vectorField surfaceTensionForce =
|
|
|
|
cleanInterfaceSurfTension().value()
|
|
|
|
*fac::edgeIntegrate
|
|
|
|
(
|
|
|
|
aMesh().Le()*aMesh().edgeLengthCorrection()
|
|
|
|
)().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tangentialSurfaceTensionForce =
|
2011-08-14 16:39:59 +00:00
|
|
|
surfaceTensionForce
|
2010-11-25 13:16:12 +00:00
|
|
|
- cleanInterfaceSurfTension().value()
|
|
|
|
*aMesh().faceCurvatures().internalField()*nA;
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtFs += tangentialSurfaceTensionForce;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
UtFs /= muFluidA().value()*DnA + muFluidB().value()*DnB + VSMALL;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Us().internalField() = UnFs + UtFs;
|
|
|
|
correctUsBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Store old-time velocity field U()
|
|
|
|
U().oldTime();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
U().boundaryField()[bPatchID()] ==
|
2010-11-25 13:16:12 +00:00
|
|
|
interpolatorAB().faceInterpolate(UtFs)
|
|
|
|
+ nB*fvc::meshPhi(rho(),U())().boundaryField()[bPatchID()]/
|
|
|
|
mesh().boundary()[bPatchID()].magSf();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
p().boundaryField()[bPatchID()].type()
|
|
|
|
== fixedGradientFvPatchField<scalar>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientFvPatchField<scalar>& pB =
|
|
|
|
refCast<fixedGradientFvPatchField<scalar> >
|
|
|
|
(
|
|
|
|
p().boundaryField()[bPatchID()]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
pB.gradient() =
|
2010-11-25 13:16:12 +00:00
|
|
|
- rhoFluidB().value()
|
|
|
|
*(
|
|
|
|
nB&fvc::ddt(U())().boundaryField()[bPatchID()]
|
|
|
|
);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Update fixedGradient boundary condition on patch A
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField nGradU =
|
|
|
|
muFluidB().value()*(UtPB - UtFs)*DnA
|
|
|
|
+ tangentialSurfaceTensionForce
|
|
|
|
- muFluidA().value()*nA*fac::div(Us())().internalField()
|
|
|
|
+ (muFluidB().value() - muFluidA().value())
|
|
|
|
*(fac::grad(Us())().internalField()&nA);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
nGradU /= muFluidA().value() + VSMALL;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientCorrectedFvPatchField<vector>& aU =
|
|
|
|
refCast<fixedGradientCorrectedFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aU.gradient() = nGradU;
|
|
|
|
}
|
|
|
|
else if
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()].type()
|
|
|
|
== fixedGradientFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientFvPatchField<vector>& aU =
|
|
|
|
refCast<fixedGradientFvPatchField<vector> >
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()]
|
|
|
|
);
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aU.gradient() = nGradU;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::updateVelocity()")
|
2011-08-14 16:39:59 +00:00
|
|
|
<< "Bounary condition on " << U().name()
|
|
|
|
<< " for freeSurface patch is "
|
|
|
|
<< U().boundaryField()[aPatchID()].type()
|
|
|
|
<< ", instead "
|
|
|
|
<< fixedGradientCorrectedFvPatchField<vector>::typeName
|
2010-11-25 13:16:12 +00:00
|
|
|
<< " or "
|
2011-08-14 16:39:59 +00:00
|
|
|
<< fixedGradientFvPatchField<vector>::typeName
|
2010-11-25 13:16:12 +00:00
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
vectorField nA = aMesh().faceAreaNormals().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField UnFs =
|
|
|
|
nA*phi_.boundaryField()[aPatchID()]
|
|
|
|
/mesh().boundary()[aPatchID()].magSf();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Correct normal component of free-surface velocity
|
|
|
|
Us().internalField() += UnFs - nA*(nA&Us().internalField());
|
|
|
|
correctUsBoundaryConditions();
|
|
|
|
|
|
|
|
vectorField tangentialSurfaceTensionForce(nA.size(), vector::zero);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (!cleanInterface())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
tangentialSurfaceTensionForce =
|
|
|
|
surfaceTensionGrad()().internalField();
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vectorField surfaceTensionForce =
|
|
|
|
cleanInterfaceSurfTension().value()
|
|
|
|
*fac::edgeIntegrate
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().Le()*aMesh().edgeLengthCorrection()
|
|
|
|
)().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
tangentialSurfaceTensionForce =
|
2011-08-14 16:39:59 +00:00
|
|
|
surfaceTensionForce
|
2010-11-25 13:16:12 +00:00
|
|
|
- cleanInterfaceSurfTension().value()
|
|
|
|
*aMesh().faceCurvatures().internalField()*nA;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
if (muFluidA().value() < SMALL)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
tangentialSurfaceTensionForce = vector::zero;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField tnGradU =
|
|
|
|
tangentialSurfaceTensionForce/(muFluidA().value() + VSMALL)
|
|
|
|
- (fac::grad(Us())&aMesh().faceAreaNormals())().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField UtPA =
|
|
|
|
U().boundaryField()[aPatchID()].patchInternalField();
|
|
|
|
UtPA -= nA*(nA & UtPA);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField DnA = mesh().boundary()[aPatchID()].deltaCoeffs();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField UtFs = UtPA + tnGradU/DnA;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Us().internalField() = UtFs + UnFs;
|
|
|
|
correctUsBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField nGradU =
|
|
|
|
tangentialSurfaceTensionForce/(muFluidA().value() + VSMALL)
|
|
|
|
- nA*fac::div(Us())().internalField()
|
|
|
|
- (fac::grad(Us())().internalField()&nA);
|
|
|
|
|
|
|
|
if
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()].type()
|
|
|
|
== fixedGradientCorrectedFvPatchField<vector>::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientCorrectedFvPatchField<vector>& aU =
|
|
|
|
refCast<fixedGradientCorrectedFvPatchField<vector> >
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
U().boundaryField()[aPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aU.gradient() = nGradU;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
else if
|
|
|
|
(
|
|
|
|
U().boundaryField()[aPatchID()].type()
|
|
|
|
== fixedGradientFvPatchField<vector>::typeName
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
fixedGradientFvPatchField<vector>& aU =
|
|
|
|
refCast<fixedGradientFvPatchField<vector> >
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
U().boundaryField()[aPatchID()]
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
aU.gradient() = nGradU;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FatalErrorIn("freeSurface::updateVelocity()")
|
2011-08-14 16:39:59 +00:00
|
|
|
<< "Bounary condition on " << U().name()
|
|
|
|
<< " for freeSurface patch is "
|
|
|
|
<< U().boundaryField()[aPatchID()].type()
|
|
|
|
<< ", instead "
|
|
|
|
<< fixedGradientCorrectedFvPatchField<vector>::typeName
|
2010-11-25 13:16:12 +00:00
|
|
|
<< " or "
|
2011-08-14 16:39:59 +00:00
|
|
|
<< fixedGradientFvPatchField<vector>::typeName
|
2010-11-25 13:16:12 +00:00
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updatePressure()
|
|
|
|
{
|
|
|
|
// Correct pressure boundary condition at the free-surface
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField nA = mesh().boundary()[aPatchID()].nf();
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (twoFluids())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
scalarField pA =
|
|
|
|
interpolatorBA().faceInterpolate
|
|
|
|
(
|
|
|
|
p().boundaryField()[bPatchID()]
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const scalarField& K = aMesh().faceCurvatures().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Info << "Free surface curvature: min = " << gMin(K)
|
|
|
|
<< ", max = " << gMax(K)
|
|
|
|
<< ", average = " << gAverage(K) << endl << flush;
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (cleanInterface())
|
2011-08-14 16:39:59 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
// pA -= cleanInterfaceSurfTension().value()*(K - gAverage(K));
|
|
|
|
pA -= cleanInterfaceSurfTension().value()*K;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scalarField surfTensionK =
|
|
|
|
surfaceTension().internalField()*K;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pA -= surfTensionK - gAverage(surfTensionK);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pA -= 2.0*(muFluidA().value() - muFluidB().value())
|
|
|
|
*fac::div(Us())().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// vector R0 = gAverage(mesh().C().boundaryField()[aPatchID()]);
|
|
|
|
vector R0 = vector::zero;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pA -= (rhoFluidA().value() - rhoFluidB().value())*
|
|
|
|
(
|
|
|
|
g_.value()
|
|
|
|
& (
|
|
|
|
mesh().C().boundaryField()[aPatchID()]
|
|
|
|
- R0
|
|
|
|
)
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
p().boundaryField()[aPatchID()] == pA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// vector R0 = gAverage(mesh().C().boundaryField()[aPatchID()]);
|
|
|
|
vector R0 = vector::zero;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField pA =
|
|
|
|
- rhoFluidA().value()*
|
|
|
|
(
|
|
|
|
g_.value()
|
|
|
|
& (
|
|
|
|
mesh().C().boundaryField()[aPatchID()]
|
|
|
|
- R0
|
|
|
|
)
|
|
|
|
);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const scalarField& K = aMesh().faceCurvatures().internalField();
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Info << "Free surface curvature: min = " << gMin(K)
|
2011-08-14 16:39:59 +00:00
|
|
|
<< ", max = " << gMax(K) << ", average = " << gAverage(K)
|
2010-11-25 13:16:12 +00:00
|
|
|
<< endl;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (cleanInterface())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
// pA -= cleanInterfaceSurfTension().value()*(K - gAverage(K));
|
|
|
|
pA -= cleanInterfaceSurfTension().value()*K;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scalarField surfTensionK =
|
|
|
|
surfaceTension().internalField()*K;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pA -= surfTensionK - gAverage(surfTensionK);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
|
|
|
|
pA -= 2.0*muFluidA().value()*fac::div(Us())().internalField();
|
|
|
|
|
|
|
|
p().boundaryField()[aPatchID()] == pA;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
// Set modified pressure at patches with fixed apsolute
|
|
|
|
// pressure
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// vector R0 = gAverage(mesh().C().boundaryField()[aPatchID()]);
|
|
|
|
vector R0 = vector::zero;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
for (int patchI=0; patchI < p().boundaryField().size(); patchI++)
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
if
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
p().boundaryField()[patchI].type()
|
|
|
|
== fixedValueFvPatchScalarField::typeName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (patchI != aPatchID())
|
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
p().boundaryField()[patchI] ==
|
|
|
|
- rho().boundaryField()[patchI]
|
|
|
|
*(g_.value()&(mesh().C().boundaryField()[patchI] - R0));
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updateSurfaceFlux()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
Phis() = fac::interpolate(Us()) & aMesh().Le();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updateSurfactantConcentration()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
if (!cleanInterface())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
Info << "Correct surfactant concentration" << endl << flush;
|
2011-08-14 16:39:59 +00:00
|
|
|
|
|
|
|
updateSurfaceFlux();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Crate and solve the surfactanta transport equation
|
2010-05-12 13:27:55 +00:00
|
|
|
faScalarMatrix CsEqn
|
|
|
|
(
|
|
|
|
fam::ddt(surfactantConcentration())
|
|
|
|
+ fam::div(Phis(), surfactantConcentration())
|
|
|
|
- fam::laplacian
|
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
surfactant().surfactDiffusion(),
|
2010-05-12 13:27:55 +00:00
|
|
|
surfactantConcentration()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (surfactant().soluble())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
const scalarField& C =
|
|
|
|
mesh().boundary()[aPatchID()]
|
|
|
|
.lookupPatchField<volScalarField, scalar>("C");
|
|
|
|
|
|
|
|
areaScalarField Cb
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"Cb",
|
|
|
|
DB().timeName(),
|
|
|
|
mesh(),
|
|
|
|
IOobject::NO_READ,
|
|
|
|
IOobject::NO_WRITE
|
|
|
|
),
|
|
|
|
aMesh(),
|
|
|
|
dimensioned<scalar>("Cb", dimMoles/dimVolume, 0),
|
|
|
|
zeroGradientFaPatchScalarField::typeName
|
|
|
|
);
|
|
|
|
|
|
|
|
Cb.internalField() = C;
|
|
|
|
Cb.correctBoundaryConditions();
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
CsEqn +=
|
2010-11-25 13:16:12 +00:00
|
|
|
fam::Sp
|
|
|
|
(
|
|
|
|
surfactant().surfactAdsorptionCoeff()*Cb
|
|
|
|
+ surfactant().surfactAdsorptionCoeff()
|
|
|
|
*surfactant().surfactDesorptionCoeff(),
|
|
|
|
surfactantConcentration()
|
|
|
|
)
|
|
|
|
- surfactant().surfactAdsorptionCoeff()
|
|
|
|
*Cb*surfactant().surfactSaturatedConc();
|
|
|
|
}
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
CsEqn.solve();
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
Info << "Correct surface tension" << endl;
|
|
|
|
|
|
|
|
surfaceTension() =
|
|
|
|
cleanInterfaceSurfTension()
|
|
|
|
+ surfactant().surfactR()
|
|
|
|
*surfactant().surfactT()
|
|
|
|
*surfactant().surfactSaturatedConc()
|
|
|
|
*log(1.0 - surfactantConcentration()
|
|
|
|
/surfactant().surfactSaturatedConc());
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (neg(min(surfaceTension().internalField())))
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
FatalErrorIn
|
|
|
|
(
|
|
|
|
"void freeSurface::correctSurfactantConcentration()"
|
2011-08-14 16:39:59 +00:00
|
|
|
) << "Surface tension is negative"
|
2010-11-25 13:16:12 +00:00
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void freeSurface::correctUsBoundaryConditions()
|
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (Us().boundaryField(), patchI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
Us().boundaryField()[patchI].type()
|
|
|
|
== calculatedFaPatchVectorField::typeName
|
|
|
|
)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField& pUs = Us().boundaryField()[patchI];
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pUs = Us().boundaryField()[patchI].patchInternalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
label ngbPolyPatchID =
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().boundary()[patchI].ngbPolyPatchIndex();
|
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (ngbPolyPatchID != -1)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
if
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-11-25 13:16:12 +00:00
|
|
|
(
|
2011-08-14 16:39:59 +00:00
|
|
|
isA<slipFvPatchVectorField>
|
|
|
|
(
|
|
|
|
U().boundaryField()[ngbPolyPatchID]
|
|
|
|
)
|
2010-11-25 13:16:12 +00:00
|
|
|
)
|
|
|
|
||
|
|
|
|
(
|
2011-08-14 16:39:59 +00:00
|
|
|
isA<symmetryFvPatchVectorField>
|
|
|
|
(
|
|
|
|
U().boundaryField()[ngbPolyPatchID]
|
|
|
|
)
|
2010-11-25 13:16:12 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
vectorField N =
|
2010-11-25 13:16:12 +00:00
|
|
|
aMesh().boundary()[patchI].ngbPolyPatchFaceNormals();
|
|
|
|
|
|
|
|
pUs -= N*(N&pUs);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-11-25 13:16:12 +00:00
|
|
|
|
|
|
|
Us().correctBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vector freeSurface::totalPressureForce() const
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
const scalarField& S = aMesh().S();
|
|
|
|
|
|
|
|
const vectorField& n = aMesh().faceAreaNormals().internalField();
|
|
|
|
|
|
|
|
const scalarField& P = p().boundaryField()[aPatchID()];
|
|
|
|
|
|
|
|
vectorField pressureForces = S*P*n;
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
return gSum(pressureForces);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vector freeSurface::totalViscousForce() const
|
|
|
|
{
|
|
|
|
const scalarField& S = aMesh().S();
|
|
|
|
const vectorField& n = aMesh().faceAreaNormals().internalField();
|
|
|
|
|
|
|
|
vectorField nGradU =
|
|
|
|
U().boundaryField()[aPatchID()].snGrad();
|
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
vectorField viscousForces =
|
2010-11-25 13:16:12 +00:00
|
|
|
- muFluidA().value()*S
|
|
|
|
*(
|
|
|
|
nGradU
|
|
|
|
+ (fac::grad(Us())().internalField()&n)
|
|
|
|
- (n*fac::div(Us())().internalField())
|
|
|
|
);
|
|
|
|
|
|
|
|
return gSum(viscousForces);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vector freeSurface::totalSurfaceTensionForce() const
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
const scalarField& S = aMesh().S();
|
|
|
|
|
|
|
|
const vectorField& n = aMesh().faceAreaNormals().internalField();
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const scalarField& K = aMesh().faceCurvatures().internalField();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField surfTensionForces(n.size(), vector::zero);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (cleanInterface())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
surfTensionForces =
|
|
|
|
S*cleanInterfaceSurfTension().value()
|
|
|
|
*fac::edgeIntegrate
|
|
|
|
(
|
|
|
|
aMesh().Le()*aMesh().edgeLengthCorrection()
|
|
|
|
)().internalField();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
surfTensionForces *= surfaceTension().internalField()*K;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
return gSum(surfTensionForces);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::initializeControlPointsPosition()
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField deltaH = scalarField(aMesh().nFaces(), 0.0);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointField displacement = pointDisplacement(deltaH);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const faceList& faces = aMesh().faces();
|
|
|
|
const pointField& points = aMesh().points();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
pointField newPoints = points + displacement;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalarField sweptVol(faces.size(), 0.0);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (faces, faceI)
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-11-25 13:16:12 +00:00
|
|
|
sweptVol[faceI] = -faces[faceI].sweptVol(points, newPoints);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
vectorField faceArea(faces.size(), vector::zero);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
forAll (faceArea, faceI)
|
|
|
|
{
|
|
|
|
faceArea[faceI] = faces[faceI].normal(newPoints);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (deltaH, faceI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
deltaH[faceI] = sweptVol[faceI]/
|
|
|
|
(faceArea[faceI] & facesDisplacementDir()[faceI]);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
displacement = pointDisplacement(deltaH);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
scalar freeSurface::maxCourantNumber()
|
|
|
|
{
|
|
|
|
scalar CoNum = 0;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
if (cleanInterface())
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
2017-08-10 19:30:05 +00:00
|
|
|
const scalarField& dE = aMesh().lPN();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
CoNum = gMax
|
|
|
|
(
|
|
|
|
DB().deltaT().value()/
|
|
|
|
sqrt
|
|
|
|
(
|
|
|
|
rhoFluidA().value()*dE*dE*dE/
|
|
|
|
2.0/M_PI/(cleanInterfaceSurfTension().value() + SMALL)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-14 16:39:59 +00:00
|
|
|
scalarField sigmaE =
|
2010-11-25 13:16:12 +00:00
|
|
|
linearEdgeInterpolate(surfaceTension())().internalField()
|
|
|
|
+ SMALL;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
const scalarField& dE =aMesh().lPN();
|
2011-08-14 16:39:59 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
CoNum = gMax
|
|
|
|
(
|
|
|
|
DB().deltaT().value()/
|
|
|
|
sqrt
|
|
|
|
(
|
|
|
|
rhoFluidA().value()*dE*dE*dE/
|
|
|
|
2.0/M_PI/sigmaE
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
return CoNum;
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::updateProperties()
|
|
|
|
{
|
|
|
|
muFluidA_ = dimensionedScalar(this->lookup("muFluidA"));
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
muFluidB_ = dimensionedScalar(this->lookup("muFluidB"));
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
rhoFluidA_ = dimensionedScalar(this->lookup("rhoFluidA"));
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
rhoFluidB_ = dimensionedScalar(this->lookup("rhoFluidB"));
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
g_ = dimensionedVector(this->lookup("g"));
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2011-08-14 16:39:59 +00:00
|
|
|
cleanInterfaceSurfTension_ =
|
2010-11-25 13:16:12 +00:00
|
|
|
dimensionedScalar(this->lookup("surfaceTension"));
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::writeVTK() const
|
|
|
|
{
|
|
|
|
aMesh().patch().writeVTK
|
|
|
|
(
|
|
|
|
DB().timePath()/"freeSurface",
|
|
|
|
aMesh().patch(),
|
|
|
|
aMesh().patch().points()
|
|
|
|
);
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
void freeSurface::writeVTKControlPoints()
|
|
|
|
{
|
|
|
|
// Write patch and points into VTK
|
|
|
|
fileName name(DB().timePath()/"freeSurfaceControlPoints");
|
|
|
|
OFstream mps(name + ".vtk");
|
|
|
|
|
|
|
|
mps << "# vtk DataFile Version 2.0" << nl
|
|
|
|
<< name << ".vtk" << nl
|
|
|
|
<< "ASCII" << nl
|
|
|
|
<< "DATASET POLYDATA" << nl
|
|
|
|
<< "POINTS " << controlPoints().size() << " float" << nl;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (controlPoints(), pointI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
mps << controlPoints()[pointI].x() << ' '
|
|
|
|
<< controlPoints()[pointI].y() << ' '
|
|
|
|
<< controlPoints()[pointI].z() << nl;
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-11-25 13:16:12 +00:00
|
|
|
// Write vertices
|
2011-08-14 16:39:59 +00:00
|
|
|
mps << "VERTICES " << controlPoints().size() << ' '
|
2010-11-25 13:16:12 +00:00
|
|
|
<< controlPoints().size()*2 << nl;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2017-08-10 19:30:05 +00:00
|
|
|
forAll (controlPoints(), pointI)
|
2010-11-25 13:16:12 +00:00
|
|
|
{
|
|
|
|
mps << 1 << ' ' << pointI << nl;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
} // End namespace Foam
|
|
|
|
|
|
|
|
// ************************************************************************* //
|