Merge commit '1e8dd2ecb10f97091b3a5fb5b1e8f8d1cbe06bb3' into nextRelease

This commit is contained in:
Hrvoje Jasak 2018-02-07 12:10:43 +00:00
commit 88ba7f654f
137 changed files with 18188 additions and 312 deletions

View file

@ -26,7 +26,8 @@ Application
Description
Incompressible LES solver for flow in a channel.
Consistent formulation without time-step and relaxation dependence by Jasak
Consistent formulation without time-step and relaxation dependence by
Jasak and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
@ -66,6 +67,9 @@ int main(int argc, char *argv[])
sgsModel->correct();
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
@ -75,24 +79,23 @@ int main(int argc, char *argv[])
flowDirection*gradP
);
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
if (piso.momentumPredictor())
{
solve(ddtUEqn + HUEqn == -fvc::grad(p));
}
// Prepare clean Ap without time derivative contribution
// HJ, 26/Oct/2015
volScalarField aU = HUEqn.A();
// Prepare clean 1/a_p without time derivative contribution
volScalarField rAU = 1.0/HUEqn.A();
// --- PISO loop
while (piso.correct())
{
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
adjustPhi(phi, U, p);
@ -100,7 +103,14 @@ int main(int argc, char *argv[])
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -117,13 +127,8 @@ int main(int argc, char *argv[])
# include "continuityErrs.H"
// Note: cannot call H(U) here because the velocity is not complete
// HJ, 22/Jan/2016
U = 1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
// Correct driving force for a constant mass flow rate
@ -135,9 +140,9 @@ int main(int argc, char *argv[])
// Calculate the pressure gradient increment needed to
// adjust the average flow-rate to the correct value
dimensionedScalar gragPplus =
(magUbar - magUbarStar)*aU.weightedAverage(mesh.V());
(magUbar - magUbarStar)/rAU.weightedAverage(mesh.V());
U += gragPplus/aU*flowDirection;
U += gragPplus*rAU*flowDirection;
gradP += gragPplus;

View file

@ -1,11 +1,14 @@
fvVectorMatrix UEqn
// Time-derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
solve(ddtUEqn + HUEqn == -fvc::grad(p));
}

View file

@ -27,6 +27,8 @@ Application
Description
Transient solver for incompressible, laminar flow of Newtonian fluids
with dynamic mesh.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
@ -60,13 +62,12 @@ int main(int argc, char *argv[])
{
# include "readControls.H"
# include "checkTotalVolume.H"
# include "CourantNo.H"
# include "setDeltaT.H"
// Make the fluxes absolute
fvc::makeAbsolute(phi, U);
# include "CourantNo.H"
# include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
@ -95,13 +96,16 @@ int main(int argc, char *argv[])
// --- PISO loop
// Prepare clean 1/a_p without time derivative contribution
rAU = 1.0/HUEqn.A();
while (piso.correct())
{
rAU = 1.0/UEqn.A();
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf());
//+ fvc::ddtPhiCorr(rAU, U, phi);
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
adjustPhi(phi, U, p);
@ -110,7 +114,14 @@ int main(int argc, char *argv[])
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -125,13 +136,11 @@ int main(int argc, char *argv[])
}
}
# include "continuityErrs.H"
# include "movingMeshContinuityErrs.H"
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation.
// Note: flux is made relative inside the function
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
runTime.write();

View file

@ -1,11 +1,12 @@
fvVectorMatrix UEqn
// Time-derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
UEqn.relax();
// Solve the momentum equation
solve(UEqn == -fvc::grad(p));
// Solve the relaxed momentum equation
solve(relax(ddtUEqn + HUEqn) == -fvc::grad(p));

View file

@ -80,5 +80,5 @@
# include "UEqn.H"
momentumPredictor = momentumPredictorSave;
rAU = 1.0/UEqn.A();
rAU = 1.0/(HUEqn.A() + ddtUEqn.A());
}

View file

@ -28,6 +28,8 @@ Description
Transient solver for incompressible, laminar flow of Newtonian fluids
with dynamic mesh. Solver implements a SIMPLE-based algorithm
in time-stepping mode.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved.
@ -100,11 +102,14 @@ int main(int argc, char *argv[])
# include "UEqn.H"
rAU = 1.0/UEqn.A();
// Prepare clean 1/a_p without time derivative contribution
rAU = 1.0/HUEqn.A();
U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf());
//+ fvc::ddtPhiCorr(rAU, U, phi);
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
adjustPhi(phi, U, p);
@ -115,7 +120,14 @@ int main(int argc, char *argv[])
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -135,11 +147,9 @@ int main(int argc, char *argv[])
// Explicitly relax pressure for momentum corrector
p.relax();
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation.
// Note: flux is made relative inside the function
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
runTime.write();

View file

@ -26,7 +26,8 @@ Application
Description
Transient solver for incompressible, laminar flow of Newtonian fluids.
Consistent formulation without time-step and relaxation dependence by Jasak
Consistent formulation without time-step and relaxation dependence by
Jasak and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
@ -59,6 +60,9 @@ int main(int argc, char *argv[])
# include "CourantNo.H"
// Time-derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
@ -66,24 +70,23 @@ int main(int argc, char *argv[])
- fvm::laplacian(nu, U)
);
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
if (piso.momentumPredictor())
{
solve(ddtUEqn + HUEqn == -fvc::grad(p));
}
// Prepare clean Ap without time derivative contribution
// HJ, 26/Oct/2015
volScalarField aU = HUEqn.A();
// Prepare clean 1/a_p without time derivative contribution
volScalarField rAU = 1.0/HUEqn.A();
// --- PISO loop
while (piso.correct())
{
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
adjustPhi(phi, U, p);
@ -91,7 +94,14 @@ int main(int argc, char *argv[])
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -108,13 +118,8 @@ int main(int argc, char *argv[])
# include "continuityErrs.H"
// Note: cannot call H(U) here because the velocity is not complete
// HJ, 22/Jan/2016
U = 1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
runTime.write();

View file

@ -27,6 +27,7 @@ Application
Description
Transient solver for incompressible, laminar flow of non-Newtonian fluids.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
@ -63,6 +64,9 @@ int main(int argc, char *argv[])
fluid.correct();
// Time-derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
@ -70,24 +74,23 @@ int main(int argc, char *argv[])
- fvm::laplacian(fluid.nu(), U)
);
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
if (piso.momentumPredictor())
{
solve(ddtUEqn + HUEqn == -fvc::grad(p));
}
// Prepare clean Ap without time derivative contribution
// HJ, 26/Oct/2015
volScalarField aU = HUEqn.A();
// Prepare clean 1/a_p without time derivative contribution
volScalarField rAU = 1.0/HUEqn.A();
// --- PISO loop
while (piso.correct())
{
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
adjustPhi(phi, U, p);
@ -95,7 +98,14 @@ int main(int argc, char *argv[])
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -112,13 +122,8 @@ int main(int argc, char *argv[])
# include "continuityErrs.H"
// Note: cannot call H(U) here because the velocity is not complete
// HJ, 22/Jan/2016
U = 1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
runTime.write();

View file

@ -1,3 +1,6 @@
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
@ -5,22 +8,8 @@
+ turbulence->divDevReff()
);
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Get under-relaxation factor
scalar UUrf =
mesh.solutionDict().equationRelaxationFactor(U.select(pimple.finalIter()));
if (pimple.momentumPredictor())
{
// Solve momentum predictor
solve
(
ddtUEqn
+ relax(HUEqn, UUrf)
==
- fvc::grad(p),
mesh.solutionDict().solver((U.select(pimple.finalIter())))
);
solve(relax(ddtUEqn + HUEqn) == -fvc::grad(p));
}

