Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-10-13 13:22:44 +02:00
170 changed files with 1864 additions and 8379 deletions

View File

@ -85,15 +85,15 @@ int main(int argc, char *argv[])
for (int corr=1; corr<=1; corr++) for (int corr=1; corr<=1; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.solve(); pEqn.solve();
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -1,6 +1,6 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = invA & UEqn.H(); U = invA & UEqn.H();
if (transonic) if (transonic)
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -38,7 +38,7 @@ else
fvc::interpolate(rho)* fvc::interpolate(rho)*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -38,7 +38,7 @@ else
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -47,7 +47,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -62,7 +62,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
Sevap Sevap
); );
@ -40,7 +40,7 @@ else
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -49,7 +49,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
Sevap Sevap
); );
@ -66,7 +66,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -18,7 +18,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p, "div(phid,p)") + fvm::div(phid, p, "div(phid,p)")
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -40,7 +40,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -55,7 +55,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,29 +1,29 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phiU surfaceScalarField phiU
( (
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
phi = phiU - rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA); surfaceScalarField rhorAUf = fvc::interpolate(rho*rAU);
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
p_rghEqn.solve p_rghEqn.solve
@ -52,7 +52,7 @@ p = p_rgh + rho*gh;
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); U += rAU*fvc::reconstruct((phi - phiU)/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -38,7 +38,7 @@ else
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -47,7 +47,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -62,7 +62,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -5,14 +5,14 @@
// pressure solution - done in 2 parts. Part 1: // pressure solution - done in 2 parts. Part 1:
thermo.rho() -= psi*p; thermo.rho() -= psi*p;
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
surfaceScalarField phiv = surfaceScalarField phiv =
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi); + fvc::ddtPhiCorr(rAU, rho, U, phi);
phi = fvc::interpolate(rho)*phiv; phi = fvc::interpolate(rho)*phiv;
@ -28,7 +28,7 @@
( (
fvc::ddt(rho) + fvc::div(phi) fvc::ddt(rho) + fvc::div(phi)
+ correction(fvm::ddt(psi, p) + fvm::div(phid, p)) + correction(fvm::ddt(psi, p) + fvm::div(phid, p))
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -58,7 +58,7 @@
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -67,7 +67,7 @@
( (
fvc::ddt(rho) + psi*correction(fvm::ddt(p)) fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -98,7 +98,7 @@
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -9,7 +9,7 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax(); UEqn().relax();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
if (momentumPredictor) if (momentumPredictor)
{ {
@ -17,6 +17,6 @@ if (momentumPredictor)
} }
else else
{ {
U = rUA*(UEqn().H() - fvc::grad(p)); U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -1,6 +1,6 @@
rho = thermo.rho(); rho = thermo.rho();
U = rUA*UEqn().H(); U = rAU*UEqn().H();
if (nCorr <= 1) if (nCorr <= 1)
{ {
@ -15,7 +15,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -25,7 +25,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -55,7 +55,7 @@ else
fvc::interpolate(rho)* fvc::interpolate(rho)*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -65,7 +65,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -101,7 +101,7 @@ rho = thermo.rho();
Info<< "rho max/min : " << max(rho).value() Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl; << " " << min(rho).value() << endl;
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -12,7 +12,7 @@ UEqn().relax();
mrfZones.addCoriolis(rho, UEqn()); mrfZones.addCoriolis(rho, UEqn());
pZones.addResistance(UEqn()); pZones.addResistance(UEqn());
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
if (momentumPredictor) if (momentumPredictor)
{ {
@ -20,6 +20,6 @@ if (momentumPredictor)
} }
else else
{ {
U = rUA*(UEqn().H() - fvc::grad(p)); U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
U = rUA*UEqn().H(); U = rAU*UEqn().H();
if (nCorr <= 1) if (nCorr <= 1)
{ {
@ -16,7 +16,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
mrfZones.relativeFlux(fvc::interpolate(psi), phid); mrfZones.relativeFlux(fvc::interpolate(psi), phid);
@ -27,7 +27,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -57,7 +57,7 @@ else
fvc::interpolate(rho)* fvc::interpolate(rho)*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
//+ fvc::ddtPhiCorr(rUA, rho, U, phi) //+ fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
mrfZones.relativeFlux(fvc::interpolate(rho), phi); mrfZones.relativeFlux(fvc::interpolate(rho), phi);
@ -68,7 +68,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve pEqn.solve
@ -109,7 +109,7 @@ else
<< " " << min(rho).value() << endl; << " " << min(rho).value() << endl;
} }
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -3,8 +3,8 @@ rho = max(rho, rhoMin);
rho = min(rho, rhoMax); rho = min(rho, rhoMax);
rho.relax(); rho.relax();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
U = rUA*UEqn().H(); U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
bool closedVolume = false; bool closedVolume = false;
@ -22,7 +22,7 @@ if (transonic)
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::div(phid, p) fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
// Relax the pressure equation to ensure diagonal-dominance // Relax the pressure equation to ensure diagonal-dominance
@ -47,7 +47,7 @@ else
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rho*rUA, p) == fvc::div(phi) fvm::laplacian(rho*rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -67,7 +67,7 @@ else
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels // For closed-volume cases adjust the pressure and density levels

View File

@ -1,3 +0,0 @@
rhoSonicFoam.C
EXE = $(FOAM_APPBIN)/rhoSonicFoam

View File

@ -1,4 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = -lfiniteVolume

View File

@ -1,12 +0,0 @@
{
# include "rhoEqn.H"
}
{
scalar sumLocalContErr = (sum(mag(rho - psi*p))/sum(rho)).value();
scalar globalContErr = (sum(rho - psi*p)/sum(rho)).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr << endl;
}

View File

@ -1,96 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
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
);
volScalarField psi
(
IOobject
(
"psi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
1.0/(R*T)
);
psi.oldTime();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
),
psi*p,
p.boundaryField().types()
);
volVectorField rhoU
(
IOobject
(
"rhoU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*U,
U.boundaryField().types()
);
volScalarField rhoE
(
IOobject
(
"rhoE",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*Cv*T + 0.5*rho*magSqr(rhoU/rho),
T.boundaryField().types()
);

View File

@ -1,23 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar R
(
thermodynamicProperties.lookup("R")
);
dimensionedScalar Cv
(
thermodynamicProperties.lookup("Cv")
);

View File

@ -1,129 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
rhoSonicFoam
Description
Density-based compressible flow solver.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "readThermodynamicProperties.H"
# include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField phiv
(
IOobject
(
"phiv",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rhoU)/fvc::interpolate(rho) & mesh.Sf()
);
scalar CoNum = max
(
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiv)/mesh.magSf()
).value()*runTime.deltaTValue();
Info<< "\nMax Courant Number = " << CoNum << endl;
solve
(
fvm::ddt(rho)
+ fvm::div(phiv, rho)
);
p = rho/psi;
solve
(
fvm::ddt(rhoU)
+ fvm::div(phiv, rhoU)
==
- fvc::grad(p)
);
U == rhoU/rho;
surfaceScalarField phiv2
(
IOobject
(
"phiv2",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rhoU)/fvc::interpolate(rho) & mesh.Sf()
);
solve
(
fvm::ddt(rhoE)
+ fvm::div(phiv, rhoE)
==
- fvc::div(phiv2, p)
);
T = (rhoE - 0.5*rho*magSqr(rhoU/rho))/Cv/rho;
psi = 1.0/(R*T);
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,8 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso BCs
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -1,8 +0,0 @@
rho/fixedRhoFvPatchScalarField.C
rho/gradientRhoFvPatchScalarField.C
rhoE/fixedRhoEFvPatchScalarField.C
rhoE/mixedRhoEFvPatchScalarField.C
rhoU/fixedRhoUFvPatchVectorField.C
p/inviscidWallPFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/librhopSonicFoam

View File

@ -1,6 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-L$(FOAM_LIBBIN)

View File

@ -1,163 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "inviscidWallPFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
fluxFraction_(1)
{}
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
fluxFraction_(ptf.fluxFraction_)
{}
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
fluxFraction_(readScalar(dict.lookup("fluxFraction")))
{
if (dict.found("gradient"))
{
gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
if (fluxFraction_<0.0 || fluxFraction_ > 1.0)
{
FatalIOErrorIn
(
"inviscidWallPFvPatchScalarField::"
"supersonicFreeStreamFvPatchVectorField"
"(const fvPatch&, const scalarField&, const dictionary&)",
dict
) << " unphysical fluxFraction specified (< 0.0 or > 1.0)"
<< exit(FatalIOError);
}
}
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField& wbppsf
)
:
fixedGradientFvPatchScalarField(wbppsf),
fluxFraction_(wbppsf.fluxFraction_)
{}
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(wbppsf, iF),
fluxFraction_(wbppsf.fluxFraction_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void inviscidWallPFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<vector>& rhoUp =
patch().lookupPatchField<volVectorField, vector>("rhoU");
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>("phi");
const fvsPatchField<scalar>& rAp =
patch().lookupPatchField<surfaceScalarField, scalar>("rrhoUAf");
gradient() = (fluxFraction_*phip - (patch().Sf() & rhoUp))/
(rAp*patch().magSf());
fixedGradientFvPatchScalarField::updateCoeffs();
}
void inviscidWallPFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
os.writeKeyword("fluxFraction")
<< fluxFraction_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, inviscidWallPFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef inviscidWallPFvPatchScalarFields_H
#define inviscidWallPFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class inviscidWallPFvPatch Declaration
\*---------------------------------------------------------------------------*/
class inviscidWallPFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
public:
// Private data
scalar fluxFraction_;
//- Runtime type information
TypeName("inviscidWallP");
// Constructors
//- Construct from patch and internal field
inviscidWallPFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
inviscidWallPFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given inviscidWallPFvPatchScalarField onto
// a new patch
inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new inviscidWallPFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
inviscidWallPFvPatchScalarField
(
const inviscidWallPFvPatchScalarField&,
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 inviscidWallPFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedRhoFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF)
{}
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedRhoFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<scalar>& psip =
patch().lookupPatchField<volScalarField, scalar>("psi");
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>("p");
operator==(psip*pp);
fixedValueFvPatchScalarField::updateCoeffs();
}
void fixedRhoFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedRhoFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,135 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedRhoFvPatchScalarField_H
#define fixedRhoFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedRhoFvPatch Declaration
\*---------------------------------------------------------------------------*/
class fixedRhoFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
public:
//- Runtime type information
TypeName("fixedRho");
// Constructors
//- Construct from patch and internal field
fixedRhoFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedRhoFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedRhoFvPatchScalarField
// onto a new patch
fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new fixedRhoFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
fixedRhoFvPatchScalarField
(
const fixedRhoFvPatchScalarField&,
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 fixedRhoFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,139 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "gradientRhoFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF)
{}
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
{}
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF)
{
if (dict.found("gradient"))
{
gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
}
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField& wbppsf
)
:
fixedGradientFvPatchScalarField(wbppsf)
{}
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(wbppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void gradientRhoFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<scalar>& psip =
patch().lookupPatchField<volScalarField, scalar>("psi");
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>("p");
gradient() = psip*pp.snGrad() + psip.snGrad()*pp;
fixedGradientFvPatchScalarField::updateCoeffs();
}
void gradientRhoFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, gradientRhoFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,132 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef gradientRhoFvPatchScalarFields_H
#define gradientRhoFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class gradientRhoFvPatch Declaration
\*---------------------------------------------------------------------------*/
class gradientRhoFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
public:
//- Runtime type information
TypeName("gradientRho");
// Constructors
//- Construct from patch and internal field
gradientRhoFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
gradientRhoFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given gradientRhoFvPatchScalarField onto
// a new patch
gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField&x
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new gradientRhoFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
gradientRhoFvPatchScalarField
(
const gradientRhoFvPatchScalarField&,
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 gradientRhoFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedRhoEFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF)
{}
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedRhoEFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const dictionary& thermodynamicProperties = db().lookupObject<IOdictionary>
(
"thermodynamicProperties"
);
dimensionedScalar Cv(thermodynamicProperties.lookup("Cv"));
const fvPatchScalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho");
const fvPatchVectorField& rhoUp =
patch().lookupPatchField<volVectorField, vector>("rhoU");
const fvPatchScalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>("T");
operator==(rhop*(Cv.value()*Tp + 0.5*magSqr(rhoUp/rhop)));
fixedValueFvPatchScalarField::updateCoeffs();
}
void fixedRhoEFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedRhoEFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,135 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedRhoEFvPatchScalarField_H
#define fixedRhoEFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedRhoEFvPatch Declaration
\*---------------------------------------------------------------------------*/
class fixedRhoEFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
public:
//- Runtime type information
TypeName("fixedRhoE");
// Constructors
//- Construct from patch and internal field
fixedRhoEFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedRhoEFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedRhoEFvPatchScalarField
// onto a new patch
fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new fixedRhoEFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
fixedRhoEFvPatchScalarField
(
const fixedRhoEFvPatchScalarField&,
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 fixedRhoEFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,194 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mixedRhoEFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF)
{
refValue() = 0.0;
refGrad() = 0.0;
valueFraction() = 0.0;
}
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper)
{}
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF)
{
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
}
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 0.0;
}
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField& ptpsf
)
:
mixedFvPatchScalarField(ptpsf)
{}
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField& ptpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(ptpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mixedRhoEFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
mixedFvPatchScalarField::autoMap(m);
}
void mixedRhoEFvPatchScalarField::rmap
(
const fvPatchField<scalar>& ptf,
const labelList& addr
)
{
mixedFvPatchField<scalar>::rmap(ptf, addr);
}
void mixedRhoEFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho");
const fvPatchField<vector>& rhoUp =
patch().lookupPatchField<volVectorField, vector>("rhoU");
// fvPatchField<scalar>& Tp =
// patch().lookupPatchField<volScalarField, scalar>("T");
const volScalarField& T = db().lookupObject<volScalarField>("T");
const label patchi = patch().index();
fvPatchScalarField& Tp =
const_cast<fvPatchScalarField&>(T.boundaryField()[patchi]);
Tp.evaluate();
const dictionary& thermodynamicProperties = db().lookupObject<IOdictionary>
(
"thermodynamicProperties"
);
dimensionedScalar Cv(thermodynamicProperties.lookup("Cv"));
valueFraction() = rhop.snGrad()/
(rhop.snGrad() - rhop*this->patch().deltaCoeffs());
refValue() = 0.5*rhop*magSqr(rhoUp/rhop);
refGrad() =
rhop*Cv.value()*Tp.snGrad()
+ (
refValue()
- (0.5*rhop.patchInternalField()*
magSqr(rhoUp.patchInternalField()/rhop.patchInternalField()))
)*patch().deltaCoeffs();
mixedFvPatchScalarField::updateCoeffs();
}
void mixedRhoEFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("valueFraction") << valueFraction()
<< token::END_STATEMENT << endl;
os.writeKeyword("refValue") << refValue() << token::END_STATEMENT << endl;
os.writeKeyword("refGrad") << refGrad() << token::END_STATEMENT << endl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mixedRhoEFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,155 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mixedRhoEFvPatchScalarField
Description
SourceFiles
mixedRhoEFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef mixedRhoEFvPatchScalarFields_H
#define mixedRhoEFvPatchScalarFields_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mixedRhoEFvPatch Declaration
\*---------------------------------------------------------------------------*/
class mixedRhoEFvPatchScalarField
:
public mixedFvPatchScalarField
{
public:
//- Runtime type information
TypeName("mixedRhoE");
// Constructors
//- Construct from patch and internal field
mixedRhoEFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mixedRhoEFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given mixedRhoEFvPatchScalarField
// onto a new patch
mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mixedRhoEFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mixedRhoEFvPatchScalarField
(
const mixedRhoEFvPatchScalarField&,
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 mixedRhoEFvPatchScalarField(*this, iF)
);
}
// 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 fvPatchField<scalar>&,
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
// ************************************************************************* //

View File

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedRhoUFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF)
{}
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
{}
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF)
{}
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField& tppsf
)
:
fixedValueFvPatchVectorField(tppsf)
{}
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField& tppsf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedRhoUFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchScalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho");
const fvPatchVectorField& Up =
patch().lookupPatchField<volVectorField, vector>("U");
operator==(rhop*Up);
fixedValueFvPatchVectorField::updateCoeffs();
}
void fixedRhoUFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchVectorField, fixedRhoUFvPatchVectorField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,135 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedRhoUFvPatchVectorField_H
#define fixedRhoUFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedRhoUFvPatch Declaration
\*---------------------------------------------------------------------------*/
class fixedRhoUFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
public:
//- Runtime type information
TypeName("fixedRhoU");
// Constructors
//- Construct from patch and internal field
fixedRhoUFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedRhoUFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedRhoUFvPatchVectorField
// onto a new patch
fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new fixedRhoUFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
fixedRhoUFvPatchVectorField
(
const fixedRhoUFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new fixedRhoUFvPatchVectorField(*this, iF)
);
}
// Member functions
// Access
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
rhopSonicFoam.C
EXE = $(FOAM_APPBIN)/rhopSonicFoam

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-IBCs/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lrhopSonicFoam

