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,30 +7,13 @@ fvVectorMatrix UEqn
|
|||||||
|
|
||||||
UEqn.relax();
|
UEqn.relax();
|
||||||
|
|
||||||
if (oCorr == nOuterCorr - 1)
|
solve
|
||||||
{
|
(
|
||||||
solve
|
UEqn
|
||||||
|
==
|
||||||
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
UEqn
|
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||||
==
|
- fvc::snGrad(p)*mesh.magSf()
|
||||||
fvc::reconstruct
|
)
|
||||||
(
|
);
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
|
||||||
),
|
|
||||||
mesh.solver("UFinal")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solve
|
|
||||||
(
|
|
||||||
UEqn
|
|
||||||
==
|
|
||||||
fvc::reconstruct
|
|
||||||
(
|
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -70,6 +70,12 @@ int main(int argc, char *argv[])
|
|||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector 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);
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|
||||||
#include "ftEqn.H"
|
#include "ftEqn.H"
|
||||||
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -30,14 +30,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
|
|
||||||
closedVolume = p.needReference();
|
closedVolume = p.needReference();
|
||||||
|
|
||||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
pEqn.solve
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
mesh.solver
|
||||||
}
|
(
|
||||||
else
|
p.select
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name()));
|
(
|
||||||
}
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,14 +31,20 @@
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
|
pEqn.solve
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
mesh.solver
|
||||||
}
|
(
|
||||||
else
|
p.select
|
||||||
{
|
(
|
||||||
pEqn.solve();
|
(
|
||||||
}
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -64,14 +70,20 @@
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
|
pEqn.solve
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
mesh.solver
|
||||||
}
|
(
|
||||||
else
|
p.select
|
||||||
{
|
(
|
||||||
pEqn.solve();
|
(
|
||||||
}
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -69,8 +69,14 @@ int main(int argc, char *argv[])
|
|||||||
#include "chemistry.H"
|
#include "chemistry.H"
|
||||||
#include "rhoEqn.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 "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "hsEqn.H"
|
#include "hsEqn.H"
|
||||||
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -7,27 +7,13 @@ tmp<fvVectorMatrix> UEqn
|
|||||||
+ turbulence->divDevRhoReff(U)
|
+ turbulence->divDevRhoReff(U)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oCorr == nOuterCorr-1)
|
UEqn().relax();
|
||||||
{
|
|
||||||
UEqn().relax(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UEqn().relax();
|
|
||||||
}
|
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn().A();
|
volScalarField rUA = 1.0/UEqn().A();
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
if (oCorr == nOuterCorr-1)
|
solve(UEqn() == -fvc::grad(p));
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,12 +37,7 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "compressibleCreatePhi.H"
|
#include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
dimensionedScalar pMin
|
|
||||||
(
|
|
||||||
mesh.solutionDict().subDict("PIMPLE").lookup("pMin")
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Creating turbulence model\n" << endl;
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
autoPtr<compressible::turbulenceModel> turbulence
|
autoPtr<compressible::turbulenceModel> turbulence
|
||||||
@ -56,9 +51,6 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
//dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "Creating field DpDt\n" << endl;
|
Info<< "Creating field DpDt\n" << endl;
|
||||||
volScalarField DpDt =
|
volScalarField DpDt =
|
||||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||||
|
|||||||
@ -8,16 +8,8 @@
|
|||||||
DpDt
|
DpDt
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oCorr == nOuterCorr-1)
|
hEqn.relax();
|
||||||
{
|
hEqn.solve();
|
||||||
hEqn.relax();
|
|
||||||
hEqn.solve(mesh.solver("hFinal"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hEqn.relax();
|
|
||||||
hEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn().A();
|
|
||||||
U = rUA*UEqn().H();
|
U = rUA*UEqn().H();
|
||||||
|
|
||||||
if (nCorr <= 1)
|
if (nCorr <= 1)
|
||||||
@ -29,19 +28,20 @@ if (transonic)
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
mesh.solver
|
||||||
&& corr == nCorr-1
|
(
|
||||||
&& nonOrth == nNonOrthCorr
|
p.select
|
||||||
)
|
(
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver("pFinal"));
|
finalIter
|
||||||
}
|
&& corr == nCorr-1
|
||||||
else
|
&& nonOrth == nNonOrthCorr
|
||||||
{
|
)
|
||||||
pEqn.solve();
|
)
|
||||||
}
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ else
|
|||||||
fvc::interpolate(rho)*
|
fvc::interpolate(rho)*
|
||||||
(
|
(
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
//+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
@ -68,19 +68,20 @@ else
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
mesh.solver
|
||||||
&& corr == nCorr-1
|
(
|
||||||
&& nonOrth == nNonOrthCorr
|
p.select
|
||||||
)
|
(
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver("pFinal"));
|
finalIter
|
||||||
}
|
&& corr == nCorr-1
|
||||||
else
|
&& nonOrth == nNonOrthCorr
|
||||||
{
|
)
|
||||||
pEqn.solve();
|
)
|
||||||
}
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -92,30 +93,15 @@ else
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
#include "compressibleContinuityErrs.H"
|
#include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
//if (oCorr != nOuterCorr-1)
|
// Explicitly relax pressure for momentum corrector
|
||||||
{
|
p.relax();
|
||||||
// Explicitly relax pressure for momentum corrector
|
|
||||||
p.relax();
|
|
||||||
|
|
||||||
rho = thermo.rho();
|
// Recalculate density from the relaxed pressure
|
||||||
rho.relax();
|
rho = thermo.rho();
|
||||||
Info<< "rho max/min : " << max(rho).value()
|
Info<< "rho max/min : " << max(rho).value()
|
||||||
<< " " << min(rho).value() << endl;
|
<< " " << min(rho).value() << endl;
|
||||||
}
|
|
||||||
|
|
||||||
U -= rUA*fvc::grad(p);
|
U -= rUA*fvc::grad(p);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
|
|
||||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
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;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
#include "rhoEqn.H"
|
||||||
{
|
|
||||||
p.storePrevIter();
|
|
||||||
rho.storePrevIter();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector 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();
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "hEqn.H"
|
#include "hEqn.H"
|
||||||
|
|
||||||
@ -80,6 +87,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
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)
|
+ turbulence->divDevRhoReff(U)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oCorr == nOuterCorr-1)
|
UEqn().relax();
|
||||||
{
|
|
||||||
UEqn().relax(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UEqn().relax();
|
|
||||||
}
|
|
||||||
|
|
||||||
mrfZones.addCoriolis(rho, UEqn());
|
mrfZones.addCoriolis(rho, UEqn());
|
||||||
pZones.addResistance(UEqn());
|
pZones.addResistance(UEqn());
|
||||||
@ -23,14 +16,7 @@ volScalarField rUA = 1.0/UEqn().A();
|
|||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
if (oCorr == nOuterCorr-1)
|
solve(UEqn() == -fvc::grad(p));
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,19 +30,20 @@ if (transonic)
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
mesh.solver
|
||||||
&& corr == nCorr-1
|
(
|
||||||
&& nonOrth == nNonOrthCorr
|
p.select
|
||||||
)
|
(
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver("pFinal"));
|
finalIter
|
||||||
}
|
&& corr == nCorr-1
|
||||||
else
|
&& nonOrth == nNonOrthCorr
|
||||||
{
|
)
|
||||||
pEqn.solve();
|
)
|
||||||
}
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -70,19 +71,20 @@ else
|
|||||||
- fvm::laplacian(rho*rUA, p)
|
- fvm::laplacian(rho*rUA, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
mesh.solver
|
||||||
&& corr == nCorr-1
|
(
|
||||||
&& nonOrth == nNonOrthCorr
|
p.select
|
||||||
)
|
(
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver("pFinal"));
|
finalIter
|
||||||
}
|
&& corr == nCorr-1
|
||||||
else
|
&& nonOrth == nNonOrthCorr
|
||||||
{
|
)
|
||||||
pEqn.solve();
|
)
|
||||||
}
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,17 +65,23 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
|
||||||
{
|
|
||||||
p.storePrevIter();
|
|
||||||
rho.storePrevIter();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector 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();
|
||||||
|
rho.storePrevIter();
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "hEqn.H"
|
#include "hEqn.H"
|
||||||
|
|
||||||
@ -86,6 +92,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -45,9 +45,14 @@
|
|||||||
scalar pRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
|
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;
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
- fvm::Sp(fvc::div(phi), h)
|
- fvm::Sp(fvc::div(phi), h)
|
||||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||||
==
|
==
|
||||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
|
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
|
||||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
|
||||||
);
|
);
|
||||||
|
|
||||||
pZones.addEnthalpySource(thermo, rho, hEqn);
|
pZones.addEnthalpySource(thermo, rho, hEqn);
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
rho = thermo.rho();
|
||||||
|
rho = max(rho, rhoMin);
|
||||||
|
rho = min(rho, rhoMax);
|
||||||
|
rho.relax();
|
||||||
|
|
||||||
if (pressureImplicitPorosity)
|
if (pressureImplicitPorosity)
|
||||||
{
|
{
|
||||||
U = trTU()&UEqn().H();
|
U = trTU()&UEqn().H();
|
||||||
@ -58,8 +63,6 @@ else
|
|||||||
|
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
|
|
||||||
bound(p, pMin);
|
|
||||||
|
|
||||||
// For closed-volume cases adjust the pressure and density levels
|
// For closed-volume cases adjust the pressure and density levels
|
||||||
// to obey overall mass continuity
|
// to obey overall mass continuity
|
||||||
if (closedVolume)
|
if (closedVolume)
|
||||||
@ -69,5 +72,7 @@ if (closedVolume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
rho = max(rho, rhoMin);
|
||||||
|
rho = min(rho, rhoMax);
|
||||||
rho.relax();
|
rho.relax();
|
||||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "compressibleCreatePhi.H"
|
#include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
|
|
||||||
label pRefCell = 0;
|
label pRefCell = 0;
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
buoyantBoussinesqPimpleFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPimpleFoam
|
||||||
@ -13,7 +13,6 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
TEqn.relax();
|
TEqn.relax();
|
||||||
|
|
||||||
TEqn.solve();
|
TEqn.solve();
|
||||||
|
|
||||||
rhok = 1.0 - beta*(T - TRef);
|
rhok = 1.0 - beta*(T - TRef);
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
buoyantBoussinesqPisoFoam
|
buoyantBoussinesqPimpleFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transient solver for buoyant, turbulent flow of incompressible fluids
|
Transient solver for buoyant, turbulent flow of incompressible fluids
|
||||||
@ -72,20 +72,40 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
#include "readPISOControls.H"
|
#include "readPIMPLEControls.H"
|
||||||
#include "CourantNo.H"
|
#include "CourantNo.H"
|
||||||
#include "setDeltaT.H"
|
#include "setDeltaT.H"
|
||||||
|
|
||||||
#include "UEqn.H"
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
#include "TEqn.H"
|
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||||
|
|
||||||
// --- PISO loop
|
|
||||||
for (int corr=0; corr<nCorr; corr++)
|
|
||||||
{
|
{
|
||||||
#include "pEqn.H"
|
bool finalIter = oCorr == nOuterCorr-1;
|
||||||
}
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::add("finalIteration", true);
|
||||||
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
if (nOuterCorr != 1)
|
||||||
|
{
|
||||||
|
p.storePrevIter();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "UEqn.H"
|
||||||
|
#include "TEqn.H"
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
#include "pEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
@ -42,9 +42,9 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "createPhi.H"
|
#include "createPhi.H"
|
||||||
|
|
||||||
# include "readTransportProperties.H"
|
#include "readTransportProperties.H"
|
||||||
|
|
||||||
Info<< "Creating turbulence model\n" << endl;
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
autoPtr<incompressible::RASModel> turbulence
|
autoPtr<incompressible::RASModel> turbulence
|
||||||
@ -57,7 +57,7 @@
|
|||||||
setRefCell
|
setRefCell
|
||||||
(
|
(
|
||||||
p,
|
p,
|
||||||
mesh.solutionDict().subDict("PISO"),
|
mesh.solutionDict().subDict("PIMPLE"),
|
||||||
pRefCell,
|
pRefCell,
|
||||||
pRefValue
|
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/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
buoyantPisoFoam
|
buoyantPimpleFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transient solver for buoyant, turbulent flow of compressible fluids for
|
Transient solver for buoyant, turbulent flow of compressible fluids for
|
||||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
#include "readPISOControls.H"
|
#include "readPIMPLEControls.H"
|
||||||
#include "compressibleCourantNo.H"
|
#include "compressibleCourantNo.H"
|
||||||
#include "setDeltaT.H"
|
#include "setDeltaT.H"
|
||||||
|
|
||||||
@ -69,21 +69,39 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
#include "UEqn.H"
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
|
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||||
#include "hEqn.H"
|
|
||||||
|
|
||||||
// --- PISO loop
|
|
||||||
|
|
||||||
for (int corr=0; corr<nCorr; corr++)
|
|
||||||
{
|
{
|
||||||
#include "pEqn.H"
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
|
||||||
|
|
||||||
rho = thermo.rho();
|
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
@ -12,16 +12,15 @@
|
|||||||
|
|
||||||
U = rUA*UEqn.H();
|
U = rUA*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
phi = fvc::interpolate(rho)*
|
||||||
(
|
(
|
||||||
fvc::interpolate(rho)
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
*(
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
(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++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
@ -32,27 +31,39 @@
|
|||||||
- fvm::laplacian(rhorUAf, p)
|
- fvm::laplacian(rhorUAf, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
pEqn.solve
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
mesh.solver
|
||||||
}
|
(
|
||||||
else
|
p.select
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name()));
|
(
|
||||||
}
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
// Calculate the conservative fluxes
|
||||||
phi += pEqn.flux();
|
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
|
// Second part of thermodynamic density update
|
||||||
thermo.rho() += psi*p;
|
thermo.rho() += psi*p;
|
||||||
|
|
||||||
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
@ -1,3 +0,0 @@
|
|||||||
buoyantPisoFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/buoyantPisoFoam
|
|
||||||
@ -22,16 +22,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
pEqn.solve();
|
||||||
// retain the residual from the first iteration
|
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
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,27 +7,13 @@ tmp<fvVectorMatrix> UEqn
|
|||||||
+ turbulence->divDevReff(U)
|
+ turbulence->divDevReff(U)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oCorr == nOuterCorr-1)
|
UEqn().relax();
|
||||||
{
|
|
||||||
UEqn().relax(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UEqn().relax();
|
|
||||||
}
|
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn().A();
|
volScalarField rUA = 1.0/UEqn().A();
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
if (oCorr == nOuterCorr-1)
|
solve(UEqn() == -fvc::grad(p));
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solve(UEqn() == -fvc::grad(p));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,19 +21,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
mesh.solver
|
||||||
&& corr == nCorr-1
|
(
|
||||||
&& nonOrth == nNonOrthCorr
|
p.select
|
||||||
)
|
(
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver("pFinal"));
|
finalIter
|
||||||
}
|
&& corr == nCorr-1
|
||||||
else
|
&& nonOrth == nNonOrthCorr
|
||||||
{
|
)
|
||||||
pEqn.solve();
|
)
|
||||||
}
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -43,11 +44,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector except for last corrector
|
// Explicitly relax pressure for momentum corrector
|
||||||
if (oCorr != nOuterCorr-1)
|
p.relax();
|
||||||
{
|
|
||||||
p.relax();
|
|
||||||
}
|
|
||||||
|
|
||||||
U -= rUA*fvc::grad(p);
|
U -= rUA*fvc::grad(p);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I.. \
|
||||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/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
|
// --- 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)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -96,62 +102,15 @@ int main(int argc, char *argv[])
|
|||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
for (int corr=0; corr<nCorr; corr++)
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
{
|
{
|
||||||
rAU = 1.0/UEqn.A();
|
#include "pEqn.H"
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
@ -1,5 +1,5 @@
|
|||||||
# include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
# include "readPIMPLEControls.H"
|
#include "readPIMPLEControls.H"
|
||||||
|
|
||||||
bool correctPhi = false;
|
bool correctPhi = false;
|
||||||
if (pimple.found("correctPhi"))
|
if (pimple.found("correctPhi"))
|
||||||
@ -62,6 +62,12 @@ int main(int argc, char *argv[])
|
|||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector 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)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -76,6 +82,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -15,14 +15,7 @@
|
|||||||
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
|
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oCorr == nOuterCorr-1)
|
UEqn.relax();
|
||||||
{
|
|
||||||
UEqn.relax(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UEqn.relax();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
@ -34,7 +27,6 @@
|
|||||||
(
|
(
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||||
- mesh.magSf()*fvc::snGrad(p)
|
- mesh.magSf()*fvc::snGrad(p)
|
||||||
),
|
)
|
||||||
mesh.solver(oCorr == nOuterCorr-1 ? "UFinal" : "U")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,18 +22,20 @@
|
|||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
if
|
pEqn.solve
|
||||||
(
|
(
|
||||||
corr == nCorr-1
|
mesh.solver
|
||||||
&& nonOrth == nNonOrthCorr
|
(
|
||||||
)
|
p.select
|
||||||
{
|
(
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
(
|
||||||
}
|
finalIter
|
||||||
else
|
&& corr == nCorr-1
|
||||||
{
|
&& nonOrth == nNonOrthCorr
|
||||||
pEqn.solve(mesh.solver(p.name()));
|
)
|
||||||
}
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -68,6 +68,12 @@ int main(int argc, char *argv[])
|
|||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector 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);
|
||||||
|
}
|
||||||
|
|
||||||
twoPhaseProperties.correct();
|
twoPhaseProperties.correct();
|
||||||
|
|
||||||
#include "alphaEqn.H"
|
#include "alphaEqn.H"
|
||||||
@ -83,6 +89,11 @@ int main(int argc, char *argv[])
|
|||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -545,4 +545,6 @@ $(writers)/gnuplotGraph/gnuplotGraph.C
|
|||||||
$(writers)/xmgrGraph/xmgrGraph.C
|
$(writers)/xmgrGraph/xmgrGraph.C
|
||||||
$(writers)/jplotGraph/jplotGraph.C
|
$(writers)/jplotGraph/jplotGraph.C
|
||||||
|
|
||||||
|
meshes/data/data.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libOpenFOAM
|
LIB = $(FOAM_LIBBIN)/libOpenFOAM
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "dictionary.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>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
|
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()));
|
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>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
|
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
|
// alpha is read from controlDict
|
||||||
void relax();
|
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
|
// Member function *this operators
|
||||||
|
|
||||||
|
|||||||
@ -23,23 +23,23 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvData.H"
|
#include "data.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "lduMatrix.H"
|
#include "lduMatrix.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
|
int Foam::data::debug(Foam::debug::debugSwitch("data", false));
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fvData::fvData(const objectRegistry& obr)
|
Foam::data::data(const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
IOdictionary
|
IOdictionary
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"fvData",
|
"data",
|
||||||
obr.time().system(),
|
obr.time().system(),
|
||||||
obr,
|
obr,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -53,13 +53,13 @@ Foam::fvData::fvData(const objectRegistry& obr)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
|
const Foam::dictionary& Foam::data::solverPerformanceDict() const
|
||||||
{
|
{
|
||||||
return subDict("solverPerformance");
|
return subDict("solverPerformance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fvData::setSolverPerformance
|
void Foam::data::setSolverPerformance
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const lduMatrix::solverPerformance& sp
|
const lduMatrix::solverPerformance& sp
|
||||||
@ -22,20 +22,21 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::fvData
|
Foam::data
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Database for finite volume solution data, solver performance and
|
Database for solution data, solver performance and other reduced data.
|
||||||
other reduced data. fvMesh is derived from fvData so that all fields have
|
|
||||||
access to the fvData from the mesh reference they hold.
|
fvMesh is derived from data so that all fields have access to the data from
|
||||||
|
the mesh reference they hold.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fvData.C
|
data.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fvData_H
|
#ifndef data_H
|
||||||
#define fvData_H
|
#define data_H
|
||||||
|
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
#include "lduMatrix.H"
|
#include "lduMatrix.H"
|
||||||
@ -46,20 +47,20 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fvData Declaration
|
Class data Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class fvData
|
class data
|
||||||
:
|
:
|
||||||
public IOdictionary
|
public IOdictionary
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
fvData(const fvData&);
|
data(const data&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const fvData&);
|
void operator=(const data&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -71,7 +72,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for objectRegistry
|
//- Construct for objectRegistry
|
||||||
fvData(const objectRegistry& obr);
|
data(const objectRegistry& obr);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -273,7 +273,6 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C
|
|||||||
|
|
||||||
finiteVolume/fv/fv.C
|
finiteVolume/fv/fv.C
|
||||||
finiteVolume/fvSchemes/fvSchemes.C
|
finiteVolume/fvSchemes/fvSchemes.C
|
||||||
finiteVolume/fvData/fvData.C
|
|
||||||
|
|
||||||
ddtSchemes = finiteVolume/ddtSchemes
|
ddtSchemes = finiteVolume/ddtSchemes
|
||||||
$(ddtSchemes)/ddtScheme/ddtSchemes.C
|
$(ddtSchemes)/ddtScheme/ddtSchemes.C
|
||||||
|
|||||||
@ -506,6 +506,13 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
InfoIn("fvMatrix<Type>::relax(const scalar alpha)")
|
||||||
|
<< "Relaxing " << psi_.name() << " by " << alpha
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
Field<Type>& S = source();
|
Field<Type>& S = source();
|
||||||
scalarField& D = diag();
|
scalarField& D = diag();
|
||||||
|
|
||||||
@ -591,9 +598,14 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvMatrix<Type>::relax()
|
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::autoPtr<typename Foam::fvMatrix<Type>::fvSolver>
|
||||||
Foam::fvMatrix<Type>::solver()
|
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>
|
template<class Type>
|
||||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
|
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>
|
template<class Type>
|
||||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
|
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),
|
surfaceInterpolation(*this),
|
||||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||||
fvSolution(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()),
|
boundary_(*this, boundaryMesh()),
|
||||||
lduPtr_(NULL),
|
lduPtr_(NULL),
|
||||||
curTimeIndex_(time().timeIndex()),
|
curTimeIndex_(time().timeIndex()),
|
||||||
@ -248,7 +248,7 @@ Foam::fvMesh::fvMesh
|
|||||||
surfaceInterpolation(*this),
|
surfaceInterpolation(*this),
|
||||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||||
fvSolution(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),
|
boundary_(*this),
|
||||||
lduPtr_(NULL),
|
lduPtr_(NULL),
|
||||||
curTimeIndex_(time().timeIndex()),
|
curTimeIndex_(time().timeIndex()),
|
||||||
@ -281,7 +281,7 @@ Foam::fvMesh::fvMesh
|
|||||||
surfaceInterpolation(*this),
|
surfaceInterpolation(*this),
|
||||||
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
fvSchemes(static_cast<const objectRegistry&>(*this)),
|
||||||
fvSolution(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),
|
boundary_(*this),
|
||||||
lduPtr_(NULL),
|
lduPtr_(NULL),
|
||||||
curTimeIndex_(time().timeIndex()),
|
curTimeIndex_(time().timeIndex()),
|
||||||
|
|||||||
@ -54,7 +54,7 @@ SourceFiles
|
|||||||
#include "surfaceInterpolation.H"
|
#include "surfaceInterpolation.H"
|
||||||
#include "fvSchemes.H"
|
#include "fvSchemes.H"
|
||||||
#include "fvSolution.H"
|
#include "fvSolution.H"
|
||||||
#include "fvData.H"
|
#include "data.H"
|
||||||
#include "DimensionedField.H"
|
#include "DimensionedField.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
@ -83,7 +83,7 @@ class fvMesh
|
|||||||
public surfaceInterpolation,
|
public surfaceInterpolation,
|
||||||
public fvSchemes,
|
public fvSchemes,
|
||||||
public fvSolution,
|
public fvSolution,
|
||||||
public fvData
|
public data
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
|||||||
@ -291,7 +291,10 @@ void Foam::DsmcCloud<ParcelType>::initialise
|
|||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
void Foam::DsmcCloud<ParcelType>::collisions()
|
void Foam::DsmcCloud<ParcelType>::collisions()
|
||||||
{
|
{
|
||||||
buildCellOccupancy();
|
if (!binaryCollision().active())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Temporary storage for subCells
|
// Temporary storage for subCells
|
||||||
List<DynamicList<label> > subCells(8);
|
List<DynamicList<label> > subCells(8);
|
||||||
@ -1057,6 +1060,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
|||||||
// Move the particles ballistically with their current velocities
|
// Move the particles ballistically with their current velocities
|
||||||
Cloud<ParcelType>::move(td);
|
Cloud<ParcelType>::move(td);
|
||||||
|
|
||||||
|
// Update cell occupancy
|
||||||
|
buildCellOccupancy();
|
||||||
|
|
||||||
// Calculate new velocities via stochastic collisions
|
// Calculate new velocities via stochastic collisions
|
||||||
collisions();
|
collisions();
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "dsmcParcel.H"
|
#include "dsmcParcel.H"
|
||||||
#include "DsmcCloud.H"
|
#include "DsmcCloud.H"
|
||||||
|
#include "NoBinaryCollision.H"
|
||||||
#include "VariableHardSphere.H"
|
#include "VariableHardSphere.H"
|
||||||
#include "LarsenBorgnakkeVariableHardSphere.H"
|
#include "LarsenBorgnakkeVariableHardSphere.H"
|
||||||
|
|
||||||
@ -34,6 +35,12 @@ namespace Foam
|
|||||||
|
|
||||||
// Add instances of collision model to the table
|
// Add instances of collision model to the table
|
||||||
makeBinaryCollisionModelType
|
makeBinaryCollisionModelType
|
||||||
|
(
|
||||||
|
NoBinaryCollision,
|
||||||
|
DsmcCloud,
|
||||||
|
dsmcParcel
|
||||||
|
);
|
||||||
|
makeBinaryCollisionModelType
|
||||||
(
|
(
|
||||||
VariableHardSphere,
|
VariableHardSphere,
|
||||||
DsmcCloud,
|
DsmcCloud,
|
||||||
|
|||||||
@ -27,6 +27,15 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::BinaryCollisionModel<CloudType>::BinaryCollisionModel(CloudType& owner)
|
||||||
|
:
|
||||||
|
dict_(dictionary::null),
|
||||||
|
owner_(owner),
|
||||||
|
coeffDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::BinaryCollisionModel<CloudType>::BinaryCollisionModel
|
Foam::BinaryCollisionModel<CloudType>::BinaryCollisionModel
|
||||||
(
|
(
|
||||||
@ -87,4 +96,3 @@ Foam::BinaryCollisionModel<CloudType>::coeffDict() const
|
|||||||
#include "BinaryCollisionModelNew.C"
|
#include "BinaryCollisionModelNew.C"
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null from owner
|
||||||
|
BinaryCollisionModel(CloudType& owner);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
BinaryCollisionModel
|
BinaryCollisionModel
|
||||||
(
|
(
|
||||||
@ -123,6 +126,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Flag to indicate whether model activates collision model
|
||||||
|
virtual bool active() const = 0;
|
||||||
|
|
||||||
//- Return the collision cross section * relative velocity product
|
//- Return the collision cross section * relative velocity product
|
||||||
virtual scalar sigmaTcR
|
virtual scalar sigmaTcR
|
||||||
(
|
(
|
||||||
|
|||||||
@ -117,6 +117,12 @@ Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
bool Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::active() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class CloudType>
|
template <class CloudType>
|
||||||
Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
|
Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
|
||||||
|
|||||||
@ -89,6 +89,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Flag to indicate whether model activates collision model
|
||||||
|
virtual bool active() const;
|
||||||
|
|
||||||
//- Return the collision cross section * relative velocity product
|
//- Return the collision cross section * relative velocity product
|
||||||
virtual scalar sigmaTcR
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
bool Foam::VariableHardSphere<CloudType>::active() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class CloudType>
|
template <class CloudType>
|
||||||
Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
|
Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
|
||||||
|
|||||||
@ -74,6 +74,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Flag to indicate whether model activates collision model
|
||||||
|
virtual bool active() const;
|
||||||
|
|
||||||
//- Return the collision cross section * relative velocity product
|
//- Return the collision cross section * relative velocity product
|
||||||
virtual scalar sigmaTcR
|
virtual scalar sigmaTcR
|
||||||
(
|
(
|
||||||
|
|||||||
@ -27,6 +27,15 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel(CloudType& owner)
|
||||||
|
:
|
||||||
|
dict_(dictionary::null),
|
||||||
|
owner_(owner),
|
||||||
|
coeffDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel
|
Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel
|
||||||
(
|
(
|
||||||
|
|||||||
@ -86,6 +86,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null from owner
|
||||||
|
InflowBoundaryModel(CloudType& owner);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
InflowBoundaryModel
|
InflowBoundaryModel
|
||||||
(
|
(
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Foam::NoInflow<CloudType>::NoInflow
|
|||||||
CloudType& cloud
|
CloudType& cloud
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
InflowBoundaryModel<CloudType>(dict, cloud, typeName)
|
InflowBoundaryModel<CloudType>(cloud)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class NoInflow
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("NoInflow");
|
TypeName("none");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Foam::MaxwellianThermal<CloudType>::MaxwellianThermal
|
|||||||
CloudType& cloud
|
CloudType& cloud
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
WallInteractionModel<CloudType>(dict, cloud, typeName)
|
WallInteractionModel<CloudType>(cloud)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Foam::SpecularReflection<CloudType>::SpecularReflection
|
|||||||
CloudType& cloud
|
CloudType& cloud
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
WallInteractionModel<CloudType>(dict, cloud, typeName)
|
WallInteractionModel<CloudType>(cloud)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,15 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::WallInteractionModel<CloudType>::WallInteractionModel(CloudType& owner)
|
||||||
|
:
|
||||||
|
dict_(dictionary::null),
|
||||||
|
owner_(owner),
|
||||||
|
coeffDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::WallInteractionModel<CloudType>::WallInteractionModel
|
Foam::WallInteractionModel<CloudType>::WallInteractionModel
|
||||||
(
|
(
|
||||||
|
|||||||
@ -85,6 +85,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null from owner
|
||||||
|
WallInteractionModel(CloudType& owner);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
WallInteractionModel
|
WallInteractionModel
|
||||||
(
|
(
|
||||||
|
|||||||
@ -28,37 +28,41 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
Foam::CollisionRecordList<Type>::CollisionRecordList()
|
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList()
|
||||||
:
|
:
|
||||||
DynamicList<CollisionRecord<Type> >()
|
pairRecords_(),
|
||||||
|
wallRecords_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
Foam::CollisionRecordList<Type>::CollisionRecordList(Istream& is)
|
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
|
||||||
:
|
:
|
||||||
DynamicList<CollisionRecord<Type> >(is)
|
pairRecords_(is),
|
||||||
|
wallRecords_(is)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check
|
is.check
|
||||||
(
|
(
|
||||||
"Foam::CollisionRecordList<Type>::CollisionRecordList(Foam::Istream&)"
|
"Foam::CollisionRecordList<PairType, WallType>::"
|
||||||
|
"CollisionRecordList(Foam::Istream&)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
Foam::CollisionRecordList<Type>::~CollisionRecordList()
|
Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
Foam::CollisionRecord<Type>& Foam::CollisionRecordList<Type>::matchRecord
|
Foam::PairCollisionRecord<PairType>&
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
|
||||||
(
|
(
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther
|
label origIdOfOther
|
||||||
@ -68,15 +72,15 @@ Foam::CollisionRecord<Type>& Foam::CollisionRecordList<Type>::matchRecord
|
|||||||
// identifiers. Two records with the same identification is not
|
// identifiers. Two records with the same identification is not
|
||||||
// supported.
|
// 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
|
// member of the list. The status of the record will be accessed
|
||||||
// by construction.
|
// by construction.
|
||||||
|
|
||||||
append(CollisionRecord<Type>(origProcOfOther, origIdOfOther));
|
pairRecords_.append
|
||||||
|
(
|
||||||
|
PairCollisionRecord<PairType>(origProcOfOther, origIdOfOther)
|
||||||
|
);
|
||||||
|
|
||||||
return (*this)[this->size() - 1];
|
return pairRecords_.last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
void Foam::CollisionRecordList<Type>::update()
|
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];
|
||||||
{
|
|
||||||
(*this)[i].setUnaccessed();
|
|
||||||
|
|
||||||
updatedRecords.append((*this)[i]);
|
if (wCR.match(pRel, radius))
|
||||||
|
{
|
||||||
|
wCR.setAccessed();
|
||||||
|
|
||||||
|
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
|
#define CollisionRecordList_H
|
||||||
|
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "CollisionRecord.H"
|
#include "PairCollisionRecord.H"
|
||||||
|
#include "WallCollisionRecord.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
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
|
Class CollisionRecordList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class PairType, class WallType>
|
||||||
class CollisionRecordList
|
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:
|
public:
|
||||||
|
|
||||||
@ -72,19 +103,66 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Enquires if the proc and id pair of the other particle are
|
//- Enquires if the proc and id pair of the other particle are
|
||||||
// present in the records. If so, return access to the
|
// present in the records. If so, return non-const access to
|
||||||
// collisionData and mark the CollisionRecord as accessed this
|
// the PairCollisionRecord (hence the data) and mark the
|
||||||
// step, if not, create the record and return access to it.
|
// PairCollisionRecord as accessed this step, if not, create
|
||||||
CollisionRecord<Type>& matchRecord
|
// the record and return access to it.
|
||||||
|
PairCollisionRecord<PairType>& matchPairRecord
|
||||||
(
|
(
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther
|
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
|
//- Update the collision records, deleting any records not
|
||||||
// marked as having been accessed, then mark all records as
|
// marked as having been accessed, then mark all records as
|
||||||
// not accessed ready for the next evaluation
|
// not accessed ready for the next evaluation
|
||||||
void update();
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::CollisionRecord<Type>::CollisionRecord()
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord()
|
||||||
:
|
:
|
||||||
origProcOfOther_(-VGREAT),
|
origProcOfOther_(-VGREAT),
|
||||||
origIdOfOther_(-VGREAT),
|
origIdOfOther_(-VGREAT),
|
||||||
@ -37,7 +37,7 @@ Foam::CollisionRecord<Type>::CollisionRecord()
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::CollisionRecord<Type>::CollisionRecord
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
||||||
(
|
(
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther,
|
label origIdOfOther,
|
||||||
@ -51,33 +51,39 @@ Foam::CollisionRecord<Type>::CollisionRecord
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::CollisionRecord<Type>::CollisionRecord(const CollisionRecord<Type>& cR)
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
||||||
|
(
|
||||||
|
const PairCollisionRecord<Type>& pCR
|
||||||
|
)
|
||||||
:
|
:
|
||||||
origProcOfOther_(cR.origProcOfOther() + 1),
|
origProcOfOther_(pCR.origProcOfOther() + 1),
|
||||||
origIdOfOther_(cR.origIdOfOther_),
|
origIdOfOther_(pCR.origIdOfOther_),
|
||||||
data_(cR.data_)
|
data_(pCR.data_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::CollisionRecord<Type>::~CollisionRecord()
|
Foam::PairCollisionRecord<Type>::~PairCollisionRecord()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
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
|
// Check for assignment to self
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::CollisionRecord<Type>::operator="
|
"Foam::PairCollisionRecord<Type>::operator="
|
||||||
"(const Foam::CollisionRecord<Type>&)"
|
"(const Foam::PairCollisionRecord<Type>&)"
|
||||||
)
|
)
|
||||||
<< "Attempted assignment to self"
|
<< "Attempted assignment to self"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
@ -91,7 +97,7 @@ void Foam::CollisionRecord<Type>::operator=(const CollisionRecord<Type>& rhs)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "CollisionRecordIO.C"
|
#include "PairCollisionRecordIO.C"
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::CollisionRecord
|
Foam::PairCollisionRecord
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
@ -35,14 +35,14 @@ Description
|
|||||||
positive means that it has.
|
positive means that it has.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
CollisionRecordI.H
|
PairCollisionRecordI.H
|
||||||
CollisionRecord.C
|
PairCollisionRecord.C
|
||||||
CollisionRecordIO.C
|
PairCollisionRecordIO.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef CollisionRecord_H
|
#ifndef PairCollisionRecord_H
|
||||||
#define CollisionRecord_H
|
#define PairCollisionRecord_H
|
||||||
|
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
@ -54,35 +54,35 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class CollisionRecord;
|
class PairCollisionRecord;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool operator==
|
inline bool operator==
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>&,
|
const PairCollisionRecord<Type>&,
|
||||||
const CollisionRecord<Type>&
|
const PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool operator!=
|
inline bool operator!=
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>&,
|
const PairCollisionRecord<Type>&,
|
||||||
const CollisionRecord<Type>&
|
const PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Istream& operator>>(Istream&, CollisionRecord<Type>&);
|
Istream& operator>>(Istream&, PairCollisionRecord<Type>&);
|
||||||
|
|
||||||
template<class 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>
|
template<class Type>
|
||||||
class CollisionRecord
|
class PairCollisionRecord
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -103,10 +103,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
CollisionRecord();
|
PairCollisionRecord();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
CollisionRecord
|
PairCollisionRecord
|
||||||
(
|
(
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther,
|
label origIdOfOther,
|
||||||
@ -114,14 +114,14 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
CollisionRecord(Istream&);
|
PairCollisionRecord(Istream&);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
CollisionRecord(const CollisionRecord&);
|
PairCollisionRecord(const PairCollisionRecord&);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~CollisionRecord();
|
~PairCollisionRecord();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -165,21 +165,21 @@ public:
|
|||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
void operator=(const CollisionRecord&);
|
void operator=(const PairCollisionRecord&);
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|
||||||
friend bool operator== <Type>
|
friend bool operator== <Type>
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>&,
|
const PairCollisionRecord<Type>&,
|
||||||
const CollisionRecord<Type>&
|
const PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
friend bool operator!= <Type>
|
friend bool operator!= <Type>
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>&,
|
const PairCollisionRecord<Type>&,
|
||||||
const CollisionRecord<Type>&
|
const PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -188,13 +188,13 @@ public:
|
|||||||
friend Istream& operator>> <Type>
|
friend Istream& operator>> <Type>
|
||||||
(
|
(
|
||||||
Istream&,
|
Istream&,
|
||||||
CollisionRecord<Type>&
|
PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
friend Ostream& operator<< <Type>
|
friend Ostream& operator<< <Type>
|
||||||
(
|
(
|
||||||
Ostream&,
|
Ostream&,
|
||||||
const CollisionRecord<Type>&
|
const PairCollisionRecord<Type>&
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -205,12 +205,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "CollisionRecordI.H"
|
#include "PairCollisionRecordI.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
# include "CollisionRecord.C"
|
# include "PairCollisionRecord.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -26,7 +26,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool Foam::CollisionRecord<Type>::match
|
inline bool Foam::PairCollisionRecord<Type>::match
|
||||||
(
|
(
|
||||||
label queryOrigProcOfOther,
|
label queryOrigProcOfOther,
|
||||||
label queryOrigIdOfOther
|
label queryOrigIdOfOther
|
||||||
@ -41,14 +41,14 @@ inline bool Foam::CollisionRecord<Type>::match
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Foam::label Foam::CollisionRecord<Type>::origProcOfOther() const
|
inline Foam::label Foam::PairCollisionRecord<Type>::origProcOfOther() const
|
||||||
{
|
{
|
||||||
return mag(origProcOfOther_) - 1;
|
return mag(origProcOfOther_) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Foam::label Foam::CollisionRecord<Type>::origIdOfOther() const
|
inline Foam::label Foam::PairCollisionRecord<Type>::origIdOfOther() const
|
||||||
{
|
{
|
||||||
return origIdOfOther_;
|
return origIdOfOther_;
|
||||||
}
|
}
|
||||||
@ -56,35 +56,35 @@ inline Foam::label Foam::CollisionRecord<Type>::origIdOfOther() const
|
|||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline const Type&
|
inline const Type&
|
||||||
Foam::CollisionRecord<Type>::collisionData() const
|
Foam::PairCollisionRecord<Type>::collisionData() const
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Type& Foam::CollisionRecord<Type>::collisionData()
|
inline Type& Foam::PairCollisionRecord<Type>::collisionData()
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool Foam::CollisionRecord<Type>::accessed() const
|
inline bool Foam::PairCollisionRecord<Type>::accessed() const
|
||||||
{
|
{
|
||||||
return pos(origProcOfOther_);
|
return pos(origProcOfOther_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline void Foam::CollisionRecord<Type>::setAccessed()
|
inline void Foam::PairCollisionRecord<Type>::setAccessed()
|
||||||
{
|
{
|
||||||
origProcOfOther_ = origProcOfOther() + 1;
|
origProcOfOther_ = origProcOfOther() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline void Foam::CollisionRecord<Type>::setUnaccessed()
|
inline void Foam::PairCollisionRecord<Type>::setUnaccessed()
|
||||||
{
|
{
|
||||||
origProcOfOther_ = -(origProcOfOther() + 1);
|
origProcOfOther_ = -(origProcOfOther() + 1);
|
||||||
}
|
}
|
||||||
@ -95,8 +95,8 @@ inline void Foam::CollisionRecord<Type>::setUnaccessed()
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool Foam::operator==
|
inline bool Foam::operator==
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>& a,
|
const PairCollisionRecord<Type>& a,
|
||||||
const CollisionRecord<Type>& b
|
const PairCollisionRecord<Type>& b
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -107,11 +107,12 @@ inline bool Foam::operator==
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline bool Foam::operator!=
|
inline bool Foam::operator!=
|
||||||
(
|
(
|
||||||
const CollisionRecord<Type>& a,
|
const PairCollisionRecord<Type>& a,
|
||||||
const CollisionRecord<Type>& b
|
const PairCollisionRecord<Type>& b
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return !(a == b);
|
return !(a == b);
|
||||||
@ -23,35 +23,38 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "CollisionRecord.H"
|
#include "PairCollisionRecord.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::CollisionRecord<Type>::CollisionRecord(Istream& is)
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord(Istream& is)
|
||||||
:
|
:
|
||||||
origProcOfOther_(readLabel(is)),
|
origProcOfOther_(readLabel(is)),
|
||||||
origIdOfOther_(readLabel(is)),
|
origIdOfOther_(readLabel(is)),
|
||||||
data_(is)
|
data_(is)
|
||||||
{
|
{
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check("Foam::CollisionRecord<Type>::CollisionRecord(Foam::Istream&)");
|
is.check
|
||||||
|
(
|
||||||
|
"Foam::PairCollisionRecord<Type>::PairCollisionRecord(Foam::Istream&)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
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
|
// Check state of Istream
|
||||||
is.check
|
is.check
|
||||||
(
|
(
|
||||||
"Foam::Istream&"
|
"Foam::Istream&"
|
||||||
"Foam::operator>>(Foam::Istream&, Foam::CollisionRecord<Type>&)"
|
"Foam::operator>>(Foam::Istream&, Foam::PairCollisionRecord<Type>&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
@ -59,17 +62,21 @@ Foam::Istream& Foam::operator>>(Istream& is, CollisionRecord<Type>& cR)
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
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_
|
os << pCR.origProcOfOther_
|
||||||
<< token::SPACE << cR.origIdOfOther_
|
<< token::SPACE << pCR.origIdOfOther_
|
||||||
<< token::SPACE << cR.data_;
|
<< token::SPACE << pCR.data_;
|
||||||
|
|
||||||
// Check state of Ostream
|
// Check state of Ostream
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||||
"const Foam::CollisionRecord<Type>&)"
|
"const Foam::PairCollisionRecord<Type>&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
return os;
|
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_;
|
vector UTurb_;
|
||||||
|
|
||||||
//- Particle collision records
|
//- Particle collision records
|
||||||
CollisionRecordList<vector> collisionRecords_;
|
CollisionRecordList<vector, vector> collisionRecords_;
|
||||||
|
|
||||||
|
|
||||||
// Cell-based quantities
|
// Cell-based quantities
|
||||||
@ -400,7 +400,8 @@ public:
|
|||||||
inline const vector& UTurb() const;
|
inline const vector& UTurb() const;
|
||||||
|
|
||||||
//- Return const access to the collision records
|
//- Return const access to the collision records
|
||||||
inline const CollisionRecordList<vector>& collisionRecords() const;
|
inline const CollisionRecordList<vector, vector>&
|
||||||
|
collisionRecords() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
@ -439,7 +440,7 @@ public:
|
|||||||
inline vector& UTurb();
|
inline vector& UTurb();
|
||||||
|
|
||||||
//- Return access to collision records
|
//- Return access to collision records
|
||||||
inline CollisionRecordList<vector>& collisionRecords();
|
inline CollisionRecordList<vector, vector>& collisionRecords();
|
||||||
|
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
|
|||||||
@ -348,7 +348,7 @@ inline bool& Foam::KinematicParcel<ParcelType>::active()
|
|||||||
|
|
||||||
|
|
||||||
template <class ParcelType>
|
template <class ParcelType>
|
||||||
inline const Foam::CollisionRecordList<Foam::vector>&
|
inline const Foam::CollisionRecordList<Foam::vector, Foam::vector>&
|
||||||
Foam::KinematicParcel<ParcelType>::collisionRecords() const
|
Foam::KinematicParcel<ParcelType>::collisionRecords() const
|
||||||
{
|
{
|
||||||
return collisionRecords_;
|
return collisionRecords_;
|
||||||
@ -426,7 +426,7 @@ inline Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb()
|
|||||||
|
|
||||||
|
|
||||||
template <class ParcelType>
|
template <class ParcelType>
|
||||||
inline Foam::CollisionRecordList<Foam::vector>&
|
inline Foam::CollisionRecordList<Foam::vector, Foam::vector>&
|
||||||
Foam::KinematicParcel<ParcelType>::collisionRecords()
|
Foam::KinematicParcel<ParcelType>::collisionRecords()
|
||||||
{
|
{
|
||||||
return collisionRecords_;
|
return collisionRecords_;
|
||||||
|
|||||||
@ -61,6 +61,7 @@ Foam::particleForces::particleForces
|
|||||||
dict_(dict.subDict("particleForces")),
|
dict_(dict.subDict("particleForces")),
|
||||||
g_(g),
|
g_(g),
|
||||||
gradUPtr_(NULL),
|
gradUPtr_(NULL),
|
||||||
|
HdotGradHInterPtr_(NULL),
|
||||||
gravity_(dict_.lookup("gravity")),
|
gravity_(dict_.lookup("gravity")),
|
||||||
virtualMass_(dict_.lookup("virtualMass")),
|
virtualMass_(dict_.lookup("virtualMass")),
|
||||||
Cvm_(0.0),
|
Cvm_(0.0),
|
||||||
@ -88,6 +89,7 @@ Foam::particleForces::particleForces(const particleForces& f)
|
|||||||
dict_(f.dict_),
|
dict_(f.dict_),
|
||||||
g_(f.g_),
|
g_(f.g_),
|
||||||
gradUPtr_(f.gradUPtr_),
|
gradUPtr_(f.gradUPtr_),
|
||||||
|
HdotGradHInterPtr_(f.HdotGradHInterPtr_),
|
||||||
gravity_(f.gravity_),
|
gravity_(f.gravity_),
|
||||||
virtualMass_(f.virtualMass_),
|
virtualMass_(f.virtualMass_),
|
||||||
Cvm_(f.Cvm_),
|
Cvm_(f.Cvm_),
|
||||||
|
|||||||
@ -198,20 +198,20 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
|
|||||||
scalar deltaT = this->owner().mesh().time().deltaTValue();
|
scalar deltaT = this->owner().mesh().time().deltaTValue();
|
||||||
|
|
||||||
vector& tangentialOverlap_AB =
|
vector& tangentialOverlap_AB =
|
||||||
pA.collisionRecords().matchRecord
|
pA.collisionRecords().matchPairRecord
|
||||||
(
|
(
|
||||||
pB.origProc(),
|
pB.origProc(),
|
||||||
pB.origId()
|
pB.origId()
|
||||||
).collisionData();
|
).collisionData();
|
||||||
|
|
||||||
vector& tangentialOverlap_BA =
|
vector& tangentialOverlap_BA =
|
||||||
pB.collisionRecords().matchRecord
|
pB.collisionRecords().matchPairRecord
|
||||||
(
|
(
|
||||||
pA.origProc(),
|
pA.origProc(),
|
||||||
pA.origId()
|
pA.origId()
|
||||||
).collisionData();
|
).collisionData();
|
||||||
|
|
||||||
vector deltaTangentialOverlap_AB = USlip_AB * deltaT;
|
vector deltaTangentialOverlap_AB = USlip_AB*deltaT;
|
||||||
|
|
||||||
tangentialOverlap_AB += deltaTangentialOverlap_AB;
|
tangentialOverlap_AB += deltaTangentialOverlap_AB;
|
||||||
tangentialOverlap_BA += -deltaTangentialOverlap_AB;
|
tangentialOverlap_BA += -deltaTangentialOverlap_AB;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Description
|
|||||||
#define PairSpringSliderDashpot_H
|
#define PairSpringSliderDashpot_H
|
||||||
|
|
||||||
#include "PairModel.H"
|
#include "PairModel.H"
|
||||||
#include "CollisionRecord.H"
|
#include "CollisionRecordList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user