Backported dnsFoam, mhdFoam, equationReaderDemo and tutorials (vanilla OF 3.0.1)

This commit is contained in:
Vanja Skuric 2016-05-28 13:01:02 +02:00
parent b4f8bce87c
commit 4a87e64c33
14 changed files with 34 additions and 73 deletions

View file

@ -27,3 +27,5 @@
);
# include "createPhi.H"
mesh.schemesDict().setFluxRequired(p.name());

View file

@ -35,6 +35,7 @@ Description
#include "fft.H"
#include "calcEk.H"
#include "graph.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMeshNoClear.H"
pisoControl piso(mesh);
#include "readTransportProperties.H"
#include "createFields.H"
#include "readTurbulenceProperties.H"
@ -57,8 +61,6 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readPISOControls.H"
force.internalField() = ReImSum
(
fft::reverseTransform
@ -83,7 +85,7 @@ int main(int argc, char *argv[])
// --- PISO loop
for (int corr=1; corr<=1; corr++)
while (piso.correct())
{
volScalarField rUA = 1.0/UEqn.A();

View file

@ -104,4 +104,7 @@
label pRefCell = 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());

View file

@ -50,6 +50,7 @@ Description
#include "fvCFD.H"
#include "OSspecific.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,6 +60,9 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
pisoControl piso(mesh);
# include "createFields.H"
# include "initContinuityErrs.H"
@ -69,7 +73,6 @@ int main(int argc, char *argv[])
while (runTime.loop())
{
# include "readPISOControls.H"
# include "readBPISOControls.H"
Info<< "Time = " << runTime.timeName() << nl << endl;
@ -91,7 +94,7 @@ int main(int argc, char *argv[])
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
while (piso.correct())
{
volScalarField rUA = 1.0/UEqn.A();
@ -100,7 +103,7 @@ int main(int argc, char *argv[])
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (piso.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -110,7 +113,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (piso.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

View file

@ -8,9 +8,4 @@
UEqn().relax();
eqnResidual = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);
solve(UEqn() == -fvc::grad(p));

View file

@ -31,7 +31,8 @@
label pRefCell = 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);

View file

@ -36,6 +36,7 @@ Author
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "IOEquationReader.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
simpleControl simple(mesh);
# include "createFields.H"
# include "createEquationReader.H"
# include "loadEquationData.H"
@ -54,22 +58,10 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
while (simple.loop())
{
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
{
# include "UEqn.H"
@ -85,8 +77,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
# include "convergenceCheck.H"
}
Info<< "End\n" << endl;

View file

@ -7,7 +7,7 @@
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -16,18 +16,9 @@
pEqn.setReference(pRefCell, pRefValue);
// Retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
pEqn.solve();
}
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 |
| \\/ M anipulation | |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{

View file

@ -50,10 +50,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p;
}
// ************************************************************************* //

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / 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 |
| \\/ M anipulation | |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{

View file

@ -56,11 +56,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p;
pB;
}
// ************************************************************************* //

View file

@ -35,8 +35,7 @@ divSchemes
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phi,nuTilda) Gauss upwind;
div((nuEff*dev(grad(U).T()))) Gauss linear; // backwards compatibility
div((nuEff*dev(T(grad(U))))) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
@ -61,10 +60,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p;
}
// ************************************************************************* //

View file

@ -53,12 +53,6 @@ multiSolver
{
default corrected;
}
fluxRequired
{
default no;
p;
}
}
icoFoam2