View File

@ -1,7 +0,0 @@
#include "fixedGradientFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedRhoFvPatchScalarField.H"
#include "gradientRhoFvPatchScalarField.H"
#include "fixedRhoEFvPatchScalarField.H"
#include "mixedRhoEFvPatchScalarField.H"
#include "fixedRhoUFvPatchVectorField.H"

View File

@ -1,54 +0,0 @@
IOobject phiHeader
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ
);
surfaceScalarField* phiPtr;
if (phiHeader.headerOk())
{
Info<< "Reading face flux field phi\n" << endl;
phiPtr = new surfaceScalarField
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
}
else
{
Info<< "Calculating face flux field phi\n" << endl;
wordList phiTypes
(
rhoU.boundaryField().size(),
calculatedFvPatchScalarField::typeName
);
phiPtr = new surfaceScalarField
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
linearInterpolate(rhoU) & mesh.Sf(),
phiTypes
);
}
surfaceScalarField& phi = *phiPtr;

View File

@ -1,129 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
p.oldTime();
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
T.correctBoundaryConditions();
volScalarField psi
(
IOobject
(
"psi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
1.0/(R*T)
);
psi.oldTime();
# include "rhoBoundaryTypes.H"
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p*psi,
rhoBoundaryTypes
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "rhoUboundaryTypes.H"
volVectorField rhoU
(
IOobject
(
"rhoU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rho*U,
rhoUboundaryTypes
);
# include "rhoEboundaryTypes.H"
volScalarField rhoE
(
IOobject
(
"rhoE",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rho*Cv*T + 0.5*rho*magSqr(rhoU/rho),
rhoEboundaryTypes
);
# include "compressibleCreatePhi.H"
phi.oldTime();
surfaceScalarField phiv
(
IOobject
(
"phiv",
runTime.timeName(),
mesh
),
phi/linearInterpolate(rho),
phi.boundaryField().types()
);
rhoU.correctBoundaryConditions();
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
volScalarField magRhoU = mag(rhoU);
volScalarField H("H", (rhoE + p)/rho);
fields.add(rho);
fields.add(magRhoU);
fields.add(H);

View File

@ -1,38 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar R
(
thermodynamicProperties.lookup("R")
);
dimensionedScalar Cv
(
thermodynamicProperties.lookup("Cv")
);
dimensionedScalar Cp = Cv + R;
dimensionedScalar gamma = Cp/Cv;
dimensionedScalar Pr
(
dimensionedScalar::lookupOrDefault
(
"Pr",
thermodynamicProperties,
1.0
)
);

View File

@ -1,19 +0,0 @@
surfaceScalarField::GeometricBoundaryField& phiPatches =
phi.boundaryField();
const volVectorField::GeometricBoundaryField& rhoUpatches =
rhoU.boundaryField();
const surfaceVectorField::GeometricBoundaryField& SfPatches =
mesh.Sf().boundaryField();
forAll(phiPatches, patchI)
{
if (phi.boundaryField().types()[patchI] == "calculated")
{
calculatedFvsPatchScalarField& phiPatch =
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
phiPatch == (rhoUpatches[patchI] & SfPatches[patchI]);
}
}

View File

@ -1,21 +0,0 @@
const volScalarField::GeometricBoundaryField& pbf = p.boundaryField();
wordList rhoBoundaryTypes = pbf.types();
forAll(rhoBoundaryTypes, patchi)
{
if
(
rhoBoundaryTypes[patchi] == "pressureTransmissive"
)
{
rhoBoundaryTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
}
else if (pbf[patchi].fixesValue())
{
rhoBoundaryTypes[patchi] = fixedRhoFvPatchScalarField::typeName;
}
else
{
rhoBoundaryTypes[patchi] = gradientRhoFvPatchScalarField::typeName;
}
}

View File

@ -1,14 +0,0 @@
const volScalarField::GeometricBoundaryField& Tbf = T.boundaryField();
wordList rhoEboundaryTypes = Tbf.types();
forAll(rhoEboundaryTypes, patchi)
{
if (Tbf[patchi].fixesValue())
{
rhoEboundaryTypes[patchi] = fixedRhoEFvPatchScalarField::typeName;
}
else
{
rhoEboundaryTypes[patchi] = mixedRhoEFvPatchScalarField::typeName;
}
}

View File

@ -1,10 +0,0 @@
const volVectorField::GeometricBoundaryField& Ubf = U.boundaryField();
wordList rhoUboundaryTypes = Ubf.types();
forAll(rhoUboundaryTypes, patchi)
{
if (Ubf[patchi].fixesValue())
{
rhoUboundaryTypes[patchi] = fixedRhoUFvPatchVectorField::typeName;
}
}

View File

@ -1,191 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
rhopSonicFoam
Description
Pressure-density-based compressible flow solver.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "weighted.H"
#include "gaussConvectionScheme.H"
#include "multivariateGaussConvectionScheme.H"
#include "MUSCL.H"
#include "LimitedScheme.H"
#include "boundaryTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readThermodynamicProperties.H"
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.value() << nl << endl;
#include "readPISOControls.H"
scalar HbyAblend = readScalar(piso.lookup("HbyAblend"));
#include "readTimeControls.H"
scalar CoNum = max
(
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiv)/mesh.magSf()
).value()*runTime.deltaTValue();
Info<< "Max Courant Number = " << CoNum << endl;
#include "setDeltaT.H"
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
{
magRhoU = mag(rhoU);
H = (rhoE + p)/rho;
fv::multivariateGaussConvectionScheme<scalar> mvConvection
(
mesh,
fields,
phiv,
mesh.divScheme("div(phiv,rhoUH)")
);
solve
(
fvm::ddt(rho)
+ mvConvection.fvmDiv(phiv, rho)
);
surfaceScalarField rhoUWeights =
mvConvection.interpolationScheme()()(magRhoU)()
.weights(magRhoU);
weighted<vector> rhoUScheme(rhoUWeights);
fvVectorMatrix rhoUEqn
(
fvm::ddt(rhoU)
+ fv::gaussConvectionScheme<vector>(mesh, phiv, rhoUScheme)
.fvmDiv(phiv, rhoU)
);
solve(rhoUEqn == -fvc::grad(p));
solve
(
fvm::ddt(rhoE)
+ mvConvection.fvmDiv(phiv, rhoE)
==
- mvConvection.fvcDiv(phiv, p)
);
T = (rhoE - 0.5*rho*magSqr(rhoU/rho))/Cv/rho;
psi = 1.0/(R*T);
p = rho/psi;
for (int corr=0; corr<nCorr; corr++)
{
volScalarField rrhoUA = 1.0/rhoUEqn.A();
surfaceScalarField rrhoUAf("rrhoUAf", fvc::interpolate(rrhoUA));
volVectorField HbyA = rrhoUA*rhoUEqn.H();
surfaceScalarField HbyAWeights =
HbyAblend*mesh.weights()
+ (1.0 - HbyAblend)*
LimitedScheme
<vector, MUSCLLimiter<NVDTVD>, limitFuncs::magSqr>
(mesh, phi, IStringStream("HbyA")()).weights(HbyA);
phi =
(
surfaceInterpolationScheme<vector>::interpolate
(HbyA, HbyAWeights) & mesh.Sf()
)
+ HbyAblend*fvc::ddtPhiCorr(rrhoUA, rho, rhoU, phi);
p.boundaryField().updateCoeffs();
surfaceScalarField phiGradp =
rrhoUAf*mesh.magSf()*fvc::snGrad(p);
phi -= phiGradp;
#include "resetPhiPatches.H"
surfaceScalarField rhof =
mvConvection.interpolationScheme()()(rho)()
.interpolate(rho);
phiv = phi/rhof;
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ mvConvection.fvcDiv(phiv, rho)
+ fvc::div(phiGradp)
- fvm::laplacian(rrhoUAf, p)
);
pEqn.solve();
phi += phiGradp + pEqn.flux();
rho = psi*p;
rhof =
mvConvection.interpolationScheme()()(rho)()
.interpolate(rho);
phiv = phi/rhof;
rhoU = HbyA - rrhoUA*fvc::grad(p);
rhoU.correctBoundaryConditions();
}
}
U = rhoU/rho;
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phid surfaceScalarField phid
( (
@ -9,7 +9,7 @@ surfaceScalarField phid
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -19,7 +19,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -33,5 +33,5 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();

View File

@ -71,8 +71,8 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phid surfaceScalarField phid
( (
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
psi psi
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
); );
pEqn.solve(); pEqn.solve();
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -92,18 +92,18 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -117,7 +117,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -1,20 +1,20 @@
{ {
volScalarField rUA("rUA", 1.0/UEqn.A()); volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf(); surfaceScalarField buoyancyPhi = rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf();
phi -= buoyancyPhi; phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi) fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
@ -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 -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf); U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -1,21 +1,21 @@
{ {
volScalarField rUA("rUA", 1.0/UEqn().A()); volScalarField rAU("rAU", 1.0/UEqn().A());
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
U = rUA*UEqn().H(); U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf(); phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p_rgh); adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf(); surfaceScalarField buoyancyPhi = rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf();
phi -= buoyancyPhi; phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi) fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
@ -32,7 +32,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 -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf); U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -5,18 +5,18 @@
// pressure solution - done in 2 parts. Part 1: // pressure solution - done in 2 parts. Part 1:
thermo.rho() -= psi*p_rgh; thermo.rho() -= psi*p_rgh;
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = fvc::interpolate(rho)* phi = fvc::interpolate(rho)*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
surfaceScalarField buoyancyPhi = -rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); surfaceScalarField buoyancyPhi = -rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
phi += buoyancyPhi; phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -25,7 +25,7 @@
( (
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
p_rghEqn.solve p_rghEqn.solve
@ -53,7 +53,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 += rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf); U += rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -2,23 +2,23 @@
rho = thermo.rho(); rho = thermo.rho();
rho.relax(); rho.relax();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn().H(); U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p_rgh); bool closedVolume = adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); surfaceScalarField buoyancyPhi = rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
phi -= buoyancyPhi; phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi) fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phi)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
@ -34,7 +34,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 -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf); U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -1,24 +1,24 @@
{ {
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn().H(); U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p); bool closedVolume = adjustPhi(phi, U, p);
surfaceScalarField buoyancyPhi = surfaceScalarField buoyancyPhi =
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); rhorAUf*fvc::interpolate(rho)*(g & mesh.Sf());
phi += buoyancyPhi; phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rhorUAf, p) == fvc::div(phi) fvm::laplacian(rhorAUf, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -42,8 +42,8 @@
// Correct the momentum source with the pressure gradient flux // Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure // calculated from the relaxed pressure
U += rUA*(rho*g - fvc::grad(p)); U += rAU*(rho*g - fvc::grad(p));
//U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf); //U += rAU*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -5,16 +5,16 @@
rho = min(rho, rhoMax[i]); rho = min(rho, rhoMax[i]);
rho.relax(); rho.relax();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn().H(); U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p_rgh); bool closedVolume = adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); surfaceScalarField buoyancyPhi = rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
phi -= buoyancyPhi; phi -= buoyancyPhi;
// Solve pressure // Solve pressure
@ -22,7 +22,7 @@
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi) fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phi)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
@ -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 -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf); U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -3,21 +3,21 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rUA*UEqn().H(); U = rAU*UEqn().H();
surfaceScalarField phiU surfaceScalarField phiU
( (
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
phi = phiU - rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
@ -25,7 +25,7 @@
( (
fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
p_rghEqn.solve p_rghEqn.solve
@ -50,7 +50,7 @@
} }
// Correct velocity field // Correct velocity field
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); U += rAU*fvc::reconstruct((phi - phiU)/rhorAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
p = p_rgh + rho*gh; p = p_rgh + rho*gh;

View File

@ -77,13 +77,13 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
@ -127,9 +127,9 @@ int main(int argc, char *argv[])
// Calculate the pressure gradient increment needed to // Calculate the pressure gradient increment needed to
// adjust the average flow-rate to the correct value // adjust the average flow-rate to the correct value
dimensionedScalar gragPplus = dimensionedScalar gragPplus =
(magUbar - magUbarStar)/rUA.weightedAverage(mesh.V()); (magUbar - magUbarStar)/rAU.weightedAverage(mesh.V());
U += flowDirection*rUA*gragPplus; U += flowDirection*rAU*gragPplus;
gradP += gragPplus; gradP += gragPplus;

View File

@ -66,11 +66,11 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -69,11 +69,11 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -9,7 +9,7 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax(); UEqn().relax();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rAU = 1.0/UEqn().A();
if (momentumPredictor) if (momentumPredictor)
{ {
@ -17,6 +17,6 @@ if (momentumPredictor)
} }
else else
{ {
U = rUA*(UEqn().H() - fvc::grad(p)); U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -1,4 +1,4 @@
U = rUA*UEqn().H(); U = rAU*UEqn().H();
if (nCorr <= 1) if (nCorr <= 1)
{ {
@ -6,7 +6,7 @@ if (nCorr <= 1)
} }
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -16,7 +16,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
// Pressure corrector // Pressure corrector
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -47,5 +47,5 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();

View File

@ -0,0 +1,22 @@
// Solve the Momentum equation
tmp<fvVectorMatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
);
UEqn().relax();
rAU = 1.0/UEqn().A();
if (momentumPredictor)
{
solve(UEqn() == -fvc::grad(p));
}
else
{
U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions();
}

View File

@ -27,7 +27,7 @@
mesh mesh
); );
# include "createPhi.H" #include "createPhi.H"
label pRefCell = 0; label pRefCell = 0;

View File

@ -46,6 +46,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
#include "continuityErrs.H" #include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion

View File

@ -79,11 +79,11 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -94,7 +94,7 @@ int main(int argc, char *argv[])
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }

