mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (int corr=1; corr<=1; corr++)
|
for (int corr=1; corr<=1; corr++)
|
||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("Dp", 1.0/UEqn.A());
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ fvMesh mesh
|
|||||||
fvMesh::defaultRegion,
|
fvMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::READ_IF_PRESENT
|
||||||
),
|
),
|
||||||
xferMove<Field<vector> >(points),
|
xferMove<Field<vector> >(points),
|
||||||
faces.xfer(),
|
faces.xfer(),
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
surfaceScalarField rhorAUf(rAU.name() + 'f', fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phig(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
|
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
@ -15,7 +15,7 @@ surfaceScalarField phiHbyA
|
|||||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
)
|
)
|
||||||
- phig
|
+ phig
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ while (pimple.correctNonOrthogonal())
|
|||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi = phiHbyA + p_rghEqn.flux();
|
phi = phiHbyA + p_rghEqn.flux();
|
||||||
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() - phig)/rhorAUf);
|
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/rhorAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phig(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||||
|
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiHbyA",
|
"phiHbyA",
|
||||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, U, phi)
|
+ fvc::ddtPhiCorr(rAU, U, phi)
|
||||||
- phig
|
+ phig
|
||||||
);
|
);
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
// 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 = HbyA - rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("rAU", 1.0/UEqn().A());
|
volScalarField rAU("rAU", 1.0/UEqn().A());
|
||||||
surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn().H();
|
HbyA = rAU*UEqn().H();
|
||||||
UEqn.clear();
|
UEqn.clear();
|
||||||
|
|
||||||
surfaceScalarField phig(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||||
|
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
adjustPhi(phiHbyA, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phiHbyA -= phig;
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (simple.correctNonOrthogonal())
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// 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 = HbyA - rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
thermo.rho() -= psi*p_rgh;
|
thermo.rho() -= psi*p_rgh;
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn().A());
|
volScalarField rAU(1.0/UEqn().A());
|
||||||
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn().H();
|
HbyA = rAU*UEqn().H();
|
||||||
UEqn.clear();
|
UEqn.clear();
|
||||||
|
|
||||||
surfaceScalarField phig(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
|
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
bool closedVolume = adjustPhi(phiHbyA, U, p_rgh);
|
bool closedVolume = adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phiHbyA -= phig;
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (simple.correctNonOrthogonal())
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
// 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 = HbyA - rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn().A());
|
volScalarField rAU(1.0/UEqn().A());
|
||||||
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
U = rAU*UEqn().H();
|
U = rAU*UEqn().H();
|
||||||
UEqn.clear();
|
UEqn.clear();
|
||||||
@ -15,8 +15,8 @@
|
|||||||
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
||||||
bool compressible = (compressibility.value() > SMALL);
|
bool compressible = (compressibility.value() > SMALL);
|
||||||
|
|
||||||
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
phi -= buoyancyPhi;
|
phi += phig;
|
||||||
|
|
||||||
// Solve pressure
|
// Solve pressure
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
// 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 -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
|
U += rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn().A());
|
volScalarField rAU(1.0/UEqn().A());
|
||||||
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn().H();
|
HbyA = rAU*UEqn().H();
|
||||||
|
|||||||
@ -61,6 +61,7 @@ int main(int argc, char *argv[])
|
|||||||
fvm::ddt(U)
|
fvm::ddt(U)
|
||||||
+ fvm::div(phi, U)
|
+ fvm::div(phi, U)
|
||||||
- fvm::laplacian(fluid.nu(), U)
|
- fvm::laplacian(fluid.nu(), U)
|
||||||
|
- (fvc::grad(U) & fvc::grad(fluid.nu()))
|
||||||
);
|
);
|
||||||
|
|
||||||
solve(UEqn == -fvc::grad(p));
|
solve(UEqn == -fvc::grad(p));
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
volScalarField rAU(1.0/UEqn().A());
|
volScalarField rAU(1.0/UEqn().A());
|
||||||
surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*(UEqn() == sources(U))().H();
|
HbyA = rAU*(UEqn() == sources(U))().H();
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
surfaceScalarField rhorAUf(rAU.name() + 'f', fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phig(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
|
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
@ -15,7 +15,7 @@ surfaceScalarField phiHbyA
|
|||||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
)
|
)
|
||||||
- phig
|
+ phig
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ while (pimple.correctNonOrthogonal())
|
|||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi = phiHbyA + p_rghEqn.flux();
|
phi = phiHbyA + p_rghEqn.flux();
|
||||||
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() - phig)/rhorAUf);
|
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/rhorAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,16 +8,21 @@
|
|||||||
surfaceScalarField rAU1f(fvc::interpolate(rAU1));
|
surfaceScalarField rAU1f(fvc::interpolate(rAU1));
|
||||||
surfaceScalarField rAU2f(fvc::interpolate(rAU2));
|
surfaceScalarField rAU2f(fvc::interpolate(rAU2));
|
||||||
|
|
||||||
U1 = rAU1*U1Eqn.H();
|
volVectorField HbyA1("HbyA1", U1);
|
||||||
U2 = rAU2*U2Eqn.H();
|
HbyA1 = rAU1*U1Eqn.H();
|
||||||
|
|
||||||
|
volVectorField HbyA2("HbyA2", U2);
|
||||||
|
HbyA2 = rAU2*U2Eqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiDrag1
|
surfaceScalarField phiDrag1
|
||||||
(
|
(
|
||||||
fvc::interpolate(alpha2/rho1*dragCoef*rAU1)*phi2 + rAU1f*(g & mesh.Sf())
|
fvc::interpolate(alpha2/rho1*dragCoef*rAU1)*phi2
|
||||||
|
+ rAU1f*(g & mesh.Sf())
|
||||||
);
|
);
|
||||||
surfaceScalarField phiDrag2
|
surfaceScalarField phiDrag2
|
||||||
(
|
(
|
||||||
fvc::interpolate(alpha1/rho2*dragCoef*rAU2)*phi1 + rAU2f*(g & mesh.Sf())
|
fvc::interpolate(alpha1/rho2*dragCoef*rAU2)*phi1
|
||||||
|
+ rAU2f*(g & mesh.Sf())
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(p.boundaryField(), patchi)
|
forAll(p.boundaryField(), patchi)
|
||||||
@ -29,16 +34,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
phi1 = (fvc::interpolate(U1) & mesh.Sf()) + fvc::ddtPhiCorr(rAU1, U1, phi1)
|
surfaceScalarField phiHbyA1
|
||||||
+ phiDrag1;
|
(
|
||||||
phi2 = (fvc::interpolate(U2) & mesh.Sf()) + fvc::ddtPhiCorr(rAU2, U2, phi2)
|
(fvc::interpolate(HbyA1) & mesh.Sf())
|
||||||
+ phiDrag2;
|
+ fvc::ddtPhiCorr(rAU1, U1, phi1)
|
||||||
|
+ phiDrag1
|
||||||
|
);
|
||||||
|
|
||||||
phi = alpha1f*phi1 + alpha2f*phi2;
|
surfaceScalarField phiHbyA2
|
||||||
|
(
|
||||||
|
(fvc::interpolate(HbyA2) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU2, U2, phi2)
|
||||||
|
+ phiDrag2
|
||||||
|
);
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA("phiHbyA", alpha1f*phiHbyA1 + alpha2f*phiHbyA2);
|
||||||
|
|
||||||
surfaceScalarField Dp
|
surfaceScalarField Dp
|
||||||
(
|
(
|
||||||
"(rho*(1|A(U)))",
|
"Dp",
|
||||||
alpha1f*rAU1f/rho1 + alpha2f*rAU2f/rho2
|
alpha1f*rAU1f/rho1 + alpha2f*rAU2f/rho2
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -46,7 +60,7 @@
|
|||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(Dp, p) == fvc::div(phi)
|
fvm::laplacian(Dp, p) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
@ -57,19 +71,17 @@
|
|||||||
{
|
{
|
||||||
surfaceScalarField SfGradp(pEqn.flux()/Dp);
|
surfaceScalarField SfGradp(pEqn.flux()/Dp);
|
||||||
|
|
||||||
phi1 -= rAU1f*SfGradp/rho1;
|
phi1 = phiHbyA1 - rAU1f*SfGradp/rho1;
|
||||||
phi2 -= rAU2f*SfGradp/rho2;
|
phi2 = phiHbyA2 - rAU2f*SfGradp/rho2;
|
||||||
phi = alpha1f*phi1 + alpha2f*phi2;
|
phi = alpha1f*phi1 + alpha2f*phi2;
|
||||||
|
|
||||||
p.relax();
|
p.relax();
|
||||||
SfGradp = pEqn.flux()/Dp;
|
SfGradp = pEqn.flux()/Dp;
|
||||||
|
|
||||||
U1 += (fvc::reconstruct(phiDrag1 - rAU1f*SfGradp/rho1));
|
U1 = HbyA1 + (fvc::reconstruct(phiDrag1 - rAU1f*SfGradp/rho1));
|
||||||
//U1 += rAU1*(fvc::reconstruct(phiDrag1/rAU1f - SfGradp/rho1));
|
|
||||||
U1.correctBoundaryConditions();
|
U1.correctBoundaryConditions();
|
||||||
|
|
||||||
U2 += (fvc::reconstruct(phiDrag2 - rAU2f*SfGradp/rho2));
|
U2 = HbyA2 + (fvc::reconstruct(phiDrag2 - rAU2f*SfGradp/rho2));
|
||||||
//U2 += rAU2*(fvc::reconstruct(phiDrag2/rAU2f - SfGradp/rho2));
|
|
||||||
U2.correctBoundaryConditions();
|
U2.correctBoundaryConditions();
|
||||||
|
|
||||||
U = alpha1*U1 + alpha2*U2;
|
U = alpha1*U1 + alpha2*U2;
|
||||||
|
|||||||
@ -25,38 +25,6 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField gamma
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"gamma",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
|
|
||||||
);
|
|
||||||
gamma.oldTime();
|
|
||||||
|
|
||||||
Info<< "Creating compressibilityModel\n" << endl;
|
|
||||||
autoPtr<barotropicCompressibilityModel> psiModel =
|
|
||||||
barotropicCompressibilityModel::New
|
|
||||||
(
|
|
||||||
thermodynamicProperties,
|
|
||||||
gamma
|
|
||||||
);
|
|
||||||
|
|
||||||
const volScalarField& psi = psiModel->psi();
|
|
||||||
|
|
||||||
rho == max
|
|
||||||
(
|
|
||||||
psi*p
|
|
||||||
+ (1.0 - gamma)*rhol0
|
|
||||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
|
||||||
rhoMin
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Reading field U\n" << endl;
|
Info<< "Reading field U\n" << endl;
|
||||||
volVectorField U
|
volVectorField U
|
||||||
(
|
(
|
||||||
@ -78,6 +46,27 @@
|
|||||||
|
|
||||||
twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
|
twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
|
||||||
|
|
||||||
|
volScalarField& gamma(twoPhaseProperties.alpha1());
|
||||||
|
gamma.oldTime();
|
||||||
|
|
||||||
|
Info<< "Creating compressibilityModel\n" << endl;
|
||||||
|
autoPtr<barotropicCompressibilityModel> psiModel =
|
||||||
|
barotropicCompressibilityModel::New
|
||||||
|
(
|
||||||
|
thermodynamicProperties,
|
||||||
|
gamma
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField& psi = psiModel->psi();
|
||||||
|
|
||||||
|
rho == max
|
||||||
|
(
|
||||||
|
psi*p
|
||||||
|
+ (1.0 - gamma)*rhol0
|
||||||
|
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||||
|
rhoMin
|
||||||
|
);
|
||||||
|
|
||||||
// Create incompressible turbulence model
|
// Create incompressible turbulence model
|
||||||
autoPtr<incompressible::turbulenceModel> turbulence
|
autoPtr<incompressible::turbulenceModel> turbulence
|
||||||
(
|
(
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
surfaceScalarField rhof("rhof", fvc::interpolate(rho));
|
surfaceScalarField rhof("rhof", fvc::interpolate(rho));
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf("rAUf", rhof*fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", rhof*fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
wclean libso phaseEquationsOfState
|
||||||
wclean
|
wclean
|
||||||
wclean compressibleInterDyMFoam
|
wclean compressibleInterDyMFoam
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
wmake libso phaseEquationsOfState
|
||||||
wmake
|
wmake
|
||||||
wmake compressibleInterDyMFoam
|
wmake compressibleInterDyMFoam
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
|
||||||
compressibleInterFoam.C
|
compressibleInterFoam.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/compressibleInterFoam
|
EXE = $(FOAM_APPBIN)/compressibleInterFoam
|
||||||
|
|||||||
@ -2,12 +2,14 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels \
|
-I$(LIB_SRC)/transportModels \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||||
|
-IphaseEquationsOfState/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ltwoPhaseInterfaceProperties \
|
-ltwoPhaseInterfaceProperties \
|
||||||
-lincompressibleTransportModels \
|
-lincompressibleTransportModels \
|
||||||
|
-lphaseEquationsOfState \
|
||||||
-lincompressibleTurbulenceModel \
|
-lincompressibleTurbulenceModel \
|
||||||
-lincompressibleRASModels \
|
-lincompressibleRASModels \
|
||||||
-lincompressibleLESModels \
|
-lincompressibleLESModels \
|
||||||
|
|||||||
20
applications/solvers/multiphase/compressibleInterFoam/TEqn.H
Normal file
20
applications/solvers/multiphase/compressibleInterFoam/TEqn.H
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
volScalarField kByCv
|
||||||
|
(
|
||||||
|
"kByCv",
|
||||||
|
(alpha1*k1/Cv1 + alpha2*k2/Cv2)
|
||||||
|
+ (alpha1*rho1 + alpha2*rho2)*turbulence->nut()
|
||||||
|
);
|
||||||
|
|
||||||
|
solve
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, T)
|
||||||
|
+ fvm::div(rhoPhi, T)
|
||||||
|
- fvm::laplacian(kByCv, T)
|
||||||
|
+ p*fvc::div(phi)*(alpha1/Cv1 + alpha2/Cv2)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update compressibilities
|
||||||
|
psi1 = eos1->psi(p, T);
|
||||||
|
psi2 = eos2->psi(p, T);
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels \
|
-I$(LIB_SRC)/transportModels \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||||
|
-I../phaseEquationsOfState/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
@ -12,6 +13,7 @@ EXE_INC = \
|
|||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ltwoPhaseInterfaceProperties \
|
-ltwoPhaseInterfaceProperties \
|
||||||
-lincompressibleTransportModels \
|
-lincompressibleTransportModels \
|
||||||
|
-lphaseEquationsOfState \
|
||||||
-lincompressibleTurbulenceModel \
|
-lincompressibleTurbulenceModel \
|
||||||
-lincompressibleRASModels \
|
-lincompressibleRASModels \
|
||||||
-lincompressibleLESModels \
|
-lincompressibleLESModels \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,7 +25,7 @@ Application
|
|||||||
compressibleInterDyMFoam
|
compressibleInterDyMFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Solver for 2 compressible, isothermal immiscible fluids using a VOF
|
Solver for 2 compressible, non-isothermal immiscible fluids using a VOF
|
||||||
(volume of fluid) phase-fraction based interface capturing approach,
|
(volume of fluid) phase-fraction based interface capturing approach,
|
||||||
with optional mesh motion and mesh topology changes including adaptive
|
with optional mesh motion and mesh topology changes including adaptive
|
||||||
re-meshing.
|
re-meshing.
|
||||||
@ -43,6 +43,7 @@ Description
|
|||||||
#include "subCycle.H"
|
#include "subCycle.H"
|
||||||
#include "interfaceProperties.H"
|
#include "interfaceProperties.H"
|
||||||
#include "twoPhaseMixture.H"
|
#include "twoPhaseMixture.H"
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
|
|
||||||
@ -124,11 +125,15 @@ int main(int argc, char *argv[])
|
|||||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
#include "TEqn.H"
|
||||||
|
|
||||||
// --- Pressure corrector loop
|
// --- Pressure corrector loop
|
||||||
while (pimple.correct())
|
while (pimple.correct())
|
||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
|
|
||||||
|
// Make the fluxes relative to the mesh motion
|
||||||
|
fvc::makeRelative(phi, U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,88 +0,0 @@
|
|||||||
{
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
|
||||||
|
|
||||||
tmp<fvScalarMatrix> p_rghEqnComp;
|
|
||||||
|
|
||||||
if (pimple.transonic())
|
|
||||||
{
|
|
||||||
p_rghEqnComp =
|
|
||||||
(
|
|
||||||
fvm::ddt(p_rgh)
|
|
||||||
+ fvm::div(phi, p_rgh)
|
|
||||||
- fvm::Sp(fvc::div(phi), p_rgh)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p_rghEqnComp =
|
|
||||||
(
|
|
||||||
fvm::ddt(p_rgh)
|
|
||||||
+ fvc::div(phi, p_rgh)
|
|
||||||
- fvc::Sp(fvc::div(phi), p_rgh)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
|
||||||
|
|
||||||
surfaceScalarField phiU
|
|
||||||
(
|
|
||||||
"phiU",
|
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
phi = phiU +
|
|
||||||
(
|
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
|
||||||
- ghf*fvc::snGrad(rho)
|
|
||||||
)*rAUf*mesh.magSf();
|
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
|
||||||
{
|
|
||||||
fvScalarMatrix p_rghEqnIncomp
|
|
||||||
(
|
|
||||||
fvc::div(phi)
|
|
||||||
- fvm::laplacian(rAUf, p_rgh)
|
|
||||||
);
|
|
||||||
|
|
||||||
solve
|
|
||||||
(
|
|
||||||
(
|
|
||||||
max(alpha1, scalar(0))*(psi1/rho1)
|
|
||||||
+ max(alpha2, scalar(0))*(psi2/rho2)
|
|
||||||
)
|
|
||||||
*p_rghEqnComp()
|
|
||||||
+ p_rghEqnIncomp,
|
|
||||||
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
|
||||||
{
|
|
||||||
dgdt =
|
|
||||||
(pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
|
|
||||||
*(p_rghEqnComp & p_rgh);
|
|
||||||
phi += p_rghEqnIncomp.flux();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
p = max
|
|
||||||
(
|
|
||||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
|
||||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
|
||||||
pMin
|
|
||||||
);
|
|
||||||
|
|
||||||
rho1 = rho10 + psi1*p;
|
|
||||||
rho2 = rho20 + psi2*p;
|
|
||||||
|
|
||||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
|
||||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
|
||||||
|
|
||||||
// Make the fluxes relative to the mesh motion
|
|
||||||
fvc::makeRelative(phi, U);
|
|
||||||
}
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,7 +25,7 @@ Application
|
|||||||
compressibleInterFoam
|
compressibleInterFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Solver for 2 compressible, isothermal immiscible fluids using a VOF
|
Solver for 2 compressible, non-isothermal immiscible fluids using a VOF
|
||||||
(volume of fluid) phase-fraction based interface capturing approach.
|
(volume of fluid) phase-fraction based interface capturing approach.
|
||||||
|
|
||||||
The momentum and other fluid properties are of the "mixture" and a single
|
The momentum and other fluid properties are of the "mixture" and a single
|
||||||
@ -40,6 +40,7 @@ Description
|
|||||||
#include "subCycle.H"
|
#include "subCycle.H"
|
||||||
#include "interfaceProperties.H"
|
#include "interfaceProperties.H"
|
||||||
#include "twoPhaseMixture.H"
|
#include "twoPhaseMixture.H"
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ int main(int argc, char *argv[])
|
|||||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
#include "TEqn.H"
|
||||||
|
|
||||||
// --- Pressure corrector loop
|
// --- Pressure corrector loop
|
||||||
while (pimple.correct())
|
while (pimple.correct())
|
||||||
|
|||||||
@ -12,23 +12,6 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading field alpha1\n" << endl;
|
|
||||||
volScalarField alpha1
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"alpha1",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Calculating field alpha1\n" << endl;
|
|
||||||
volScalarField alpha2("alpha2", scalar(1) - alpha1);
|
|
||||||
|
|
||||||
Info<< "Reading field U\n" << endl;
|
Info<< "Reading field U\n" << endl;
|
||||||
volVectorField U
|
volVectorField U
|
||||||
(
|
(
|
||||||
@ -45,48 +28,20 @@
|
|||||||
|
|
||||||
#include "createPhi.H"
|
#include "createPhi.H"
|
||||||
|
|
||||||
|
Info<< "Reading field T\n" << endl;
|
||||||
Info<< "Reading transportProperties\n" << endl;
|
volScalarField T
|
||||||
twoPhaseMixture twoPhaseProperties(U, phi);
|
|
||||||
|
|
||||||
dimensionedScalar rho10
|
|
||||||
(
|
(
|
||||||
twoPhaseProperties.subDict
|
IOobject
|
||||||
(
|
(
|
||||||
twoPhaseProperties.phase1Name()
|
"T",
|
||||||
).lookup("rho0")
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
dimensionedScalar rho20
|
|
||||||
(
|
|
||||||
twoPhaseProperties.subDict
|
|
||||||
(
|
|
||||||
twoPhaseProperties.phase2Name()
|
|
||||||
).lookup("rho0")
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar psi1
|
|
||||||
(
|
|
||||||
twoPhaseProperties.subDict
|
|
||||||
(
|
|
||||||
twoPhaseProperties.phase1Name()
|
|
||||||
).lookup("psi")
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar psi2
|
|
||||||
(
|
|
||||||
twoPhaseProperties.subDict
|
|
||||||
(
|
|
||||||
twoPhaseProperties.phase2Name()
|
|
||||||
).lookup("psi")
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
|
|
||||||
|
|
||||||
Info<< "Calculating field g.h\n" << endl;
|
|
||||||
volScalarField gh("gh", g & mesh.C());
|
|
||||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
|
||||||
|
|
||||||
volScalarField p
|
volScalarField p
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -94,19 +49,120 @@
|
|||||||
"p",
|
"p",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::READ_IF_PRESENT,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
max
|
p_rgh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
|
twoPhaseMixture twoPhaseProperties(U, phi);
|
||||||
|
|
||||||
|
volScalarField& alpha1(twoPhaseProperties.alpha1());
|
||||||
|
|
||||||
|
Info<< "Calculating phase-fraction alpha" << twoPhaseProperties.phase2Name()
|
||||||
|
<< nl << endl;
|
||||||
|
volScalarField alpha2
|
||||||
|
(
|
||||||
|
"alpha" + twoPhaseProperties.phase2Name(),
|
||||||
|
scalar(1) - alpha1
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar k1
|
||||||
|
(
|
||||||
|
"k",
|
||||||
|
dimensionSet(1, 1, -3, -1, 0),
|
||||||
|
twoPhaseProperties.subDict
|
||||||
(
|
(
|
||||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
twoPhaseProperties.phase1Name()
|
||||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
).lookup("k")
|
||||||
pMin
|
);
|
||||||
|
|
||||||
|
dimensionedScalar k2
|
||||||
|
(
|
||||||
|
"k",
|
||||||
|
dimensionSet(1, 1, -3, -1, 0),
|
||||||
|
twoPhaseProperties.subDict
|
||||||
|
(
|
||||||
|
twoPhaseProperties.phase2Name()
|
||||||
|
).lookup("k")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar Cv1
|
||||||
|
(
|
||||||
|
"Cv",
|
||||||
|
dimensionSet(0, 2, -2, -1, 0),
|
||||||
|
twoPhaseProperties.subDict
|
||||||
|
(
|
||||||
|
twoPhaseProperties.phase1Name()
|
||||||
|
).lookup("Cv")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar Cv2
|
||||||
|
(
|
||||||
|
"Cv",
|
||||||
|
dimensionSet(0, 2, -2, -1, 0),
|
||||||
|
twoPhaseProperties.subDict
|
||||||
|
(
|
||||||
|
twoPhaseProperties.phase2Name()
|
||||||
|
).lookup("Cv")
|
||||||
|
);
|
||||||
|
|
||||||
|
autoPtr<phaseEquationOfState> eos1
|
||||||
|
(
|
||||||
|
phaseEquationOfState::New
|
||||||
|
(
|
||||||
|
twoPhaseProperties.subDict
|
||||||
|
(
|
||||||
|
twoPhaseProperties.phase1Name()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField rho1(rho10 + psi1*p);
|
autoPtr<phaseEquationOfState> eos2
|
||||||
volScalarField rho2(rho20 + psi2*p);
|
(
|
||||||
|
phaseEquationOfState::New
|
||||||
|
(
|
||||||
|
twoPhaseProperties.subDict
|
||||||
|
(
|
||||||
|
twoPhaseProperties.phase2Name()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField psi1
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi1",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
eos1->psi(p, T)
|
||||||
|
);
|
||||||
|
psi1.oldTime();
|
||||||
|
|
||||||
|
volScalarField psi2
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi2",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
eos2->psi(p, T)
|
||||||
|
);
|
||||||
|
psi2.oldTime();
|
||||||
|
|
||||||
|
dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
|
volScalarField rho1("rho1", eos1->rho(p, T));
|
||||||
|
volScalarField rho2("rho2", eos2->rho(p, T));
|
||||||
|
|
||||||
volScalarField rho
|
volScalarField rho
|
||||||
(
|
(
|
||||||
|
|||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "wallHeatTransferFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
Tinf_(p.size(), 0.0),
|
||||||
|
alphaWall_(p.size(), 0.0)
|
||||||
|
{
|
||||||
|
refValue() = 0.0;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
Tinf_(ptf.Tinf_, mapper),
|
||||||
|
alphaWall_(ptf.alphaWall_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
Tinf_("Tinf", dict, p.size()),
|
||||||
|
alphaWall_("alphaWall", dict, p.size())
|
||||||
|
{
|
||||||
|
refValue() = Tinf_;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf),
|
||||||
|
Tinf_(tppsf.Tinf_),
|
||||||
|
alphaWall_(tppsf.alphaWall_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf, iF),
|
||||||
|
Tinf_(tppsf.Tinf_),
|
||||||
|
alphaWall_(tppsf.alphaWall_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::wallHeatTransferFvPatchScalarField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalarField::autoMap(m);
|
||||||
|
Tinf_.autoMap(m);
|
||||||
|
alphaWall_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::wallHeatTransferFvPatchScalarField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mixedFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const wallHeatTransferFvPatchScalarField& tiptf =
|
||||||
|
refCast<const wallHeatTransferFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
Tinf_.rmap(tiptf.Tinf_, addr);
|
||||||
|
alphaWall_.rmap(tiptf.alphaWall_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatchScalarField& Cpw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("Cp");
|
||||||
|
|
||||||
|
const fvPatchScalarField& kByCpw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("kByCp");
|
||||||
|
|
||||||
|
valueFraction() =
|
||||||
|
1.0/
|
||||||
|
(
|
||||||
|
1.0
|
||||||
|
+ Cpw*kByCpw*patch().deltaCoeffs()/alphaWall_
|
||||||
|
);
|
||||||
|
|
||||||
|
mixedFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::wallHeatTransferFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
Tinf_.writeEntry("Tinf", os);
|
||||||
|
alphaWall_.writeEntry("alphaWall", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField(fvPatchScalarField, wallHeatTransferFvPatchScalarField);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,194 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::wallHeatTransferFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Enthalpy boundary conditions for wall heat transfer
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
wallHeatTransferFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef wallHeatTransferFvPatchScalarField_H
|
||||||
|
#define wallHeatTransferFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class wallHeatTransferFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class wallHeatTransferFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Tinf
|
||||||
|
scalarField Tinf_;
|
||||||
|
|
||||||
|
//- alphaWall
|
||||||
|
scalarField alphaWall_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("wallHeatTransfer");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given wallHeatTransferFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new wallHeatTransferFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
wallHeatTransferFvPatchScalarField
|
||||||
|
(
|
||||||
|
const wallHeatTransferFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new wallHeatTransferFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return Tinf
|
||||||
|
const scalarField& Tinf() const
|
||||||
|
{
|
||||||
|
return Tinf_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to Tinf to allow adjustment
|
||||||
|
scalarField& Tinf()
|
||||||
|
{
|
||||||
|
return Tinf_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return alphaWall
|
||||||
|
const scalarField& alphaWall() const
|
||||||
|
{
|
||||||
|
return alphaWall_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to alphaWall to allow adjustment
|
||||||
|
scalarField& alphaWall()
|
||||||
|
{
|
||||||
|
return alphaWall_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
virtual void autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||||
|
virtual void rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,84 +1,97 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
rho1 = eos1->rho(p, T);
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
rho2 = eos2->rho(p, T);
|
||||||
|
|
||||||
tmp<fvScalarMatrix> p_rghEqnComp;
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
if (pimple.transonic())
|
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||||
|
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||||
|
|
||||||
|
//if (transonic)
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
//else
|
||||||
{
|
{
|
||||||
p_rghEqnComp =
|
surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
|
||||||
(
|
surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
|
||||||
fvm::ddt(p_rgh)
|
|
||||||
+ fvm::div(phi, p_rgh)
|
p_rghEqnComp1 =
|
||||||
- fvm::Sp(fvc::div(phi), p_rgh)
|
fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh))
|
||||||
);
|
+ fvc::div(phid1, p_rgh)
|
||||||
}
|
- fvc::Sp(fvc::div(phid1), p_rgh);
|
||||||
else
|
|
||||||
{
|
p_rghEqnComp2 =
|
||||||
p_rghEqnComp =
|
fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh))
|
||||||
(
|
+ fvc::div(phid2, p_rgh)
|
||||||
fvm::ddt(p_rgh)
|
- fvc::Sp(fvc::div(phid2), p_rgh);
|
||||||
+ fvc::div(phi, p_rgh)
|
|
||||||
- fvc::Sp(fvc::div(phi), p_rgh)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
surfaceScalarField phiHbyA
|
||||||
|
|
||||||
surfaceScalarField phiU
|
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
(
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
)*rAUf*mesh.magSf();
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
|
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||||
|
// pressure solution - done in 2 parts. Part 1:
|
||||||
|
//thermo.rho() -= psi*p_rgh;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqnIncomp
|
fvScalarMatrix p_rghEqnIncomp
|
||||||
(
|
(
|
||||||
fvc::div(phi)
|
fvc::div(phiHbyA)
|
||||||
- fvm::laplacian(rAUf, p_rgh)
|
- fvm::laplacian(rAUf, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
solve
|
solve
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
max(alpha1, scalar(0))*(psi1/rho1)
|
(max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
|
||||||
+ max(alpha2, scalar(0))*(psi2/rho2)
|
+ (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
|
||||||
)
|
)
|
||||||
*p_rghEqnComp()
|
|
||||||
+ p_rghEqnIncomp,
|
+ p_rghEqnIncomp,
|
||||||
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
|
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
|
// Second part of thermodynamic density update
|
||||||
|
//thermo.rho() += psi*p_rgh;
|
||||||
|
|
||||||
dgdt =
|
dgdt =
|
||||||
(pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
|
(
|
||||||
*(p_rghEqnComp & p_rgh);
|
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||||
phi += p_rghEqnIncomp.flux();
|
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||||
|
);
|
||||||
|
|
||||||
|
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||||
|
|
||||||
|
U = HbyA
|
||||||
|
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
p = max
|
rho1 = eos1->rho(p, T);
|
||||||
(
|
rho2 = eos2->rho(p, T);
|
||||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
|
||||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
|
||||||
pMin
|
|
||||||
);
|
|
||||||
|
|
||||||
rho1 = rho10 + psi1*p;
|
|
||||||
rho2 = rho20 + psi2*p;
|
|
||||||
|
|
||||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
phaseEquationOfState/phaseEquationOfState.C
|
||||||
|
phaseEquationOfState/newPhaseEquationOfState.C
|
||||||
|
constant/constant.C
|
||||||
|
linear/linear.C
|
||||||
|
perfectFluid/perfectFluid.C
|
||||||
|
adiabaticPerfectFluid/adiabaticPerfectFluid.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libphaseEquationsOfState
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lincompressibleTransportModels
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "adiabaticPerfectFluid.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(adiabaticPerfectFluid, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
phaseEquationOfState,
|
||||||
|
adiabaticPerfectFluid,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::adiabaticPerfectFluid::adiabaticPerfectFluid
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseEquationOfState(dict),
|
||||||
|
p0_("p0", dimPressure, dict.lookup("p0")),
|
||||||
|
rho0_("rho0", dimDensity, dict.lookup("rho0")),
|
||||||
|
gamma_("gamma", dimless, dict.lookup("gamma")),
|
||||||
|
B_("B", dimPressure, dict.lookup("B"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::adiabaticPerfectFluid::~adiabaticPerfectFluid()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::phaseEquationsOfState::adiabaticPerfectFluid::rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::phaseEquationsOfState::adiabaticPerfectFluid::psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
(rho0_/(gamma_*(p0_ + B_)))
|
||||||
|
*pow((p + B_)/(p0_ + B_), 1.0/gamma_ - 1.0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseEquationsOfState::adiabaticPerfectFluid
|
||||||
|
|
||||||
|
Description
|
||||||
|
AdiabaticPerfectFluid phase density model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
adiabaticPerfectFluid.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef adiabaticPerfectFluid_H
|
||||||
|
#define adiabaticPerfectFluid_H
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
#include "dimensionedTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class adiabaticPerfectFluid Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class adiabaticPerfectFluid
|
||||||
|
:
|
||||||
|
public phaseEquationOfState
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference pressure
|
||||||
|
dimensionedScalar p0_;
|
||||||
|
|
||||||
|
//- Reference density
|
||||||
|
dimensionedScalar rho0_;
|
||||||
|
|
||||||
|
//- The isentropic exponent
|
||||||
|
dimensionedScalar gamma_;
|
||||||
|
|
||||||
|
//- Pressure offset for a stiffened gas
|
||||||
|
dimensionedScalar B_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("adiabaticPerfectFluid");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
adiabaticPerfectFluid
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~adiabaticPerfectFluid();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
tmp<volScalarField> rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
|
||||||
|
tmp<volScalarField> psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseEquationsOfState
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constant.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(constant, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
phaseEquationOfState,
|
||||||
|
constant,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::constant::constant
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseEquationOfState(dict),
|
||||||
|
rho_("rho", dimDensity, dict.lookup("rho"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::constant::~constant()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
p.mesh(),
|
||||||
|
rho_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
p.mesh(),
|
||||||
|
dimensionedScalar("psi", dimDensity/dimPressure, 0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseEquationsOfState::constant
|
||||||
|
|
||||||
|
Description
|
||||||
|
Constant phase density model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
constant.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef constant_H
|
||||||
|
#define constant_H
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
#include "dimensionedTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class constant Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class constant
|
||||||
|
:
|
||||||
|
public phaseEquationOfState
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- The constant density of the phase
|
||||||
|
dimensionedScalar rho_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("constant");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
constant
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~constant();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
tmp<volScalarField> rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
|
||||||
|
tmp<volScalarField> psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseEquationsOfState
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "linear.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(linear, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
phaseEquationOfState,
|
||||||
|
linear,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::linear::linear
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseEquationOfState(dict),
|
||||||
|
rho0_("rho0", dimDensity, dict.lookup("rho0")),
|
||||||
|
psi_("psi", dimDensity/dimPressure, dict.lookup("psi"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::linear::~linear()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
rho0_ + psi_*p
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
p.mesh(),
|
||||||
|
psi_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseEquationsOfState::linear
|
||||||
|
|
||||||
|
Description
|
||||||
|
Linear phase density model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
linear.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef linear_H
|
||||||
|
#define linear_H
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
#include "dimensionedTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class linear Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class linear
|
||||||
|
:
|
||||||
|
public phaseEquationOfState
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- The reference density of the phase
|
||||||
|
dimensionedScalar rho0_;
|
||||||
|
|
||||||
|
//- The constant compressibility of the phase
|
||||||
|
dimensionedScalar psi_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("linear");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
linear
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~linear();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
tmp<volScalarField> rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
|
||||||
|
tmp<volScalarField> psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseEquationsOfState
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "perfectFluid.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(perfectFluid, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
phaseEquationOfState,
|
||||||
|
perfectFluid,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::perfectFluid::perfectFluid
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseEquationOfState(dict),
|
||||||
|
rho0_("rho0", dimDensity, dict.lookup("rho0")),
|
||||||
|
R_("R", dimensionSet(0, 2, -2, -1, 0), dict.lookup("R"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationsOfState::perfectFluid::~perfectFluid()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
rho0_ + psi(p, T)*p
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Foam::volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"psi",
|
||||||
|
p.time().timeName(),
|
||||||
|
p.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
1.0/(R_*T)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseEquationsOfState::perfectFluid
|
||||||
|
|
||||||
|
Description
|
||||||
|
PerfectFluid phase density model.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
perfectFluid.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef perfectFluid_H
|
||||||
|
#define perfectFluid_H
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
#include "dimensionedTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseEquationsOfState
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class perfectFluid Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class perfectFluid
|
||||||
|
:
|
||||||
|
public phaseEquationOfState
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- The reference density of the phase
|
||||||
|
dimensionedScalar rho0_;
|
||||||
|
|
||||||
|
//- The fluid constant of the phase
|
||||||
|
dimensionedScalar R_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("perfectFluid");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
perfectFluid
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~perfectFluid();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
tmp<volScalarField> rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
|
||||||
|
tmp<volScalarField> psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseEquationsOfState
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::phaseEquationOfState> Foam::phaseEquationOfState::New
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word phaseEquationOfStateType
|
||||||
|
(
|
||||||
|
dict.subDict("equationOfState").lookup("type")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Selecting phaseEquationOfState "
|
||||||
|
<< phaseEquationOfStateType << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(phaseEquationOfStateType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn("phaseEquationOfState::New")
|
||||||
|
<< "Unknown phaseEquationOfStateType type "
|
||||||
|
<< phaseEquationOfStateType << endl << endl
|
||||||
|
<< "Valid phaseEquationOfState types are : " << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cstrIter()(dict.subDict("equationOfState"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "phaseEquationOfState.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(phaseEquationOfState, 0);
|
||||||
|
defineRunTimeSelectionTable(phaseEquationOfState, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationOfState::phaseEquationOfState
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
dict_(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseEquationOfState::~phaseEquationOfState()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,127 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseEquationOfState
|
||||||
|
|
||||||
|
Description
|
||||||
|
A2stract base-class for dispersed-phase particle diameter models.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
phaseEquationOfState.C
|
||||||
|
newDiameterModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef phaseEquationOfState_H
|
||||||
|
#define phaseEquationOfState_H
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class phaseEquationOfState Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class phaseEquationOfState
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
const dictionary& dict_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("phaseEquationOfState");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare runtime construction
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
phaseEquationOfState,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
phaseEquationOfState
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~phaseEquationOfState();
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
static autoPtr<phaseEquationOfState> New
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the phase density
|
||||||
|
virtual tmp<volScalarField> rho
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
//- Return the phase compressibility
|
||||||
|
virtual tmp<volScalarField> psi
|
||||||
|
(
|
||||||
|
const volScalarField& p,
|
||||||
|
const volScalarField& T
|
||||||
|
) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,29 +1,35 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
surfaceScalarField phiU
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
mrfZones.relativeFlux(phiU);
|
mrfZones.relativeFlux(phiHbyA);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
(
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
(
|
||||||
- ghf*fvc::snGrad(rho)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
)*rAUf*mesh.magSf();
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -32,13 +38,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -12,20 +12,6 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading field alpha1\n" << endl;
|
|
||||||
volScalarField alpha1
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"alpha1",
|
|
||||||
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
|
||||||
(
|
(
|
||||||
@ -46,6 +32,8 @@
|
|||||||
Info<< "Reading transportProperties\n" << endl;
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
twoPhaseMixture twoPhaseProperties(U, phi);
|
twoPhaseMixture twoPhaseProperties(U, phi);
|
||||||
|
|
||||||
|
volScalarField& alpha1(twoPhaseProperties.alpha1());
|
||||||
|
|
||||||
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
|
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
|
||||||
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
|
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
|
||||||
|
|
||||||
|
|||||||
@ -1,31 +1,39 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
phiAbs =
|
surfaceScalarField phiHbyA
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs);
|
"phiHbyA",
|
||||||
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs)
|
||||||
|
);
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
if (p_rgh.needReference())
|
||||||
{
|
{
|
||||||
fvc::makeRelative(phiAbs, U);
|
fvc::makeRelative(phiHbyA, U);
|
||||||
adjustPhi(phiAbs, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
fvc::makeAbsolute(phiAbs, U);
|
fvc::makeAbsolute(phiHbyA, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
phi = phiAbs +
|
surfaceScalarField phig
|
||||||
(
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
(
|
||||||
- ghf*fvc::snGrad(rho)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
)*rAUf*mesh.magSf();
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -34,13 +42,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiAbs)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
phiAbs = phi;
|
phiAbs = phi;
|
||||||
|
|||||||
@ -1,28 +1,34 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
surfaceScalarField phiU
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
(
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
(
|
||||||
- ghf*fvc::snGrad(rho)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
)*rAUf*mesh.magSf();
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -31,13 +37,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,24 +1,28 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi =
|
surfaceScalarField phig
|
||||||
phiU
|
(
|
||||||
+ (
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
)*rAUf*mesh.magSf();
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
|
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
|
||||||
const volScalarField& vDotcP = vDotP[0]();
|
const volScalarField& vDotcP = vDotP[0]();
|
||||||
@ -28,7 +32,7 @@
|
|||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvc::div(phi) - fvm::laplacian(rAUf, p_rgh)
|
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
||||||
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -38,13 +42,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi += p_rghEqn.flux();
|
phi = phiHbyA + p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,31 +1,32 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
//+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
mrfZones.relativeFlux(phiU);
|
mrfZones.relativeFlux(phiHbyA);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi =
|
surfaceScalarField phig
|
||||||
phiU
|
(
|
||||||
+ (
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
mixture.surfaceTensionForce()
|
);
|
||||||
- ghf*fvc::snGrad(rho)
|
|
||||||
)*rAUf*mesh.magSf();
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -34,13 +35,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,29 +1,34 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
(
|
(
|
||||||
mixture.surfaceTensionForce()
|
(
|
||||||
- ghf*fvc::snGrad(rho)
|
mixture.surfaceTensionForce()
|
||||||
)*rAUf*mesh.magSf();
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -32,13 +37,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,54 +1,61 @@
|
|||||||
volScalarField rAU(1.0/UEqn.A());
|
|
||||||
|
|
||||||
surfaceScalarField rAUf
|
|
||||||
(
|
|
||||||
"(rho*(1|A(U)))",
|
|
||||||
fvc::interpolate(rho)*fvc::interpolate(rAU)
|
|
||||||
);
|
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
|
||||||
phi =
|
|
||||||
fvc::interpolate(rho)
|
|
||||||
*(
|
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
surfaceScalarField phiU("phiU", phi);
|
|
||||||
phi -= ghf*fvc::snGrad(rho)*rAUf*mesh.magSf();
|
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
|
|
||||||
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phi)
|
"phiHbyA",
|
||||||
|
fvc::interpolate(rho)
|
||||||
|
*(
|
||||||
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
phiHbyA += phig;
|
||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
fvScalarMatrix p_rghEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phiHbyA)
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
|
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||||
|
|
||||||
|
if (pimple.finalNonOrthogonalIter())
|
||||||
|
{
|
||||||
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p == p_rgh + rho*gh;
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
|
{
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
|
);
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "rhoEqn.H"
|
||||||
|
#include "compressibleContinuityErrs.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
|
||||||
{
|
|
||||||
p += dimensionedScalar
|
|
||||||
(
|
|
||||||
"p",
|
|
||||||
p.dimensions(),
|
|
||||||
pRefValue - getRefCellValue(p, pRefCell)
|
|
||||||
);
|
|
||||||
p_rgh = p - rho*gh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
|
||||||
#include "compressibleContinuityErrs.H"
|
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|||||||
@ -12,20 +12,6 @@
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Reading field alpha1\n" << endl;
|
|
||||||
volScalarField alpha1
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"alpha1",
|
|
||||||
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
|
||||||
(
|
(
|
||||||
@ -45,6 +31,8 @@
|
|||||||
Info<< "Reading transportProperties\n" << endl;
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
twoPhaseMixture twoPhaseProperties(U, phi);
|
twoPhaseMixture twoPhaseProperties(U, phi);
|
||||||
|
|
||||||
|
volScalarField& alpha1(twoPhaseProperties.alpha1());
|
||||||
|
|
||||||
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
|
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
|
||||||
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
|
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
|
||||||
|
|
||||||
|
|||||||
@ -1,24 +1,31 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
surfaceScalarField phiU
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU - ghf*fvc::snGrad(rho)*rAUf*mesh.magSf();
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -27,13 +34,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
162
applications/test/LduMatrix/LduMatrixTest.C
Normal file
162
applications/test/LduMatrix/LduMatrixTest.C
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "LduMatrix.H"
|
||||||
|
#include "diagTensorField.H"
|
||||||
|
#include "TPCG.H"
|
||||||
|
#include "TPBiCG.H"
|
||||||
|
#include "NoPreconditioner.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
typedef Foam::LduMatrix<vector, diagTensor, scalar>
|
||||||
|
lduVectorMatrix;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||||
|
|
||||||
|
typedef Foam::DiagonalSolver<vector, diagTensor, scalar>
|
||||||
|
lduVectorDiagonalSolver;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef LduMatrix<vector, diagTensor, scalar>::preconditioner
|
||||||
|
lduVectorPreconditioner;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, diagTensor, scalar>::smoother
|
||||||
|
lduVectorSmoother;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, diagTensor, scalar>::solver
|
||||||
|
lduVectorSolver;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||||
|
|
||||||
|
typedef TPCG<vector, diagTensor, scalar> TPCGVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||||
|
addsymMatrixConstructorToTable<TPCGVector>
|
||||||
|
addTPCGSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
typedef TPBiCG<vector, diagTensor, scalar> TPBiCGVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||||
|
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||||
|
addTPBiCGSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
typedef NoPreconditioner<vector, diagTensor, scalar> NoPreconditionerVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||||
|
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||||
|
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||||
|
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||||
|
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
volVectorField psi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
lduVectorMatrix testMatrix(mesh);
|
||||||
|
testMatrix.diag() = 2*pTraits<diagTensor>::one;
|
||||||
|
testMatrix.source() = pTraits<vector>::one;
|
||||||
|
testMatrix.upper() = 0.1;
|
||||||
|
testMatrix.lower() = -0.1;
|
||||||
|
|
||||||
|
Info<< testMatrix << endl;
|
||||||
|
|
||||||
|
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||||
|
FieldField<Field, scalar> internalCoeffs(0);
|
||||||
|
|
||||||
|
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||||
|
lduVectorMatrix::solver::New
|
||||||
|
(
|
||||||
|
psi.name(),
|
||||||
|
testMatrix,
|
||||||
|
boundaryCoeffs,
|
||||||
|
internalCoeffs,
|
||||||
|
psi.boundaryField().interfaces(),
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"PBiCG"
|
||||||
|
"{"
|
||||||
|
" preconditioner none;"
|
||||||
|
" tolerance (1e-05 1e-05 1e-05);"
|
||||||
|
" relTol (0 0 0);"
|
||||||
|
"}"
|
||||||
|
)()
|
||||||
|
);
|
||||||
|
|
||||||
|
lduVectorMatrix::solverPerformance solverPerf =
|
||||||
|
testMatrixSolver->solve(psi);
|
||||||
|
|
||||||
|
solverPerf.print();
|
||||||
|
|
||||||
|
Info<< psi << endl;
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
162
applications/test/LduMatrix/LduMatrixTest2.C
Normal file
162
applications/test/LduMatrix/LduMatrixTest2.C
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "LduMatrix.H"
|
||||||
|
#include "tensorField.H"
|
||||||
|
#include "TPCG.H"
|
||||||
|
#include "TPBiCG.H"
|
||||||
|
#include "NoPreconditioner.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
typedef Foam::LduMatrix<vector, tensor, scalar>
|
||||||
|
lduVectorMatrix;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||||
|
|
||||||
|
typedef Foam::DiagonalSolver<vector, tensor, scalar>
|
||||||
|
lduVectorDiagonalSolver;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef LduMatrix<vector, tensor, scalar>::preconditioner
|
||||||
|
lduVectorPreconditioner;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, tensor, scalar>::smoother
|
||||||
|
lduVectorSmoother;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, tensor, scalar>::solver
|
||||||
|
lduVectorSolver;
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||||
|
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||||
|
|
||||||
|
typedef TPCG<vector, tensor, scalar> TPCGVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, tensor, scalar>::solver::
|
||||||
|
addsymMatrixConstructorToTable<TPCGVector>
|
||||||
|
addTPCGSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
typedef TPBiCG<vector, tensor, scalar> TPBiCGVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, tensor, scalar>::solver::
|
||||||
|
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||||
|
addTPBiCGSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
typedef NoPreconditioner<vector, tensor, scalar> NoPreconditionerVector;
|
||||||
|
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||||
|
|
||||||
|
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||||
|
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||||
|
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||||
|
|
||||||
|
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||||
|
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||||
|
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
volVectorField psi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
lduVectorMatrix testMatrix(mesh);
|
||||||
|
testMatrix.diag() = 2*I;
|
||||||
|
testMatrix.source() = pTraits<vector>::one;
|
||||||
|
testMatrix.upper() = 0.1;
|
||||||
|
testMatrix.lower() = -0.1;
|
||||||
|
|
||||||
|
Info<< testMatrix << endl;
|
||||||
|
|
||||||
|
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||||
|
FieldField<Field, scalar> internalCoeffs(0);
|
||||||
|
|
||||||
|
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||||
|
lduVectorMatrix::solver::New
|
||||||
|
(
|
||||||
|
psi.name(),
|
||||||
|
testMatrix,
|
||||||
|
//boundaryCoeffs,
|
||||||
|
//internalCoeffs,
|
||||||
|
//psi.boundaryField().interfaces(),
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"PBiCG"
|
||||||
|
"{"
|
||||||
|
" preconditioner none;"
|
||||||
|
" tolerance (1e-05 1e-05 1e-05);"
|
||||||
|
" relTol (0 0 0);"
|
||||||
|
"}"
|
||||||
|
)()
|
||||||
|
);
|
||||||
|
|
||||||
|
lduVectorMatrix::solverPerformance solverPerf =
|
||||||
|
testMatrixSolver->solve(psi);
|
||||||
|
|
||||||
|
solverPerf.print();
|
||||||
|
|
||||||
|
Info<< psi << endl;
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
147
applications/test/LduMatrix/LduMatrixTest3.C
Normal file
147
applications/test/LduMatrix/LduMatrixTest3.C
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
icoFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Transient solver for incompressible, laminar flow of Newtonian fluids.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "LduMatrix.H"
|
||||||
|
#include "diagTensorField.H"
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, scalar, scalar> lduVectorMatrix;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createFields.H"
|
||||||
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
#include "readPISOControls.H"
|
||||||
|
#include "CourantNo.H"
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(U)
|
||||||
|
+ fvm::div(phi, U)
|
||||||
|
- fvm::laplacian(nu, U)
|
||||||
|
);
|
||||||
|
|
||||||
|
fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
|
||||||
|
|
||||||
|
lduVectorMatrix U3Eqnp(mesh);
|
||||||
|
U3Eqnp.diag() = UEqnp.diag();
|
||||||
|
U3Eqnp.upper() = UEqnp.upper();
|
||||||
|
U3Eqnp.lower() = UEqnp.lower();
|
||||||
|
U3Eqnp.source() = UEqnp.source();
|
||||||
|
|
||||||
|
UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
|
||||||
|
UEqnp.addBoundarySource(U3Eqnp.source(), false);
|
||||||
|
|
||||||
|
autoPtr<lduVectorMatrix::solver> U3EqnpSolver =
|
||||||
|
lduVectorMatrix::solver::New
|
||||||
|
(
|
||||||
|
U.name(),
|
||||||
|
U3Eqnp,
|
||||||
|
dictionary
|
||||||
|
(
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"{"
|
||||||
|
" solver PBiCG;"
|
||||||
|
" preconditioner DILU;"
|
||||||
|
" tolerance (1e-5 1e-5 1);"
|
||||||
|
" relTol (0 0 0);"
|
||||||
|
"}"
|
||||||
|
)()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
U3EqnpSolver->solve(U).print(Info);
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
volScalarField rAU = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
U = rAU*UEqn.H();
|
||||||
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU, U, phi);
|
||||||
|
|
||||||
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
pEqn.solve();
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi -= pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
U -= rAU*fvc::grad(p);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
3
applications/test/LduMatrix/Make/files
Normal file
3
applications/test/LduMatrix/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
LduMatrixTest3.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/LduMatrixTest
|
||||||
4
applications/test/LduMatrix/Make/options
Normal file
4
applications/test/LduMatrix/Make/options
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = -lfiniteVolume
|
||||||
55
applications/test/LduMatrix/createFields.H
Normal file
55
applications/test/LduMatrix/createFields.H
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
|
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar nu
|
||||||
|
(
|
||||||
|
transportProperties.lookup("nu")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field p\n" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Reading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
|
||||||
|
label pRefCell = 0;
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
|
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||||
3
applications/test/PisoFoam/Make/files
Normal file
3
applications/test/PisoFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PisoFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/PisoFoam
|
||||||
13
applications/test/PisoFoam/Make/options
Normal file
13
applications/test/PisoFoam/Make/options
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lincompressibleTurbulenceModel \
|
||||||
|
-lincompressibleRASModels \
|
||||||
|
-lincompressibleLESModels \
|
||||||
|
-lincompressibleTransportModels \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
191
applications/test/PisoFoam/PisoFoam.C
Normal file
191
applications/test/PisoFoam/PisoFoam.C
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
pisoFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Transient solver for incompressible flow.
|
||||||
|
|
||||||
|
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "singlePhaseTransportModel.H"
|
||||||
|
#include "turbulenceModel.H"
|
||||||
|
|
||||||
|
#include "LduMatrix.H"
|
||||||
|
#include "diagTensorField.H"
|
||||||
|
|
||||||
|
typedef LduMatrix<vector, scalar, scalar> lduVectorMatrix;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createFields.H"
|
||||||
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
#include "readPISOControls.H"
|
||||||
|
#include "CourantNo.H"
|
||||||
|
|
||||||
|
// Pressure-velocity PISO corrector
|
||||||
|
{
|
||||||
|
// Momentum predictor
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(U)
|
||||||
|
+ fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevReff(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
//UEqn.relax();
|
||||||
|
|
||||||
|
fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
|
||||||
|
|
||||||
|
lduVectorMatrix U3Eqnp(mesh);
|
||||||
|
U3Eqnp.diag() = UEqnp.diag();
|
||||||
|
U3Eqnp.upper() = UEqnp.upper();
|
||||||
|
U3Eqnp.lower() = UEqnp.lower();
|
||||||
|
U3Eqnp.source() = UEqnp.source();
|
||||||
|
|
||||||
|
UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
|
||||||
|
UEqnp.addBoundarySource(U3Eqnp.source(), false);
|
||||||
|
|
||||||
|
U3Eqnp.interfaces() = U.boundaryField().interfaces();
|
||||||
|
U3Eqnp.interfacesUpper() = UEqnp.boundaryCoeffs().component(0);
|
||||||
|
U3Eqnp.interfacesLower() = UEqnp.internalCoeffs().component(0);
|
||||||
|
|
||||||
|
autoPtr<lduVectorMatrix::solver> U3EqnpSolver =
|
||||||
|
lduVectorMatrix::solver::New
|
||||||
|
(
|
||||||
|
U.name(),
|
||||||
|
U3Eqnp,
|
||||||
|
dictionary
|
||||||
|
(
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"{"
|
||||||
|
" /*solver SmoothSolver;*/"
|
||||||
|
" smoother GaussSeidel;"
|
||||||
|
" solver PBiCCCG;"
|
||||||
|
" preconditioner none;"
|
||||||
|
" tolerance (1e-7 1e-7 1);"
|
||||||
|
" relTol (0 0 0);"
|
||||||
|
"}"
|
||||||
|
)()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//for (int i=0; i<3; i++)
|
||||||
|
{
|
||||||
|
U3EqnpSolver->solve(U).print(Info);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
//solve(UEqnp);
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
|
|
||||||
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
|
(
|
||||||
|
"phiHbyA",
|
||||||
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU, U, phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
adjustPhi(phiHbyA, U, p);
|
||||||
|
|
||||||
|
// Non-orthogonal pressure corrector loop
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
// Pressure corrector
|
||||||
|
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
|
||||||
|
);
|
||||||
|
|
||||||
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pEqn.solve(mesh.solver("pFinal"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pEqn.solve();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi = phiHbyA - pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
U = HbyA - rAU*fvc::grad(p);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
42
applications/test/PisoFoam/createFields.H
Normal file
42
applications/test/PisoFoam/createFields.H
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
Info<< "Reading field p\n" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
|
||||||
|
label pRefCell = 0;
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
|
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||||
|
|
||||||
|
|
||||||
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
|
autoPtr<incompressible::turbulenceModel> turbulence
|
||||||
|
(
|
||||||
|
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||||
|
);
|
||||||
206
applications/test/extendedStencil/Test-ExtendedStencil2.C
Normal file
206
applications/test/extendedStencil/Test-ExtendedStencil2.C
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
testExtendedStencil2
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test app for determining extended cell-to-cell stencil.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
|
||||||
|
#include "CFCCellToCellStencil.H"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void writeStencilOBJ
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const point& fc,
|
||||||
|
const List<point>& stencilCc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OFstream str(fName);
|
||||||
|
label vertI = 0;
|
||||||
|
|
||||||
|
meshTools::writeOBJ(str, fc);
|
||||||
|
vertI++;
|
||||||
|
|
||||||
|
forAll(stencilCc, i)
|
||||||
|
{
|
||||||
|
meshTools::writeOBJ(str, stencilCc[i]);
|
||||||
|
vertI++;
|
||||||
|
str << "l 1 " << vertI << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Stats
|
||||||
|
void writeStencilStats(const labelListList& stencil)
|
||||||
|
{
|
||||||
|
label sumSize = 0;
|
||||||
|
label nSum = 0;
|
||||||
|
label minSize = labelMax;
|
||||||
|
label maxSize = labelMin;
|
||||||
|
|
||||||
|
forAll(stencil, i)
|
||||||
|
{
|
||||||
|
const labelList& sCells = stencil[i];
|
||||||
|
|
||||||
|
if (sCells.size() > 0)
|
||||||
|
{
|
||||||
|
sumSize += sCells.size();
|
||||||
|
nSum++;
|
||||||
|
minSize = min(minSize, sCells.size());
|
||||||
|
maxSize = max(maxSize, sCells.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reduce(sumSize, sumOp<label>());
|
||||||
|
reduce(nSum, sumOp<label>());
|
||||||
|
sumSize /= nSum;
|
||||||
|
|
||||||
|
reduce(minSize, minOp<label>());
|
||||||
|
reduce(maxSize, maxOp<label>());
|
||||||
|
|
||||||
|
Info<< "Stencil size :" << nl
|
||||||
|
<< " average : " << sumSize << nl
|
||||||
|
<< " min : " << minSize << nl
|
||||||
|
<< " max : " << maxSize << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "addTimeOptions.H"
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
// Get times list
|
||||||
|
instantList Times = runTime.times();
|
||||||
|
# include "checkTimeOptions.H"
|
||||||
|
runTime.setTime(Times[startTime], startTime);
|
||||||
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
|
||||||
|
//---- CELL CENTRED STENCIL -----
|
||||||
|
|
||||||
|
// Centred, cell stencil
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
{
|
||||||
|
// Full stencil. This is per local cell a set of global indices, either
|
||||||
|
// into cells or also boundary faces.
|
||||||
|
CFCCellToCellStencil stencil(mesh);
|
||||||
|
|
||||||
|
// Construct exchange map and renumber stencil
|
||||||
|
List<Map<label> > compactMap(Pstream::nProcs());
|
||||||
|
mapDistribute map
|
||||||
|
(
|
||||||
|
stencil.globalNumbering(),
|
||||||
|
stencil,
|
||||||
|
compactMap
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Print some stats
|
||||||
|
Info<< "cellFaceCell:" << endl;
|
||||||
|
writeStencilStats(stencil);
|
||||||
|
|
||||||
|
|
||||||
|
// Collect the data in stencil form
|
||||||
|
List<List<vector> > stencilPoints;
|
||||||
|
{
|
||||||
|
const volVectorField& fld = mesh.C();
|
||||||
|
|
||||||
|
// 1. Construct cell data in compact addressing
|
||||||
|
List<point> compactFld(map.constructSize(), pTraits<point>::zero);
|
||||||
|
|
||||||
|
// Insert my internal values
|
||||||
|
forAll(fld, cellI)
|
||||||
|
{
|
||||||
|
compactFld[cellI] = fld[cellI];
|
||||||
|
}
|
||||||
|
// Insert my boundary values
|
||||||
|
label nCompact = fld.size();
|
||||||
|
forAll(fld.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
const fvPatchField<vector>& pfld = fld.boundaryField()[patchI];
|
||||||
|
|
||||||
|
forAll(pfld, i)
|
||||||
|
{
|
||||||
|
compactFld[nCompact++] = pfld[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do all swapping
|
||||||
|
map.distribute(compactFld);
|
||||||
|
|
||||||
|
// 2. Pull to stencil
|
||||||
|
stencilPoints.setSize(stencil.size());
|
||||||
|
|
||||||
|
forAll(stencil, cellI)
|
||||||
|
{
|
||||||
|
const labelList& compactCells = stencil[cellI];
|
||||||
|
|
||||||
|
stencilPoints[cellI].setSize(compactCells.size());
|
||||||
|
|
||||||
|
forAll(compactCells, i)
|
||||||
|
{
|
||||||
|
stencilPoints[cellI][i] = compactFld[compactCells[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
forAll(stencilPoints, cellI)
|
||||||
|
{
|
||||||
|
writeStencilOBJ
|
||||||
|
(
|
||||||
|
runTime.path()/"centredCell" + Foam::name(cellI) + ".obj",
|
||||||
|
mesh.cellCentres()[cellI],
|
||||||
|
stencilPoints[cellI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pout<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -214,7 +214,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
|||||||
|
|
||||||
forAll(localPoints, i)
|
forAll(localPoints, i)
|
||||||
{
|
{
|
||||||
const point pt = localPoints[i] + 1E-4*rndGen.vector01();
|
const point pt = localPoints[i] + 1e-4*rndGen.vector01();
|
||||||
|
|
||||||
label meshPointI = allBoundary.meshPoints()[i];
|
label meshPointI = allBoundary.meshPoints()[i];
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
|||||||
{
|
{
|
||||||
const edge& e = edges[i];
|
const edge& e = edges[i];
|
||||||
|
|
||||||
const point pt = e.centre(localPoints) + 1E-4*rndGen.vector01();
|
const point pt = e.centre(localPoints) + 1e-4*rndGen.vector01();
|
||||||
|
|
||||||
label meshEdgeI = meshEdges[i];
|
label meshEdgeI = meshEdges[i];
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -58,7 +58,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
|
|
||||||
// Max cos angle for edges to be considered aligned with axis.
|
// Max cos angle for edges to be considered aligned with axis.
|
||||||
static const scalar edgeTol = 1E-3;
|
static const scalar edgeTol = 1e-3;
|
||||||
|
|
||||||
|
|
||||||
void writeSet(const cellSet& cells, const string& msg)
|
void writeSet(const cellSet& cells, const string& msg)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
boundaryPoint,
|
boundaryPoint,
|
||||||
1E-9, // factor of largest face area
|
1e-9, // factor of largest face area
|
||||||
5, // factor between smallest and largest edge on
|
5, // factor between smallest and largest edge on
|
||||||
// face
|
// face
|
||||||
collapser
|
collapser
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,7 +31,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::scalar Foam::edgeStats::edgeTol_ = 1E-3;
|
const Foam::scalar Foam::edgeStats::edgeTol_ = 1e-3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ EXE_INC = \
|
|||||||
${EXE_NDEBUG} \
|
${EXE_NDEBUG} \
|
||||||
${CGAL_INC} \
|
${CGAL_INC} \
|
||||||
-I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
|
-I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
|
||||||
-I$(FOAM_APP)/utilities/mesh/generation/extrude/extrudeModel/lnInclude \
|
|
||||||
-IconformalVoronoi2DMesh/lnInclude \
|
-IconformalVoronoi2DMesh/lnInclude \
|
||||||
-I$(FOAM_APP)/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/lnInclude \
|
-I$(FOAM_APP)/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
@ -18,10 +17,13 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude \
|
||||||
-I$(LIB_SRC)/triSurface/lnInclude
|
-I$(LIB_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
|
-lboost_thread \
|
||||||
|
-lmpfr \
|
||||||
-lextrude2DMesh \
|
-lextrude2DMesh \
|
||||||
-lextrudeModel \
|
-lextrudeModel \
|
||||||
-lcv2DMesh \
|
-lcv2DMesh \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
|
|||||||
const pointField& points = pMesh.points();
|
const pointField& points = pMesh.points();
|
||||||
|
|
||||||
const boundBox& bb = pMesh.bounds();
|
const boundBox& bb = pMesh.bounds();
|
||||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
const scalar mergeDim = 1e-4 * bb.minDim();
|
||||||
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,6 +22,8 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
|
-lboost_thread \
|
||||||
|
-lmpfr \
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldecompositionMethods \
|
-ldecompositionMethods \
|
||||||
|
|||||||
@ -45,8 +45,6 @@ SourceFiles
|
|||||||
#ifndef conformalVoronoiMesh_H
|
#ifndef conformalVoronoiMesh_H
|
||||||
#define conformalVoronoiMesh_H
|
#define conformalVoronoiMesh_H
|
||||||
|
|
||||||
#define CGAL_INEXACT
|
|
||||||
|
|
||||||
#include "CGALTriangulation3Ddefs.H"
|
#include "CGALTriangulation3Ddefs.H"
|
||||||
#include "uint.H"
|
#include "uint.H"
|
||||||
#include "ulong.H"
|
#include "ulong.H"
|
||||||
|
|||||||
@ -561,7 +561,7 @@ Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices
|
|||||||
scalar closenessTolerance = cvMeshControls().mergeClosenessCoeff();
|
scalar closenessTolerance = cvMeshControls().mergeClosenessCoeff();
|
||||||
|
|
||||||
// Absolute distance for points to be considered coincident. Bit adhoc
|
// Absolute distance for points to be considered coincident. Bit adhoc
|
||||||
// but points were seen with distSqr ~ 1E-30 which is SMALL^2. Add a few
|
// but points were seen with distSqr ~ 1e-30 which is SMALL^2. Add a few
|
||||||
// digits to account for truncation errors.
|
// digits to account for truncation errors.
|
||||||
scalar coincidentDistanceSqr = sqr
|
scalar coincidentDistanceSqr = sqr
|
||||||
(
|
(
|
||||||
|
|||||||
@ -19,6 +19,8 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
|
-lboost_thread \
|
||||||
|
-lmpfr \
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \
|
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \
|
||||||
-ledgeMesh \
|
-ledgeMesh \
|
||||||
|
|||||||
@ -51,7 +51,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
||||||
// usually meshes get written with limited precision (6 digits)
|
// usually meshes get written with limited precision (6 digits)
|
||||||
static const scalar defaultMergeTol = 1E-6;
|
static const scalar defaultMergeTol = 1e-6;
|
||||||
|
|
||||||
// Get merging distance when matching face centres
|
// Get merging distance when matching face centres
|
||||||
scalar getMergeDistance
|
scalar getMergeDistance
|
||||||
@ -397,7 +397,7 @@ int main(int argc, char *argv[])
|
|||||||
"mergeTol",
|
"mergeTol",
|
||||||
"scalar",
|
"scalar",
|
||||||
"specify the merge distance relative to the bounding box size "
|
"specify the merge distance relative to the bounding box size "
|
||||||
"(default 1E-6)"
|
"(default 1e-6)"
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|||||||
@ -14,6 +14,8 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
|
-lboost_thread \
|
||||||
|
-lmpfr \
|
||||||
-L$(FASTDUALOCTREE_SRC_PATH) -lperf_main \
|
-L$(FASTDUALOCTREE_SRC_PATH) -lperf_main \
|
||||||
-lGL \
|
-lGL \
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
wclean libso extrudeModel
|
|
||||||
wclean extrudeMesh
|
wclean extrudeMesh
|
||||||
wclean extrudeToRegionMesh
|
wclean extrudeToRegionMesh
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,7 @@
|
|||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
wmake libso extrudeModel
|
|
||||||
wmake extrudeMesh
|
wmake extrudeMesh
|
||||||
|
|
||||||
wmake libso extrudeToRegionMesh/createShellMesh
|
|
||||||
wmake extrudeToRegionMesh
|
wmake extrudeToRegionMesh
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-IextrudedMesh \
|
-IextrudedMesh \
|
||||||
-I../extrudeModel/lnInclude \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -666,7 +666,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const boundBox& bb = mesh.bounds();
|
const boundBox& bb = mesh.bounds();
|
||||||
const vector span = bb.span();
|
const vector span = bb.span();
|
||||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
const scalar mergeDim = 1e-4 * bb.minDim();
|
||||||
|
|
||||||
Info<< "Mesh bounding box : " << bb << nl
|
Info<< "Mesh bounding box : " << bb << nl
|
||||||
<< " with span : " << span << nl
|
<< " with span : " << span << nl
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I../extrudeModel/lnInclude \
|
|
||||||
-IcreateShellMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lextrudeModel \
|
|
||||||
-lcreateShellMesh \
|
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh
|
-ldynamicMesh \
|
||||||
|
-lextrudeModel
|
||||||
|
|||||||
@ -3,7 +3,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-Iextrude2DMesh/lnInclude \
|
-Iextrude2DMesh/lnInclude \
|
||||||
-I../extrude/extrudeModel/lnInclude
|
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lsurfMesh \
|
-lsurfMesh \
|
||||||
|
|||||||
@ -4,7 +4,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(FOAM_APP)/utilities/mesh/generation/extrude/extrudeModel/lnInclude
|
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
|
|||||||
@ -257,7 +257,7 @@ int main(int argc, char *argv[])
|
|||||||
const pointField& points = mesh().points();
|
const pointField& points = mesh().points();
|
||||||
|
|
||||||
const boundBox& bb = mesh().bounds();
|
const boundBox& bb = mesh().bounds();
|
||||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
const scalar mergeDim = 1e-4 * bb.minDim();
|
||||||
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,8 +41,8 @@ Foam::label Foam::findOppositeWedge
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
pp.size() == wpp.size()
|
pp.size() == wpp.size()
|
||||||
&& mag(pp.axis() & wpp.axis()) >= (1-1E-3)
|
&& mag(pp.axis() & wpp.axis()) >= (1-1e-3)
|
||||||
&& mag(ppCosAngle - wppCosAngle) >= 1E-3
|
&& mag(ppCosAngle - wppCosAngle) >= 1e-3
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return patchI;
|
return patchI;
|
||||||
@ -106,7 +106,7 @@ bool Foam::checkWedges
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (mag(opp.axis() & pp.axis()) < (1-1E-3))
|
if (mag(opp.axis() & pp.axis()) < (1-1e-3))
|
||||||
{
|
{
|
||||||
if (report)
|
if (report)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,15 +37,24 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# include "addOverwriteOption.H"
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
const bool overwrite = args.optionFound("overwrite");
|
||||||
|
|
||||||
|
if (!overwrite)
|
||||||
|
{
|
||||||
|
runTime++;
|
||||||
|
}
|
||||||
|
|
||||||
mirrorFvMesh mesh
|
mirrorFvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
mirrorFvMesh::defaultRegion,
|
mirrorFvMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,7 +52,7 @@ void Foam::meshDualiser::checkPolyTopoChange(const polyTopoChange& meshMod)
|
|||||||
label nUnique = mergePoints
|
label nUnique = mergePoints
|
||||||
(
|
(
|
||||||
points,
|
points,
|
||||||
1E-6,
|
1e-6,
|
||||||
false,
|
false,
|
||||||
oldToNew
|
oldToNew
|
||||||
);
|
);
|
||||||
@ -226,7 +226,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
|||||||
label nUnique = mergePoints
|
label nUnique = mergePoints
|
||||||
(
|
(
|
||||||
facePoints,
|
facePoints,
|
||||||
1E-6,
|
1e-6,
|
||||||
false,
|
false,
|
||||||
oldToNew
|
oldToNew
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,7 +52,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
|
|
||||||
// Max cos angle for edges to be considered aligned with axis.
|
// Max cos angle for edges to be considered aligned with axis.
|
||||||
static const scalar edgeTol = 1E-3;
|
static const scalar edgeTol = 1e-3;
|
||||||
|
|
||||||
|
|
||||||
// Calculate some edge statistics on mesh.
|
// Calculate some edge statistics on mesh.
|
||||||
@ -206,7 +206,7 @@ label twoDNess(const polyMesh& mesh)
|
|||||||
minLen = min(minLen, mesh.edges()[cEdges[i]].mag(mesh.points()));
|
minLen = min(minLen, mesh.edges()[cEdges[i]].mag(mesh.points()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cellPlane.distance(ctrs[cellI]) > 1E-6*minLen)
|
if (cellPlane.distance(ctrs[cellI]) > 1e-6*minLen)
|
||||||
{
|
{
|
||||||
// Centres not in plane
|
// Centres not in plane
|
||||||
return -1;
|
return -1;
|
||||||
@ -274,7 +274,7 @@ label twoDNess(const polyMesh& mesh)
|
|||||||
|
|
||||||
const scalarField cosAngle(mag(n/mag(n) & cellPlane.normal()));
|
const scalarField cosAngle(mag(n/mag(n) & cellPlane.normal()));
|
||||||
|
|
||||||
if (mag(min(cosAngle) - max(cosAngle)) > 1E-6)
|
if (mag(min(cosAngle) - max(cosAngle)) > 1e-6)
|
||||||
{
|
{
|
||||||
// cosAngle should be either ~1 over all faces (2D front and
|
// cosAngle should be either ~1 over all faces (2D front and
|
||||||
// back) or ~0 (all other patches perp to 2D)
|
// back) or ~0 (all other patches perp to 2D)
|
||||||
|
|||||||
@ -1036,6 +1036,22 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
UIndirectList<label>(faceProcAddressing, map().faceMap())
|
UIndirectList<label>(faceProcAddressing, map().faceMap())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Detect any flips.
|
||||||
|
const labelHashSet& fff = map().flipFaceFlux();
|
||||||
|
forAllConstIter(labelHashSet, fff, iter)
|
||||||
|
{
|
||||||
|
label faceI = iter.key();
|
||||||
|
label masterFaceI = faceProcAddressing[faceI];
|
||||||
|
|
||||||
|
faceProcAddressing[faceI] = -masterFaceI;
|
||||||
|
|
||||||
|
if (masterFaceI == 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable()) << "problem faceI:" << faceI
|
||||||
|
<< " masterFaceI:" << masterFaceI << exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pointProcAddressing.headerOk())
|
if (pointProcAddressing.headerOk())
|
||||||
{
|
{
|
||||||
@ -1083,9 +1099,13 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
Info<< "After renumbering :" << nl
|
Info<< "After renumbering :" << nl
|
||||||
<< " band : " << band << nl
|
<< " band : " << band << nl
|
||||||
<< " profile : " << profile << nl
|
<< " profile : " << profile << nl;
|
||||||
<< " rms frontwidth : " << rmsFrontwidth << nl
|
if (doFrontWidth)
|
||||||
<< endl;
|
{
|
||||||
|
|
||||||
|
Info<< " rms frontwidth : " << rmsFrontwidth << nl;
|
||||||
|
}
|
||||||
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderPoints)
|
if (orderPoints)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,7 +55,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
||||||
// usually meshes get written with limited precision (6 digits)
|
// usually meshes get written with limited precision (6 digits)
|
||||||
static const scalar defaultMergeTol = 1E-7;
|
static const scalar defaultMergeTol = 1e-7;
|
||||||
|
|
||||||
|
|
||||||
static void renumber
|
static void renumber
|
||||||
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
|
|||||||
"mergeTol",
|
"mergeTol",
|
||||||
"scalar",
|
"scalar",
|
||||||
"specify the merge distance relative to the bounding box size "
|
"specify the merge distance relative to the bounding box size "
|
||||||
"(default 1E-7)"
|
"(default 1e-7)"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
|
|||||||
@ -60,7 +60,7 @@ Description
|
|||||||
|
|
||||||
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
|
||||||
// usually meshes get written with limited precision (6 digits)
|
// usually meshes get written with limited precision (6 digits)
|
||||||
static const scalar defaultMergeTol = 1E-6;
|
static const scalar defaultMergeTol = 1e-6;
|
||||||
|
|
||||||
|
|
||||||
//// Read mesh if available. Otherwise create empty mesh with same non-proc
|
//// Read mesh if available. Otherwise create empty mesh with same non-proc
|
||||||
@ -721,7 +721,7 @@ int main(int argc, char *argv[])
|
|||||||
"mergeTol",
|
"mergeTol",
|
||||||
"scalar",
|
"scalar",
|
||||||
"specify the merge distance relative to the bounding box size "
|
"specify the merge distance relative to the bounding box size "
|
||||||
"(default 1E-6)"
|
"(default 1e-6)"
|
||||||
);
|
);
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,6 +37,8 @@ Description
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "ReadFields.H"
|
#include "ReadFields.H"
|
||||||
|
#include "interpolationWeights.H"
|
||||||
|
#include "uniformInterpolate.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -48,6 +50,8 @@ class fieldInterpolator
|
|||||||
const HashSet<word>& selectedFields_;
|
const HashSet<word>& selectedFields_;
|
||||||
instant ti_;
|
instant ti_;
|
||||||
instant ti1_;
|
instant ti1_;
|
||||||
|
const interpolationWeights& interpolator_;
|
||||||
|
const wordList& timeNames_;
|
||||||
int divisions_;
|
int divisions_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -60,6 +64,8 @@ public:
|
|||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
const instant& ti,
|
const instant& ti,
|
||||||
const instant& ti1,
|
const instant& ti1,
|
||||||
|
const interpolationWeights& interpolator,
|
||||||
|
const wordList& timeNames,
|
||||||
int divisions
|
int divisions
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -69,6 +75,8 @@ public:
|
|||||||
selectedFields_(selectedFields),
|
selectedFields_(selectedFields),
|
||||||
ti_(ti),
|
ti_(ti),
|
||||||
ti1_(ti1),
|
ti1_(ti1),
|
||||||
|
interpolator_(interpolator),
|
||||||
|
timeNames_(timeNames),
|
||||||
divisions_(divisions)
|
divisions_(divisions)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -98,34 +106,6 @@ void fieldInterpolator::interpolate()
|
|||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << '(';
|
Info<< " " << fieldIter()->name() << '(';
|
||||||
|
|
||||||
GeoFieldType fieldi
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldIter()->name(),
|
|
||||||
ti_.name(),
|
|
||||||
fieldIter()->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_
|
|
||||||
);
|
|
||||||
|
|
||||||
GeoFieldType fieldi1
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldIter()->name(),
|
|
||||||
ti1_.name(),
|
|
||||||
fieldIter()->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
|
scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
|
||||||
|
|
||||||
for (int j=0; j<divisions_; j++)
|
for (int j=0; j<divisions_; j++)
|
||||||
@ -141,20 +121,51 @@ void fieldInterpolator::interpolate()
|
|||||||
Info<< " ";
|
Info<< " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar lambda = scalar(j + 1)/scalar(divisions_ + 1);
|
// Calculate times to read and weights
|
||||||
|
labelList indices;
|
||||||
|
scalarField weights;
|
||||||
|
interpolator_.valueWeights
|
||||||
|
(
|
||||||
|
runTime_.value(),
|
||||||
|
indices,
|
||||||
|
weights
|
||||||
|
);
|
||||||
|
|
||||||
|
const wordList selectedTimeNames
|
||||||
|
(
|
||||||
|
UIndirectList<word>(timeNames_, indices)()
|
||||||
|
);
|
||||||
|
|
||||||
|
//Info<< "For time " << runTime_.value()
|
||||||
|
// << " need times " << selectedTimeNames
|
||||||
|
// << " need weights " << weights << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Read on the objectRegistry all the required fields
|
||||||
|
ReadFields<GeoFieldType>
|
||||||
|
(
|
||||||
|
fieldIter()->name(),
|
||||||
|
mesh_,
|
||||||
|
selectedTimeNames
|
||||||
|
);
|
||||||
|
|
||||||
GeoFieldType fieldj
|
GeoFieldType fieldj
|
||||||
(
|
(
|
||||||
IOobject
|
uniformInterpolate<GeoFieldType>
|
||||||
(
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldIter()->name(),
|
||||||
|
runTime_.timeName(),
|
||||||
|
fieldIter()->db(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
fieldIter()->name(),
|
fieldIter()->name(),
|
||||||
timej.name(),
|
selectedTimeNames,
|
||||||
fieldIter()->db(),
|
weights
|
||||||
IOobject::NO_READ,
|
)
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
(1.0 - lambda)*fieldi + lambda*fieldi1
|
|
||||||
);
|
);
|
||||||
|
|
||||||
fieldj.write();
|
fieldj.write();
|
||||||
@ -188,6 +199,12 @@ int main(int argc, char *argv[])
|
|||||||
"integer",
|
"integer",
|
||||||
"specify number of temporal sub-divisions to create (default = 1)."
|
"specify number of temporal sub-divisions to create (default = 1)."
|
||||||
);
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"interpolationType",
|
||||||
|
"word",
|
||||||
|
"specify type of interpolation (linear or spline)"
|
||||||
|
);
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
@ -198,15 +215,51 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
args.optionLookup("fields")() >> selectedFields;
|
args.optionLookup("fields")() >> selectedFields;
|
||||||
}
|
}
|
||||||
|
if (selectedFields.size())
|
||||||
|
{
|
||||||
|
Info<< "Interpolating fields " << selectedFields << nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Interpolating all fields" << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int divisions = 1;
|
int divisions = 1;
|
||||||
if (args.optionFound("divisions"))
|
if (args.optionFound("divisions"))
|
||||||
{
|
{
|
||||||
args.optionLookup("divisions")() >> divisions;
|
args.optionLookup("divisions")() >> divisions;
|
||||||
}
|
}
|
||||||
|
Info<< "Using " << divisions << " per time interval" << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
|
const word interpolationType = args.optionLookupOrDefault<word>
|
||||||
|
(
|
||||||
|
"interpolationType",
|
||||||
|
"linear"
|
||||||
|
);
|
||||||
|
Info<< "Using interpolation " << interpolationType << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
scalarField timeVals(timeDirs.size());
|
||||||
|
wordList timeNames(timeDirs.size());
|
||||||
|
forAll(timeDirs, i)
|
||||||
|
{
|
||||||
|
timeVals[i] = timeDirs[i].value();
|
||||||
|
timeNames[i] = timeDirs[i].name();
|
||||||
|
}
|
||||||
|
autoPtr<interpolationWeights> interpolatorPtr
|
||||||
|
(
|
||||||
|
interpolationWeights::New
|
||||||
|
(
|
||||||
|
interpolationType,
|
||||||
|
timeVals
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|
||||||
Info<< "Interpolating fields for times:" << endl;
|
Info<< "Interpolating fields for times:" << endl;
|
||||||
@ -226,6 +279,8 @@ int main(int argc, char *argv[])
|
|||||||
selectedFields,
|
selectedFields,
|
||||||
timeDirs[timei],
|
timeDirs[timei],
|
||||||
timeDirs[timei+1],
|
timeDirs[timei+1],
|
||||||
|
interpolatorPtr(),
|
||||||
|
timeNames,
|
||||||
divisions
|
divisions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,6 +70,7 @@ Usage
|
|||||||
#include "IOPtrList.H"
|
#include "IOPtrList.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "stringListOps.H"
|
#include "stringListOps.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -256,8 +257,12 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"instance",
|
"instance",
|
||||||
"name",
|
"name",
|
||||||
"specify alternate time instance - default is latest time"
|
"override instance setting (default is the time name)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add explicit time option
|
||||||
|
timeSelector::addOptions();
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"literalRE",
|
"literalRE",
|
||||||
@ -272,6 +277,18 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
|
// Optionally override controlDict time with -time options
|
||||||
|
instantList times = timeSelector::selectIfPresent(runTime, args);
|
||||||
|
if (times.size() < 1)
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "No times selected." << exit(FatalError);
|
||||||
|
}
|
||||||
|
runTime.setTime(times[0], 0);
|
||||||
|
word instance = args.optionLookupOrDefault("instance", runTime.timeName());
|
||||||
|
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
const word dictName("changeDictionaryDict");
|
const word dictName("changeDictionaryDict");
|
||||||
@ -317,11 +334,6 @@ int main(int argc, char *argv[])
|
|||||||
regionPrefix = regionName;
|
regionPrefix = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
word instance = runTime.timeName();
|
|
||||||
if (args.options().found("instance"))
|
|
||||||
{
|
|
||||||
instance = args.options()["instance"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we do not use the master-only reading since we read
|
// Make sure we do not use the master-only reading since we read
|
||||||
// fields (different per processor) as dictionaries.
|
// fields (different per processor) as dictionaries.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,7 +32,7 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
static const scalar perturbFactor = 1E-6;
|
static const scalar perturbFactor = 1e-6;
|
||||||
|
|
||||||
|
|
||||||
// Special version of findCell that generates a cell guaranteed to be
|
// Special version of findCell that generates a cell guaranteed to be
|
||||||
|
|||||||
@ -7,7 +7,7 @@ List<treeBoundBox> meshBb
|
|||||||
treeBoundBox
|
treeBoundBox
|
||||||
(
|
(
|
||||||
boundBox(coarseMesh.points(), false)
|
boundBox(coarseMesh.points(), false)
|
||||||
).extend(rndGen, 1E-3)
|
).extend(rndGen, 1e-3)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Dummy bounds dictionary
|
// Dummy bounds dictionary
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -367,7 +367,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
forAll(triQ, faceI)
|
forAll(triQ, faceI)
|
||||||
{
|
{
|
||||||
if (triQ[faceI] < 1E-11)
|
if (triQ[faceI] < 1e-11)
|
||||||
{
|
{
|
||||||
problemFaces.append(faceI);
|
problemFaces.append(faceI);
|
||||||
}
|
}
|
||||||
@ -427,9 +427,9 @@ int main(int argc, char *argv[])
|
|||||||
const pointField& localPoints = surf.localPoints();
|
const pointField& localPoints = surf.localPoints();
|
||||||
|
|
||||||
const boundBox bb(localPoints);
|
const boundBox bb(localPoints);
|
||||||
scalar smallDim = 1E-6 * bb.mag();
|
scalar smallDim = 1e-6 * bb.mag();
|
||||||
|
|
||||||
Info<< "Checking for points less than 1E-6 of bounding box ("
|
Info<< "Checking for points less than 1e-6 of bounding box ("
|
||||||
<< bb.span() << " meter) apart."
|
<< bb.span() << " meter) apart."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,9 @@ then
|
|||||||
CGAL_LIBDIR=-L$CGAL_ARCH_PATH/lib \
|
CGAL_LIBDIR=-L$CGAL_ARCH_PATH/lib \
|
||||||
LAPACK_LIB=-llapack \
|
LAPACK_LIB=-llapack \
|
||||||
BLAS_LIB=-lblas \
|
BLAS_LIB=-lblas \
|
||||||
CGAL_LIB=-lCGAL"
|
CGAL_LIB=-lCGAL \
|
||||||
|
CGAL_BOOST_LIB=-lboost_thread \
|
||||||
|
CGAL_MPFR_LIB=-lmpfr"
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Compiling surfaceFeatureExtract without CGAL curvature support"
|
echo "Compiling surfaceFeatureExtract without CGAL curvature support"
|
||||||
|
|||||||
@ -15,6 +15,8 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
|
${CGAL_BOOST_LIB} \
|
||||||
|
${CGAL_MPFR_LIB} \
|
||||||
${CGAL_LIBDIR} \
|
${CGAL_LIBDIR} \
|
||||||
${LAPACK_LIB} \
|
${LAPACK_LIB} \
|
||||||
${BLAS_LIB} \
|
${BLAS_LIB} \
|
||||||
|
|||||||
@ -30,9 +30,6 @@ surface1.stl
|
|||||||
|
|
||||||
// Write options
|
// Write options
|
||||||
|
|
||||||
// Write .eMesh file (for snappyHexMesh)
|
|
||||||
writeFeatureEdgeMesh yes;
|
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
// Write features to obj format for postprocessing
|
||||||
writeObj yes;
|
writeObj yes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
|
|||||||
treeBoundBox
|
treeBoundBox
|
||||||
(
|
(
|
||||||
boundBox(mesh.points(), false)
|
boundBox(mesh.points(), false)
|
||||||
).extend(rndGen, 1E-3)
|
).extend(rndGen, 1e-3)
|
||||||
);
|
);
|
||||||
Pstream::gatherList(meshBb);
|
Pstream::gatherList(meshBb);
|
||||||
Pstream::scatterList(meshBb);
|
Pstream::scatterList(meshBb);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -254,7 +254,7 @@ int main(int argc, char *argv[])
|
|||||||
selectSurf,
|
selectSurf,
|
||||||
indexedOctree<treeDataTriSurface>::perturbTol()
|
indexedOctree<treeDataTriSurface>::perturbTol()
|
||||||
),
|
),
|
||||||
bb.extend(rndGen, 1E-4), // slightly randomize bb
|
bb.extend(rndGen, 1e-4), // slightly randomize bb
|
||||||
8, // maxLevel
|
8, // maxLevel
|
||||||
10, // leafsize
|
10, // leafsize
|
||||||
3.0 // duplicity
|
3.0 // duplicity
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user