diff --git a/.gitignore b/.gitignore index 296f8d0367..8de178a605 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,8 @@ doc/[Dd]oxygen/html doc/[Dd]oxygen/latex doc/[Dd]oxygen/man -# Other HTML files e.g. ReleaseNotes-?.?.html -*.html +# generated files in the main directory (e.g. ReleaseNotes-?.?.html) +/*.html # source packages - anywhere *.tar.bz2 diff --git a/Allwmake b/Allwmake index 2e570c89a5..36d7658f19 100755 --- a/Allwmake +++ b/Allwmake @@ -1,13 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -if [ "$PWD" != "$WM_PROJECT_DIR" ] -then +wmakeCheckPwd "$WM_PROJECT_DIR" || { echo "Error: Current directory is not \$WM_PROJECT_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 -fi +} # wmake is required for subsequent targets ( cd wmake/src && make ) diff --git a/README b/README index 390dd8edb5..7b092d0d72 100644 --- a/README +++ b/README @@ -99,7 +99,7 @@ and a csh/tcsh example: + setenv FOAM_INST_DIR /data/app/OpenFOAM - + foamDotFile=$FOAM_INST_DIR/OpenFOAM-1.6/etc/bashrc + + foamDotFile=$FOAM_INST_DIR/OpenFOAM-1.6/etc/cshrc + if ( -f $foamDotFile ) source $foamDotFile The value set in '$FOAM_INST_DIR' will be used to locate the remaining parts @@ -180,12 +180,12 @@ downloads a supported version of Qt /e.g./ 4.3.5 as described in the section on "Qt". The user should unpack the source pack in the $WM_THIRD_PARTY_DIR. Then the user can build Qt by executing from within $WM_THIRD_PARTY_DIR: - + makeQt + + ./makeQt The user should then compile ParaView using the local version of Qt by executing makeParaView with the -qmake option, giving the full path of the newly built qmake as an argument: - + makeParaView -qmake + + ./makeParaView -qmake The user must then recompile the PV3FoamReader module as normal (see above). diff --git a/applications/Allwmake b/applications/Allwmake index ddb5b116fc..48e66941d3 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,13 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -if [ "$PWD" != "$WM_PROJECT_DIR/applications" ] -then +wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/applications" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 -fi +} set -x diff --git a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H index 9f4d8368a8..20fd654cef 100644 --- a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H +++ b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H @@ -13,7 +13,7 @@ ); volVectorField force = - U/dimensionedScalar("dt", dimTime, runTime.deltaT().value()); + U/dimensionedScalar("dt", dimTime, runTime.deltaTValue()); Kmesh K(mesh); - UOprocess forceGen(K, runTime.deltaT().value(), turbulenceProperties); + UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties); diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/newPDRDragModel.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/newPDRDragModel.C index 29a92e19f8..d8fd2dd5e3 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/newPDRDragModel.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/newPDRDragModel.C @@ -52,7 +52,7 @@ Foam::autoPtr Foam::PDRDragModel::New ) << "Unknown PDRDragModel type " << PDRDragModelTypeName << endl << endl << "Valid PDRDragModels are : " << endl - << dictionaryConstructorTablePtr_->toc() + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/applications/solvers/combustion/PDRFoam/StCourantNo.H b/applications/solvers/combustion/PDRFoam/StCourantNo.H index 18d6e86a94..5f3f3359fb 100644 --- a/applications/solvers/combustion/PDRFoam/StCourantNo.H +++ b/applications/solvers/combustion/PDRFoam/StCourantNo.H @@ -41,11 +41,11 @@ Description StCoNum = max(SfUfbyDelta/mesh.magSf()).value() - *runTime.deltaT().value(); + *runTime.deltaTValue(); meanStCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())).value() - *runTime.deltaT().value(); + *runTime.deltaTValue(); } Info<< "St courant Number mean: " << meanStCoNum diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/newXiEqModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/newXiEqModel.C index 43515c6bae..f0bc471c91 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/newXiEqModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/newXiEqModel.C @@ -56,7 +56,7 @@ Foam::autoPtr Foam::XiEqModel::New ) << "Unknown XiEqModel type " << XiEqModelTypeName << endl << endl << "Valid XiEqModels are : " << endl - << dictionaryConstructorTablePtr_->toc() + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/newXiGModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/newXiGModel.C index 780bc8418d..81f5cca253 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/newXiGModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/newXiGModel.C @@ -56,7 +56,7 @@ Foam::autoPtr Foam::XiGModel::New ) << "Unknown XiGModel type " << XiGModelTypeName << endl << endl << "Valid XiGModels are : " << endl - << dictionaryConstructorTablePtr_->toc() + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/newXiModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/newXiModel.C index fd1e25de9b..2dc8dac138 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/newXiModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/newXiModel.C @@ -54,7 +54,7 @@ Foam::autoPtr Foam::XiModel::New ) << "Unknown XiModel type " << XiModelTypeName << endl << endl << "Valid XiModels are : " << endl - << dictionaryConstructorTablePtr_->toc() + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/applications/solvers/combustion/PDRFoam/setDeltaT.H b/applications/solvers/combustion/PDRFoam/setDeltaT.H index 7092e9779a..c40bc4a1d7 100644 --- a/applications/solvers/combustion/PDRFoam/setDeltaT.H +++ b/applications/solvers/combustion/PDRFoam/setDeltaT.H @@ -41,12 +41,12 @@ if (adjustTimeStep) ( min ( - deltaTFact*runTime.deltaT().value(), + deltaTFact*runTime.deltaTValue(), maxDeltaT ) ); - Info<< "deltaT = " << runTime.deltaT().value() << endl; + Info<< "deltaT = " << runTime.deltaTValue() << endl; } // ************************************************************************* // diff --git a/applications/solvers/combustion/XiFoam/bEqn.H b/applications/solvers/combustion/XiFoam/bEqn.H index d06ec2e5f0..2b9b50d124 100644 --- a/applications/solvers/combustion/XiFoam/bEqn.H +++ b/applications/solvers/combustion/XiFoam/bEqn.H @@ -40,7 +40,7 @@ if (ign.ignited()) ( mesh.surfaceInterpolation::deltaCoeffs() *mag(phiSt)/(fvc::interpolate(rho)*mesh.magSf()) - ).value()*runTime.deltaT().value(); + ).value()*runTime.deltaTValue(); Info<< "Max St-Courant Number = " << StCoNum << endl; diff --git a/applications/solvers/combustion/dieselEngineFoam/createFields.H b/applications/solvers/combustion/dieselEngineFoam/createFields.H index 9d9229cc3c..6987608006 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createFields.H +++ b/applications/solvers/combustion/dieselEngineFoam/createFields.H @@ -13,6 +13,14 @@ PtrList& Y = composition.Y(); word inertSpecie(thermo.lookup("inertSpecie")); +if (!composition.contains(inertSpecie)) +{ + FatalErrorIn(args.executable()) + << "Specified inert specie '" << inertSpecie << "' not found in " + << "species list. Available species:" << composition.species() + << exit(FatalError); +} + volScalarField rho ( IOobject diff --git a/applications/solvers/combustion/dieselEngineFoam/createSpray.H b/applications/solvers/combustion/dieselEngineFoam/createSpray.H index ea4d0121b6..8c6706e0ba 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createSpray.H +++ b/applications/solvers/combustion/dieselEngineFoam/createSpray.H @@ -30,7 +30,7 @@ scalar gasMass0 = fvc::domainIntegrate(rho).value(); if (dieselSpray.twoD()) { - gasMass0 *= 2.0*mathematicalConstant::pi/dieselSpray.angleOfWedge(); + gasMass0 *= constant::mathematical::twoPi/dieselSpray.angleOfWedge(); } gasMass0 -= diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index e3f9c0b118..ce80690224 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -43,6 +43,7 @@ Description #include "OFstream.H" #include "volPointInterpolation.H" #include "thermoPhysicsTypes.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,8 +89,8 @@ int main(int argc, char *argv[]) chemistry.solve ( - runTime.value() - runTime.deltaT().value(), - runTime.deltaT().value() + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() ); // turbulent time scale diff --git a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H index 31337d0a77..5c1e43dc99 100644 --- a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H +++ b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H @@ -20,7 +20,7 @@ if (dieselSpray.twoD()) { - gasMass *= 2.0*mathematicalConstant::pi/dieselSpray.angleOfWedge(); + gasMass *= constant::mathematical::twoPi/dieselSpray.angleOfWedge(); } scalar addedMass = gasMass - gasMass0; diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 86460c1e9a..42d9534654 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -41,6 +41,7 @@ Description #include "IFstream.H" #include "OFstream.H" #include "Switch.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -79,8 +80,8 @@ int main(int argc, char *argv[]) chemistry.solve ( - runTime.value() - runTime.deltaT().value(), - runTime.deltaT().value() + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() ); // turbulent time scale diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 9adf73cc67..dd584d03e2 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -58,6 +58,7 @@ Description #include "ignition.H" #include "Switch.H" #include "OFstream.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/reactingFoam/chemistry.H b/applications/solvers/combustion/reactingFoam/chemistry.H index d059bd9ed3..691b6dcb92 100644 --- a/applications/solvers/combustion/reactingFoam/chemistry.H +++ b/applications/solvers/combustion/reactingFoam/chemistry.H @@ -3,8 +3,8 @@ chemistry.solve ( - runTime.value() - runTime.deltaT().value(), - runTime.deltaT().value() + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() ); // turbulent time scale diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index f989c43d41..875191eea4 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -68,10 +68,10 @@ int main(int argc, char *argv[]) #include "chemistry.H" #include "rhoEqn.H" - #include "UEqn.H" for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) { + #include "UEqn.H" #include "YEqn.H" #define Db turbulence->alphaEff() diff --git a/applications/solvers/combustion/rhoReactingFoam/chemistry.H b/applications/solvers/combustion/rhoReactingFoam/chemistry.H index d059bd9ed3..691b6dcb92 100644 --- a/applications/solvers/combustion/rhoReactingFoam/chemistry.H +++ b/applications/solvers/combustion/rhoReactingFoam/chemistry.H @@ -3,8 +3,8 @@ chemistry.solve ( - runTime.value() - runTime.deltaT().value(), - runTime.deltaT().value() + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() ); // turbulent time scale diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index b2d007094e..5423a70e3b 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -182,7 +182,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs() } Field C2 = pmu/prho - *sqrt(ppsi*mathematicalConstant::pi/2.0) + *sqrt(ppsi*constant::mathematical::piByTwo) *2.0*gamma_/Pr.value()/(gamma_ + 1.0) *(2.0 - accommodationCoeff_)/accommodationCoeff_; diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index a087d0c964..ec8f777542 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -147,7 +147,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() const fvPatchField& ppsi = patch().lookupPatchField("psi"); - Field C1 = sqrt(ppsi*mathematicalConstant::pi/2.0) + Field C1 = sqrt(ppsi*constant::mathematical::piByTwo) *(2.0 - accommodationCoeff_)/accommodationCoeff_; Field pnu = pmu/prho; diff --git a/applications/solvers/compressible/rhoCentralFoam/compressibleCourantNo.H b/applications/solvers/compressible/rhoCentralFoam/compressibleCourantNo.H index 33b4edc8a7..a0601fc1de 100644 --- a/applications/solvers/compressible/rhoCentralFoam/compressibleCourantNo.H +++ b/applications/solvers/compressible/rhoCentralFoam/compressibleCourantNo.H @@ -38,11 +38,11 @@ if (mesh.nInternalFaces()) surfaceScalarField amaxSfbyDelta = mesh.surfaceInterpolation::deltaCoeffs()*amaxSf; - CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaT().value(); + CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaTValue(); meanCoNum = (sum(amaxSfbyDelta)/sum(mesh.magSf())).value() - *runTime.deltaT().value(); + *runTime.deltaTValue(); } Info<< "Mean and max Courant Numbers = " diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options index 61456e486a..4f198992b9 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ @@ -8,6 +9,7 @@ EXE_INC = \ EXE_LIBS = \ -lbasicThermophysicalModels \ + -lthermalPorousZone \ -lspecie \ -lcompressibleRASModels \ -lfiniteVolume \ diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H index 1177cba2a4..09b75191db 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H @@ -64,7 +64,7 @@ dimensionedScalar initialMass = fvc::domainIntegrate(rho); - porousZones pZones(mesh); + thermalPorousZones pZones(mesh); Switch pressureImplicitPorosity(false); int nUCorr = 0; @@ -84,4 +84,3 @@ pressureImplicitPorosity = true; } } - diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H index 605b8820d1..f33843b48f 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H @@ -9,6 +9,8 @@ - p*fvc::div(phi/fvc::interpolate(rho)) ); + pZones.addEnthalpySource(thermo, rho, hEqn); + hEqn.relax(); eqnResidual = hEqn.solve().initialResidual(); diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index 10bfeb61db..5b620be335 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -34,7 +34,7 @@ Description #include "fvCFD.H" #include "basicPsiThermo.H" #include "RASModel.H" -#include "porousZones.H" +#include "thermalPorousZones.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index f6a433fd61..38922c99c9 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -27,7 +27,7 @@ if (transonic) pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration + // Retain the residual from the first iteration if (nonOrth == 0) { eqnResidual = pEqn.solve().initialResidual(); diff --git a/applications/solvers/compressible/rhoSimplecFoam/Make/files b/applications/solvers/compressible/rhoSimplecFoam/Make/files new file mode 100644 index 0000000000..6637e49aa3 --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/Make/files @@ -0,0 +1,3 @@ +rhoSimplecFoam.C + +EXE = $(FOAM_APPBIN)/rhoSimplecFoam diff --git a/applications/solvers/compressible/rhoSimplecFoam/Make/options b/applications/solvers/compressible/rhoSimplecFoam/Make/options new file mode 100644 index 0000000000..9d578f011a --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/Make/options @@ -0,0 +1,14 @@ +EXE_INC = \ + -I../rhoSimpleFoam \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -lbasicThermophysicalModels \ + -lspecie \ + -lcompressibleRASModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/solvers/compressible/rhoSimplecFoam/UEqn.H b/applications/solvers/compressible/rhoSimplecFoam/UEqn.H new file mode 100644 index 0000000000..c41bc9b6c7 --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/UEqn.H @@ -0,0 +1,17 @@ + // Solve the Momentum equation + + tmp UEqn + ( + fvm::div(phi, U) + - fvm::Sp(fvc::div(phi), U) + + turbulence->divDevRhoReff(U) + ); + + UEqn().relax(); + + eqnResidual = solve + ( + UEqn() == -fvc::grad(p) + ).initialResidual(); + + maxResidual = max(eqnResidual, maxResidual); diff --git a/applications/solvers/compressible/rhoSimplecFoam/createFields.H b/applications/solvers/compressible/rhoSimplecFoam/createFields.H new file mode 100644 index 0000000000..d97ee4705b --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/createFields.H @@ -0,0 +1,63 @@ + Info<< "Reading thermophysical properties\n" << endl; + + autoPtr pThermo + ( + basicPsiThermo::New(mesh) + ); + basicPsiThermo& thermo = pThermo(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + volScalarField& p = thermo.p(); + volScalarField& h = thermo.h(); + const volScalarField& psi = thermo.psi(); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "compressibleCreatePhi.H" + + label pRefCell = 0; + scalar pRefValue = 0.0; + setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); + + dimensionedScalar pMin + ( + mesh.solutionDict().subDict("SIMPLE").lookup("pMin") + ); + + Info<< "Creating turbulence model\n" << endl; + autoPtr turbulence + ( + compressible::RASModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/solvers/compressible/rhoSimplecFoam/hEqn.H b/applications/solvers/compressible/rhoSimplecFoam/hEqn.H new file mode 100644 index 0000000000..8ac1c9f510 --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/hEqn.H @@ -0,0 +1,29 @@ +{ + fvScalarMatrix hEqn + ( + fvm::div(phi, h) + - fvm::Sp(fvc::div(phi), h) + - fvm::laplacian(turbulence->alphaEff(), h) + == + fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)")) + - p*fvc::div(phi/fvc::interpolate(rho)) + ); + + hEqn.relax(); + + eqnResidual = hEqn.solve().initialResidual(); + maxResidual = max(eqnResidual, maxResidual); + + thermo.correct(); + + rho = thermo.rho(); + + if (!transonic) + { + rho.relax(); + } + + Info<< "rho max/min : " + << max(rho).value() << " " + << min(rho).value() << endl; +} diff --git a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H new file mode 100644 index 0000000000..cd3ae5ff1f --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H @@ -0,0 +1,123 @@ +volScalarField p0 = p; + +volScalarField AU = UEqn().A(); +volScalarField AtU = AU - UEqn().H1(); +U = UEqn().H()/AU; +UEqn.clear(); + +bool closedVolume = false; + +if (transonic) +{ + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi*U) & mesh.Sf() + ); + + surfaceScalarField phic + ( + "phic", + fvc::interpolate(rho/AtU - rho/AU)*fvc::snGrad(p)*mesh.magSf() + + phid*(fvc::interpolate(p) - fvc::interpolate(p, "UD")) + ); + + refCast(p.boundaryField()[1]).refValue() + = p.boundaryField()[1]; + + fvScalarMatrix pEqn + ( + fvm::div(phid, p) + + fvc::div(phic) + - fvm::Sp(fvc::div(phid), p) + + fvc::div(phid)*p + - fvm::laplacian(rho/AtU, p) + ); + + 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(); + } + + if (nonOrth == nNonOrthCorr) + { + phi == phic + pEqn.flux(); + } + } +} +else +{ + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + phi = fvc::interpolate(rho*U) & mesh.Sf(); + closedVolume = adjustPhi(phi, U, p); + phi += fvc::interpolate(rho/AtU - rho/AU)*fvc::snGrad(p)*mesh.magSf(); + + fvScalarMatrix pEqn + ( + fvc::div(phi) + //- fvm::laplacian(rho/AU, p) + - fvm::laplacian(rho/AtU, p) + ); + + 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(); + } + + + if (nonOrth == nNonOrthCorr) + { + phi += pEqn.flux(); + } + } +} + +// The incompressibe for of the continuity error check is appropriate for +// steady-state compressible also. +#include "incompressible/continuityErrs.H" + +// Explicitly relax pressure for momentum corrector +p.relax(); + +U -= (fvc::grad(p0)*(1.0/AU - 1.0/AtU) + fvc::grad(p)/AtU); +//U -= fvc::grad(p)/AU; + +U.correctBoundaryConditions(); + +bound(p, pMin); + +// For closed-volume cases adjust the pressure and density levels +// to obey overall mass continuity +if (closedVolume) +{ + p += (initialMass - fvc::domainIntegrate(psi*p)) + /fvc::domainIntegrate(psi); +} + +rho = thermo.rho(); + +if (!transonic) +{ + rho.relax(); +} + +Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; diff --git a/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C new file mode 100644 index 0000000000..8f706182b5 --- /dev/null +++ b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + rhoSimplecFoam + +Description + Steady-state SIMPLEC solver for laminar or turbulent RANS flow of + compressible fluids. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "basicPsiThermo.H" +#include "RASModel.H" +#include "mixedFvPatchFields.H" +#include "bound.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createFields.H" + #include "initContinuityErrs.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + #include "readSIMPLEControls.H" + #include "initConvergenceCheck.H" + + p.storePrevIter(); + + if (!transonic) + { + rho.storePrevIter(); + } + + // Velocity-pressure-enthalpy SIMPLEC corrector + { + #include "UEqn.H" + #include "pEqn.H" + #include "hEqn.H" + } + + turbulence->correct(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + #include "convergenceCheck.H" + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C b/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C index 0571ee5082..f06b13e5de 100644 --- a/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C +++ b/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) ( mesh.surfaceInterpolation::deltaCoeffs() *mag(phiv)/mesh.magSf() - ).value()*runTime.deltaT().value(); + ).value()*runTime.deltaTValue(); Info<< "\nMax Courant Number = " << CoNum << endl; diff --git a/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C b/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C index 3d71de6324..def72f426b 100644 --- a/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C +++ b/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) ( mesh.surfaceInterpolation::deltaCoeffs() *mag(phiv)/mesh.magSf() - ).value()*runTime.deltaT().value(); + ).value()*runTime.deltaTValue(); Info<< "Max Courant Number = " << CoNum << endl; diff --git a/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H b/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H deleted file mode 100644 index d024bd2017..0000000000 --- a/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H +++ /dev/null @@ -1,162 +0,0 @@ - - Info<< nl << "Reading field boundaryT" << endl; - volScalarField boundaryT - ( - IOobject - ( - "boundaryT", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field boundaryU" << endl; - volVectorField boundaryU - ( - IOobject - ( - "boundaryU", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field rhoN (number density)" << endl; - volScalarField rhoN - ( - IOobject - ( - "rhoN", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field rhoM (mass density)" << endl; - volScalarField rhoM - ( - IOobject - ( - "rhoM", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field rhoNdsmc (dsmc particle density)" << endl; - volScalarField dsmcRhoN - ( - IOobject - ( - "dsmcRhoN", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field momentum (momentum density)" << endl; - volVectorField momentum - ( - IOobject - ( - "momentum", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field linearKE (linear kinetic energy density)" - << endl; - - volScalarField linearKE - ( - IOobject - ( - "linearKE", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field internalE (internal energy density)" << endl; - volScalarField internalE - ( - IOobject - ( - "internalE", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field iDof (internal degree of freedom density)" - << endl; - - volScalarField iDof - ( - IOobject - ( - "iDof", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field q (surface heat transfer)" << endl; - volScalarField q - ( - IOobject - ( - "q", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Reading field fD (surface force density)" << endl; - volVectorField fD - ( - IOobject - ( - "fD", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< nl << "Constructing dsmcCloud " << endl; - - dsmcCloud dsmc("dsmc", boundaryT, boundaryU); diff --git a/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C b/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C index 84b499451f..f5a57f15e8 100644 --- a/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C +++ b/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C @@ -41,53 +41,21 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + Info<< nl << "Constructing dsmcCloud " << endl; + + dsmcCloud dsmc("dsmc", mesh); + Info<< "\nStarting time loop\n" << endl; - while (runTime.run()) + while (runTime.loop()) { - runTime++; - Info<< "Time = " << runTime.timeName() << nl << endl; - // Carry out dsmcCloud timestep - dsmc.evolve(); - // Retrieve flow field data from dsmcCloud - - rhoN = dsmc.rhoN(); - rhoN.correctBoundaryConditions(); - - rhoM = dsmc.rhoM(); - rhoM.correctBoundaryConditions(); - - dsmcRhoN = dsmc.dsmcRhoN(); - dsmcRhoN.correctBoundaryConditions(); - - momentum = dsmc.momentum(); - momentum.correctBoundaryConditions(); - - linearKE = dsmc.linearKE(); - linearKE.correctBoundaryConditions(); - - internalE = dsmc.internalE(); - internalE.correctBoundaryConditions(); - - iDof = dsmc.iDof(); - iDof.correctBoundaryConditions(); - - // Retrieve surface field data from dsmcCloud - - q = dsmc.q(); - - fD = dsmc.fD(); - - // Print status of dsmcCloud - dsmc.info(); runTime.write(); diff --git a/applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H b/applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H index a25c31e683..a9db2ea585 100644 --- a/applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H +++ b/applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H @@ -1,4 +1,4 @@ Info<< "magnetic flux divergence error = " - << runTime.deltaT().value() + << runTime.deltaTValue() *mag(fvc::div(phiB))().weightedAverage(mesh.V()).value() << endl; diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 4bbb449df7..11768ea2f6 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -21,7 +21,7 @@ fvm::laplacian(rhorUAf, p) == fvc::div(phi) ); - pEqn.setReference(pRefCell, p[pRefCell]); + pEqn.setReference(pRefCell, pRefValue); // retain the residual from the first iteration if (nonOrth == 0) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files index 9b95197f54..f9d90502d1 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files @@ -1,7 +1,4 @@ -regionProperties/regionProperties.C - derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C -derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.C fluid/compressibleCourantNo.C diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 12316d6bc7..842fa2f086 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -5,7 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude EXE_LIBS = \ -lbasicThermophysicalModels \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C index a3d68f55ca..93e42ee0d5 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C @@ -47,10 +47,10 @@ Foam::scalar Foam::compressibleCourantNo / fvc::interpolate(rho); CoNum = max(SfUfbyDelta/mesh.magSf()) - .value()*runTime.deltaT().value(); + .value()*runTime.deltaTValue(); meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) - .value()*runTime.deltaT().value(); + .value()*runTime.deltaTValue(); } Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 1826a77217..7c82fec144 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -41,24 +41,6 @@ ) ); - Info<< " Adding to KFluid\n" << endl; - KFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "K", - runTime.timeName(), - fluidRegions[i], - IOobject::NO_READ, - IOobject::NO_WRITE - ), - thermoFluid[i].Cp()*thermoFluid[i].alpha() - ) - ); - Info<< " Adding to UFluid\n" << endl; UFluid.set ( @@ -129,6 +111,24 @@ ).ptr() ); + Info<< " Adding to KFluid\n" << endl; + KFluid.set + ( + i, + new volScalarField + ( + IOobject + ( + "K", + runTime.timeName(), + fluidRegions[i], + IOobject::NO_READ, + IOobject::NO_WRITE + ), + thermoFluid[i].Cp()*turbulence[i].alphaEff() + ) + ); + Info<< " Adding to DpDtFluid\n" << endl; DpDtFluid.set ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/files b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/files new file mode 100644 index 0000000000..e5f536ca09 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/files @@ -0,0 +1,5 @@ +derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C +chtMultiRegionSimpleFoam.C + +EXE = $(FOAM_APPBIN)/chtMultiRegionSimpleFoam + diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/options new file mode 100644 index 0000000000..34be199596 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/Make/options @@ -0,0 +1,16 @@ +EXE_INC = \ + /* -DFULLDEBUG -O0 -g */ \ + -Ifluid \ + -Isolid \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lbasicThermophysicalModels \ + -lspecie \ + -lcompressibleRASModels diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C new file mode 100644 index 0000000000..336f32d671 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + chtMultiRegionSimpleFoam + +Description + Steady-state version of chtMultiRegionFoam + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "basicPsiThermo.H" +#include "turbulenceModel.H" +#include "fixedGradientFvPatchFields.H" +#include "regionProperties.H" +#include "compressibleCourantNo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + + regionProperties rp(runTime); + + #include "createFluidMeshes.H" + #include "createSolidMeshes.H" + + #include "createFluidFields.H" + #include "createSolidFields.H" + + #include "initContinuityErrs.H" + + + while (runTime.run()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + forAll(fluidRegions, i) + { + Info<< "\nSolving for fluid region " + << fluidRegions[i].name() << endl; + #include "setRegionFluidFields.H" + #include "readFluidMultiRegionSIMPLEControls.H" + #include "initConvergenceCheck.H" + #include "solveFluid.H" + #include "convergenceCheck.H" + } + + forAll(solidRegions, i) + { + Info<< "\nSolving for solid region " + << solidRegions[i].name() << endl; + #include "setRegionSolidFields.H" + #include "readSolidMultiRegionSIMPLEControls.H" + #include "initConvergenceCheck.H" + #include "solveSolid.H" + #include "convergenceCheck.H" + } + + runTime++; + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C new file mode 100644 index 0000000000..b1f8c3bed2 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "solidWallHeatFluxTemperatureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + q_(p.size(), 0.0), + KName_("undefined-K") +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + q_(ptf.q_, mapper), + KName_(ptf.KName_) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + q_("q", dict, p.size()), + KName_(dict.lookup("K")) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf), + q_(tppsf.q_), + KName_(tppsf.KName_) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF), + q_(tppsf.q_), + KName_(tppsf.KName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + q_.autoMap(m); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf = + refCast(ptf); + + q_.rmap(hfptf.q_, addr); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& Kw = + patch().lookupPatchField(KName_); + + const fvPatchScalarField& Tw = *this; + + operator==(q_/(patch().deltaCoeffs()*Kw) + Tw.patchInternalField()); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + q_.writeEntry("q", os); + os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + solidWallHeatFluxTemperatureFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H new file mode 100644 index 0000000000..85a1ef1cf1 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + solidWallHeatFluxTemperatureFvPatchScalarField + +Description + Heat flux boundary condition for temperature on solid region + + Example usage: + myWallPatch + { + type solidWallHeatFluxTemperature; + K K; // Name of K field + q uniform 1000; // Heat flux / [W/m2] + value 300.0; // Initial temperature / [K] + } + + +SourceFiles + solidWallHeatFluxTemperatureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H +#define solidWallHeatFluxTemperatureFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class solidWallHeatFluxTemperatureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class solidWallHeatFluxTemperatureFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Heat flux / [W/m2] + scalarField q_; + + //- Name of thermal conductivity field + word KName_; + + +public: + + //- Runtime type information + TypeName("solidWallHeatFluxTemperature"); + + + // Constructors + + //- Construct from patch and internal field + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // solidWallHeatFluxTemperatureFvPatchScalarField + // onto a new patch + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new solidWallHeatFluxTemperatureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new solidWallHeatFluxTemperatureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H new file mode 100644 index 0000000000..1cbafe368a --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H @@ -0,0 +1,22 @@ + // Solve the Momentum equation + tmp UEqn + ( + fvm::div(phi, U) + - fvm::Sp(fvc::div(phi), U) + + turb.divDevRhoReff(U) + ); + + UEqn().relax(); + + eqnResidual = solve + ( + UEqn() + == + fvc::reconstruct + ( + fvc::interpolate(rho)*(g & mesh.Sf()) + - fvc::snGrad(p)*mesh.magSf() + ) + ).initialResidual(); + + maxResidual = max(eqnResidual, maxResidual); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleContinuityErrors.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleContinuityErrors.H new file mode 100644 index 0000000000..046ca5ec37 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleContinuityErrors.H @@ -0,0 +1,21 @@ +{ + dimensionedScalar totalMass = fvc::domainIntegrate(rho); + + scalar sumLocalContErr = + ( + fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass + ).value(); + + scalar globalContErr = + ( + fvc::domainIntegrate(rho - thermo.rho())/totalMass + ).value(); + + cumulativeContErr[i] += globalContErr; + + Info<< "time step continuity errors (" << mesh.name() << ")" + << ": sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr[i] + << endl; +} diff --git a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleCourantNo.C similarity index 61% rename from applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C rename to applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleCourantNo.C index 214b96bf26..a3d68f55ca 100644 --- a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleCourantNo.C @@ -22,39 +22,42 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ -#include "error.H" -#include "blockMesh.H" +#include "compressibleCourantNo.H" +#include "fvc.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::labelList Foam::blockMesh::createBlockOffsets() +Foam::scalar Foam::compressibleCourantNo +( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& rho, + const surfaceScalarField& phi +) { - Info<< nl << "Creating block offsets" << endl; + scalar CoNum = 0.0; + scalar meanCoNum = 0.0; - blockMesh& blocks = *this; - - nPoints_ = blocks[0].points().size(); - nCells_ = blocks[0].cells().size(); - - labelList BlockOffsets(blocks.size()); - BlockOffsets[0] = 0; - - label blockLabel; - for (blockLabel=1; blockLabel +#ifndef compressibleCourantNo_H +#define compressibleCourantNo_H -#include "vtkFoamData.h" -#include "vtkObjectFactory.h" +#include "fvMesh.H" -vtkCxxRevisionMacro(vtkFoamData, "$Revision: 1.20 $"); -vtkStandardNewMacro(vtkFoamData); - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -vtkFoamData::vtkFoamData() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -vtkFoamData::~vtkFoamData() -{} +namespace Foam +{ + scalar compressibleCourantNo + ( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& rho, + const surfaceScalarField& phi + ); +} +#endif // ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H new file mode 100644 index 0000000000..3ca2f68581 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H @@ -0,0 +1,15 @@ + scalar CoNum = -GREAT; + forAll(fluidRegions, regionI) + { + CoNum = max + ( + compressibleCourantNo + ( + fluidRegions[regionI], + runTime, + rhoFluid[regionI], + phiFluid[regionI] + ), + CoNum + ); + } diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H new file mode 100644 index 0000000000..53c00386ff --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H @@ -0,0 +1,12 @@ +// check convergence +Info<< "maxResidual: " << maxResidual + << " convergence criterion: " << convergenceCriterion + << endl; + +if (maxResidual < convergenceCriterion) +{ + Info<< "reached convergence criterion: " << convergenceCriterion << endl; + runTime.writeAndEnd(); + Info<< "latestTime = " << runTime.timeName() << endl; +} + diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/createFluidFields.H new file mode 100644 index 0000000000..2d2ccf9a5e --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -0,0 +1,144 @@ + // Initialise fluid field pointer lists + PtrList thermoFluid(fluidRegions.size()); + PtrList rhoFluid(fluidRegions.size()); + PtrList KFluid(fluidRegions.size()); + PtrList UFluid(fluidRegions.size()); + PtrList phiFluid(fluidRegions.size()); + PtrList gFluid(fluidRegions.size()); + PtrList turbulence(fluidRegions.size()); + PtrList DpDtf(fluidRegions.size()); + + List initialMassFluid(fluidRegions.size()); + List