View File

@ -89,22 +89,22 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/hUEqn.A(); volScalarField rAU = 1.0/hUEqn.A();
surfaceScalarField ghrUAf = magg*fvc::interpolate(h*rUA); surfaceScalarField ghrAUf = magg*fvc::interpolate(h*rAU);
surfaceScalarField phih0 = ghrUAf*mesh.magSf()*fvc::snGrad(h0); surfaceScalarField phih0 = ghrAUf*mesh.magSf()*fvc::snGrad(h0);
if (rotating) if (rotating)
{ {
hU = rUA*(hUEqn.H() - (F ^ hU)); hU = rAU*(hUEqn.H() - (F ^ hU));
} }
else else
{ {
hU = rUA*hUEqn.H(); hU = rAU*hUEqn.H();
} }
phi = (fvc::interpolate(hU) & mesh.Sf()) phi = (fvc::interpolate(hU) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, h, hU, phi) + fvc::ddtPhiCorr(rAU, h, hU, phi)
- phih0; - phih0;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
( (
fvm::ddt(h) fvm::ddt(h)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(ghrUAf, h) - fvm::laplacian(ghrAUf, h)
); );
if (ucorr < nOuterCorr-1 || corr < nCorr-1) if (ucorr < nOuterCorr-1 || corr < nCorr-1)
@ -131,7 +131,7 @@ int main(int argc, char *argv[])
} }
} }
hU -= rUA*h*magg*fvc::grad(h + h0); hU -= rAU*h*magg*fvc::grad(h + h0);
// Constrain the momentum to be in the geometry if 3D geometry // Constrain the momentum to be in the geometry if 3D geometry
if (mesh.nGeometricD() == 3) if (mesh.nGeometricD() == 3)

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
coalParcels.Srho() coalParcels.Srho()
); );
@ -53,7 +53,7 @@ else
fvc::interpolate(rho)* fvc::interpolate(rho)*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -62,7 +62,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
coalParcels.Srho() coalParcels.Srho()
); );
@ -92,7 +92,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ surfaceFilm.Srho() + surfaceFilm.Srho()
@ -41,7 +41,7 @@ else
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -50,7 +50,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ surfaceFilm.Srho() + surfaceFilm.Srho()
@ -68,7 +68,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
if (transonic) if (transonic)
{ {
@ -11,7 +11,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -21,7 +21,7 @@ if (transonic)
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
); );
@ -40,7 +40,7 @@ else
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -49,7 +49,7 @@ else
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
); );
@ -66,7 +66,7 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -11,16 +11,16 @@
surfaceScalarField rhof = fvc::interpolate(rho, "rhof"); surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA)); surfaceScalarField rAUf("rAUf", rhof*fvc::interpolate(rAU));
volVectorField HbyA = rUA*UEqn.H(); volVectorField HbyA = rAU*UEqn.H();
phiv = (fvc::interpolate(HbyA) & mesh.Sf()) phiv = (fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phiv); + fvc::ddtPhiCorr(rAU, rho, U, phiv);
p.boundaryField().updateCoeffs(); p.boundaryField().updateCoeffs();
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p); surfaceScalarField phiGradp = rAUf*mesh.magSf()*fvc::snGrad(p);
phiv -= phiGradp/rhof; phiv -= phiGradp/rhof;
@ -34,7 +34,7 @@
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi) - (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
+ fvc::div(phiv, rho) + fvc::div(phiv, rho)
+ fvc::div(phiGradp) + fvc::div(phiGradp)
- fvm::laplacian(rUAf, p) - fvm::laplacian(rAUf, p)
); );
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
@ -79,7 +79,7 @@
// Correct velocity // Correct velocity
U = HbyA - rUA*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
// Remove the swirl component of velocity for "wedge" cases // Remove the swirl component of velocity for "wedge" cases
if (piso.found("removeSwirl")) if (piso.found("removeSwirl"))

