Backported dnsFoam, mhdFoam, equationReaderDemo and tutorials (vanilla OF 3.0.1)
This commit is contained in:
parent
b4f8bce87c
commit
4a87e64c33
14 changed files with 34 additions and 73 deletions
|
@ -27,3 +27,5 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "createPhi.H"
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
mesh.schemesDict().setFluxRequired(p.name());
|
||||||
|
|
|
@ -35,6 +35,7 @@ Description
|
||||||
#include "fft.H"
|
#include "fft.H"
|
||||||
#include "calcEk.H"
|
#include "calcEk.H"
|
||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMeshNoClear.H"
|
#include "createMeshNoClear.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
#include "readTransportProperties.H"
|
#include "readTransportProperties.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "readTurbulenceProperties.H"
|
#include "readTurbulenceProperties.H"
|
||||||
|
@ -57,8 +61,6 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
|
||||||
|
|
||||||
force.internalField() = ReImSum
|
force.internalField() = ReImSum
|
||||||
(
|
(
|
||||||
fft::reverseTransform
|
fft::reverseTransform
|
||||||
|
@ -83,7 +85,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
|
|
||||||
for (int corr=1; corr<=1; corr++)
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
volScalarField rUA = 1.0/UEqn.A();
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
|
|
@ -104,4 +104,7 @@
|
||||||
|
|
||||||
label pRefCell = 0;
|
label pRefCell = 0;
|
||||||
scalar pRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
setRefCell(p, piso.dict(), pRefCell, pRefValue);
|
||||||
|
mesh.schemesDict().setFluxRequired(p.name());
|
||||||
|
|
||||||
|
mesh.schemesDict().setFluxRequired(pB.name());
|
||||||
|
|
|
@ -50,6 +50,7 @@ Description
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -59,6 +60,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
@ -69,7 +73,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while (runTime.loop())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
# include "readPISOControls.H"
|
|
||||||
# include "readBPISOControls.H"
|
# include "readBPISOControls.H"
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
@ -91,7 +94,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
|
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
volScalarField rUA = 1.0/UEqn.A();
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
@ -100,7 +103,7 @@ int main(int argc, char *argv[])
|
||||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rUA, U, phi);
|
+ fvc::ddtPhiCorr(rUA, U, phi);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
|
@ -110,7 +113,7 @@ int main(int argc, char *argv[])
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,4 @@
|
||||||
|
|
||||||
UEqn().relax();
|
UEqn().relax();
|
||||||
|
|
||||||
eqnResidual = solve
|
solve(UEqn() == -fvc::grad(p));
|
||||||
(
|
|
||||||
UEqn() == -fvc::grad(p)
|
|
||||||
).initialResidual();
|
|
||||||
|
|
||||||
maxResidual = max(eqnResidual, maxResidual);
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
label pRefCell = 0;
|
label pRefCell = 0;
|
||||||
scalar pRefValue = 0.0;
|
scalar pRefValue = 0.0;
|
||||||
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
|
setRefCell(p, simple.dict(), pRefCell, pRefValue);
|
||||||
|
mesh.schemesDict().setFluxRequired(p.name());
|
||||||
|
|
||||||
|
|
||||||
singlePhaseTransportModel laminarTransport(U, phi);
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
|
@ -36,6 +36,7 @@ Author
|
||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
#include "IOEquationReader.H"
|
#include "IOEquationReader.H"
|
||||||
|
#include "simpleControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
simpleControl simple(mesh);
|
||||||
|
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "createEquationReader.H"
|
# include "createEquationReader.H"
|
||||||
# include "loadEquationData.H"
|
# include "loadEquationData.H"
|
||||||
|
@ -54,22 +58,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while (runTime.loop())
|
while (simple.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
dictionary simple = mesh.solutionDict().subDict("SIMPLE");
|
|
||||||
|
|
||||||
int nNonOrthCorr =
|
|
||||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
|
||||||
|
|
||||||
bool momentumPredictor =
|
|
||||||
simple.lookupOrDefault<Switch>("momentumPredictor", true);
|
|
||||||
|
|
||||||
# include "initConvergenceCheck.H"
|
|
||||||
|
|
||||||
p.storePrevIter();
|
|
||||||
|
|
||||||
// Pressure-velocity SIMPLE corrector
|
// Pressure-velocity SIMPLE corrector
|
||||||
{
|
{
|
||||||
# include "UEqn.H"
|
# include "UEqn.H"
|
||||||
|
@ -85,8 +77,6 @@ int main(int argc, char *argv[])
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
# include "convergenceCheck.H"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
|
@ -16,18 +16,9 @@
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
// Retain the residual from the first iteration
|
pEqn.solve();
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
eqnResidual = pEqn.solve().initialResidual();
|
|
||||||
maxResidual = max(eqnResidual, maxResidual);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | foam-extend: Open Source CFD |
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
| \\ / O peration | Version: 3.2 |
|
| \\ / O peration | Version: 4.0 |
|
||||||
| \\ / A nd | Web: http://www.foam-extend.org |
|
| \\ / A nd | Web: http://www.foam-extend.org |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | For copyright notice see file Copyright |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
FoamFile
|
FoamFile
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,10 +50,4 @@ snGradSchemes
|
||||||
default corrected;
|
default corrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
|
||||||
{
|
|
||||||
default no;
|
|
||||||
p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | foam-extend: Open Source CFD |
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
| \\ / O peration | Version: 3.2 |
|
| \\ / O peration | Version: 4.0 |
|
||||||
| \\ / A nd | Web: http://www.foam-extend.org |
|
| \\ / A nd | Web: http://www.foam-extend.org |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | For copyright notice see file Copyright |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
FoamFile
|
FoamFile
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,11 +56,4 @@ snGradSchemes
|
||||||
default corrected;
|
default corrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
|
||||||
{
|
|
||||||
default no;
|
|
||||||
p;
|
|
||||||
pB;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -35,8 +35,7 @@ divSchemes
|
||||||
div(phi,R) Gauss upwind;
|
div(phi,R) Gauss upwind;
|
||||||
div(R) Gauss linear;
|
div(R) Gauss linear;
|
||||||
div(phi,nuTilda) Gauss upwind;
|
div(phi,nuTilda) Gauss upwind;
|
||||||
div((nuEff*dev(grad(U).T()))) Gauss linear; // backwards compatibility
|
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||||
div((nuEff*dev(T(grad(U))))) Gauss linear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
||||||
|
@ -61,10 +60,4 @@ snGradSchemes
|
||||||
default corrected;
|
default corrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
|
||||||
{
|
|
||||||
default no;
|
|
||||||
p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -53,12 +53,6 @@ multiSolver
|
||||||
{
|
{
|
||||||
default corrected;
|
default corrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
|
||||||
{
|
|
||||||
default no;
|
|
||||||
p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
icoFoam2
|
icoFoam2
|
||||||
|
|
Reference in a new issue