View file

@ -41,7 +41,7 @@
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(1/aU, pcorr) == fvc::div(phi)
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
);
pcorrEqn.setReference(pRefCell, pRefValue);
@ -55,6 +55,7 @@
// Fluxes are corrected to absolute velocity and further corrected
// later. HJ, 6/Feb/2009
}
# include "continuityErrs.H"
}

View file

@ -42,18 +42,18 @@
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
Info<< "Reading field aU if present\n" << endl;
volScalarField aU
Info<< "Reading field rAU if present\n" << endl;
volScalarField rAU
(
IOobject
(
"aU",
"rAU",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
1/runTime.deltaT(),
runTime.deltaT(),
zeroGradientFvPatchScalarField::typeName
);

View file

@ -1,26 +1,32 @@
{
p.boundaryField().updateCoeffs();
// Prepare clean Ap without time derivative contribution and
// without contribution from under-relaxation
// HJ, 26/Oct/2015
aU = HUEqn.A();
// Prepare clean 1/a_p without time derivative and under-relaxation
// contribution
rAU = 1.0/HUEqn.A();
// Store velocity under-relaxation point before using U for the flux
// precursor
U.storePrevIter();
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Consistently calculate flux
pimple.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
// Global flux balance
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/pimple.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -35,24 +41,16 @@
}
}
// Explicitly relax pressure for momentum corrector except for last corrector
// Explicitly relax pressure for momentum corrector except for last
// corrector
if (!pimple.finalIter())
{
p.relax();
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
# include "movingMeshContinuityErrs.H"
U = UUrf*
(
1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
)
)
+ (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation. Note: flux is
// made relative inside the function
pimple.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}

View file

@ -25,15 +25,16 @@ Application
pimpleDyMFoam.C
Description
Transient solver for incompressible, flow of Newtonian fluids
Transient solver for incompressible, turbulent flow of Newtonian fluids
with dynamic mesh using the PIMPLE (merged PISO-SIMPLE) algorithm.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
Hrvoje Jasak, Wikki Ltd. All rights reserved.
\*---------------------------------------------------------------------------*/
@ -76,15 +77,10 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
bool meshChanged = mesh.update();
reduce(meshChanged, orOp<bool>());
# include "volContinuity.H"
if (checkMeshCourantNo)
{
# include "meshCourantNo.H"
}
// Mesh motion update
if (correctPhi && meshChanged)
{
// Fluxes will be corrected to absolute velocity
@ -92,14 +88,19 @@ int main(int argc, char *argv[])
# include "correctPhi.H"
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
if (mesh.moving() && checkMeshCourantNo)
{
# include "meshCourantNo.H"
}
if (meshChanged)
{
# include "CourantNo.H"
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
// --- PIMPLE loop
while (pimple.loop())
{

View file

@ -1,3 +1,6 @@
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
@ -5,27 +8,14 @@ fvVectorMatrix HUEqn
+ turbulence->divDevReff()
);
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Get under-relaxation factor
scalar UUrf =
mesh.solutionDict().equationRelaxationFactor(U.select(pimple.finalIter()));
if (pimple.momentumPredictor())
{
// Solve momentum predictor
solve
(
ddtUEqn
+ relax(HUEqn, UUrf)
==
- fvc::grad(p),
mesh.solutionDict().solver((U.select(pimple.finalIter())))
);
solve(relax(ddtUEqn + HUEqn) == -fvc::grad(p));
}
else
{
// Explicit update
U = (ddtUEqn.H() + HUEqn.H() - fvc::grad(p))/(HUEqn.A() + ddtUEqn.A());
U.correctBoundaryConditions();
}

View file

@ -41,18 +41,18 @@ autoPtr<incompressible::turbulenceModel> turbulence
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
Info<< "Reading field aU if present\n" << endl;
volScalarField aU
Info<< "Reading field rAU if present\n" << endl;
volScalarField rAU
(
IOobject
(
"aU",
"rAU",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
1/runTime.deltaT(),
runTime.deltaT(),
zeroGradientFvPatchScalarField::typeName
);

View file

@ -1,26 +1,32 @@
{
p.boundaryField().updateCoeffs();
// Prepare clean Ap without time derivative contribution and
// without contribution from under-relaxation
// HJ, 26/Oct/2015
aU = HUEqn.A();
// Prepare clean 1/a_p without time derivative and under-relaxation
// contribution
rAU = 1.0/HUEqn.A();
// Store velocity under-relaxation point before using U for the flux
// precursor
U.storePrevIter();
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Consistently calculate flux
pimple.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
// Global flux balance
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/pimple.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -35,7 +41,8 @@
}
}
// Explicitly relax pressure for momentum corrector except for last corrector
// Explicitly relax pressure for momentum corrector except for last
// corrector
if (!pimple.finalIter())
{
p.relax();
@ -43,13 +50,7 @@
# include "continuityErrs.H"
U = UUrf*
(
1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
)
)
+ (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure equation. Note: flux is
// made relative inside the function
pimple.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}

View file

@ -25,12 +25,13 @@ Application
pimpleFoam
Description
Large time-step transient solver for incompressible, flow using the PIMPLE
(merged PISO-SIMPLE) algorithm.
Large time-step transient solver for incompressible turbulent flow using
the PIMPLE (merged PISO-SIMPLE) algorithm.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved

View file

@ -25,10 +25,13 @@ Application
pisoFoam
Description
Transient solver for incompressible flow.
Transient solver for incompressible, turbulent flow.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
@ -63,30 +66,36 @@ int main(int argc, char *argv[])
{
// Momentum predictor
fvVectorMatrix UEqn
// Time-derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Convection-diffusion matrix
fvVectorMatrix HUEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
fvm::div(phi, U)
+ turbulence->divDevReff()
);
UEqn.relax();
if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
solve(relax(ddtUEqn + HUEqn) == -fvc::grad(p));
}
// --- PISO loop
while (piso.correct())
{
volScalarField rUA = 1.0/UEqn.A();
// Prepare clean 1/a_p without time derivative and
// under-relaxation contribution
volScalarField rAU = 1.0/HUEqn.A();
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
// Calculate U from convection-diffusion matrix
U = rAU*HUEqn.H();
// Consistently calculate flux
piso.calcTransientConsistentFlux(phi, U, rAU, ddtUEqn);
// Global flux balance
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
@ -96,7 +105,14 @@ int main(int argc, char *argv[])
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/piso.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -116,8 +132,9 @@ int main(int argc, char *argv[])
# include "continuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
// Consistently reconstruct velocity after pressure
// equation. Note: flux is made relative inside the function
piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p);
}
}

View file

@ -1,18 +1,10 @@
// Solve the momentum equation
tmp<fvVectorMatrix> HUEqn
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff()
);
// Get under-relaxation factor
const scalar UUrf = mesh.solutionDict().equationRelaxationFactor(U.name());
// Momentum solution
solve
(
relax(HUEqn(), UUrf)
==
-fvc::grad(p)
);
solve(relax(UEqn()) == -fvc::grad(p));

View file