View File

@ -1,6 +1,6 @@
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rUAf = fvc::interpolate(rUA); surfaceScalarField rAUf = fvc::interpolate(rAU);
tmp<fvScalarMatrix> p_rghEqnComp; tmp<fvScalarMatrix> p_rghEqnComp;
@ -24,27 +24,27 @@
} }
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phiU surfaceScalarField phiU
( (
"phiU", "phiU",
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
phi = phiU + phi = phiU +
( (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho) - ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf(); )*rAUf*mesh.magSf();
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqnIncomp fvScalarMatrix p_rghEqnIncomp
( (
fvc::div(phi) fvc::div(phi)
- fvm::laplacian(rUAf, p_rgh) - fvm::laplacian(rAUf, p_rgh)
); );
solve solve
@ -75,7 +75,7 @@
} }
} }
U += rUA*fvc::reconstruct((phi - phiU)/rUAf); U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
p = max p = max

View File

@ -1,6 +1,6 @@
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rUAf = fvc::interpolate(rUA); surfaceScalarField rAUf = fvc::interpolate(rAU);
tmp<fvScalarMatrix> p_rghEqnComp; tmp<fvScalarMatrix> p_rghEqnComp;
@ -24,27 +24,27 @@
} }
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phiU surfaceScalarField phiU
( (
"phiU", "phiU",
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
phi = phiU + phi = phiU +
( (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho) - ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf(); )*rAUf*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqnIncomp fvScalarMatrix p_rghEqnIncomp
( (
fvc::div(phi) fvc::div(phi)
- fvm::laplacian(rUAf, p_rgh) - fvm::laplacian(rAUf, p_rgh)
); );
solve solve
@ -75,7 +75,7 @@
} }
} }
U += rUA*fvc::reconstruct((phi - phiU)/rUAf); U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
p = max p = max

