mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -7,22 +7,6 @@ fvVectorMatrix UEqn
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
if (oCorr == nOuterCorr - 1)
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
),
|
||||
mesh.solver("UFinal")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
@ -33,4 +17,3 @@ else
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -70,6 +70,12 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
#include "ftEqn.H"
|
||||
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
@ -30,14 +30,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
|
||||
closedVolume = p.needReference();
|
||||
|
||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
|
||||
@ -31,14 +31,20 @@
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
@ -64,14 +70,20 @@
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
|
||||
@ -69,8 +69,14 @@ int main(int argc, char *argv[])
|
||||
#include "chemistry.H"
|
||||
#include "rhoEqn.H"
|
||||
|
||||
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
|
||||
for (label oCorr=1; oCorr <= nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "YEqn.H"
|
||||
#include "hsEqn.H"
|
||||
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
@ -7,28 +7,14 @@ tmp<fvVectorMatrix> UEqn
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
UEqn().relax(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn().relax();
|
||||
}
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
U = rUA*(UEqn().H() - fvc::grad(p));
|
||||
|
||||
@ -39,11 +39,6 @@
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
dimensionedScalar pMin
|
||||
(
|
||||
mesh.solutionDict().subDict("PIMPLE").lookup("pMin")
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
@ -56,9 +51,6 @@
|
||||
)
|
||||
);
|
||||
|
||||
//dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt =
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
@ -8,16 +8,8 @@
|
||||
DpDt
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
hEqn.relax();
|
||||
hEqn.solve(mesh.solver("hFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
hEqn.relax();
|
||||
hEqn.solve();
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
U = rUA*UEqn().H();
|
||||
|
||||
if (nCorr <= 1)
|
||||
@ -29,19 +28,20 @@ if (transonic)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
@ -55,7 +55,7 @@ else
|
||||
fvc::interpolate(rho)*
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
//+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
@ -68,19 +68,20 @@ else
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
@ -92,30 +93,15 @@ else
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
//if (oCorr != nOuterCorr-1)
|
||||
{
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Recalculate density from the relaxed pressure
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
}
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
bound(p, pMin);
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
/*
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
}
|
||||
*/
|
||||
|
||||
@ -61,15 +61,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
}
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
|
||||
@ -80,6 +87,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
rhoPisoFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoPisoFoam
|
||||
@ -1,13 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels
|
||||
@ -1,11 +0,0 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicPsiThermo> pThermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
);
|
||||
basicPsiThermo& thermo = pThermo();
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
volScalarField& h = thermo.h();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
Info<< "\nReading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt =
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
@ -1,12 +0,0 @@
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, h)
|
||||
+ fvm::div(phi, h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
DpDt
|
||||
);
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
if (transonic)
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phi =
|
||||
fvc::interpolate(rho)*
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
@ -1,93 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
rhoPisoFoam
|
||||
|
||||
Description
|
||||
Transient PISO solver for compressible, laminar or turbulent flow.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "readPISOControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=1; corr<=nCorr; corr++)
|
||||
{
|
||||
#include "hEqn.H"
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -7,14 +7,7 @@ tmp<fvVectorMatrix> UEqn
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
UEqn().relax(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn().relax();
|
||||
}
|
||||
|
||||
mrfZones.addCoriolis(rho, UEqn());
|
||||
pZones.addResistance(UEqn());
|
||||
@ -22,16 +15,9 @@ pZones.addResistance(UEqn());
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
U = rUA*(UEqn().H() - fvc::grad(p));
|
||||
|
||||
@ -30,19 +30,20 @@ if (transonic)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
@ -70,19 +71,20 @@ else
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
|
||||
@ -65,17 +65,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
|
||||
@ -86,6 +92,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
@ -45,9 +45,14 @@
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
|
||||
|
||||
dimensionedScalar pMin
|
||||
dimensionedScalar rhoMax
|
||||
(
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
|
||||
);
|
||||
|
||||
dimensionedScalar rhoMin
|
||||
(
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
|
||||
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
|
||||
);
|
||||
|
||||
pZones.addEnthalpySource(thermo, rho, hEqn);
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
rho = thermo.rho();
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
if (pressureImplicitPorosity)
|
||||
{
|
||||
U = trTU()&UEqn().H();
|
||||
@ -58,8 +63,6 @@ else
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
bound(p, pMin);
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
@ -69,5 +72,7 @@ if (closedVolume)
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
buoyantBoussinesqPimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPimpleFoam
|
||||
@ -13,7 +13,6 @@
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
rhok = 1.0 - beta*(T - TRef);
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
buoyantBoussinesqPisoFoam
|
||||
buoyantBoussinesqPimpleFoam
|
||||
|
||||
Description
|
||||
Transient solver for buoyant, turbulent flow of incompressible fluids
|
||||
@ -72,10 +72,24 @@ int main(int argc, char *argv[])
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readTimeControls.H"
|
||||
#include "readPISOControls.H"
|
||||
#include "readPIMPLEControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "TEqn.H"
|
||||
|
||||
@ -87,6 +101,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
@ -57,7 +57,7 @@
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
mesh.solutionDict().subDict("PISO"),
|
||||
mesh.solutionDict().subDict("PIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
@ -0,0 +1,52 @@
|
||||
{
|
||||
volScalarField rUA("rUA", 1.0/UEqn.A());
|
||||
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
||||
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, U, phi);
|
||||
|
||||
surfaceScalarField buoyancyPhi =
|
||||
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
||||
phi += buoyancyPhi;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rUAf, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi -= pEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
buoyantBoussinesqPisoFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPisoFoam
|
||||
@ -1,41 +0,0 @@
|
||||
{
|
||||
volScalarField rUA("rUA", 1.0/UEqn.A());
|
||||
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
||||
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
surfaceScalarField phiU
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, U, phi)
|
||||
);
|
||||
|
||||
phi = phiU + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rUAf, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
buoyantPimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/buoyantPimpleFoam
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
buoyantPisoFoam
|
||||
buoyantPimpleFoam
|
||||
|
||||
Description
|
||||
Transient solver for buoyant, turbulent flow of compressible fluids for
|
||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "readPISOControls.H"
|
||||
#include "readPIMPLEControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
@ -69,12 +69,24 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
#include "UEqn.H"
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
#include "pEqn.H"
|
||||
@ -84,6 +96,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
@ -12,16 +12,15 @@
|
||||
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
surfaceScalarField phiU
|
||||
phi = fvc::interpolate(rho)*
|
||||
(
|
||||
fvc::interpolate(rho)
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
||||
surfaceScalarField buoyancyPhi =
|
||||
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
||||
phi += buoyancyPhi;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
@ -32,27 +31,39 @@
|
||||
- fvm::laplacian(rhorUAf, p)
|
||||
);
|
||||
|
||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi += pEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rUA*fvc::reconstruct((buoyancyPhi + pEqn.flux())/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
// Second part of thermodynamic density update
|
||||
thermo.rho() += psi*p;
|
||||
|
||||
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
#include "rhoEqn.H"
|
||||
@ -1,3 +0,0 @@
|
||||
buoyantPisoFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/buoyantPisoFoam
|
||||
@ -22,16 +22,7 @@
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
// retain the residual from the first iteration
|
||||
if (nonOrth == 0)
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
);
|
||||
|
||||
if (ocorr != nOuterCorr-1)
|
||||
{
|
||||
UEqn.relax();
|
||||
}
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
8
applications/solvers/incompressible/pimpleFoam/Allwmake
Executable file
8
applications/solvers/incompressible/pimpleFoam/Allwmake
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake
|
||||
wmake pimpleDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -7,28 +7,14 @@ tmp<fvVectorMatrix> UEqn
|
||||
+ turbulence->divDevReff(U)
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
UEqn().relax(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn().relax();
|
||||
}
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
U = rUA*(UEqn().H() - fvc::grad(p));
|
||||
|
||||
@ -21,19 +21,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
@ -43,11 +44,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector except for last corrector
|
||||
if (oCorr != nOuterCorr-1)
|
||||
{
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
}
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
@ -0,0 +1,55 @@
|
||||
U = rAU*UEqn().H();
|
||||
|
||||
if (nCorr <= 1)
|
||||
{
|
||||
UEqn.clear();
|
||||
}
|
||||
|
||||
phi = (fvc::interpolate(U) & mesh.Sf());
|
||||
|
||||
if (p.needReference())
|
||||
{
|
||||
fvc::makeRelative(phi, U);
|
||||
adjustPhi(phi, U, p);
|
||||
fvc::makeAbsolute(phi, U);
|
||||
}
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
pEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
p.relax();
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
@ -84,8 +84,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// --- PIMPLE loop
|
||||
for (int ocorr=0; ocorr<nOuterCorr; ocorr++)
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
@ -96,62 +102,15 @@ int main(int argc, char *argv[])
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
|
||||
U = rAU*UEqn.H();
|
||||
phi = (fvc::interpolate(U) & mesh.Sf());
|
||||
|
||||
if (p.needReference())
|
||||
{
|
||||
fvc::makeRelative(phi, U);
|
||||
adjustPhi(phi, U, p);
|
||||
fvc::makeAbsolute(phi, U);
|
||||
}
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if
|
||||
(
|
||||
ocorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
if (ocorr != nOuterCorr-1)
|
||||
{
|
||||
p.relax();
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
@ -62,6 +62,12 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
@ -76,6 +82,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
@ -15,14 +15,7 @@
|
||||
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
UEqn.relax(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn.relax();
|
||||
}
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
@ -34,7 +27,6 @@
|
||||
(
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- mesh.magSf()*fvc::snGrad(p)
|
||||
),
|
||||
mesh.solver(oCorr == nOuterCorr-1 ? "UFinal" : "U")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -22,18 +22,20 @@
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if
|
||||
pEqn.solve
|
||||
(
|
||||
corr == nCorr-1
|
||||
mesh.solver
|
||||
(
|
||||
p.select
|
||||
(
|
||||
(
|
||||
finalIter
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
|
||||
@ -68,6 +68,12 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqn.H"
|
||||
@ -83,6 +89,11 @@ int main(int argc, char *argv[])
|
||||
#include "continuityErrs.H"
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
@ -545,4 +545,6 @@ $(writers)/gnuplotGraph/gnuplotGraph.C
|
||||
$(writers)/xmgrGraph/xmgrGraph.C
|
||||
$(writers)/jplotGraph/jplotGraph.C
|
||||
|
||||
meshes/data/data.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libOpenFOAM
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "dictionary.H"
|
||||
#include "data.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -918,6 +919,15 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::relax"
|
||||
"(const scalar alpha)"
|
||||
) << "Relaxing" << endl << this->info() << " by " << alpha << endl;
|
||||
}
|
||||
|
||||
operator==(prevIter() + alpha*(*this - prevIter()));
|
||||
}
|
||||
|
||||
@ -925,16 +935,33 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
|
||||
{
|
||||
scalar alpha = 0;
|
||||
word name = this->name();
|
||||
|
||||
if (this->mesh().relax(this->name()))
|
||||
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false))
|
||||
{
|
||||
alpha = this->mesh().relaxationFactor(this->name());
|
||||
name += "Final";
|
||||
}
|
||||
|
||||
if (alpha > 0)
|
||||
if (this->mesh().relax(name))
|
||||
{
|
||||
relax(alpha);
|
||||
relax(this->mesh().relaxationFactor(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::word Foam::GeometricField<Type, PatchField, GeoMesh>::select
|
||||
(
|
||||
bool final
|
||||
) const
|
||||
{
|
||||
if (final)
|
||||
{
|
||||
return this->name() + "Final";
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->name();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -476,6 +476,11 @@ public:
|
||||
// alpha is read from controlDict
|
||||
void relax();
|
||||
|
||||
//- Select the final iteration parameters if `final' is true
|
||||
// by returning the field name + "Final"
|
||||
// otherwise the standard parameters by returning the field name
|
||||
word select(bool final) const;
|
||||
|
||||
|
||||
// Member function *this operators
|
||||
|
||||
|
||||
@ -23,23 +23,23 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvData.H"
|
||||
#include "data.H"
|
||||
#include "Time.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
|
||||
int Foam::data::debug(Foam::debug::debugSwitch("data", false));
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvData::fvData(const objectRegistry& obr)
|
||||
Foam::data::data(const objectRegistry& obr)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"fvData",
|
||||
"data",
|
||||
obr.time().system(),
|
||||
obr,
|
||||
IOobject::NO_READ,
|
||||
@ -53,13 +53,13 @@ Foam::fvData::fvData(const objectRegistry& obr)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
|
||||
const Foam::dictionary& Foam::data::solverPerformanceDict() const
|
||||
{
|
||||
return subDict("solverPerformance");
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvData::setSolverPerformance
|
||||
void Foam::data::setSolverPerformance
|
||||
(
|
||||
const word& name,
|
||||
const lduMatrix::solverPerformance& sp
|
||||
@ -22,20 +22,21 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fvData
|
||||
Foam::data
|
||||
|
||||
Description
|
||||
Database for finite volume solution data, solver performance and
|
||||
other reduced data. fvMesh is derived from fvData so that all fields have
|
||||
access to the fvData from the mesh reference they hold.
|
||||
Database for solution data, solver performance and other reduced data.
|
||||
|
||||
fvMesh is derived from data so that all fields have access to the data from
|
||||
the mesh reference they hold.
|
||||
|
||||
SourceFiles
|
||||
fvData.C
|
||||
data.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvData_H
|
||||
#define fvData_H
|
||||
#ifndef data_H
|
||||
#define data_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "lduMatrix.H"
|
||||
@ -46,20 +47,20 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvData Declaration
|
||||
Class data Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fvData
|
||||
class data
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fvData(const fvData&);
|
||||
data(const data&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fvData&);
|
||||
void operator=(const data&);
|
||||
|
||||
|
||||
public:
|
||||
@ -71,7 +72,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct for objectRegistry
|
||||
fvData(const objectRegistry& obr);
|
||||
data(const objectRegistry& obr);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -273,7 +273,6 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C
|
||||
|
||||
finiteVolume/fv/fv.C
|
||||
finiteVolume/fvSchemes/fvSchemes.C
|
||||
finiteVolume/fvData/fvData.C
|
||||
|
||||
ddtSchemes = finiteVolume/ddtSchemes
|
||||
$(ddtSchemes)/ddtScheme/ddtSchemes.C
|
||||
|
||||
@ -506,6 +506,13 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
InfoIn("fvMatrix<Type>::relax(const scalar alpha)")
|
||||
<< "Relaxing " << psi_.name() << " by " << alpha
|
||||
<< endl;
|
||||
}
|
||||
|
||||
Field<Type>& S = source();
|
||||
scalarField& D = diag();
|
||||
|
||||
@ -591,9 +598,14 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
||||
template<class Type>
|
||||
void Foam::fvMatrix<Type>::relax()
|
||||
{
|
||||
if (psi_.mesh().relax(psi_.name()))
|
||||
word name = psi_.select
|
||||
(
|
||||
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
);
|
||||
|
||||
if (psi_.mesh().relax(name))
|
||||
{
|
||||
relax(psi_.mesh().relaxationFactor(psi_.name()));
|
||||
relax(psi_.mesh().relaxationFactor(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -167,21 +167,48 @@ template<class Type>
|
||||
Foam::autoPtr<typename Foam::fvMatrix<Type>::fvSolver>
|
||||
Foam::fvMatrix<Type>::solver()
|
||||
{
|
||||
return solver(psi_.mesh().solverDict(psi_.name()));
|
||||
return solver
|
||||
(
|
||||
psi_.mesh().solverDict
|
||||
(
|
||||
psi_.select
|
||||
(
|
||||
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
|
||||
{
|
||||
return solve(psi_.mesh().solverDict(psi_.name()));
|
||||
return solve
|
||||
(
|
||||
psi_.mesh().solverDict
|
||||
(
|
||||
psi_.select
|
||||
(
|
||||
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
|
||||
{
|
||||
return solve(psi_.mesh().solverDict(psi_.name()));
|
||||
return solve
|
||||
(
|
||||
psi_.mesh().solverDict
|
||||
(
|
||||
psi_.select
|
||||
(
|
||||
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ Foam::fvMesh::fvMesh(const IOobject& io)
|
||||
surfaceInterpolation(*this),
|
||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||
fvSolution(static_cast<const objectRegistry&>(*this)),
|
||||
fvData(static_cast<const objectRegistry&>(*this)),
|
||||
data(static_cast<const objectRegistry&>(*this)),
|
||||
boundary_(*this, boundaryMesh()),
|
||||
lduPtr_(NULL),
|
||||
curTimeIndex_(time().timeIndex()),
|
||||
@ -248,7 +248,7 @@ Foam::fvMesh::fvMesh
|
||||
surfaceInterpolation(*this),
|
||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||
fvSolution(static_cast<const objectRegistry&>(*this)),
|
||||
fvData(static_cast<const objectRegistry&>(*this)),
|
||||
data(static_cast<const objectRegistry&>(*this)),
|
||||
boundary_(*this),
|
||||
lduPtr_(NULL),
|
||||
curTimeIndex_(time().timeIndex()),
|
||||
@ -281,7 +281,7 @@ Foam::fvMesh::fvMesh
|
||||
surfaceInterpolation(*this),
|
||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||
fvSolution(static_cast<const objectRegistry&>(*this)),
|
||||
fvData(static_cast<const objectRegistry&>(*this)),
|
||||
data(static_cast<const objectRegistry&>(*this)),
|
||||
boundary_(*this),
|
||||
lduPtr_(NULL),
|
||||
curTimeIndex_(time().timeIndex()),
|
||||
|
||||
@ -54,7 +54,7 @@ SourceFiles
|
||||
#include "surfaceInterpolation.H"
|
||||
#include "fvSchemes.H"
|
||||
#include "fvSolution.H"
|
||||
#include "fvData.H"
|
||||
#include "data.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
@ -83,7 +83,7 @@ class fvMesh
|
||||
public surfaceInterpolation,
|
||||
public fvSchemes,
|
||||
public fvSolution,
|
||||
public fvData
|
||||
public data
|
||||
{
|
||||
// Private data
|
||||
|
||||
|
||||
@ -291,7 +291,10 @@ void Foam::DsmcCloud<ParcelType>::initialise
|
||||
template<class ParcelType>
|
||||
void Foam::DsmcCloud<ParcelType>::collisions()
|
||||
{
|
||||
buildCellOccupancy();
|
||||
if (!binaryCollision().active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Temporary storage for subCells
|
||||
List<DynamicList<label> > subCells(8);
|
||||
@ -1057,6 +1060,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
||||
// Move the particles ballistically with their current velocities
|
||||
Cloud<ParcelType>::move(td);
|
||||
|
||||
// Update cell occupancy
|
||||
buildCellOccupancy();
|
||||
|
||||
// Calculate new velocities via stochastic collisions
|
||||
collisions();
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "dsmcParcel.H"
|
||||
#include "DsmcCloud.H"
|
||||
#include "NoBinaryCollision.H"
|
||||
#include "VariableHardSphere.H"
|
||||
#include "LarsenBorgnakkeVariableHardSphere.H"
|
||||
|
||||
@ -34,6 +35,12 @@ namespace Foam
|
||||
|
||||
// Add instances of collision model to the table
|
||||
makeBinaryCollisionModelType
|
||||
(
|
||||
NoBinaryCollision,
|
||||
DsmcCloud,
|
||||
dsmcParcel
|
||||
);
|
||||
makeBinaryCollisionModelType
|
||||
(
|
||||
VariableHardSphere,
|
||||
DsmcCloud,
|
||||
|
||||
@ -27,6 +27,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::BinaryCollisionModel<CloudType>::BinaryCollisionModel(CloudType& owner)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::BinaryCollisionModel<CloudType>::BinaryCollisionModel
|
||||
(
|
||||
@ -87,4 +96,3 @@ Foam::BinaryCollisionModel<CloudType>::coeffDict() const
|
||||
#include "BinaryCollisionModelNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
|
||||
@ -85,6 +85,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
BinaryCollisionModel(CloudType& owner);
|
||||
|
||||
//- Construct from components
|
||||
BinaryCollisionModel
|
||||
(
|
||||
@ -123,6 +126,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates collision model
|
||||
virtual bool active() const = 0;
|
||||
|
||||
//- Return the collision cross section * relative velocity product
|
||||
virtual scalar sigmaTcR
|
||||
(
|
||||
|
||||
@ -117,6 +117,12 @@ Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::active() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template <class CloudType>
|
||||
Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
|
||||
|
||||
@ -89,6 +89,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates collision model
|
||||
virtual bool active() const;
|
||||
|
||||
//- Return the collision cross section * relative velocity product
|
||||
virtual scalar sigmaTcR
|
||||
(
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "NoBinaryCollision.H"
|
||||
#include "constants.H"
|
||||
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template <class CloudType>
|
||||
Foam::NoBinaryCollision<CloudType>::NoBinaryCollision
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
BinaryCollisionModel<CloudType>(cloud)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template <class CloudType>
|
||||
Foam::NoBinaryCollision<CloudType>::~NoBinaryCollision()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::NoBinaryCollision<CloudType>::active() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <class CloudType>
|
||||
Foam::scalar Foam::NoBinaryCollision<CloudType>::sigmaTcR
|
||||
(
|
||||
label typeIdP,
|
||||
label typeIdQ,
|
||||
const vector& UP,
|
||||
const vector& UQ
|
||||
) const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::scalar Foam::NoBinaryCollision<CloudType>::sigmaTcR"
|
||||
"("
|
||||
"label typeIdP,"
|
||||
"label typeIdQ,"
|
||||
"const vector& UP,"
|
||||
"const vector& UQ"
|
||||
") const"
|
||||
)
|
||||
<< "sigmaTcR called on NoBinaryCollision model, this should "
|
||||
<< "not happen, this is not an actual model." << nl
|
||||
<< "Enclose calls to sigmaTcR within a if(binaryCollision().active()) "
|
||||
<< " check."
|
||||
<< abort(FatalError);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template <class CloudType>
|
||||
void Foam::NoBinaryCollision<CloudType>::collide
|
||||
(
|
||||
label typeIdP,
|
||||
label typeIdQ,
|
||||
vector& UP,
|
||||
vector& UQ,
|
||||
scalar& EiP,
|
||||
scalar& EiQ
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
Class
|
||||
Foam::NoBinaryCollision
|
||||
|
||||
Description
|
||||
No collison BinaryCollision Model
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NoBinaryCollision_H
|
||||
#define NoBinaryCollision_H
|
||||
|
||||
#include "BinaryCollisionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NoBinaryCollision Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class NoBinaryCollision
|
||||
:
|
||||
public BinaryCollisionModel<CloudType>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
NoBinaryCollision
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~NoBinaryCollision();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates collision model
|
||||
virtual bool active() const;
|
||||
|
||||
//- Return the collision cross section * relative velocity product
|
||||
virtual scalar sigmaTcR
|
||||
(
|
||||
label typeIdP,
|
||||
label typeIdQ,
|
||||
const vector& UP,
|
||||
const vector& UQ
|
||||
) const;
|
||||
|
||||
//- Apply collision
|
||||
virtual void collide
|
||||
(
|
||||
label typeIdP,
|
||||
label typeIdQ,
|
||||
vector& UP,
|
||||
vector& UQ,
|
||||
scalar& EiP,
|
||||
scalar& EiQ
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "NoBinaryCollision.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -51,6 +51,12 @@ Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::VariableHardSphere<CloudType>::active() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template <class CloudType>
|
||||
Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
|
||||
|
||||
@ -74,6 +74,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates collision model
|
||||
virtual bool active() const;
|
||||
|
||||
//- Return the collision cross section * relative velocity product
|
||||
virtual scalar sigmaTcR
|
||||
(
|
||||
|
||||
@ -27,6 +27,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel(CloudType& owner)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel
|
||||
(
|
||||
|
||||
@ -86,6 +86,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
InflowBoundaryModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
InflowBoundaryModel
|
||||
(
|
||||
|
||||
@ -34,7 +34,7 @@ Foam::NoInflow<CloudType>::NoInflow
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
InflowBoundaryModel<CloudType>(dict, cloud, typeName)
|
||||
InflowBoundaryModel<CloudType>(cloud)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class NoInflow
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoInflow");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::MaxwellianThermal<CloudType>::MaxwellianThermal
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
WallInteractionModel<CloudType>(dict, cloud, typeName)
|
||||
WallInteractionModel<CloudType>(cloud)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ Foam::SpecularReflection<CloudType>::SpecularReflection
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
WallInteractionModel<CloudType>(dict, cloud, typeName)
|
||||
WallInteractionModel<CloudType>(cloud)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::WallInteractionModel<CloudType>::WallInteractionModel(CloudType& owner)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::WallInteractionModel<CloudType>::WallInteractionModel
|
||||
(
|
||||
|
||||
@ -85,6 +85,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
WallInteractionModel(CloudType& owner);
|
||||
|
||||
//- Construct from components
|
||||
WallInteractionModel
|
||||
(
|
||||
|
||||
@ -28,37 +28,41 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecordList<Type>::CollisionRecordList()
|
||||
template<class PairType, class WallType>
|
||||
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList()
|
||||
:
|
||||
DynamicList<CollisionRecord<Type> >()
|
||||
pairRecords_(),
|
||||
wallRecords_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecordList<Type>::CollisionRecordList(Istream& is)
|
||||
template<class PairType, class WallType>
|
||||
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
|
||||
:
|
||||
DynamicList<CollisionRecord<Type> >(is)
|
||||
pairRecords_(is),
|
||||
wallRecords_(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::CollisionRecordList<Type>::CollisionRecordList(Foam::Istream&)"
|
||||
"Foam::CollisionRecordList<PairType, WallType>::"
|
||||
"CollisionRecordList(Foam::Istream&)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecordList<Type>::~CollisionRecordList()
|
||||
template<class PairType, class WallType>
|
||||
Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>& Foam::CollisionRecordList<Type>::matchRecord
|
||||
template<class PairType, class WallType>
|
||||
Foam::PairCollisionRecord<PairType>&
|
||||
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
|
||||
(
|
||||
label origProcOfOther,
|
||||
label origIdOfOther
|
||||
@ -68,15 +72,15 @@ Foam::CollisionRecord<Type>& Foam::CollisionRecordList<Type>::matchRecord
|
||||
// identifiers. Two records with the same identification is not
|
||||
// supported.
|
||||
|
||||
forAll(*this, i)
|
||||
forAll(pairRecords_, i)
|
||||
{
|
||||
CollisionRecord<Type>& cR = (*this)[i];
|
||||
PairCollisionRecord<PairType>& pCR = pairRecords_[i];
|
||||
|
||||
if (cR.match(origProcOfOther, origIdOfOther))
|
||||
if (pCR.match(origProcOfOther, origIdOfOther))
|
||||
{
|
||||
cR.setAccessed();
|
||||
pCR.setAccessed();
|
||||
|
||||
return cR;
|
||||
return pCR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,28 +88,179 @@ Foam::CollisionRecord<Type>& Foam::CollisionRecordList<Type>::matchRecord
|
||||
// member of the list. The status of the record will be accessed
|
||||
// by construction.
|
||||
|
||||
append(CollisionRecord<Type>(origProcOfOther, origIdOfOther));
|
||||
pairRecords_.append
|
||||
(
|
||||
PairCollisionRecord<PairType>(origProcOfOther, origIdOfOther)
|
||||
);
|
||||
|
||||
return (*this)[this->size() - 1];
|
||||
return pairRecords_.last();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::CollisionRecordList<Type>::update()
|
||||
template<class PairType, class WallType>
|
||||
Foam::WallCollisionRecord<WallType>&
|
||||
Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
|
||||
(
|
||||
const vector& pRel,
|
||||
scalar radius
|
||||
)
|
||||
{
|
||||
DynamicList<CollisionRecord<Type> > updatedRecords;
|
||||
// Returning the first record that matches the relative position.
|
||||
// Two records with the same relative position is not supported.
|
||||
|
||||
forAll(*this, i)
|
||||
forAll(wallRecords_, i)
|
||||
{
|
||||
if ((*this)[i].accessed())
|
||||
WallCollisionRecord<WallType>& wCR = wallRecords_[i];
|
||||
|
||||
if (wCR.match(pRel, radius))
|
||||
{
|
||||
(*this)[i].setUnaccessed();
|
||||
wCR.setAccessed();
|
||||
|
||||
updatedRecords.append((*this)[i]);
|
||||
return wCR;
|
||||
}
|
||||
}
|
||||
|
||||
DynamicList<CollisionRecord<Type> >::operator=(updatedRecords);
|
||||
// Record not found, create a new one and return it as the last
|
||||
// member of the list. The status of the record will be accessed
|
||||
// by construction.
|
||||
|
||||
wallRecords_.append(WallCollisionRecord<WallType>(pRel));
|
||||
|
||||
return wallRecords_.last();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class PairType, class WallType>
|
||||
void Foam::CollisionRecordList<PairType, WallType>::update()
|
||||
{
|
||||
{
|
||||
DynamicList<PairCollisionRecord<PairType> > updatedRecords;
|
||||
|
||||
forAll(pairRecords_, i)
|
||||
{
|
||||
if (pairRecords_[i].accessed())
|
||||
{
|
||||
pairRecords_[i].setUnaccessed();
|
||||
|
||||
updatedRecords.append(pairRecords_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
pairRecords_ = updatedRecords;
|
||||
}
|
||||
|
||||
{
|
||||
DynamicList<WallCollisionRecord<WallType> > updatedRecords;
|
||||
|
||||
forAll(wallRecords_, i)
|
||||
{
|
||||
if (wallRecords_[i].accessed())
|
||||
{
|
||||
wallRecords_[i].setUnaccessed();
|
||||
|
||||
updatedRecords.append(wallRecords_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
wallRecords_ = updatedRecords;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class PairType, class WallType>
|
||||
void Foam::CollisionRecordList<PairType, WallType>::operator=
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::CollisionRecordList<PairType, WallType>::operator="
|
||||
"(const Foam::CollisionRecordList<PairType, WallType>&)"
|
||||
)
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
pairRecords_ = rhs.pairRecords_;
|
||||
wallRecords_ = rhs.wallRecords_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class PairType, class WallType>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>& a,
|
||||
const CollisionRecordList<PairType, WallType>& b
|
||||
)
|
||||
{
|
||||
return
|
||||
(
|
||||
a.pairRecords_ == b.pairRecords_
|
||||
&& a.wallRecords_ == b.wallRecords_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class PairType, class WallType>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>& a,
|
||||
const CollisionRecordList<PairType, WallType>& b
|
||||
)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class PairType, class WallType>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
CollisionRecordList<PairType, WallType>& cRL
|
||||
)
|
||||
{
|
||||
is >> cRL.pairRecords_ >> cRL.wallRecords_;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>"
|
||||
"(Foam::Istream&, Foam::CollisionRecordList<PairType, WallType>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class PairType, class WallType>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const CollisionRecordList<PairType, WallType>& cRL
|
||||
)
|
||||
{
|
||||
os << cRL.pairRecords_ << cRL.wallRecords_;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::CollisionRecordList<PairType, WallType>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -37,22 +37,53 @@ SourceFiles
|
||||
#define CollisionRecordList_H
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "CollisionRecord.H"
|
||||
#include "PairCollisionRecord.H"
|
||||
#include "WallCollisionRecord.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class PairType, class WallType>
|
||||
class CollisionRecordList;
|
||||
|
||||
template<class PairType, class WallType>
|
||||
inline bool operator==
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>&,
|
||||
const CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
|
||||
template<class PairType, class WallType>
|
||||
inline bool operator!=
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>&,
|
||||
const CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
|
||||
template<class PairType, class WallType>
|
||||
Istream& operator>>(Istream&, CollisionRecordList<PairType, WallType>&);
|
||||
|
||||
template<class PairType, class WallType>
|
||||
Ostream& operator<<(Ostream&, const CollisionRecordList<PairType, WallType>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CollisionRecordList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
template<class PairType, class WallType>
|
||||
class CollisionRecordList
|
||||
:
|
||||
public DynamicList<CollisionRecord<Type> >
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- List of active pair collisions
|
||||
DynamicList<PairCollisionRecord<PairType> > pairRecords_;
|
||||
|
||||
//- List of active wall collisions
|
||||
DynamicList<WallCollisionRecord<WallType> > wallRecords_;
|
||||
|
||||
public:
|
||||
|
||||
@ -72,19 +103,66 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Enquires if the proc and id pair of the other particle are
|
||||
// present in the records. If so, return access to the
|
||||
// collisionData and mark the CollisionRecord as accessed this
|
||||
// step, if not, create the record and return access to it.
|
||||
CollisionRecord<Type>& matchRecord
|
||||
// present in the records. If so, return non-const access to
|
||||
// the PairCollisionRecord (hence the data) and mark the
|
||||
// PairCollisionRecord as accessed this step, if not, create
|
||||
// the record and return access to it.
|
||||
PairCollisionRecord<PairType>& matchPairRecord
|
||||
(
|
||||
label origProcOfOther,
|
||||
label origIdOfOther
|
||||
);
|
||||
|
||||
//- Enquires if the position of wall impact relative to the
|
||||
// particle centre is present in the records. If so, return
|
||||
// access to the WallCollisionRecord (hence the data) and
|
||||
// mark the WallCollisionRecord as accesses this step, if
|
||||
// not, create the record and return access to it.
|
||||
WallCollisionRecord<WallType>& matchWallRecord
|
||||
(
|
||||
const vector& pRel,
|
||||
scalar radius
|
||||
);
|
||||
|
||||
//- Update the collision records, deleting any records not
|
||||
// marked as having been accessed, then mark all records as
|
||||
// not accessed ready for the next evaluation
|
||||
void update();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const CollisionRecordList&);
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend bool operator== <PairType, WallType>
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>&,
|
||||
const CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
|
||||
friend bool operator!= <PairType, WallType>
|
||||
(
|
||||
const CollisionRecordList<PairType, WallType>&,
|
||||
const CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <PairType, WallType>
|
||||
(
|
||||
Istream&,
|
||||
CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <PairType, WallType>
|
||||
(
|
||||
Ostream&,
|
||||
const CollisionRecordList<PairType, WallType>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -23,12 +23,12 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CollisionRecord.H"
|
||||
#include "PairCollisionRecord.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>::CollisionRecord()
|
||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord()
|
||||
:
|
||||
origProcOfOther_(-VGREAT),
|
||||
origIdOfOther_(-VGREAT),
|
||||
@ -37,7 +37,7 @@ Foam::CollisionRecord<Type>::CollisionRecord()
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>::CollisionRecord
|
||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
||||
(
|
||||
label origProcOfOther,
|
||||
label origIdOfOther,
|
||||
@ -51,33 +51,39 @@ Foam::CollisionRecord<Type>::CollisionRecord
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>::CollisionRecord(const CollisionRecord<Type>& cR)
|
||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
||||
(
|
||||
const PairCollisionRecord<Type>& pCR
|
||||
)
|
||||
:
|
||||
origProcOfOther_(cR.origProcOfOther() + 1),
|
||||
origIdOfOther_(cR.origIdOfOther_),
|
||||
data_(cR.data_)
|
||||
origProcOfOther_(pCR.origProcOfOther() + 1),
|
||||
origIdOfOther_(pCR.origIdOfOther_),
|
||||
data_(pCR.data_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>::~CollisionRecord()
|
||||
Foam::PairCollisionRecord<Type>::~PairCollisionRecord()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::CollisionRecord<Type>::operator=(const CollisionRecord<Type>& rhs)
|
||||
void Foam::PairCollisionRecord<Type>::operator=
|
||||
(
|
||||
const PairCollisionRecord<Type>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::CollisionRecord<Type>::operator="
|
||||
"(const Foam::CollisionRecord<Type>&)"
|
||||
"Foam::PairCollisionRecord<Type>::operator="
|
||||
"(const Foam::PairCollisionRecord<Type>&)"
|
||||
)
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
@ -91,7 +97,7 @@ void Foam::CollisionRecord<Type>::operator=(const CollisionRecord<Type>& rhs)
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "CollisionRecordIO.C"
|
||||
#include "PairCollisionRecordIO.C"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CollisionRecord
|
||||
Foam::PairCollisionRecord
|
||||
|
||||
Description
|
||||
|
||||
@ -35,14 +35,14 @@ Description
|
||||
positive means that it has.
|
||||
|
||||
SourceFiles
|
||||
CollisionRecordI.H
|
||||
CollisionRecord.C
|
||||
CollisionRecordIO.C
|
||||
PairCollisionRecordI.H
|
||||
PairCollisionRecord.C
|
||||
PairCollisionRecordIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CollisionRecord_H
|
||||
#define CollisionRecord_H
|
||||
#ifndef PairCollisionRecord_H
|
||||
#define PairCollisionRecord_H
|
||||
|
||||
#include "label.H"
|
||||
#include "vector.H"
|
||||
@ -54,35 +54,35 @@ namespace Foam
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class Type>
|
||||
class CollisionRecord;
|
||||
class PairCollisionRecord;
|
||||
|
||||
template<class Type>
|
||||
inline bool operator==
|
||||
(
|
||||
const CollisionRecord<Type>&,
|
||||
const CollisionRecord<Type>&
|
||||
const PairCollisionRecord<Type>&,
|
||||
const PairCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
inline bool operator!=
|
||||
(
|
||||
const CollisionRecord<Type>&,
|
||||
const CollisionRecord<Type>&
|
||||
const PairCollisionRecord<Type>&,
|
||||
const PairCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, CollisionRecord<Type>&);
|
||||
Istream& operator>>(Istream&, PairCollisionRecord<Type>&);
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const CollisionRecord<Type>&);
|
||||
Ostream& operator<<(Ostream&, const PairCollisionRecord<Type>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CollisionRecord Declaration
|
||||
Class PairCollisionRecord Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class CollisionRecord
|
||||
class PairCollisionRecord
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -103,10 +103,10 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
CollisionRecord();
|
||||
PairCollisionRecord();
|
||||
|
||||
//- Construct from components
|
||||
CollisionRecord
|
||||
PairCollisionRecord
|
||||
(
|
||||
label origProcOfOther,
|
||||
label origIdOfOther,
|
||||
@ -114,14 +114,14 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
CollisionRecord(Istream&);
|
||||
PairCollisionRecord(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
CollisionRecord(const CollisionRecord&);
|
||||
PairCollisionRecord(const PairCollisionRecord&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~CollisionRecord();
|
||||
~PairCollisionRecord();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -165,21 +165,21 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const CollisionRecord&);
|
||||
void operator=(const PairCollisionRecord&);
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend bool operator== <Type>
|
||||
(
|
||||
const CollisionRecord<Type>&,
|
||||
const CollisionRecord<Type>&
|
||||
const PairCollisionRecord<Type>&,
|
||||
const PairCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
friend bool operator!= <Type>
|
||||
(
|
||||
const CollisionRecord<Type>&,
|
||||
const CollisionRecord<Type>&
|
||||
const PairCollisionRecord<Type>&,
|
||||
const PairCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
|
||||
@ -188,13 +188,13 @@ public:
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
CollisionRecord<Type>&
|
||||
PairCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const CollisionRecord<Type>&
|
||||
const PairCollisionRecord<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
@ -205,12 +205,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "CollisionRecordI.H"
|
||||
#include "PairCollisionRecordI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CollisionRecord.C"
|
||||
# include "PairCollisionRecord.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,7 +26,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::CollisionRecord<Type>::match
|
||||
inline bool Foam::PairCollisionRecord<Type>::match
|
||||
(
|
||||
label queryOrigProcOfOther,
|
||||
label queryOrigIdOfOther
|
||||
@ -41,14 +41,14 @@ inline bool Foam::CollisionRecord<Type>::match
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline Foam::label Foam::CollisionRecord<Type>::origProcOfOther() const
|
||||
inline Foam::label Foam::PairCollisionRecord<Type>::origProcOfOther() const
|
||||
{
|
||||
return mag(origProcOfOther_) - 1;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline Foam::label Foam::CollisionRecord<Type>::origIdOfOther() const
|
||||
inline Foam::label Foam::PairCollisionRecord<Type>::origIdOfOther() const
|
||||
{
|
||||
return origIdOfOther_;
|
||||
}
|
||||
@ -56,35 +56,35 @@ inline Foam::label Foam::CollisionRecord<Type>::origIdOfOther() const
|
||||
|
||||
template<class Type>
|
||||
inline const Type&
|
||||
Foam::CollisionRecord<Type>::collisionData() const
|
||||
Foam::PairCollisionRecord<Type>::collisionData() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline Type& Foam::CollisionRecord<Type>::collisionData()
|
||||
inline Type& Foam::PairCollisionRecord<Type>::collisionData()
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::CollisionRecord<Type>::accessed() const
|
||||
inline bool Foam::PairCollisionRecord<Type>::accessed() const
|
||||
{
|
||||
return pos(origProcOfOther_);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::CollisionRecord<Type>::setAccessed()
|
||||
inline void Foam::PairCollisionRecord<Type>::setAccessed()
|
||||
{
|
||||
origProcOfOther_ = origProcOfOther() + 1;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::CollisionRecord<Type>::setUnaccessed()
|
||||
inline void Foam::PairCollisionRecord<Type>::setUnaccessed()
|
||||
{
|
||||
origProcOfOther_ = -(origProcOfOther() + 1);
|
||||
}
|
||||
@ -95,8 +95,8 @@ inline void Foam::CollisionRecord<Type>::setUnaccessed()
|
||||
template<class Type>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const CollisionRecord<Type>& a,
|
||||
const CollisionRecord<Type>& b
|
||||
const PairCollisionRecord<Type>& a,
|
||||
const PairCollisionRecord<Type>& b
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -107,11 +107,12 @@ inline bool Foam::operator==
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const CollisionRecord<Type>& a,
|
||||
const CollisionRecord<Type>& b
|
||||
const PairCollisionRecord<Type>& a,
|
||||
const PairCollisionRecord<Type>& b
|
||||
)
|
||||
{
|
||||
return !(a == b);
|
||||
@ -23,35 +23,38 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CollisionRecord.H"
|
||||
#include "PairCollisionRecord.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CollisionRecord<Type>::CollisionRecord(Istream& is)
|
||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord(Istream& is)
|
||||
:
|
||||
origProcOfOther_(readLabel(is)),
|
||||
origIdOfOther_(readLabel(is)),
|
||||
data_(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check("Foam::CollisionRecord<Type>::CollisionRecord(Foam::Istream&)");
|
||||
is.check
|
||||
(
|
||||
"Foam::PairCollisionRecord<Type>::PairCollisionRecord(Foam::Istream&)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, CollisionRecord<Type>& cR)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, PairCollisionRecord<Type>& pCR)
|
||||
{
|
||||
is >> cR.origProcOfOther_ >> cR.origIdOfOther_ >> cR.data_;
|
||||
is >> pCR.origProcOfOther_ >> pCR.origIdOfOther_ >> pCR.data_;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream&"
|
||||
"Foam::operator>>(Foam::Istream&, Foam::CollisionRecord<Type>&)"
|
||||
"Foam::operator>>(Foam::Istream&, Foam::PairCollisionRecord<Type>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
@ -59,17 +62,21 @@ Foam::Istream& Foam::operator>>(Istream& is, CollisionRecord<Type>& cR)
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const CollisionRecord<Type>& cR)
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const PairCollisionRecord<Type>& pCR
|
||||
)
|
||||
{
|
||||
os << cR.origProcOfOther_
|
||||
<< token::SPACE << cR.origIdOfOther_
|
||||
<< token::SPACE << cR.data_;
|
||||
os << pCR.origProcOfOther_
|
||||
<< token::SPACE << pCR.origIdOfOther_
|
||||
<< token::SPACE << pCR.data_;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::CollisionRecord<Type>&)"
|
||||
"const Foam::PairCollisionRecord<Type>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "WallCollisionRecord.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::WallCollisionRecord<Type>::WallCollisionRecord()
|
||||
:
|
||||
accessed_(false),
|
||||
pRel_(),
|
||||
data_(pTraits<Type>::zero)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::WallCollisionRecord<Type>::WallCollisionRecord
|
||||
(
|
||||
const vector& pRel,
|
||||
const Type& data
|
||||
)
|
||||
:
|
||||
accessed_(true),
|
||||
pRel_(pRel),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::WallCollisionRecord<Type>::WallCollisionRecord
|
||||
(
|
||||
const WallCollisionRecord<Type>& wCR
|
||||
)
|
||||
:
|
||||
accessed_(wCR.accessed_),
|
||||
pRel_(wCR.pRel_),
|
||||
data_(wCR.data_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::WallCollisionRecord<Type>::~WallCollisionRecord()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::WallCollisionRecord<Type>::operator=
|
||||
(
|
||||
const WallCollisionRecord<Type>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::WallCollisionRecord<Type>::operator="
|
||||
"(const Foam::WallCollisionRecord<Type>&)"
|
||||
)
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
accessed_ = rhs.accessed_;
|
||||
pRel_ = rhs.pRel_;
|
||||
data_ = rhs.data_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "WallCollisionRecordIO.C"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::WallCollisionRecord
|
||||
|
||||
Description
|
||||
Record of a collision between the particle holding the record and
|
||||
a wall face at the position relative to the centre of the particle.
|
||||
|
||||
SourceFiles
|
||||
WallCollisionRecordI.H
|
||||
WallCollisionRecord.C
|
||||
WallCollisionRecordIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef WallCollisionRecord_H
|
||||
#define WallCollisionRecord_H
|
||||
|
||||
#include "vector.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class Type>
|
||||
class WallCollisionRecord;
|
||||
|
||||
template<class Type>
|
||||
inline bool operator==
|
||||
(
|
||||
const WallCollisionRecord<Type>&,
|
||||
const WallCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
inline bool operator!=
|
||||
(
|
||||
const WallCollisionRecord<Type>&,
|
||||
const WallCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, WallCollisionRecord<Type>&);
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const WallCollisionRecord<Type>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class WallCollisionRecord Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class WallCollisionRecord
|
||||
{
|
||||
// Private data
|
||||
|
||||
// //- Recording whether or not this record has been accessed
|
||||
bool accessed_;
|
||||
|
||||
//- The position of wall impact relative to the cell centre
|
||||
vector pRel_;
|
||||
|
||||
//- Collision data, stored as if the storing particle was the
|
||||
// first particle (particle A) in the collision.
|
||||
Type data_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
WallCollisionRecord();
|
||||
|
||||
//- Construct from components
|
||||
WallCollisionRecord
|
||||
(
|
||||
const vector& pRel,
|
||||
const Type& data = pTraits<Type>::zero
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
WallCollisionRecord(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
WallCollisionRecord(const WallCollisionRecord&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~WallCollisionRecord();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the pRel data
|
||||
inline const vector& pRel() const;
|
||||
|
||||
//- Return access to the collision data
|
||||
inline const Type& collisionData() const;
|
||||
|
||||
//- Return access to the collision data
|
||||
inline Type& collisionData();
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
inline bool match(const vector& pRel, scalar radius);
|
||||
|
||||
//- Return the accessed status of the record
|
||||
inline bool accessed() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Set the accessed property of the record to accessed
|
||||
inline void setAccessed();
|
||||
|
||||
//- Set the accessed property of the record to unaccessed
|
||||
inline void setUnaccessed();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const WallCollisionRecord&);
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend bool operator== <Type>
|
||||
(
|
||||
const WallCollisionRecord<Type>&,
|
||||
const WallCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
friend bool operator!= <Type>
|
||||
(
|
||||
const WallCollisionRecord<Type>&,
|
||||
const WallCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
WallCollisionRecord<Type>&
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const WallCollisionRecord<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "WallCollisionRecordI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "WallCollisionRecord.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::WallCollisionRecord<Type>::match
|
||||
(
|
||||
const vector& pRel,
|
||||
scalar radius
|
||||
)
|
||||
{
|
||||
scalar magpRel_= mag(pRel_);
|
||||
|
||||
scalar magpRel = mag(pRel);
|
||||
|
||||
// Using the new data as the acceptance criterion
|
||||
scalar cosAcceptanceAngle = magpRel/radius;
|
||||
|
||||
if (cosAcceptanceAngle > 1.0)
|
||||
{
|
||||
Info<< "pRel_ " << pRel_ << " " << magpRel_ << nl
|
||||
<< "pRel " << pRel << " " << magpRel << nl
|
||||
<< "unit vector dot product " << (pRel & pRel_)/(magpRel_*magpRel)
|
||||
<< nl << "cosAcceptanceAngle " << cosAcceptanceAngle
|
||||
<< endl;
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"inline bool Foam::WallCollisionRecord<Type>::match"
|
||||
"("
|
||||
"const vector& pRel,"
|
||||
"scalar radius"
|
||||
") const"
|
||||
)
|
||||
<< "Problem with matching WallCollisionRecord." << nl
|
||||
<< "The given radius, " << radius << ", is smaller than distance "
|
||||
<< "to the relative position of the WallInteractionSite, "
|
||||
<< magpRel << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Are the test and recorded pRel (relative position vectors)
|
||||
// aligned to within the calculated tolerance?
|
||||
bool matched = (pRel & pRel_)/(magpRel_*magpRel) > cosAcceptanceAngle;
|
||||
|
||||
if (matched)
|
||||
{
|
||||
pRel_ = pRel;
|
||||
}
|
||||
|
||||
return matched;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline const Type&
|
||||
Foam::WallCollisionRecord<Type>::collisionData() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline Type& Foam::WallCollisionRecord<Type>::collisionData()
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::WallCollisionRecord<Type>::accessed() const
|
||||
{
|
||||
return accessed_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::WallCollisionRecord<Type>::setAccessed()
|
||||
{
|
||||
accessed_ = true;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::WallCollisionRecord<Type>::setUnaccessed()
|
||||
{
|
||||
accessed_ = false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const WallCollisionRecord<Type>& a,
|
||||
const WallCollisionRecord<Type>& b
|
||||
)
|
||||
{
|
||||
return
|
||||
(
|
||||
a.accessed_ == b.accessed_
|
||||
&& a.pRel_ == b.pRel_
|
||||
&& a.data_ == b.data_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const WallCollisionRecord<Type>& a,
|
||||
const WallCollisionRecord<Type>& b
|
||||
)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "WallCollisionRecord.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::WallCollisionRecord<Type>::WallCollisionRecord(Istream& is)
|
||||
:
|
||||
accessed_(is),
|
||||
pRel_(is),
|
||||
data_(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::WallCollisionRecord<Type>::WallCollisionRecord(Foam::Istream&)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, WallCollisionRecord<Type>& wCR)
|
||||
{
|
||||
is >> wCR.accessed_ >> wCR.pRel_ >> wCR.data_;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream&"
|
||||
"Foam::operator>>(Foam::Istream&, Foam::WallCollisionRecord<Type>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const WallCollisionRecord<Type>& wCR
|
||||
)
|
||||
{
|
||||
os << wCR.accessed_
|
||||
<< token::SPACE << wCR.pRel_
|
||||
<< token::SPACE << wCR.data_;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::WallCollisionRecord<Type>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -268,7 +268,7 @@ protected:
|
||||
vector UTurb_;
|
||||
|
||||
//- Particle collision records
|
||||
CollisionRecordList<vector> collisionRecords_;
|
||||
CollisionRecordList<vector, vector> collisionRecords_;
|
||||
|
||||
|
||||
// Cell-based quantities
|
||||
@ -400,7 +400,8 @@ public:
|
||||
inline const vector& UTurb() const;
|
||||
|
||||
//- Return const access to the collision records
|
||||
inline const CollisionRecordList<vector>& collisionRecords() const;
|
||||
inline const CollisionRecordList<vector, vector>&
|
||||
collisionRecords() const;
|
||||
|
||||
|
||||
// Edit
|
||||
@ -439,7 +440,7 @@ public:
|
||||
inline vector& UTurb();
|
||||
|
||||
//- Return access to collision records
|
||||
inline CollisionRecordList<vector>& collisionRecords();
|
||||
inline CollisionRecordList<vector, vector>& collisionRecords();
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
@ -348,7 +348,7 @@ inline bool& Foam::KinematicParcel<ParcelType>::active()
|
||||
|
||||
|
||||
template <class ParcelType>
|
||||
inline const Foam::CollisionRecordList<Foam::vector>&
|
||||
inline const Foam::CollisionRecordList<Foam::vector, Foam::vector>&
|
||||
Foam::KinematicParcel<ParcelType>::collisionRecords() const
|
||||
{
|
||||
return collisionRecords_;
|
||||
@ -426,7 +426,7 @@ inline Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb()
|
||||
|
||||
|
||||
template <class ParcelType>
|
||||
inline Foam::CollisionRecordList<Foam::vector>&
|
||||
inline Foam::CollisionRecordList<Foam::vector, Foam::vector>&
|
||||
Foam::KinematicParcel<ParcelType>::collisionRecords()
|
||||
{
|
||||
return collisionRecords_;
|
||||
|
||||
@ -61,6 +61,7 @@ Foam::particleForces::particleForces
|
||||
dict_(dict.subDict("particleForces")),
|
||||
g_(g),
|
||||
gradUPtr_(NULL),
|
||||
HdotGradHInterPtr_(NULL),
|
||||
gravity_(dict_.lookup("gravity")),
|
||||
virtualMass_(dict_.lookup("virtualMass")),
|
||||
Cvm_(0.0),
|
||||
@ -88,6 +89,7 @@ Foam::particleForces::particleForces(const particleForces& f)
|
||||
dict_(f.dict_),
|
||||
g_(f.g_),
|
||||
gradUPtr_(f.gradUPtr_),
|
||||
HdotGradHInterPtr_(f.HdotGradHInterPtr_),
|
||||
gravity_(f.gravity_),
|
||||
virtualMass_(f.virtualMass_),
|
||||
Cvm_(f.Cvm_),
|
||||
|
||||
@ -198,14 +198,14 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
|
||||
scalar deltaT = this->owner().mesh().time().deltaTValue();
|
||||
|
||||
vector& tangentialOverlap_AB =
|
||||
pA.collisionRecords().matchRecord
|
||||
pA.collisionRecords().matchPairRecord
|
||||
(
|
||||
pB.origProc(),
|
||||
pB.origId()
|
||||
).collisionData();
|
||||
|
||||
vector& tangentialOverlap_BA =
|
||||
pB.collisionRecords().matchRecord
|
||||
pB.collisionRecords().matchPairRecord
|
||||
(
|
||||
pA.origProc(),
|
||||
pA.origId()
|
||||
|
||||
@ -33,7 +33,7 @@ Description
|
||||
#define PairSpringSliderDashpot_H
|
||||
|
||||
#include "PairModel.H"
|
||||
#include "CollisionRecord.H"
|
||||
#include "CollisionRecordList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -100,11 +100,10 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
|
||||
scalar deltaT = this->owner().mesh().time().deltaTValue();
|
||||
|
||||
// For remembering previous overlap
|
||||
// vector deltaTangentialOverlap_PW = USlip_PW * deltaT;
|
||||
// tangentialOverlap_PW += deltaTangentialOverlap_PW;
|
||||
vector& tangentialOverlap_PW =
|
||||
p.collisionRecords().matchWallRecord(-r_PW, pREff).collisionData();
|
||||
|
||||
vector tangentialOverlap_PW = USlip_PW * deltaT;
|
||||
tangentialOverlap_PW += USlip_PW*deltaT;
|
||||
|
||||
scalar tangentialOverlapMag = mag(tangentialOverlap_PW);
|
||||
|
||||
@ -124,7 +123,7 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
|
||||
fT_PW = -mu_*mag(fN_PW)*USlip_PW/mag(USlip_PW);
|
||||
|
||||
// tangentialOverlap_PW = vector::zero;
|
||||
tangentialOverlap_PW = vector::zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user