mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -12,7 +12,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
TEqn.relax();
|
TEqn.relax();
|
||||||
TEqn.solve();
|
TEqn.solve(mesh.solver(T.select(finalIter)));
|
||||||
|
|
||||||
rhok = 1.0 - beta*(T - TRef);
|
rhok = 1.0 - beta*(T - TRef);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,10 @@
|
|||||||
fvc::reconstruct
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
fvc::interpolate(rhok)*(g & mesh.Sf())
|
- ghf*fvc::snGrad(rhok)
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
- fvc::snGrad(p_rgh)
|
||||||
)
|
)*mesh.magSf()
|
||||||
)
|
),
|
||||||
|
mesh.solver(U.select(finalIter))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|||||||
@ -14,12 +14,12 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading field p\n" << endl;
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
volScalarField p
|
volScalarField p_rgh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"p",
|
"p_rgh",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
@ -52,6 +52,18 @@
|
|||||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Kinematic density for buoyancy force
|
||||||
|
volScalarField rhok
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhok",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
1.0 - beta*(T - TRef)
|
||||||
|
);
|
||||||
|
|
||||||
// kinematic turbulent thermal thermal conductivity m2/s
|
// kinematic turbulent thermal thermal conductivity m2/s
|
||||||
Info<< "Reading field kappat\n" << endl;
|
Info<< "Reading field kappat\n" << endl;
|
||||||
volScalarField kappat
|
volScalarField kappat
|
||||||
@ -67,25 +79,41 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
p_rgh + rhok*gh
|
||||||
|
);
|
||||||
|
|
||||||
label pRefCell = 0;
|
label pRefCell = 0;
|
||||||
scalar pRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell
|
setRefCell
|
||||||
(
|
(
|
||||||
p,
|
p,
|
||||||
|
p_rgh,
|
||||||
mesh.solutionDict().subDict("PIMPLE"),
|
mesh.solutionDict().subDict("PIMPLE"),
|
||||||
pRefCell,
|
pRefCell,
|
||||||
pRefValue
|
pRefValue
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
// Kinematic density for buoyancy force
|
{
|
||||||
volScalarField rhok
|
p += dimensionedScalar
|
||||||
(
|
(
|
||||||
IOobject
|
"p",
|
||||||
(
|
p.dimensions(),
|
||||||
"rhok",
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
runTime.timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
1.0 - beta*(T - TRef)
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,23 @@
|
|||||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rUA, U, phi);
|
+ fvc::ddtPhiCorr(rUA, U, phi);
|
||||||
|
|
||||||
surfaceScalarField buoyancyPhi =
|
surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf();
|
||||||
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
phi -= buoyancyPhi;
|
||||||
phi += buoyancyPhi;
|
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rUAf, p) == fvc::div(phi)
|
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.solve
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
|
p_rghEqn.solve
|
||||||
(
|
(
|
||||||
mesh.solver
|
mesh.solver
|
||||||
(
|
(
|
||||||
p.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
finalIter
|
||||||
@ -36,17 +37,30 @@
|
|||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
// Calculate the conservative fluxes
|
// Calculate the conservative fluxes
|
||||||
phi -= pEqn.flux();
|
phi -= p_rghEqn.flux();
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector
|
// Explicitly relax pressure for momentum corrector
|
||||||
p.relax();
|
p_rgh.relax();
|
||||||
|
|
||||||
// Correct the momentum source with the pressure gradient flux
|
// Correct the momentum source with the pressure gradient flux
|
||||||
// calculated from the relaxed pressure
|
// calculated from the relaxed pressure
|
||||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
|
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
p = p_rgh + rhok*gh;
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
|
{
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
|
);
|
||||||
|
p_rgh = p - rhok*gh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,29 +96,23 @@
|
|||||||
p_rgh + rhok*gh
|
p_rgh + rhok*gh
|
||||||
);
|
);
|
||||||
|
|
||||||
label p_rghRefCell = 0;
|
label pRefCell = 0;
|
||||||
scalar p_rghRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell
|
setRefCell
|
||||||
(
|
(
|
||||||
|
p,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
mesh.solutionDict().subDict("SIMPLE"),
|
mesh.solutionDict().subDict("SIMPLE"),
|
||||||
p_rghRefCell,
|
pRefCell,
|
||||||
p_rghRefValue
|
pRefValue
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar pRefValue = 0.0;
|
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
if (p_rgh.needReference())
|
||||||
{
|
{
|
||||||
pRefValue = readScalar
|
|
||||||
(
|
|
||||||
mesh.solutionDict().subDict("SIMPLE").lookup("pRefValue")
|
|
||||||
);
|
|
||||||
|
|
||||||
p += dimensionedScalar
|
p += dimensionedScalar
|
||||||
(
|
(
|
||||||
"p",
|
"p",
|
||||||
p.dimensions(),
|
p.dimensions(),
|
||||||
pRefValue - getRefCellValue(p, p_rghRefCell)
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,17 +18,9 @@
|
|||||||
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
// retain the residual from the first iteration
|
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p_rghEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -55,7 +47,8 @@
|
|||||||
(
|
(
|
||||||
"p",
|
"p",
|
||||||
p.dimensions(),
|
p.dimensions(),
|
||||||
pRefValue - getRefCellValue(p, p_rghRefCell)
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
);
|
);
|
||||||
|
p_rgh = p - rhok*gh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,11 @@
|
|||||||
==
|
==
|
||||||
fvc::reconstruct
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
(
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
- ghf*fvc::snGrad(rho)
|
||||||
)
|
- fvc::snGrad(p_rgh)
|
||||||
|
)*mesh.magSf()
|
||||||
|
),
|
||||||
|
mesh.solver(U.select(finalIter))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|||||||
@ -53,15 +53,30 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
|
volScalarField p_rgh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p_rgh",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force p_rgh to be consistent with p
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
|
|
||||||
Info<< "Creating field DpDt\n" << endl;
|
Info<< "Creating field DpDt\n" << endl;
|
||||||
volScalarField DpDt
|
volScalarField DpDt
|
||||||
(
|
(
|
||||||
"DpDt",
|
"DpDt",
|
||||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||||
);
|
);
|
||||||
|
|
||||||
thermo.correct();
|
|
||||||
|
|
||||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
|
||||||
|
|
||||||
dimensionedScalar totalVolume = sum(mesh.V());
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
hEqn.solve();
|
hEqn.solve(mesh.solver(h.select(finalIter)));
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
{
|
{
|
||||||
bool closedVolume = p.needReference();
|
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
// Thermodynamic density needs to be updated by psi*d(p) after the
|
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||||
// pressure solution - done in 2 parts. Part 1:
|
// pressure solution - done in 2 parts. Part 1:
|
||||||
thermo.rho() -= psi*p;
|
thermo.rho() -= psi*p_rgh;
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn.A();
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
||||||
@ -18,24 +16,23 @@
|
|||||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
surfaceScalarField buoyancyPhi =
|
surfaceScalarField buoyancyPhi = -rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||||
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
|
||||||
phi += buoyancyPhi;
|
phi += buoyancyPhi;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p))
|
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||||
+ fvc::div(phi)
|
+ fvc::div(phi)
|
||||||
- fvm::laplacian(rhorUAf, p)
|
- fvm::laplacian(rhorUAf, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.solve
|
p_rghEqn.solve
|
||||||
(
|
(
|
||||||
mesh.solver
|
mesh.solver
|
||||||
(
|
(
|
||||||
p.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
finalIter
|
||||||
@ -49,34 +46,25 @@
|
|||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
// Calculate the conservative fluxes
|
// Calculate the conservative fluxes
|
||||||
phi += pEqn.flux();
|
phi += p_rghEqn.flux();
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector
|
// Explicitly relax pressure for momentum corrector
|
||||||
p.relax();
|
p_rgh.relax();
|
||||||
|
|
||||||
// Correct the momentum source with the pressure gradient flux
|
// Correct the momentum source with the pressure gradient flux
|
||||||
// calculated from the relaxed pressure
|
// calculated from the relaxed pressure
|
||||||
U += rUA*fvc::reconstruct((buoyancyPhi + pEqn.flux())/rhorUAf);
|
U += rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p = p_rgh + rho*gh;
|
||||||
|
|
||||||
// Second part of thermodynamic density update
|
// Second part of thermodynamic density update
|
||||||
thermo.rho() += psi*p;
|
thermo.rho() += psi*p_rgh;
|
||||||
|
|
||||||
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"
|
||||||
#include "compressibleContinuityErrs.H"
|
#include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
// 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);
|
|
||||||
thermo.rho() = psi*p;
|
|
||||||
rho += (initialMass - fvc::domainIntegrate(rho))/totalVolume;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,11 +62,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "hEqn.H"
|
#include "hEqn.H"
|
||||||
for (int i=0; i<3; i++)
|
|
||||||
{
|
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
|
|||||||
@ -23,20 +23,6 @@
|
|||||||
volScalarField& h = thermo.h();
|
volScalarField& h = thermo.h();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
Info<< "Reading field p_rgh\n" << endl;
|
|
||||||
volScalarField p_rgh
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"p_rgh",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Reading field U\n" << endl;
|
Info<< "Reading field U\n" << endl;
|
||||||
volVectorField U
|
volVectorField U
|
||||||
(
|
(
|
||||||
@ -53,7 +39,6 @@
|
|||||||
|
|
||||||
#include "compressibleCreatePhi.H"
|
#include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
|
|
||||||
Info<< "Creating turbulence model\n" << endl;
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
autoPtr<compressible::RASModel> turbulence
|
autoPtr<compressible::RASModel> turbulence
|
||||||
(
|
(
|
||||||
@ -66,40 +51,39 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Info<< "Calculating field g.h\n" << endl;
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
volScalarField gh("gh", g & mesh.C());
|
volScalarField gh("gh", g & mesh.C());
|
||||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
p = p_rgh + rho*gh;
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
thermo.correct();
|
volScalarField p_rgh
|
||||||
rho = thermo.rho();
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p_rgh",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force p_rgh to be consistent with p
|
||||||
p_rgh = p - rho*gh;
|
p_rgh = p - rho*gh;
|
||||||
|
|
||||||
label p_rghRefCell = 0;
|
|
||||||
scalar p_rghRefValue = 0.0;
|
label pRefCell = 0;
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
setRefCell
|
setRefCell
|
||||||
(
|
(
|
||||||
|
p,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
mesh.solutionDict().subDict("SIMPLE"),
|
mesh.solutionDict().subDict("SIMPLE"),
|
||||||
p_rghRefCell,
|
pRefCell,
|
||||||
p_rghRefValue
|
pRefValue
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar pRefValue = 0.0;
|
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
|
||||||
{
|
|
||||||
pRefValue = readScalar
|
|
||||||
(
|
|
||||||
mesh.solutionDict().subDict("SIMPLE").lookup("pRefValue")
|
|
||||||
);
|
|
||||||
|
|
||||||
p += dimensionedScalar
|
|
||||||
(
|
|
||||||
"p",
|
|
||||||
p.dimensions(),
|
|
||||||
pRefValue - getRefCellValue(p, p_rghRefCell)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||||
|
dimensionedScalar totalVolume = sum(mesh.V());
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn().A();
|
volScalarField rUA = 1.0/UEqn().A();
|
||||||
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
||||||
|
|
||||||
U = rUA*UEqn().H();
|
U = rUA*UEqn().H();
|
||||||
//UEqn.clear();
|
UEqn.clear();
|
||||||
|
|
||||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||||
bool closedVolume = adjustPhi(phi, U, p_rgh);
|
bool closedVolume = adjustPhi(phi, U, p_rgh);
|
||||||
@ -20,7 +21,7 @@
|
|||||||
fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
@ -42,13 +43,13 @@
|
|||||||
|
|
||||||
p = p_rgh + rho*gh;
|
p = p_rgh + rho*gh;
|
||||||
|
|
||||||
// For closed-volume cases adjust the pressure and density levels
|
// For closed-volume cases adjust the pressure level
|
||||||
// to obey overall mass continuity
|
// to obey overall mass continuity
|
||||||
if (closedVolume)
|
if (closedVolume)
|
||||||
{
|
{
|
||||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||||
/fvc::domainIntegrate(psi);
|
/fvc::domainIntegrate(psi);
|
||||||
p_rgh == p - rho*gh;
|
p_rgh = p - rho*gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "readSIMPLEControls.H"
|
#include "readSIMPLEControls.H"
|
||||||
|
|
||||||
p.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
rho.storePrevIter();
|
rho.storePrevIter();
|
||||||
|
|
||||||
// Pressure-velocity SIMPLE corrector
|
// Pressure-velocity SIMPLE corrector
|
||||||
|
|||||||
@ -93,6 +93,8 @@ 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;
|
||||||
|
|
||||||
forAll(fluidRegions, i)
|
forAll(fluidRegions, i)
|
||||||
{
|
{
|
||||||
Info<< "\nSolving for fluid region "
|
Info<< "\nSolving for fluid region "
|
||||||
|
|||||||
@ -13,7 +13,9 @@
|
|||||||
==
|
==
|
||||||
fvc::reconstruct
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
(
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
- ghf*fvc::snGrad(rho)
|
||||||
|
- fvc::snGrad(p_rgh)
|
||||||
|
)*mesh.magSf()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,12 +6,16 @@
|
|||||||
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
||||||
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
||||||
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
||||||
PtrList<volScalarField> DpDtf(fluidRegions.size());
|
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
||||||
|
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
||||||
|
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
||||||
|
|
||||||
List<scalar> initialMassFluid(fluidRegions.size());
|
List<scalar> initialMassFluid(fluidRegions.size());
|
||||||
List<label> pRefCellFluid(fluidRegions.size(),0);
|
List<label> pRefCellFluid(fluidRegions.size(),0);
|
||||||
List<scalar> pRefValueFluid(fluidRegions.size(),0.0);
|
List<scalar> pRefValueFluid(fluidRegions.size(),0.0);
|
||||||
|
|
||||||
|
PtrList<dimensionedScalar> rhoMax(fluidRegions.size());
|
||||||
|
PtrList<dimensionedScalar> rhoMin(fluidRegions.size());
|
||||||
|
|
||||||
// Populate fluid field pointer lists
|
// Populate fluid field pointer lists
|
||||||
forAll(fluidRegions, i)
|
forAll(fluidRegions, i)
|
||||||
@ -130,15 +134,74 @@
|
|||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< " Adding to ghFluid\n" << endl;
|
||||||
|
ghFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Adding to ghfFluid\n" << endl;
|
||||||
|
ghfFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p_rgh",
|
||||||
|
runTime.timeName(),
|
||||||
|
fluidRegions[i],
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
fluidRegions[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force p_rgh to be consistent with p
|
||||||
|
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
||||||
|
|
||||||
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
||||||
|
|
||||||
setRefCell
|
setRefCell
|
||||||
(
|
(
|
||||||
thermoFluid[i].p(),
|
thermoFluid[i].p(),
|
||||||
|
p_rghFluid[i],
|
||||||
fluidRegions[i].solutionDict().subDict("SIMPLE"),
|
fluidRegions[i].solutionDict().subDict("SIMPLE"),
|
||||||
pRefCellFluid[i],
|
pRefCellFluid[i],
|
||||||
pRefValueFluid[i]
|
pRefValueFluid[i]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
rhoMax.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new dimensionedScalar
|
||||||
|
(
|
||||||
|
fluidRegions[i].solutionDict().subDict("SIMPLE").lookup
|
||||||
|
(
|
||||||
|
"rhoMax"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
rhoMin.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new dimensionedScalar
|
||||||
|
(
|
||||||
|
fluidRegions[i].solutionDict().subDict("SIMPLE").lookup
|
||||||
|
(
|
||||||
|
"rhoMin"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
- fvm::Sp(fvc::div(phi), h)
|
- fvm::Sp(fvc::div(phi), h)
|
||||||
- fvm::laplacian(turb.alphaEff(), h)
|
- fvm::laplacian(turb.alphaEff(), h)
|
||||||
==
|
==
|
||||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(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))
|
||||||
);
|
);
|
||||||
|
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
// From buoyantSimpleFoam
|
// From buoyantSimpleFoam
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
rho = max(rho, rhoMin[i]);
|
||||||
|
rho = min(rho, rhoMax[i]);
|
||||||
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn().A();
|
volScalarField rUA = 1.0/UEqn().A();
|
||||||
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
||||||
@ -10,59 +12,54 @@
|
|||||||
UEqn.clear();
|
UEqn.clear();
|
||||||
|
|
||||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||||
bool closedVolume = adjustPhi(phi, U, p);
|
bool closedVolume = adjustPhi(phi, U, p_rgh);
|
||||||
|
|
||||||
surfaceScalarField buoyancyPhi =
|
surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||||
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
phi -= buoyancyPhi;
|
||||||
phi += buoyancyPhi;
|
|
||||||
|
|
||||||
// Solve pressure
|
// Solve pressure
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rhorUAf, p) == fvc::div(phi)
|
fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
// retain the residual from the first iteration
|
p_rghEqn.solve();
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
// For closed-volume cases adjust the pressure and density levels
|
// Calculate the conservative fluxes
|
||||||
|
phi -= p_rghEqn.flux();
|
||||||
|
|
||||||
|
// Explicitly relax pressure for momentum corrector
|
||||||
|
p_rgh.relax();
|
||||||
|
|
||||||
|
// Correct the momentum source with the pressure gradient flux
|
||||||
|
// calculated from the relaxed pressure
|
||||||
|
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p = p_rgh + rho*gh;
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
// For closed-volume cases adjust the pressure level
|
||||||
// to obey overall mass continuity
|
// to obey overall mass continuity
|
||||||
if (closedVolume)
|
if (closedVolume)
|
||||||
{
|
{
|
||||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||||
/fvc::domainIntegrate(psi);
|
/fvc::domainIntegrate(psi);
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the conservative fluxes
|
|
||||||
phi -= pEqn.flux();
|
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector
|
|
||||||
p.relax();
|
|
||||||
|
|
||||||
// Correct the momentum source with the pressure gradient flux
|
|
||||||
// calculated from the relaxed pressure
|
|
||||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
rho = max(rho, rhoMin[i]);
|
||||||
|
rho = min(rho, rhoMax[i]);
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
Info<< "Min/max rho:" << min(rho).value() << ' '
|
Info<< "Min/max rho:" << min(rho).value() << ' '
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
volScalarField& K = KFluid[i];
|
volScalarField& K = KFluid[i];
|
||||||
volVectorField& U = UFluid[i];
|
volVectorField& U = UFluid[i];
|
||||||
surfaceScalarField& phi = phiFluid[i];
|
surfaceScalarField& phi = phiFluid[i];
|
||||||
const dimensionedVector& g = gFluid[i];
|
|
||||||
|
|
||||||
compressible::turbulenceModel& turb = turbulence[i];
|
compressible::turbulenceModel& turb = turbulence[i];
|
||||||
|
|
||||||
@ -22,3 +21,7 @@
|
|||||||
|
|
||||||
const label pRefCell = pRefCellFluid[i];
|
const label pRefCell = pRefCellFluid[i];
|
||||||
const scalar pRefValue = pRefValueFluid[i];
|
const scalar pRefValue = pRefValueFluid[i];
|
||||||
|
|
||||||
|
volScalarField& p_rgh = p_rghFluid[i];
|
||||||
|
const volScalarField& gh = ghFluid[i];
|
||||||
|
const surfaceScalarField& ghf = ghfFluid[i];
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Pressure-velocity SIMPLE corrector
|
// Pressure-velocity SIMPLE corrector
|
||||||
|
|
||||||
p.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
rho.storePrevIter();
|
rho.storePrevIter();
|
||||||
{
|
{
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|||||||
@ -16,8 +16,11 @@
|
|||||||
==
|
==
|
||||||
fvc::reconstruct
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
(
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
- ghf*fvc::snGrad(rho)
|
||||||
)
|
- fvc::snGrad(p_rgh)
|
||||||
|
)*mesh.magSf()
|
||||||
|
),
|
||||||
|
mesh.solver(U.select(finalIter))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
||||||
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
||||||
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
||||||
|
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
||||||
|
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
||||||
|
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
||||||
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
|
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
|
||||||
|
|
||||||
List<scalar> initialMassFluid(fluidRegions.size());
|
List<scalar> initialMassFluid(fluidRegions.size());
|
||||||
@ -129,6 +132,42 @@
|
|||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< " Adding to ghFluid\n" << endl;
|
||||||
|
ghFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Adding to ghfFluid\n" << endl;
|
||||||
|
ghfFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghFluid.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p_rgh",
|
||||||
|
runTime.timeName(),
|
||||||
|
fluidRegions[i],
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
fluidRegions[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force p_rgh to be consistent with p
|
||||||
|
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
||||||
|
|
||||||
|
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
||||||
|
|
||||||
Info<< " Adding to DpDtFluid\n" << endl;
|
Info<< " Adding to DpDtFluid\n" << endl;
|
||||||
DpDtFluid.set
|
DpDtFluid.set
|
||||||
(
|
(
|
||||||
@ -147,6 +186,4 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,16 +7,9 @@
|
|||||||
==
|
==
|
||||||
DpDt
|
DpDt
|
||||||
);
|
);
|
||||||
if (oCorr == nOuterCorr-1)
|
|
||||||
{
|
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
hEqn.solve(mesh.solver("hFinal"));
|
hEqn.solve(mesh.solver(h.select(finalIter)));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hEqn.relax();
|
|
||||||
hEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
bool closedVolume = p.needReference();
|
bool closedVolume = p_rgh.needReference();
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
@ -17,34 +17,35 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rhorUAf;
|
phi = phiU - rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(psi, p)
|
fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh
|
||||||
+ fvc::div(phi)
|
+ fvc::div(phi)
|
||||||
- fvm::laplacian(rhorUAf, p)
|
- fvm::laplacian(rhorUAf, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
p_rghEqn.solve
|
||||||
|
(
|
||||||
|
mesh.solver
|
||||||
|
(
|
||||||
|
p_rgh.select
|
||||||
|
(
|
||||||
(
|
(
|
||||||
oCorr == nOuterCorr-1
|
oCorr == nOuterCorr-1
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
{
|
)
|
||||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
)
|
||||||
}
|
);
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve(mesh.solver(p.name()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
phi += pEqn.flux();
|
phi += p_rghEqn.flux();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,8 @@
|
|||||||
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
|
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
|
|
||||||
|
p = p_rgh + rho*gh;
|
||||||
|
|
||||||
// Update pressure substantive derivative
|
// Update pressure substantive derivative
|
||||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||||
|
|
||||||
@ -65,9 +68,10 @@
|
|||||||
// to obey overall mass continuity
|
// to obey overall mass continuity
|
||||||
if (closedVolume)
|
if (closedVolume)
|
||||||
{
|
{
|
||||||
p += (massIni - fvc::domainIntegrate(psi*p))
|
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||||
/fvc::domainIntegrate(psi);
|
/fvc::domainIntegrate(psi);
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update thermal conductivity
|
// Update thermal conductivity
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
const dictionary& piso = fluidRegions[i].solutionDict().subDict("PISO");
|
|
||||||
|
|
||||||
const int nOuterCorr =
|
|
||||||
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
|
|
||||||
|
|
||||||
const int nCorr =
|
|
||||||
piso.lookupOrDefault<int>("nCorrectors", 1);
|
|
||||||
|
|
||||||
const int nNonOrthCorr =
|
|
||||||
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
|
||||||
|
|
||||||
const bool momentumPredictor =
|
|
||||||
piso.lookupOrDefault("momentumPredictor", true);
|
|
||||||
|
|
||||||
const bool transonic =
|
|
||||||
piso.lookupOrDefault("transonic", false);
|
|
||||||
|
|
||||||
@ -1,11 +1,10 @@
|
|||||||
const fvMesh& mesh = fluidRegions[i];
|
fvMesh& mesh = fluidRegions[i];
|
||||||
|
|
||||||
basicPsiThermo& thermo = thermoFluid[i];
|
basicPsiThermo& thermo = thermoFluid[i];
|
||||||
volScalarField& rho = rhoFluid[i];
|
volScalarField& rho = rhoFluid[i];
|
||||||
volScalarField& K = KFluid[i];
|
volScalarField& K = KFluid[i];
|
||||||
volVectorField& U = UFluid[i];
|
volVectorField& U = UFluid[i];
|
||||||
surfaceScalarField& phi = phiFluid[i];
|
surfaceScalarField& phi = phiFluid[i];
|
||||||
const dimensionedVector& g = gFluid[i];
|
|
||||||
|
|
||||||
compressible::turbulenceModel& turb = turbulence[i];
|
compressible::turbulenceModel& turb = turbulence[i];
|
||||||
volScalarField& DpDt = DpDtFluid[i];
|
volScalarField& DpDt = DpDtFluid[i];
|
||||||
@ -14,4 +13,13 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
volScalarField& h = thermo.h();
|
volScalarField& h = thermo.h();
|
||||||
|
|
||||||
const dimensionedScalar massIni("massIni", dimMass, initialMassFluid[i]);
|
volScalarField& p_rgh = p_rghFluid[i];
|
||||||
|
const volScalarField& gh = ghFluid[i];
|
||||||
|
const surfaceScalarField& ghf = ghfFluid[i];
|
||||||
|
|
||||||
|
const dimensionedScalar initialMass
|
||||||
|
(
|
||||||
|
"initialMass",
|
||||||
|
dimMass,
|
||||||
|
initialMassFluid[i]
|
||||||
|
);
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::add("finalIteration", true);
|
||||||
|
}
|
||||||
|
|
||||||
if (oCorr == 0)
|
if (oCorr == 0)
|
||||||
{
|
{
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
@ -16,3 +21,8 @@ for (int corr=0; corr<nCorr; corr++)
|
|||||||
turb.correct();
|
turb.correct();
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
p.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
rho.storePrevIter();
|
rho.storePrevIter();
|
||||||
|
|||||||
@ -8,9 +8,5 @@
|
|||||||
<< solidRegions[i].name() << nl << endl;
|
<< solidRegions[i].name() << nl << endl;
|
||||||
|
|
||||||
Info<< " Adding to thermos\n" << endl;
|
Info<< " Adding to thermos\n" << endl;
|
||||||
thermos.set
|
thermos.set(i, basicSolidThermo::New(solidRegions[i]));
|
||||||
(
|
|
||||||
i,
|
|
||||||
basicSolidThermo::New(solidRegions[i])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::add("finalIteration", true);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
@ -7,8 +12,13 @@
|
|||||||
- fvm::laplacian(K, T)
|
- fvm::laplacian(K, T)
|
||||||
);
|
);
|
||||||
TEqn().relax();
|
TEqn().relax();
|
||||||
TEqn().solve();
|
TEqn().solve(mesh.solver(T.select(finalIter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
|
|||||||
@ -13,5 +13,5 @@
|
|||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
solve(UEqn == -fvc::grad(p));
|
solve(UEqn == -fvc::grad(p), mesh.solver(U.select(finalIter)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,17 +90,28 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- PIMPLE loop
|
||||||
for (int ocorr=1; 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 "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "hsEqn.H"
|
#include "hsEqn.H"
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
for (int corr=1; corr<=nCorr; corr++)
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
mesh.data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
hsEqn.relax();
|
hsEqn.relax();
|
||||||
|
|
||||||
hsEqn.solve();
|
hsEqn.solve(mesh.solver(hs.select(finalIter)));
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,20 @@ if (transonic)
|
|||||||
coalParcels.Srho()
|
coalParcels.Srho()
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve
|
||||||
|
(
|
||||||
|
mesh.solver
|
||||||
|
(
|
||||||
|
p.select
|
||||||
|
(
|
||||||
|
(
|
||||||
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -54,7 +67,20 @@ else
|
|||||||
coalParcels.Srho()
|
coalParcels.Srho()
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve
|
||||||
|
(
|
||||||
|
mesh.solver
|
||||||
|
(
|
||||||
|
p.select
|
||||||
|
(
|
||||||
|
(
|
||||||
|
finalIter
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,7 +20,8 @@ The disadvantages:
|
|||||||
- a patch-wise loop now might need to store data to go to the neighbour half
|
- a patch-wise loop now might need to store data to go to the neighbour half
|
||||||
since it is no longer handled in a single patch.
|
since it is no longer handled in a single patch.
|
||||||
- decomposed cyclics now require overlapping communications so will
|
- decomposed cyclics now require overlapping communications so will
|
||||||
only work in non-blocking mode. Hence the underlying message passing library
|
only work in 'nonBlocking' mode or 'blocking' (=buffered) mode but not
|
||||||
|
in 'scheduled' mode. The underlying message passing library
|
||||||
will require overlapping communications with message tags.
|
will require overlapping communications with message tags.
|
||||||
- it is quite a code-change and there might be some oversights.
|
- it is quite a code-change and there might be some oversights.
|
||||||
- once converted (see foamUpgradeCyclics below) cases are not backwards
|
- once converted (see foamUpgradeCyclics below) cases are not backwards
|
||||||
@ -103,19 +104,14 @@ type 'processorCyclic'.
|
|||||||
|
|
||||||
|
|
||||||
- processor patches use overlapping communication using a different message
|
- processor patches use overlapping communication using a different message
|
||||||
tag. This maps straight through into the MPI message tag.
|
tag. This maps straight through into the MPI message tag. Each processor
|
||||||
See processorCyclicPolyPatch::tag(). This needs to be calculated the
|
'interface' (processorPolyPatch, processorFvPatch, etc.) has a 'tag()'
|
||||||
same on both sides so is calculated as
|
to use for communication.
|
||||||
Pstream::nProcs()*max(myProcNo, neighbProcNo)
|
|
||||||
+ min(myProcNo, neighbProcNo)
|
|
||||||
which is
|
|
||||||
- unique
|
|
||||||
- commutative
|
|
||||||
- does not interfere with the default tag (= 1)
|
|
||||||
|
|
||||||
|
|
||||||
- when constructing a GeometricField from a dictionary it will explicitly
|
- when constructing a GeometricField from a dictionary it will explicitly
|
||||||
check for non-existing entries for cyclic patches and exit with an error message
|
check for non-existing entries for cyclic patches and exit with an error message
|
||||||
warning to run foamUpgradeCyclics.
|
warning to run foamUpgradeCyclics. (1.7.x will check if you are trying
|
||||||
|
to run a case which has split cyclics)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -296,6 +296,7 @@ primitiveShapes = meshes/primitiveShapes
|
|||||||
$(primitiveShapes)/line/line.C
|
$(primitiveShapes)/line/line.C
|
||||||
$(primitiveShapes)/plane/plane.C
|
$(primitiveShapes)/plane/plane.C
|
||||||
$(primitiveShapes)/triangle/intersection.C
|
$(primitiveShapes)/triangle/intersection.C
|
||||||
|
$(primitiveShapes)/objectHit/pointIndexHitIOList.C
|
||||||
|
|
||||||
meshShapes = meshes/meshShapes
|
meshShapes = meshes/meshShapes
|
||||||
$(meshShapes)/edge/edge.C
|
$(meshShapes)/edge/edge.C
|
||||||
|
|||||||
@ -126,6 +126,14 @@ class face
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Return types for classify
|
||||||
|
enum proxType
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
POINT, // Close to point
|
||||||
|
EDGE // Close to edge
|
||||||
|
};
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
static const char* const typeName;
|
static const char* const typeName;
|
||||||
@ -249,6 +257,20 @@ public:
|
|||||||
const pointField& meshPoints
|
const pointField& meshPoints
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return nearest point to face and classify it:
|
||||||
|
// + near point (nearType=POINT, nearLabel=0, 1, 2)
|
||||||
|
// + near edge (nearType=EDGE, nearLabel=0, 1, 2)
|
||||||
|
// Note: edges are counted from starting vertex so
|
||||||
|
// e.g. edge n is from f[n] to f[0], where the face has n + 1
|
||||||
|
// points
|
||||||
|
pointHit nearestPointClassify
|
||||||
|
(
|
||||||
|
const point& p,
|
||||||
|
const pointField& meshPoints,
|
||||||
|
label& nearType,
|
||||||
|
label& nearLabel
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Return contact sphere diameter
|
//- Return contact sphere diameter
|
||||||
scalar contactSphereDiameter
|
scalar contactSphereDiameter
|
||||||
(
|
(
|
||||||
|
|||||||
@ -181,6 +181,22 @@ Foam::pointHit Foam::face::nearestPoint
|
|||||||
const point& p,
|
const point& p,
|
||||||
const pointField& meshPoints
|
const pointField& meshPoints
|
||||||
) const
|
) const
|
||||||
|
{
|
||||||
|
// Dummy labels
|
||||||
|
label nearType = -1;
|
||||||
|
label nearLabel = -1;
|
||||||
|
|
||||||
|
return nearestPointClassify(p, meshPoints, nearType, nearLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointHit Foam::face::nearestPointClassify
|
||||||
|
(
|
||||||
|
const point& p,
|
||||||
|
const pointField& meshPoints,
|
||||||
|
label& nearType,
|
||||||
|
label& nearLabel
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
const face& f = *this;
|
const face& f = *this;
|
||||||
point ctr = centre(meshPoints);
|
point ctr = centre(meshPoints);
|
||||||
@ -188,6 +204,9 @@ Foam::pointHit Foam::face::nearestPoint
|
|||||||
// Initialize to miss, distance=GREAT
|
// Initialize to miss, distance=GREAT
|
||||||
pointHit nearest(p);
|
pointHit nearest(p);
|
||||||
|
|
||||||
|
nearType = -1;
|
||||||
|
nearLabel = -1;
|
||||||
|
|
||||||
label nPoints = f.size();
|
label nPoints = f.size();
|
||||||
|
|
||||||
point nextPoint = ctr;
|
point nextPoint = ctr;
|
||||||
@ -196,8 +215,10 @@ Foam::pointHit Foam::face::nearestPoint
|
|||||||
{
|
{
|
||||||
nextPoint = meshPoints[f[fcIndex(pI)]];
|
nextPoint = meshPoints[f[fcIndex(pI)]];
|
||||||
|
|
||||||
|
label tmpNearType = -1;
|
||||||
|
label tmpNearLabel = -1;
|
||||||
|
|
||||||
// Note: for best accuracy, centre point always comes last
|
// Note: for best accuracy, centre point always comes last
|
||||||
//
|
|
||||||
triPointRef tri
|
triPointRef tri
|
||||||
(
|
(
|
||||||
meshPoints[f[pI]],
|
meshPoints[f[pI]],
|
||||||
@ -205,12 +226,42 @@ Foam::pointHit Foam::face::nearestPoint
|
|||||||
ctr
|
ctr
|
||||||
);
|
);
|
||||||
|
|
||||||
pointHit curHit = tri.nearestPoint(p);
|
pointHit curHit = tri.nearestPointClassify
|
||||||
|
(
|
||||||
|
p,
|
||||||
|
tmpNearType,
|
||||||
|
tmpNearLabel
|
||||||
|
);
|
||||||
|
|
||||||
if (Foam::mag(curHit.distance()) < Foam::mag(nearest.distance()))
|
if (Foam::mag(curHit.distance()) < Foam::mag(nearest.distance()))
|
||||||
{
|
{
|
||||||
nearest.setDistance(curHit.distance());
|
nearest.setDistance(curHit.distance());
|
||||||
|
|
||||||
|
// Assume at first that the near type is NONE on the
|
||||||
|
// triangle (i.e. on the face of the triangle) then it is
|
||||||
|
// therefore also for the face.
|
||||||
|
|
||||||
|
nearType = NONE;
|
||||||
|
|
||||||
|
if (tmpNearType == triPointRef::EDGE && tmpNearLabel == 0)
|
||||||
|
{
|
||||||
|
// If the triangle edge label is 0, then this is also
|
||||||
|
// an edge of the face, if not, it is on the face
|
||||||
|
|
||||||
|
nearType = EDGE;
|
||||||
|
|
||||||
|
nearLabel = pI;
|
||||||
|
}
|
||||||
|
else if (tmpNearType == triPointRef::POINT && tmpNearLabel < 2)
|
||||||
|
{
|
||||||
|
// If the triangle point label is 0 or 1, then this is
|
||||||
|
// also a point of the face, if not, it is on the face
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
|
||||||
|
nearLabel = pI + tmpNearLabel;
|
||||||
|
}
|
||||||
|
|
||||||
if (curHit.hit())
|
if (curHit.hit())
|
||||||
{
|
{
|
||||||
nearest.setHit();
|
nearest.setHit();
|
||||||
|
|||||||
@ -79,21 +79,6 @@ class triangle
|
|||||||
|
|
||||||
PointRef a_, b_, c_;
|
PointRef a_, b_, c_;
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Fast distance to triangle calculation. From
|
|
||||||
// "Distance Between Point and Trangle in 3D"
|
|
||||||
// David Eberly, Magic Software Inc. Aug. 2002.
|
|
||||||
// Works on function Q giving distance to point and tries to
|
|
||||||
// minimize this.
|
|
||||||
static pointHit nearestPoint
|
|
||||||
(
|
|
||||||
const Point& baseVertex,
|
|
||||||
const vector& E0,
|
|
||||||
const vector& E1,
|
|
||||||
const point& P
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -202,24 +187,27 @@ public:
|
|||||||
const scalar tol = 0.0
|
const scalar tol = 0.0
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return nearest point to p on triangle
|
//- Find the nearest point to p on the triangle and classify it:
|
||||||
inline pointHit nearestPoint
|
// + near point (nearType=POINT, nearLabel=0, 1, 2)
|
||||||
(
|
// + near edge (nearType=EDGE, nearLabel=0, 1, 2)
|
||||||
const point& p
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Classify point in triangle plane w.r.t. triangle edges.
|
|
||||||
// - inside (true returned)/outside (false returned)
|
|
||||||
// - near point (nearType=POINT, nearLabel=0, 1, 2)
|
|
||||||
// - near edge (nearType=EDGE, nearLabel=0, 1, 2)
|
|
||||||
// Note: edges are counted from starting
|
// Note: edges are counted from starting
|
||||||
// vertex so e.g. edge 2 is from f[2] to f[0]
|
// vertex so e.g. edge 2 is from f[2] to f[0]
|
||||||
// tol is fraction to account for truncation error. Is only used
|
pointHit nearestPointClassify
|
||||||
// when comparing normalized (0..1) numbers.
|
(
|
||||||
|
const point& p,
|
||||||
|
label& nearType,
|
||||||
|
label& nearLabel
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return nearest point to p on triangle
|
||||||
|
inline pointHit nearestPoint(const point& p) const;
|
||||||
|
|
||||||
|
//- Classify nearest point to p in triangle plane
|
||||||
|
// w.r.t. triangle edges and points. Returns inside
|
||||||
|
// (true)/outside (false).
|
||||||
bool classify
|
bool classify
|
||||||
(
|
(
|
||||||
const point& p,
|
const point& p,
|
||||||
const scalar tol,
|
|
||||||
label& nearType,
|
label& nearType,
|
||||||
label& nearLabel
|
label& nearLabel
|
||||||
) const;
|
) const;
|
||||||
|
|||||||
@ -32,158 +32,6 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
|
||||||
pointHit triangle<Point, PointRef>::nearestPoint
|
|
||||||
(
|
|
||||||
const Point& baseVertex,
|
|
||||||
const vector& E0,
|
|
||||||
const vector& E1,
|
|
||||||
const point& P
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Distance vector
|
|
||||||
const vector D(baseVertex - P);
|
|
||||||
|
|
||||||
// Some geometrical factors
|
|
||||||
const scalar a = E0 & E0;
|
|
||||||
const scalar b = E0 & E1;
|
|
||||||
const scalar c = E1 & E1;
|
|
||||||
|
|
||||||
// Precalculate distance factors
|
|
||||||
const scalar d = E0 & D;
|
|
||||||
const scalar e = E1 & D;
|
|
||||||
const scalar f = D & D;
|
|
||||||
|
|
||||||
// Do classification
|
|
||||||
const scalar det = a*c - b*b;
|
|
||||||
scalar s = b*e - c*d;
|
|
||||||
scalar t = b*d - a*e;
|
|
||||||
|
|
||||||
bool inside = false;
|
|
||||||
|
|
||||||
if (s+t < det)
|
|
||||||
{
|
|
||||||
if (s < 0)
|
|
||||||
{
|
|
||||||
if (t < 0)
|
|
||||||
{
|
|
||||||
// Region 4
|
|
||||||
if (e > 0)
|
|
||||||
{
|
|
||||||
// min on edge t = 0
|
|
||||||
t = 0;
|
|
||||||
s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// min on edge s=0
|
|
||||||
s = 0;
|
|
||||||
t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Region 3. Min on edge s = 0
|
|
||||||
s = 0;
|
|
||||||
t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (t < 0)
|
|
||||||
{
|
|
||||||
// Region 5
|
|
||||||
t = 0;
|
|
||||||
s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Region 0
|
|
||||||
const scalar invDet = 1/det;
|
|
||||||
s *= invDet;
|
|
||||||
t *= invDet;
|
|
||||||
|
|
||||||
inside = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (s < 0)
|
|
||||||
{
|
|
||||||
// Region 2
|
|
||||||
const scalar tmp0 = b + d;
|
|
||||||
const scalar tmp1 = c + e;
|
|
||||||
if (tmp1 > tmp0)
|
|
||||||
{
|
|
||||||
// min on edge s+t=1
|
|
||||||
const scalar numer = tmp1 - tmp0;
|
|
||||||
const scalar denom = a-2*b+c;
|
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
|
||||||
t = 1 - s;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// min on edge s=0
|
|
||||||
s = 0;
|
|
||||||
t = (tmp1 <= 0 ? 1 : (e >= 0 ? 0 : - e/c));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (t < 0)
|
|
||||||
{
|
|
||||||
// Region 6
|
|
||||||
const scalar tmp0 = b + d;
|
|
||||||
const scalar tmp1 = c + e;
|
|
||||||
if (tmp1 > tmp0)
|
|
||||||
{
|
|
||||||
// min on edge s+t=1
|
|
||||||
const scalar numer = tmp1 - tmp0;
|
|
||||||
const scalar denom = a-2*b+c;
|
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
|
||||||
t = 1 - s;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// min on edge t=0
|
|
||||||
t = 0;
|
|
||||||
s = (tmp1 <= 0 ? 1 : (d >= 0 ? 0 : - d/a));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Region 1
|
|
||||||
const scalar numer = c+e-(b+d);
|
|
||||||
if (numer <= 0)
|
|
||||||
{
|
|
||||||
s = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const scalar denom = a-2*b+c;
|
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t = 1 - s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate distance.
|
|
||||||
// Note: Foam::mag used since truncation error causes negative distances
|
|
||||||
// with points very close to one of the triangle vertices.
|
|
||||||
// (Up to -2.77556e-14 seen). Could use +SMALL but that not large enough.
|
|
||||||
|
|
||||||
return pointHit
|
|
||||||
(
|
|
||||||
inside,
|
|
||||||
baseVertex + s*E0 + t*E1,
|
|
||||||
Foam::sqrt
|
|
||||||
(
|
|
||||||
Foam::mag(a*s*s + 2*b*s*t + c*t*t + 2*d*s + 2*e*t + f)
|
|
||||||
),
|
|
||||||
!inside
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
@ -247,7 +95,7 @@ inline Point triangle<Point, PointRef>::centre() const
|
|||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline scalar triangle<Point, PointRef>::mag() const
|
inline scalar triangle<Point, PointRef>::mag() const
|
||||||
{
|
{
|
||||||
return ::Foam::mag(normal());
|
return Foam::mag(normal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -536,7 +384,7 @@ inline pointHit triangle<Point, PointRef>::ray
|
|||||||
inter.setMiss(eligible);
|
inter.setMiss(eligible);
|
||||||
|
|
||||||
// The miss point is the nearest point on the triangle
|
// The miss point is the nearest point on the triangle
|
||||||
inter.setPoint(nearestPoint(a_, E0, E1, p).rawPoint());
|
inter.setPoint(nearestPoint(p).rawPoint());
|
||||||
|
|
||||||
// The distance to the miss is the distance between the
|
// The distance to the miss is the distance between the
|
||||||
// original point and plane of intersection
|
// original point and plane of intersection
|
||||||
@ -633,18 +481,130 @@ inline pointHit triangle<Point, PointRef>::intersection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Point, class PointRef>
|
||||||
|
pointHit triangle<Point, PointRef>::nearestPointClassify
|
||||||
|
(
|
||||||
|
const point& p,
|
||||||
|
label& nearType,
|
||||||
|
label& nearLabel
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Adapted from:
|
||||||
|
// Real-time collision detection, Christer Ericson, 2005, 136-142
|
||||||
|
|
||||||
|
// Check if P in vertex region outside A
|
||||||
|
vector ab = b_ - a_;
|
||||||
|
vector ac = c_ - a_;
|
||||||
|
vector ap = p - a_;
|
||||||
|
|
||||||
|
scalar d1 = ab & ap;
|
||||||
|
scalar d2 = ac & ap;
|
||||||
|
|
||||||
|
if (d1 <= 0.0 && d2 <= 0.0)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1, 0, 0)
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 0;
|
||||||
|
return pointHit(false, a_, Foam::mag(a_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in vertex region outside B
|
||||||
|
vector bp = p - b_;
|
||||||
|
scalar d3 = ab & bp;
|
||||||
|
scalar d4 = ac & bp;
|
||||||
|
|
||||||
|
if (d3 >= 0.0 && d4 <= d3)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0, 1, 0)
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 1;
|
||||||
|
return pointHit(false, b_, Foam::mag(b_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of AB, if so return projection of P onto AB
|
||||||
|
scalar vc = d1*d4 - d3*d2;
|
||||||
|
|
||||||
|
if (vc <= 0.0 && d1 >= 0.0 && d3 <= 0.0)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1-v, v, 0)
|
||||||
|
scalar v = d1/(d1 - d3);
|
||||||
|
|
||||||
|
point nearPt = a_ + v*ab;
|
||||||
|
nearType = EDGE;
|
||||||
|
nearLabel = 0;
|
||||||
|
return pointHit(false, nearPt, Foam::mag(nearPt - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in vertex region outside C
|
||||||
|
vector cp = p - c_;
|
||||||
|
scalar d5 = ab & cp;
|
||||||
|
scalar d6 = ac & cp;
|
||||||
|
|
||||||
|
if (d6 >= 0.0 && d5 <= d6)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0, 0, 1)
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 2;
|
||||||
|
return pointHit(false, c_, Foam::mag(c_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of AC, if so return projection of P onto AC
|
||||||
|
scalar vb = d5*d2 - d1*d6;
|
||||||
|
|
||||||
|
if (vb <= 0.0 && d2 >= 0.0 && d6 <= 0.0)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1-w, 0, w)
|
||||||
|
scalar w = d2/(d2 - d6);
|
||||||
|
|
||||||
|
point nearPt = a_ + w*ac;
|
||||||
|
nearType = EDGE;
|
||||||
|
nearLabel = 2;
|
||||||
|
return pointHit(false, nearPt, Foam::mag(nearPt - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of BC, if so return projection of P onto BC
|
||||||
|
scalar va = d3*d6 - d5*d4;
|
||||||
|
|
||||||
|
if (va <= 0.0 && (d4 - d3) >= 0.0 && (d5 - d6) >= 0.0)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0, 1-w, w)
|
||||||
|
scalar w = (d4 - d3)/((d4 - d3) + (d5 - d6));
|
||||||
|
|
||||||
|
point nearPt = b_ + w*(c_ - b_);
|
||||||
|
nearType = EDGE;
|
||||||
|
nearLabel = 1;
|
||||||
|
return pointHit(false, nearPt, Foam::mag(nearPt - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// P inside face region. Compute Q through its barycentric
|
||||||
|
// coordinates (u, v, w)
|
||||||
|
scalar denom = 1.0/(va + vb + vc);
|
||||||
|
scalar v = vb * denom;
|
||||||
|
scalar w = vc * denom;
|
||||||
|
|
||||||
|
// = u*a + v*b + w*c, u = va*denom = 1.0 - v - w
|
||||||
|
|
||||||
|
point nearPt = a_ + ab*v + ac*w;
|
||||||
|
nearType = NONE,
|
||||||
|
nearLabel = -1;
|
||||||
|
return pointHit(true, nearPt, Foam::mag(nearPt - p), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline pointHit triangle<Point, PointRef>::nearestPoint
|
inline pointHit triangle<Point, PointRef>::nearestPoint
|
||||||
(
|
(
|
||||||
const point& p
|
const point& p
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Express triangle in terms of baseVertex (point a_) and
|
// Dummy labels
|
||||||
// two edge vectors
|
label nearType = -1;
|
||||||
vector E0 = b_ - a_;
|
label nearLabel = -1;
|
||||||
vector E1 = c_ - a_;
|
|
||||||
|
|
||||||
return nearestPoint(a_, E0, E1, p);
|
return nearestPointClassify(p, nearType, nearLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -652,160 +612,14 @@ template<class Point, class PointRef>
|
|||||||
inline bool triangle<Point, PointRef>::classify
|
inline bool triangle<Point, PointRef>::classify
|
||||||
(
|
(
|
||||||
const point& p,
|
const point& p,
|
||||||
const scalar tol,
|
|
||||||
label& nearType,
|
label& nearType,
|
||||||
label& nearLabel
|
label& nearLabel
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const vector E0 = b_ - a_;
|
return nearestPointClassify(p, nearType, nearLabel).hit();
|
||||||
const vector E1 = c_ - a_;
|
|
||||||
const vector n = 0.5*(E0 ^ E1);
|
|
||||||
|
|
||||||
// Get largest component of normal
|
|
||||||
scalar magX = Foam::mag(n.x());
|
|
||||||
scalar magY = Foam::mag(n.y());
|
|
||||||
scalar magZ = Foam::mag(n.z());
|
|
||||||
|
|
||||||
label i0 = -1;
|
|
||||||
if ((magX >= magY) && (magX >= magZ))
|
|
||||||
{
|
|
||||||
i0 = 0;
|
|
||||||
}
|
|
||||||
else if ((magY >= magX) && (magY >= magZ))
|
|
||||||
{
|
|
||||||
i0 = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i0 = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get other components
|
|
||||||
label i1 = (i0 + 1) % 3;
|
|
||||||
label i2 = (i1 + 1) % 3;
|
|
||||||
|
|
||||||
|
|
||||||
scalar u1 = E0[i1];
|
|
||||||
scalar v1 = E0[i2];
|
|
||||||
|
|
||||||
scalar u2 = E1[i1];
|
|
||||||
scalar v2 = E1[i2];
|
|
||||||
|
|
||||||
scalar det = v2*u1 - u2*v1;
|
|
||||||
|
|
||||||
scalar u0 = p[i1] - a_[i1];
|
|
||||||
scalar v0 = p[i2] - a_[i2];
|
|
||||||
|
|
||||||
scalar alpha = 0;
|
|
||||||
scalar beta = 0;
|
|
||||||
|
|
||||||
bool hit = false;
|
|
||||||
|
|
||||||
if (Foam::mag(u1) < ROOTVSMALL)
|
|
||||||
{
|
|
||||||
beta = u0/u2;
|
|
||||||
|
|
||||||
alpha = (v0 - beta*v2)/v1;
|
|
||||||
|
|
||||||
hit = ((alpha >= 0) && ((alpha + beta) <= 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
beta = (v0*u1 - u0*v1)/det;
|
|
||||||
|
|
||||||
alpha = (u0 - beta*u2)/u1;
|
|
||||||
|
|
||||||
hit = ((alpha >= 0) && ((alpha + beta) <= 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Now alpha, beta are the coordinates in the triangle local coordinate
|
|
||||||
// system E0, E1
|
|
||||||
//
|
|
||||||
|
|
||||||
//Pout<< "alpha:" << alpha << endl;
|
|
||||||
//Pout<< "beta:" << beta << endl;
|
|
||||||
//Pout<< "hit:" << hit << endl;
|
|
||||||
//Pout<< "tol:" << tol << endl;
|
|
||||||
|
|
||||||
if (hit)
|
|
||||||
{
|
|
||||||
// alpha,beta might get negative due to precision errors
|
|
||||||
alpha = max(0.0, min(1.0, alpha));
|
|
||||||
beta = max(0.0, min(1.0, beta));
|
|
||||||
}
|
|
||||||
|
|
||||||
nearType = NONE;
|
|
||||||
nearLabel = -1;
|
|
||||||
|
|
||||||
if (Foam::mag(alpha+beta-1) <= tol)
|
|
||||||
{
|
|
||||||
// On edge between vert 1-2 (=edge 1)
|
|
||||||
|
|
||||||
if (Foam::mag(alpha) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 2;
|
|
||||||
}
|
|
||||||
else if (Foam::mag(beta) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 1;
|
|
||||||
}
|
|
||||||
else if ((alpha >= 0) && (alpha <= 1) && (beta >= 0) && (beta <= 1))
|
|
||||||
{
|
|
||||||
nearType = EDGE;
|
|
||||||
nearLabel = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Foam::mag(alpha) <= tol)
|
|
||||||
{
|
|
||||||
// On edge between vert 2-0 (=edge 2)
|
|
||||||
|
|
||||||
if (Foam::mag(beta) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 0;
|
|
||||||
}
|
|
||||||
else if (Foam::mag(beta-1) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 2;
|
|
||||||
}
|
|
||||||
else if ((beta >= 0) && (beta <= 1))
|
|
||||||
{
|
|
||||||
nearType = EDGE;
|
|
||||||
nearLabel = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Foam::mag(beta) <= tol)
|
|
||||||
{
|
|
||||||
// On edge between vert 0-1 (= edge 0)
|
|
||||||
|
|
||||||
if (Foam::mag(alpha) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 0;
|
|
||||||
}
|
|
||||||
else if (Foam::mag(alpha-1) <= tol)
|
|
||||||
{
|
|
||||||
nearType = POINT;
|
|
||||||
nearLabel = 1;
|
|
||||||
}
|
|
||||||
else if ((alpha >= 0) && (alpha <= 1))
|
|
||||||
{
|
|
||||||
nearType = EDGE;
|
|
||||||
nearLabel = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class point, class pointRef>
|
template<class point, class pointRef>
|
||||||
|
|||||||
@ -112,13 +112,6 @@ directMappedVelocityFluxFixedValueFvPatchField
|
|||||||
<< " in file " << dimensionedInternalField().objectPath()
|
<< " in file " << dimensionedInternalField().objectPath()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force calculation of schedule (uses parallel comms)
|
|
||||||
const directMappedPolyPatch& mpp = refCast<const directMappedPolyPatch>
|
|
||||||
(
|
|
||||||
this->patch().patch()
|
|
||||||
);
|
|
||||||
(void)mpp.map().schedule();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,12 +42,13 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
const polyBoundaryMesh& oldPatches = mesh.boundaryMesh();
|
const polyBoundaryMesh& oldPatches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Check agglomeration within patch face range and continuous
|
// Check agglomeration within patch face range and continuous
|
||||||
labelList nAgglom(oldPatches.size());
|
labelList nAgglom(oldPatches.size(), 0);
|
||||||
|
|
||||||
forAll(oldPatches, patchI)
|
forAll(oldPatches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = oldPatches[patchI];
|
const polyPatch& pp = oldPatches[patchI];
|
||||||
|
if (pp.size() > 0)
|
||||||
|
{
|
||||||
nAgglom[patchI] = max(agglom[patchI])+1;
|
nAgglom[patchI] = max(agglom[patchI])+1;
|
||||||
|
|
||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
@ -63,6 +64,7 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check agglomeration is sync
|
// Check agglomeration is sync
|
||||||
{
|
{
|
||||||
@ -155,6 +157,8 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
|
|
||||||
forAll(oldPatches, patchI)
|
forAll(oldPatches, patchI)
|
||||||
{
|
{
|
||||||
|
patchStarts[patchI] = coarseI;
|
||||||
|
|
||||||
const polyPatch& pp = oldPatches[patchI];
|
const polyPatch& pp = oldPatches[patchI];
|
||||||
|
|
||||||
if (pp.size() > 0)
|
if (pp.size() > 0)
|
||||||
@ -170,8 +174,6 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
// From agglomeration to compact patch face
|
// From agglomeration to compact patch face
|
||||||
labelList agglomToFace(nAgglom[patchI], -1);
|
labelList agglomToFace(nAgglom[patchI], -1);
|
||||||
|
|
||||||
patchStarts[patchI] = coarseI;
|
|
||||||
|
|
||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
label myAgglom = agglom[patchI][i];
|
label myAgglom = agglom[patchI][i];
|
||||||
@ -223,10 +225,10 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
patchSizes[patchI] = coarseI-patchStarts[patchI];
|
patchSizes[patchI] = coarseI-patchStarts[patchI];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Pout<< "patchStarts:" << patchStarts << endl;
|
//Pout<< "patchStarts:" << patchStarts << endl;
|
||||||
//Pout<< "patchSizes:" << patchSizes << endl;
|
//Pout<< "patchSizes:" << patchSizes << endl;
|
||||||
|
|||||||
@ -44,7 +44,6 @@ octree/octreeDataFace.C
|
|||||||
octree/treeBoundBox.C
|
octree/treeBoundBox.C
|
||||||
octree/treeNodeName.C
|
octree/treeNodeName.C
|
||||||
octree/treeLeafName.C
|
octree/treeLeafName.C
|
||||||
octree/pointIndexHitIOList.C
|
|
||||||
|
|
||||||
indexedOctree/indexedOctreeName.C
|
indexedOctree/indexedOctreeName.C
|
||||||
indexedOctree/treeDataCell.C
|
indexedOctree/treeDataCell.C
|
||||||
|
|||||||
@ -2794,6 +2794,30 @@ Foam::indexedOctree<Type>::getVolumeType
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
template <class CompareOp>
|
||||||
|
void Foam::indexedOctree<Type>::findNear
|
||||||
|
(
|
||||||
|
const scalar nearDist,
|
||||||
|
const indexedOctree<Type>& tree2,
|
||||||
|
CompareOp& cop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
findNear
|
||||||
|
(
|
||||||
|
nearDist,
|
||||||
|
true,
|
||||||
|
*this,
|
||||||
|
nodePlusOctant(0, 0),
|
||||||
|
bb(),
|
||||||
|
tree2,
|
||||||
|
nodePlusOctant(0, 0),
|
||||||
|
tree2.bb(),
|
||||||
|
cop
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Print contents of nodeI
|
// Print contents of nodeI
|
||||||
template <class Type>
|
template <class Type>
|
||||||
void Foam::indexedOctree<Type>::print
|
void Foam::indexedOctree<Type>::print
|
||||||
|
|||||||
@ -35,145 +35,145 @@ defineTypeNameAndDebug(Foam::treeDataTriSurface, 0);
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
// Fast distance to triangle calculation. From
|
// // Fast distance to triangle calculation. From
|
||||||
// "Distance Between Point and Trangle in 3D"
|
// // "Distance Between Point and Triangle in 3D"
|
||||||
// David Eberly, Magic Software Inc. Aug. 2003.
|
// // David Eberly, Magic Software Inc. Aug. 2003.
|
||||||
// Works on function Q giving distance to point and tries to minimize this.
|
// // Works on function Q giving distance to point and tries to minimize this.
|
||||||
Foam::scalar Foam::treeDataTriSurface::nearestCoords
|
// Foam::scalar Foam::treeDataTriSurface::nearestCoords
|
||||||
(
|
// (
|
||||||
const point& base,
|
// const point& base,
|
||||||
const point& E0,
|
// const point& E0,
|
||||||
const point& E1,
|
// const point& E1,
|
||||||
const scalar a,
|
// const scalar a,
|
||||||
const scalar b,
|
// const scalar b,
|
||||||
const scalar c,
|
// const scalar c,
|
||||||
const point& P,
|
// const point& P,
|
||||||
scalar& s,
|
// scalar& s,
|
||||||
scalar& t
|
// scalar& t
|
||||||
)
|
// )
|
||||||
{
|
// {
|
||||||
// distance vector
|
// // distance vector
|
||||||
const vector D(base - P);
|
// const vector D(base - P);
|
||||||
|
|
||||||
// Precalculate distance factors.
|
// // Precalculate distance factors.
|
||||||
const scalar d = E0 & D;
|
// const scalar d = E0 & D;
|
||||||
const scalar e = E1 & D;
|
// const scalar e = E1 & D;
|
||||||
|
|
||||||
// Do classification
|
// // Do classification
|
||||||
const scalar det = a*c - b*b;
|
// const scalar det = a*c - b*b;
|
||||||
|
|
||||||
s = b*e - c*d;
|
// s = b*e - c*d;
|
||||||
t = b*d - a*e;
|
// t = b*d - a*e;
|
||||||
|
|
||||||
if (s+t < det)
|
// if (s+t < det)
|
||||||
{
|
// {
|
||||||
if (s < 0)
|
// if (s < 0)
|
||||||
{
|
// {
|
||||||
if (t < 0)
|
// if (t < 0)
|
||||||
{
|
// {
|
||||||
//region 4
|
// //region 4
|
||||||
if (e > 0)
|
// if (e > 0)
|
||||||
{
|
// {
|
||||||
//min on edge t = 0
|
// //min on edge t = 0
|
||||||
t = 0;
|
// t = 0;
|
||||||
s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
// s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//min on edge s=0
|
// //min on edge s=0
|
||||||
s = 0;
|
// s = 0;
|
||||||
t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
// t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//region 3. Min on edge s = 0
|
// //region 3. Min on edge s = 0
|
||||||
s = 0;
|
// s = 0;
|
||||||
t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
// t = (e >= 0 ? 0 : (-e >= c ? 1 : -e/c));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (t < 0)
|
// else if (t < 0)
|
||||||
{
|
// {
|
||||||
//region 5
|
// //region 5
|
||||||
t = 0;
|
// t = 0;
|
||||||
s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
// s = (d >= 0 ? 0 : (-d >= a ? 1 : -d/a));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//region 0
|
// //region 0
|
||||||
const scalar invDet = 1/det;
|
// const scalar invDet = 1/det;
|
||||||
s *= invDet;
|
// s *= invDet;
|
||||||
t *= invDet;
|
// t *= invDet;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
if (s < 0)
|
// if (s < 0)
|
||||||
{
|
// {
|
||||||
//region 2
|
// //region 2
|
||||||
const scalar tmp0 = b + d;
|
// const scalar tmp0 = b + d;
|
||||||
const scalar tmp1 = c + e;
|
// const scalar tmp1 = c + e;
|
||||||
if (tmp1 > tmp0)
|
// if (tmp1 > tmp0)
|
||||||
{
|
// {
|
||||||
//min on edge s+t=1
|
// //min on edge s+t=1
|
||||||
const scalar numer = tmp1 - tmp0;
|
// const scalar numer = tmp1 - tmp0;
|
||||||
const scalar denom = a-2*b+c;
|
// const scalar denom = a-2*b+c;
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
// s = (numer >= denom ? 1 : numer/denom);
|
||||||
t = 1 - s;
|
// t = 1 - s;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//min on edge s=0
|
// //min on edge s=0
|
||||||
s = 0;
|
// s = 0;
|
||||||
t = (tmp1 <= 0 ? 1 : (e >= 0 ? 0 : - e/c));
|
// t = (tmp1 <= 0 ? 1 : (e >= 0 ? 0 : - e/c));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (t < 0)
|
// else if (t < 0)
|
||||||
{
|
// {
|
||||||
//region 6
|
// //region 6
|
||||||
const scalar tmp0 = b + d;
|
// const scalar tmp0 = b + d;
|
||||||
const scalar tmp1 = c + e;
|
// const scalar tmp1 = c + e;
|
||||||
if (tmp1 > tmp0)
|
// if (tmp1 > tmp0)
|
||||||
{
|
// {
|
||||||
//min on edge s+t=1
|
// //min on edge s+t=1
|
||||||
const scalar numer = tmp1 - tmp0;
|
// const scalar numer = tmp1 - tmp0;
|
||||||
const scalar denom = a-2*b+c;
|
// const scalar denom = a-2*b+c;
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
// s = (numer >= denom ? 1 : numer/denom);
|
||||||
t = 1 - s;
|
// t = 1 - s;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//min on edge t=0
|
// //min on edge t=0
|
||||||
t = 0;
|
// t = 0;
|
||||||
s = (tmp1 <= 0 ? 1 : (d >= 0 ? 0 : - d/a));
|
// s = (tmp1 <= 0 ? 1 : (d >= 0 ? 0 : - d/a));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//region 1
|
// //region 1
|
||||||
const scalar numer = c+e-(b+d);
|
// const scalar numer = c+e-(b+d);
|
||||||
if (numer <= 0)
|
// if (numer <= 0)
|
||||||
{
|
// {
|
||||||
s = 0;
|
// s = 0;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
const scalar denom = a-2*b+c;
|
// const scalar denom = a-2*b+c;
|
||||||
s = (numer >= denom ? 1 : numer/denom);
|
// s = (numer >= denom ? 1 : numer/denom);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
t = 1 - s;
|
// t = 1 - s;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// Calculate distance.
|
// // Calculate distance.
|
||||||
// Note: abs should not be needed but truncation error causes problems
|
// // Note: abs should not be needed but truncation error causes problems
|
||||||
// with points very close to one of the triangle vertices.
|
// // with points very close to one of the triangle vertices.
|
||||||
// (seen up to -9e-15). Alternatively add some small value.
|
// // (seen up to -9e-15). Alternatively add some small value.
|
||||||
|
|
||||||
const scalar f = D & D;
|
// const scalar f = D & D;
|
||||||
return Foam::mag(a*s*s + 2*b*s*t + c*t*t + 2*d*s + 2*e*t + f);
|
// return Foam::mag(a*s*s + 2*b*s*t + c*t*t + 2*d*s + 2*e*t + f);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -234,9 +234,7 @@ Foam::label Foam::treeDataTriSurface::getVolumeType
|
|||||||
(
|
(
|
||||||
surface_,
|
surface_,
|
||||||
sample,
|
sample,
|
||||||
pHit.index(),
|
pHit.index()
|
||||||
pHit.hitPoint(),
|
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (t == triSurfaceTools::UNKNOWN)
|
if (t == triSurfaceTools::UNKNOWN)
|
||||||
@ -353,39 +351,43 @@ void Foam::treeDataTriSurface::findNearest
|
|||||||
// )
|
// )
|
||||||
//)
|
//)
|
||||||
{
|
{
|
||||||
// Get spanning vectors of triangle
|
// // Get spanning vectors of triangle
|
||||||
vector base(p1);
|
// vector base(p1);
|
||||||
vector E0(p0 - p1);
|
// vector E0(p0 - p1);
|
||||||
vector E1(p2 - p1);
|
// vector E1(p2 - p1);
|
||||||
|
|
||||||
scalar a(E0& E0);
|
// scalar a(E0& E0);
|
||||||
scalar b(E0& E1);
|
// scalar b(E0& E1);
|
||||||
scalar c(E1& E1);
|
// scalar c(E1& E1);
|
||||||
|
|
||||||
// Get nearest point in s,t coordinates (s is along E0, t is along
|
// // Get nearest point in s,t coordinates (s is along E0, t
|
||||||
// E1)
|
// // is along E1)
|
||||||
scalar s;
|
// scalar s;
|
||||||
scalar t;
|
// scalar t;
|
||||||
|
|
||||||
scalar distSqr = nearestCoords
|
// scalar distSqr = nearestCoords
|
||||||
(
|
// (
|
||||||
base,
|
// base,
|
||||||
E0,
|
// E0,
|
||||||
E1,
|
// E1,
|
||||||
a,
|
// a,
|
||||||
b,
|
// b,
|
||||||
c,
|
// c,
|
||||||
sample,
|
// sample,
|
||||||
|
|
||||||
s,
|
// s,
|
||||||
t
|
// t
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
pointHit pHit = triPointRef(p0, p1, p2).nearestPoint(sample);
|
||||||
|
|
||||||
|
scalar distSqr = sqr(pHit.distance());
|
||||||
|
|
||||||
if (distSqr < nearestDistSqr)
|
if (distSqr < nearestDistSqr)
|
||||||
{
|
{
|
||||||
nearestDistSqr = distSqr;
|
nearestDistSqr = distSqr;
|
||||||
minIndex = index;
|
minIndex = index;
|
||||||
nearestPoint = base + s*E0 + t*E1;
|
nearestPoint = pHit.rawPoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,20 +60,20 @@ class treeDataTriSurface
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- fast triangle nearest point calculation. Returns point in E0, E1
|
// //- fast triangle nearest point calculation. Returns point in E0, E1
|
||||||
// coordinate system: base + s*E0 + t*E1
|
// // coordinate system: base + s*E0 + t*E1
|
||||||
static scalar nearestCoords
|
// static scalar nearestCoords
|
||||||
(
|
// (
|
||||||
const point& base,
|
// const point& base,
|
||||||
const point& E0,
|
// const point& E0,
|
||||||
const point& E1,
|
// const point& E1,
|
||||||
const scalar a,
|
// const scalar a,
|
||||||
const scalar b,
|
// const scalar b,
|
||||||
const scalar c,
|
// const scalar c,
|
||||||
const point& P,
|
// const point& P,
|
||||||
scalar& s,
|
// scalar& s,
|
||||||
scalar& t
|
// scalar& t
|
||||||
);
|
// );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -430,10 +430,7 @@ bool Foam::edgeIntersections::offsetPerturb
|
|||||||
|
|
||||||
point ctr = tri.centre();
|
point ctr = tri.centre();
|
||||||
|
|
||||||
// Get measure for tolerance.
|
tri.classify(pHit.hitPoint(), nearType, nearLabel);
|
||||||
scalar tolDim = 0.001*mag(tri.a() - ctr);
|
|
||||||
|
|
||||||
tri.classify(pHit.hitPoint(), tolDim, nearType, nearLabel);
|
|
||||||
|
|
||||||
if (nearType == triPointRef::POINT || nearType == triPointRef::EDGE)
|
if (nearType == triPointRef::POINT || nearType == triPointRef::EDGE)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -315,7 +315,7 @@ void Foam::surfaceIntersection::classifyHit
|
|||||||
surf2Pts[f2[0]],
|
surf2Pts[f2[0]],
|
||||||
surf2Pts[f2[1]],
|
surf2Pts[f2[1]],
|
||||||
surf2Pts[f2[2]]
|
surf2Pts[f2[2]]
|
||||||
).classify(pHit.hitPoint(), tolDim, nearType, nearLabel);
|
).classify(pHit.hitPoint(), nearType, nearLabel);
|
||||||
|
|
||||||
// Classify points on edge of surface1
|
// Classify points on edge of surface1
|
||||||
label edgeEnd =
|
label edgeEnd =
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Foam::scalar Foam::octreeDataTriSurface::tol(1E-6);
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
// Fast distance to triangle calculation. From
|
// Fast distance to triangle calculation. From
|
||||||
// "Distance Between Point and Trangle in 3D"
|
// "Distance Between Point and Triangle in 3D"
|
||||||
// David Eberly, Magic Software Inc. Aug. 2003.
|
// David Eberly, Magic Software Inc. Aug. 2003.
|
||||||
// Works on function Q giving distance to point and tries to minimize this.
|
// Works on function Q giving distance to point and tries to minimize this.
|
||||||
void Foam::octreeDataTriSurface::nearestCoords
|
void Foam::octreeDataTriSurface::nearestCoords
|
||||||
|
|||||||
@ -234,9 +234,7 @@ void Foam::orientedSurface::propagateOrientation
|
|||||||
(
|
(
|
||||||
s,
|
s,
|
||||||
samplePoint,
|
samplePoint,
|
||||||
nearestFaceI,
|
nearestFaceI
|
||||||
nearestPt,
|
|
||||||
10*SMALL
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (side == triSurfaceTools::UNKNOWN)
|
if (side == triSurfaceTools::UNKNOWN)
|
||||||
|
|||||||
@ -2121,12 +2121,13 @@ Foam::vector Foam::triSurfaceTools::surfaceNormal
|
|||||||
|
|
||||||
label nearType;
|
label nearType;
|
||||||
label nearLabel;
|
label nearLabel;
|
||||||
|
|
||||||
triPointRef
|
triPointRef
|
||||||
(
|
(
|
||||||
points[f[0]],
|
points[f[0]],
|
||||||
points[f[1]],
|
points[f[1]],
|
||||||
points[f[2]]
|
points[f[2]]
|
||||||
).classify(nearestPt, 1E-6, nearType, nearLabel);
|
).classify(nearestPt, nearType, nearLabel);
|
||||||
|
|
||||||
if (nearType == triPointRef::NONE)
|
if (nearType == triPointRef::NONE)
|
||||||
{
|
{
|
||||||
@ -2199,28 +2200,61 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide
|
|||||||
(
|
(
|
||||||
const triSurface& surf,
|
const triSurface& surf,
|
||||||
const point& sample,
|
const point& sample,
|
||||||
const label nearestFaceI, // nearest face
|
const label nearestFaceI
|
||||||
const point& nearestPoint, // nearest point on nearest face
|
|
||||||
const scalar tol
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const labelledTri& f = surf[nearestFaceI];
|
const labelledTri& f = surf[nearestFaceI];
|
||||||
const pointField& points = surf.points();
|
const pointField& points = surf.points();
|
||||||
|
|
||||||
// Find where point is on triangle. Note tolerance needed. Is relative
|
// Find where point is on triangle.
|
||||||
// one (used in comparing normalized [0..1] triangle coordinates).
|
|
||||||
label nearType, nearLabel;
|
label nearType, nearLabel;
|
||||||
triPointRef
|
|
||||||
|
pointHit pHit = triPointRef
|
||||||
(
|
(
|
||||||
points[f[0]],
|
points[f[0]],
|
||||||
points[f[1]],
|
points[f[1]],
|
||||||
points[f[2]]
|
points[f[2]]
|
||||||
).classify(nearestPoint, tol, nearType, nearLabel);
|
).nearestPointClassify(sample, nearType, nearLabel);
|
||||||
|
|
||||||
|
const point& nearestPoint(pHit.rawPoint());
|
||||||
|
|
||||||
if (nearType == triPointRef::NONE)
|
if (nearType == triPointRef::NONE)
|
||||||
{
|
{
|
||||||
|
vector sampleNearestVec = (sample - nearestPoint);
|
||||||
|
|
||||||
// Nearest to face interior. Use faceNormal to determine side
|
// Nearest to face interior. Use faceNormal to determine side
|
||||||
scalar c = (sample - nearestPoint) & surf.faceNormals()[nearestFaceI];
|
scalar c = sampleNearestVec & surf.faceNormals()[nearestFaceI];
|
||||||
|
|
||||||
|
// // If the sample is essentially on the face, do not check for
|
||||||
|
// // it being perpendicular.
|
||||||
|
|
||||||
|
// scalar magSampleNearestVec = mag(sampleNearestVec);
|
||||||
|
|
||||||
|
// if (magSampleNearestVec > SMALL)
|
||||||
|
// {
|
||||||
|
// c /= magSampleNearestVec*mag(surf.faceNormals()[nearestFaceI]);
|
||||||
|
|
||||||
|
// if (mag(c) < 0.99)
|
||||||
|
// {
|
||||||
|
// FatalErrorIn("triSurfaceTools::surfaceSide")
|
||||||
|
// << "nearestPoint identified as being on triangle face "
|
||||||
|
// << "but vector from nearestPoint to sample is not "
|
||||||
|
// << "perpendicular to the normal." << nl
|
||||||
|
// << "sample: " << sample << nl
|
||||||
|
// << "nearestPoint: " << nearestPoint << nl
|
||||||
|
// << "sample - nearestPoint: "
|
||||||
|
// << sample - nearestPoint << nl
|
||||||
|
// << "normal: " << surf.faceNormals()[nearestFaceI] << nl
|
||||||
|
// << "mag(sample - nearestPoint): "
|
||||||
|
// << mag(sample - nearestPoint) << nl
|
||||||
|
// << "normalised dot product: " << c << nl
|
||||||
|
// << "triangle vertices: " << nl
|
||||||
|
// << " " << points[f[0]] << nl
|
||||||
|
// << " " << points[f[1]] << nl
|
||||||
|
// << " " << points[f[2]] << nl
|
||||||
|
// << abort(FatalError);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
@ -2239,13 +2273,13 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide
|
|||||||
// Get the edge. Assume order of faceEdges same as face vertices.
|
// Get the edge. Assume order of faceEdges same as face vertices.
|
||||||
label edgeI = surf.faceEdges()[nearestFaceI][nearLabel];
|
label edgeI = surf.faceEdges()[nearestFaceI][nearLabel];
|
||||||
|
|
||||||
//if (debug)
|
// if (debug)
|
||||||
//{
|
// {
|
||||||
// // Check order of faceEdges same as face vertices.
|
// // Check order of faceEdges same as face vertices.
|
||||||
// const edge& e = surf.edges()[edgeI];
|
// const edge& e = surf.edges()[edgeI];
|
||||||
// const labelList& meshPoints = surf.meshPoints();
|
// const labelList& meshPoints = surf.meshPoints();
|
||||||
// const edge meshEdge(meshPoints[e[0]], meshPoints[e[1]]);
|
// const edge meshEdge(meshPoints[e[0]], meshPoints[e[1]]);
|
||||||
//
|
|
||||||
// if
|
// if
|
||||||
// (
|
// (
|
||||||
// meshEdge
|
// meshEdge
|
||||||
@ -2259,7 +2293,7 @@ Foam::triSurfaceTools::sideType Foam::triSurfaceTools::surfaceSide
|
|||||||
// << " in face " << f
|
// << " in face " << f
|
||||||
// << abort(FatalError);
|
// << abort(FatalError);
|
||||||
// }
|
// }
|
||||||
//}
|
// }
|
||||||
|
|
||||||
return edgeSide(surf, sample, nearestPoint, edgeI);
|
return edgeSide(surf, sample, nearestPoint, edgeI);
|
||||||
}
|
}
|
||||||
@ -2717,7 +2751,14 @@ void Foam::triSurfaceTools::calcInterpolationWeights
|
|||||||
|
|
||||||
triPointRef tri(f.tri(points));
|
triPointRef tri(f.tri(points));
|
||||||
|
|
||||||
pointHit nearest = tri.nearestPoint(samplePt);
|
label nearType, nearLabel;
|
||||||
|
|
||||||
|
pointHit nearest = tri.nearestPointClassify
|
||||||
|
(
|
||||||
|
samplePt,
|
||||||
|
nearType,
|
||||||
|
nearLabel
|
||||||
|
);
|
||||||
|
|
||||||
if (nearest.hit())
|
if (nearest.hit())
|
||||||
{
|
{
|
||||||
@ -2741,14 +2782,6 @@ void Foam::triSurfaceTools::calcInterpolationWeights
|
|||||||
minDistance = nearest.distance();
|
minDistance = nearest.distance();
|
||||||
|
|
||||||
// Outside triangle. Store nearest.
|
// Outside triangle. Store nearest.
|
||||||
label nearType, nearLabel;
|
|
||||||
tri.classify
|
|
||||||
(
|
|
||||||
nearest.rawPoint(),
|
|
||||||
1E-6, // relative tolerance
|
|
||||||
nearType,
|
|
||||||
nearLabel
|
|
||||||
);
|
|
||||||
|
|
||||||
if (nearType == triPointRef::POINT)
|
if (nearType == triPointRef::POINT)
|
||||||
{
|
{
|
||||||
@ -2779,12 +2812,12 @@ void Foam::triSurfaceTools::calcInterpolationWeights
|
|||||||
max
|
max
|
||||||
(
|
(
|
||||||
0,
|
0,
|
||||||
mag(nearest.rawPoint()-p0)/mag(p1-p0)
|
mag(nearest.rawPoint() - p0)/mag(p1 - p0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Interpolate
|
// Interpolate
|
||||||
weights[0] = 1-s;
|
weights[0] = 1 - s;
|
||||||
weights[1] = s;
|
weights[1] = s;
|
||||||
weights[2] = -GREAT;
|
weights[2] = -GREAT;
|
||||||
|
|
||||||
@ -2830,7 +2863,6 @@ Foam::surfaceLocation Foam::triSurfaceTools::classify
|
|||||||
triPointRef(s[triI].tri(s.points())).classify
|
triPointRef(s[triI].tri(s.points())).classify
|
||||||
(
|
(
|
||||||
trianglePoint,
|
trianglePoint,
|
||||||
1E-6,
|
|
||||||
elemType,
|
elemType,
|
||||||
index
|
index
|
||||||
);
|
);
|
||||||
|
|||||||
@ -458,9 +458,7 @@ public:
|
|||||||
(
|
(
|
||||||
const triSurface& surf,
|
const triSurface& surf,
|
||||||
const point& sample,
|
const point& sample,
|
||||||
const label nearestFaceI, // nearest face
|
const label nearestFaceI
|
||||||
const point& nearestPt, // nearest point on nearest face
|
|
||||||
const scalar tol // tolerance for nearness test.
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Triangulation of faces
|
// Triangulation of faces
|
||||||
|
|||||||
@ -168,7 +168,6 @@ bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
|
|||||||
td.keepParticle
|
td.keepParticle
|
||||||
&& !td.switchProcessor
|
&& !td.switchProcessor
|
||||||
&& lifeTime_ > 0
|
&& lifeTime_ > 0
|
||||||
&& tEnd > ROOTVSMALL
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// TBD: implement subcycling so step through cells in more than
|
// TBD: implement subcycling so step through cells in more than
|
||||||
@ -191,6 +190,12 @@ bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
|
|||||||
|
|
||||||
tEnd -= dt;
|
tEnd -= dt;
|
||||||
stepFraction() = 1.0 - tEnd/deltaT;
|
stepFraction() = 1.0 - tEnd/deltaT;
|
||||||
|
|
||||||
|
if (tEnd <= ROOTVSMALL)
|
||||||
|
{
|
||||||
|
// Force removal
|
||||||
|
lifeTime_ = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!td.keepParticle || lifeTime_ == 0)
|
if (!td.keepParticle || lifeTime_ == 0)
|
||||||
|
|||||||
@ -89,20 +89,29 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
|
|
||||||
if (signed_)
|
if (signed_)
|
||||||
{
|
{
|
||||||
vectorField normal;
|
List<searchableSurface::volumeType> volType;
|
||||||
surfPtr_().getNormal(nearest, normal);
|
|
||||||
|
|
||||||
forAll(nearest, i)
|
surfPtr_().getVolumeType(cc, volType);
|
||||||
{
|
|
||||||
vector d(cc[i]-nearest[i].hitPoint());
|
|
||||||
|
|
||||||
if ((d&normal[i]) > 0)
|
forAll(volType, i)
|
||||||
{
|
{
|
||||||
fld[i] = Foam::mag(d);
|
searchableSurface::volumeType vT = volType[i];
|
||||||
|
|
||||||
|
if (vT == searchableSurface::OUTSIDE)
|
||||||
|
{
|
||||||
|
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||||
|
}
|
||||||
|
else if (vT == searchableSurface::INSIDE)
|
||||||
|
{
|
||||||
|
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fld[i] = -Foam::mag(d);
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::distanceSurface::createGeometry()"
|
||||||
|
) << "getVolumeType failure, neither INSIDE or OUTSIDE"
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,20 +141,30 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
|
|
||||||
if (signed_)
|
if (signed_)
|
||||||
{
|
{
|
||||||
vectorField normal;
|
List<searchableSurface::volumeType> volType;
|
||||||
surfPtr_().getNormal(nearest, normal);
|
|
||||||
|
|
||||||
forAll(nearest, i)
|
surfPtr_().getVolumeType(cc, volType);
|
||||||
{
|
|
||||||
vector d(cc[i]-nearest[i].hitPoint());
|
|
||||||
|
|
||||||
if ((d&normal[i]) > 0)
|
forAll(volType, i)
|
||||||
{
|
{
|
||||||
fld[i] = Foam::mag(d);
|
searchableSurface::volumeType vT = volType[i];
|
||||||
|
|
||||||
|
if (vT == searchableSurface::OUTSIDE)
|
||||||
|
{
|
||||||
|
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||||
|
}
|
||||||
|
else if (vT == searchableSurface::INSIDE)
|
||||||
|
{
|
||||||
|
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fld[i] = -Foam::mag(d);
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::distanceSurface::createGeometry()"
|
||||||
|
) << "getVolumeType failure, "
|
||||||
|
<< "neither INSIDE or OUTSIDE"
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,20 +198,31 @@ void Foam::distanceSurface::createGeometry()
|
|||||||
|
|
||||||
if (signed_)
|
if (signed_)
|
||||||
{
|
{
|
||||||
vectorField normal;
|
List<searchableSurface::volumeType> volType;
|
||||||
surfPtr_().getNormal(nearest, normal);
|
|
||||||
|
|
||||||
forAll(nearest, i)
|
surfPtr_().getVolumeType(pts, volType);
|
||||||
{
|
|
||||||
vector d(pts[i]-nearest[i].hitPoint());
|
|
||||||
|
|
||||||
if ((d&normal[i]) > 0)
|
forAll(volType, i)
|
||||||
{
|
{
|
||||||
pointDistance_[i] = Foam::mag(d);
|
searchableSurface::volumeType vT = volType[i];
|
||||||
|
|
||||||
|
if (vT == searchableSurface::OUTSIDE)
|
||||||
|
{
|
||||||
|
pointDistance_[i] =
|
||||||
|
Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||||
|
}
|
||||||
|
else if (vT == searchableSurface::INSIDE)
|
||||||
|
{
|
||||||
|
pointDistance_[i] =
|
||||||
|
-Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointDistance_[i] = -Foam::mag(d);
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::distanceSurface::createGeometry()"
|
||||||
|
) << "getVolumeType failure, neither INSIDE or OUTSIDE"
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -231,19 +231,17 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
scalar P = Psmooth(Prat);
|
scalar P = Psmooth(Prat);
|
||||||
scalar yPlusTherm = this->yPlusTherm(P, Prat);
|
scalar yPlusTherm = this->yPlusTherm(P, Prat);
|
||||||
|
|
||||||
// Evaluate new effective thermal diffusivity
|
// Update turbulent thermal conductivity
|
||||||
scalar kappaEff = 0.0;
|
if (yPlus > yPlusTherm)
|
||||||
if (yPlus < yPlusTherm)
|
|
||||||
{
|
{
|
||||||
kappaEff = Pr*yPlus;
|
scalar nu = nuw[faceI];
|
||||||
|
scalar kt = nu*(yPlus/(Prt_/kappa_*log(E_*yPlusTherm) + P) - 1/Pr);
|
||||||
|
kappatw[faceI] = max(0.0, kt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kappaEff = nuw[faceI]*yPlus/(Prt_/kappa_*log(E_*yPlusTherm) + P);
|
kappatw[faceI] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update turbulent thermal diffusivity
|
|
||||||
kappatw[faceI] = max(0.0, kappaEff - nuw[faceI]/Pr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedValueFvPatchField<scalar>::updateCoeffs();
|
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|||||||
@ -23,411 +23,7 @@ boundaryField
|
|||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value nonuniform List<scalar>
|
value uniform 300;
|
||||||
400
|
|
||||||
(
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,23 +22,20 @@ boundaryField
|
|||||||
{
|
{
|
||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p_rgh;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 2 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
floor
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
rho rhok;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceiling
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
rho rhok;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedWalls
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
rho rhok;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
cleanCase
|
cleanCase
|
||||||
cp 0/T.org 0/T
|
rm -f 0/T
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -8,6 +8,7 @@ application=`getApplication`
|
|||||||
|
|
||||||
compileApplication ../../buoyantPimpleFoam/hotRoom/setHotRoom
|
compileApplication ../../buoyantPimpleFoam/hotRoom/setHotRoom
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
|
cp 0/T.org 0/T
|
||||||
runApplication setHotRoom
|
runApplication setHotRoom
|
||||||
runApplication $application
|
runApplication $application
|
||||||
|
|
||||||
|
|||||||
@ -40,12 +40,12 @@ divSchemes
|
|||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(nuEff,U) Gauss linear corrected;
|
laplacian(nuEff,U) Gauss linear uncorrected;
|
||||||
laplacian((1|A(U)),p) Gauss linear corrected;
|
laplacian((1|A(U)),p_rgh) Gauss linear uncorrected;
|
||||||
laplacian(kappaEff,T) Gauss linear corrected;
|
laplacian(kappaEff,T) Gauss linear uncorrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear uncorrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
|
||||||
laplacian(DREff,R) Gauss linear corrected;
|
laplacian(DREff,R) Gauss linear uncorrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolationSchemes
|
interpolationSchemes
|
||||||
@ -55,13 +55,13 @@ interpolationSchemes
|
|||||||
|
|
||||||
snGradSchemes
|
snGradSchemes
|
||||||
{
|
{
|
||||||
default corrected;
|
default uncorrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p ;
|
p_rgh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,17 +17,17 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
p
|
p_rgh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
tolerance 1e-8;
|
tolerance 1e-8;
|
||||||
relTol 0.1;
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFinal
|
p_rghFinal
|
||||||
{
|
{
|
||||||
$p;
|
$p_rgh;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,23 +22,20 @@ boundaryField
|
|||||||
{
|
{
|
||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
cleanCase
|
cleanCase
|
||||||
cp 0/T.org 0/T
|
rm -f 0/T
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -8,6 +8,7 @@ application=`getApplication`
|
|||||||
|
|
||||||
compileApplication ../../buoyantPimpleFoam/hotRoom/setHotRoom
|
compileApplication ../../buoyantPimpleFoam/hotRoom/setHotRoom
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
|
cp 0/T.org 0/T
|
||||||
runApplication setHotRoom
|
runApplication setHotRoom
|
||||||
runApplication $application
|
runApplication $application
|
||||||
|
|
||||||
|
|||||||
@ -45,5 +45,25 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable true;
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
residualControl1
|
||||||
|
{
|
||||||
|
type residualControl;
|
||||||
|
functionObjectLibs ( "libjobControl.so" );
|
||||||
|
outputControl timeStep;
|
||||||
|
outputInterval 1;
|
||||||
|
|
||||||
|
maxResiduals
|
||||||
|
{
|
||||||
|
p_rgh 1e-2;
|
||||||
|
U 1e-4;
|
||||||
|
T 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -37,17 +37,15 @@ solvers
|
|||||||
SIMPLE
|
SIMPLE
|
||||||
{
|
{
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
p_rghRefCell 0;
|
pRefCell 0;
|
||||||
p_rghRefValue 0;
|
|
||||||
pRefValue 0;
|
pRefValue 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
rho 1;
|
|
||||||
p_rgh 0.7;
|
p_rgh 0.7;
|
||||||
U 0.2;
|
U 0.2;
|
||||||
T 0.7;
|
T 0.5;
|
||||||
"(k|epsilon|R)" 0.7;
|
"(k|epsilon|R)" 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,30 +22,26 @@ boundaryField
|
|||||||
{
|
{
|
||||||
ground
|
ground
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
igloo_region0
|
igloo_region0
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
twoFridgeFreezers_seal_0
|
twoFridgeFreezers_seal_0
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
twoFridgeFreezers_herring_1
|
twoFridgeFreezers_herring_1
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
rho rhok;
|
value $internalField;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,55 +21,55 @@ FoamFile
|
|||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
nFaces 0;
|
nFaces 0;
|
||||||
startFace 60456;
|
startFace 60336;
|
||||||
}
|
}
|
||||||
minX
|
minX
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
nFaces 0;
|
nFaces 0;
|
||||||
startFace 60456;
|
startFace 60336;
|
||||||
}
|
}
|
||||||
maxX
|
maxX
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
nFaces 0;
|
nFaces 0;
|
||||||
startFace 60456;
|
startFace 60336;
|
||||||
}
|
}
|
||||||
minY
|
minY
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
nFaces 0;
|
nFaces 0;
|
||||||
startFace 60456;
|
startFace 60336;
|
||||||
}
|
}
|
||||||
ground
|
ground
|
||||||
{
|
{
|
||||||
type wall;
|
type wall;
|
||||||
nFaces 590;
|
nFaces 590;
|
||||||
startFace 60456;
|
startFace 60336;
|
||||||
}
|
}
|
||||||
maxZ
|
maxZ
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
nFaces 0;
|
nFaces 0;
|
||||||
startFace 61046;
|
startFace 60926;
|
||||||
}
|
}
|
||||||
igloo_region0
|
igloo_region0
|
||||||
{
|
{
|
||||||
type wall;
|
type wall;
|
||||||
nFaces 2260;
|
nFaces 2260;
|
||||||
startFace 61046;
|
startFace 60926;
|
||||||
}
|
}
|
||||||
twoFridgeFreezers_seal_0
|
twoFridgeFreezers_seal_0
|
||||||
{
|
{
|
||||||
type wall;
|
type wall;
|
||||||
nFaces 1344;
|
nFaces 1344;
|
||||||
startFace 63306;
|
startFace 63186;
|
||||||
}
|
}
|
||||||
twoFridgeFreezers_herring_1
|
twoFridgeFreezers_herring_1
|
||||||
{
|
{
|
||||||
type wall;
|
type wall;
|
||||||
nFaces 1116;
|
nFaces 1116;
|
||||||
startFace 64650;
|
startFace 64530;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -45,5 +45,25 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable true;
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
residualControl1
|
||||||
|
{
|
||||||
|
type residualControl;
|
||||||
|
functionObjectLibs ( "libjobControl.so" );
|
||||||
|
outputControl timeStep;
|
||||||
|
outputInterval 1;
|
||||||
|
|
||||||
|
maxResiduals
|
||||||
|
{
|
||||||
|
p_rgh 1e-2;
|
||||||
|
U 1e-4;
|
||||||
|
T 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -37,16 +37,15 @@ solvers
|
|||||||
SIMPLE
|
SIMPLE
|
||||||
{
|
{
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
p_rghRefCell 0;
|
pRefCell 0;
|
||||||
p_rghRefValue 0;
|
|
||||||
pRefValue 0;
|
pRefValue 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
p_rgh 0.8;
|
p_rgh 0.7;
|
||||||
U 0.2;
|
U 0.2;
|
||||||
T 0.7;
|
T 0.5;
|
||||||
"(k|epsilon)" 0.7;
|
"(k|epsilon)" 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,20 +22,20 @@ boundaryField
|
|||||||
{
|
{
|
||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/0/p_rgh
Normal file
42
tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/0/p_rgh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p_rgh;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1e5;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
floor
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceiling
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedWalls
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -42,7 +42,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
laplacian((rho*(1|A(U))),p_rgh) Gauss linear corrected;
|
||||||
laplacian(alphaEff,h) Gauss linear corrected;
|
laplacian(alphaEff,h) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
@ -62,7 +62,7 @@ snGradSchemes
|
|||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p ;
|
p_rgh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,17 +25,17 @@ solvers
|
|||||||
relTol 0;
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p
|
p_rgh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
tolerance 1e-8;
|
tolerance 1e-8;
|
||||||
relTol 0.1;
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFinal
|
p_rghFinal
|
||||||
{
|
{
|
||||||
$p;
|
$p_rgh;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ solvers
|
|||||||
solver PBiCG;
|
solver PBiCG;
|
||||||
preconditioner DILU;
|
preconditioner DILU;
|
||||||
tolerance 1e-6;
|
tolerance 1e-6;
|
||||||
relTol 0;
|
relTol 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
"(U|h|k|epsilon|R)Final"
|
"(U|h|k|epsilon|R)Final"
|
||||||
@ -56,7 +56,7 @@ solvers
|
|||||||
|
|
||||||
PIMPLE
|
PIMPLE
|
||||||
{
|
{
|
||||||
momentumPredictor no;
|
momentumPredictor yes;
|
||||||
nOuterCorrectors 1;
|
nOuterCorrectors 1;
|
||||||
nCorrectors 2;
|
nCorrectors 2;
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
|
|||||||
@ -23,26 +23,26 @@ boundaryField
|
|||||||
{
|
{
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
topAndBottom
|
topAndBottom
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
hot
|
hot
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
cold
|
cold
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,5 +44,25 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable true;
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
residualControl1
|
||||||
|
{
|
||||||
|
type residualControl;
|
||||||
|
functionObjectLibs ( "libjobControl.so" );
|
||||||
|
outputControl timeStep;
|
||||||
|
outputInterval 1;
|
||||||
|
|
||||||
|
maxResiduals
|
||||||
|
{
|
||||||
|
p_rgh 1e-2;
|
||||||
|
U 1e-4;
|
||||||
|
T 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -44,17 +44,16 @@ SIMPLE
|
|||||||
{
|
{
|
||||||
momentumPredictor yes;
|
momentumPredictor yes;
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
p_rghRefCell 0;
|
pRefCell 0;
|
||||||
p_rghRefValue 100000;
|
pRefValue 0;
|
||||||
pRefValue 100000;
|
|
||||||
convergence 1e-04;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
p_rgh 0.9;
|
rho 1.0;
|
||||||
|
p_rgh 0.7;
|
||||||
U 0.3;
|
U 0.3;
|
||||||
h 0.7;
|
h 0.3;
|
||||||
"(k|epsilon|omega)" 0.7;
|
"(k|epsilon|omega)" 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,411 +23,7 @@ boundaryField
|
|||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value nonuniform List<scalar>
|
value uniform 300;
|
||||||
400
|
|
||||||
(
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,411 +23,7 @@ boundaryField
|
|||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value nonuniform List<scalar>
|
value uniform 300;
|
||||||
400
|
|
||||||
(
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
600
|
|
||||||
600
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
300
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,20 +22,20 @@ boundaryField
|
|||||||
{
|
{
|
||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 1e5;
|
value $internalField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/p_rgh
Normal file
42
tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/p_rgh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p_rgh;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1e5;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
floor
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceiling
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedWalls
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 1e5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -45,5 +45,25 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable true;
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
residualControl1
|
||||||
|
{
|
||||||
|
type residualControl;
|
||||||
|
functionObjectLibs ( "libjobControl.so" );
|
||||||
|
outputControl timeStep;
|
||||||
|
outputInterval 1;
|
||||||
|
|
||||||
|
maxResiduals
|
||||||
|
{
|
||||||
|
p_rgh 1e-2;
|
||||||
|
U 1e-4;
|
||||||
|
T 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -40,12 +40,12 @@ divSchemes
|
|||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear uncorrected;
|
||||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
laplacian((rho*(1|A(U))),p_rgh) Gauss linear uncorrected;
|
||||||
laplacian(alphaEff,h) Gauss linear corrected;
|
laplacian(alphaEff,h) Gauss linear uncorrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear uncorrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
|
||||||
laplacian(DREff,R) Gauss linear corrected;
|
laplacian(DREff,R) Gauss linear uncorrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolationSchemes
|
interpolationSchemes
|
||||||
@ -61,7 +61,7 @@ snGradSchemes
|
|||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p ;
|
p_rgh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,12 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
p
|
p_rgh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
tolerance 1e-08;
|
tolerance 1e-08;
|
||||||
relTol 0;
|
relTol 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
"(U|h|k|epsilon|R)"
|
"(U|h|k|epsilon|R)"
|
||||||
@ -30,7 +30,7 @@ solvers
|
|||||||
solver PBiCG;
|
solver PBiCG;
|
||||||
preconditioner DILU;
|
preconditioner DILU;
|
||||||
tolerance 1e-05;
|
tolerance 1e-05;
|
||||||
relTol 0;
|
relTol 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,16 +38,16 @@ SIMPLE
|
|||||||
{
|
{
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
pRefCell 0;
|
pRefCell 0;
|
||||||
pRefValue 100000;
|
pRefValue 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
rho 1;
|
rho 1.0;
|
||||||
p 0.7;
|
p_rgh 0.7;
|
||||||
U 0.2;
|
U 0.2;
|
||||||
h 0.7;
|
h 0.2;
|
||||||
"(k|epsilon|R)" 0.7;
|
"(k|epsilon|R)" 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ boundaryField
|
|||||||
type MarshakRadiation;
|
type MarshakRadiation;
|
||||||
T T;
|
T T;
|
||||||
emissivity 1;
|
emissivity 1;
|
||||||
value uniform 0;
|
// value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
@ -33,7 +33,7 @@ boundaryField
|
|||||||
type MarshakRadiation;
|
type MarshakRadiation;
|
||||||
T T;
|
T T;
|
||||||
emissivity 1;
|
emissivity 1;
|
||||||
value uniform 0;
|
// value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
@ -41,7 +41,7 @@ boundaryField
|
|||||||
type MarshakRadiation;
|
type MarshakRadiation;
|
||||||
T T;
|
T T;
|
||||||
emissivity 1;
|
emissivity 1;
|
||||||
value uniform 0;
|
// value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
box
|
box
|
||||||
@ -49,7 +49,7 @@ boundaryField
|
|||||||
type MarshakRadiation;
|
type MarshakRadiation;
|
||||||
T T;
|
T T;
|
||||||
emissivity 1;
|
emissivity 1;
|
||||||
value uniform 0;
|
// value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,26 +22,26 @@ boundaryField
|
|||||||
{
|
{
|
||||||
floor
|
floor
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 100000;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling
|
ceiling
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 100000;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedWalls
|
fixedWalls
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 100000;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
box
|
box
|
||||||
{
|
{
|
||||||
type buoyantPressure;
|
type calculated;
|
||||||
value uniform 100000;
|
value $internalField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p_rgh;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 100000;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
floor
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceiling
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedWalls
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
box
|
||||||
|
{
|
||||||
|
type buoyantPressure;
|
||||||
|
value uniform 100000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -45,5 +45,25 @@ timePrecision 6;
|
|||||||
|
|
||||||
runTimeModifiable true;
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
residualControl1
|
||||||
|
{
|
||||||
|
type residualControl;
|
||||||
|
functionObjectLibs ( "libjobControl.so" );
|
||||||
|
outputControl timeStep;
|
||||||
|
outputInterval 1;
|
||||||
|
|
||||||
|
maxResiduals
|
||||||
|
{
|
||||||
|
p_rgh 1e-2;
|
||||||
|
U 1e-4;
|
||||||
|
T 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -41,7 +41,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
laplacian((rho*(1|A(U))),p_rgh) Gauss linear corrected;
|
||||||
laplacian(alphaEff,h) Gauss linear corrected;
|
laplacian(alphaEff,h) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
@ -62,7 +62,7 @@ snGradSchemes
|
|||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p;
|
p_rgh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
p
|
p_rgh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
@ -35,7 +35,7 @@ solvers
|
|||||||
|
|
||||||
G
|
G
|
||||||
{
|
{
|
||||||
$p;
|
$p_rgh;
|
||||||
tolerance 1e-05;
|
tolerance 1e-05;
|
||||||
relTol 0.1;
|
relTol 0.1;
|
||||||
}
|
}
|
||||||
@ -50,11 +50,11 @@ SIMPLE
|
|||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
rho 1;
|
rho 1.0;
|
||||||
p 0.3;
|
p_rgh 0.7;
|
||||||
U 0.7;
|
U 0.2;
|
||||||
h 0.7;
|
h 0.2;
|
||||||
"(k|epsilon)" 0.7;
|
"(k|epsilon|R)" 0.5;
|
||||||
G 0.7;
|
G 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type greyDiffusiveRadiation;
|
type greyDiffusiveRadiation;
|
||||||
T T;
|
T T;
|
||||||
emissivity 0.5;
|
emissivity 1.0;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user