Merging surface tracking, 3. Zeljko Tukovic

This commit is contained in:
Hrvoje Jasak 2010-11-25 13:16:12 +00:00
parent e72fff64a7
commit 814982fb2b
95 changed files with 2893 additions and 2648 deletions

View file

@ -1,20 +1,15 @@
EXE_INC = \ EXE_INC = \
-I./include \ -I../include \
-I../freeSurface \ -I../freeSurface/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \ -I$(LIB_SRC)/finiteArea/lnInclude
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetDecompositionMotionSolver/lnInclude \
$(WM_DECOMP_INC)
EXE_LIBS = \ EXE_LIBS = \
-lfreeSurface \ -lfreeSurface \
-lfiniteVolume \ -ldynamicFvMesh \
-lfiniteArea \
-lmeshTools \
-ldynamicMesh \ -ldynamicMesh \
-lmeshTools \ -lmeshTools \
$(WM_DECOMP_LIBS) \ -lfiniteVolume \
-llduSolvers -lfiniteArea

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) 2004-2007 Z. Tukovic and H. Jasak \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,37 +32,25 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Ostream.H"
#include "OFstream.H"
#include "fvCFD.H" #include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "inletOutletFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "motionSolver.H"
#include "freeSurface.H" #include "freeSurface.H"
#include "inletOutletFvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "boundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
# include "createDynamicFvMesh.H"
# include "createMeshNoClear.H"
# include "createFields.H" # include "createFields.H"
# include "initContinuityErrs.H" # include "initContinuityErrs.H"
# include "createBubble.H" # include "createBubble.H"
# include "createSurfactantConcentrationField.H"
# include "createPath.H"
# include "createForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,98 +58,100 @@ int main(int argc, char *argv[])
for (runTime++; !runTime.end(); runTime++) for (runTime++; !runTime.end(); runTime++)
{ {
Info << "Time = " << runTime.value() << endl; Info << "Time = " << runTime.value() << endl << endl;
# include "readBubbleSIMPLEControls.H" # include "readPISOControls.H"
# include "CourantNo.H"
interface.updateDisplacementDirections();
interface.moveMeshPointsForOldFreeSurfDisplacement(); interface.moveMeshPointsForOldFreeSurfDisplacement();
interface.smooth(); interface.updateDisplacementDirections();
# include "updateMovingReferenceFrame.H" interface.predictPoints();
// --- SIMPLE loop Info<< "\nMax surface Courant Number = "
for (label timeCorr=0; timeCorr<=nTimeCorr; timeCorr++) << interface.maxCourantNumber() << endl << endl;
for (int corr=0; corr<nOuterCorr; corr++)
{ {
Info << endl; // Update interface bc
interface.updateBoundaryConditions();
p.storePrevIter(); // Make the fluxes relative
phi -= fvc::meshPhi(rho, U);
interface.correctBoundaryConditions(); # include "CourantNo.H"
tmp<fvVectorMatrix> UEqn fvVectorMatrix UEqn
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ rho*aF + rho*aF
+ fvm::div(phiNet, U) + fvm::div(fvc::interpolate(rho)*phi, U, "div(phi,U)")
- fvm::laplacian(mu, U) - fvm::laplacian(mu, U)
); );
UEqn().relax(); solve(UEqn == -fvc::grad(p));
solve(UEqn() == -fvc::grad(p)); // --- PISO loop
for (int i=0; i<nCorr; i++)
volScalarField AU = UEqn().A();
U = UEqn().H()/AU;
U.correctBoundaryConditions();
UEqn.clear();
phi = (fvc::interpolate(U) & mesh.Sf());
# include "spacePatchFlowRateScaling.H"
# include "freeSurfacePatchFlowRateScaling.H"
// Non-orthogonal pressure corrector loop
for (label nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn volScalarField AU = UEqn.A();
(
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
);
pEqn.setReference(0, 0.0); U = UEqn.H()/AU;
pEqn.solve();
if (nonOrth == nNonOrthCorr) phi = (fvc::interpolate(U) & mesh.Sf());
# include "scalePhi.H"
# include "scaleSpacePhi.H"
// Non-orthogonal pressure corrector loop
for (label nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
phi -= pEqn.flux(); fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AU, p)
== fvc::div(phi)
);
# include "setReference.H"
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
} }
# include "continuityErrs.H"
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
} }
# include "continuityErrs.H" # include "solveBulkSurfactant.H"
// Explicitly relax pressure interface.correctPoints();
p.relax();
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
// Move mesh
interface.movePoints();
// Update motion fluxes
phiNet = fvc::interpolate(rho)*(phi - fvc::meshPhi(rho, U));
# include "freeSurfaceContinuityErrs.H" # include "freeSurfaceContinuityErrs.H"
} }
# include "bubbleVolumeReduction.H" # include "updateMovingReferenceFrame.H"
# include "volContinuity.H"
Info << "Total surface tension force: "
<< interface.totalSurfaceTensionForce() << endl;
vector totalForce =
interface.totalViscousForce()
+ interface.totalPressureForce();
Info << "Total force: " << totalForce << endl;
runTime.write(); runTime.write();
# include "writeData.H"
# include "writePath.H"
# include "writeForces.H"
Info << "ExecutionTime = " Info << "ExecutionTime = "
<< scalar(runTime.elapsedCpuTime()) << scalar(runTime.elapsedCpuTime())
<< " s\n" << endl << endl; << " s\n" << endl << endl;

View file

@ -1,9 +0,0 @@
bubbleProperties.remove("Vb");
Vb = gSum((1.0 - interface.fluidIndicator().internalField())*mesh.V());
bubbleProperties.add("Vb", Vb);
if(Pstream::master())
{
Info << "Bubble volume reduction: " << Vb/Vbf << endl;
}

View file

@ -1,171 +0,0 @@
// Detect the space patch
label spacePatchID = -1;
forAll (mesh.boundary(), patchI)
{
if (mesh.boundary()[patchI].name() == "space")
{
spacePatchID = patchI;
Info<< "Found space patch. ID: "
<< spacePatchID << endl;
}
}
// if (spacePatchID < 0)
// {
// FatalErrorIn(args.executable())
// << "Space patch not defined. Please make sure that "
// << "the space patch is named as space."
// << abort(FatalError);
// }
IOdictionary mrfProperties
(
IOobject
(
"mrfProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
scalar lambdaFf
(
readScalar(mrfProperties.lookup("lambdaFf"))
);
scalar lambdaF0
(
readScalar(mrfProperties.lookup("lambdaF0"))
);
// Parameters of moving reference frame
IOdictionary movingReferenceFrame
(
IOobject
(
"movingReferenceFrame",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
)
);
// - Bubble center
vector Cb;
if (movingReferenceFrame.found("Cb"))
{
Cb = vector
(
movingReferenceFrame.lookup("Cb")
);
}
else
{
Cb = gSum((1.0 - interface.fluidIndicator().internalField())*
mesh.C().internalField()*mesh.V())/
gSum((1.0 - interface.fluidIndicator().internalField())*mesh.V());
}
// - Bubble centre on the start of calculation
vector Cbf;
if (movingReferenceFrame.found("Cbf"))
{
Cbf = vector
(
movingReferenceFrame.lookup("Cbf")
);
}
else
{
Cbf = Cb;
}
// - Bubble position vector
dimensionedVector XF ("XF", dimLength, vector::zero);
if (movingReferenceFrame.found("XF"))
{
XF = dimensionedVector
(
movingReferenceFrame.lookup("XF")
);
}
else
{
XF = dimensionedVector
(
"XF",
dimLength,
Cbf
);
}
// - Bubble velocity
dimensionedVector UF ("UF", dimVelocity, vector::zero);
if (movingReferenceFrame.found("UF"))
{
UF = dimensionedVector
(
movingReferenceFrame.lookup("UF")
);
}
// - Bubble acceleration
dimensionedVector aF ("aF", dimensionSet(0,1,-2,0,0,0,0), vector::zero);
if (movingReferenceFrame.found("aF"))
{
aF = dimensionedVector
(
movingReferenceFrame.lookup("aF")
);
}
IOdictionary bubbleProperties
(
IOobject
(
"bubbleProperties",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
)
);
scalar Vb;
if (bubbleProperties.found("Vb"))
{
Vb = readScalar
(
bubbleProperties.lookup("Vb")
);
}
else
{
Vb = gSum((1.0 - interface.fluidIndicator().internalField())*mesh.V());
bubbleProperties.add("Vb", Vb);
}
scalar Vbf;
if (bubbleProperties.found("Vbf"))
{
Vbf = readScalar
(
bubbleProperties.lookup("Vbf")
);
}
else
{
Vbf = Vb;
bubbleProperties.add("Vbf", Vbf);
}

View file

@ -1,82 +0,0 @@
Info<< "\nReading field p\n" << endl << flush;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl << flush;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhi.H"
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimMass/dimVolume, 0)
);
freeSurface interface(mesh, rho, U, p, phi);
rho = interface.fluidIndicator()*
(
interface.rhoFluidA()
- interface.rhoFluidB()
)
+ interface.rhoFluidB();
volScalarField mu
(
IOobject
(
"mu",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
interface.fluidIndicator()*
(
interface.muFluidA()
- interface.muFluidB()
)
+ interface.muFluidB()
);
surfaceScalarField phiNet = fvc::interpolate(rho)*(phi - fvc::meshPhi(rho,U));
phiNet.rename("phiNet");

View file

@ -1,26 +0,0 @@
OFstream* forcesFilePtr = NULL;
if(Pstream::master())
{
mkDir
(
args.rootPath()
/args.globalCaseName()
/"forces"
/runTime.timeName()
);
forcesFilePtr =
new OFstream
(
args.rootPath()
/args.globalCaseName()
/"forces"
/runTime.timeName()
/"dragAndLift"
);
*forcesFilePtr << "Time" << tab << "drag" << tab << "lift" << endl;
}
OFstream& forcesFile = *forcesFilePtr;

View file

@ -1,29 +0,0 @@
OFstream* pathFilePtr = NULL;
if(Pstream::master())
{
mkDir
(
args.rootPath()
/args.globalCaseName()
/"path"
/runTime.timeName()
);
pathFilePtr =
new OFstream
(
args.rootPath()
/args.globalCaseName()
/"path"
/runTime.timeName()
/"path"
);
*pathFilePtr << "Time" << tab;
*pathFilePtr << "Xb" << tab << "Yb" << tab << "Zb" << tab
<< "Ub" << tab << "ab" << endl;
}
OFstream& pathFile = *pathFilePtr;

View file

@ -1,24 +0,0 @@
if(Pstream::master())
{
Info<< "Free surface flux: sum local = "
<< sum(mag(phi.boundaryField()[interface.aPatchID()]))
<< ", global = "
<< sum(phi.boundaryField()[interface.aPatchID()]) << endl;
Info<< "Free surface continuity error : sum local = " <<
sum
(
mag
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
)
<< ", global = " <<
sum
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
<< endl;
}

View file

@ -1,13 +0,0 @@
if(Pstream::master())
{
scalarField weights =
mag(phi.boundaryField()[interface.bPatchID()]);
if(mag(sum(weights)) > SMALL)
{
weights /= sum(weights);
}
phi.boundaryField()[interface.bPatchID()] -=
weights*sum(phi.boundaryField()[interface.bPatchID()]);
}

View file

@ -1,15 +0,0 @@
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
int nTimeCorr = 0;
if (simple.found("nTimeCorrectors"))
{
nTimeCorr = readInt(simple.lookup("nTimeCorrectors"));
}
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}