@ -1,22 +1,11 @@
{
p.boundaryField().updateCoeffs();
// Prepare clean 1/Ap without contribution from under-relaxation
// HJ, 26/Oct/2015
volScalarField rAU
(
"(1|A(U))",
1/HUEqn().A()
);
volScalarField rAU = 1.0/UEqn().A();
U = rAU*UEqn().H();
UEqn.clear();
// Store velocity under-relaxation point before using U for
// the flux precursor
U.storePrevIter();
U = rAU*HUEqn().H();
HUEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
// Calculate under-relaxation consistent flux
simple.calcSteadyConsistentFlux(phi, U);
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
@ -24,7 +13,14 @@
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAU)/simple.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
@ -42,9 +38,5 @@
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
// Note: since under-relaxation does not change aU, H/a in U can be
// re-used. HJ, 22/Jan/2016
U = UUrf*(U - rAU*fvc::grad(p)) + (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions();
}
// Reconstruct consistent velocity after pressure equation
simple.reconstructSteadyVelocity(U, rAU, p);

View file

@ -25,8 +25,9 @@ Application
simpleFoam
Description
Steady-state solver for incompressible, turbulent flow
Steady-state solver for incompressible, turbulent flow.
Consistent formulation without time-step and relaxation dependence by Jasak
and Tukovic.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved

View file

@ -1,15 +1,11 @@
// Solve the momentum equation
tmp<fvVectorMatrix> HUrelEqn
tmp<fvVectorMatrix> UrelEqn
(
fvm::div(phi, Urel)
+ turbulence->divDevReff()
+ SRF->Su()
);
// Get under-relaxation factor
const scalar UUrf =
mesh.solutionDict().equationRelaxationFactor(Urel.name());
// Momentum solution
solve(relax(HUrelEqn(), UUrf) == -fvc::grad(p));
solve(relax(UrelEqn()) == -fvc::grad(p));

View file