View File

@ -1,14 +1,14 @@
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rUAf = fvc::interpolate(rUA); surfaceScalarField rAUf = fvc::interpolate(rAU);
U = rUA*UEqn.H(); U = rAU*UEqn.H();
surfaceScalarField phiU surfaceScalarField phiU
( (
"phiU", "phiU",
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
adjustPhi(phiU, U, p_rgh); adjustPhi(phiU, U, p_rgh);
@ -17,7 +17,7 @@
( (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho) - ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf(); )*rAUf*mesh.magSf();
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP(); Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
const volScalarField& vDotcP = vDotP[0](); const volScalarField& vDotcP = vDotP[0]();
@ -27,7 +27,7 @@
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvc::div(phi) - fvm::laplacian(rUAf, p_rgh) fvc::div(phi) - 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)
); );
@ -52,7 +52,7 @@
} }
} }
U += rUA*fvc::reconstruct((phi - phiU)/rUAf); U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -1,27 +1,27 @@
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rUAf surfaceScalarField rAUf
( (
"(rho*(1|A(U)))", "(rho*(1|A(U)))",
fvc::interpolate(rho)*fvc::interpolate(rUA) fvc::interpolate(rho)*fvc::interpolate(rAU)
); );
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = phi =
fvc::interpolate(rho) fvc::interpolate(rho)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
surfaceScalarField phiU("phiU", phi); surfaceScalarField phiU("phiU", phi);
phi -= ghf*fvc::snGrad(rho)*rUAf*mesh.magSf(); phi -= ghf*fvc::snGrad(rho)*rAUf*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rUAf, p_rgh) == fvc::ddt(rho) + fvc::div(phi) fvm::laplacian(rAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phi)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
@ -49,5 +49,5 @@ if (p_rgh.needReference())
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U += rUA*fvc::reconstruct((phi - phiU)/rUAf); U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();

View File

@ -102,11 +102,11 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U = rUA*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi); + fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
# include "continuityErrs.H" # include "continuityErrs.H"
U -= rUA*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View File

@ -569,21 +569,31 @@ int main(int argc, char *argv[])
<< "as type patch. Please reset after mesh conversion as necessary." << "as type patch. Please reset after mesh conversion as necessary."
<< endl; << endl;
wordList patchTypes(patchFaces.size(), polyPatch::typeName); PtrList<dictionary> patchDicts;
wordList patchPhysicalTypes(patchFaces.size());
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -596,10 +606,9 @@ int main(int argc, char *argv[])
cellShapes, cellShapes,
patchFaces, patchFaces,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );

View File

@ -578,7 +578,6 @@ int main(int argc, char *argv[])
wordList patchTypes(npatch); wordList patchTypes(npatch);
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = wallPolyPatch::typeName; word defaultFacesType = wallPolyPatch::typeName;
wordList patchPhysicalTypes(npatch);
label nCreatedPatches = 0; label nCreatedPatches = 0;
@ -707,18 +706,30 @@ int main(int argc, char *argv[])
patchTypes.setSize(nCreatedPatches); patchTypes.setSize(nCreatedPatches);
patchNames.setSize(nCreatedPatches); patchNames.setSize(nCreatedPatches);
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -731,10 +742,9 @@ int main(int argc, char *argv[])
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -45,7 +45,6 @@ Description
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H" #include "cellShape.H"
#include "faceSet.H" #include "faceSet.H"
#include "cellSet.H" #include "cellSet.H"
@ -1542,17 +1541,6 @@ int main(int argc, char *argv[])
} }
repatcher.repatch(); repatcher.repatch();
preservePatchTypes
(
runTime,
runTime.constant(),
polyMesh::defaultRegion,
patchNames,
patchTypes,
defaultFacesName,
defaultFacesType,
patchPhysicalTypes
);
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(10); IOstream::defaultPrecision(10);

View File