View file

@ -1,17 +0,0 @@
if(spacePatchID != -1)
{
fvsPatchScalarField& spacePhi = phi.boundaryField()[spacePatchID];
scalar outflowScaling =
(
- sum(neg(spacePhi)*spacePhi) + SMALL
)/
(
sum(pos(spacePhi)*spacePhi) + SMALL
);
spacePhi += pos(spacePhi)*spacePhi*(outflowScaling - 1.0);
U.boundaryField()[spacePatchID] +=
pos(spacePhi)*U.boundaryField()[spacePatchID]*(outflowScaling - 1.0);
}

View file

@ -1,77 +0,0 @@
vector Cb0 = Cb;
Cb = gSum((1.0 - interface.fluidIndicator().internalField())*
mesh.C().internalField()*mesh.V())/
gSum((1.0 - interface.fluidIndicator().internalField())*mesh.V());
Info << "Current bubble centre: " << Cb << endl;
dimensionedVector dUF
(
"dUF",
dimVelocity,
lambdaFf*(Cb-Cbf)/runTime.deltaT0().value()
+ lambdaF0*(Cb-Cb0)/runTime.deltaT0().value()
);
XF += (UF + 0.5*dUF)*runTime.deltaT0();
Info << "Current bubble position: " << XF << endl;
// dimensionedVector UF00 ("UF00", dimVelocity, UF0.value());
// UF0 = UF;
UF += dUF;
Info << "Current bubble velocity: " << UF << endl;
aF = dUF/runTime.deltaT0();
// aF = (3.0*UF - 4.0*UF0 + UF00)/(2.0*runTime.deltaT0());
Info << "Current bubble acceleration: " << aF << endl;
if(spacePatchID != -1)
{
if
(
U.boundaryField()[spacePatchID].type()
== inletOutletFvPatchVectorField::typeName
)
{
inletOutletFvPatchVectorField& spaceU =
refCast<inletOutletFvPatchVectorField>
(
U.boundaryField()[spacePatchID]
);
spaceU.refValue() = -UF.value();
}
}
// Update movingReferenceFrame dictionary
if (movingReferenceFrame.found("Cb"))
{
movingReferenceFrame.remove("Cb");
}
movingReferenceFrame.add("Cb", Cb);
if (movingReferenceFrame.found("Cbf"))
{
movingReferenceFrame.remove("Cbf");
}
movingReferenceFrame.add("Cbf", Cbf);
if (movingReferenceFrame.found("XF"))
{
movingReferenceFrame.remove("XF");
}
movingReferenceFrame.add("XF", XF);
if (movingReferenceFrame.found("UF"))
{
movingReferenceFrame.remove("UF");
}
movingReferenceFrame.add("UF", UF);
if (movingReferenceFrame.found("aF"))
{
movingReferenceFrame.remove("aF");
}
movingReferenceFrame.add("aF", aF);

View file

@ -1,62 +0,0 @@
if (runTime.outputTime())
{
// Local free surface curvature and flux
if(Pstream::master())
{
OFstream file
(
runTime.timePath()/"fsData.dat"
);
file.precision(12);
scalarField flowRate =
phi.boundaryField()[interface.aPatchID()]
+ fvc::meshPhi(rho,U)().boundaryField()[interface.aPatchID()];
const vectorField& C =
mesh.Cf().boundaryField()[interface.aPatchID()];
const scalarField& K =
interface.aMesh().faceCurvatures().internalField();
file<< "X" << tab
<< "Y" << tab
<< "Z" << tab
<< "K" << tab
<< "flux";
if(!interface.cleanInterface())
{
file<< tab << "Cs" << tab
<< "surfTension" << endl;
}
else
{
file << endl;
}
forAll(flowRate, faceI)
{
file<< C[faceI].x() << tab
<< C[faceI].y() << tab
<< C[faceI].z() << tab
<< K[faceI] << tab
<< flowRate[faceI];
if(!interface.cleanInterface())
{
file<< tab <<
interface.surfactantConcentration().internalField()[faceI]
<< tab
<< interface.surfaceTension().internalField()[faceI]
<< endl;
}
else
{
file << endl;
}
}
}
}

View file

@ -1,68 +0,0 @@
if(Pstream::master())
{
// const scalarField& magSf =
// mesh.magSf().boundaryField()[interface.aPatchID()];
// vectorField n =
// mesh.Sf().boundaryField()[interface.aPatchID()]/magSf;
// const scalarField& P = p.boundaryField()[interface.aPatchID()];
// vectorField pressureForces = magSf*P*n;
// vectorField snGradU =
// U.boundaryField()[interface.aPatchID()].snGrad();
// vectorField viscousForces =
// - interface.muFluidA().value()*magSf*
// (
// snGradU
// + ((n*n)&snGradU)
// + (fac::grad(interface.Us())&interface.aMesh().faceAreaNormals())
// ().internalField()
// );
vector totalPressureForce = -interface.totalPressureForce();
vector totalViscousForce = -interface.totalViscousForce();
vector totalForce = totalPressureForce + totalViscousForce;
vector dragDir;
scalar Uref;
if(mag(UF.value()) > SMALL)
{
dragDir = - UF.value()/mag(UF.value());
Uref = mag(UF.value());
}
else
{
dragDir = interface.g().value()/mag(interface.g().value());
Uref = SMALL;
}
scalar Aref =
sum
(
(dragDir&mesh.Sf().boundaryField()[interface.aPatchID()])*
pos(dragDir&mesh.Sf().boundaryField()[interface.aPatchID()])
);
scalar drag =
(dragDir&totalForce)/
(0.5*interface.rhoFluidA().value()*sqr(Uref)*Aref);
scalar lift =
mag((I - dragDir*dragDir)&totalForce)/
(0.5*interface.rhoFluidA().value()*sqr(Uref)*Aref);
forcesFile << runTime.value() << tab;
forcesFile << drag << tab << lift << endl;
}

View file

@ -1,10 +0,0 @@
if(Pstream::master())
{
pathFile << runTime.value() << tab;
pathFile << XF.value().x() << tab
<< XF.value().y() << tab
<< XF.value().z() << tab
<< mag(UF.value()) << tab
<< mag(aF.value()) << endl;
}

View file