@ -1,36 +1,32 @@
p.boundaryField().updateCoeffs();
// Prepare clean 1/Ap without contribution from under-relaxation
// HJ, 26/Oct/2015
volScalarField rUA
(
"(1|A(Urel))",
1/HUrelEqn().A()
);
volScalarField rAUrel = 1.0/UrelEqn().A();
Urel = rAUrel*UrelEqn().H();
UrelEqn.clear();
// Store velocity under-relaxation point before using U for the flux
// precursor
Urel.storePrevIter();
Urel = rUA*HUrelEqn().H();
HUrelEqn.clear();
phi = fvc::interpolate(Urel) & mesh.Sf();
// Global flux balance
// Calculate under-relaxation consistent flux
simple.calcSteadyConsistentFlux(phi, Urel);
adjustPhi(phi, Urel, p);
// Non-orthogonal pressure corrector loop
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
fvm::laplacian
(
fvc::interpolate(rAUrel)/simple.aCoeff(Urel.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
@ -41,8 +37,5 @@
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
// Note: since under-relaxation does not change aU, H/a in U can be
// re-used. HJ, 22/Jan/2016
Urel = UUrf*(Urel - rUA*fvc::grad(p)) + (1 - UUrf)*Urel.prevIter();
Urel.correctBoundaryConditions();
// Reconstruct consistent velocity after pressure equation
simple.reconstructSteadyVelocity(Urel, rAUrel, p);

View file

@ -65,50 +65,8 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector
{
// Momentum predictor
tmp<fvVectorMatrix> UrelEqn
(
fvm::div(phi, Urel)
+ turbulence->divDevReff()
+ SRF->Su()
);
UrelEqn().relax();
solve(UrelEqn() == -fvc::grad(p));
p.boundaryField().updateCoeffs();
volScalarField AUrel = UrelEqn().A();
Urel = UrelEqn().H()/AUrel;
UrelEqn.clear();
phi = fvc::interpolate(Urel) & mesh.Sf();
adjustPhi(phi, Urel, p);
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AUrel, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
Urel -= fvc::grad(p)/AUrel;
Urel.correctBoundaryConditions();
# include "UEqn.H"
# include "pEqn.H"
}
turbulence->correct();

View file

@ -624,6 +624,30 @@ EulerLocalDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename EulerLocalDdtScheme<Type>::fluxFieldType>
EulerLocalDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
const objectRegistry& registry = this->mesh();
// Get access to the scalar beta[i]
const scalarField& beta =
registry.lookupObject<scalarField>(deltaTName_);
const surfaceScalarField rDeltaTf = fvc::interpolate
(
1.0/(beta[0]*registry.lookupObject<volScalarField>(deltaTauName_))
);
return (mesh().Sf() & faceU.oldTime())*rAUf*rDeltaTf;
}
template<class Type>
tmp<surfaceScalarField> EulerLocalDdtScheme<Type>::meshPhi
(

View file

@ -165,6 +165,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -191,6 +201,15 @@ tmp<surfaceScalarField> EulerLocalDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> EulerLocalDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -840,6 +840,31 @@ backwardDualDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename backwardDualDdtScheme<Type>::fluxFieldType>
backwardDualDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
notImplemented
(
type()
+ "::fvcDdtConsistentPhiCorr"
+ "\n("
+ "\n const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,"
+ "\n const GeometricField<Type, fvPatchField, volMesh>& U"
+ "\n const surfaceScalarField rAUf"
+ "\n)"
);
// Dummy return
return tmp<fluxFieldType>(NULL);
}
template<class Type>
tmp<surfaceScalarField> backwardDualDdtScheme<Type>::meshPhi
(

View file

@ -198,6 +198,15 @@ public:
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -224,6 +233,15 @@ tmp<surfaceScalarField> backwardDualDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> backwardDualDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -170,6 +170,25 @@ Foam::pimpleControl::~pimpleControl()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dimensionedScalar Foam::pimpleControl::relaxFactor
(
const Foam::volVectorField& U
) const
{
scalar urf = 1;
if (mesh_.solutionDict().relaxEquation(U.select(finalIter())))
{
urf = mesh_.solutionDict().equationRelaxationFactor
(
U.select(finalIter())
);
}
return dimensionedScalar("alphaU", dimless, urf);
}
bool Foam::pimpleControl::loop()
{
read();

View file

@ -91,6 +91,15 @@ protected:
virtual bool criteriaSatisfied();
// Time and under-relaxation consistency
//- Get relaxation factor for velocity field
virtual const dimensionedScalar relaxFactor
(
const volVectorField& U
) const;
public:
// Static Data Members

View file

@ -25,6 +25,10 @@ License
#include "solutionControl.H"
#include "lduMatrix.H"
#include "fvc.H"
#include "inletOutletFvPatchFields.H"
#include "slipFvPatchFields.H"
#include "symmetryFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -218,6 +222,115 @@ Foam::scalar Foam::solutionControl::maxResidual
}
const Foam::dimensionedScalar Foam::solutionControl::relaxFactor
(
const Foam::volVectorField& U
) const
{
scalar urf = 1;
if (mesh_.solutionDict().relaxEquation(U.name()))
{
urf = mesh_.solutionDict().equationRelaxationFactor(U.name());
}
return dimensionedScalar("alphaU", dimless, urf);
}
void Foam::solutionControl::addDdtFluxContribution
(
surfaceScalarField& phi,
surfaceScalarField& aCoeff,
const surfaceVectorField& faceU,
const volVectorField& U,
const surfaceScalarField& rAUf,
const fvVectorMatrix& ddtUEqn
) const
{
// Add ddt scheme dependent flux contribution. Here: phi = H/A & Sf.
phi += fvc::ddtConsistentPhiCorr(faceU, U, rAUf);
// Add ddt scheme dependent contribution to diffusion scale coeff. Here:
// aCoeff = 1.
aCoeff += fvc::interpolate(ddtUEqn.A())*rAUf;
}
void Foam::solutionControl::addUnderRelaxationFluxContribution
(
surfaceScalarField& phi,
surfaceScalarField& aCoeff,
const volVectorField& U
) const
{
// Get under-relaxation factor used in this iteration
const dimensionedScalar alphaU(this->relaxFactor(U));
// Return if the under-relaxation factor is >= 1 and =< 0
if ((alphaU.value() > 1.0 - SMALL) || (alphaU.value() < SMALL))
{
return;
}
const dimensionedScalar urfCoeff((1.0 - alphaU)/alphaU);
// Add under-relaxation dependent flux contribution
phi += urfCoeff*aCoeff*phi.prevIter();
// Add under-relaxation dependent contribution to diffusion scale coeff
aCoeff += urfCoeff*aCoeff;
}
void Foam::solutionControl::correctBoundaryFlux
(
surfaceScalarField& phi,
const volVectorField& U
) const
{
// Get necessary data at the boundaries
const volVectorField::GeometricBoundaryField& Ub = U.boundaryField();
const surfaceVectorField::GeometricBoundaryField& Sb =
mesh_.Sf().boundaryField();
surfaceScalarField::GeometricBoundaryField& phib = phi.boundaryField();
// Correct flux at boundaries depending on patch type. Note: it is possible
// that we missed some important boundary conditions that need special
// considerations when calculating the flux. Maybe we can reorganise this in
// future by relying on distinction between = and == operators for
// fvsPatchFields. However, that would require serious changes at the
// moment (e.g. using phi = rUA*UEqn.H() as in most solvers would not update
// the boundary values correctly for fixed fvsPatchFields). VV, 20/Apr/2017.
forAll (phib, patchI)
{
// Get patch field
const fvPatchVectorField& Up = Ub[patchI];
if
(
Up.fixesValue()
&& !isA<inletOutletFvPatchVectorField>(Up)
)
{
// This is fixed value patch, flux needs to be recalculated
// with respect to the boundary condition
phib[patchI] == (Up & Sb[patchI]);
}
else if
(
isA<slipFvPatchVectorField>(Up)
|| isA<symmetryFvPatchVectorField>(Up)
)
{
// This is slip or symmetry, flux needs to be zero
phib[patchI] == 0.0;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName)
@ -236,7 +349,10 @@ Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName)
transonic_(false),
consistent_(false),
corr_(0),
corrNonOrtho_(0)
corrNonOrtho_(0),
aCoeffPtrs_(),
faceUPtrs_(),
indices_()
{}
@ -246,4 +362,407 @@ Foam::solutionControl::~solutionControl()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solutionControl::calcTransientConsistentFlux
(
surfaceScalarField& phi,
const volVectorField& U,
const volScalarField& rAU,
const fvVectorMatrix& ddtUEqn
) const
{
// Store necessary data for this velocity field
const word& UName = U.name();
// Check whether the fields are present in the list
if (!indices_.found(UName))
{
// Get current index as size of the indices list (before insertion)
const label i = indices_.size();
// Insert the index into the hash table
indices_.insert(UName, i);
// Extend lists
aCoeffPtrs_.resize(indices_.size());
faceUPtrs_.resize(indices_.size());
// Double check whether the fields have been already set
if (!aCoeffPtrs_.set(i) && !faceUPtrs_.set(i))
{
aCoeffPtrs_.set
(
i,
new surfaceScalarField
(
IOobject
(
"aCoeff." + UName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimless, 0.0)
)
);
faceUPtrs_.set
(
i,
new surfaceVectorField
(
IOobject
(
"faceU." + UName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedVector("zero", dimVelocity, vector::zero)
)
);
}
else if (!aCoeffPtrs_.set(i) || !faceUPtrs_.set(i))
{
FatalErrorIn
(
"void solutionControl::calcTransientConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU,"
"\n const fvVectorMatrix& ddtUEqn"
"\n)"
) << "Either aCoeff or faceU is allocated for field " << UName
<< " while the other is not." << nl
<< " This must not happen in transient simulation. Make sure"
<< " that functions aiding consistency are called in the right"
<< " order (first flux and then velocity reconstruction)."
<< exit(FatalError);
}
}
else
{
// Index has been set for this field, so the fields must be there as
// well. Check and report an error if they are not allocated
if (!aCoeffPtrs_.set(indices_[UName]))
{
FatalErrorIn
(
"void solutionControl::calcTransientConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU,"
"\n const fvVectorMatrix& ddtUEqn"
"\n)"
) << "Index is set, but the aCoeff field is not allocated for "
<< UName << "." << nl
<< "This should not happen for transient simulation." << nl
<< "Something went wrong."
<< exit(FatalError);
}
else if (!faceUPtrs_.set(indices_[UName]))
{
FatalErrorIn
(
"void solutionControl::calcTransientConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU,"
"\n const fvVectorMatrix& ddtUEqn"
"\n)"
) << "Index is set, but the faceU field is not allocated for "
<< UName << "." << nl
<< "This should not happen for transient simulation." << nl
<< "Something went wrong."
<< exit(FatalError);
}
}
// Algorithm:
// 1. Update flux and aCoeff due to ddt discretisation
// 2. Update flux and aCoeff due to under-relaxation
// 3. Scale the flux with aCoeff, making sure that flux at fixed boundaries
// remains consistent
// Get index from the hash table
const label i = indices_[UName];
// Get fields that will be updated
surfaceScalarField& aCoeff = aCoeffPtrs_[i];
surfaceVectorField& faceU = faceUPtrs_[i];
// Update face interpolated velocity field. Note: handling of oldTime faceU
// fields happens in ddt scheme when calling ddtConsistentPhiCorr inside
// addDdtFluxContribution
faceU = fvc::interpolate(U);
// Interpolate original rAU on the faces
const surfaceScalarField rAUf = fvc::interpolate(rAU);
// Store previous iteration for the correct handling of under-relaxation
phi.storePrevIter();
// Calculate the ordinary part of the flux (H/A)
phi = (faceU & mesh_.Sf());
// Initialize aCoeff to 1
aCoeff = dimensionedScalar("one", dimless, 1.0);
// STAGE 1: consistent ddt discretisation handling
addDdtFluxContribution(phi, aCoeff, faceU, U, rAUf, ddtUEqn);
// STAGE 2: consistent under-relaxation handling
addUnderRelaxationFluxContribution(phi, aCoeff, U);
// STAGE 3: scale the flux and correct it at the boundaries
phi /= aCoeff;
correctBoundaryFlux(phi, U);
}
void Foam::solutionControl::calcSteadyConsistentFlux
(
surfaceScalarField& phi,
const volVectorField& U
) const
{
// Store necessary data for this velocity field
const word& UName = U.name();
// Check whether the fields are present in the list
if (!indices_.found(UName))
{
// Get current index as size of the indices list (before insertion)
const label i = indices_.size();
// Insert the index into the hash table
indices_.insert(UName, i);
// Extend list (only aCoeff list because faceU does not need to be
// stored for steady state simulations)
aCoeffPtrs_.resize(indices_.size());
// Double check whether the aCoeff field has been already set. Note:
// faceU does not need to be stored for steady state
if (!aCoeffPtrs_.set(i) && faceUPtrs_.empty())
{
aCoeffPtrs_.set
(
i,
new surfaceScalarField
(
IOobject
(
"aCoeff." + UName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimless, 0.0)
)
);
}
else if (!aCoeffPtrs_.set(i) || !faceUPtrs_.empty())
{
FatalErrorIn
(
"void solutionControl::calcSteadyConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU"
"\n)"
) << "Either aCoeff or faceU is allocated for field " << UName
<< " while the other is not."
<< "This must not happen in transient simulation. Make sure"
<< " that functions aiding consistency are called in the right"
<< " order (first flux and then velocity reconstruction)."
<< exit(FatalError);
}
}
else
{
// Index has been set for this field. Check the state of fields
if (!aCoeffPtrs_.set(indices_[UName]))
{
// aCoeff field should be allocated
FatalErrorIn
(
"void solutionControl::calcSteadyConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU"
"\n)"
) << "Index is set, but the aCoeff field is not allocated for "
<< UName << "." << nl
<< "This should not happen for steady state simulation." << nl
<< "Something went wrong."
<< exit(FatalError);
}
else if (!faceUPtrs_.empty())
{
// faceU field shouldn't be allocated
FatalErrorIn
(
"void solutionControl::calcSteadyConsistentFlux"
"\n("
"\n surfaceScalarField& phi,"
"\n const volVectorField& U,"
"\n const volScalarField& rAU"
"\n)"
) << "Index is set, but the faceU field is allocated for "
<< UName << "." << nl
<< "This should not happen for steady state simulation." << nl
<< "Something went wrong."
<< exit(FatalError);
}
}
// Algorithm:
// 1. Update flux and aCoeff due to under-relaxation
// 2. Scale the flux with aCoeff, making sure that flux at fixed boundaries
// remains consistent
// Get index from the hash table
const label i = indices_[UName];
// Get aCoeff field. Note: no need to check whether the entry has been found
// since we have just inserted it above
surfaceScalarField& aCoeff = aCoeffPtrs_[i];
// Store previous iteration for the correct handling of under-relaxation
phi.storePrevIter();
// Calculate the ordinary part of the flux (H/A)
phi = (fvc::interpolate(U) & mesh_.Sf());
// Initialize aCoeff to 1
aCoeff = dimensionedScalar("one", dimless, 1.0);
// STAGE 1: consistent under-relaxation handling
addUnderRelaxationFluxContribution(phi, aCoeff, U);
// STAGE 2: scale the flux and correct it at the boundaries
phi /= aCoeff;
correctBoundaryFlux(phi, U);
}
void Foam::solutionControl::reconstructTransientVelocity
(
volVectorField& U,
surfaceScalarField& phi,
const fvVectorMatrix& ddtUEqn,
const volScalarField& rAU,
const volScalarField& p
) const
{
// Reconstruct the velocity using all the components from original equation
U = 1.0/(1.0/rAU + ddtUEqn.A())*
(
U/rAU + ddtUEqn.H() - fvc::grad(p)
);
// Get name and the corresponding index
const word& UName = U.name();
const label i = indices_[UName];
// Update divergence free face velocity field, whose value will be used in
// the next time step. Note that we need to have absolute flux here.
if (!faceUPtrs_.set(i))
{
FatalErrorIn
(
"void solutionControl::reconstructTransientVelocity"
"\n("
"\n volVectorField& U,"
"\n const volVectorField& ddtUEqn,"
"\n const volScalarField& rAU,"
"\n const volScalarField& p"
"\n const surfaceScalarField& phi"
"\n) const"
) << "faceU not calculated for field " << UName
<< ". Make sure you have called"
<< " calcTransientConsistentFlux(...) before calling this function."
<< exit(FatalError);
}
// Get faceU field. Note: no need to check whether the entry has been found
// since we have just checked
surfaceVectorField& faceU = faceUPtrs_[i];
// First interpolate the reconstructed velocity on the faces
faceU = fvc::interpolate(U);
// Replace the normal component with conservative flux
const surfaceVectorField& Sf = mesh_.Sf();
const surfaceVectorField rSf = Sf/magSqr(Sf);
// Subtract interpolated normal component
faceU -= (Sf & faceU)*rSf;
// Now that the normal component is zero, add the normal component from
// conservative flux
faceU += phi*rSf;
// If the mesh is moving, flux needs to be relative before boundary
// conditions for velocity are corrected. VV and IG, 4/Jan/2016.
fvc::makeRelative(phi, U);
// Correct boundary conditions with relative flux
U.correctBoundaryConditions();
}
void Foam::solutionControl::reconstructSteadyVelocity
(
volVectorField& U,
const volScalarField& rAU,
const volScalarField& p
) const
{
// Reconstruct the velocity field
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
// Note: no need to store and update faceU field for steady state run
}
const Foam::surfaceScalarField& Foam::solutionControl::aCoeff
(
const word& UName
) const
{
// Get corresponding index
const label i = indices_[UName];
if (!aCoeffPtrs_.set(i))
{
FatalErrorIn
(
"const surfaceScalarField& solutionControl::aCoeff() const"
) << "aCoeff not calculated for field " << UName
<< ". Make sure you have called"
<< " calcTransientConsistentFlux(...) or "
<< " calcSteadyConsistentFlux(...) before calling aCoeff()."
<< exit(FatalError);
}
return aCoeffPtrs_[i];
}
// ************************************************************************* //

View file

@ -25,7 +25,9 @@ Class
Foam::solutionControl
Description
Base class for solution control classes
Base class for solution control classes.
The class also provides additional member functions for calculation
of time and under-relaxation consistent flux and velocity.
\*---------------------------------------------------------------------------*/
@ -143,8 +145,65 @@ protected:
) const;
// Time and under-relaxation consistency helper functions
//- Get relaxation factor for velocity field. Overriden in
// pimpleControl since different relaxation factor may be used for
// final iteration.
virtual const dimensionedScalar relaxFactor
(
const volVectorField& U
) const;
//- Add consistent flux contribution arising from time derivative
// term. Note: aCoeff is parameter for clarity
void addDdtFluxContribution
(
surfaceScalarField& phi,
surfaceScalarField& aCoeff,
const surfaceVectorField& faceU,
const volVectorField& U,
const surfaceScalarField& rAUf,
const fvVectorMatrix& ddtUEqn
) const;
//- Add consistent flux contribution arising from the
// under-relaxation. Note: aCoeff is parameter for clarity
void addUnderRelaxationFluxContribution
(
surfaceScalarField& phi,
surfaceScalarField& aCoeff,
const volVectorField& U
) const;
//- Correct flux at the boundaries
void correctBoundaryFlux
(
surfaceScalarField& phi,
const volVectorField& U
) const;
private:
// Private data
// Fields necessary for time and under-relaxation consistency
//- A coeff (A^~) arising from consistency formulation. Note: we can
// have multiple pressure/velocity systems, hence the PtrList
mutable PtrList<surfaceScalarField> aCoeffPtrs_;
//- Face velocity needed for consistent formulation. Note: we can
// have multiple pressure/velocity systems, hence the PtrList
mutable PtrList<surfaceVectorField> faceUPtrs_;
//- Hash Table containing indices of PtrLists for given names
mutable HashTable<label> indices_;
// Private member functions
//- Disallow default bitwise copy construct
solutionControl(const solutionControl&);
@ -204,6 +263,54 @@ public:
inline bool consistent() const;
// Time and under-relaxation consistency.
// Note: argument matching U parameter needs to be equal U = H/A, where
// H and A come from convection-difussion equation only (without time
// derivative term)
//- Calculate consistent flux for transient solvers (before pressure
// equation).
void calcTransientConsistentFlux
(
surfaceScalarField& phi,
const volVectorField& U,
const volScalarField& rAU,
const fvVectorMatrix& ddtUEqn
) const;
//- Calculate consistent flux for steady state solvers (before
// pressure equation).
void calcSteadyConsistentFlux
(
surfaceScalarField& phi,
const volVectorField& U
) const;
//- Reconstruct velocity for transient solvers (after pressure
// equation and flux reconstruction).
void reconstructTransientVelocity
(
volVectorField& U,
surfaceScalarField& phi,
const fvVectorMatrix& ddtUEqn,
const volScalarField& rAU,
const volScalarField& p
) const;
//- Reconstruct velocity for steady state solvers (after pressure
// equation and flux reconstruction).
void reconstructSteadyVelocity
(
volVectorField& U,
const volScalarField& rAU,
const volScalarField& p
) const;
//- Const access to aCoeff (needed for pressure equation) given the
// name of the velocity field
const surfaceScalarField& aCoeff(const word& UName) const;
// Evolution
//- Main control loop

View file

@ -651,6 +651,19 @@ CoEulerDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename CoEulerDdtScheme<Type>::fluxFieldType>
CoEulerDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return (mesh().Sf() & faceU.oldTime())*rAUf*CofrDeltaT();
}
template<class Type>
tmp<surfaceScalarField> CoEulerDdtScheme<Type>::meshPhi
(

View file

@ -173,6 +173,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -199,6 +209,15 @@ tmp<surfaceScalarField> CoEulerDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> CoEulerDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -1167,6 +1167,53 @@ CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename CrankNicolsonDdtScheme<Type>::fluxFieldType>
CrankNicolsonDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
// Store old ddt field for faceU, necessary for consistent flux evaluation
DDt0Field<GeometricField<Type, fvsPatchField, surfaceMesh> >& faceUDdt0 =
ddt0_<GeometricField<Type, fvsPatchField, surfaceMesh> >
(
"ddt0(" + faceU.name() + ')',
faceU.dimensions()
);
// Trigger storage of faceU old time values
faceU.oldTime().oldTime();
// Evaluate faceU ddt if necessary
if (evaluate(faceUDdt0))
{
// Update ddt(faceU)
faceUDdt0 =
(
rDtCoef0_(faceUDdt0)*
(
faceU.oldTime()
- faceU.oldTime().oldTime()
)
- offCentre_(faceUDdt0())
);
}
return
rAUf*
(
mesh().Sf()
& (
rDtCoef_(faceUDdt0)*faceU.oldTime()
+ offCentre_(faceUDdt0())
)
);
}
template<class Type>
tmp<surfaceScalarField> CrankNicolsonDdtScheme<Type>::meshPhi
(

View file

@ -245,6 +245,15 @@ public:
);
// Member functions for the new time consistent formulation
virtual tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -271,6 +280,15 @@ tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -513,6 +513,19 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename EulerDdtScheme<Type>::fluxFieldType>
EulerDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return (mesh().Sf() & faceU.oldTime())*rAUf/mesh().time().deltaT();
}
template<class Type>
tmp<surfaceScalarField> EulerDdtScheme<Type>::meshPhi
(

View file

@ -151,6 +151,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -177,6 +187,15 @@ tmp<surfaceScalarField> EulerDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> EulerDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -656,6 +656,19 @@ SLTSDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename SLTSDdtScheme<Type>::fluxFieldType>
SLTSDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return (mesh().Sf() & faceU.oldTime())*rAUf*fvc::interpolate(SLrDeltaT());
}
template<class Type>
tmp<surfaceScalarField> SLTSDdtScheme<Type>::meshPhi
(

View file

@ -174,6 +174,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -200,6 +210,15 @@ tmp<surfaceScalarField> SLTSDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> SLTSDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -714,6 +714,39 @@ backwardDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename backwardDdtScheme<Type>::fluxFieldType>
backwardDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
const scalar deltaT = deltaT_();
const scalar deltaT0 = deltaT0_(U);
const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
const scalar coefft0 = coefft + coefft00;
const scalar rDeltaT = 1.0/deltaT;
const dimensionedScalar beta("beta", dimless/dimTime, coefft0*rDeltaT);
const dimensionedScalar gamma("gamma", dimless/dimTime, -coefft00*rDeltaT);
return
rAUf*
(
mesh().Sf()
& (
beta*faceU.oldTime()
+ gamma*faceU.oldTime().oldTime()
)
);
}
template<class Type>
tmp<surfaceScalarField> backwardDdtScheme<Type>::meshPhi
(

View file

@ -163,6 +163,15 @@ public:
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -189,6 +198,15 @@ tmp<surfaceScalarField> backwardDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> backwardDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -659,6 +659,22 @@ tmp<surfaceScalarField> boundedBackwardDdtScheme::fvcDdtPhiCorr
}
tmp<surfaceScalarField> boundedBackwardDdtScheme::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
)
{
notImplemented
(
"boundedBackwardDdtScheme::fvcDdtConsistentPhiCorr"
);
return surfaceScalarField::null();
}
tmp<surfaceScalarField> boundedBackwardDdtScheme::meshPhi
(
const volScalarField& vf

View file

@ -171,6 +171,16 @@ public:
const surfaceScalarField& phi
);
// Member functions for the new time consistent formulation
tmp<surfaceScalarField> fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const volScalarField&

