diff --git a/.gitignore b/.gitignore index 138a636d60..a897b8121d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,6 @@ .*~ *.bak *.bak[0-9][0-9] -*.orig -*.orig[0-9][0-9] \#*\# # File-browser settings - anywhere diff --git a/Allwmake b/Allwmake index cf49e407b7..67c26d0a3d 100755 --- a/Allwmake +++ b/Allwmake @@ -1,9 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -# Parse arguments for library compilation without documentation by default -genDoc=0 -targetType=libso +# Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments wmakeCheckPwd "$WM_PROJECT_DIR" || { @@ -36,11 +34,5 @@ src/Allwmake $targetType $* # Compile OpenFOAM libraries and applications applications/Allwmake $targetType $* -# Optionally build OpenFOAM Doxygen documentation -if [ $genDoc -eq 1 ] -then - doc/Allwmake -fi - #------------------------------------------------------------------------------ diff --git a/applications/Allwmake b/applications/Allwmake index 23c5ebbae0..14ba388bf1 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -2,7 +2,6 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation -targetType=libso . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { @@ -20,8 +19,8 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { set -x -wmake -all solvers $* -wmake -all utilities $* +wmake -all $targetType solvers +wmake -all $targetType utilities #------------------------------------------------------------------------------ diff --git a/applications/solvers/DNS/dnsFoam/createFields.H b/applications/solvers/DNS/dnsFoam/createFields.H index 7584773636..64f4ccf465 100644 --- a/applications/solvers/DNS/dnsFoam/createFields.H +++ b/applications/solvers/DNS/dnsFoam/createFields.H @@ -1,3 +1,5 @@ +#include "readTransportProperties.H" + Info<< "Reading field p\n" << endl; volScalarField p ( @@ -29,3 +31,5 @@ volVectorField U #include "createPhi.H" mesh.setFluxRequired(p.name()); + +#include "readTurbulenceProperties.H" diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index ddbbd20aa0..a38a001258 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.C @@ -28,7 +28,7 @@ Group grpDNSSolvers Description - Direct numerical simulation solver for boxes of isotropic turbulence + Direct numerical simulation solver for boxes of isotropic turbulence. \*---------------------------------------------------------------------------*/ @@ -44,16 +44,13 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMeshNoClear.H" - - pisoControl piso(mesh); - - #include "readTransportProperties.H" + #include "createControl.H" #include "createFields.H" - #include "readTurbulenceProperties.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +61,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - force.internalField() = ReImSum + force.primitiveFieldRef() = ReImSum ( fft::reverseTransform ( @@ -119,7 +116,7 @@ int main(int argc, char *argv[]) runTime.write(); - if (runTime.outputTime()) + if (runTime.writeTime()) { calcEk(U, K).write ( diff --git a/applications/solvers/basic/laplacianFoam/laplacianFoam.C b/applications/solvers/basic/laplacianFoam/laplacianFoam.C index 846a4b00a0..c22c11608e 100644 --- a/applications/solvers/basic/laplacianFoam/laplacianFoam.C +++ b/applications/solvers/basic/laplacianFoam/laplacianFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,6 +52,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "fvOptions.H" #include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,6 +67,7 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" + #include "createFvOptions.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,10 +79,16 @@ int main(int argc, char *argv[]) while (simple.correctNonOrthogonal()) { - solve + fvScalarMatrix TEqn ( fvm::ddt(T) - fvm::laplacian(DT, T) + == + fvOptions(T) ); + + fvOptions.constrain(TEqn); + TEqn.solve(); + fvOptions.correct(T); } #include "write.H" diff --git a/applications/solvers/basic/laplacianFoam/write.H b/applications/solvers/basic/laplacianFoam/write.H index 47aa182c0a..6b14ba4995 100644 --- a/applications/solvers/basic/laplacianFoam/write.H +++ b/applications/solvers/basic/laplacianFoam/write.H @@ -1,4 +1,4 @@ - if (runTime.outputTime()) + if (runTime.writeTime()) { volVectorField gradT(fvc::grad(T)); diff --git a/applications/solvers/basic/potentialFoam/createFields.H b/applications/solvers/basic/potentialFoam/createFields.H index af0adfd8f9..2682bf6833 100644 --- a/applications/solvers/basic/potentialFoam/createFields.H +++ b/applications/solvers/basic/potentialFoam/createFields.H @@ -43,7 +43,7 @@ word pName("p"); // Update name of the pressure field from the command-line option args.optionReadIfPresent("pName", pName); -// Infer the pressure BCs from the velocity BCs +// Infer the pressure BCs from the velocity wordList pBCTypes ( U.boundaryField().size(), @@ -78,62 +78,36 @@ volScalarField p pBCTypes ); -label pRefCell = 0; -scalar pRefValue = 0.0; -if (args.optionFound("writep")) -{ - setRefCell - ( - p, - potentialFlow.dict(), - pRefCell, - pRefValue - ); -} - - -Info<< "Constructing velocity potential field Phi\n" << endl; -autoPtr PhiPtr; - -IOobject io +// Infer the velocity potential BCs from the pressure +wordList PhiBCTypes ( - "Phi", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE + p.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName ); -if (io.typeHeaderOk()) +forAll(p.boundaryField(), patchi) { - PhiPtr.reset(new volScalarField(io, mesh)); -} -else -{ - // Cannot just use p.boundaryField().types() since does not initialise - // complex boundary types. Instead re-clone them from p. - - io.readOpt() = IOobject::NO_READ; - PhiPtr.reset - ( - new volScalarField - ( - io, - mesh, - dimensionedScalar("Phi", dimLength*dimVelocity, 0), - p.boundaryField().types() - ) - ); - - const volScalarField::GeometricBoundaryField& bp = p.boundaryField(); - volScalarField::GeometricBoundaryField& bPhi = PhiPtr().boundaryField(); - - forAll(bp, patchI) + if (p.boundaryField()[patchi].fixesValue()) { - bPhi.set(patchI, bp[patchI].clone(PhiPtr().dimensionedInternalField())); + PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName; } } -volScalarField& Phi = PhiPtr(); + +Info<< "Constructing velocity potential field Phi\n" << endl; +volScalarField Phi +( + IOobject + ( + "Phi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("Phi", dimLength*dimVelocity, 0), + PhiBCTypes +); label PhiRefCell = 0; scalar PhiRefValue = 0; diff --git a/applications/solvers/basic/potentialFoam/potentialFoam.C b/applications/solvers/basic/potentialFoam/potentialFoam.C index 356d7e5fad..0dbe1b5cad 100644 --- a/applications/solvers/basic/potentialFoam/potentialFoam.C +++ b/applications/solvers/basic/potentialFoam/potentialFoam.C @@ -28,7 +28,9 @@ Group grpBasicSolvers Description - Potential flow solver. + Potential flow solver which solves for the velocity potential + from which the flux-field is obtained and velocity field by reconstructing + the flux. \heading Solver details The potential flow solution is typically employed to generate initial fields diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 7e2ed0b63e..9d873681fe 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,17 +87,16 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "readCombustionProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" - #include "createMRF.H" + #include "createFieldRefs.H" #include "createFvOptions.H" #include "initContinuityErrs.H" #include "createTimeControls.H" @@ -113,7 +112,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "createTimeControls.H" + #include "readTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 4e561052fd..30e5f5a6cf 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "createTimeControls.H" + #include "readTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -131,11 +131,11 @@ int main(int argc, char *argv[]) protectedCell = 0; } - forAll(betav, cellI) + forAll(betav, celli) { - if (betav[cellI] < 0.99) + if (betav[celli] < 0.99) { - protectedCell[cellI] = 1; + protectedCell[celli] = 1; } } diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.C b/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.C index e85e41b432..befc3f3b59 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.C @@ -105,7 +105,7 @@ Foam::tmp Foam::XiEqModels::basicSubGrid::XiEq() const mesh, dimensionedScalar("zero", Nv.dimensions(), 0.0) ); - N.internalField() = Nv.internalField()*Cw; + N.primitiveFieldRef() = Nv.primitiveField()*Cw; volSymmTensorField ns ( @@ -125,7 +125,7 @@ Foam::tmp Foam::XiEqModels::basicSubGrid::XiEq() const Zero ) ); - ns.internalField() = nsv.internalField()*Cw; + ns.primitiveFieldRef() = nsv.primitiveField()*Cw; volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4))); volScalarField b((Uhat & B_ & Uhat)/sqrt(n)); diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C index 45050a171b..26104e40ab 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C @@ -73,7 +73,7 @@ Foam::tmp Foam::XiGModels::basicSubGrid::G() const volScalarField& Gtot = tGtot.ref(); const scalarField Cw = pow(Su_.mesh().V(), 2.0/3.0); - scalarField N(Nv.internalField()*Cw); + scalarField N(Nv.primitiveField()*Cw); forAll(N, celli) { diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index afe97f7f7f..4a2a35635b 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -130,7 +130,7 @@ void PDRkEpsilon::correct() tgradU.clear(); // Update espsilon and G at the wall - epsilon_.boundaryField().updateCoeffs(); + epsilon_.boundaryFieldRef().updateCoeffs(); // Add the blockage generation term so that it is included consistently // in both the k and epsilon equations @@ -163,7 +163,7 @@ void PDRkEpsilon::correct() epsEqn.ref().relax(); - epsEqn.ref().boundaryManipulate(epsilon_.boundaryField()); + epsEqn.ref().boundaryManipulate(epsilon_.boundaryFieldRef()); solve(epsEqn); bound(epsilon_, epsilonMin_); diff --git a/applications/solvers/combustion/PDRFoam/StCourantNo.H b/applications/solvers/combustion/PDRFoam/StCourantNo.H index ab12c922f7..9696f67593 100644 --- a/applications/solvers/combustion/PDRFoam/StCourantNo.H +++ b/applications/solvers/combustion/PDRFoam/StCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,8 +36,8 @@ Description { scalarField sumPhi ( - fvc::surfaceSum(mag(phiSt))().internalField() - / rho.internalField() + fvc::surfaceSum(mag(phiSt))().primitiveField() + / rho.primitiveField() ); StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C index 46dee65938..c2b863087c 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,7 +74,7 @@ Foam::tmp Foam::XiEqModels::Gulder::XiEq() const if (subGridSchelkin_) { - up.internalField() += calculateSchelkinEffect(uPrimeCoef_); + up.primitiveFieldRef() += calculateSchelkinEffect(uPrimeCoef_); } volScalarField tauEta(sqrt(mag(thermo_.muu()/(thermo_.rhou()*epsilon)))); diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C index 0208818ee0..d91f1b9e31 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C @@ -82,7 +82,7 @@ Foam::tmp Foam::XiEqModels::SCOPEXiEq::XiEq() const volScalarField up(sqrt((2.0/3.0)*k)); if (subGridSchelkin_) { - up.internalField() += calculateSchelkinEffect(uPrimeCoef_); + up.primitiveFieldRef() += calculateSchelkinEffect(uPrimeCoef_); } volScalarField l(lCoef_*sqrt(3.0/2.0)*up*k/epsilon); @@ -119,9 +119,11 @@ Foam::tmp Foam::XiEqModels::SCOPEXiEq::XiEq() const } } + volScalarField::Boundary& xieqBf = xieq.boundaryFieldRef(); + forAll(xieq.boundaryField(), patchi) { - scalarField& xieqp = xieq.boundaryField()[patchi]; + scalarField& xieqp = xieqBf[patchi]; const scalarField& Kp = K.boundaryField()[patchi]; const scalarField& Map = Ma.boundaryField()[patchi]; const scalarField& upBySup = upBySu.boundaryField()[patchi]; diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C index 966dae7175..a6301ba973 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C @@ -114,7 +114,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const ) ); volScalarField& N = tN.ref(); - N.internalField() = Nv.internalField()*pow(mesh.V(), 2.0/3.0); + N.primitiveFieldRef() = Nv.primitiveField()*pow(mesh.V(), 2.0/3.0); volSymmTensorField ns ( @@ -134,7 +134,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const Zero ) ); - ns.internalField() = nsv.internalField()*pow(mesh.V(), 2.0/3.0); + ns.primitiveFieldRef() = nsv.primitiveField()*pow(mesh.V(), 2.0/3.0); const volVectorField Uhat ( @@ -150,7 +150,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const const scalarField deltaUp(upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0)); // Re use tN - N.internalField() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0); + N.primitiveFieldRef() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0); return tN; } diff --git a/applications/solvers/combustion/PDRFoam/createFieldRefs.H b/applications/solvers/combustion/PDRFoam/createFieldRefs.H new file mode 100644 index 0000000000..502b3b4230 --- /dev/null +++ b/applications/solvers/combustion/PDRFoam/createFieldRefs.H @@ -0,0 +1 @@ +const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 95f42a03d6..1341894242 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -23,7 +23,6 @@ volScalarField rho ); volScalarField& p = thermo.p(); -const volScalarField& psi = thermo.psi(); volScalarField& b = composition.Y("b"); Info<< "min(b) = " << min(b).value() << endl; @@ -227,3 +226,5 @@ fields.add(b); fields.add(thermo.he()); fields.add(thermo.heu()); flameWrinkling->addXi(fields); + +#include "createMRF.H" diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index fd07b0b3cb..947c62132e 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C @@ -266,9 +266,11 @@ Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi); } - forAll(Su0.boundaryField(), patchi) + volScalarField::Boundary& Su0Bf = Su0.boundaryFieldRef(); + + forAll(Su0Bf, patchi) { - scalarField& Su0p = Su0.boundaryField()[patchi]; + scalarField& Su0p = Su0Bf[patchi]; const scalarField& pp = p.boundaryField()[patchi]; const scalarField& Tup = Tu.boundaryField()[patchi]; @@ -313,9 +315,11 @@ Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi[celli]); } - forAll(Su0.boundaryField(), patchi) + volScalarField::Boundary& Su0Bf = Su0.boundaryFieldRef(); + + forAll(Su0Bf, patchi) { - scalarField& Su0p = Su0.boundaryField()[patchi]; + scalarField& Su0p = Su0Bf[patchi]; const scalarField& pp = p.boundaryField()[patchi]; const scalarField& Tup = Tu.boundaryField()[patchi]; const scalarField& phip = phi.boundaryField()[patchi]; @@ -365,9 +369,11 @@ Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::Ma ma[celli] = Ma(phi[celli]); } - forAll(ma.boundaryField(), patchi) + volScalarField::Boundary& maBf = ma.boundaryFieldRef(); + + forAll(maBf, patchi) { - scalarField& map = ma.boundaryField()[patchi]; + scalarField& map = maBf[patchi]; const scalarField& phip = phi.boundaryField()[patchi]; forAll(map, facei) diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index a336810139..4c23928970 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,16 +65,15 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "readCombustionProperties.H" #include "createFields.H" - #include "createMRF.H" + #include "createFieldRefs.H" #include "createFvOptions.H" #include "initContinuityErrs.H" #include "createTimeControls.H" @@ -89,7 +88,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "createTimeControls.H" + #include "readTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" diff --git a/applications/solvers/combustion/XiFoam/createFieldRefs.H b/applications/solvers/combustion/XiFoam/createFieldRefs.H new file mode 100644 index 0000000000..502b3b4230 --- /dev/null +++ b/applications/solvers/combustion/XiFoam/createFieldRefs.H @@ -0,0 +1 @@ +const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/combustion/XiFoam/createFields.H b/applications/solvers/combustion/XiFoam/createFields.H index fa573b9b77..9dd4b6560f 100644 --- a/applications/solvers/combustion/XiFoam/createFields.H +++ b/applications/solvers/combustion/XiFoam/createFields.H @@ -23,7 +23,6 @@ volScalarField rho ); volScalarField& p = thermo.p(); -const volScalarField& psi = thermo.psi(); volScalarField& b = composition.Y("b"); Info<< "min(b) = " << min(b).value() << endl; @@ -139,3 +138,5 @@ if (composition.contains("ft")) fields.add(b); fields.add(thermo.he()); fields.add(thermo.heu()); + +#include "createMRF.H" diff --git a/applications/solvers/combustion/chemFoam/chemFoam.C b/applications/solvers/combustion/chemFoam/chemFoam.C index 60c915d9dd..8098ae464e 100644 --- a/applications/solvers/combustion/chemFoam/chemFoam.C +++ b/applications/solvers/combustion/chemFoam/chemFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,12 +28,10 @@ Group grpCombustionSolvers Description - Solver for chemistry problems designed for use on single cell cases to - provide comparison against other chemistry solvers + Solver for chemistry problems, designed for use on single cell cases to + provide comparison against other chemistry solvers, that uses a single cell + mesh, and fields created from the initial conditions. - Note: - - single cell mesh created on-the-fly - - fields created on the fly from the initial conditions \*---------------------------------------------------------------------------*/ @@ -52,10 +50,15 @@ int main(int argc, char *argv[]) { argList::noParallel(); + #define CREATE_MESH createSingleCellMesh.H + #define NO_CONTROL + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createSingleCellMesh.H" #include "createFields.H" + #include "createFieldRefs.H" #include "readInitialConditions.H" #include "createControls.H" diff --git a/applications/solvers/combustion/chemFoam/createFieldRefs.H b/applications/solvers/combustion/chemFoam/createFieldRefs.H new file mode 100644 index 0000000000..ef34180b32 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/createFieldRefs.H @@ -0,0 +1,4 @@ +scalar dtChem = refCast(chemistry).deltaTChem()[0]; +basicMultiComponentMixture& composition = thermo.composition(); +PtrList& Y = composition.Y(); +volScalarField& p = thermo.p(); diff --git a/applications/solvers/combustion/chemFoam/createFields.H b/applications/solvers/combustion/chemFoam/createFields.H index 2d2e9d1ebd..62be3ce0dd 100644 --- a/applications/solvers/combustion/chemFoam/createFields.H +++ b/applications/solvers/combustion/chemFoam/createFields.H @@ -27,14 +27,10 @@ autoPtr pChemistry(psiChemistryModel::New(mesh)); psiChemistryModel& chemistry = pChemistry(); - scalar dtChem = refCast(chemistry).deltaTChem()[0]; psiReactionThermo& thermo = chemistry.thermo(); thermo.validate(args.executable(), "h"); - basicMultiComponentMixture& composition = thermo.composition(); - PtrList& Y = composition.Y(); - volScalarField rho ( IOobject @@ -48,8 +44,6 @@ thermo.rho() ); - volScalarField& p = thermo.p(); - volScalarField Rspecific ( IOobject diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options index 6ef06f8991..ac4a300545 100644 --- a/applications/solvers/combustion/coldEngineFoam/Make/options +++ b/applications/solvers/combustion/coldEngineFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I. \ -I../engineFoam \ -I../XiFoam \ -I../../compressible/rhoPimpleFoam \ diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 14e35856f3..9d42388cba 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,15 +45,16 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #define CREATE_TIME createEngineTime.H + #define CREATE_MESH createEngineMesh.H + #include "postProcess.H" + #include "setRootCase.H" #include "createEngineTime.H" #include "createEngineMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "createFields.H" - #include "createMRF.H" + #include "createFieldRefs.H" #include "createFvOptions.H" #include "createRhoUf.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/combustion/coldEngineFoam/createFieldRefs.H b/applications/solvers/combustion/coldEngineFoam/createFieldRefs.H new file mode 100644 index 0000000000..6e1184a1fa --- /dev/null +++ b/applications/solvers/combustion/coldEngineFoam/createFieldRefs.H @@ -0,0 +1,2 @@ +const volScalarField& psi = thermo.psi(); +const volScalarField& T = thermo.T(); diff --git a/applications/solvers/combustion/coldEngineFoam/createFields.H b/applications/solvers/combustion/coldEngineFoam/createFields.H index f78e5bde29..10e1546584 100644 --- a/applications/solvers/combustion/coldEngineFoam/createFields.H +++ b/applications/solvers/combustion/coldEngineFoam/createFields.H @@ -1,71 +1,70 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiThermo::New(mesh) +); +psiThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); + +volScalarField rho +( + IOobject ( - psiThermo::New(mesh) - ); - psiThermo& thermo = pThermo(); - thermo.validate(args.executable(), "h", "e"); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); - const volScalarField& T = thermo.T(); - - - Info<< "\nReading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - Info<< "Creating field dpdt\n" << endl; - volScalarField dpdt - ( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), + "rho", + runTime.timeName(), mesh, - dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) - ); + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +volScalarField& p = thermo.p(); + +Info<< "\nReading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); + +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); + +#include "createMRF.H" diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index a13df4cea3..19ad61e610 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,16 +68,17 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #define CREATE_TIME createEngineTime.H + #define CREATE_MESH createEngineMesh.H + #include "postProcess.H" + #include "setRootCase.H" #include "createEngineTime.H" #include "createEngineMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "readCombustionProperties.H" #include "createFields.H" - #include "createMRF.H" + #include "createFieldRefs.H" #include "createFvOptions.H" #include "createRhoUf.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options index 2d2d441e24..b49c426e87 100644 --- a/applications/solvers/combustion/fireFoam/Make/options +++ b/applications/solvers/combustion/fireFoam/Make/options @@ -21,7 +21,6 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \ @@ -29,7 +28,6 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude - EXE_LIBS = \ -lfiniteVolume \ -lfvOptions \ diff --git a/applications/solvers/combustion/fireFoam/YEEqn.H b/applications/solvers/combustion/fireFoam/YEEqn.H index cee98e2429..1c9c2176c5 100644 --- a/applications/solvers/combustion/fireFoam/YEEqn.H +++ b/applications/solvers/combustion/fireFoam/YEEqn.H @@ -12,12 +12,11 @@ tmp> mvConvection radiation->correct(); combustion->correct(); dQ = combustion->dQ(); - label inertIndex = -1; volScalarField Yt(0.0*Y[0]); forAll(Y, i) { - if (Y[i].name() != inertSpecie) + if (i != inertIndex && composition.active(i)) { volScalarField& Yi = Y[i]; @@ -44,10 +43,6 @@ tmp> mvConvection Yi.max(0.0); Yt += Yi; } - else - { - inertIndex = i; - } } Y[inertIndex] = scalar(1) - Yt; diff --git a/applications/solvers/combustion/fireFoam/createFieldRefs.H b/applications/solvers/combustion/fireFoam/createFieldRefs.H new file mode 100644 index 0000000000..6df6f9df2f --- /dev/null +++ b/applications/solvers/combustion/fireFoam/createFieldRefs.H @@ -0,0 +1,4 @@ +const volScalarField& psi = thermo.psi(); +const volScalarField& T = thermo.T(); +filmModelType& surfaceFilm = tsurfaceFilm(); +const label inertIndex(composition.species()[inertSpecie]); diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index c5fcc21c90..30e7d30377 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -19,6 +19,13 @@ basicMultiComponentMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); const word inertSpecie(thermo.lookup("inertSpecie")); +if (!composition.species().found(inertSpecie)) +{ + FatalIOErrorIn(args.executable().c_str(), thermo) + << "Inert specie " << inertSpecie << " not found in available species " + << composition.species() + << exit(FatalIOError); +} Info<< "Creating field rho\n" << endl; volScalarField rho @@ -35,8 +42,6 @@ volScalarField rho ); volScalarField& p = thermo.p(); -const volScalarField& T = thermo.T(); -const volScalarField& psi = thermo.psi(); Info<< "\nReading field U\n" << endl; volVectorField U @@ -54,6 +59,9 @@ volVectorField U #include "compressibleCreatePhi.H" +#include "createMRF.H" + + Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( @@ -69,6 +77,60 @@ autoPtr turbulence // Set the turbulence into the combustion model combustion->setTurbulence(turbulence()); + +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" +#include "readpRef.H" + +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +mesh.setFluxRequired(p_rgh.name()); + +#include "phrghEqn.H" + + +multivariateSurfaceInterpolationScheme::fieldTable fields; + +forAll(Y, i) +{ + fields.add(Y[i]); +} +fields.add(thermo.he()); + +IOdictionary additionalControlsDict +( + IOobject + ( + "additionalControls", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); + +Switch solvePrimaryRegion +( + additionalControlsDict.lookup("solvePrimaryRegion") +); + +Switch solvePyrolysisRegion +( + additionalControlsDict.lookupOrDefault("solvePyrolysisRegion", true) +); + volScalarField dQ ( IOobject @@ -100,51 +162,7 @@ volScalarField dpdt Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); - -#include "readGravitationalAcceleration.H" -#include "readhRef.H" -#include "gh.H" - - -volScalarField p_rgh -( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -// Force p_rgh to be consistent with p -p_rgh = p - rho*gh; - -mesh.setFluxRequired(p_rgh.name()); - -multivariateSurfaceInterpolationScheme::fieldTable fields; - -forAll(Y, i) -{ - fields.add(Y[i]); -} -fields.add(thermo.he()); - -IOdictionary additionalControlsDict -( - IOobject - ( - "additionalControls", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) -); - -Switch solvePrimaryRegion -( - additionalControlsDict.lookup("solvePrimaryRegion") -); +#include "createClouds.H" +#include "createSurfaceFilmModel.H" +#include "createPyrolysisModel.H" +#include "createRadiationModel.H" diff --git a/applications/solvers/combustion/fireFoam/createSurfaceFilmModel.H b/applications/solvers/combustion/fireFoam/createSurfaceFilmModel.H index 8ddcc77a5f..ffdbcbf6a9 100644 --- a/applications/solvers/combustion/fireFoam/createSurfaceFilmModel.H +++ b/applications/solvers/combustion/fireFoam/createSurfaceFilmModel.H @@ -3,4 +3,3 @@ Info<< "\nConstructing surface film model" << endl; typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType; autoPtr tsurfaceFilm(filmModelType::New(mesh, g)); -filmModelType& surfaceFilm = tsurfaceFilm(); diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index b337a29bc7..cc7f5d879e 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -28,8 +28,8 @@ Group grpCombustionSolvers Description - Transient PIMPLE solver for fires and turbulent diffusion flames with - reacting Lagrangian parcels, surface film and pyrolysis modelling. + Transient solver for fires and turbulent diffusion flames with reacting + particle clouds, surface film and pyrolysis modelling. \*---------------------------------------------------------------------------*/ @@ -49,20 +49,15 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "createFields.H" - #include "createMRF.H" + #include "createFieldRefs.H" #include "createFvOptions.H" - #include "createClouds.H" - #include "createSurfaceFilmModel.H" - #include "createPyrolysisModel.H" - #include "createRadiationModel.H" #include "initContinuityErrs.H" #include "createTimeControls.H" #include "compressibleCourantNo.H" @@ -77,7 +72,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "createTimeControls.H" + #include "readTimeControls.H" #include "compressibleCourantNo.H" #include "solidRegionDiffusionNo.H" #include "setMultiRegionDeltaT.H" @@ -91,7 +86,10 @@ int main(int argc, char *argv[]) surfaceFilm.evolve(); - pyrolysis.evolve(); + if(solvePyrolysisRegion) + { + pyrolysis.evolve(); + } if (solvePrimaryRegion) { diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 7b5249d57e..0d42787fff 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); -surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); +surfaceScalarField phig("phig", -rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); surfaceScalarField phiHbyA ( @@ -25,9 +25,10 @@ while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( - fvc::ddt(psi, rho)*gh + fvm::ddt(psi, p_rgh) + + fvc::ddt(psi, rho)*gh + + fvc::ddt(psi)*pRef + fvc::div(phiHbyA) - + fvm::ddt(psi, p_rgh) - fvm::laplacian(rhorAUf, p_rgh) == parcels.Srho() @@ -46,7 +47,7 @@ while (pimple.correctNonOrthogonal()) } } -p = p_rgh + rho*gh; +p = p_rgh + rho*gh + pRef; #include "rhoEqn.H" #include "compressibleContinuityErrs.H" diff --git a/applications/solvers/combustion/fireFoam/phrghEqn.H b/applications/solvers/combustion/fireFoam/phrghEqn.H new file mode 100644 index 0000000000..3c5175f41f --- /dev/null +++ b/applications/solvers/combustion/fireFoam/phrghEqn.H @@ -0,0 +1,62 @@ +if (pimple.dict().lookupOrDefault("hydrostaticInitialization", false)) +{ + volScalarField& ph_rgh = regIOobject::store + ( + new volScalarField + ( + IOobject + ( + "ph_rgh", + "0", + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ) + ); + + if (equal(runTime.value(), 0)) + { + p = ph_rgh + rho*gh + pRef; + thermo.correct(); + rho = thermo.rho(); + + label nCorr + ( + pimple.dict().lookupOrDefault