@ -1,79 +0,0 @@
// The FOAM Project // File: updateCoupledInterfaces.C
/*
-------------------------------------------------------------------------------
========= | Class Implementation
\\ / |
\\ / | Name: updateCoupledInterfaces
\\ / | Family: matrix
\\/ |
F ield | FOAM version: 2.2
O peration |
A and | Copyright (C) 1991-2003 Nabla Ltd.
M anipulation | All Rights Reserved.
-------------------------------------------------------------------------------
DESCRIPTION
AUTHOR
Hrvoje Jasak and Henry G. Weller.
-------------------------------------------------------------------------------
*/
#include "lduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void lduMatrix::updateMatrixInterfaces
(
const FieldField<Field, scalar>& coupleCoeffs,
const lduCoupledInterfacePtrsList& interfaces,
const scalarField& psiif,
scalarField& result,
const direction cmpt
) const
{
// Initialise coupling
forAll (interfaces, interfaceI)
{
if (interfaces[interfaceI]->coupled())
{
interfaces[interfaceI]->initInterfaceMatrixUpdate
(
psiif,
result,
*this,
coupleCoeffs[interfaceI],
cmpt,
false
);
}
}
// Update coupled interface
forAll (interfaces, interfaceI)
{
if (interfaces[interfaceI]->coupled())
{
interfaces[interfaceI]->updateInterfaceMatrix
(
psiif,
result,
*this,
coupleCoeffs[interfaceI],
cmpt
);
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -2,4 +2,18 @@ freeSurface.C
makeFreeSurfaceData.C makeFreeSurfaceData.C
freeSurfacePointDisplacement.C freeSurfacePointDisplacement.C
correctedFvPatchFields/correctedFvPatchField/correctedFvPatchFields.C
basicCorrectedFvPatchFields = correctedFvPatchFields/basicCorrectedFvPatchFields
$(basicCorrectedFvPatchFields)/fixedGradient/fixedGradientCorrectedFvPatchFields.C
$(basicCorrectedFvPatchFields)/fixedValue/fixedValueCorrectedFvPatchFields.C
$(basicCorrectedFvPatchFields)/zeroGradient/zeroGradientCorrectedFvPatchFields.C
patchCorrectedSnGrad/patchCorrectedSnGrads.C
functionObjects/bubbleHistory/bubbleHistory.C
functionObjects/sloshingHistory/sloshingHistory.C
LIB = $(FOAM_LIBBIN)/libfreeSurface LIB = $(FOAM_LIBBIN)/libfreeSurface

View file

@ -3,6 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetDecompositionMotionSolver/lnInclude \ -I$(LIB_SRC)/dynamicMesh/meshMotion/tetDecompositionMotionSolver/lnInclude \
-I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \ -I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \
$(WM_DECOMP_INC) $(WM_DECOMP_INC)

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

File diff suppressed because it is too large Load diff

View file

@ -45,9 +45,8 @@ SourceFiles
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "faCFD.H" #include "faCFD.H"
#include "patchToPatchInterpolation.H" #include "IOpatchToPatchInterpolation.H"
#include "tetDecompositionMotionSolver.H" #include "dynamicFvMesh.H"
#include "tetPolyPatchInterpolation.H"
#include "surfactantProperties.H" #include "surfactantProperties.H"
@ -67,7 +66,7 @@ class freeSurface
// Private data // Private data
//- Reference to fvMesh //- Reference to fvMesh
fvMesh& mesh_; dynamicFvMesh& mesh_;
//- Reference to density field //- Reference to density field
const volScalarField& rho_; const volScalarField& rho_;
@ -91,10 +90,11 @@ class freeSurface
// parallel with free-surface point normals // parallel with free-surface point normals
Switch normalMotionDir_; Switch normalMotionDir_;
//- Is it necessary to smoot the free surface //- Free-surface points displacement direction
Switch freeSurfaceSmoothing_; // if not normal motion direction
vector motionDir_;
//- Is it free-surface clean of surfactants //- Is it free-surface clean of surfactant
Switch cleanInterface_; Switch cleanInterface_;
//- ID of the fvMesh patch which represents //- ID of the fvMesh patch which represents
@ -126,23 +126,27 @@ class freeSurface
//- Free surface patches which do not move //- Free surface patches which do not move
wordList fixedFreeSurfacePatches_; wordList fixedFreeSurfacePatches_;
//- Free surface patches for witch point normals
// must be corrected
wordList pointNormalsCorrectionPatches_;
//- Number of free-surface correctors
label nFreeSurfCorr_;
//- Interface smoothing at the begining of time step
Switch smoothing_;
// Demand-driven data // Demand-driven data
//- Patch A motion interpolation //- Patch to patch interpolation object which deals with
mutable tetPolyPatchInterpolation* interpolatorAPtr_; // interpolation of flow variables between two free-surface
// (interface) patches
//- Patch B motion interpolation mutable IOpatchToPatchInterpolation* interpolatorABPtr_;
mutable tetPolyPatchInterpolation* interpolatorBPtr_;
//- Patch to patch interpolation object which deals with //- Patch to patch interpolation object which deals with
// interpolation of flow variables between two free-surface // interpolation of flow variables between two free-surface
// (interface) patches // (interface) patches
mutable patchToPatchInterpolation* interpolatorABPtr_; mutable IOpatchToPatchInterpolation* interpolatorBAPtr_;
//- Patch to patch interpolation object which deals with
// interpolation of flow variables between two free-surface
// (interface) patches
mutable patchToPatchInterpolation* interpolatorBAPtr_;
//- Points which are attached to the free-surface A side faces //- Points which are attached to the free-surface A side faces
// and which defines the free-surface shape // and which defines the free-surface shape
@ -150,7 +154,7 @@ class freeSurface
//- Field which additionally determines //- Field which additionally determines
// the motion of free-surface points // the motion of free-surface points
mutable scalarField* motionPointsMaskPtr_; mutable labelList* motionPointsMaskPtr_;
//- Displacement direction of free-surface points //- Displacement direction of free-surface points
mutable vectorField* pointsDisplacementDirPtr_; mutable vectorField* pointsDisplacementDirPtr_;
@ -166,9 +170,6 @@ class freeSurface
// free-surface side A faces // free-surface side A faces
mutable faMesh* aMeshPtr_; mutable faMesh* aMeshPtr_;
//- Reference to mesh motion solver
mutable tetDecompositionMotionSolver* mSolverPtr_;
//- Free-surface velocity field //- Free-surface velocity field
mutable areaVectorField* UsPtr_; mutable areaVectorField* UsPtr_;
@ -197,16 +198,15 @@ class freeSurface
void makeDirections(); void makeDirections();
void makeTotalDisplacement(); void makeTotalDisplacement();
void readTotalDisplacement(); void readTotalDisplacement();
void makeFaMesh(); void makeFaMesh() const;
void makeMeshMotionSolver(); void makeUs() const;
void makeUs();
void makePhis(); void makePhis();
void makeSurfactConc(); void makePhi();
void makeSurfaceTension(); void makeDdtPhi();
void makeSurfactant(); void makeSurfactConc() const;
void makeSurfaceTension() const;
void makeSurfactant() const;
void makeFluidIndicator(); void makeFluidIndicator();
void makePatchPointInterpolators();
//- Clear all demand-driven data //- Clear all demand-driven data
void clearOut(); void clearOut();
@ -222,6 +222,14 @@ class freeSurface
// for given new control points position // for given new control points position
tmp<vectorField> pointDisplacement(const scalarField& deltaH); tmp<vectorField> pointDisplacement(const scalarField& deltaH);
// Calc least sqare plane point and normal
tmp<vectorField> lsPlanePointAndNormal
(
const vectorField& points,
const vector& origin,
const vector& axis
) const;
public: public:
// Declare name of the class and it's debug switch // Declare name of the class and it's debug switch
@ -232,7 +240,7 @@ public:
freeSurface freeSurface
( (
fvMesh& m, dynamicFvMesh& m,
const volScalarField& rho, const volScalarField& rho,
volVectorField& Ub, volVectorField& Ub,
volScalarField& Pb, volScalarField& Pb,
@ -249,19 +257,19 @@ public:
//- Return reference to fvMesh //- Return reference to fvMesh
const fvMesh& mesh() const dynamicFvMesh& mesh()
{ {
return mesh_; return mesh_;
} }
//- Return reference to fvMesh //- Return reference to fvMesh
fvMesh& mesh() const dynamicFvMesh& mesh() const
{ {
return mesh_; return mesh_;
} }
//- Return reference to time //- Return reference to DB
const Time& time() const const Time& DB() const
{ {
return U_.mesh().time(); return U_.mesh().time();
} }
@ -278,16 +286,22 @@ public:
return U_; return U_;
} }
//- Return reference to velocity field
const volVectorField& U() const
{
return U_;
}
//- Return reference to pressure field //- Return reference to pressure field
volScalarField& p() volScalarField& p()
{ {
return p_; return p_;
} }
//- Return reference to flux field //- Return reference to pressure field
const surfaceScalarField& phi() const const volScalarField& p() const
{ {
return phi_; return p_;
} }
//- Are there exist two fluid //- Are there exist two fluid
@ -303,13 +317,6 @@ public:
return normalMotionDir_; return normalMotionDir_;
} }
//- Is it necessary to consider the normal shear stress
// at the free-surface
bool freeSurfaceSmoothing() const
{
return freeSurfaceSmoothing_;
}
//- Is it interface clean //- Is it interface clean
bool cleanInterface() const bool cleanInterface() const
{ {
@ -366,25 +373,19 @@ public:
return cleanInterfaceSurfTension_; return cleanInterfaceSurfTension_;
} }
//- Return reference to interpolator for point motion, side A
const tetPolyPatchInterpolation& interpolatorA();
//- Return reference to interpolator for point motion, side B
const tetPolyPatchInterpolation& interpolatorB();
//- Return reference to interpolator from free surface side A to //- Return reference to interpolator from free surface side A to
// free surface side B // free surface side B
const patchToPatchInterpolation& interpolatorAB(); const IOpatchToPatchInterpolation& interpolatorAB();
//- Return reference to interpolator from free surface side B to //- Return reference to interpolator from free surface side B to
// free surface side A // free surface side A
const patchToPatchInterpolation& interpolatorBA(); const IOpatchToPatchInterpolation& interpolatorBA();
//- Return control points //- Return control points
vectorField& controlPoints(); vectorField& controlPoints();
//- Return reference to motion points mask field //- Return reference to motion points mask field
scalarField& motionPointsMask(); labelList& motionPointsMask();
//- Return reference to point displacement direction field //- Return reference to point displacement direction field
vectorField& pointsDisplacementDir(); vectorField& pointsDisplacementDir();
@ -398,23 +399,35 @@ public:
//- Return reference to finite area mesh //- Return reference to finite area mesh
faMesh& aMesh(); faMesh& aMesh();
//- Return reference to motion solver //- Return reference to finite area mesh
tetDecompositionMotionSolver& meshMotionSolver(); const faMesh& aMesh() const;
//- Return free-surface velocity field //- Return free-surface velocity field
areaVectorField& Us(); areaVectorField& Us();
//- Return free-surface velocity field
const areaVectorField& Us() const;
//- Return free-surface fluid flux field //- Return free-surface fluid flux field
edgeScalarField& Phis(); edgeScalarField& Phis();
//- Return free-surface surfactant concentration field //- Return free-surface surfactant concentration field
areaScalarField& surfactantConcentration(); areaScalarField& surfactantConcentration();
//- Return free-surface surfactant concentration field
const areaScalarField& surfactantConcentration() const;
//- Return surface tension field //- Return surface tension field
areaScalarField& surfaceTension(); areaScalarField& surfaceTension();
//- Return surface tension field
const areaScalarField& surfaceTension() const;
//- Return surface tension gradient
tmp<areaVectorField> surfaceTensionGrad();
//- Return surfactant properties //- Return surfactant properties
const surfactantProperties& surfactant(); const surfactantProperties& surfactant() const;
//- Return referenct to fluid indicator //- Return referenct to fluid indicator
const volScalarField& fluidIndicator(); const volScalarField& fluidIndicator();
@ -422,11 +435,14 @@ public:
//- Update control points end displacement directions //- Update control points end displacement directions
void updateDisplacementDirections(); void updateDisplacementDirections();
//- Move only free-surface points //- Predict interface points position
bool movePoints(); bool predictPoints();
//- Move only free-surface points for uniform displacement //- Correct interface points position
bool movePoints(scalar displ); bool correctPoints();
//- Move only free-surface points
bool movePoints(const scalarField& interfacePHi);
//- Move mesh points for old time free-surface points displacement //- Move mesh points for old time free-surface points displacement
bool moveMeshPointsForOldFreeSurfDisplacement(); bool moveMeshPointsForOldFreeSurfDisplacement();
@ -434,38 +450,56 @@ public:
//- Move mesh points //- Move mesh points
bool moveMeshPoints(); bool moveMeshPoints();
//- Move mesh points for given displacement filed //- Update free-surface boundary conditions
bool moveMeshPoints(const scalarField& delta); void updateBoundaryConditions();
//- Correct free-surface boundary conditions
void correctBoundaryConditions();
//- Correct free-surface pressure //- Correct free-surface pressure
void correctPressure(); void updatePressure();
//- Correct free-surface velocity //- Correct free-surface velocity
void correctVelocity(); void updateVelocity();
//- Correct free-surface velocity gradient //- Update free-surface flux
void correctVelocityGradient(); void updateSurfaceFlux();
//- Correct free-surface velocity //- Update free-surface surfactant concentration
void correctSurfaceFlux(); void updateSurfactantConcentration();
//- Correct free-surface surfactant concentration //- Correct surface velocity boundary conditions
void correctSurfactantConcentration(); void correctUsBoundaryConditions();
//- Calculate total pressure force //- Calculate total pressure force
vector totalPressureForce(); vector totalPressureForce() const;
//- Calculate total viscous force //- Calculate total viscous force
vector totalViscousForce(); vector totalViscousForce() const;
//- Calculate total surface tension force
vector totalSurfaceTensionForce() const;
//- Calculate free-surface undulation indicator //- Calculate free-surface undulation indicator
tmp<scalarField> undulationIndicator(); tmp<scalarField> undulationIndicator();
//- Smooth free-surface //- Smooth free-surface
void smooth(); void smooth();
//- Chech free-surface faces flatness
tmp<scalarField> checkFaceFlatness();
//- Initialize control points position
void initializeControlPointsPosition();
//- Maximal surface tension based Courant number
scalar maxCourantNumber();
//- Update properties
void updateProperties();
//- Write VTK freeSurface mesh
void writeVTK() const;
//- Write VTK freeSurface control points
void writeVTKControlPoints();
}; };