@ -818,24 +818,32 @@ int main(int argc, char *argv[])
// Scale points // Scale points
points *= scaleFactor; points *= scaleFactor;
wordList patchTypes(boundary.size(), polyPatch::typeName); PtrList<dictionary> patchDicts(boundary.size());
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes(boundary.size());
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Mesh will auto-write on construction // Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -848,10 +856,9 @@ int main(int argc, char *argv[])
cells, cells,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -459,7 +459,6 @@ wordList patchNames(nPatches);
wordList patchTypes(nPatches); wordList patchTypes(nPatches);
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes(nPatches);
label nAddedPatches = 0; label nAddedPatches = 0;
@ -535,17 +534,27 @@ forAll(boundary, patchi)
} }
} }
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
}
// Build the mesh and write it out // Build the mesh and write it out
polyMesh pShapeMesh polyMesh pShapeMesh
@ -560,10 +569,9 @@ polyMesh pShapeMesh
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
Info << "Writing polyMesh" << endl; Info << "Writing polyMesh" << endl;

View File

@ -43,7 +43,6 @@ Description
#include "polyMesh.H" #include "polyMesh.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H" #include "cellShape.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "mergePoints.H" #include "mergePoints.H"

View File

@ -230,17 +230,28 @@ void sammMesh::readBoundary()
patchPhysicalTypes_.setSize(patchTypes_.size()); patchPhysicalTypes_.setSize(patchTypes_.size());
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime_, runTime_,
runTime_.constant(), runTime_.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames_, patchNames_,
patchTypes_, patchDicts,
defaultFacesName_, defaultFacesName_,
defaultFacesType_, defaultFacesType_
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (patchDicts.set(patchI))
{
const dictionary& dict = patchDicts[patchI];
dict.readIfPresent("type", patchTypes_[patchI]);
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
}
}
} }

View File

@ -228,17 +228,28 @@ void starMesh::readBoundary()
patchPhysicalTypes_.setSize(patchTypes_.size()); patchPhysicalTypes_.setSize(patchTypes_.size());
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime_, runTime_,
runTime_.constant(), runTime_.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames_, patchNames_,
patchTypes_, patchDicts,
defaultFacesName_, defaultFacesName_,
defaultFacesType_, defaultFacesType_
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (patchDicts.set(patchI))
{
const dictionary& dict = patchDicts[patchI];
dict.readIfPresent("type", patchTypes_[patchI]);
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
}
}
} }

View File

@ -52,7 +52,6 @@ Usage
#include "blockMesh.H" #include "blockMesh.H"
#include "attachPolyTopoChanger.H" #include "attachPolyTopoChanger.H"
#include "preservePatchTypes.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "cellSet.H" #include "cellSet.H"
@ -219,6 +218,7 @@ int main(int argc, char *argv[])
xferCopy(blocks.points()), // could we re-use space? xferCopy(blocks.points()), // could we re-use space?
blocks.cells(), blocks.cells(),
blocks.patches(), blocks.patches(),
blocks.patchNames(),
blocks.patchDicts(), blocks.patchDicts(),
defaultFacesName, defaultFacesName,
defaultFacesType defaultFacesType

View File

@ -153,6 +153,12 @@ int main(int argc, char *argv[])
"internalFacesOnly", "internalFacesOnly",
"do not convert boundary faces" "do not convert boundary faces"
); );
argList::addBoolOption
(
"updateFields",
"update fields to include new patches:"
" NOTE: updated field values may need to be edited"
);
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -235,7 +241,9 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName()); IOobjectList objects(mesh, runTime.timeName());
// Read vol fields. // Read vol fields.
if (args.optionFound("updateFields"))
{
Info<< "Reading geometric fields" << nl << endl;
PtrList<volScalarField> vsFlds; PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds); ReadFields(mesh, objects, vsFlds);
@ -267,7 +275,11 @@ int main(int argc, char *argv[])
PtrList<surfaceTensorField> stFlds; PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds); ReadFields(mesh, objects, stFlds);
}
else
{
Info<< "Not updating geometric fields" << nl << endl;
}
// Mesh change container // Mesh change container
polyTopoChange meshMod(mesh); polyTopoChange meshMod(mesh);

View File

@ -163,6 +163,7 @@ void Foam::ensightMesh::correct()
prisms.setSize(nPrisms); prisms.setSize(nPrisms);
wedges.setSize(nWedges); wedges.setSize(nWedges);
hexes.setSize(nHexes); hexes.setSize(nHexes);
hexesWedges.setSize(nHexesWedges);
polys.setSize(nPolys); polys.setSize(nPolys);
meshCellSets_.nTets = nTets; meshCellSets_.nTets = nTets;

View File

@ -280,6 +280,7 @@ public:
const Xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& shapes, const cellShapeList& shapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts, const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName, const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType, const word& defaultBoundaryPatchType,

View File

@ -698,6 +698,7 @@ Foam::polyMesh::polyMesh
const Xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& cellsAsShapes, const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts, const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName, const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType, const word& defaultBoundaryPatchType,
@ -832,12 +833,6 @@ Foam::polyMesh::polyMesh
// Remove all of the old mesh files if they exist // Remove all of the old mesh files if they exist
removeFiles(instance()); removeFiles(instance());
wordList boundaryPatchNames(boundaryDicts.size());
forAll(boundaryDicts, patchI)
{
boundaryDicts[patchI].lookup("name") >> boundaryPatchNames[patchI];
}
// Calculate faces and cells // Calculate faces and cells
labelList patchSizes; labelList patchSizes;
labelList patchStarts; labelList patchStarts;
@ -858,7 +853,7 @@ Foam::polyMesh::polyMesh
// Warning: Patches can only be added once the face list is // Warning: Patches can only be added once the face list is
// completed, as they hold a subList of the face list // completed, as they hold a subList of the face list
forAll(boundaryFaces, patchI) forAll(boundaryDicts, patchI)
{ {
dictionary patchDict(boundaryDicts[patchI]); dictionary patchDict(boundaryDicts[patchI]);

View File

@ -27,7 +27,10 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::polyMeshTetDecomposition::minTetQuality = 1e-12; // Note: the use of this tolerance is ad-hoc, there may be extreme
// cases where the resulting tetrahedra still have particle tracking
// problems.
const Foam::scalar Foam::polyMeshTetDecomposition::minTetQuality = SMALL;
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -25,7 +25,6 @@ License
#include "preservePatchTypes.H" #include "preservePatchTypes.H"
#include "polyBoundaryMeshEntries.H" #include "polyBoundaryMeshEntries.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -35,14 +34,16 @@ void Foam::preservePatchTypes
const word& meshInstance, const word& meshInstance,
const fileName& meshDir, const fileName& meshDir,
const wordList& patchNames, const wordList& patchNames,
wordList& patchTypes, PtrList<dictionary>& patchDicts,
const word& defaultFacesName, const word& defaultFacesName,
word& defaultFacesType, word& defaultFacesType
wordList& patchPhysicalTypes
) )
{ {
patchDicts.setSize(patchNames.size());
dictionary patchDictionary; dictionary patchDictionary;
// Read boundary file as single dictionary
{ {
IOobject patchEntriesHeader IOobject patchEntriesHeader
( (
@ -67,8 +68,6 @@ void Foam::preservePatchTypes
} }
} }
if (patchDictionary.size())
{
forAll(patchNames, patchi) forAll(patchNames, patchi)
{ {
if (patchDictionary.found(patchNames[patchi])) if (patchDictionary.found(patchNames[patchi]))
@ -76,14 +75,9 @@ void Foam::preservePatchTypes
const dictionary& patchDict = const dictionary& patchDict =
patchDictionary.subDict(patchNames[patchi]); patchDictionary.subDict(patchNames[patchi]);
patchDict.lookup("type") >> patchTypes[patchi]; patchDicts.set(patchi, patchDict.clone());
patchDicts[patchi].remove("nFaces");
patchDict.readIfPresent("geometricType", patchTypes[patchi]); patchDicts[patchi].remove("startFace");
patchDict.readIfPresent
(
"physicalType",
patchPhysicalTypes[patchi]
);
} }
} }
@ -94,7 +88,6 @@ void Foam::preservePatchTypes
patchDict.readIfPresent("geometricType", defaultFacesType); patchDict.readIfPresent("geometricType", defaultFacesType);
} }
}
Info<< nl << "Default patch type set to " << defaultFacesType << endl; Info<< nl << "Default patch type set to " << defaultFacesType << endl;
} }

View File