View file

@ -222,6 +222,15 @@ public:
) = 0;
// Member functions for the new time consistent formulation
virtual tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
) = 0;
virtual tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -282,9 +291,20 @@ tmp<surfaceScalarField> SS<scalar>::fvcDdtPhiCorr \
{ \
notImplemented(#SS"<scalar>::fvcDdtPhiCorr"); \
return surfaceScalarField::null(); \
} \
\
template<> \
tmp<surfaceScalarField> SS<scalar>::fvcDdtConsistentPhiCorr \
( \
const surfaceScalarField& faceU, \
const volScalarField& U, \
const surfaceScalarField& rAUf \
) \
{ \
notImplemented(#SS"<scalar>::fvcDdtConsistentPhiCorr"); \
return surfaceScalarField::null(); \
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository

View file

@ -658,6 +658,19 @@ steadyInertialDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename steadyInertialDdtScheme<Type>::fluxFieldType>
steadyInertialDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return (mesh().Sf() & faceU.oldTime())*rAUf*CofrDeltaT();
}
template<class Type>
tmp<surfaceScalarField> steadyInertialDdtScheme<Type>::meshPhi
(

View file

@ -174,6 +174,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -200,6 +210,15 @@ tmp<surfaceScalarField> steadyInertialDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> steadyInertialDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -330,6 +330,38 @@ steadyStateDdtScheme<Type>::fvcDdtPhiCorr
}
template<class Type>
tmp<typename steadyStateDdtScheme<Type>::fluxFieldType>
steadyStateDdtScheme<Type>::fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return tmp<fluxFieldType>
(
new fluxFieldType
(
IOobject
(
"ddtConsistentPhiCorr("
+ faceU.name() + "," + rAUf.name() + ')',
mesh().time().timeName(),
mesh()
),
mesh(),
dimensioned<typename flux<Type>::type>
(
"zero",
faceU.dimensions()*dimArea/rAUf.dimensions()/dimTime,
pTraits<typename flux<Type>::type>::zero
)
)
);
}
template<class Type>
tmp<surfaceScalarField> steadyStateDdtScheme<Type>::meshPhi
(

View file

@ -150,6 +150,16 @@ public:
const fluxFieldType& phi
);
// Member functions for the new time consistent formulation
tmp<fluxFieldType> fvcDdtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
tmp<surfaceScalarField> meshPhi
(
const GeometricField<Type, fvPatchField, volMesh>&
@ -176,6 +186,15 @@ tmp<surfaceScalarField> steadyStateDdtScheme<scalar>::fvcDdtPhiCorr
);
template<>
tmp<surfaceScalarField> steadyStateDdtScheme<scalar>::fvcDdtConsistentPhiCorr
(
const surfaceScalarField& faceU,
const volScalarField& U,
const surfaceScalarField& rAUf
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View file

@ -156,6 +156,23 @@ ddtPhiCorr
}
template<class Type>
tmp<GeometricField<typename flux<Type>::type, fvsPatchField, surfaceMesh> >
ddtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
)
{
return fv::ddtScheme<Type>::New
(
U.mesh(),
U.mesh().schemesDict().ddtScheme("ddt(" + U.name() + ')')
)().fvcDdtConsistentPhiCorr(faceU, U, rAUf);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc

View file

@ -122,6 +122,25 @@ namespace fvc
surfaceMesh
>& phi
);
// Functions for the new time consistent formulation
template<class Type>
tmp
<
GeometricField
<
typename Foam::flux<Type>::type,
fvsPatchField,
surfaceMesh
>
>
ddtConsistentPhiCorr
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& faceU,
const GeometricField<Type, fvPatchField, volMesh>& U,
const surfaceScalarField& rAUf
);
}