View file

@ -26,7 +26,10 @@ License
#include "freeSurface.H" #include "freeSurface.H"
#include "primitivePatchInterpolation.H" #include "primitivePatchInterpolation.H"
#include "faceTetPolyPatch.H" #include "wedgeFaPatch.H"
#include "wallFvPatch.H"
#include "wedgeFaPatchFields.H"
#include "slipFaPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,8 +42,8 @@ void freeSurface::makeInterpolators()
{ {
if (debug) if (debug)
{ {
Info<< "freeSurface::makeInterpolators(): " Info<< "freeSurface::makeInterpolators() : "
<< "making patch to patch interpolator" << "making pathc to patch interpolator"
<< endl; << endl;
} }
@ -49,13 +52,13 @@ void freeSurface::makeInterpolators()
// if the pointer is already set // if the pointer is already set
if if
( (
interpolatorABPtr_ || interpolatorBAPtr_ ||
interpolatorBAPtr_ interpolatorABPtr_
) )
{ {
FatalErrorIn("freeSurface::makeInterpolators()") FatalErrorIn("freeSurface::makeInterpolators()")
<< "patch to patch interpolators already exists" << "patch to patch interpolators already exists"
<< abort(FatalError); << abort(FatalError);
} }
@ -74,8 +77,18 @@ void freeSurface::makeInterpolators()
<< abort(FatalError); << abort(FatalError);
} }
interpolatorBAPtr_ = new patchToPatchInterpolation // patchToPatchInterpolation::setDirectHitTol(1e-2);
interpolatorBAPtr_ = new IOpatchToPatchInterpolation
( (
IOobject
(
"baInterpolator",
DB().timeName(),
mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh().boundaryMesh()[bPatchID()], mesh().boundaryMesh()[bPatchID()],
mesh().boundaryMesh()[aPatchID()], mesh().boundaryMesh()[aPatchID()],
intersection::VISIBLE intersection::VISIBLE
@ -83,13 +96,141 @@ void freeSurface::makeInterpolators()
); );
interpolatorABPtr_ = new patchToPatchInterpolation const scalarField& faceDistBA =
interpolatorBAPtr_->faceDistanceToIntersection();
forAll(faceDistBA, faceI)
{
if(mag(faceDistBA[faceI] - GREAT) < SMALL)
{
FatalErrorIn("freeSurface::makeInterpolators()")
<< "Error in B-to-A face patchToPatchInterpolation."
<< abort(FatalError);
}
}
const scalarField& pointDistBA =
interpolatorBAPtr_->pointDistanceToIntersection();
forAll(pointDistBA, pointI)
{
if(mag(pointDistBA[pointI] - GREAT) < SMALL)
{
FatalErrorIn("freeSurface::makeInterpolators()")
<< "Error in B-to-A point patchToPatchInterpolation."
<< abort(FatalError);
}
}
interpolatorABPtr_ = new IOpatchToPatchInterpolation
( (
IOobject
(
"abInterpolator",
DB().timeName(),
mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh().boundaryMesh()[aPatchID()], mesh().boundaryMesh()[aPatchID()],
mesh().boundaryMesh()[bPatchID()], mesh().boundaryMesh()[bPatchID()],
intersection::VISIBLE intersection::VISIBLE
// intersection::HALF_RAY // intersection::HALF_RAY
); );
const scalarField& faceDistAB =
interpolatorABPtr_->faceDistanceToIntersection();
forAll(faceDistAB, faceI)
{
if(mag(faceDistAB[faceI] - GREAT) < SMALL)
{
FatalErrorIn("freeSurface::makeInterpolators()")
<< "Error in A-to-B face patchToPatchInterpolation."
<< abort(FatalError);
}
}
const scalarField& pointDistAB =
interpolatorABPtr_->pointDistanceToIntersection();
forAll(pointDistAB, pointI)
{
if(mag(pointDistAB[pointI] - GREAT)<SMALL)
{
FatalErrorIn("freeSurface::makeInterpolators()")
<< "Error in A-to-B point patchToPatchInterpolation."
<< abort(FatalError);
}
}
Info << "\nCheck A-to-B and B-to-A interpolators" << endl;
scalar maxDist = max
(
mag
(
interpolatorABPtr_->faceInterpolate
(
vectorField(mesh().boundaryMesh()[aPatchID()]
.faceCentres())
)
- mesh().boundaryMesh()[bPatchID()].faceCentres()
)
);
scalar maxDistPt = max
(
mag
(
interpolatorABPtr_->pointInterpolate
(
vectorField(mesh().boundaryMesh()[aPatchID()]
.localPoints())
)
- mesh().boundaryMesh()[bPatchID()].localPoints()
)
);
Info << "A-to-B interpolation error, face: " << maxDist
<< ", point: " << maxDistPt << endl;
maxDist = max
(
mag
(
interpolatorBAPtr_->faceInterpolate
(
vectorField
(
mesh().boundaryMesh()[bPatchID()].faceCentres()
)
)
- mesh().boundaryMesh()[aPatchID()].faceCentres()
)
);
maxDistPt = max
(
mag
(
interpolatorBAPtr_->pointInterpolate
(
vectorField
(
mesh().boundaryMesh()[bPatchID()].localPoints()
)
)
- mesh().boundaryMesh()[aPatchID()].localPoints()
)
);
Info << "B-to-A interpolation error, face: " << maxDist
<< ", point: " << maxDistPt << endl;
} }
@ -97,7 +238,7 @@ void freeSurface::makeControlPoints()
{ {
if (debug) if (debug)
{ {
Info<< "freeSurface::makeControlPoints(): " Info<< "freeSurface::makeControlPoints() : "
<< "making control points" << "making control points"
<< endl; << endl;
} }
@ -107,16 +248,15 @@ void freeSurface::makeControlPoints()
// if the pointer is already set // if the pointer is already set
if (controlPointsPtr_) if (controlPointsPtr_)
{ {
FatalErrorIn("freeSurface::makeControlPoints()") FatalErrorIn("freeSurface::makeInterpolators()")
<< "patch to patch interpolators already exists" << "patch to patch interpolators already exists"
<< abort(FatalError); << abort(FatalError);
} }
IOobject controlPointsHeader IOobject controlPointsHeader
( (
"controlPoints", "controlPoints",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::MUST_READ IOobject::MUST_READ
); );
@ -129,7 +269,7 @@ void freeSurface::makeControlPoints()
IOobject IOobject
( (
"controlPoints", "controlPoints",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
@ -144,13 +284,15 @@ void freeSurface::makeControlPoints()
IOobject IOobject
( (
"controlPoints", "controlPoints",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
aMesh().areaCentres().internalField() aMesh().areaCentres().internalField()
); );
initializeControlPointsPosition();
} }
} }
@ -183,10 +325,10 @@ void freeSurface::makeMotionPointsMask()
} }
motionPointsMaskPtr_ = new scalarField motionPointsMaskPtr_ = new labelList
( (
mesh().boundaryMesh()[aPatchID()].nPoints(), mesh().boundaryMesh()[aPatchID()].nPoints(),
1.0 1
); );
} }
@ -219,7 +361,7 @@ void freeSurface::makeDirections()
if(aPatchID() == -1) if(aPatchID() == -1)
{ {
FatalErrorIn("freeSurface::makeMotionPointsMask()") FatalErrorIn("freeSurface::makeDirections()")
<< "Free surface patch A not defined." << "Free surface patch A not defined."
<< abort(FatalError); << abort(FatalError);
} }
@ -229,17 +371,28 @@ void freeSurface::makeDirections()
new vectorField new vectorField
( (
mesh().boundaryMesh()[aPatchID()].nPoints(), mesh().boundaryMesh()[aPatchID()].nPoints(),
-(g_/mag(g_)).value() vector::zero
); );
facesDisplacementDirPtr_ = facesDisplacementDirPtr_ =
new vectorField new vectorField
( (
mesh().boundaryMesh()[aPatchID()].size(), mesh().boundaryMesh()[aPatchID()].size(),
-(g_/mag(g_)).value() vector::zero
); );
if(!normalMotionDir())
{
if(mag(motionDir_) < SMALL)
{
FatalErrorIn("freeSurface::makeDirections()")
<< "Zero motion direction"
<< abort(FatalError);
}
facesDisplacementDir() = motionDir_;
pointsDisplacementDir() = motionDir_;
}
updateDisplacementDirections(); updateDisplacementDirections();
} }
@ -264,14 +417,13 @@ void freeSurface::makeTotalDisplacement()
<< abort(FatalError); << abort(FatalError);
} }
totalDisplacementPtr_ = totalDisplacementPtr_ =
new vectorIOField new vectorIOField
( (
IOobject IOobject
( (
"totalDisplacement", "totalDisplacement",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
@ -304,13 +456,12 @@ void freeSurface::readTotalDisplacement()
<< abort(FatalError); << abort(FatalError);
} }
if if
( (
IOobject IOobject
( (
"totalDisplacement", "totalDisplacement",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
@ -323,7 +474,7 @@ void freeSurface::readTotalDisplacement()
IOobject IOobject
( (
"totalDisplacement", "totalDisplacement",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
@ -333,7 +484,7 @@ void freeSurface::readTotalDisplacement()
} }
void freeSurface::makeFaMesh() void freeSurface::makeFaMesh() const
{ {
if (debug) if (debug)
{ {
@ -342,7 +493,6 @@ void freeSurface::makeFaMesh()
<< endl; << endl;
} }
// It is an error to attempt to recalculate // It is an error to attempt to recalculate
// if the pointer is already set // if the pointer is already set
if (aMeshPtr_) if (aMeshPtr_)
@ -352,76 +502,10 @@ void freeSurface::makeFaMesh()
<< abort(FatalError); << abort(FatalError);
} }
aMeshPtr_ = new faMesh(mesh()); aMeshPtr_ = new faMesh(mesh());
} }
void freeSurface::makeUs() const
void freeSurface::makeMeshMotionSolver()
{
if (debug)
{
Info<< "freeSurface::makeMeshMotionSolver() : "
<< "making mesh motion solver"
<< endl;
}
// It is an error to attempt to recalculate
// if the pointer is already set
if (mSolverPtr_)
{
FatalErrorIn("freeSurface::makeMeshMotionSolver()")
<< "mesh motion solver already exists"
<< abort(FatalError);
}
mSolverPtr_ = dynamic_cast<tetDecompositionMotionSolver*>
(
motionSolver::New(mesh()).ptr()
);
}
void freeSurface::makePatchPointInterpolators()
{
if (interpolatorAPtr_ || interpolatorBPtr_)
{
FatalErrorIn("freeSurface::makePatchPointInterpolators()")
<< "mesh motion solver already exists"
<< abort(FatalError);
}
// Make interpolators
if(aPatchID() != -1)
{
interpolatorAPtr_ =
new tetPolyPatchInterpolation
(
refCast<const faceTetPolyPatch>
(
meshMotionSolver().motionU().boundaryField()
[aPatchID()].patch()
)
);
}
if(bPatchID() != -1)
{
interpolatorBPtr_ =
new tetPolyPatchInterpolation
(
refCast<const faceTetPolyPatch>
(
meshMotionSolver().motionU().boundaryField()
[bPatchID()].patch()
)
);
}
}
void freeSurface::makeUs()
{ {
if (debug) if (debug)
{ {
@ -441,19 +525,57 @@ void freeSurface::makeUs()
} }
wordList patchFieldTypes
(
aMesh().boundary().size(),
zeroGradientFaPatchVectorField::typeName
);
forAll(aMesh().boundary(), patchI)
{
if
(
aMesh().boundary()[patchI].type()
== wedgeFaPatch::typeName
)
{
patchFieldTypes[patchI] =
wedgeFaPatchVectorField::typeName;
}
else
{
label ngbPolyPatchID =
aMesh().boundary()[patchI].ngbPolyPatchIndex();
if (ngbPolyPatchID != -1)
{
if
(
mesh().boundary()[ngbPolyPatchID].type()
== wallFvPatch::typeName
)
{
patchFieldTypes[patchI] =
slipFaPatchVectorField::typeName;
}
}
}
}
UsPtr_ = new areaVectorField UsPtr_ = new areaVectorField
( (
IOobject IOobject
( (
"Us", "Us",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
aMesh(), aMesh(),
dimensioned<vector>("Us", dimVelocity, vector::zero), dimensioned<vector>("Us", dimVelocity, vector::zero),
zeroGradientFaPatchVectorField::typeName patchFieldTypes
); );
} }
@ -483,7 +605,7 @@ void freeSurface::makePhis()
IOobject IOobject
( (
"phis", "phis",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -493,7 +615,7 @@ void freeSurface::makePhis()
} }
void freeSurface::makeSurfactConc() void freeSurface::makeSurfactConc() const
{ {
if (debug) if (debug)
{ {
@ -507,18 +629,17 @@ void freeSurface::makeSurfactConc()
// if the pointer is already set // if the pointer is already set
if (surfactConcPtr_) if (surfactConcPtr_)
{ {
FatalErrorIn("freeSurface::makeUs()") FatalErrorIn("freeSurface::makeSurfaceConc()")
<< "free-surface surfactant concentratio field already exists" << "free-surface surfactant concentratio field already exists"
<< abort(FatalError); << abort(FatalError);
} }
surfactConcPtr_ = new areaScalarField surfactConcPtr_ = new areaScalarField
( (
IOobject IOobject
( (
"Cs", "Cs",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
@ -528,7 +649,7 @@ void freeSurface::makeSurfactConc()
} }
void freeSurface::makeSurfaceTension() void freeSurface::makeSurfaceTension() const
{ {
if (debug) if (debug)
{ {
@ -553,7 +674,7 @@ void freeSurface::makeSurfaceTension()
IOobject IOobject
( (
"surfaceTension", "surfaceTension",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -568,7 +689,7 @@ void freeSurface::makeSurfaceTension()
} }
void freeSurface::makeSurfactant() void freeSurface::makeSurfactant() const
{ {
if (debug) if (debug)
{ {
@ -594,6 +715,7 @@ void freeSurface::makeSurfactant()
surfactantPtr_ = new surfactantProperties(surfactProp); surfactantPtr_ = new surfactantProperties(surfactProp);
} }
void freeSurface::makeFluidIndicator() void freeSurface::makeFluidIndicator()
{ {
if (debug) if (debug)
@ -618,7 +740,7 @@ void freeSurface::makeFluidIndicator()
IOobject IOobject
( (
"fluidIndicator", "fluidIndicator",
time().timeName(), DB().timeName(),
mesh(), mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -652,7 +774,7 @@ void freeSurface::makeFluidIndicator()
{ {
fluidIndicator[curCell] = 0.0; fluidIndicator[curCell] = 0.0;
for (int i = 0;i < cellCells[curCell].size();i++) for (int i = 0; i < cellCells[curCell].size(); i++)
{ {
slList.append(cellCells[curCell][i]); slList.append(cellCells[curCell][i]);
} }
@ -666,29 +788,7 @@ void freeSurface::makeFluidIndicator()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const tetPolyPatchInterpolation& freeSurface::interpolatorA() const IOpatchToPatchInterpolation& freeSurface::interpolatorAB()
{
if (!interpolatorAPtr_)
{
makePatchPointInterpolators();
}
return *interpolatorAPtr_;
}
const tetPolyPatchInterpolation& freeSurface::interpolatorB()
{
if (!interpolatorBPtr_)
{
makePatchPointInterpolators();
}
return *interpolatorBPtr_;
}
const patchToPatchInterpolation& freeSurface::interpolatorAB()
{ {
if (!interpolatorABPtr_) if (!interpolatorABPtr_)
{ {
@ -699,7 +799,7 @@ const patchToPatchInterpolation& freeSurface::interpolatorAB()
} }
const patchToPatchInterpolation& freeSurface::interpolatorBA() const IOpatchToPatchInterpolation& freeSurface::interpolatorBA()
{ {
if (!interpolatorBAPtr_) if (!interpolatorBAPtr_)
{ {
@ -721,7 +821,7 @@ vectorField& freeSurface::controlPoints()
} }
scalarField& freeSurface::motionPointsMask() labelList& freeSurface::motionPointsMask()
{ {
if (!motionPointsMaskPtr_) if (!motionPointsMaskPtr_)
{ {
@ -775,18 +875,16 @@ faMesh& freeSurface::aMesh()
return *aMeshPtr_; return *aMeshPtr_;
} }
const faMesh& freeSurface::aMesh() const
tetDecompositionMotionSolver& freeSurface::meshMotionSolver()
{ {
if (!mSolverPtr_) if (!aMeshPtr_)
{ {
makeMeshMotionSolver(); makeFaMesh();
} }
return *mSolverPtr_; return *aMeshPtr_;
} }
areaVectorField& freeSurface::Us() areaVectorField& freeSurface::Us()
{ {
if (!UsPtr_) if (!UsPtr_)
@ -797,6 +895,15 @@ areaVectorField& freeSurface::Us()
return *UsPtr_; return *UsPtr_;
} }
const areaVectorField& freeSurface::Us() const
{
if (!UsPtr_)
{
makeUs();
}
return *UsPtr_;
}
edgeScalarField& freeSurface::Phis() edgeScalarField& freeSurface::Phis()
{ {
@ -808,7 +915,6 @@ edgeScalarField& freeSurface::Phis()
return *phisPtr_; return *phisPtr_;
} }
areaScalarField& freeSurface::surfactantConcentration() areaScalarField& freeSurface::surfactantConcentration()
{ {
if (!surfactConcPtr_) if (!surfactConcPtr_)
@ -819,6 +925,15 @@ areaScalarField& freeSurface::surfactantConcentration()
return *surfactConcPtr_; return *surfactConcPtr_;
} }
const areaScalarField& freeSurface::surfactantConcentration() const
{
if (!surfactConcPtr_)
{
makeSurfactConc();
}
return *surfactConcPtr_;
}
areaScalarField& freeSurface::surfaceTension() areaScalarField& freeSurface::surfaceTension()
{ {
@ -830,8 +945,17 @@ areaScalarField& freeSurface::surfaceTension()
return *surfaceTensionPtr_; return *surfaceTensionPtr_;
} }
const areaScalarField& freeSurface::surfaceTension() const
{
if (!surfaceTensionPtr_)
{
makeSurfaceTension();
}
const surfactantProperties& freeSurface::surfactant() return *surfaceTensionPtr_;
}
const surfactantProperties& freeSurface::surfactant() const
{ {
if (!surfactantPtr_) if (!surfactantPtr_)
{ {
@ -853,6 +977,31 @@ const volScalarField& freeSurface::fluidIndicator()
} }
tmp<areaVectorField> freeSurface::surfaceTensionGrad()
{
tmp<areaVectorField> tgrad
(
new areaVectorField
(
IOobject
(
"surfaceTensionGrad",
DB().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
(-fac::grad(surfactantConcentration())*
surfactant().surfactR()*surfactant().surfactT()/
(1.0 - surfactantConcentration()/
surfactant().surfactSaturatedConc()))()
)
);
return tgrad;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 2004-2007 Z. Tukovic and H. Jasak \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -79,6 +79,9 @@ class surfactantProperties
//- Equilibrium surfactant concentration at the free-surface //- Equilibrium surfactant concentration at the free-surface
dimensionedScalar surfactEquilibriumConc_; dimensionedScalar surfactEquilibriumConc_;
//- Is the surfactant soluble
Switch soluble_;
public: public:
// Constructors // Constructors
@ -94,9 +97,14 @@ public:
surfactR_("R", dimGasConstant*dimMass/dimMoles, 8.3144), surfactR_("R", dimGasConstant*dimMass/dimMoles, 8.3144),
surfactEquilibriumConc_ surfactEquilibriumConc_
( (
surfactSaturatedConc_/ surfactSaturatedConc_
(1.0 + surfactDesorptionCoeff_/surfactBulkConc_) /(
) 1.0
+ surfactDesorptionCoeff_
/surfactBulkConc_
)
),
soluble_(dict.lookup("soluble"))
{} {}
@ -155,6 +163,12 @@ public:
{ {
return surfactEquilibriumConc_; return surfactEquilibriumConc_;
} }
//- Is the surfactant soluble
Switch soluble() const
{
return soluble_;
}
}; };

View file

@ -1,19 +1,15 @@
EXE_INC = \ EXE_INC = \
-I../freeSurface \ -I../include \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I../freeSurface/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetDecompositionMotionSolver/lnInclude \ -I$(LIB_SRC)/finiteArea/lnInclude
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
$(WM_DECOMP_INC)
EXE_LIBS = \ EXE_LIBS = \
-lfreeSurface \ -lfreeSurface \
-lfiniteVolume \ -ldynamicFvMesh \
-lfiniteArea \
-lmeshTools \
-ldynamicMesh \ -ldynamicMesh \
-lmeshTools \ -lmeshTools \
$(WM_DECOMP_LIBS) \ -lfiniteVolume \
-llduSolvers -lfiniteArea

View file

@ -1,5 +1,5 @@
Info<< "Reading field p\n" << endl;
Info<< "\nReading field p\n" << endl << flush;
volScalarField p volScalarField p
( (
IOobject IOobject
@ -14,8 +14,7 @@ volScalarField p
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl << flush;
volVectorField U volVectorField U
( (
IOobject IOobject
@ -30,7 +29,7 @@ volVectorField U
); );
#include "createPhi.H" # include "createPhi.H"
volScalarField rho volScalarField rho
@ -51,15 +50,49 @@ volScalarField rho
freeSurface interface(mesh, rho, U, p, phi); freeSurface interface(mesh, rho, U, p, phi);
rho = interface.fluidIndicator()* volScalarField* fluidIndicatorPtr = NULL;
if(Pstream::parRun())
{
fluidIndicatorPtr = new volScalarField
( (
IOobject
(
"fluidIndicator",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
}
else
{
fluidIndicatorPtr = new volScalarField
(
IOobject
(
"fluidIndicator",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
interface.fluidIndicator()
);
}
volScalarField& fluidIndicator = *fluidIndicatorPtr;
rho = fluidIndicator
*(
interface.rhoFluidA() interface.rhoFluidA()
- interface.rhoFluidB() - interface.rhoFluidB()
) )
+ interface.rhoFluidB(); + interface.rhoFluidB();
rho.correctBoundaryConditions();
volScalarField mu volScalarField mu
( (
@ -69,14 +102,22 @@ volScalarField mu
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::NO_WRITE
), ),
interface.fluidIndicator()*(interface.muFluidA() - interface.muFluidB()) fluidIndicator
*(
interface.muFluidA()
- interface.muFluidB()
)
+ interface.muFluidB() + interface.muFluidB()
); );
// Read interpolators if present
if (interface.twoFluids())
{
interface.interpolatorAB();
}
surfaceScalarField phiNet =
fvc::interpolate(rho)*(phi - fvc::meshPhi(rho, U)); # include "setRefCell.H"
phiNet.rename("phiNet");

View file

@ -1,24 +0,0 @@
if(Pstream::master())
{
Info<< "Free surface flux: sum local = "
<< sum(mag(phi.boundaryField()[interface.aPatchID()]))
<< ", global = "
<< sum(phi.boundaryField()[interface.aPatchID()]) << endl;
Info<< "Free surface continuity error : sum local = " <<
sum
(
mag
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
)
<< ", global = " <<
sum
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
<< endl << endl;
}

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) 2004-2007 Z. Tukovic and H. Jasak \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,29 +23,33 @@ License
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Application Application
interTrackFoam interfaceTrackinFoam
Description Description
Solver for 1 or 2 incompressible fluids, which tracks the interface Incompressible laminar CFD code for simulation of a single bubble rising
using moving mesh in a stil liquid. Interface between fluid phases is tracked using moving
mesh.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "motionSolver.H" #include "dynamicFvMesh.H"
#include "freeSurface.H" #include "freeSurface.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H"
# include "createMeshNoClear.H"
# include "createFields.H"
# include "initContinuityErrs.H"
# include "createTime.H"
# include "createDynamicFvMesh.H"
# include "createFields.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,79 +57,91 @@ int main(int argc, char *argv[])
for (runTime++; !runTime.end(); runTime++) for (runTime++; !runTime.end(); runTime++)
{ {
Info << "Time = " << runTime.value() << endl; Info << "Time = " << runTime.value() << endl << endl;
# include "readInterfaceSIMPLEControls.H" # include "readPISOControls.H"
# include "CourantNo.H"
interface.updateDisplacementDirections();
interface.moveMeshPointsForOldFreeSurfDisplacement(); interface.moveMeshPointsForOldFreeSurfDisplacement();
interface.smooth(); interface.updateDisplacementDirections();
// --- SIMPLE loop interface.predictPoints();
for (label timeCorr=0; timeCorr<=nTimeCorr; timeCorr++)
Pout<< "\nMax surface Courant Number = "
<< interface.maxCourantNumber() << endl << endl;
for (int corr=0; corr<nOuterCorr; corr++)
{ {
p.storePrevIter(); // Update interface bc
interface.updateBoundaryConditions();
interface.correctBoundaryConditions(); // Make the fluxes relative
phi -= fvc::meshPhi(rho, U);
tmp<fvVectorMatrix> UEqn # include "CourantNo.H"
fvVectorMatrix UEqn
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(phiNet, U) + fvm::div(fvc::interpolate(rho)*phi, U, "div(phi,U)")
- fvm::laplacian(mu, U) - fvm::laplacian(mu, U)
); );
UEqn().relax(); solve(UEqn == -fvc::grad(p));
solve(UEqn() == - fvc::grad(p)); // --- PISO loop
for (int i=0; i<nCorr; i++)
volScalarField AU = UEqn().A();
U = UEqn().H()/AU;
U.correctBoundaryConditions();
UEqn.clear();
phi = (fvc::interpolate(U) & mesh.Sf());
// Non-orthogonal pressure corrector loop
for (label nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
tmp<fvScalarMatrix> pEqn volScalarField AU = UEqn.A();
(
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
);
pEqn().setReference(0, 0.0); U = UEqn.H()/AU;
pEqn().solve();
if (nonOrth == nNonOrthCorr) phi = (fvc::interpolate(U) & mesh.Sf());
# include "scalePhi.H"
// Non-orthogonal pressure corrector loop
for (label nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
phi -= pEqn().flux(); fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AU, p)
== fvc::div(phi)
);
# include "setReference.H"
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
} }
# include "continuityErrs.H"
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
} }
# include "continuityErrs.H" interface.correctPoints();
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
// Move mesh
interface.movePoints();
// Update motion fluxes
phiNet = fvc::interpolate(rho)*(phi - fvc::meshPhi(rho, U));
# include "freeSurfaceContinuityErrs.H" # include "freeSurfaceContinuityErrs.H"
} }
# include "volContinuity.H"
Info << "Total surface tension force: "
<< interface.totalSurfaceTensionForce() << endl;
vector totalForce =
interface.totalViscousForce()
+ interface.totalPressureForce();
Info << "Total force: " << totalForce << endl;
runTime.write(); runTime.write();
Info << "ExecutionTime = " Info << "ExecutionTime = "

View file

@ -1,15 +0,0 @@
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
int nTimeCorr = 0;
if (simple.found("nTimeCorrectors"))
{
nTimeCorr = readInt(simple.lookup("nTimeCorrectors"));
}
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}

View file

@ -1,4 +0,0 @@
sloshingInterTrackFoam.C
EXE = $(FOAM_APPBIN)/sloshingInterTrackFoam

View file

@ -1,18 +0,0 @@
EXE_INC = \
-I../freeSurface \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetDecompositionMotionSolver/lnInclude \
$(WM_DECOMP_INC)
EXE_LIBS = \
-lfreeSurface \
-lfiniteArea\
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools \
$(WM_DECOMP_LIBS) \
-llduSolvers

View file

@ -1,80 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimMass/dimVolume, 0)
);
freeSurface interface(mesh, rho, U, p, phi);
rho = interface.fluidIndicator()*
(
interface.rhoFluidA()
- interface.rhoFluidB()
)
+ interface.rhoFluidB();
volScalarField mu
(
IOobject
(
"mu",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
interface.fluidIndicator()*
(
interface.muFluidA()
- interface.muFluidB()
)
+ interface.muFluidB()
);
surfaceScalarField phiNet = fvc::interpolate(rho)*(phi - fvc::meshPhi(rho,U));
phiNet.rename("phiNet");

View file

@ -1,45 +0,0 @@
mkDir(runTime.path()/"positions"/runTime.timeName());
OFstream positionsFile
(
runTime.path()
/"positions"
/runTime.timeName()
/"leftAndRightPosition"
);
positionsFile << "Time" << tab;
positionsFile << "Left" << tab << "Right" << endl;
// Find left and right point label in the patch localPoints field
const pointField& locPoints =
mesh.boundaryMesh()[interface.aPatchID()].localPoints();
label leftPointLabel = -1;
label rightPointLabel = -1;
forAll(locPoints, pointI)
{
if(leftPointLabel == -1 || rightPointLabel == -1)
{
if(mag(locPoints[pointI].x()) < SMALL)
{
leftPointLabel = pointI;
}
else if(mag(locPoints[pointI].x() - 1.0) < SMALL)
{
rightPointLabel = pointI;
}
}
}
if(leftPointLabel == -1 || rightPointLabel == -1)
{
Info << "Can't find left and right points labels!";
return 0;
}
// scalar dissipation = 0.0;

View file

@ -1,29 +0,0 @@
OFstream file
(
runTime.timePath()/"curvature.dat"
);
const vectorField& C = interface.aMesh().areaCentres().internalField();
const scalarField& K = interface.aMesh().faceCurvatures().internalField();
// const scalarField divUs = fac::div(Us)().internalField();
// const vectorField& nP = interface.aMesh().pointAreaNormals();
// const vectorField& nF = interface.aMesh().faceAreaNormals();
// primitivePatchInterpolationZT
// patchInterpolator(mesh.boundaryMesh()[movingPatchID]);
// vectorField nFAvr =
// patchInterpolator.pointToFaceInterpolate(nP);
// nFAvr /= mag(nFAvr);
forAll(C, faceI)
{
file<< C[faceI].x() << ' '
<< C[faceI].y() << ' '
<< K[faceI] << endl;
// << phi.boundaryField()[movingPatchID][faceI] << ' '
// << (180.0/M_PI)*std::acos((nF[faceI])&(nFAvr[faceI])) << endl;
}

View file

@ -1,24 +0,0 @@
if(Pstream::master())
{
Info<< "Free surface flux: sum local = "
<< sum(mag(phi.boundaryField()[interface.aPatchID()]))
<< ", global = "
<< sum(phi.boundaryField()[interface.aPatchID()]) << endl;
Info<< "Free surface continuity error : sum local = " <<
sum
(
mag
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
)
<< ", global = " <<
sum
(
phiNet.boundaryField()[interface.aPatchID()]/
interface.rhoFluidA().value()
)
<< endl << endl;
}

View file

@ -1,15 +0,0 @@
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
int nTimeCorr = 0;
if (simple.found("nTimeCorrectors"))
{
nTimeCorr = readInt(simple.lookup("nTimeCorrectors"));
}
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}

View file

@ -1,155 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2007 Z. Tukovic and H. Jasak
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM 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.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Application
sloshingInterTrackFoam
Description
interTrackFoam application with data recording specific for 2D sloshing case
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "motionSolver.H"
#include "freeSurface.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMeshNoClear.H"
# include "createFields.H"
# include "initContinuityErrs.H"
# include "createPositions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl;
# include "forceWriteData.H"
for (runTime++; !runTime.end(); runTime++)
{
Info << "Time = " << runTime.value() << endl;
# include "readInterfaceSIMPLEControls.H"
# include "CourantNo.H"
interface.updateDisplacementDirections();
interface.moveMeshPointsForOldFreeSurfDisplacement();
// --- SIMPLE loop
for (label timeCorr=0; timeCorr<=nTimeCorr; timeCorr++)
{
p.storePrevIter();
interface.correctBoundaryConditions();
tmp<fvVectorMatrix> UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phiNet, U)
- fvm::laplacian(mu, U)
);
UEqn().relax();
solve(UEqn() == - fvc::grad(p));
volScalarField AU = UEqn().A();
U = UEqn().H()/AU;
U.correctBoundaryConditions();
UEqn.clear();
phi = (fvc::interpolate(U) & mesh.Sf());
// Non-orthogonal pressure corrector loop
for (label nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> pEqn
(
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
);
pEqn().setReference(0, 0.0);
pEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn().flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
// Move mesh
interface.movePoints();
// Update motion fluxes
phiNet = fvc::interpolate(rho)*(phi - fvc::meshPhi(rho, U));
# include "freeSurfaceContinuityErrs.H"
}
runTime.write();
# include "writeData.H"
if (runTime.outputTime())
{
# include "writePositions.H"
}
Info << "ExecutionTime = "
<< scalar(runTime.elapsedCpuTime())
<< " s\n" << endl << endl;
}
Info << "End\n" << endl;
return(0);
}
// ************************************************************************* //

View file

@ -1,4 +0,0 @@
if (runTime.outputTime())
{
# include "forceWriteData.H"
}

View file

@ -1,43 +0,0 @@
positionsFile << runTime.value() << tab;
const pointField& P =
mesh.boundaryMesh()[interface.aPatchID()].localPoints();
// scalar ePot =
// mag
// (
// rhoLiquid.value()*
// sum((g.value()&mesh.C().internalField())*mesh.V())
// );
// scalar eKin =
// 0.5*rhoLiquid.value()*sum(magSqr(U)().internalField()*mesh.V());
// tensorField gradU = fvc::grad(U, "test")().internalField();
// dissipation +=
// 2.0*muLiquid.value()
// *sum((symm(gradU) && gradU)*mesh.V())
// *runTime.deltaT().value();
// fvScalarMatrix eTotEqn
// (
// fvm::ddt(eTot)
// + fvm::div(phi, eTot)
// + dissipation
// );
// eTotEqn.solve();
positionsFile.precision(12);
positionsFile << P[leftPointLabel].y() << tab
<< P[rightPointLabel].y() << endl;
// << ePot << tab
// << eKin << tab
// << ePot + eKin << tab
// << ePot + eKin + dissipation << endl;

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) 1991-2005 OpenCFD Ltd. \\ / A nd | Copyright held by original author
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View file

@ -42,7 +42,6 @@ pointNormalsCorrectionPatches 0 ();
nFreeSurfaceCorrectors 1; nFreeSurfaceCorrectors 1;
freeSurfaceSmoothing on;
surfactantProperties surfactantProperties
{ {

View file

@ -29,8 +29,8 @@ gradSchemes
divSchemes divSchemes
{ {
default none;
div(phi,U) Gauss GammaVDC 0.5; div(phi,U) Gauss GammaVDC 0.5;
div(phiNet,U) Gauss GammaVDC 0.5;
} }
laplacianSchemes laplacianSchemes

View file

@ -34,19 +34,14 @@ solvers
} }
} }
SIMPLE PISO
{ {
nTimeCorrectors 4; nOuterCorrectors 6;
nCorrectors 2;
nNonOrthogonalCorrectors 1; nNonOrthogonalCorrectors 1;
pRefPoint (0 0 0); pRefPoint (0 0 0);
pRefValue 0; pRefValue 0;
} }
relaxationFactors
{
p 0.7;
U 0.7;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -5,7 +5,7 @@
cleanFaMesh () cleanFaMesh ()
{ {
rm -rf ./constant/faMesh/faceLabels* \ rm -rf ./constant/faMesh/faceLabels* \
./constant/faMesh/boundary* \ ./constant/faMesh/faBoundary* \
> /dev/null 2>&1 > /dev/null 2>&1
} }

View file

@ -24,13 +24,12 @@ ddtSchemes
gradSchemes gradSchemes
{ {
default Gauss linear; default Gauss linear;
grad(p) Gauss linear;
} }
divSchemes divSchemes
{ {
default none;
div(phi,U) Gauss GammaVDC 0.5; div(phi,U) Gauss GammaVDC 0.5;
div(phiNet,U) Gauss GammaVDC 0.5;
} }
laplacianSchemes laplacianSchemes
@ -53,7 +52,7 @@ snGradSchemes
fluxRequired fluxRequired
{ {
p 0; p;
} }

View file

@ -35,16 +35,12 @@ solvers
} }
} }
SIMPLE PISO
{ {
nTimeCorrectors 5; nOuterCorrectors 5;
nCorrectors 2;
nNonOrthogonalCorrectors 1; nNonOrthogonalCorrectors 1;
} }
relaxationFactors
{
p 0.7;
U 0.7;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -26,9 +26,7 @@ boundaryField
{ {
walls walls
{ {
// type slip; type slip;
type fixedValue;
value uniform (0 0 0);
} }
freeSurface freeSurface

View file

@ -6,7 +6,7 @@
cleanFaMesh () cleanFaMesh ()
{ {
rm -rf ./constant/faMesh/faceLabels* \ rm -rf ./constant/faMesh/faceLabels* \
./constant/faMesh/boundary* \ ./constant/faMesh/faBoundary* \
> /dev/null 2>&1 > /dev/null 2>&1
} }

View file

@ -41,8 +41,6 @@ pointNormalsCorrectionPatches 2(inlet outlet);
nFreeSurfaceCorrectors 1; nFreeSurfaceCorrectors 1;
freeSurfaceSmoothing on;
surfactantProperties surfactantProperties
{ {
bulkConc bulkConc [ 0 -3 0 0 1 0 0 ] 1.0e-2; bulkConc bulkConc [ 0 -3 0 0 1 0 0 ] 1.0e-2;

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: http://www.OpenFOAM.org | | \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View file

@ -24,7 +24,6 @@ gradSchemes
{ {
default none; default none;
grad(Us) Gauss linear; grad(Us) Gauss linear;
grad((Us&faceAreaNormals)) Gauss linear;
} }
divSchemes divSchemes

View file

@ -35,18 +35,11 @@ solvers
} }
} }
SIMPLE PISO
{ {
nTimeCorrectors 5; nOuterCorrectors 10;
nCorrectors 2;
nNonOrthogonalCorrectors 1; nNonOrthogonalCorrectors 1;
ddtPhiCorr no;
} }
relaxationFactors
{
p 0.7;
U 0.7;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -5,7 +5,7 @@
cleanFaMesh () cleanFaMesh ()
{ {
rm -rf ./constant/faMesh/faceLabels* \ rm -rf ./constant/faMesh/faceLabels* \
./constant/faMesh/boundary* \ ./constant/faMesh/faBoundary* \
> /dev/null 2>&1 > /dev/null 2>&1
} }

View file

@ -29,8 +29,8 @@ gradSchemes
divSchemes divSchemes
{ {
defalut none;
div(phi,U) Gauss linear; div(phi,U) Gauss linear;
div(phiNet,U) Gauss linear;
} }
laplacianSchemes laplacianSchemes

View file

@ -35,18 +35,14 @@ solvers
} }
} }
SIMPLE PISO
{ {
nTimeCorrectors 10; nOuterCorrectors 10;
nCorrectors 2;
nNonOrthogonalCorrectors 1; nNonOrthogonalCorrectors 1;
pRefPoint (0.5 1.5 0); pRefPoint (0.5 1.5 0);
pRefValue 0; pRefValue 0;
} }
relaxationFactors
{
p 0.7;
U 0.7;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -0,0 +1,62 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ 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
{
freeSurface
{
type fixedGradient;
gradient uniform (0 0 0);
}
inlet
{
type fixedValue;
value uniform (0 0 0.25);
}
outlet
{
type zeroGradient;
}
bottom
{
type fixedValue;
value uniform (0 0 0);
}
side-1
{
type slip;
}
side-2
{
type slip;
}
symm-1
{
type symmetryPlane;
}
symm-2
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,63 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class tetPointVectorField;
location "0";
object motionU;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
freeSurface
{
type fixedValue;
value uniform (0 0 -1);
}
inlet
{
type fixedValue;
value uniform (0 0 0);
}
outlet
{
type fixedValue;
value uniform (0 0 0);
}
bottom
{
type fixedValue;
value uniform (0 0 0);
}
side-1
{
type slip;
}
side-2
{
type slip;
}
symm-1
{
type symmetryPlane;
}
symm-2
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
freeSurface
{
type fixedValue;
value uniform 0;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
bottom
{
type zeroGradient;
}
side-1
{
type zeroGradient;
}
side-2
{
type zeroGradient;
}
symm-1
{
type symmetryPlane;
}
symm-2
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,14 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanFaMesh ()
{
rm -rf ./constant/faMesh/faceLabels* \
./constant/faMesh/faBoundary* \
> /dev/null 2>&1
}
cleanCase
cleanFaMesh

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name from directory
application="interTrackFoam"
runApplication blockMesh
runApplication makeFaMesh
runApplication $application

View file

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
twoDMotion yes;
solver laplaceFaceDecomposition;
diffusivity quadratic;
distancePatches 1 (freeSurface);
frozenDiffusion yes;
pseudoSolid
{
poissonsRatio 0.3;
nCorrectors 3;
convergenceTolerance 1e-9;
};
// ************************************************************************* //

View file

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object faMeshDefinition;
}
// ************************************************************************** //
polyMeshPatches 1( freeSurface );
boundary
{
symm-1
{
type symmetryPlane;
ownerPolyPatch freeSurface;
neighbourPolyPatch symm-1;
}
symm-2
{
type symmetryPlane;
ownerPolyPatch freeSurface;
neighbourPolyPatch symm-2;
}
side-1
{
type patch;
ownerPolyPatch freeSurface;
neighbourPolyPatch side-1;
}
side-2
{
type patch;
ownerPolyPatch freeSurface;
neighbourPolyPatch side-2;
}
}
// ************************************************************************** //

View file

@ -0,0 +1,63 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object freeSurfaceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
twoFluids no;
normalMotionDir no;
motionDir (0 0 1);
cleanInterface yes;
muFluidA muFluidA [ 1 -1 -1 0 0 0 0 ] 0.01;
muFluidB muFluidB [ 1 -1 -1 0 0 0 0 ] 0;
rhoFluidA rhoFluidA [ 1 -3 0 0 0 0 0 ] 100;
rhoFluidB rhoFluidB [ 1 -3 0 0 0 0 0 ] 1.0;
surfaceTension surfaceTension [ 1 -2 0 0 0 0 0 ] 0;
g g [ 0 1 -2 0 0 0 0 ] (0 0 -9.81);
fixedFreeSurfacePatches 0( );
pointNormalsCorrectionPatches 4(side-1 side-2 symm-1 symm-2);
nFreeSurfaceCorrectors 1;
smoothing yes;
surfactantProperties
{
bulkConc bulkConc [ 0 -3 0 0 1 0 0 ] 1.0e-2;
saturatedConc saturatedSurfConc [ 0 -2 0 0 1 0 0 ] 5.0e-6;
adsorptionCoeff adsorptionCoeff [ 0 3 -1 0 -1 0 0 ] 40.0;
desorptionCoeff desorptionCoeff [ 0 -3 0 0 1 0 0 ] 8.93e-2;
bulkDiffusion bulkDiffusion [ 0 2 -1 0 0 0 0 ] 1.0e-9;
diffusion diffusion [ 0 2 -1 0 0 0 0 ] 1.0e-9;
temperature temperature [ 0 0 0 1 0 0 0 ] 293.0;
}
// ************************************************************************* //

View file

@ -0,0 +1,149 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(0.15 0 0)
(0.4 0 0)
(0.5 0 0)
(0 0.15 0)
(0.15 0.15 0)
(0.4 0.15 0)
(0.5 0.15 0)
(0 0.4 0)
(0.15 0.4 0)
(0.4 0.4 0)
(0.5 0.4 0)
(0 0.5 0)
(0.15 0.5 0)
(0.4 0.5 0)
(0.5 0.5 0)
//
(0 0 0.3)
(0.15 0 0.3)
(0.4 0 0.3)
(0.5 0 0.3)
(0 0.15 0.3)
(0.15 0.15 0.3)
(0.4 0.15 0.3)
(0.5 0.15 0.3)
(0 0.4 0.3)
(0.15 0.4 0.3)
(0.4 0.4 0.3)
(0.5 0.4 0.3)
(0 0.5 0.3)
(0.15 0.5 0.3)
(0.4 0.5 0.3)
(0.5 0.5 0.3)
);
blocks
(
hex (0 1 5 4 16 17 21 20) (12 12 24) simpleGrading (1 1 0.5)
hex (1 2 6 5 17 18 22 21) (20 12 24) simpleGrading (1 1 0.5)
hex (2 3 7 6 18 19 23 22) (8 12 24) simpleGrading (1 1 0.5)
hex (4 5 9 8 20 21 25 24) (12 20 24) simpleGrading (1 1 0.5)
hex (5 6 10 9 21 22 26 25) (20 20 24) simpleGrading (1 1 0.5)
hex (6 7 11 10 22 23 27 26) (8 20 24) simpleGrading (1 1 0.5)
hex (8 9 13 12 24 25 29 28) (12 8 24) simpleGrading (1 1 0.5)
hex (9 10 14 13 25 26 30 29) (20 8 24) simpleGrading (1 1 0.5)
hex (10 11 15 14 26 27 31 30) (8 8 24) simpleGrading (1 1 0.5)
);
edges
(
);
patches
(
patch freeSurface
(
(16 17 21 20)
(17 18 22 21)
(18 19 23 22)
(20 21 25 24)
(21 22 26 25)
(22 23 27 26)
(24 25 29 28)
(25 26 30 29)
(26 27 31 30)
)
patch inlet
(
(4 5 1 0)
)
patch outlet
(
(14 15 11 10)
)
wall bottom
(
(5 6 2 1)
(6 7 3 2)
(8 9 5 4)
(9 10 6 5)
(10 11 7 6)
(12 13 9 8)
(13 14 10 9)
)
wall side-1
(
(3 7 23 19)
(7 11 27 23)
(11 15 31 27)
)
wall side-2
(
(15 14 30 31)
(14 13 29 30)
(13 12 28 29)
)
symmetryPlane symm-1
(
(0 1 17 16)
(1 2 18 17)
(2 3 19 18)
)
symmetryPlane symm-2
(
(12 8 24 28)
(8 4 20 24)
(4 0 16 20)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
8
(
freeSurface
{
type patch;
nFaces 1600;
startFace 111680;
}
inlet
{
type patch;
nFaces 144;
startFace 113280;
}
outlet
{
type patch;
nFaces 64;
startFace 113424;
}
bottom
{
type wall;
nFaces 1392;
startFace 113488;
}
side-1
{
type wall;
nFaces 960;
startFace 114880;
}
side-2
{
type wall;
nFaces 960;
startFace 115840;
}
symm-1
{
type symmetryPlane;
nFaces 960;
startFace 116800;
}
symm-2
{
type symmetryPlane;
nFaces 960;
startFace 117760;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interTrackFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 10;
deltaT 0.001;
writeControl runTime;
writeInterval 0.01;
cycleWrite 0;
writeFormat ascii;
writeCompression compressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View file

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method simple;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
processorWeights
(
1
1
1
1
1
1
);
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object faSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
}
gradSchemes
{
default none;
grad(Us) Gauss linear;
}
divSchemes
{
default none;
div(Us) Gauss linear;
}
laplacianSchemes
{
}
interpolationSchemes
{
}
snGradSchemes
{
}
fluxRequired
{
}
// ************************************************************************* //

View file

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object faSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
ddt(rho,U) backward;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
div(phi,U) Gauss GammaVDC 0.5;
}
laplacianSchemes
{
default none;
laplacian(mu,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
p;
}
// ************************************************************************* //

View file

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
}
PISO
{
nOuterCorrectors 10;
nCorrectors 2;
nNonOrthogonalCorrectors 1;
}
// ************************************************************************* //

View file

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object tetFemSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
motionU
{
solver PCG;
preconditioner DIC;
tolerance 1e-09;
relTol 0.001;
}
}
// ************************************************************************* //

View file

@ -1,22 +0,0 @@
#!/bin/sh
currDir=`pwd`
application=`basename $currDir`
cases="sphereTransport"
tutorialPath=`dirname $0`/..
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanFaMesh ()
{
rm -rf ./constant/faMesh/faceLabels* \
./constant/faMesh/boundary* \
> /dev/null 2>&1
}
for case in $cases
do
(cd $case; cleanTimeDirectories)
(cd $case; cleanFaMesh)
done

View file

@ -1,14 +0,0 @@
#!/bin/sh
currDir=`pwd`
application=`basename $currDir`
cases="sphereTransport"
tutorialPath=`dirname $0`/..
. $WM_PROJECT_DIR/bin/tools/RunFunctions
for case in $cases
do
(cd $case; runApplication makeFaMesh)
(cd $case; runApplication $application)
done