@ -37,6 +37,7 @@ SourceFiles
#include "fileName.H" #include "fileName.H"
#include "wordList.H" #include "wordList.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,10 +53,9 @@ void preservePatchTypes
const word& meshInstance, const word& meshInstance,
const fileName& meshDir, const fileName& meshDir,
const wordList& patchNames, const wordList& patchNames,
wordList& patchTypes, PtrList<dictionary>& patchDicts,
const word& defaultFacesName, const word& defaultFacesName,
word& defaultFacesType, word& defaultFacesType
wordList& patchPhysicalTypes
); );
} // End namespace Foam } // End namespace Foam

View File

@ -272,10 +272,10 @@ const Foam::point& Foam::plane::refPoint() const
} }
// Return coefficcients for plane equation: ax + by + cz + d = 0 // Return coefficients for plane equation: ax + by + cz + d = 0
Foam::scalarList Foam::plane::planeCoeffs() const Foam::FixedList<Foam::scalar, 4> Foam::plane::planeCoeffs() const
{ {
scalarList C(4); FixedList<scalar, 4> C(4);
scalar magX = mag(unitVector_.x()); scalar magX = mag(unitVector_.x());
scalar magY = mag(unitVector_.y()); scalar magY = mag(unitVector_.y());
@ -291,8 +291,8 @@ Foam::scalarList Foam::plane::planeCoeffs() const
} }
else else
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.z();
C[1] = 0; C[1] = unitVector_.y()/unitVector_.z();
C[2] = 1; C[2] = 1;
} }
} }
@ -300,14 +300,14 @@ Foam::scalarList Foam::plane::planeCoeffs() const
{ {
if (magY > magZ) if (magY > magZ)
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.y();
C[1] = 1; C[1] = 1;
C[2] = unitVector_.z()/unitVector_.y(); C[2] = unitVector_.z()/unitVector_.y();
} }
else else
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.z();
C[1] = 0; C[1] = unitVector_.y()/unitVector_.z();
C[2] = 1; C[2] = 1;
} }
} }
@ -422,19 +422,18 @@ Foam::point Foam::plane::planePlaneIntersect
const plane& plane3 const plane& plane3
) const ) const
{ {
List<scalarList> pcs(3); FixedList<scalar, 4> coeffs1(planeCoeffs());
pcs[0]= planeCoeffs(); FixedList<scalar, 4> coeffs2(plane2.planeCoeffs());
pcs[1]= plane2.planeCoeffs(); FixedList<scalar, 4> coeffs3(plane3.planeCoeffs());
pcs[2]= plane3.planeCoeffs();
tensor a tensor a
( (
pcs[0][0],pcs[0][1],pcs[0][2], coeffs1[0],coeffs1[1],coeffs1[2],
pcs[1][0],pcs[1][1],pcs[1][2], coeffs2[0],coeffs2[1],coeffs2[2],
pcs[2][0],pcs[2][1],pcs[2][2] coeffs3[0],coeffs3[1],coeffs3[2]
); );
vector b(pcs[0][3],pcs[1][3],pcs[2][3]); vector b(coeffs1[3],coeffs2[3],coeffs3[3]);
return (inv(a) & (-b)); return (inv(a) & (-b));
} }

View File

@ -149,7 +149,7 @@ public:
//- Return coefficients for the //- Return coefficients for the
// plane equation: ax + by + cz + d = 0 // plane equation: ax + by + cz + d = 0
scalarList planeCoeffs() const; FixedList<scalar, 4> planeCoeffs() const;
//- Return nearest point in the plane for the given point //- Return nearest point in the plane for the given point
point nearestPoint(const point& p) const; point nearestPoint(const point& p) const;

View File

@ -412,6 +412,8 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
List<polyPatch*> p(nPatches); List<polyPatch*> p(nPatches);
// All patch dictionaries
PtrList<dictionary> patchDicts(patchNames_.size());
// Default boundary patch types // Default boundary patch types
word defaultFacesType(emptyPolyPatch::typeName); word defaultFacesType(emptyPolyPatch::typeName);
@ -422,20 +424,37 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
mesh.instance(), mesh.instance(),
mesh.meshDir(), mesh.meshDir(),
patchNames_, patchNames_,
patchTypes_, patchDicts,
"defaultFaces", "defaultFaces",
defaultFacesType, defaultFacesType
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
dictionary& patchDict = patchDicts[patchI];
// add but not overwrite type
patchDict.add("type", patchTypes_[patchI], false);
if (patchPhysicalTypes_.size() && patchPhysicalTypes_[patchI].size())
{
patchDict.add("startFace", patchPhysicalTypes_[patchI], false);
}
// overwrite sizes and start
patchDict.add("nFaces", patchSizes_[patchI], true);
patchDict.add("startFace", patchStarts_[patchI], true);
}
forAll(patchStarts_, patchI) forAll(patchStarts_, patchI)
{ {
p[patchI] = polyPatch::New p[patchI] = polyPatch::New
( (
patchTypes_[patchI],
patchNames_[patchI], patchNames_[patchI],
patchSizes_[patchI], patchDicts[patchI],
patchStarts_[patchI],
patchI, patchI,
mesh.boundaryMesh() mesh.boundaryMesh()
).ptr(); ).ptr();

View File

@ -161,13 +161,13 @@ Foam::pressureGradientExplicitSource::Su() const
void Foam::pressureGradientExplicitSource::update() void Foam::pressureGradientExplicitSource::update()
{ {
const volScalarField& rUA = const volScalarField& rAU =
mesh_.lookupObject<volScalarField>("(1|A(" + U_.name() + "))"); mesh_.lookupObject<volScalarField>("(1|A(" + U_.name() + "))");
// Integrate flow variables over cell set // Integrate flow variables over cell set
scalar volTot = 0.0; scalar volTot = 0.0;
scalar magUbarAve = 0.0; scalar magUbarAve = 0.0;
scalar rUAave = 0.0; scalar rAUave = 0.0;
forAllConstIter(cellSet, selectedCellSet_, iter) forAllConstIter(cellSet, selectedCellSet_, iter)
{ {
label cellI = iter.key(); label cellI = iter.key();
@ -176,27 +176,27 @@ void Foam::pressureGradientExplicitSource::update()
volTot += volCell; volTot += volCell;
magUbarAve += (flowDir_ & U_[cellI])*volCell; magUbarAve += (flowDir_ & U_[cellI])*volCell;
rUAave += rUA[cellI]*volCell; rAUave += rAU[cellI]*volCell;
} }
// Collect across all processors // Collect across all processors
reduce(volTot, sumOp<scalar>()); reduce(volTot, sumOp<scalar>());
reduce(magUbarAve, sumOp<scalar>()); reduce(magUbarAve, sumOp<scalar>());
reduce(rUAave, sumOp<scalar>()); reduce(rAUave, sumOp<scalar>());
// Volume averages // Volume averages
magUbarAve /= volTot; magUbarAve /= volTot;
rUAave /= volTot; rAUave /= volTot;
// Calculate the pressure gradient increment needed to adjust the average // Calculate the pressure gradient increment needed to adjust the average
// flow-rate to the desired value // flow-rate to the desired value
scalar gradPplus = (mag(Ubar_) - magUbarAve)/rUAave; scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave;
// Apply correction to velocity field // Apply correction to velocity field
forAllConstIter(cellSet, selectedCellSet_, iter) forAllConstIter(cellSet, selectedCellSet_, iter)
{ {
label cellI = iter.key(); label cellI = iter.key();
U_[cellI] += flowDir_*rUA[cellI]*gradPplus; U_[cellI] += flowDir_*rAU[cellI]*gradPplus;
} }
// Update pressure gradient // Update pressure gradient

View File

@ -89,7 +89,6 @@ Foam::PtrList<Foam::dictionary> Foam::blockMesh::patchDicts() const
patchTopologies[patchI].write(os); patchTopologies[patchI].write(os);
IStringStream is(os.str()); IStringStream is(os.str());
patchDicts.set(patchI, new dictionary(is)); patchDicts.set(patchI, new dictionary(is));
patchDicts[patchI].set("name", patchTopologies[patchI].name());
} }
return patchDicts; return patchDicts;
} }
@ -134,12 +133,12 @@ const Foam::faceListList& Foam::blockMesh::patches() const
} }
//Foam::wordList Foam::blockMesh::patchNames() const Foam::wordList Foam::blockMesh::patchNames() const
//{ {
// return topology().boundaryMesh().names(); return topology().boundaryMesh().names();
//} }
//
//
//Foam::wordList Foam::blockMesh::patchTypes() const //Foam::wordList Foam::blockMesh::patchTypes() const
//{ //{
// return topology().boundaryMesh().types(); // return topology().boundaryMesh().types();