View file

@ -1669,6 +1669,24 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::relax(const fvMatrix<Type>& m)
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::relax
(
const tmp<fvMatrix<Type> >& tm,
const scalar alpha
)
{
return relax(tm(), alpha);
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::relax(const tmp<fvMatrix<Type> >& tm)
{
return relax(tm());
}
template<class Type>
Foam::lduSolverPerformance Foam::solve
(

View file

@ -521,6 +521,7 @@ void checkMethod
const char*
);
template<class Type>
void checkMethod
(
@ -529,6 +530,7 @@ void checkMethod
const char*
);
template<class Type>
void checkMethod
(
@ -537,7 +539,8 @@ void checkMethod
const char*
);
//- Relax and return a copy of the matrix giver relaxation factor
//- Relax and return a copy of the matrix given relaxation factor
template<class Type>
tmp<fvMatrix<Type> > relax
(
@ -551,6 +554,21 @@ template<class Type>
tmp<fvMatrix<Type> > relax(const fvMatrix<Type>&);
//- Relax and return a copy of the matrix given tmp to a matrix and relaxation
// factor
template<class Type>
tmp<fvMatrix<Type> > relax
(
const tmp<fvMatrix<Type> >&,
const scalar
);
//- Relax and return a copy of the matrix given tmp to a matrix
template<class Type>
tmp<fvMatrix<Type> > relax(const tmp<fvMatrix<Type> >&);
//- Solve returning the solution statistics given convergence tolerance
// Use the given solver controls
template<class Type>

View file

@ -40,7 +40,7 @@ if (&(df1).mesh() != &(df2).mesh()) \
FatalErrorIn("checkField(df1, df2, op)") \
<< "different mesh for fields " \
<< (df1).name() << " and " << (df2).name() \
<< " during operatrion " << op \
<< " during operation " << op \
<< abort(FatalError); \
}

View file

@ -38,7 +38,7 @@ if ((gf1).mesh() != (gf2).mesh()) \
FatalErrorIn("checkField(gf1, gf2, op)") \
<< "different mesh for fields " \
<< (gf1).name() << " and " << (gf2).name() \
<< " during operatrion " << op \
<< " during operation " << op \
<< abort(FatalError); \
}

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (26.3389 6.5036 0);
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform (26.3389 6.5036 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (26.3389 6.5036 0);
}
solidWall
{
type fixedValue;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View file

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.0005723;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform 0.0005723;
}
outlet
{
type zeroGradient;
}
solidWall
{
type kqRWallFunction;
value uniform 0.0005723;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
solidWall
{
type nutWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 0.42797;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform 0.42797;
}
outlet
{
type zeroGradient;
}
solidWall
{
type omegaWallFunction;
refValue uniform 0;
value uniform 0.42797;
Cmu 0.09;
kappa 0.41;
E 9.8;
beta1 0.075;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
solidWall
{
type zeroGradient;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,11 @@
#!/bin/bash
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanTimeDirectories
\rm -rf 0
\rm -rf surfaces
\rm -f validationData/*.raw
\rm -rf validationResults
cp -r save 0

View file

@ -0,0 +1,19 @@
#!/bin/bash
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=pisoFoam
runApplication $application
runApplication sample -latestTime
timeStep=$(grep "^endTime" system/controlDict | awk '{ print $2 }' | sed 's/;//g')
cp -v surfaces/$timeStep/p_solidWall.raw validationData/
./validationData/gnuplot
mkdir -v validationResults
mv -v *.png validationResults/
gnome-open validationResults/Cp.png

View file

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
|*---------------------------------------------------------------------------*|
| File created by CFD support s.r.o., Mon Aug 17 06:22:27 2015 |
| http://www.cdfsupport.com |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.3;
format ascii;
class dictionary;
location "constant";
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
// ************************************************************************* //

View file

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
4
(
frontAndBack
{
type empty;
nFaces 55404;
startFace 54975;
}
inlet
{
type patch;
nFaces 486;
startFace 110379;
}
outlet
{
type patch;
nFaces 114;
startFace 110865;
}
solidWall
{
type wall;
nFaces 258;
startFace 110979;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,26 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
|*---------------------------------------------------------------------------*|
| File created by CFD support s.r.o., Mon Aug 17 06:22:42 2015 |
| http://www.cdfsupport.com |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.3;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1.605e-05;
// ************************************************************************* //

View file

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RASModel;
// ************************************************************************* //

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (26.3389 6.5036 0);
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform (26.3389 6.5036 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (26.3389 6.5036 0);
}
solidWall
{
type fixedValue;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View file

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.0005723;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform 0.0005723;
}
outlet
{
type zeroGradient;
}
solidWall
{
type kqRWallFunction;
value uniform 0.0005723;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
solidWall
{
type nutWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 0.42797;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type fixedValue;
value uniform 0.42797;
}
outlet
{
type zeroGradient;
}
solidWall
{
type omegaWallFunction;
refValue uniform 0;
value uniform 0.42797;
Cmu 0.09;
kappa 0.41;
E 9.8;
beta1 0.075;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
frontAndBack
{
type empty;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
solidWall
{
type zeroGradient;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pisoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.001;
writeControl runTime;
writeInterval 0.1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View file

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default backward;
}
gradSchemes
{
default cellLimited leastSquares 1;
gradU cellLimited leastSquares 1;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind gradU;
div(phi,k) Gauss upwind;
div(phi,omega) Gauss upwind;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear limited 0.5;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default limited 0.5;
}
// ************************************************************************* //

View file

@ -0,0 +1,116 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver amgSolver;
cycle V-cycle;
policy PAMG;
interpolation direct;
nPreSweeps 2;
nPostSweeps 2;
groupSize 4;
minCoarseEqns 100;
nMaxLevels 100;
scale on;
smoother GaussSeidel;
minIter 1;
maxIter 200;
tolerance 1e-7;
relTol 0.01;
}
pFinal
{
solver amgSolver;
cycle V-cycle;
policy PAMG;
interpolation direct;
nPreSweeps 2;
nPostSweeps 2;
groupSize 4;
minCoarseEqns 100;
nMaxLevels 100;
scale on;
smoother GaussSeidel;
minIter 1;
maxIter 200;
tolerance 1e-7;
relTol 0.0;
}
U
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.01;
minIter 1;
}
UFinal
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.0;
minIter 1;
}
k
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
minIter 1;
}
omega
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
minIter 1;
}
}
PISO
{
nCorrectors 4;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
U 1;
k 0.7;
epsilon 0.7;
}
fields
{
p 1;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,85 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver amgSolver;
cycle V-cycle;
policy PAMG;
interpolation direct;
nPreSweeps 2;
nPostSweeps 2;
groupSize 4;
minCoarseEqns 100;
nMaxLevels 100;
scale on;
smoother GaussSeidel;
minIter 1;
maxIter 200;
tolerance 1e-7;
relTol 0.01;
}
U
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.01;
minIter 1;
}
k
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
minIter 1;
}
omega
{
solver BiCGStab;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
minIter 1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
convergence 1e-5;
}
relaxationFactors
{
equations
{
U VELOCITY-URF;
k 0.7;
epsilon 0.7;
}
fields
{
p 0.3;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
interpolationScheme cellPoint;
surfaceFormat raw;
setFormat gnuplot;
sets
();
fields (
p
);
surfaces
(
solidWall
{
type patch;
patchName solidWall;
rhoName rhoInf;
rhoInf 1.0; //Reference density for fluid
outputInterval: 1.0
interpolate true;
triangulate false;
}
);
// *********************************************************************** //

View file

@ -0,0 +1,48 @@
0.9012 -0.3490138
0.89344968 -0.2554269
0.82171416 -0.02505875
0.73781244 0.09012508
0.68914764 0.1261201
0.59443152 0.1837125
0.52954512 0.2341051
0.46555992 0.2772994
0.40157472 0.3204932
0.33921168 0.363687
0.27612768 0.4212794
0.24404496 0.4500751
0.21574728 0.4788713
0.18690888 0.5076675
0.14383152 0.5724578
0.1153536 0.637249
0.0729972 0.7884283
0.04560072 0.9180102
0.02550396 0.9900002
0.00738984 0.1693139
-0.00027036 -6.209
0.0130674 -5.121951
0.02667552 -3.682151
0.04406868 -3.408589
0.06777024 -3.077435
0.09093108 -2.767878
0.11562396 -2.559107
0.13734288 -2.422326
0.16509984 -2.235152
0.1933074 -2.098371
0.22367784 -1.947192
0.25476924 -1.81761
0.28739268 -1.680829
0.31614096 -1.558445
0.35137788 -1.392869
0.38310012 -1.256088
0.41473224 -1.133705
0.44528292 -1.018521
0.47736564 -0.8961382
0.51034956 -0.795352
0.53810652 -0.7017651
0.56622396 -0.629775
0.5938908 -0.5721827
0.64868385 -0.4929938
0.71131716 -0.4426007
0.80008536 -0.4066057
0.83874684 -0.4066057
0.85695108 -0.4066057

View file

@ -0,0 +1,11 @@
#!/bin/bash
gnuplot -persist << 'EOF'
set term pngcairo dashed size 1024,768 font "Arial,12"
set output "Cp.png"
set yrange [* : *] reverse;
plot './validationData/cp.dat' using 1:2 title'C_p Experimetal data', \
'./validationData/p_solidWall.raw' using 1:($4/368.018) title 'C_p CFD' ;
EOF

View file

@ -0,0 +1,9 @@
Author: Filip Sutalo, sutalo.filip1@gmail.com
Reference experimental data:
https://turbmodels.larc.nasa.gov/naca4412sep_val.html
Notes:
1. Since flow separation occurs, we should have performed averaging of the
results instead of taking the last iteration solution for comparison.
2. There are some doubts regarding experimental measurements.

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (44.31525 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type fixedValue;
value uniform (0 0 0);
}
lowerWall
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.079598;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type epsilonWallFunction;
refValue uniform 0;
value $internalField;
Cmu 0.09;
kappa 0.41;
E 9.8;
}
lowerWall
{
type epsilonWallFunction;
refValue uniform 0;
value $internalField;
Cmu 0.09;
kappa 0.41;
E 9.8;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 294.57e-03;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type kqRWallFunction;
value $internalField;
}
lowerWall
{
type kqRWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 97.37245;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type omegaWallFunction;
value $internalField;
}
lowerWall
{
type omegaWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
upperWall
{
type zeroGradient;
}
lowerWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,12 @@
#!/bin/bash
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
\rm -rf 0
\rm -rf surfaces sets
\rm -f validationData/*.raw
\rm -f validationData/*.xy
\rm -rf validationResults
cp -r save 0

View file

@ -0,0 +1,25 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=simpleFoam
runApplication blockMesh
runApplication potentialFoam
runApplication $application
runApplication sample -latestTime
timeStep=$(grep "^endTime" system/controlDict | awk '{ print $2 }' | sed 's/;//g')
cp -v surfaces/$timeStep/p_lowerWall.raw validationData/
cp -v sets/$timeStep/profile_?_U.xy validationData/
./validationData/gnuplot
mkdir -v validationResults
mv -v *.png validationResults/
cp -v validationData/BFSLines.pdf validationResults/
gnome-open validationResults/Cp.png

View file

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
RASModel kOmegaSST;//kEpsilon;
turbulence on;
// ************************************************************************* //

View file

@ -0,0 +1,104 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;//0.0127;
vertices
(
(-110 9 0)
(-110 1 0)
(0 1 0)
(0 0 0)
(50 0 0)
(50 1 0)
(50 9 0)
(0 9 0)
(-110 9 1)
(-110 1 1)
(0 1 1)
(0 0 1)
(50 0 1)
(50 1 1)
(50 9 1)
(0 9 1)
(-130 9 0)
(-130 1 0)
(-130 9 1)
(-130 1 1)
);
blocks
(
hex (17 1 0 16 19 9 8 18) (15 45 1) simpleGrading (0.85925 7.95 1) //(100 40 1)
hex (1 2 7 0 9 10 15 8) (262 45 1) simpleGrading (0.04368 7.95 1) //(550 40 1)
hex (2 5 6 7 10 13 14 15) (330 45 1) simpleGrading (5.1341 7.95 1) //(250 40 1)
hex (3 4 5 2 11 12 13 10) (330 19 1) simpleGrading (5.1341 1 1) //(250 10 1)
);
edges
(
);
patches
(
patch inlet
(
(16 17 19 18)
)
patch outlet
(
(5 6 14 13)
(4 5 13 12)
)
patch symmetry
(
(0 16 18 8)
(1 9 19 17)
)
wall upperWall
(
(0 8 15 7)
(7 15 14 6)
)
wall lowerWall
(
(1 9 10 2)
(2 10 11 3)
(3 11 12 4)
)
empty frontAndBack
(
(0 7 2 1)
(2 7 6 5)
(2 5 4 3)
(8 9 10 15)
(10 13 14 15)
(10 11 12 13)
(8 18 19 9)
(1 17 16 0)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6
(
inlet
{
type patch;
nFaces 45;
startFace 66499;
}
outlet
{
type patch;
nFaces 64;
startFace 66544;
}
symmetry
{
type patch;
nFaces 30;
startFace 66608;
}
upperWall
{
type wall;
nFaces 592;
startFace 66638;
}
lowerWall
{
type wall;
nFaces 611;
startFace 67230;
}
frontAndBack
{
type empty;
nFaces 67170;
startFace 67841;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1.230979e-03;
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (44.31525 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type fixedValue;
value uniform (0 0 0);
}
lowerWall
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.079598;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type epsilonWallFunction;
refValue uniform 0;
value $internalField;
Cmu 0.09;
kappa 0.41;
E 9.8;
}
lowerWall
{
type epsilonWallFunction;
refValue uniform 0;
value $internalField;
Cmu 0.09;
kappa 0.41;
E 9.8;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 294.57e-03;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type kqRWallFunction;
value $internalField;
}
lowerWall
{
type kqRWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 97.37245;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type omegaWallFunction;
value $internalField;
}
lowerWall
{
type omegaWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
upperWall
{
type zeroGradient;
}
lowerWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
symmetry
{
type symmetryPlane;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1000;
deltaT 1;
writeControl timeStep;
writeInterval 1000;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

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