View File

@ -121,6 +121,7 @@ class blockMesh
bool readBoundary bool readBoundary
( (
const dictionary& meshDescription, const dictionary& meshDescription,
wordList& patchNames,
faceListList& tmpBlocksPatches, faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts PtrList<dictionary>& patchDicts
); );
@ -185,8 +186,8 @@ public:
//- Get patch information from the topology mesh //- Get patch information from the topology mesh
PtrList<dictionary> patchDicts() const; PtrList<dictionary> patchDicts() const;
// wordList patchNames() const; wordList patchNames() const;
//
// wordList patchTypes() const; // wordList patchTypes() const;
// //
// wordList patchPhysicalTypes() const; // wordList patchPhysicalTypes() const;

View File

@ -189,6 +189,7 @@ bool Foam::blockMesh::readPatches
bool Foam::blockMesh::readBoundary bool Foam::blockMesh::readBoundary
( (
const dictionary& meshDescription, const dictionary& meshDescription,
wordList& patchNames,
faceListList& tmpBlocksPatches, faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts PtrList<dictionary>& patchDicts
) )
@ -201,6 +202,7 @@ bool Foam::blockMesh::readBoundary
meshDescription.lookup("boundary") meshDescription.lookup("boundary")
); );
patchNames.setSize(patchesInfo.size());
tmpBlocksPatches.setSize(patchesInfo.size()); tmpBlocksPatches.setSize(patchesInfo.size());
patchDicts.setSize(patchesInfo.size()); patchDicts.setSize(patchesInfo.size());
@ -215,9 +217,9 @@ bool Foam::blockMesh::readBoundary
<< " valid dictionary." << exit(FatalIOError); << " valid dictionary." << exit(FatalIOError);
} }
// Construct dictionary and add name patchNames[patchI] = patchInfo.keyword();
// Construct dictionary
patchDicts.set(patchI, new dictionary(patchInfo.dict())); patchDicts.set(patchI, new dictionary(patchInfo.dict()));
patchDicts[patchI].set("name", patchInfo.keyword());
// Read block faces // Read block faces
patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI]; patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI];
@ -472,7 +474,8 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
Info<< nl << "Reading physicalType from existing boundary file" << endl; Info<< nl << "Reading physicalType from existing boundary file" << endl;
wordList patchPhysicalTypes(tmpBlocksPatches.size()); PtrList<dictionary> patchDicts(patchNames.size());
word defaultFacesType;
preservePatchTypes preservePatchTypes
( (
@ -480,31 +483,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
meshDescription.time().constant(), meshDescription.time().constant(),
polyMesh::meshSubDir, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType, defaultPatchType
patchPhysicalTypes
); );
// Convert into dictionary // Add cyclic info (might not be present from older file)
PtrList<dictionary> patchDicts(patchNames.size());
forAll(patchDicts, patchI) forAll(patchDicts, patchI)
{
if (!patchDicts.set(patchI))
{ {
patchDicts.set(patchI, new dictionary()); patchDicts.set(patchI, new dictionary());
patchDicts[patchI].set("name", patchNames[patchI]); }
patchDicts[patchI].set("type", patchTypes[patchI]);
dictionary& dict = patchDicts[patchI];
// Add but not override type
dict.add("type", patchTypes[patchI], false);
// Override neighbourpatch name
if (nbrPatchNames[patchI] != word::null) if (nbrPatchNames[patchI] != word::null)
{ {
patchDicts[patchI].set("neighbourPatch", nbrPatchNames[patchI]); dict.set("neighbourPatch", nbrPatchNames[patchI]);
}
if (patchPhysicalTypes[patchI] != word::null)
{
patchDicts[patchI].set
(
"physicalType",
patchPhysicalTypes[patchI]
);
} }
} }
@ -523,6 +524,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames,
patchDicts, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType defaultPatchType
@ -530,12 +532,14 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
} }
else if (meshDescription.found("boundary")) else if (meshDescription.found("boundary"))
{ {
wordList patchNames;
faceListList tmpBlocksPatches; faceListList tmpBlocksPatches;
PtrList<dictionary> patchDicts; PtrList<dictionary> patchDicts;
topologyOK = topologyOK && readBoundary topologyOK = topologyOK && readBoundary
( (
meshDescription, meshDescription,
patchNames,
tmpBlocksPatches, tmpBlocksPatches,
patchDicts patchDicts
); );
@ -553,6 +557,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
cellShapeList tmpBlockCells(blocks.size()); cellShapeList tmpBlockCells(blocks.size());
createCellShapes(tmpBlockCells); createCellShapes(tmpBlockCells);
// Extract
blockMeshPtr = new polyMesh blockMeshPtr = new polyMesh
( (
@ -568,6 +573,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames,
patchDicts, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType defaultPatchType

View File

@ -478,10 +478,10 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::solveThickness
Info<< "kinematicSingleLayer::solveThickness()" << endl; Info<< "kinematicSingleLayer::solveThickness()" << endl;
} }
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
U_ = rUA*UEqn.H(); U_ = rAU*UEqn.H();
surfaceScalarField deltarUAf = fvc::interpolate(delta_*rUA); surfaceScalarField deltarAUf = fvc::interpolate(delta_*rAU);
surfaceScalarField rhof = fvc::interpolate(rho_); surfaceScalarField rhof = fvc::interpolate(rho_);
surfaceScalarField phiAdd surfaceScalarField phiAdd
@ -500,13 +500,13 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::solveThickness
( (
"phid", "phid",
(fvc::interpolate(U_*rho_) & filmRegion_.Sf()) (fvc::interpolate(U_*rho_) & filmRegion_.Sf())
- deltarUAf*phiAdd*rhof - deltarAUf*phiAdd*rhof
); );
constrainFilmField(phid, 0.0); constrainFilmField(phid, 0.0);
surfaceScalarField ddrhorUAppf = surfaceScalarField ddrhorAUppf =
fvc::interpolate(delta_)*deltarUAf*rhof*fvc::interpolate(pp); fvc::interpolate(delta_)*deltarAUf*rhof*fvc::interpolate(pp);
// constrainFilmField(ddrhorUAppf, 0.0); // constrainFilmField(ddrhorAUppf, 0.0);
for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
{ {
@ -515,7 +515,7 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::solveThickness
( (
fvm::ddt(rho_, delta_) fvm::ddt(rho_, delta_)
+ fvm::div(phid, delta_) + fvm::div(phid, delta_)
- fvm::laplacian(ddrhorUAppf, delta_) - fvm::laplacian(ddrhorAUppf, delta_)
== ==
rhoSp_ rhoSp_
); );
@ -537,7 +537,7 @@ void Foam::surfaceFilmModels::kinematicSingleLayer::solveThickness
delta_.max(0.0); delta_.max(0.0);
// Update U field // Update U field
U_ -= fvc::reconstruct(deltarUAf*phiAdd); U_ -= fvc::reconstruct(deltarAUf*phiAdd);
// Remove any patch-normal components of velocity // Remove any patch-normal components of velocity
U_ -= nHat_*(nHat_ & U_); U_ -= nHat_*(nHat_ & U_);

View File

@ -34,14 +34,7 @@ Description
#include "Time.H" #include "Time.H"
#include "IFstream.H" #include "IFstream.H"
#include "OFstream.H" #include "OFstream.H"
#include "meshTools.H" #include "pointField.H"
#include "polyMesh.H"
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H"
#include "cellModeller.H"
#include "mergePoints.H"
#include "unitConversion.H" #include "unitConversion.H"
using namespace Foam; using namespace Foam;

View File

@ -1,55 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 1;
boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}
outlet
{
type zeroGradient;
}
bottom
{
type symmetryPlane;
}
top
{
type symmetryPlane;
}
obstacle
{
type zeroGradient;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More