diff --git a/applications/solvers/basic/laplacianFoam/Make/options b/applications/solvers/basic/laplacianFoam/Make/options index d27c95d033..04ef6c148d 100644 --- a/applications/solvers/basic/laplacianFoam/Make/options +++ b/applications/solvers/basic/laplacianFoam/Make/options @@ -4,4 +4,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lfvOptions \ -lmeshTools diff --git a/applications/solvers/basic/laplacianFoam/createFields.H b/applications/solvers/basic/laplacianFoam/createFields.H index 616afe1a88..7056505e99 100644 --- a/applications/solvers/basic/laplacianFoam/createFields.H +++ b/applications/solvers/basic/laplacianFoam/createFields.H @@ -1,37 +1,39 @@ - Info<< "Reading field T\n" << endl; +Info<< "Reading field T\n" << endl; - volScalarField T +volScalarField T +( + IOobject ( - IOobject - ( - "T", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading transportProperties\n" << endl; +Info<< "Reading transportProperties\n" << endl; - IOdictionary transportProperties +IOdictionary transportProperties +( + IOobject ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); - Info<< "Reading diffusivity DT\n" << endl; +Info<< "Reading diffusivity DT\n" << endl; - dimensionedScalar DT - ( - transportProperties.lookup("DT") - ); +dimensionedScalar DT +( + "DT", + dimArea/dimTime, + transportProperties +); diff --git a/applications/solvers/basic/scalarTransportFoam/createFields.H b/applications/solvers/basic/scalarTransportFoam/createFields.H index c6ba83629b..54dcb3fca5 100644 --- a/applications/solvers/basic/scalarTransportFoam/createFields.H +++ b/applications/solvers/basic/scalarTransportFoam/createFields.H @@ -1,55 +1,57 @@ - Info<< "Reading field T\n" << endl; +Info<< "Reading field T\n" << endl; - volScalarField T +volScalarField T +( + IOobject ( - IOobject - ( - "T", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; +Info<< "Reading field U\n" << endl; - volVectorField U +volVectorField U +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading transportProperties\n" << endl; +Info<< "Reading transportProperties\n" << endl; - IOdictionary transportProperties +IOdictionary transportProperties +( + IOobject ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); - Info<< "Reading diffusivity DT\n" << endl; +Info<< "Reading diffusivity DT\n" << endl; - dimensionedScalar DT - ( - transportProperties.lookup("DT") - ); +dimensionedScalar DT +( + "DT", + dimArea/dimTime, + transportProperties +); - #include "createPhi.H" +#include "createPhi.H" diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index 405f5bcf62..58dfadafd4 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -15,8 +15,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lengine \ diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C index 49f36d3309..2b2cd7c4fd 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,7 @@ Foam::PDRDragModel::~PDRDragModel() bool Foam::PDRDragModel::read(const dictionary& PDRProperties) { - PDRDragModelCoeffs_ = PDRProperties.subDict(type() + "Coeffs"); + PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs"); PDRDragModelCoeffs_.lookup("drag") >> on_; diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C index a6301ba973..7e3b2536b1 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,7 +67,7 @@ Foam::XiEqModel::~XiEqModel() bool Foam::XiEqModel::read(const dictionary& XiEqProperties) { - XiEqModelCoeffs_ = XiEqProperties.subDict(type() + "Coeffs"); + XiEqModelCoeffs_ = XiEqProperties.optionalSubDict(type() + "Coeffs"); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.C index 12bd713060..217242b24b 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,7 +67,7 @@ Foam::XiGModel::~XiGModel() bool Foam::XiGModel::read(const dictionary& XiGProperties) { - XiGModelCoeffs_ = XiGProperties.subDict(type() + "Coeffs"); + XiGModelCoeffs_ = XiGProperties.optionalSubDict(type() + "Coeffs"); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.C index 0bb0cd1e0b..9580728905 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ Foam::XiModel::~XiModel() bool Foam::XiModel::read(const dictionary& XiProperties) { - XiModelCoeffs_ = XiProperties.subDict(type() + "Coeffs"); + XiModelCoeffs_ = XiProperties.optionalSubDict(type() + "Coeffs"); return true; } diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index 947c62132e..afdebbd2c6 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,7 +80,7 @@ Foam::laminarFlameSpeedModels::SCOPE::SCOPE dict.lookup("fuelFile") ) )() - ).subDict(typeName + "Coeffs") + ).optionalSubDict(typeName + "Coeffs") ), LFL_(readScalar(coeffsDict_.lookup("lowerFlamabilityLimit"))), UFL_(readScalar(coeffsDict_.lookup("upperFlamabilityLimit"))), diff --git a/applications/solvers/combustion/chemFoam/createBaseFields.H b/applications/solvers/combustion/chemFoam/createBaseFields.H index 0762f2708d..80dea2584b 100644 --- a/applications/solvers/combustion/chemFoam/createBaseFields.H +++ b/applications/solvers/combustion/chemFoam/createBaseFields.H @@ -54,4 +54,3 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl; T.write(); } - diff --git a/applications/solvers/combustion/chemFoam/output.H b/applications/solvers/combustion/chemFoam/output.H index 5620fe6820..2e84c59a48 100644 --- a/applications/solvers/combustion/chemFoam/output.H +++ b/applications/solvers/combustion/chemFoam/output.H @@ -1,6 +1,6 @@ runTime.write(); - Info<< "Sh = " << Sh + Info<< "Qdot = " << Qdot << ", T = " << thermo.T()[0] << ", p = " << thermo.p()[0] << ", " << Y[0].name() << " = " << Y[0][0] @@ -8,4 +8,3 @@ post<< runTime.value() << token::TAB << thermo.T()[0] << token::TAB << thermo.p()[0] << endl; - diff --git a/applications/solvers/combustion/chemFoam/setDeltaT.H b/applications/solvers/combustion/chemFoam/setDeltaT.H index 46d9f7bf43..52407c9475 100644 --- a/applications/solvers/combustion/chemFoam/setDeltaT.H +++ b/applications/solvers/combustion/chemFoam/setDeltaT.H @@ -3,4 +3,3 @@ if (adjustTimeStep) runTime.setDeltaT(min(dtChem, maxDeltaT)); Info<< "deltaT = " << runTime.deltaT().value() << endl; } - diff --git a/applications/solvers/combustion/chemFoam/solveChemistry.H b/applications/solvers/combustion/chemFoam/solveChemistry.H index cb4258c31d..e32a1ab0bd 100644 --- a/applications/solvers/combustion/chemFoam/solveChemistry.H +++ b/applications/solvers/combustion/chemFoam/solveChemistry.H @@ -1,3 +1,3 @@ - dtChem = chemistry.solve(runTime.deltaT().value()); - scalar Sh = chemistry.Sh()()[0]/rho[0]; - integratedHeat += Sh*runTime.deltaT().value(); +dtChem = chemistry.solve(runTime.deltaT().value()); +scalar Qdot = chemistry.Qdot()()[0]/rho[0]; +integratedHeat += Qdot*runTime.deltaT().value(); diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options index b49c426e87..869c315f4c 100644 --- a/applications/solvers/combustion/fireFoam/Make/options +++ b/applications/solvers/combustion/fireFoam/Make/options @@ -13,10 +13,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -38,9 +35,6 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/combustion/fireFoam/YEEqn.H b/applications/solvers/combustion/fireFoam/YEEqn.H index e968600171..5176956acc 100644 --- a/applications/solvers/combustion/fireFoam/YEEqn.H +++ b/applications/solvers/combustion/fireFoam/YEEqn.H @@ -10,7 +10,7 @@ tmp> mvConvection ); { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) @@ -67,8 +67,8 @@ tmp> mvConvection ) - fvm::laplacian(turbulence->alphaEff(), he) == - combustion->Sh() - + radiation->Sh(thermo) + Qdot + + radiation->Sh(thermo, he) + parcels.Sh(he) + surfaceFilm.Sh() + fvOptions(rho, he) diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index 30e7d30377..85d26aed87 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -131,18 +131,18 @@ Switch solvePyrolysisRegion additionalControlsDict.lookupOrDefault("solvePyrolysisRegion", true) ); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H index 9267c9a9be..f92598bbed 100644 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ b/applications/solvers/combustion/reactingFoam/EEqn.H @@ -17,7 +17,7 @@ ) - fvm::laplacian(turbulence->alphaEff(), he) == - reaction->Sh() + Qdot + fvOptions(rho, he) ); diff --git a/applications/solvers/combustion/reactingFoam/YEqn.H b/applications/solvers/combustion/reactingFoam/YEqn.H index 7c3f0f117b..4d209a3d81 100644 --- a/applications/solvers/combustion/reactingFoam/YEqn.H +++ b/applications/solvers/combustion/reactingFoam/YEqn.H @@ -11,7 +11,7 @@ tmp> mvConvection { reaction->correct(); - dQ = reaction->dQ(); + Qdot = reaction->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/combustion/reactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/createFields.H index e4475e5d1b..6fcf83624c 100644 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/createFields.H @@ -117,18 +117,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H index a4b328f367..675aef3f5a 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H @@ -117,18 +117,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H index fbd45dd20c..687dffcc13 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H @@ -96,18 +96,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/combustion/reactingFoam/setRDeltaT.H b/applications/solvers/combustion/reactingFoam/setRDeltaT.H index 5c24294ef6..b0f9c02b65 100644 --- a/applications/solvers/combustion/reactingFoam/setRDeltaT.H +++ b/applications/solvers/combustion/reactingFoam/setRDeltaT.H @@ -43,13 +43,16 @@ License // Damping coefficient (1-0) scalar rDeltaTDampingCoeff ( - pimpleDict.lookupOrDefault("rDeltaTDampingCoeff", 1) + pimpleDict.lookupOrDefault("rDeltaTDampingCoeff", 1.0) ); // Maximum change in cell temperature per iteration // (relative to previous value) scalar alphaTemp(pimpleDict.lookupOrDefault("alphaTemp", 0.05)); + // Maximum change in cell concentration per iteration + // (relative to reference value) + scalar alphaY(pimpleDict.lookupOrDefault("alphaY", 1.0)); Info<< "Time scales min/max:" << endl; @@ -68,34 +71,89 @@ License rDeltaT.max(1/maxDeltaT); Info<< " Flow = " - << gMin(1/rDeltaT.primitiveField()) << ", " - << gMax(1/rDeltaT.primitiveField()) << endl; + << 1/gMax(rDeltaT.primitiveField()) << ", " + << 1/gMin(rDeltaT.primitiveField()) << endl; } - // Reaction source time scale - if (alphaTemp < 1.0) + // Heat release rate time scale + if (alphaTemp < 1) { volScalarField::Internal rDeltaTT ( - mag(reaction->Sh())/(alphaTemp*rho*thermo.Cp()*T) + mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T) ); Info<< " Temperature = " - << gMin(1/(rDeltaTT.field() + VSMALL)) << ", " - << gMax(1/(rDeltaTT.field() + VSMALL)) << endl; + << 1/(gMax(rDeltaTT.field()) + VSMALL) << ", " + << 1/(gMin(rDeltaTT.field()) + VSMALL) << endl; - rDeltaT.ref() = max + rDeltaT.ref() = max(rDeltaT(), rDeltaTT); + } + + // Reaction rate time scale + if (alphaY < 1) + { + dictionary Yref(pimpleDict.subDict("Yref")); + + volScalarField::Internal rDeltaTY ( - rDeltaT(), - rDeltaTT + IOobject + ( + "rDeltaTY", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("rDeltaTY", rDeltaT.dimensions(), 0) ); + + bool foundY = false; + + forAll(Y, i) + { + if (i != inertIndex && composition.active(i)) + { + volScalarField& Yi = Y[i]; + + if (Yref.found(Yi.name())) + { + foundY = true; + scalar Yrefi = readScalar(Yref.lookup(Yi.name())); + + rDeltaTY.field() = max + ( + mag + ( + reaction->R(Yi)().source() + /((Yrefi*alphaY)*(rho*mesh.V())) + ), + rDeltaTY + ); + } + } + } + + if (foundY) + { + Info<< " Composition = " + << 1/(gMax(rDeltaTY.field()) + VSMALL) << ", " + << 1/(gMin(rDeltaTY.field()) + VSMALL) << endl; + + rDeltaT.ref() = max(rDeltaT(), rDeltaTY); + } + else + { + IOWarningIn(args.executable().c_str(), Yref) + << "Cannot find any active species in Yref " << Yref + << endl; + } } // Update tho boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); // Spatially smooth the time scale field - if (rDeltaTSmoothingCoeff < 1.0) + if (rDeltaTSmoothingCoeff < 1) { fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } @@ -105,7 +163,7 @@ License // - only increase at a fraction of old time scale if ( - rDeltaTDampingCoeff < 1.0 + rDeltaTDampingCoeff < 1 && runTime.timeIndex() > runTime.startTimeIndex() + 1 ) { @@ -120,8 +178,8 @@ License rDeltaT.correctBoundaryConditions(); Info<< " Overall = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << 1/gMax(rDeltaT.primitiveField()) + << ", " << 1/gMin(rDeltaT.primitiveField()) << endl; } diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H index 5ab7d3835f..be5014394d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,7 +184,8 @@ public: //- Evaluate the patch field virtual void evaluate ( - const Pstream::commsTypes commsType=Pstream::blocking + const Pstream::commsTypes commsType= + Pstream::commsTypes::blocking ); //- Return face-gradient transform diagonal diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C index 96413e0201..b24f21fe8d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C @@ -120,11 +120,14 @@ int main(int argc, char *argv[]) "cSf_pos", interpolate(c, pos, T.name())*mesh.magSf() ); + cSf_pos.setOriented(); + surfaceScalarField cSf_neg ( "cSf_neg", interpolate(c, neg, T.name())*mesh.magSf() ); + cSf_neg.setOriented(); surfaceScalarField ap ( @@ -269,4 +272,5 @@ int main(int argc, char *argv[]) return 0; } + // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C index 65ab9d2db3..6550d62b28 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C @@ -101,11 +101,14 @@ int main(int argc, char *argv[]) "cSf_pos", interpolate(c, pos, T.name())*mesh.magSf() ); + cSf_pos.setOriented(); + surfaceScalarField cSf_neg ( "cSf_neg", interpolate(c, neg, T.name())*mesh.magSf() ); + cSf_neg.setOriented(); surfaceScalarField ap ( diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index a7ee3eca45..84f70f2cd0 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -2,11 +2,11 @@ Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo +autoPtr pThermo ( - psiThermo::New(mesh) + fluidThermo::New(mesh) ); -psiThermo& thermo = pThermo(); +fluidThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); volScalarField& p = thermo.p(); @@ -40,27 +40,7 @@ volVectorField U #include "compressibleCreatePhi.H" -dimensionedScalar rhoMax -( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - pimple.dict(), - dimDensity, - GREAT - ) -); - -dimensionedScalar rhoMin -( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - pimple.dict(), - dimDensity, - 0 - ) -); +pressureControl pressureControl(p, rho, pimple.dict(), false); Info<< "Creating turbulence model\n" << endl; autoPtr turbulence diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index ac7107acf0..5aab536239 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,55 +7,52 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + fvc::flux(rho*HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, phi) +); + +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(p)*phid; while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - ( - fvc::flux(rho*HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, phi) - ) - ); - - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -87,19 +79,20 @@ else // Explicitly relax pressure for momentum corrector p.relax(); -// Recalculate density from the relaxed pressure -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); +pressureControl.limit(p); +p.correctBoundaryConditions(); +rho = thermo.rho(); + +if (!pimple.transonic()) +{ + rho.relax(); +} + if (thermo.dpdt()) { dpdt = fvc::ddt(p); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H index 713f443fc5..afbc2851e4 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,72 +7,64 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + ( + fvc::flux(rho*HbyA) + + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) + ) +); + +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +volScalarField rhorAtU("rhorAtU", rho*rAtU); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) - /fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - MRF.makeRelative(fvc::interpolate(psi), phid); - - surfaceScalarField phic - ( - "phic", + phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() - ); + - fvc::interpolate(p)*phid; HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - + fvc::div(phic) - fvm::laplacian(rhorAtU, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == phic + pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - ( - fvc::flux(rho*HbyA) - + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) - ) - ); - - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -109,19 +96,16 @@ U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); -if (thermo.dpdt()) -{ - dpdt = fvc::ddt(p); -} - -// Recalculate density from the relaxed pressure +pressureControl.limit(p); +p.correctBoundaryConditions(); rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); if (!pimple.transonic()) { rho.relax(); } -Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; +if (thermo.dpdt()) +{ + dpdt = fvc::ddt(p); +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H index 7bd540df40..0f85562618 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,55 +7,53 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + fvc::flux(rho*HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) +); + +fvc::makeRelative(phiHbyA, rho, U); +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - - fvc::makeRelative(phid, psi, U); - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(p)*phid; while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - fvc::flux(rho*HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) - ); - - fvc::makeRelative(phiHbyA, rho, U); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (pimple.correctNonOrthogonal()) { // Pressure corrector @@ -88,19 +81,20 @@ else // Explicitly relax pressure for momentum corrector p.relax(); -// Recalculate density from the relaxed pressure -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); +pressureControl.limit(p); +p.correctBoundaryConditions(); +rho = thermo.rho(); + +if (!pimple.transonic()) +{ + rho.relax(); +} + { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C index c7046bb9b4..493b35f692 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Application - rhoPimpleFoam + rhoPimpleDyMFoam Group grpCompressibleSolvers grpMovingMeshSolvers @@ -38,10 +38,11 @@ Description #include "fvCFD.H" #include "dynamicFvMesh.H" -#include "psiThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" +#include "pressureControl.H" #include "CorrectPhi.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index 1a74933ea8..0fbe7717e3 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,10 +37,11 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "psiThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" +#include "pressureControl.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index 176a61a0c1..c7914f89d3 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -1,11 +1,14 @@ Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo + +autoPtr pThermo ( - rhoThermo::New(mesh) + fluidThermo::New(mesh) ); -rhoThermo& thermo = pThermo(); +fluidThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); +volScalarField& p = thermo.p(); + volScalarField rho ( IOobject @@ -19,8 +22,6 @@ volScalarField rho thermo.rho() ); -volScalarField& p = thermo.p(); - Info<< "Reading field U\n" << endl; volVectorField U ( @@ -37,35 +38,10 @@ volVectorField U #include "compressibleCreatePhi.H" - -label pRefCell = 0; -scalar pRefValue = 0.0; -setRefCell(p, simple.dict(), pRefCell, pRefValue); +pressureControl pressureControl(p, rho, simple.dict()); mesh.setFluxRequired(p.name()); -dimensionedScalar rhoMax -( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - simple.dict(), - dimDensity, - GREAT - ) -); - -dimensionedScalar rhoMin -( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - simple.dict(), - dimDensity, - 0 - ) -); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 291c220b95..c7edbb9e87 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -1,6 +1,4 @@ { - //const volScalarField& psi = thermo.psi(); - volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -8,22 +6,27 @@ bool closedVolume = false; + surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); + MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (simple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *fvc::flux(HbyA) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(p)*phid; while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::div(phid, p) + fvc::div(phiHbyA) + + fvm::div(phid, p) - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) @@ -32,26 +35,24 @@ // Relax the pressure equation to ensure diagonal-dominance pEqn.relax(); - pEqn.setReference(pRefCell, pRefValue); + pEqn.setReference + ( + pressureControl.refCell(), + pressureControl.refValue() + ); pEqn.solve(); if (simple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - closedVolume = adjustPhi(phiHbyA, U, p); - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -62,7 +63,11 @@ fvOptions(psi, p, rho.name()) ); - pEqn.setReference(pRefCell, pRefValue); + pEqn.setReference + ( + pressureControl.refCell(), + pressureControl.refValue() + ); pEqn.solve(); @@ -83,6 +88,8 @@ U.correctBoundaryConditions(); fvOptions.correct(U); + pressureControl.limit(p); + // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity if (closedVolume) @@ -91,19 +98,12 @@ /fvc::domainIntegrate(psi); } - rho = thermo.rho(); - rho = max(rho, rhoMin); - rho = min(rho, rhoMax); + p.correctBoundaryConditions(); - thermo.rho() = max(thermo.rho(), rhoMin); - thermo.rho() = min(thermo.rho(), rhoMax); + rho = thermo.rho(); if (!simple.transonic()) { rho.relax(); } - - Info<< "rho max/min : " - << max(rho).value() << " " - << min(rho).value() << endl; } diff --git a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H index 446a7849d0..c7dc0f864d 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H @@ -5,33 +5,34 @@ tUEqn.clear(); bool closedVolume = false; +surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +volScalarField rhorAtU("rhorAtU", rho*rAtU); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); + if (simple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *fvc::flux(HbyA) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - MRF.makeRelative(fvc::interpolate(psi), phid); - - surfaceScalarField phic - ( - "phic", + phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() - ); + - fvc::interpolate(p)*phid; HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::div(phid, p) - + fvc::div(phic) + fvc::div(phiHbyA) + + fvm::div(phid, p) - fvm::laplacian(rhorAtU, p) == fvOptions(psi, p, rho.name()) @@ -40,31 +41,27 @@ if (simple.transonic()) // Relax the pressure equation to maintain diagonal dominance pEqn.relax(); - pEqn.setReference(pRefCell, pRefValue); + pEqn.setReference + ( + pressureControl.refCell(), + pressureControl.refValue() + ); pEqn.solve(); if (simple.finalNonOrthogonalIter()) { - phi == phic + pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - closedVolume = adjustPhi(phiHbyA, U, p); phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -75,7 +72,11 @@ else fvOptions(psi, p, rho.name()) ); - pEqn.setReference(pRefCell, pRefValue); + pEqn.setReference + ( + pressureControl.refCell(), + pressureControl.refValue() + ); pEqn.solve(); @@ -97,6 +98,8 @@ U = HbyA - rAtU*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); +pressureControl.limit(p); + // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity if (closedVolume) @@ -105,16 +108,12 @@ if (closedVolume) /fvc::domainIntegrate(psi); } +p.correctBoundaryConditions(); + // Recalculate density from the relaxed pressure rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -thermo.rho() = max(thermo.rho(), rhoMin); -thermo.rho() = min(thermo.rho(), rhoMax); if (!simple.transonic()) { rho.relax(); } - -Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H deleted file mode 100644 index 56e78ff630..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H +++ /dev/null @@ -1,26 +0,0 @@ -{ - volScalarField& he = thermo.he(); - - fvScalarMatrix EEqn - ( - fvm::div(phi, he) - + ( - he.name() == "e" - ? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho)) - : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) - ) - - fvm::laplacian(turbulence->alphaEff(), he) - == - fvOptions(rho, he) - ); - - EEqn.relax(); - - fvOptions.constrain(EEqn); - - EEqn.solve(); - - fvOptions.correct(he); - - thermo.correct(); -} diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H deleted file mode 100644 index e7136c52d0..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H +++ /dev/null @@ -1,84 +0,0 @@ -Info<< "Reading thermophysical properties\n" << endl; - -autoPtr pThermo -( - rhoThermo::New(mesh) -); -rhoThermo& thermo = pThermo(); -thermo.validate(args.executable(), "h", "e"); - -volScalarField rho -( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - thermo.rho() -); - -volScalarField& p = thermo.p(); - -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, simple.dict(), pRefCell, pRefValue); - -mesh.setFluxRequired(p.name()); - -dimensionedScalar rhoMax -( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - simple.dict(), - dimDensity, - GREAT - ) -); - -dimensionedScalar rhoMin -( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - simple.dict(), - dimDensity, - 0 - ) -); - -Info<< "Creating turbulence model\n" << endl; -autoPtr turbulence -( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) -); - -dimensionedScalar initialMass = fvc::domainIntegrate(rho); - -#include "createMRF.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H index cdabc4dad9..4167f80e59 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H @@ -48,7 +48,11 @@ fvScalarMatrix& pEqn = tpEqn.ref(); - pEqn.setReference(pRefCell, pRefValue); + pEqn.setReference + ( + pressureControl.refCell(), + pressureControl.refValue() + ); pEqn.solve(); @@ -75,6 +79,8 @@ U.correctBoundaryConditions(); fvOptions.correct(U); + pressureControl.limit(p); + // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity if (closedVolume) @@ -84,14 +90,5 @@ } rho = thermo.rho(); - rho = max(rho, rhoMin); - rho = min(rho, rhoMax); - - thermo.rho() = max(thermo.rho(), rhoMin); - thermo.rho() = min(thermo.rho(), rhoMax); - rho.relax(); - Info<< "rho max/min : " - << max(rho).value() << " " - << min(rho).value() << endl; } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index 249984ed22..548a7dd130 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,11 +34,12 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "rhoThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" +#include "simpleControl.H" +#include "pressureControl.H" #include "fvOptions.H" #include "IOporosityModelList.H" -#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index 63f00f881d..9cae9c3e28 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,9 +33,10 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "rhoThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "simpleControl.H" +#include "pressureControl.H" #include "fvOptions.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/readThermodynamicProperties.H b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/readThermodynamicProperties.H index 82ebe7ae30..8f420d91c6 100644 --- a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/readThermodynamicProperties.H +++ b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/readThermodynamicProperties.H @@ -1,37 +1,37 @@ - Info<< "Reading thermodynamicProperties\n" << endl; +Info<< "Reading thermodynamicProperties\n" << endl; - IOdictionary thermodynamicProperties +IOdictionary thermodynamicProperties +( + IOobject ( - IOobject - ( - "thermodynamicProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + "thermodynamicProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); - dimensionedScalar rho0 - ( - "rho0", - dimDensity, - thermodynamicProperties - ); +dimensionedScalar rho0 +( + "rho0", + dimDensity, + thermodynamicProperties +); - dimensionedScalar p0 - ( - "p0", - dimPressure, - thermodynamicProperties - ); +dimensionedScalar p0 +( + "p0", + dimPressure, + thermodynamicProperties +); - dimensionedScalar psi - ( - "psi", - dimCompressibility, - thermodynamicProperties - ); +dimensionedScalar psi +( + "psi", + dimCompressibility, + thermodynamicProperties +); - // Density offset, i.e. the constant part of the density - dimensionedScalar rhoO("rhoO", rho0 - psi*p0); +// Density offset, i.e. the constant part of the density +dimensionedScalar rhoO("rhoO", rho0 - psi*p0); diff --git a/applications/solvers/electromagnetics/magneticFoam/magnet.H b/applications/solvers/electromagnetics/magneticFoam/magnet.H index 7e9b04a4c5..8f15c69635 100644 --- a/applications/solvers/electromagnetics/magneticFoam/magnet.H +++ b/applications/solvers/electromagnetics/magneticFoam/magnet.H @@ -138,9 +138,7 @@ public: >> m.orientation_; is.readEnd("magnet"); - // Check state of Istream - is.check("operator>>(Istream&, magnet&)"); - + is.check(FUNCTION_NAME); return is; } diff --git a/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H b/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H index 5ddbdab95e..7f280b8aa3 100644 --- a/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H +++ b/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H @@ -1,4 +1,3 @@ const dictionary& Bpiso = mesh.solutionDict().subDict("BPISO"); const int nBcorr = Bpiso.lookupOrDefault("nCorrectors", 1); - diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H index ddd21254a9..f0a7e3ad36 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H @@ -18,7 +18,7 @@ - fvm::laplacian(turbulence->alphaEff(), he) == rho*(U&g) - + radiation->Sh(thermo) + + radiation->Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H index b9782d3f73..e932d2fdef 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H @@ -12,7 +12,7 @@ - fvm::laplacian(turbulence->alphaEff(), he) == rho*(U&g) - + radiation->Sh(thermo) + + radiation->Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H index b618478860..daf3af8f2d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H @@ -12,7 +12,7 @@ - fvm::laplacian(turb.alphaEff(), he) == rho*(U&g) - + rad.Sh(thermo) + + rad.Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H index 616fabd7fe..66fd738d7a 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H @@ -2,4 +2,3 @@ const int nNonOrthCorr = simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index eafea3fd4c..d8f4516f5e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -18,7 +18,7 @@ - fvm::laplacian(turb.alphaEff(), he) == rho*(U&g) - + rad.Sh(thermo) + + rad.Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C index de5307c11b..e1c501f1b9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,9 @@ License \*---------------------------------------------------------------------------*/ #include "solidRegionDiffNo.H" -#include "fvc.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Foam::scalar Foam::solidRegionDiffNo ( @@ -34,21 +36,16 @@ Foam::scalar Foam::solidRegionDiffNo const volScalarField& kappa ) { - scalar DiNum = 0.0; - scalar meanDiNum = 0.0; - - //- Take care: can have fluid domains with 0 cells so do not test for - // zero internal faces. surfaceScalarField kapparhoCpbyDelta ( - mesh.surfaceInterpolation::deltaCoeffs() - * fvc::interpolate(kappa) - / fvc::interpolate(Cprho) + sqr(mesh.surfaceInterpolation::deltaCoeffs()) + *fvc::interpolate(kappa) + /fvc::interpolate(Cprho) ); - DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaT().value(); - - meanDiNum = (average(kapparhoCpbyDelta)).value()*runTime.deltaT().value(); + const scalar DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaTValue(); + const scalar meanDiNum = + average(kapparhoCpbyDelta).value()*runTime.deltaTValue(); Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum << " max: " << DiNum << endl; diff --git a/applications/solvers/heatTransfer/thermoFoam/EEqn.H b/applications/solvers/heatTransfer/thermoFoam/EEqn.H index 51232bf0be..98a248ac35 100644 --- a/applications/solvers/heatTransfer/thermoFoam/EEqn.H +++ b/applications/solvers/heatTransfer/thermoFoam/EEqn.H @@ -17,7 +17,7 @@ ) - fvm::laplacian(alphaEff, he) == - radiation->Sh(thermo) + radiation->Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index ccbe3b8141..7296a8cb37 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -93,8 +93,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - laminarTransport.lookup("lambda") >> lambda; - //alpha += // mesh.relaxationFactor("alpha") // *(lambda*max(Ua & U, zeroSensitivity) - alpha); diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H index 93da72123d..bba352e71c 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H @@ -89,8 +89,19 @@ autoPtr turbulence dimensionedScalar zeroSensitivity("0", dimVelocity*dimVelocity, 0.0); dimensionedScalar zeroAlpha("0", dimless/dimTime, 0.0); -dimensionedScalar lambda(laminarTransport.lookup("lambda")); -dimensionedScalar alphaMax(laminarTransport.lookup("alphaMax")); +dimensionedScalar lambda +( + "lambda", + dimTime/sqr(dimLength), + laminarTransport +); + +dimensionedScalar alphaMax +( + "alphaMax", + dimless/dimTime, + laminarTransport +); const labelList& inletCells = mesh.boundary()["inlet"].faceCells(); //const labelList& outletCells = mesh.boundary()["outlet"].faceCells(); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index 241ae11c3d..3c0f7b99e2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,7 +70,6 @@ int main(int argc, char *argv[]) { #include "readControls.H" #include "CourantNo.H" - #include "setDeltaT.H" runTime++; diff --git a/applications/solvers/lagrangian/DPMFoam/Allwclean b/applications/solvers/lagrangian/DPMFoam/Allwclean index f953f59874..b78c67f661 100755 --- a/applications/solvers/lagrangian/DPMFoam/Allwclean +++ b/applications/solvers/lagrangian/DPMFoam/Allwclean @@ -2,7 +2,10 @@ cd ${0%/*} || exit 1 # Run from this directory wclean libso DPMTurbulenceModels + wclean wclean MPPICFoam +wclean DPMDyMFoam +wclean DPMDyMFoam/MPPICDyMFoam #------------------------------------------------------------------------------ diff --git a/applications/solvers/lagrangian/DPMFoam/Allwmake b/applications/solvers/lagrangian/DPMFoam/Allwmake index 2af858f6bb..e3c5370297 100755 --- a/applications/solvers/lagrangian/DPMFoam/Allwmake +++ b/applications/solvers/lagrangian/DPMFoam/Allwmake @@ -1,5 +1,5 @@ #!/bin/sh -cd ${0%/*} || exit 1 +cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments @@ -8,5 +8,7 @@ wmake $targetType DPMTurbulenceModels wmake $targetType wmake $targetType MPPICFoam +wmake $targetType DPMDyMFoam +wmake $targetType DPMDyMFoam/MPPICDyMFoam #------------------------------------------------------------------------------ diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/DPMDyMFoam.C b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/DPMDyMFoam.C new file mode 100644 index 0000000000..aec4c64304 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/DPMDyMFoam.C @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ 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 3 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, see . + +Application + DPMDyMFoam + +Description + Transient solver for the coupled transport of a single kinematic particle + cloud including the effect of the volume fraction of particles on the + continuous phase, with optional mesh motion and mesh topology changes. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "singlePhaseTransportModel.H" +#include "PhaseIncompressibleTurbulenceModel.H" +#include "pimpleControl.H" +#include "CorrectPhi.H" + +#ifdef MPPIC + #include "basicKinematicMPPICCloud.H" + #define basicKinematicTypeCloud basicKinematicMPPICCloud +#else + #include "basicKinematicCollidingCloud.H" + #define basicKinematicTypeCloud basicKinematicCollidingCloud +#endif + +int main(int argc, char *argv[]) +{ + argList::addOption + ( + "cloudName", + "name", + "specify alternative cloud name. default is 'kinematicCloud'" + ); + + #include "postProcess.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "createControls.H" + #include "createFields.H" + #include "createUcf.H" + #include "initContinuityErrs.H" + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + mesh.update(); + + // Calculate absolute flux from the mapped surface velocity + phic = mesh.Sf() & Ucf; + + if (mesh.changing() && correctPhi) + { + #include "correctPhic.H" + } + + // Make the flux relative to the mesh motion + fvc::makeRelative(phic, Uc); + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + + continuousPhaseTransport.correct(); + muc = rhoc*continuousPhaseTransport.nu(); + + Info<< "Evolving " << kinematicCloud.name() << endl; + kinematicCloud.evolve(); + + // Update continuous phase volume fraction field + alphac = max(1.0 - kinematicCloud.theta(), alphacMin); + alphac.correctBoundaryConditions(); + alphacf = fvc::interpolate(alphac); + alphaPhic = alphacf*phic; + + fvVectorMatrix cloudSU(kinematicCloud.SU(Uc)); + volVectorField cloudVolSUSu + ( + IOobject + ( + "cloudVolSUSu", + runTime.timeName(), + mesh + ), + mesh, + dimensionedVector + ( + "0", + cloudSU.dimensions()/dimVolume, + Zero + ), + zeroGradientFvPatchVectorField::typeName + ); + + cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V(); + cloudVolSUSu.correctBoundaryConditions(); + cloudSU.source() = Zero; + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UcEqn.H" + + // --- PISO loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + continuousPhaseTurbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/MPPICDyMFoam.C b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/MPPICDyMFoam.C new file mode 100644 index 0000000000..ba5dc1bc85 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/MPPICDyMFoam.C @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ 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 3 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, see . + +Application + MPPICDyMFoam + +Description + Transient solver for the coupled transport of a single kinematic particle + cloud including the effect of the volume fraction of particles on the + continuous phase. Multi-Phase Particle In Cell (MPPIC) modeling is used to + represent collisions without resolving particle-particle interactions, + with optional mesh motion and mesh topology changes. + +\*---------------------------------------------------------------------------*/ + +#define MPPIC + +#include "DPMDyMFoam.C" + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/files b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/files new file mode 100644 index 0000000000..d25393d1ff --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/files @@ -0,0 +1,3 @@ +MPPICDyMFoam.C + +EXE = $(FOAM_APPBIN)/MPPICDyMFoam diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options new file mode 100644 index 0000000000..8b16d20d06 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options @@ -0,0 +1,42 @@ +EXE_INC = \ + -I.. \ + -I../.. \ + -I../DPMTurbulenceModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianTurbulence \ + -lspecie \ + -lradiationModels \ + -lincompressibleTransportModels \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lDPMTurbulenceModels \ + -lregionModels \ + -lsurfaceFilmModels \ + -lsampling \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/files b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/files new file mode 100644 index 0000000000..c3354998ef --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/files @@ -0,0 +1,3 @@ +DPMDyMFoam.C + +EXE = $(FOAM_APPBIN)/DPMDyMFoam diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options new file mode 100644 index 0000000000..a4c0fcc139 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options @@ -0,0 +1,41 @@ +EXE_INC = \ + -I.. \ + -I../DPMTurbulenceModels/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude + +EXE_LIBS = \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianTurbulence \ + -lspecie \ + -lradiationModels \ + -lincompressibleTransportModels \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lDPMTurbulenceModels \ + -lregionModels \ + -lsurfaceFilmModels \ + -lsampling \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/correctPhic.H b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/correctPhic.H new file mode 100644 index 0000000000..46ef721fa2 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/correctPhic.H @@ -0,0 +1,11 @@ +CorrectPhi +( + Uc, + phic, + p, + dimensionedScalar("rAUf", dimTime, 1), + geometricZeroField(), + pimple +); + +#include "continuityErrs.H" diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createControls.H b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createControls.H new file mode 100644 index 0000000000..bee8bd4f39 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createControls.H @@ -0,0 +1,12 @@ +#include "createControl.H" +#include "createTimeControls.H" + +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", false) +); + +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createUcf.H similarity index 69% rename from src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C rename to applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createUcf.H index 62bda3abcb..bdd9898b69 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/IMULES.C +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/createUcf.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -21,34 +21,29 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -\*---------------------------------------------------------------------------*/ +Global + createUcf -#include "IMULES.H" -#include "profiling.H" +Description + Creates and initialises the velocity velocity field Ucf. + +\*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void Foam::MULES::implicitSolve +Info<< "Reading/calculating continuous phase face velocity Ucf\n" << endl; + +surfaceVectorField Ucf ( - volScalarField& psi, - const surfaceScalarField& phi, - surfaceScalarField& phiPsi, - const scalar psiMax, - const scalar psiMin -) -{ - addProfiling(solve, "MULES::implicitSolve"); - - implicitSolve + IOobject ( - geometricOneField(), - psi, - phi, - phiPsi, - zeroField(), zeroField(), - psiMax, psiMin - ); -} - + "Ucf", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvc::interpolate(Uc) +); // ************************************************************************* // diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/pEqn.H b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/pEqn.H new file mode 100644 index 0000000000..dd4d382bef --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/pEqn.H @@ -0,0 +1,62 @@ +{ + volVectorField HbyA(constrainHbyA(rAUc*UcEqn.H(), Uc, p)); + + surfaceScalarField phiHbyA + ( + "phiHbyA", + ( + fvc::flux(HbyA) + + alphacf*rAUcf*fvc::ddtCorr(Uc, Ucf) + ) + ); + + if (p.needReference()) + { + fvc::makeRelative(phiHbyA, Uc); + adjustPhi(phiHbyA, Uc, p); + fvc::makeAbsolute(phiHbyA, Uc); + } + + phiHbyA += phicForces; + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, Uc, phiHbyA, rAUcf); + + // Non-orthogonal pressure corrector loop + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::laplacian(alphacf*rAUcf, p) + == + fvc::ddt(alphac) + fvc::div(alphacf*phiHbyA) + ); + + pEqn.setReference(pRefCell, pRefValue); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phic = phiHbyA - pEqn.flux()/alphacf; + + p.relax(); + + Uc = HbyA + + rAUc + *fvc::reconstruct((phicForces - pEqn.flux()/alphacf)/rAUcf); + Uc.correctBoundaryConditions(); + + { + Ucf = fvc::interpolate(Uc); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Ucf += n*(phic/mesh.magSf() - (n & Ucf)); + } + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phic, Uc); + } + } +} + +#include "continuityErrs.H" diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/readControls.H b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/readControls.H new file mode 100644 index 0000000000..9f982e260b --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/readControls.H @@ -0,0 +1,5 @@ +#include "readTimeControls.H" + +correctPhi = pimple.dict().lookupOrDefault("correctPhi", false); + +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options index aed6969724..b0eaf6453e 100644 --- a/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options @@ -25,7 +25,6 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lthermophysicalFunctions \ -lspecie \ -lradiationModels \ -lincompressibleTransportModels \ diff --git a/applications/solvers/lagrangian/DPMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/Make/options index 8ab44318e6..b1f295e294 100644 --- a/applications/solvers/lagrangian/DPMFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/Make/options @@ -21,7 +21,6 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lthermophysicalFunctions \ -lspecie \ -lradiationModels \ -lincompressibleTransportModels \ diff --git a/applications/solvers/lagrangian/DPMFoam/pEqn.H b/applications/solvers/lagrangian/DPMFoam/pEqn.H index 9e46551122..ea0bd1c101 100644 --- a/applications/solvers/lagrangian/DPMFoam/pEqn.H +++ b/applications/solvers/lagrangian/DPMFoam/pEqn.H @@ -1,6 +1,5 @@ { - volVectorField HbyA("HbyA", Uc); - HbyA = rAUc*UcEqn.H(); + volVectorField HbyA(constrainHbyA(rAUc*UcEqn.H(), Uc, p)); surfaceScalarField phiHbyA ( @@ -8,10 +7,16 @@ ( fvc::flux(HbyA) + alphacf*rAUcf*fvc::ddtCorr(Uc, phic) - + phicForces ) ); + if (p.needReference()) + { + adjustPhi(phiHbyA, Uc, p); + } + + phiHbyA += phicForces; + // Update the pressure BCs to ensure flux consistency constrainPressure(p, Uc, phiHbyA, rAUcf); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H index 8d32932607..6f1ad9041b 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H @@ -18,10 +18,10 @@ - fvm::laplacian(turbulence->alphaEff(), he) == rho*(U&g) - + combustion->Sh() + + Qdot + coalParcels.Sh(he) + limestoneParcels.Sh(he) - + radiation->Sh(thermo) + + radiation->Sh(thermo, he) + fvOptions(rho, he) ); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index 9c23effa57..7e4d2dccfc 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -10,10 +10,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -38,11 +35,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H index 4edbce9b42..49e3f70d89 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H @@ -12,7 +12,7 @@ tmp> mvConvection { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index d3daf7265c..4e4f45e721 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -131,18 +131,18 @@ volScalarField dpdt Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H index 7e2ed6074d..c31ad040a1 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H @@ -80,7 +80,7 @@ License ( (coalParcels.hsTrans() + limestoneParcels.hsTrans()) /(mesh.V()*runTime.deltaT()) - + combustion->Sh()() + + Qdot ) /( alphaTemp diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options index 0004a128e4..aebc4519bb 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options @@ -19,7 +19,6 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lthermophysicalFunctions \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options index 4f94e7f64f..76fa725a3a 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options @@ -23,7 +23,6 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lthermophysicalFunctions \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H index 4c2d95da9d..4d112da030 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H @@ -20,8 +20,8 @@ rho*(U&g) + parcels.Sh(he) + surfaceFilm.Sh() - + radiation->Sh(thermo) - + combustion->Sh() + + radiation->Sh(thermo, he) + + Qdot + fvOptions(rho, he) ); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index 014cd4e356..eab72a2389 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -9,10 +9,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -36,9 +33,6 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H index 555b5bc0bc..eb24899013 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H @@ -12,7 +12,7 @@ tmp> mvConvection { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H index 8ec3c94169..0159cdba15 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H @@ -134,18 +134,18 @@ Switch solvePrimaryRegion additionalControlsDict.lookup("solvePrimaryRegion") ); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H index 194e03c59d..42185b8afb 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H @@ -19,8 +19,8 @@ == rho*(U&g) + parcels.Sh(he) - + radiation->Sh(thermo) - + combustion->Sh() + + radiation->Sh(thermo, he) + + Qdot + fvOptions(rho, he) ); @@ -35,6 +35,6 @@ thermo.correct(); radiation->correct(); - Info<< "T gas min/max = " << min(T).value() << ", " + Info<< "T gas min/max " << min(T).value() << ", " << max(T).value() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index f39888db2f..8038347006 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -11,10 +11,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -39,11 +36,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H index db6628936c..60a27fec85 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H @@ -11,7 +11,7 @@ tmp> mvConvection { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index e5ed566eba..2da47d4ced 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -121,18 +121,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H index 63398fb001..28bc211e05 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H @@ -79,7 +79,7 @@ License mag ( parcels.hsTrans()/(mesh.V()*runTime.deltaT()) - + combustion->Sh()() + + Qdot ) /( alphaTemp diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H index 8239d44621..c8baf6beab 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H @@ -13,8 +13,8 @@ == rho*(U&g) + parcels.Sh(he) - + radiation->Sh(thermo) - + combustion->Sh() + + radiation->Sh(thermo, he) + + Qdot + fvOptions(rho, he) ); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options index f39888db2f..8038347006 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options @@ -11,10 +11,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -39,11 +36,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H index 7c7cf9a4c0..1510f8e391 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H @@ -11,7 +11,7 @@ tmp> mvConvection { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H index 16f297c995..328fc67224 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H @@ -103,18 +103,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C index b3504da91a..bbec4a41ab 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C @@ -38,7 +38,6 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "IOporosityModelList.H" #include "fvOptions.H" #include "SLGThermo.H" #include "simpleControl.H" diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/EEqn.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/EEqn.H index 8239d44621..2741ad3f96 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/EEqn.H @@ -12,9 +12,9 @@ - fvm::laplacian(turbulence->alphaEff(), he) == rho*(U&g) + + Qdot + parcels.Sh(he) - + radiation->Sh(thermo) - + combustion->Sh() + + radiation->Sh(thermo, he) + fvOptions(rho, he) ); @@ -25,6 +25,7 @@ EEqn.solve(); fvOptions.correct(he); + thermo.correct(); radiation->correct(); diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options b/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options index d88ca09eae..433d27ec07 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options @@ -10,10 +10,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -37,11 +34,6 @@ EXE_LIBS = \ -llagrangianTurbulence \ -lspecie \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/YEqn.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/YEqn.H index 7c7cf9a4c0..1510f8e391 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/YEqn.H @@ -11,7 +11,7 @@ tmp> mvConvection { combustion->correct(); - dQ = combustion->dQ(); + Qdot = combustion->Qdot(); volScalarField Yt(0.0*Y[0]); forAll(Y, i) diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H index 16f297c995..ae5129fbc2 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/createFields.H @@ -103,18 +103,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options index 35233e06cb..75f471f270 100644 --- a/applications/solvers/lagrangian/sprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -13,10 +13,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -37,11 +34,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/sprayFoam/createFields.H b/applications/solvers/lagrangian/sprayFoam/createFields.H index 91b7bc2b6d..e2124b3685 100644 --- a/applications/solvers/lagrangian/sprayFoam/createFields.H +++ b/applications/solvers/lagrangian/sprayFoam/createFields.H @@ -117,18 +117,18 @@ forAll(Y, i) } fields.add(thermo.he()); -volScalarField dQ +volScalarField Qdot ( IOobject ( - "dQ", + "Qdot", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ); #include "createMRF.H" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options index 75d59e0933..f6f65d7c6c 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options @@ -14,10 +14,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -41,11 +38,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C index 666932b2f0..16d2d524c5 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) if (runTime.write()) { - combustion->dQ()().write(); + combustion->Qdot()().write(); } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options index 86c7ad23f2..fe32be8cfe 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options @@ -15,10 +15,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -44,11 +41,7 @@ EXE_LIBS = \ -lspecie \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ - -lliquidProperties \ - -lliquidMixtureProperties \ - -lsolidProperties \ - -lsolidMixtureProperties \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C index 8509ecaf53..21646fed97 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) if (runTime.write()) { - combustion->dQ()().write(); + combustion->Qdot()().write(); } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C index 86e8371bf2..a4eaaeaad5 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -78,32 +78,42 @@ int main(int argc, char *argv[]) parcels.evolve(); - #include "rhoEqn.H" - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) + if (pimple.solveFlow()) { - #include "UEqn.H" - #include "YEqn.H" - #include "EEqn.H" + #include "rhoEqn.H" - // --- Pressure corrector loop - while (pimple.correct()) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { - #include "pEqn.H" + #include "UEqn.H" + #include "YEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } } - if (pimple.turbCorr()) + rho = thermo.rho(); + + if (runTime.write()) { - turbulence->correct(); + combustion->Qdot()().write(); } } - - rho = thermo.rho(); - - if (runTime.write()) + else { - combustion->dQ()().write(); + if (runTime.writeTime()) + { + parcels.write(); + } } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options index f9056dd790..639909b38e 100644 --- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options @@ -17,7 +17,6 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lthermophysicalFunctions \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C b/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C index d2cab50bee..62b6b0e186 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C +++ b/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C @@ -38,6 +38,9 @@ Description #include "fvCFD.H" #include "CMULES.H" +#include "EulerDdtScheme.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "subCycle.H" #include "immiscibleIncompressibleTwoPhaseMixture.H" @@ -45,7 +48,7 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" +#include "fvcSmooth.H" #include "basicKinematicMPPICCloud.H" @@ -59,16 +62,22 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createControl.H" + #include "createTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" - #include "createTimeControls.H" #include "correctPhi.H" - #include "CourantNo.H" - #include "setInitialDeltaT.H" turbulence->validate(); + if (!LTS) + { + #include "readTimeControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -76,9 +85,17 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "CourantNo.H" - #include "alphaCourantNo.H" - #include "setDeltaT.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "CourantNo.H" + #include "alphaCourantNo.H" + #include "setDeltaT.H" + } runTime++; @@ -133,6 +150,8 @@ int main(int argc, char *argv[]) #include "alphaControls.H" #include "alphaEqnSubCycle.H" + mixture.correct(); + #include "UEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/MPPICInterFoam/Make/options b/applications/solvers/multiphase/MPPICInterFoam/Make/options index e298ad1f59..abc0537451 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/Make/options +++ b/applications/solvers/multiphase/MPPICInterFoam/Make/options @@ -4,6 +4,7 @@ EXE_INC = \ -I. \ -I./IncompressibleTwoPhaseMixtureTurbulenceModels/lnInclude \ -I$(interFoamPath) \ + -I../VoF \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ @@ -31,7 +32,7 @@ EXE_LIBS = \ -lmeshTools \ -llagrangian \ -llagrangianIntermediate \ - -lthermophysicalFunctions \ + -lthermophysicalProperties \ -lspecie \ -lincompressibleTransportModels \ -limmiscibleIncompressibleTwoPhaseMixture \ diff --git a/applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H b/applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H deleted file mode 100644 index 97d1428638..0000000000 --- a/applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H +++ /dev/null @@ -1,164 +0,0 @@ -{ - word alphaScheme("div(phi,alpha)"); - word alpharScheme("div(phirb,alpha)"); - - // Standard face-flux compression coefficient - surfaceScalarField phic - ( - mixture.cAlpha()*mag(alphaPhic/mesh.magSf()) - ); - - // Add the optional isotropic compression contribution - if (icAlpha > 0) - { - phic *= (1.0 - icAlpha); - phic += (mixture.cAlpha()*icAlpha)*fvc::interpolate(mag(U)); - } - - // Do not compress interface at non-coupled boundary faces - // (inlets, outlets etc.) - surfaceScalarField::Boundary& phicBf = phic.boundaryFieldRef(); - forAll(phic.boundaryField(), patchi) - { - fvsPatchScalarField& phicp = phicBf[patchi]; - - if (!phicp.coupled()) - { - phicp == 0; - } - } - - tmp tphiAlpha; - - if (MULESCorr) - { - fvScalarMatrix alpha1Eqn - ( - fv::EulerDdtScheme(mesh).fvmDdt(alphac, alpha1) - + fv::gaussConvectionScheme - ( - mesh, - alphaPhic, - upwind(mesh, alphaPhic) - ).fvmDiv(alphaPhic, alpha1) - - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), alpha1) - ); - - alpha1Eqn.solve(); - - Info<< "Phase-1 volume fraction = " - << alpha1.weightedAverage(mesh.Vsc()).value() - << " Min(alpha1) = " << min(alpha1).value() - << " Max(alpha1) = " << max(alpha1).value() - << endl; - - tmp tphiAlphaUD(alpha1Eqn.flux()); - alphaPhi = tphiAlphaUD(); - - if (alphaApplyPrevCorr && tphiAlphaCorr0.valid()) - { - Info<< "Applying the previous iteration compression flux" << endl; - - MULES::correct - ( - alphac, - alpha1, - alphaPhi, - tphiAlphaCorr0.ref(), - zeroField(), zeroField(), - 1, 0 - ); - - alphaPhi += tphiAlphaCorr0(); - } - - // Cache the upwind-flux - tphiAlphaCorr0 = tphiAlphaUD; - - alpha2 = 1.0 - alpha1; - - mixture.correct(); - } - - for (int aCorr=0; aCorr tphiAlphaUn - ( - fvc::flux - ( - alphaPhic, - alpha1, - alphaScheme - ) - + fvc::flux - ( - -fvc::flux(-phir, alpha2, alpharScheme), - alpha1, - alpharScheme - ) - ); - - if (MULESCorr) - { - tmp tphiAlphaCorr(tphiAlphaUn() - alphaPhi); - volScalarField alpha10("alpha10", alpha1); - - //MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); - - MULES::correct - ( - alphac, - alpha1, - tphiAlphaUn(), - tphiAlphaCorr.ref(), - zeroField(), zeroField(), - 1, 0 - ); - - // Under-relax the correction for all but the 1st corrector - if (aCorr == 0) - { - alphaPhi += tphiAlphaCorr(); - } - else - { - alpha1 = 0.5*alpha1 + 0.5*alpha10; - alphaPhi += 0.5*tphiAlphaCorr(); - } - } - else - { - alphaPhi = tphiAlphaUn; - - MULES::explicitSolve - ( - alphac, - alpha1, - alphaPhic, - alphaPhi, - zeroField(), zeroField(), - 1, 0 - ); - - } - - alpha2 = 1.0 - alpha1; - - mixture.correct(); - } - - rhoPhi = alphaPhi*(rho1 - rho2) + alphaPhic*rho2; - - if (alphaApplyPrevCorr && MULESCorr) - { - tphiAlphaCorr0 = alphaPhi - tphiAlphaCorr0; - } - - Info<< "Phase-1 volume fraction = " - << alpha1.weightedAverage(mesh.Vsc()).value() - << " Min(alpha1) = " << min(alpha1).value() - << " Max(alpha1) = " << max(alpha1).value() - << endl; -} diff --git a/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H deleted file mode 100644 index c0d3c8e43a..0000000000 --- a/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H +++ /dev/null @@ -1,34 +0,0 @@ -if (nAlphaSubCycles > 1) -{ - dimensionedScalar totalDeltaT = runTime.deltaT(); - surfaceScalarField rhoPhiSum - ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("0", rhoPhi.dimensions(), 0) - ); - - for - ( - subCycle alphaSubCycle(alpha1, nAlphaSubCycles); - !(++alphaSubCycle).end(); - ) - { - #include "alphaEqn.H" - rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; - } - - rhoPhi = rhoPhiSum; -} -else -{ - #include "alphaEqn.H" -} - -rho == alpha1*rho1 + alpha2*rho2; -mu = mixture.mu(); diff --git a/applications/solvers/multiphase/MPPICInterFoam/createFields.H b/applications/solvers/multiphase/MPPICInterFoam/createFields.H index de8ae559cc..bcf4252b5b 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/createFields.H +++ b/applications/solvers/multiphase/MPPICInterFoam/createFields.H @@ -1,221 +1,204 @@ - Info<< "Reading field p_rgh\n" << endl; - volScalarField p_rgh +#include "createRDeltaT.H" + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "createPhi.H" - - Info<< "Reading transportProperties\n" << endl; - immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); - - volScalarField& alpha1(mixture.alpha1()); - volScalarField& alpha2(mixture.alpha2()); - - const dimensionedScalar& rho1 = mixture.rho1(); - const dimensionedScalar& rho2 = mixture.rho2(); - - // Need to store rho for ddt(rho, U) - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - alpha1*rho1 + alpha2*rho2 - ); - rho.oldTime(); - - // Need to store mu as incompressibleTwoPhaseMixture does not store it - volScalarField mu - ( - IOobject - ( - "mu", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT - ), - mixture.mu(), - calculatedFvPatchScalarField::typeName - ); - - - // Mass flux - surfaceScalarField rhoPhi - ( - IOobject - ( - "rhoPhi", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - fvc::interpolate(rho)*phi - ); - - - #include "readGravitationalAcceleration.H" - - #include "readhRef.H" - #include "gh.H" - - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - p_rgh + rho*gh - ); - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell - ( - p, - p_rgh, - mesh.solutionDict().subDict("PIMPLE"), - pRefCell, - pRefValue - ); - - if (p_rgh.needReference()) - { - p += dimensionedScalar - ( - "p", - p.dimensions(), - pRefValue - getRefCellValue(p, pRefCell) - ); - p_rgh = p - rho*gh; - } - - mesh.setFluxRequired(p_rgh.name()); - mesh.setFluxRequired(alpha1.name()); - - // MULES flux from previous time-step - surfaceScalarField alphaPhi - ( - IOobject - ( - "alphaPhi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - phi*fvc::interpolate(alpha1) - ); - - - tmp tphiAlphaCorr0; - - // alphac must be constructed before the cloud - // so that the drag-models can find it - volScalarField alphac - ( - IOobject - ( - "alphac", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), + "p_rgh", + runTime.timeName(), mesh, - dimensionedScalar("0", dimless, 0), - zeroGradientFvPatchScalarField::typeName - ); - alphac.oldTime(); + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - volScalarField alphacRho(alphac*rho); - alphacRho.oldTime(); - - Info<< "Constructing kinematicCloud " << endl; - basicKinematicMPPICCloud kinematicCloud +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - "kinematicCloud", + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + +Info<< "Reading transportProperties\n" << endl; +immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); + +volScalarField& alpha1(mixture.alpha1()); +volScalarField& alpha2(mixture.alpha2()); + +const dimensionedScalar& rho1 = mixture.rho1(); +const dimensionedScalar& rho2 = mixture.rho2(); + +// Need to store rho for ddt(rho, U) +volScalarField rho +( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + alpha1*rho1 + alpha2*rho2 +); +rho.oldTime(); + +// Need to store mu as incompressibleTwoPhaseMixture does not store it +volScalarField mu +( + IOobject + ( + "mu", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT + ), + mixture.mu(), + calculatedFvPatchScalarField::typeName +); + + +// Mass flux +surfaceScalarField rhoPhi +( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + fvc::interpolate(rho)*phi +); + +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" + +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + p_rgh + rho*gh +); + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell +( + p, + p_rgh, + mesh.solutionDict().subDict("PIMPLE"), + pRefCell, + pRefValue +); + +if (p_rgh.needReference()) +{ + p += dimensionedScalar + ( + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) + ); + p_rgh = p - rho*gh; +} + +mesh.setFluxRequired(p_rgh.name()); +mesh.setFluxRequired(alpha1.name()); + +// alphac must be constructed before the cloud +// so that the drag-models can find it +volScalarField alphac +( + IOobject + ( + "alphac", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0), + zeroGradientFvPatchScalarField::typeName +); +alphac.oldTime(); + +volScalarField alphacRho(alphac*rho); +alphacRho.oldTime(); + +Info<< "Constructing kinematicCloud " << endl; +basicKinematicMPPICCloud kinematicCloud +( + "kinematicCloud", + rho, + U, + mu, + g +); + +// Particle fraction upper limit +scalar alphacMin +( + 1.0 + - readScalar + ( + kinematicCloud.particleProperties().subDict("constantProperties") + .lookup("alphaMax") + ) +); + +// Update alphac from the particle locations +alphac = max(1.0 - kinematicCloud.theta(), alphacMin); +alphac.correctBoundaryConditions(); + +surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac)); + +// Phase mass flux +surfaceScalarField alphaRhoPhic("alphaRhoPhic", alphacf*rhoPhi); + +// Volumetric phase flux +surfaceScalarField alphaPhic("alphaPhic", alphacf*phi); + +autoPtr +< + PhaseCompressibleTurbulenceModel + < + immiscibleIncompressibleTwoPhaseMixture + > +>turbulence +( + PhaseCompressibleTurbulenceModel + < + immiscibleIncompressibleTwoPhaseMixture + >::New + ( + alphac, rho, U, - mu, - g - ); + alphaRhoPhic, + rhoPhi, + mixture + ) +); - // Particle fraction upper limit - scalar alphacMin - ( - 1.0 - - readScalar - ( - kinematicCloud.particleProperties().subDict("constantProperties") - .lookup("alphaMax") - ) - ); - - // Update alphac from the particle locations - alphac = max(1.0 - kinematicCloud.theta(), alphacMin); - alphac.correctBoundaryConditions(); - - surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac)); - - // Phase mass flux - surfaceScalarField alphaRhoPhic("alphaRhoPhic", alphacf*rhoPhi); - - // Volumetric phase flux - surfaceScalarField alphaPhic("alphaPhic", alphacf*phi); - - autoPtr - < - PhaseCompressibleTurbulenceModel - < - immiscibleIncompressibleTwoPhaseMixture - > - >turbulence - ( - PhaseCompressibleTurbulenceModel - < - immiscibleIncompressibleTwoPhaseMixture - >::New - ( - alphac, - rho, - U, - alphaRhoPhic, - rhoPhi, - mixture - ) - ); - - #include "createMRF.H" +#include "createMRF.H" diff --git a/applications/solvers/multiphase/interFoam/alphaCourantNo.H b/applications/solvers/multiphase/VoF/alphaCourantNo.H similarity index 96% rename from applications/solvers/multiphase/interFoam/alphaCourantNo.H rename to applications/solvers/multiphase/VoF/alphaCourantNo.H index a084155c8a..24f6e48a22 100644 --- a/applications/solvers/multiphase/interFoam/alphaCourantNo.H +++ b/applications/solvers/multiphase/VoF/alphaCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/VoF/alphaEqn.H similarity index 59% rename from applications/solvers/multiphase/interFoam/alphaEqn.H rename to applications/solvers/multiphase/VoF/alphaEqn.H index 20bb4fa240..abae00fb38 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/VoF/alphaEqn.H @@ -2,46 +2,57 @@ word alphaScheme("div(phi,alpha)"); word alpharScheme("div(phirb,alpha)"); - tmp> ddtAlpha - ( - fv::ddtScheme::New - ( - mesh, - mesh.ddtScheme("ddt(alpha)") - ) - ); - // Set the off-centering coefficient according to ddt scheme scalar ocCoeff = 0; - if - ( - isType>(ddtAlpha()) - || isType>(ddtAlpha()) - ) { - ocCoeff = 0; - } - else if (isType>(ddtAlpha())) - { - if (nAlphaSubCycles > 1) + tmp> tddtAlpha + ( + fv::ddtScheme::New + ( + mesh, + mesh.ddtScheme("ddt(alpha)") + ) + ); + const fv::ddtScheme& ddtAlpha = tddtAlpha(); + + if + ( + isType>(ddtAlpha) + || isType>(ddtAlpha) + ) + { + ocCoeff = 0; + } + else if (isType>(ddtAlpha)) + { + if (nAlphaSubCycles > 1) + { + FatalErrorInFunction + << "Sub-cycling is not supported " + "with the CrankNicolson ddt scheme" + << exit(FatalError); + } + + if + ( + alphaRestart + || mesh.time().timeIndex() > mesh.time().startTimeIndex() + 1 + ) + { + ocCoeff = + refCast>(ddtAlpha) + .ocCoeff(); + } + } + else { FatalErrorInFunction - << "Sub-cycling is not supported " - "with the CrankNicolson ddt scheme" + << "Only Euler and CrankNicolson ddt schemes are supported" << exit(FatalError); } - - ocCoeff = - refCast>(ddtAlpha()) - .ocCoeff(); - } - else - { - FatalErrorInFunction - << "Only Euler and CrankNicolson ddt schemes are supported" - << exit(FatalError); } + // Set the time blending factor, 1 for Euler scalar cnCoeff = 1.0/(1.0 + ocCoeff); // Standard face-flux compression coefficient @@ -79,6 +90,8 @@ if (MULESCorr) { + #include "alphaSuSp.H" + fvScalarMatrix alpha1Eqn ( ( @@ -92,6 +105,8 @@ phiCN, upwind(mesh, phiCN) ).fvmDiv(phiCN, alpha1) + == + Su + fvm::Sp(Sp + divU, alpha1) ); alpha1Eqn.solve(); @@ -124,37 +139,42 @@ for (int aCorr=0; aCorr talphaPhiUn + ( + fvc::flux ( - fvc::flux - ( - phi, - alpha1, - alphaScheme - ) - + fvc::flux - ( - -fvc::flux(-phir, alpha2, alpharScheme), - alpha1, - alpharScheme - ) - ); - - // Calculate the Crank-Nicolson off-centred alpha flux - if (ocCoeff > 0) - { - alphaPhiUn = - cnCoeff*alphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime(); - } + phiCN(), + cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime(), + alphaScheme + ) + + fvc::flux + ( + -fvc::flux(-phir, alpha2, alpharScheme), + alpha1, + alpharScheme + ) + ); if (MULESCorr) { - tmp talphaPhiCorr(alphaPhiUn - alphaPhi); + tmp talphaPhiCorr(talphaPhiUn() - alphaPhi); volScalarField alpha10("alpha10", alpha1); - MULES::correct(alpha1, alphaPhiUn, talphaPhiCorr.ref(), 1, 0); + MULES::correct + ( + geometricOneField(), + alpha1, + talphaPhiUn(), + talphaPhiCorr.ref(), + Sp, + (-Sp*alpha1)(), + 1, + 0 + ); // Under-relax the correction for all but the 1st corrector if (aCorr == 0) @@ -169,9 +189,19 @@ } else { - alphaPhi = alphaPhiUn; + alphaPhi = talphaPhiUn; - MULES::explicitSolve(alpha1, phiCN, alphaPhi, 1, 0); + MULES::explicitSolve + ( + geometricOneField(), + alpha1, + phiCN, + alphaPhi, + Sp, + (Su + divU*min(alpha1(), scalar(1)))(), + 1, + 0 + ); } alpha2 = 1.0 - alpha1; @@ -182,6 +212,11 @@ if (alphaApplyPrevCorr && MULESCorr) { talphaPhiCorr0 = alphaPhi - talphaPhiCorr0; + talphaPhiCorr0.ref().rename("alphaPhiCorr0"); + } + else + { + talphaPhiCorr0.clear(); } if @@ -190,7 +225,8 @@ == fv::EulerDdtScheme::typeName ) { - rhoPhi = alphaPhi*(rho1 - rho2) + phiCN*rho2; + #include "rhofs.H" + rhoPhi = alphaPhi*(rho1f - rho2f) + phiCN*rho2f; } else { @@ -201,7 +237,8 @@ } // Calculate the end-of-time-step mass flux - rhoPhi = alphaPhi*(rho1 - rho2) + phi*rho2; + #include "rhofs.H" + rhoPhi = alphaPhi*(rho1f - rho2f) + phi*rho2f; } Info<< "Phase-1 volume fraction = " diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/VoF/alphaEqnSubCycle.H similarity index 100% rename from applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H rename to applications/solvers/multiphase/VoF/alphaEqnSubCycle.H diff --git a/applications/solvers/multiphase/VoF/createAlphaFluxes.H b/applications/solvers/multiphase/VoF/createAlphaFluxes.H new file mode 100644 index 0000000000..3a697e38d4 --- /dev/null +++ b/applications/solvers/multiphase/VoF/createAlphaFluxes.H @@ -0,0 +1,20 @@ +IOobject alphaPhiHeader +( + "alphaPhi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE +); + +const bool alphaRestart = alphaPhiHeader.typeHeaderOk(true); + +// MULES flux from previous time-step +surfaceScalarField alphaPhi +( + alphaPhiHeader, + phi*fvc::interpolate(alpha1) +); + +// MULES Correction +tmp talphaPhiCorr0; diff --git a/applications/solvers/multiphase/interFoam/setDeltaT.H b/applications/solvers/multiphase/VoF/setDeltaT.H similarity index 95% rename from applications/solvers/multiphase/interFoam/setDeltaT.H rename to applications/solvers/multiphase/VoF/setDeltaT.H index 9cc860c032..924d24c8ea 100644 --- a/applications/solvers/multiphase/interFoam/setDeltaT.H +++ b/applications/solvers/multiphase/VoF/setDeltaT.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/interFoam/setRDeltaT.H b/applications/solvers/multiphase/VoF/setRDeltaT.H similarity index 100% rename from applications/solvers/multiphase/interFoam/setRDeltaT.H rename to applications/solvers/multiphase/VoF/setRDeltaT.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/multiphase/compressibleInterFoam/Allwclean index deb5e2378b..71bff64a72 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwclean +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwclean @@ -2,6 +2,7 @@ cd ${0%/*} || exit 1 # Run from this directory wclean libso twoPhaseMixtureThermo +wclean libso surfaceTensionModels wclean wclean compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 20da00c472..29bafc3a61 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -5,6 +5,7 @@ cd ${0%/*} || exit 1 # Run from this directory . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments wmake $targetType twoPhaseMixtureThermo +wmake $targetType surfaceTensionModels wmake $targetType wmake $targetType compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index e24e6697f9..29b12f3114 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -I. \ + -I../VoF \ -ItwoPhaseMixtureThermo \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ @@ -11,6 +13,7 @@ EXE_INC = \ EXE_LIBS = \ -ltwoPhaseMixtureThermo \ + -ltwoPhaseSurfaceTension \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H index 460c3c3e91..60dd2aecc8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H @@ -5,19 +5,25 @@ + fvm::div(rhoPhi, T) - fvm::laplacian(mixture.alphaEff(turbulence->mut()), T) + ( - divU*p + fvc::div(fvc::absolute(phi, U), p) + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) ) *( alpha1/mixture.thermo1().Cv() + alpha2/mixture.thermo2().Cv() ) + == + fvOptions(rho, T) ); TEqn.relax(); + + fvOptions.constrain(TEqn); + TEqn.solve(); - mixture.correct(); + fvOptions.correct(T); - Info<< "min(T) " << min(T).value() << endl; + mixture.correctThermo(); + mixture.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H index 44be32aac2..b5e66ec33f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H @@ -1,12 +1,16 @@ fvVectorMatrix UEqn ( - fvm::ddt(rho, U) - + fvm::div(rhoPhi, U) + fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + + MRF.DDt(rho, U) + turbulence->divDevRhoReff(U) + == + fvOptions(rho, U) ); UEqn.relax(); + fvOptions.constrain(UEqn); + if (pimple.momentumPredictor()) { solve @@ -16,12 +20,14 @@ fvc::reconstruct ( ( - interface.surfaceTensionForce() + mixture.surfaceTensionForce() - ghf*fvc::snGrad(rho) - fvc::snGrad(p_rgh) ) * mesh.magSf() ) ); + fvOptions.correct(U); + K = 0.5*magSqr(U); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaControls.H b/applications/solvers/multiphase/compressibleInterFoam/alphaControls.H deleted file mode 100644 index a99a0b39e2..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaControls.H +++ /dev/null @@ -1,5 +0,0 @@ -const dictionary& alphaControls = mesh.solverDict(alpha1.name()); - -label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); - -label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H deleted file mode 100644 index eedf020670..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H +++ /dev/null @@ -1,88 +0,0 @@ -{ - word alphaScheme("div(phi,alpha)"); - word alpharScheme("div(phirb,alpha)"); - - surfaceScalarField phir(phic*interface.nHatf()); - - for (int gCorr=0; gCorr 0.0 && alpha1[celli] > 0.0) - { - Sp[celli] -= dgdt[celli]*alpha1[celli]; - Su[celli] += dgdt[celli]*alpha1[celli]; - } - else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0) - { - Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]); - } - } - - - surfaceScalarField alphaPhi1 - ( - fvc::flux - ( - phi, - alpha1, - alphaScheme - ) - + fvc::flux - ( - -fvc::flux(-phir, alpha2, alpharScheme), - alpha1, - alpharScheme - ) - ); - - MULES::explicitSolve - ( - geometricOneField(), - alpha1, - phi, - alphaPhi1, - Sp, - Su, - 1, - 0 - ); - - surfaceScalarField rho1f(fvc::interpolate(rho1)); - surfaceScalarField rho2f(fvc::interpolate(rho2)); - rhoPhi = alphaPhi1*(rho1f - rho2f) + phi*rho2f; - - alpha2 = scalar(1) - alpha1; - } - - Info<< "Liquid phase volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() - << " Min(" << alpha1.name() << ") = " << min(alpha1).value() - << " Min(" << alpha2.name() << ") = " << min(alpha2).value() - << endl; -} diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H deleted file mode 100644 index 89e5619150..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ /dev/null @@ -1,40 +0,0 @@ -{ - #include "alphaControls.H" - - surfaceScalarField phic(mag(phi/mesh.magSf())); - phic = min(interface.cAlpha()*phic, max(phic)); - - volScalarField divU(fvc::div(fvc::absolute(phi, U))); - - if (nAlphaSubCycles > 1) - { - dimensionedScalar totalDeltaT = runTime.deltaT(); - surfaceScalarField rhoPhiSum - ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar("0", rhoPhi.dimensions(), 0) - ); - - for - ( - subCycle alphaSubCycle(alpha1, nAlphaSubCycles); - !(++alphaSubCycle).end(); - ) - { - #include "alphaEqns.H" - rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; - } - - rhoPhi = rhoPhiSum; - } - else - { - #include "alphaEqns.H" - } -} diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H new file mode 100644 index 0000000000..81309cd091 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H @@ -0,0 +1,43 @@ +volScalarField::Internal Sp +( + IOobject + ( + "Sp", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("Sp", dgdt.dimensions(), 0) +); + +volScalarField::Internal Su +( + IOobject + ( + "Su", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("Su", dgdt.dimensions(), 0) +); + +forAll(dgdt, celli) +{ + if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0) + { + Sp[celli] -= dgdt[celli]*alpha1[celli]; + Su[celli] += dgdt[celli]*alpha1[celli]; + } + else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0) + { + Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]); + } +} + +volScalarField::Internal divU +( + mesh.moving() + ? fvc::div(phiCN() + mesh.phi()) + : fvc::div(phiCN()) +); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H new file mode 100644 index 0000000000..f8d0a15836 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H @@ -0,0 +1,3 @@ +{ + #include "alphaEqnSubCycle.H" +} diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options index cc7d5a2832..4de8fd2713 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ + -I. \ -I.. \ + -I../../VoF \ -I../twoPhaseMixtureThermo \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ @@ -14,6 +16,7 @@ EXE_INC = \ EXE_LIBS = \ -ltwoPhaseMixtureThermo \ + -ltwoPhaseSurfaceTension \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index e30881ac43..34e8762709 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,9 +24,6 @@ License Application compressibleInterDyMFoam -Group - grpMultiphaseSolvers grpMovingMeshSolvers - Description Solver for 2 compressible, non-isothermal immiscible fluids using a VOF (volume of fluid) phase-fraction based interface capturing approach, @@ -42,14 +39,18 @@ Description #include "fvCFD.H" #include "dynamicFvMesh.H" -#include "MULES.H" +#include "CMULES.H" +#include "EulerDdtScheme.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "subCycle.H" -#include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "twoPhaseMixtureThermo.H" #include "turbulentFluidThermoModel.H" #include "pimpleControl.H" +#include "fvOptions.H" #include "CorrectPhi.H" +#include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,6 +64,8 @@ int main(int argc, char *argv[]) #include "initContinuityErrs.H" #include "createControl.H" #include "createFields.H" + #include "createAlphaFluxes.H" + #include "createFvOptions.H" #include "createUf.H" #include "createControls.H" #include "CourantNo.H" @@ -87,63 +90,66 @@ int main(int argc, char *argv[]) // same divergence volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U))); + if (LTS) + { + #include "setRDeltaT.H" + } + else { #include "CourantNo.H" + #include "alphaCourantNo.H" #include "setDeltaT.H" - - runTime++; - - Info<< "Time = " << runTime.timeName() << nl << endl; - - scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - - // Do any mesh changes - mesh.update(); - - if (mesh.changing()) - { - Info<< "Execution time for mesh.update() = " - << runTime.elapsedCpuTime() - timeBeforeMeshUpdate - << " s" << endl; - - gh = (g & mesh.C()) - ghRef; - ghf = (g & mesh.Cf()) - ghRef; - } - - if ((correctPhi && mesh.changing()) || mesh.topoChanging()) - { - // Calculate absolute flux from the mapped surface velocity - // Note: temporary fix until mapped Uf is assessed - Uf = fvc::interpolate(U); - - // Calculate absolute flux from the mapped surface velocity - phi = mesh.Sf() & Uf; - - #include "correctPhi.H" - - // Make the fluxes relative to the mesh motion - fvc::makeRelative(phi, U); - } } - if (mesh.changing() && checkMeshCourantNo) - { - #include "meshCourantNo.H" - } + runTime++; - turbulence->correct(); + Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - #include "alphaEqnsSubCycle.H" - - // correct interface on first PIMPLE corrector - if (pimple.corr() == 1) + if (pimple.firstIter() || moveMeshOuterCorrectors) { - interface.correct(); + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; + } + + if ((mesh.changing() && correctPhi) || mesh.topoChanging()) + { + // Calculate absolute flux from the mapped surface velocity + // Note: temporary fix until mapped Uf is assessed + Uf = fvc::interpolate(U); + + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + #include "correctPhi.H" + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + + mixture.correct(); + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } } + #include "alphaControls.H" + #include "compressibleAlphaEqnSubCycle.H" + solve(fvm::ddt(rho) + fvc::div(rhoPhi)); #include "UEqn.H" @@ -154,14 +160,13 @@ int main(int argc, char *argv[]) { #include "pEqn.H" } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } } - rho = alpha1*rho1 + alpha2*rho2; - - // Correct p_rgh for consistency with p and the updated densities - p_rgh = p - rho*gh; - p_rgh.correctBoundaryConditions(); - runTime.write(); Info<< "ExecutionTime = " diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/createControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/createControls.H index aed0e76956..f1930cdfc0 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/createControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/createControls.H @@ -9,3 +9,8 @@ bool checkMeshCourantNo ( pimple.dict().lookupOrDefault("checkMeshCourantNo", false) ); + +bool moveMeshOuterCorrectors +( + pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false) +); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H index 5423aee3c1..7cd3875e85 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -8,11 +8,12 @@ fvc::flux(HbyA) + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf) ); + MRF.makeRelative(phiHbyA); surfaceScalarField phig ( ( - interface.surfaceTensionForce() + mixture.surfaceTensionForce() - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf() ); @@ -20,7 +21,7 @@ phiHbyA += phig; // Update the pressure BCs to ensure flux consistency - constrainPressure(p_rgh, U, phiHbyA, rAUf); + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); // Make the fluxes relative to the mesh motion fvc::makeRelative(phiHbyA, U); @@ -92,6 +93,7 @@ U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf); U.correctBoundaryConditions(); + fvOptions.correct(U); } } @@ -118,7 +120,4 @@ ); K = 0.5*magSqr(U); - - Info<< "max(U) " << max(mag(U)).value() << endl; - Info<< "min(p_rgh) " << min(p_rgh).value() << endl; } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H index ed2db49fb4..d82dcecb8a 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H @@ -4,3 +4,6 @@ correctPhi = pimple.dict().lookupOrDefault("correctPhi", true); checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); + +moveMeshOuterCorrectors = + pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 5042da7731..a657caf01e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,14 +39,18 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "MULES.H" +#include "CMULES.H" +#include "EulerDdtScheme.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "subCycle.H" #include "rhoThermo.H" -#include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "twoPhaseMixtureThermo.H" #include "turbulentFluidThermoModel.H" #include "pimpleControl.H" +#include "fvOptions.H" +#include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,8 +64,8 @@ int main(int argc, char *argv[]) #include "createControl.H" #include "createTimeControls.H" #include "createFields.H" - #include "CourantNo.H" - #include "setInitialDeltaT.H" + #include "createAlphaFluxes.H" + #include "createFvOptions.H" volScalarField& p = mixture.p(); volScalarField& T = mixture.T(); @@ -70,6 +74,13 @@ int main(int argc, char *argv[]) turbulence->validate(); + if (!LTS) + { + #include "readTimeControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -77,8 +88,17 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "CourantNo.H" - #include "setDeltaT.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "CourantNo.H" + #include "alphaCourantNo.H" + #include "setDeltaT.H" + } runTime++; @@ -87,18 +107,12 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - #include "alphaEqnsSubCycle.H" - - // correct interface on first PIMPLE corrector - if (pimple.corr() == 1) - { - interface.correct(); - } + #include "alphaControls.H" + #include "alphaEqnSubCycle.H" solve(fvm::ddt(rho) + fvc::div(rhoPhi)); #include "UEqn.H" - volScalarField divU(fvc::div(fvc::absolute(phi, U))); #include "TEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 9a49e504c6..46168e6b87 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -1,3 +1,5 @@ +#include "createRDeltaT.H" + Info<< "Reading field p_rgh\n" << endl; volScalarField p_rgh ( @@ -29,7 +31,7 @@ volVectorField U #include "createPhi.H" Info<< "Constructing twoPhaseMixtureThermo\n" << endl; -twoPhaseMixtureThermo mixture(mesh); +twoPhaseMixtureThermo mixture(U, phi); volScalarField& alpha1(mixture.alpha1()); volScalarField& alpha2(mixture.alpha2()); @@ -61,6 +63,7 @@ dimensionedScalar pMin ); mesh.setFluxRequired(p_rgh.name()); +mesh.setFluxRequired(alpha1.name()); #include "readGravitationalAcceleration.H" @@ -89,9 +92,6 @@ volScalarField dgdt pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001)) ); -// Construct interface from alpha1 distribution -interfaceProperties interface(alpha1, U, mixture); - // Construct compressible turbulence model autoPtr turbulence ( @@ -100,3 +100,5 @@ autoPtr turbulence Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + +#include "createMRF.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 78e46f4664..51c58ba536 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -8,11 +8,12 @@ fvc::flux(HbyA) + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi) ); + MRF.makeRelative(phiHbyA); surfaceScalarField phig ( ( - interface.surfaceTensionForce() + mixture.surfaceTensionForce() - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf() ); @@ -20,7 +21,7 @@ phiHbyA += phig; // Update the pressure BCs to ensure flux consistency - constrainPressure(p_rgh, U, phiHbyA, rAUf); + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); tmp p_rghEqnComp1; tmp p_rghEqnComp2; @@ -98,6 +99,7 @@ U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf); U.correctBoundaryConditions(); + fvOptions.correct(U); } } @@ -112,7 +114,4 @@ p_rgh.correctBoundaryConditions(); K = 0.5*magSqr(U); - - Info<< "max(U) " << max(mag(U)).value() << endl; - Info<< "min(p_rgh) " << min(p_rgh).value() << endl; } diff --git a/applications/solvers/multiphase/compressibleInterFoam/rhofs.H b/applications/solvers/multiphase/compressibleInterFoam/rhofs.H new file mode 100644 index 0000000000..67dc10f378 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/rhofs.H @@ -0,0 +1,2 @@ +surfaceScalarField rho1f(fvc::interpolate(rho1)); +surfaceScalarField rho2f(fvc::interpolate(rho2)); diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files new file mode 100644 index 0000000000..fa34a83824 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files @@ -0,0 +1,3 @@ +liquidProperties/liquidPropertiesSurfaceTension.C + +LIB = $(FOAM_LIBBIN)/libtwoPhaseSurfaceTension diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options new file mode 100644 index 0000000000..0d8cc30e2d --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -linterfaceProperties \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie \ + -lthermophysicalProperties \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C new file mode 100644 index 0000000000..7888ec2347 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "liquidPropertiesSurfaceTension.H" +#include "liquidThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceTensionModels +{ + defineTypeNameAndDebug(liquidProperties, 0); + addToRunTimeSelectionTable + ( + surfaceTensionModel, + liquidProperties, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::liquidProperties::liquidProperties +( + const dictionary& dict, + const fvMesh& mesh +) +: + surfaceTensionModel(mesh), + phaseName_(dict.lookup("phase")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::liquidProperties::~liquidProperties() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::surfaceTensionModels::liquidProperties::sigma() const +{ + const heRhoThermopureMixtureliquidProperties& thermo = + mesh_.lookupObject + ( + IOobject::groupName(basicThermo::dictName, phaseName_) + ); + + const Foam::liquidProperties& liquid = thermo.mixture().properties(); + + tmp tsigma + ( + new volScalarField + ( + IOobject + ( + "sigma", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimSigma + ) + ); + volScalarField& sigma = tsigma.ref(); + + const volScalarField& T = thermo.T(); + const volScalarField& p = thermo.p(); + + volScalarField::Internal& sigmai = sigma; + const volScalarField::Internal& pi = p; + const volScalarField::Internal& Ti = T; + + forAll(sigmai, celli) + { + sigmai[celli] = liquid.sigma(pi[celli], Ti[celli]); + } + + volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); + const volScalarField::Boundary& pBf = p.boundaryField(); + const volScalarField::Boundary& TBf = T.boundaryField(); + + forAll(sigmaBf, patchi) + { + scalarField& sigmaPf = sigmaBf[patchi]; + const scalarField& pPf = pBf[patchi]; + const scalarField& TPf = TBf[patchi]; + + forAll(sigmaPf, facei) + { + sigmaPf[facei] = liquid.sigma(pPf[facei], TPf[facei]); + } + } + + return tsigma; +} + + +bool Foam::surfaceTensionModels::liquidProperties::readDict +( + const dictionary& dict +) +{ + return true; +} + + +bool Foam::surfaceTensionModels::liquidProperties::writeData +( + Ostream& os +) const +{ + if (surfaceTensionModel::writeData(os)) + { + return os.good(); + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H new file mode 100644 index 0000000000..7c1e4940ac --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ 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 3 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, see . + +Class + Foam::surfaceTensionModels::liquidProperties + +Description + Temperature-dependent surface tension model in which the surface tension + function provided by the phase Foam::liquidProperties class is used. + +Usage + \table + Property | Description | Required | Default value + phase | Phase name | yes | + \endtable + + Example of the surface tension specification: + \verbatim + sigma + { + type liquidProperties; + phase water; + } + \endverbatim + +See also + Foam::surfaceTensionModel + +SourceFiles + liquidPropertiesSurfaceTension.C + +\*---------------------------------------------------------------------------*/ + +#ifndef liquidPropertiesSurfaceTension_H +#define liquidPropertiesSurfaceTension_H + +#include "surfaceTensionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace surfaceTensionModels +{ + +/*---------------------------------------------------------------------------*\ + Class liquidProperties Declaration +\*---------------------------------------------------------------------------*/ + +class liquidProperties +: + public surfaceTensionModel +{ + // Private data + + //- Name of the liquid phase + word phaseName_; + + +public: + + //- Runtime type information + TypeName("liquidProperties"); + + + // Constructors + + //- Construct from dictionary and mesh + liquidProperties + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~liquidProperties(); + + + // Member Functions + + //- Surface tension coefficient + virtual tmp sigma() const; + + //- Update surface tension coefficient from given dictionary + virtual bool readDict(const dictionary& dict); + + //- Write in dictionary format + virtual bool writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceTensionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options index ed39dee58b..aca6fad2c2 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ @@ -9,4 +10,5 @@ LIB_LIBS = \ -lfluidThermophysicalModels \ -lspecie \ -ltwoPhaseMixture \ + -linterfaceProperties \ -lfiniteVolume diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index c713498ef6..6274ad1c31 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,11 +40,13 @@ namespace Foam Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo ( - const fvMesh& mesh + const volVectorField& U, + const surfaceScalarField& phi ) : - psiThermo(mesh, word::null), - twoPhaseMixture(mesh, *this), + psiThermo(U.mesh(), word::null), + twoPhaseMixture(U.mesh(), *this), + interfaceProperties(alpha1(), U, *this), thermo1_(nullptr), thermo2_(nullptr) { @@ -58,8 +60,8 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo T2.write(); } - thermo1_ = rhoThermo::New(mesh, phase1Name()); - thermo2_ = rhoThermo::New(mesh, phase2Name()); + thermo1_ = rhoThermo::New(U.mesh(), phase1Name()); + thermo2_ = rhoThermo::New(U.mesh(), phase2Name()); thermo1_->validate(phase1Name(), "e"); thermo2_->validate(phase2Name(), "e"); @@ -76,17 +78,23 @@ Foam::twoPhaseMixtureThermo::~twoPhaseMixtureThermo() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::twoPhaseMixtureThermo::correct() +void Foam::twoPhaseMixtureThermo::correctThermo() { thermo1_->he() = thermo1_->he(p_, T_); thermo1_->correct(); thermo2_->he() = thermo2_->he(p_, T_); thermo2_->correct(); +} + +void Foam::twoPhaseMixtureThermo::correct() +{ psi_ = alpha1()*thermo1_->psi() + alpha2()*thermo2_->psi(); mu_ = alpha1()*thermo1_->mu() + alpha2()*thermo2_->mu(); alpha_ = alpha1()*thermo1_->alpha() + alpha2()*thermo2_->alpha(); + + interfaceProperties::correct(); } @@ -352,4 +360,17 @@ Foam::tmp Foam::twoPhaseMixtureThermo::alphaEff } +bool Foam::twoPhaseMixtureThermo::read() +{ + if (psiThermo::read()) + { + return interfaceProperties::read(); + } + else + { + return false; + } +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index 3cde04bb46..aefdbdee4f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,6 +39,7 @@ SourceFiles #include "rhoThermo.H" #include "psiThermo.H" #include "twoPhaseMixture.H" +#include "interfaceProperties.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,7 +53,8 @@ namespace Foam class twoPhaseMixtureThermo : public psiThermo, - public twoPhaseMixture + public twoPhaseMixture, + public interfaceProperties { // Private data @@ -71,10 +73,11 @@ public: // Constructors - //- Construct from mesh + //- Construct from components twoPhaseMixtureThermo ( - const fvMesh& mesh + const volVectorField& U, + const surfaceScalarField& phi ); @@ -104,7 +107,10 @@ public: return thermo2_(); } - //- Update properties + //- Correct the thermodynamics of each phase + virtual void correctThermo(); + + //- Update mixture properties virtual void correct(); //- Return true if the equation of state is incompressible @@ -279,6 +285,12 @@ public: const scalarField& alphat, const label patchi ) const; + + + // IO + + //- Read base transportProperties dictionary + virtual bool read(); }; diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/Make/options b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/Make/options index f3010e0e57..9df3add9e2 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I. \ + -I../VoF \ -I../interFoam \ -ImultiphaseMixtureThermo/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C index 55175d8d80..627dd41b6f 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -113,6 +113,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo 1e-8/pow(average(mesh_.V()), 1.0/3.0) ) { + rhoPhi_.setOriented(); calcAlphas(); alphas_.write(); correct(); @@ -698,6 +699,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const ); surfaceScalarField& stf = tstf.ref(); + stf.setOriented(); forAllConstIter(PtrDictionary, phases_, phase1) { diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C index 5eb7e0f9ce..c096513474 100644 --- a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::mixtureViscosityModels::plastic::plastic ) : mixtureViscosityModel(name, viscosityProperties, U, phi), - plasticCoeffs_(viscosityProperties.subDict(modelName + "Coeffs")), + plasticCoeffs_(viscosityProperties.optionalSubDict(modelName + "Coeffs")), plasticViscosityCoeff_ ( "coeff", @@ -117,7 +117,7 @@ bool Foam::mixtureViscosityModels::plastic::read { mixtureViscosityModel::read(viscosityProperties); - plasticCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs"); + plasticCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs"); plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_; plasticCoeffs_.lookup("n") >> plasticViscosityExponent_; diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C index c671c223db..cf8abd2e6e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -126,7 +126,7 @@ Foam::autoPtr Foam::relativeVelocityModel::New ( cstrIter() ( - dict.subDict(modelType + "Coeffs"), + dict.optionalSubDict(modelType + "Coeffs"), mixture ) ); diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index 21e9667b83..55f8a8df38 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I../VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ diff --git a/applications/solvers/multiphase/interFoam/alphaSuSp.H b/applications/solvers/multiphase/interFoam/alphaSuSp.H new file mode 100644 index 0000000000..0b8e05e187 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/alphaSuSp.H @@ -0,0 +1,3 @@ +zeroField Su; +zeroField Sp; +zeroField divU; diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index f820cf874f..23bdacf6b2 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -121,20 +121,6 @@ if (p_rgh.needReference()) mesh.setFluxRequired(p_rgh.name()); mesh.setFluxRequired(alpha1.name()); -// MULES flux from previous time-step -surfaceScalarField alphaPhi -( - IOobject - ( - "alphaPhi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - phi*fvc::interpolate(alpha1) -); - // MULES compressed flux is registered in case scalarTransport FO needs it. surfaceScalarField alphaPhiUn ( @@ -150,7 +136,4 @@ surfaceScalarField alphaPhiUn dimensionedScalar("zero", phi.dimensions(), 0.0) ); -// MULES Correction -tmp talphaPhiCorr0; - #include "createMRF.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options index 9792cb9b85..7cbe75837c 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I. \ -I.. \ + -I../../VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 3663697976..1dd92f95a1 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "localEulerDdtScheme.H" #include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,6 +63,7 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "createDyMControls.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" volScalarField rAU @@ -128,6 +128,13 @@ int main(int argc, char *argv[]) << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << endl; + // Do not apply previous time-step mesh compression flux + // if the mesh topology changed + if (mesh.topoChanging()) + { + talphaPhiCorr0.clear(); + } + gh = (g & mesh.C()) - ghRef; ghf = (g & mesh.Cf()) - ghRef; } diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index 2c7df14ae7..aafc10bcc4 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -28,7 +28,7 @@ phiHbyA += phig; // Update the pressure BCs to ensure flux consistency - constrainPressure(p_rgh, U, phiHbyA, rAUf); + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 5f16dfa18d..858624b2d5 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "localEulerDdtScheme.H" #include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,6 +66,7 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" #include "correctPhi.H" diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options index 3d2ce063a5..840e64390f 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I. \ -I.. \ + -I../../VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -IimmiscibleIncompressibleThreePhaseMixture \ -IincompressibleThreePhaseMixture \ diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqns.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H similarity index 100% rename from applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqns.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqn.H diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H similarity index 93% rename from applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H index 6025b60069..2f117f2cd4 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H @@ -19,7 +19,7 @@ if (nAlphaSubCycles > 1) !(++alphaSubCycle).end(); ) { - #include "alphaEqns.H" + #include "alphaEqn.H" rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; } @@ -27,7 +27,7 @@ if (nAlphaSubCycles > 1) } else { - #include "alphaEqns.H" + #include "alphaEqn.H" } { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H index 5b152b78a7..5d8a42388a 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H @@ -40,7 +40,7 @@ const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); const dimensionedScalar& rho3 = mixture.rho3(); -dimensionedScalar D23(mixture.lookup("D23")); +dimensionedScalar D23("D23", dimViscosity, mixture); // Need to store rho for ddt(rho, U) volScalarField rho diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index aa0e55626e..a2b92de3f9 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) while (pimple.loop()) { #include "alphaControls.H" - #include "alphaEqnsSubCycle.H" + #include "alphaEqnSubCycle.H" mixture.correct(); diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C index dce55234e7..644c3b25a0 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -168,8 +168,8 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties ).lookup("cAlpha") ) ), - sigma12_(mixture.lookup("sigma12")), - sigma13_(mixture.lookup("sigma13")), + sigma12_("sigma12", dimensionSet(1, 0, -2, 0, 0), mixture), + sigma13_("sigma13", dimensionSet(1, 0, -2, 0, 0), mixture), deltaN_ ( diff --git a/applications/solvers/multiphase/interFoam/rhofs.H b/applications/solvers/multiphase/interFoam/rhofs.H new file mode 100644 index 0000000000..5949bf1e0a --- /dev/null +++ b/applications/solvers/multiphase/interFoam/rhofs.H @@ -0,0 +1,2 @@ +const dimensionedScalar& rho1f(rho1); +const dimensionedScalar& rho2f(rho2); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C index a4663ba488..32d3fe4308 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,10 +47,10 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz : phaseChangeTwoPhaseMixture(typeName, U, phi), - UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), - tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), - Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), - Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_), + tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_), + Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_), + Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_), p0_("0", pSat().dimensions(), 0.0), @@ -102,7 +102,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read() { if (phaseChangeTwoPhaseMixture::read()) { - phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C index cfe6b1b008..ade26e86a4 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,10 +47,10 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle : phaseChangeTwoPhaseMixture(typeName, U, phi), - UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), - tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), - Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), - Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_), + tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_), + Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_), + Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_), p0_("0", pSat().dimensions(), 0.0), @@ -97,7 +97,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read() { if (phaseChangeTwoPhaseMixture::read()) { - phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C index 3be86e0f51..07fe4a2331 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,10 +54,10 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer : phaseChangeTwoPhaseMixture(typeName, U, phi), - n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")), - dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")), - Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), - Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + n_("n", dimless/dimVolume, phaseChangeTwoPhaseMixtureCoeffs_), + dNuc_("dNuc", dimLength, phaseChangeTwoPhaseMixtureCoeffs_), + Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_), + Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_), p0_("0", pSat().dimensions(), 0.0) { @@ -151,7 +151,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read() { if (phaseChangeTwoPhaseMixture::read()) { - phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_; phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C index b9a5e69bf8..c4fe701a2f 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture ) : incompressibleTwoPhaseMixture(U, phi), - phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")), + phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")), pSat_("pSat", dimPressure, lookup("pSat")) {} @@ -77,7 +77,7 @@ bool Foam::phaseChangeTwoPhaseMixture::read() { if (incompressibleTwoPhaseMixture::read()) { - phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); lookup("pSat") >> pSat_; return true; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.H index 071820c319..738b7ae570 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.H @@ -22,13 +22,13 @@ License along with OpenFOAM. If not, see . Class - Foam::constant + Foam::diameterModels::constant Description Constant dispersed-phase particle diameter model. SourceFiles - constant.C + constantDiameter.C \*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/diameterModel/newDiameterModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/diameterModel/newDiameterModel.C index 51e7407882..963ad160f7 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/diameterModel/newDiameterModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/diameterModels/diameterModel/newDiameterModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,11 @@ Foam::autoPtr Foam::diameterModel::New << exit(FatalError); } - return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase); + return cstrIter() + ( + dict.optionalSubDict(diameterModelType + "Coeffs"), + phase + ); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index be4def509e..de3084f69f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,11 +64,8 @@ void Foam::multiphaseSystem::solveAlphas() forAllIter(PtrDictionary, phases_, iter) { - phaseModel& phase1 = iter(); - volScalarField& alpha1 = phase1; - - phase1.alphaPhi() = - dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0); + phaseModel& phase = iter(); + volScalarField& alpha1 = phase; alphaPhiCorrs.set ( @@ -79,7 +76,7 @@ void Foam::multiphaseSystem::solveAlphas() fvc::flux ( phi_, - phase1, + phase, "div(phi," + alpha1.name() + ')' ) ) @@ -92,13 +89,13 @@ void Foam::multiphaseSystem::solveAlphas() phaseModel& phase2 = iter2(); volScalarField& alpha2 = phase2; - if (&phase2 == &phase1) continue; + if (&phase2 == &phase) continue; - surfaceScalarField phir(phase1.phi() - phase2.phi()); + surfaceScalarField phir(phase.phi() - phase2.phi()); scalarCoeffSymmTable::const_iterator cAlpha ( - cAlphas_.find(interfacePair(phase1, phase2)) + cAlphas_.find(interfacePair(phase, phase2)) ); if (cAlpha != cAlphas_.end()) @@ -108,7 +105,7 @@ void Foam::multiphaseSystem::solveAlphas() (mag(phi_) + mag(phir))/mesh_.magSf() ); - phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2); + phir += min(cAlpha()*phic, max(phic))*nHatf(phase, phase2); } word phirScheme @@ -119,39 +116,18 @@ void Foam::multiphaseSystem::solveAlphas() alphaPhiCorr += fvc::flux ( -fvc::flux(-phir, phase2, phirScheme), - phase1, + phase, phirScheme ); } - surfaceScalarField::Boundary& alphaPhiCorrBf = - alphaPhiCorr.boundaryFieldRef(); - - // Ensure that the flux at inflow BCs is preserved - forAll(alphaPhiCorrBf, patchi) - { - fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi]; - - if (!alphaPhiCorrp.coupled()) - { - const scalarField& phi1p = phase1.phi().boundaryField()[patchi]; - const scalarField& alpha1p = alpha1.boundaryField()[patchi]; - - forAll(alphaPhiCorrp, facei) - { - if (phi1p[facei] < 0) - { - alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei]; - } - } - } - } + phase.correctInflowOutflow(alphaPhiCorr); MULES::limit ( 1.0/mesh_.time().deltaT().value(), geometricOneField(), - phase1, + phase, phi_, alphaPhiCorr, zeroField(), @@ -182,29 +158,30 @@ void Foam::multiphaseSystem::solveAlphas() forAllIter(PtrDictionary, phases_, iter) { - phaseModel& phase1 = iter(); + phaseModel& phase = iter(); surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; - alphaPhi += upwind(mesh_, phi_).flux(phase1); + alphaPhi += upwind(mesh_, phi_).flux(phase); + phase.correctInflowOutflow(alphaPhi); MULES::explicitSolve ( geometricOneField(), - phase1, + phase, alphaPhi, zeroField(), zeroField() ); - phase1.alphaPhi() += alphaPhi; + phase.alphaPhi() = alphaPhi; - Info<< phase1.name() << " volume fraction, min, max = " - << phase1.weightedAverage(mesh_.V()).value() - << ' ' << min(phase1).value() - << ' ' << max(phase1).value() + Info<< phase.name() << " volume fraction, min, max = " + << phase.weightedAverage(mesh_.V()).value() + << ' ' << min(phase).value() + << ' ' << max(phase).value() << endl; - sumAlpha += phase1; + sumAlpha += phase; phasei++; } @@ -215,6 +192,15 @@ void Foam::multiphaseSystem::solveAlphas() << ' ' << max(sumAlpha).value() << endl; + // Correct the sum of the phase-fractions to avoid 'drift' + volScalarField sumCorr(1.0 - sumAlpha); + forAllIter(PtrDictionary, phases_, iter) + { + phaseModel& phase = iter(); + volScalarField& alpha = phase; + alpha += alpha*sumCorr; + } + calcAlphas(); } @@ -815,6 +801,7 @@ Foam::tmp Foam::multiphaseSystem::surfaceTension ) ) ); + tSurfaceTension.ref().setOriented(); forAllConstIter(PtrDictionary, phases_, iter) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index f8b323346f..224d0345d6 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,6 +113,8 @@ Foam::phaseModel::phaseModel dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0) ) { + alphaPhi_.setOriented(); + const word phiName = IOobject::groupName("phi", name_); IOobject phiHeader @@ -236,6 +238,24 @@ bool Foam::phaseModel::read(const dictionary& phaseDict) } +void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const +{ + surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef(); + const volScalarField::Boundary& alphaBf = boundaryField(); + const surfaceScalarField::Boundary& phiBf = phi().boundaryField(); + + forAll(alphaPhiBf, patchi) + { + fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi]; + + if (!alphaPhip.coupled()) + { + alphaPhip = phiBf[patchi]*alphaBf[patchi]; + } + } +} + + Foam::tmp Foam::phaseModel::d() const { return dPtr_().d(); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H index d1f1157b9a..90e48183ca 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.H @@ -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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -208,6 +208,9 @@ public: return alphaPhi_; } + //- Ensure that the flux at inflow/outflow BCs is preserved + void correctInflowOutflow(surfaceScalarField& alphaPhi) const; + //- Correct the phase properties void correct(); diff --git a/applications/solvers/multiphase/multiphaseInterFoam/Make/options b/applications/solvers/multiphase/multiphaseInterFoam/Make/options index 99850d69be..576e7aa224 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseInterFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I. \ + -I../VoF \ -I../interFoam \ -ImultiphaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/Make/options b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/Make/options index 1a210c20e6..b7d051f1ca 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I.. \ + -I../../VoF \ -I../../interFoam/interDyMFoam \ -I../../interFoam \ -I../multiphaseMixture/lnInclude \ diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 5dd59dead1..b6144051a4 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -128,6 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture 1e-8/pow(average(mesh_.V()), 1.0/3.0) ) { + rhoPhi_.setOriented(); + calcAlphas(); alphas_.write(); } @@ -273,6 +275,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const ); surfaceScalarField& stf = tstf.ref(); + stf.setOriented(); forAllConstIter(PtrDictionary, phases_, iter1) { @@ -681,6 +684,14 @@ void Foam::multiphaseMixture::solveAlphas << ' ' << max(sumAlpha).value() << endl; + // Correct the sum of the phase-fractions to avoid 'drift' + volScalarField sumCorr(1.0 - sumAlpha); + forAllIter(PtrDictionary, phases_, iter) + { + phase& alpha = iter(); + alpha += alpha*sumCorr; + } + calcAlphas(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/Make/options b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/Make/options index 3a5eb7ac71..65db644ba7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/Make/options +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/Make/options @@ -2,10 +2,7 @@ EXE_INC = \ -I../phaseSystems/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C index 435bb7df2a..de32766bc6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,9 +86,7 @@ Foam::interfaceCompositionModels::Saturated::update ( const volScalarField& Tf ) -{ - // do nothing -} +{} template diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/surfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/surfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H index 636dc57293..94daf77027 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/surfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/surfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::constantSurfaceTensionCoefficient + Foam::surfaceTensionModels::constantSurfaceTensionCoefficient Description Constant value surface tension model. diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H index 4ca36a0a96..c5963a3eff 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::constantAspectRatio + Foam::aspectRatioModels::constantAspectRatio Description Constant value aspect ratio model. diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C index 64345bf759..2213f1a725 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -455,6 +455,7 @@ Foam::BlendedInterfacialModel::Ff() const dimensionedScalar("zero", ModelType::dimF*dimArea, 0) ) ); + x.ref().setOriented(); if (model_.valid()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C index b9859eb41d..02969b89cb 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C @@ -347,7 +347,7 @@ Foam::MomentumTransferPhaseSystem::Ff } else { - return tmp + tmp tFf ( new surfaceScalarField ( @@ -364,6 +364,10 @@ Foam::MomentumTransferPhaseSystem::Ff dimensionedScalar("zero", liftModel::dimF*dimArea, 0) ) ); + + tFf.ref().setOriented(); + + return tFf; } } @@ -621,6 +625,8 @@ Foam::MomentumTransferPhaseSystem::setPhiD ) ) ); + + phiDs[phasei].setOriented(); } return phiDs[phasei]; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index b33289a0b7..4335bace8a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -375,6 +375,18 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() volScalarField hef1(phase1.thermo().he(phase1.thermo().p(), Tf)); volScalarField hef2(phase2.thermo().he(phase2.thermo().p(), Tf)); + volScalarField L + ( + min + ( + (pos(iDmdt)*he2 + neg(iDmdt)*hef2) + - (neg(iDmdt)*he1 + pos(iDmdt)*hef1), + 0.3*mag(hef2 - hef1) + ) + ); + + volScalarField iDmdtNew(iDmdt); + if (massTransfer_ ) { volScalarField H1 @@ -389,28 +401,13 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() Tf = saturationModel_->Tsat(phase1.thermo().p()); - scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt")); + iDmdtNew = + (H1*(Tf - T1) + H2*(Tf - T2))/L; - iDmdt = - (1 - iDmdtRelax)*iDmdt - + iDmdtRelax*(H1*(Tf - T1) + H2*(Tf - T2)) - /min - ( - (pos(iDmdt)*he2 + neg(iDmdt)*hef2) - - (neg(iDmdt)*he1 + pos(iDmdt)*hef1), - 0.3*mag(hef2 - hef1) - ); - - Info<< "iDmdt." << pair.name() - << ": min = " << min(iDmdt.primitiveField()) - << ", mean = " << average(iDmdt.primitiveField()) - << ", max = " << max(iDmdt.primitiveField()) - << ", integral = " << fvc::domainIntegrate(iDmdt).value() - << endl; } else { - iDmdt == dimensionedScalar("0", dmdt.dimensions(), 0); + iDmdtNew == dimensionedScalar("0",dmdt.dimensions(), 0); } volScalarField H1(this->heatTransferModels_[pair][pair.first()]->K()); @@ -423,16 +420,7 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() H2.boundaryFieldRef() = max(H2.boundaryField(), phase2.boundaryField()*HLimit); - volScalarField mDotL - ( - iDmdt* - ( - (pos(iDmdt)*he2 + neg(iDmdt)*hef2) - - (neg(iDmdt)*he1 + pos(iDmdt)*hef1) - ) - ); - - Tf = (H1*T1 + H2*T2 + mDotL)/(H1 + H2); + Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2); Info<< "Tf." << pair.name() << ": min = " << min(Tf.primitiveField()) @@ -440,6 +428,19 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() << ", max = " << max(Tf.primitiveField()) << endl; + scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt")); + iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew; + + if (massTransfer_ ) + { + Info<< "iDmdt." << pair.name() + << ": min = " << min(iDmdt.primitiveField()) + << ", mean = " << average(iDmdt.primitiveField()) + << ", max = " << max(iDmdt.primitiveField()) + << ", integral = " << fvc::domainIntegrate(iDmdt).value() + << endl; + } + // Accumulate dmdt contributions from boundaries volScalarField wDmdt ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C index a956565b47..d7eaa2f081 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,7 @@ void Foam::diameterModel::correct() bool Foam::diameterModel::read(const dictionary& phaseProperties) { - diameterProperties_ = phaseProperties.subDict(type() + "Coeffs"); + diameterProperties_ = phaseProperties.optionalSubDict(type() + "Coeffs"); return true; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/newDiameterModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/newDiameterModel.C index 51e7407882..963ad160f7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/newDiameterModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/newDiameterModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,11 @@ Foam::autoPtr Foam::diameterModel::New << exit(FatalError); } - return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase); + return cstrIter() + ( + dict.optionalSubDict(diameterModelType + "Coeffs"), + phase + ); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C index b5dd4ab37a..cabb9e2ebf 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C @@ -135,7 +135,7 @@ Foam::AnisothermalPhaseModel::heEqn() he ) == - this->Sh() + this->Qdot() ); // Add the appropriate pressure-work term diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C index bd4dda226f..e92cae4c9f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.C @@ -65,7 +65,7 @@ Foam::InertPhaseModel::R template Foam::tmp -Foam::InertPhaseModel::Sh() const +Foam::InertPhaseModel::Qdot() const { return tmp ( @@ -73,7 +73,7 @@ Foam::InertPhaseModel::Sh() const ( IOobject ( - IOobject::groupName("Sh", this->name()), + IOobject::groupName("Qdot", this->name()), this->mesh().time().timeName(), this->mesh() ), diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H index 26c9661ab7..c152da488a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/InertPhaseModel/InertPhaseModel.H @@ -78,8 +78,8 @@ public: volScalarField& Yi ) const; - //- Return the reaction heat source - virtual tmp Sh() const; + //- Return the heat release rate + virtual tmp Qdot() const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 0605c1171e..2afa388aca 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -200,6 +200,9 @@ Foam::MovingPhaseModel::MovingPhaseModel dimensionedScalar("0", dimDensity/dimTime, 0) ) { + alphaPhi_.setOriented(); + alphaRhoPhi_.setOriented(); + phi_.writeOpt() = IOobject::AUTO_WRITE; correctKinematics(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C index b15f2898b5..aef23273f2 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.C @@ -105,9 +105,9 @@ Foam::ReactingPhaseModel::R template Foam::tmp -Foam::ReactingPhaseModel::Sh() const +Foam::ReactingPhaseModel::Qdot() const { - return reaction_->Sh(); + return reaction_->Qdot(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H index e05c71b44a..fdda42ca09 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/ReactingPhaseModel/ReactingPhaseModel.H @@ -87,8 +87,8 @@ public: volScalarField& Yi ) const; - //- Return the reacton heat source - virtual tmp Sh() const; + //- Return heat release rate + virtual tmp Qdot() const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index 9fa7c0f589..da10824230 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,24 @@ bool Foam::phaseModel::compressible() const } +void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const +{ + surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef(); + const volScalarField::Boundary& alphaBf = boundaryField(); + const surfaceScalarField::Boundary& phiBf = phi()().boundaryField(); + + forAll(alphaPhiBf, patchi) + { + fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi]; + + if (!alphaPhip.coupled()) + { + alphaPhip = phiBf[patchi]*alphaBf[patchi]; + } + } +} + + const Foam::tmp& Foam::phaseModel::divU() const { NotImplemented; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 719ef80a8c..41fb67e715 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -283,6 +283,9 @@ public: //- Access the mass flux of the phase virtual surfaceScalarField& alphaRhoPhi() = 0; + //- Ensure that the flux at inflow/outflow BCs is preserved + void correctInflowOutflow(surfaceScalarField& alphaPhi) const; + // Transport diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C index b9abe549a0..19e768416f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,9 +76,7 @@ void Foam::phaseSystem::generatePairs // pair already exists if (phasePairs_.found(key)) - { - // do nothing ... - } + {} // new ordered pair else if (key.ordered()) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 01f36c881c..8f4bf7ee0f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,6 +131,22 @@ void Foam::phaseSystem::generatePairsAndSubModels ) ) ); + + if (!phasePairs_.found(key)) + { + phasePairs_.insert + ( + key, + autoPtr + ( + new phasePair + ( + phaseModels_[key.first()], + phaseModels_[key.second()] + ) + ) + ); + } } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C index f43303a2b7..712a96e1de 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/reactionThermo/hRefConstThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -253,6 +253,14 @@ makeReactionMixtureThermo constRefRhoConstHThermoPhysics ); +makeReactionMixtureThermo +( + rhoThermo, + rhoReactionThermo, + heRhoThermo, + multiComponentMixture, + constRefFluidHThermoPhysics +); makeReactionMixtureThermo ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index ca37c2245b..627af1db87 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,15 +71,17 @@ void Foam::multiphaseSystem::solveAlphas() { bool LTS = fv::localEulerDdt::enabled(mesh_); + forAll(phases(), phasei) + { + phases()[phasei].correctBoundaryConditions(); + } + PtrList alphaPhiCorrs(phases().size()); forAll(phases(), phasei) { phaseModel& phase = phases()[phasei]; volScalarField& alpha1 = phase; - phase.alphaPhi() = - dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0); - alphaPhiCorrs.set ( phasei, @@ -134,28 +136,7 @@ void Foam::multiphaseSystem::solveAlphas() ); } - surfaceScalarField::Boundary& alphaPhiCorrBf = - alphaPhiCorr.boundaryFieldRef(); - - // Ensure that the flux at inflow BCs is preserved - forAll(alphaPhiCorr.boundaryField(), patchi) - { - fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi]; - - if (!alphaPhiCorrp.coupled()) - { - const scalarField& phi1p = phase.phi().boundaryField()[patchi]; - const scalarField& alpha1p = alpha1.boundaryField()[patchi]; - - forAll(alphaPhiCorrp, facei) - { - if (phi1p[facei] < 0) - { - alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei]; - } - } - } - } + phase.correctInflowOutflow(alphaPhiCorr); if (LTS) { @@ -215,8 +196,9 @@ void Foam::multiphaseSystem::solveAlphas() phaseModel& phase = phases()[phasei]; volScalarField& alpha = phase; - surfaceScalarField& alphaPhic = alphaPhiCorrs[phasei]; - alphaPhic += upwind(mesh_, phi_).flux(phase); + surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; + alphaPhi += upwind(mesh_, phi_).flux(phase); + phase.correctInflowOutflow(alphaPhi); volScalarField::Internal Sp ( @@ -298,12 +280,12 @@ void Foam::multiphaseSystem::solveAlphas() ( geometricOneField(), alpha, - alphaPhic, + alphaPhi, Sp, Su ); - phase.alphaPhi() += alphaPhic; + phase.alphaPhi() = alphaPhi; Info<< phase.name() << " volume fraction, min, max = " << phase.weightedAverage(mesh_.V()).value() @@ -319,6 +301,14 @@ void Foam::multiphaseSystem::solveAlphas() << ' ' << min(sumAlpha).value() << ' ' << max(sumAlpha).value() << endl; + + // Correct the sum of the phase-fractions to avoid 'drift' + volScalarField sumCorr(1.0 - sumAlpha); + forAll(phases(), phasei) + { + volScalarField& alpha = phases()[phasei]; + alpha += alpha*sumCorr; + } } @@ -558,6 +548,8 @@ Foam::tmp Foam::multiphaseSystem::surfaceTension ) ); + tSurfaceTension.ref().setOriented(); + forAll(phases(), phasej) { const phaseModel& phase2 = phases()[phasej]; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H index 5e916dce2f..3445c81fb9 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H @@ -294,12 +294,11 @@ while (pimple.correct()) forAll(phases, phasei) { phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + volScalarField& rho = phase.thermo().rho(); if (phase.compressible()) { - const volScalarField& alpha = phase; - const volScalarField& rho = phase.rho(); - if (pimple.transonic()) { surfaceScalarField phid @@ -357,21 +356,29 @@ while (pimple.correct()) ).ptr() ); } + } + else + { + pEqnComps.set + ( + phasei, + fvm::Su(-(fvOptions(alpha, rho)&rho)/rho, p_rgh).ptr() + ); + } - if (fluid.transfersMass(phase)) + if (fluid.transfersMass(phase)) + { + if (pEqnComps.set(phasei)) { - if (pEqnComps.set(phasei)) - { - pEqnComps[phasei] -= fluid.dmdt(phase)/rho; - } - else - { - pEqnComps.set - ( - phasei, - fvm::Su(-fluid.dmdt(phase)/rho, p_rgh) - ); - } + pEqnComps[phasei] -= fluid.dmdt(phase)/rho; + } + else + { + pEqnComps.set + ( + phasei, + fvm::Su(-fluid.dmdt(phase)/rho, p_rgh) + ); } } } @@ -421,7 +428,7 @@ while (pimple.correct()) phase.phi() = phiHbyAs[phasei] + alpharAUfs[phasei]*mSfGradp; // Set the phase dilatation rates - if (phase.compressible()) + if (pEqnComps.set(phasei)) { phase.divU(-pEqnComps[phasei] & p_rgh); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H index 3b225202e9..3365febdf6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H @@ -7,8 +7,7 @@ volScalarField rAU1 1.0 /( U1Eqn.A() - + max(phase1.residualAlpha() - alpha1, scalar(0)) - *rho1/runTime.deltaT() + + byDt(max(phase1.residualAlpha() - alpha1, scalar(0))*rho1) ) ); volScalarField rAU2 @@ -17,8 +16,7 @@ volScalarField rAU2 1.0 /( U2Eqn.A() - + max(phase2.residualAlpha() - alpha2, scalar(0)) - *rho2/runTime.deltaT() + + byDt(max(phase2.residualAlpha() - alpha2, scalar(0))*rho2) ) ); @@ -101,8 +99,8 @@ while (pimple.correct()) rAU1 *( U1Eqn.H() - + max(phase1.residualAlpha() - alpha1, scalar(0)) - *rho1*U1.oldTime()/runTime.deltaT() + + byDt(max(phase1.residualAlpha() - alpha1, scalar(0))*rho1) + *U1.oldTime() ); volVectorField HbyA2 @@ -114,8 +112,8 @@ while (pimple.correct()) rAU2 *( U2Eqn.H() - + max(phase2.residualAlpha() - alpha2, scalar(0)) - *rho2*U2.oldTime()/runTime.deltaT() + + byDt(max(phase2.residualAlpha() - alpha2, scalar(0))*rho2) + *U2.oldTime() ); surfaceScalarField ghSnGradRho @@ -175,11 +173,9 @@ while (pimple.correct()) ( IOobject::groupName("phiHbyA", phase1.name()), fvc::flux(HbyA1) - + phiCorrCoeff1*fvc::interpolate(alpha1.oldTime()*rho1.oldTime()*rAU1) - *( - MRF.absolute(phi1.oldTime()) - - fvc::flux(U1.oldTime()) - )/runTime.deltaT() + + phiCorrCoeff1 + *fvc::interpolate(byDt(alpha1.oldTime()*rho1.oldTime()*rAU1)) + *(MRF.absolute(phi1.oldTime()) - fvc::flux(U1.oldTime())) - phiF1() - phig1 ); @@ -189,11 +185,9 @@ while (pimple.correct()) ( IOobject::groupName("phiHbyA", phase2.name()), fvc::flux(HbyA2) - + phiCorrCoeff2*fvc::interpolate(alpha2.oldTime()*rho2.oldTime()*rAU2) - *( - MRF.absolute(phi2.oldTime()) - - fvc::flux(U2.oldTime()) - )/runTime.deltaT() + + phiCorrCoeff2 + *fvc::interpolate(byDt(alpha2.oldTime()*rho2.oldTime()*rAU2)) + *(MRF.absolute(phi2.oldTime()) - fvc::flux(U2.oldTime())) - phiF2() - phig2 ); @@ -236,9 +230,10 @@ while (pimple.correct()) tmp pEqnComp2; // Construct the compressibility parts of the pressure equation - if (pimple.transonic()) + + if (phase1.compressible()) { - if (phase1.compressible()) + if (pimple.transonic()) { surfaceScalarField phid1 ( @@ -263,8 +258,24 @@ while (pimple.correct()) deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); pEqnComp1.ref().relax(); } + else + { + pEqnComp1 = + ( + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); + } + } + else + { + pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh); + } - if (phase2.compressible()) + if (phase2.compressible()) + { + if (pimple.transonic()) { surfaceScalarField phid2 ( @@ -285,23 +296,11 @@ while (pimple.correct()) + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) ) ); + deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); pEqnComp2.ref().relax(); } - } - else - { - if (phase1.compressible()) - { - pEqnComp1 = - ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); - } - - if (phase2.compressible()) + else { pEqnComp2 = ( @@ -311,6 +310,10 @@ while (pimple.correct()) + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); } } + else + { + pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh); + } if (fluid.transfersMass()) { @@ -396,11 +399,11 @@ while (pimple.correct()) } // Set the phase dilatation rates - if (phase1.compressible()) + if (pEqnComp1.valid()) { phase1.divU(-pEqnComp1 & p_rgh); } - if (phase2.compressible()) + if (pEqnComp2.valid()) { phase2.divU(-pEqnComp2 & p_rgh); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/DDtU.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/DDtU.H index c7bccf66ea..557eb02678 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/DDtU.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/DDtU.H @@ -1,2 +1,2 @@ -ddtPhi1 = fvc::ddt(phi1); -ddtPhi2 = fvc::ddt(phi2); +tddtPhi1 = fvc::ddt(phi1); +tddtPhi2 = fvc::ddt(phi2); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createDDtU.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createDDtU.H index 14e66e47a8..e461616b29 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createDDtU.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createDDtU.H @@ -1,2 +1,7 @@ -surfaceScalarField ddtPhi1(fvc::ddt(phi1)); -surfaceScalarField ddtPhi2(fvc::ddt(phi2)); +tmp tddtPhi1; +tmp tddtPhi2; + +if (faceMomentum) +{ + #include "pUf/DDtU.H" +} diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/createRDeltaTf.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createRDeltaTf.H similarity index 100% rename from applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/createRDeltaTf.H rename to applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/createRDeltaTf.H diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H index 7950d76b94..d2202eb890 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H @@ -159,7 +159,7 @@ while (pimple.correct()) (alphaRhof10 + Vmf) *byDt(MRF.absolute(phi1.oldTime())) + fvc::flux(U1Eqn.H()) - + Vmf*ddtPhi2 + + Vmf*tddtPhi2() + Kdf*MRF.absolute(phi2) - Ff1() ); @@ -177,7 +177,7 @@ while (pimple.correct()) (alphaRhof20 + Vmf) *byDt(MRF.absolute(phi2.oldTime())) + fvc::flux(U2Eqn.H()) - + Vmf*ddtPhi1 + + Vmf*tddtPhi1() + Kdf*MRF.absolute(phi1) - Ff2() ); @@ -215,79 +215,91 @@ while (pimple.correct()) tmp pEqnComp1; tmp pEqnComp2; - if (pimple.transonic()) - { - surfaceScalarField phid1 - ( - IOobject::groupName("phid", phase1.name()), - fvc::interpolate(psi1)*phi1 - ); - surfaceScalarField phid2 - ( - IOobject::groupName("phid", phase2.name()), - fvc::interpolate(psi2)*phi2 - ); + // Construct the compressibility parts of the pressure equation - if (phase1.compressible()) + if (phase1.compressible()) + { + if (pimple.transonic()) { - pEqnComp1 = + surfaceScalarField phid1 ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + correction - ( - (alpha1/rho1)* - ( - psi1*fvm::ddt(p_rgh) - + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) - ) + IOobject::groupName("phid", phase1.name()), + fvc::interpolate(psi1)*phi1 ); + + pEqnComp1 = + ( + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + correction + ( + (alpha1/rho1)* + ( + psi1*fvm::ddt(p_rgh) + + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) + ) + ); + deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); pEqnComp1.ref().relax(); } - - if (phase2.compressible()) + else { - pEqnComp2 = - ( - phase2.continuityError() - - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) - )/rho2 - + correction - ( - (alpha2/rho2)* + pEqnComp1 = ( - psi2*fvm::ddt(p_rgh) - + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) - ) - ); - deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); - pEqnComp2.ref().relax(); + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); } } else { - if (phase1.compressible()) - { - pEqnComp1 = - ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); - } + pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh); + } - if (phase2.compressible()) + if (phase2.compressible()) + { + if (pimple.transonic()) + { + surfaceScalarField phid2 + ( + IOobject::groupName("phid", phase2.name()), + fvc::interpolate(psi2)*phi2 + ); + + pEqnComp2 = + ( + phase2.continuityError() + - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) + )/rho2 + + correction + ( + (alpha2/rho2)* + ( + psi2*fvm::ddt(p_rgh) + + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + ) + ); + + deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); + pEqnComp2.ref().relax(); + } + else { pEqnComp2 = - ( - phase2.continuityError() - - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) - )/rho2 - + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); + ( + phase2.continuityError() + - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) + )/rho2 + + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); } } + else + { + pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh); + } if (fluid.transfersMass()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C index f180257e9c..399a596944 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C @@ -45,6 +45,18 @@ Description namespace Foam { + tmp byDt(const volScalarField& vf) + { + if (fv::localEulerDdt::enabled(vf.mesh())) + { + return fv::localEulerDdt::localRDeltaT(vf.mesh())*vf; + } + else + { + return vf/vf.mesh().time().deltaT(); + } + } + tmp byDt(const surfaceScalarField& sf) { if (fv::localEulerDdt::enabled(sf.mesh())) @@ -92,7 +104,7 @@ int main(int argc, char *argv[]) ) ); - #include "createRDeltaTf.H" + #include "pUf/createRDeltaTf.H" #include "pUf/createDDtU.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 60b92573c4..034da57349 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,9 @@ License #include "saturationModel.H" #include "wallFvPatch.H" #include "uniformDimensionedFields.H" +#include "mathematicalConstants.H" +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -84,7 +86,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField relax_(0.5), AbyV_(p.size(), 0), alphatConv_(p.size(), 0), - dDep_(p.size(), 0), + dDep_(p.size(), 1e-5), + qq_(p.size(), 0), partitioningModel_(nullptr), nucleationSiteModel_(nullptr), departureDiamModel_(nullptr), @@ -112,7 +115,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField relax_(dict.lookupOrDefault("relax", 0.5)), AbyV_(p.size(), 0), alphatConv_(p.size(), 0), - dDep_(p.size(), 0), + dDep_(p.size(), 1e-5), + qq_(p.size(), 0), partitioningModel_(nullptr), nucleationSiteModel_(nullptr), departureDiamModel_(nullptr), @@ -157,6 +161,17 @@ alphatWallBoilingWallFunctionFvPatchScalarField ( dict.subDict("departureFreqModel") ); + + if (dict.found("dDep")) + { + dDep_ = scalarField("dDep", dict, p.size()); + } + + if (dict.found("qQuenching")) + { + qq_ = scalarField("qQuenching", dict, p.size()); + } + break; } } @@ -195,6 +210,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField AbyV_(psf.AbyV_), alphatConv_(psf.alphatConv_, mapper), dDep_(psf.dDep_, mapper), + qq_(psf.qq_, mapper), partitioningModel_(psf.partitioningModel_), nucleationSiteModel_(psf.nucleationSiteModel_), departureDiamModel_(psf.departureDiamModel_), @@ -213,6 +229,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField AbyV_(psf.AbyV_), alphatConv_(psf.alphatConv_), dDep_(psf.dDep_), + qq_(psf.qq_), partitioningModel_(psf.partitioningModel_), nucleationSiteModel_(psf.nucleationSiteModel_), departureDiamModel_(psf.departureDiamModel_), @@ -232,6 +249,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField AbyV_(psf.AbyV_), alphatConv_(psf.alphatConv_), dDep_(psf.dDep_), + qq_(psf.qq_), partitioningModel_(psf.partitioningModel_), nucleationSiteModel_(psf.nucleationSiteModel_), departureDiamModel_(psf.departureDiamModel_), @@ -259,10 +277,9 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() // Lookup the fluid model const ThermalPhaseChangePhaseSystem < - MomentumTransferPhaseSystem - < - twoPhaseSystem> - >& fluid = refCast + MomentumTransferPhaseSystem + >& fluid = + refCast < const ThermalPhaseChangePhaseSystem < @@ -429,14 +446,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() const scalarField Tplus(Prt_*(log(E_*yPlus)/kappa_ + P)); scalarField Tl(Tw - (Tplus_y250/Tplus)*(Tw - Tc)); - Tl = max(Tc - 40, min(Tc, Tl)); - const scalarField Tsub(max(Tsatw - Tl, scalar(0))); - - // Wall heat flux partitioning - const scalarField fLiquid - ( - partitioningModel_->fLiquid(liquidw) - ); + Tl = max(Tc - 40, Tl); // Nucleation site density: const scalarField N @@ -446,7 +456,9 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() liquid, vapor, patchi, - Tsatw + Tl, + Tsatw, + L ) ); @@ -456,7 +468,9 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() liquid, vapor, patchi, - Tsub + Tl, + Tsatw, + L ); // Bubble departure frequency: @@ -474,19 +488,24 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() // Area fractions: // Del Valle & Kenning (1985) - const scalarField Ja(rhoLiquidw*Cpw*Tsub/(rhoVaporw*L)); - const scalarField Al(fLiquid*4.8*exp(-Ja/80)); + const scalarField Ja + ( + rhoLiquidw*Cpw*(Tsatw - Tl)/(rhoVaporw*L) + ); + const scalarField Al + ( + fLiquid*4.8*exp( min(-Ja/80,log(VGREAT))) + ); - const scalarField A2(min(M_PI*sqr(dDep_)*N*Al/4, scalar(1))); + const scalarField A2(min(pi*sqr(dDep_)*N*Al/4, scalar(1))); const scalarField A1(max(1 - A2, scalar(1e-4))); - const scalarField A2E(min(M_PI*sqr(dDep_)*N*Al/4, scalar(5))); - - // Wall evaporation heat flux [kg/s3 = J/m2s] - const scalarField Qe((1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*L); + const scalarField A2E(min(pi*sqr(dDep_)*N*Al/4, scalar(5))); // Volumetric mass source in the near wall cell due to the // wall boiling - dmdt_ = (1 - relax_)*dmdt_ + relax_*Qe*AbyV_/L; + dmdt_ = + (1 - relax_)*dmdt_ + + relax_*(1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*AbyV_; // Volumetric source in the near wall cell due to the wall // boiling @@ -495,11 +514,11 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() // Quenching heat transfer coefficient const scalarField hQ ( - 2*(alphaw*Cpw)*fDep*sqrt((0.8/fDep)/(M_PI*alphaw/rhow)) + 2*(alphaw*Cpw)*fDep*sqrt((0.8/fDep)/(pi*alphaw/rhow)) ); // Quenching heat flux - const scalarField Qq(A2*hQ*max(Tw - Tl, scalar(0))); + qq_ = (A2*hQ*max(Tw - Tl, scalar(0))); // Effective thermal diffusivity that corresponds to the // calculated convective, quenching and evaporative heat fluxes @@ -508,7 +527,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() ( ( A1*alphatConv_ - + (Qq + Qe)/max(hew.snGrad(), scalar(1e-16)) + + (qq_ + qe())/max(hew.snGrad(), scalar(1e-16)) ) /max(liquidw, scalar(1e-8)) ); @@ -531,12 +550,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() if (debug) { - const scalarField Qc + const scalarField qc ( fLiquid*A1*(alphatConv_ + alphaw)*hew.snGrad() ); - const scalarField QEff + const scalarField qEff ( liquidw*(*this + alphaw)*hew.snGrad() ); @@ -555,13 +574,13 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() << gMax(A2E) << endl; Info<< " dmdtW: " << gMin(dmdt_) << " - " << gMax(dmdt_) << endl; - Info<< " Qc: " << gMin(Qc) << " - " << gMax(Qc) << endl; - Info<< " Qq: " << gMin(fLiquid*Qq) << " - " - << gMax(fLiquid*Qq) << endl; - Info<< " Qe: " << gMin(fLiquid*Qe) << " - " - << gMax(fLiquid*Qe) << endl; - Info<< " QEff: " << gMin(QEff) << " - " - << gMax(QEff) << endl; + Info<< " qc: " << gMin(qc) << " - " << gMax(qc) << endl; + Info<< " qq: " << gMin(fLiquid*qq()) << " - " + << gMax(fLiquid*qq()) << endl; + Info<< " qe: " << gMin(fLiquid*qe()) << " - " + << gMax(fLiquid*qe()) << endl; + Info<< " qEff: " << gMin(qEff) << " - " + << gMax(qEff) << endl; Info<< " alphat: " << gMin(*this) << " - " << gMax(*this) << endl; Info<< " alphatConv: " << gMin(alphatConv_) @@ -622,11 +641,14 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const os << indent << token::BEGIN_BLOCK << incrIndent << nl; departureFreqModel_->write(os); os << decrIndent << indent << token::END_BLOCK << nl; + break; } } dmdt_.writeEntry("dmdt", os); + dDep_.writeEntry("dDep", os); + qq_.writeEntry("qQuenching", os); alphatConv_.writeEntry("alphatConv", os); writeEntry("value", os); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H index d724d98611..665d41197e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,7 +115,7 @@ Usage value uniform 0.01; \endverbatim -SeeAlso +See also Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField SourceFiles @@ -181,6 +181,9 @@ private: //- Departure diameter field scalarField dDep_; + //- Quenching surface heat flux + scalarField qq_; + //- Run-time selected heat flux partitioning model autoPtr partitioningModel_; @@ -269,12 +272,23 @@ public: // Member functions - //- Calculate and return the departure diameter field + //- Return the departure diameter field const scalarField& dDeparture() const { return dDep_; } + //- Return the quenching surface heat flux [W/m2] + const scalarField& qq() const + { + return qq_; + } + + //- Return the evaporation surface heat flux [W/m2] + tmp qe() const + { + return mDotL_/AbyV_; + } // Evaluation functions diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C index ae6ecf4620..53fe0e2f15 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,7 +80,9 @@ KocamustafaogullariIshii::dDeparture const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const scalarField& Tsub + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const { // Gravitational acceleration diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H index 5bbe8d5433..e7f0c67555 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,9 @@ public: const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const scalarField& Tsub + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const; virtual void write(Ostream& os) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C index 23229071c0..71ef4f03c7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,7 +54,10 @@ TolubinskiKostanchuk::TolubinskiKostanchuk const dictionary& dict ) : - departureDiameterModel() + departureDiameterModel(), + dRef_(dict.lookupOrDefault("dRef", 6e-4)), + dMax_(dict.lookupOrDefault("dMax", 0.0014)), + dMin_(dict.lookupOrDefault("dMin", 1e-6)) {} @@ -74,10 +77,22 @@ TolubinskiKostanchuk::dDeparture const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const scalarField& Tsub + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const { - return max(min(0.0006*exp(-Tsub/45), scalar(0.0014)), scalar(1e-6)); + return max(min(dRef_*exp(-(Tsatw-Tl)/45), dMax_), dMin_); +} + + +void Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::write(Ostream& os) const +{ + departureDiameterModel::write(os); + os.writeKeyword("dRef") << dRef_ << token::END_STATEMENT << nl; + os.writeKeyword("dMax") << dMax_ << token::END_STATEMENT << nl; + os.writeKeyword("dMin") << dMin_ << token::END_STATEMENT << nl; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H index 9437f5185b..79c5d61c6a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,17 @@ class TolubinskiKostanchuk public departureDiameterModel { + // Private data: + + //- Coefficient of the temperature term + scalar dRef_; + + //- Maximum diameter + scalar dMax_; + + //- Minimum diameter + scalar dMin_; + public: //- Runtime type information @@ -87,8 +98,12 @@ public: const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const scalarField& Tsub + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const; + + virtual void write(Ostream& os) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H index 47f431eb19..5a7375e061 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,9 @@ public: const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const scalarField& Tsub + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const = 0; virtual void write(Ostream& os) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C index 28920597d2..69eddc91c8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,8 @@ Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla const dictionary& dict ) : - nucleationSiteModel() + nucleationSiteModel(), + Cn_(dict.lookupOrDefault("Cn", 1)) {} @@ -71,13 +72,15 @@ Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::N const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const fvPatchScalarField& Tsatw + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const { const fvPatchScalarField& Tw = liquid.thermo().T().boundaryField()[patchi]; - return 0.8*9.922e5*pow(max((Tw - Tsatw)/10, scalar(0)), 1.805); + return Cn_*9.922e5*pow(max((Tw - Tsatw)/10, scalar(0)), 1.805); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H index a521eb7842..f3c560478f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,11 @@ class LemmertChawla public nucleationSiteModel { + // Private data: + + //- Coefficient for nucleation site density + scalar Cn_; + public: //- Runtime type information @@ -91,7 +96,9 @@ public: const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const fvPatchScalarField& Tsatw + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H index 6a26e4de70..fc26b7f9ec 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,9 @@ public: const phaseModel& liquid, const phaseModel& vapor, const label patchi, - const fvPatchScalarField& Tsatw + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L ) const = 0; virtual void write(Ostream& os) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C index 8feaaf8ca6..1963b11425 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,13 +73,13 @@ Lavieville::fLiquid ) const { return - pos(alphaLiquid-alphaCrit_) + pos(alphaLiquid - alphaCrit_) *( 1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_)) ) + neg(alphaLiquid - alphaCrit_) *( - pow(0.5*(alphaLiquid/alphaCrit_), 20*alphaCrit_) + 0.5*pow(alphaLiquid/alphaCrit_, 20*alphaCrit_) ); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C index 69818cf604..702464b813 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C @@ -83,7 +83,7 @@ cosine::fLiquid 1 - cos ( constant::mathematical::pi - *(alphaLiquid1_ - alphaLiquid) + *(alphaLiquid - alphaLiquid0_) /(alphaLiquid1_ - alphaLiquid0_) ) ) diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H index 17815d94a0..2983335b26 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H @@ -32,13 +32,11 @@ Description - alphaLiquid0 0.05 \verbatim - Ioilev, A., Samigulin, M., Ustinenko, V., Kucherova, P., Tentner, - A., Lo, S., & Splawski, A. (2007). - Advances in the modeling of cladding heat transfer - and critical heat flux in boiling water reactor fuel assemblies. - In Proc. 12th International Topical Meeting on Nuclear Reactor - Thermal Hydraulics (NURETH-12), - Pittsburgh, Pennsylvania, USA. + Tentner, A., Lo, S., & Kozlov, V. (2006). + Advances in computational fluid dynamics modeling + of two-phase flow in boiling water reactor fuel assemblies. + In International Conference of Nuclear Engineering, + Miami, Florida, USA. \endverbatim SourceFiles diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H index 3e635de085..81d2550fff 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H @@ -31,10 +31,8 @@ Description - alphaLiquid1 0.1 - alphaLiquid0 0.05 - Reference: \verbatim - Ioilev, A., Samigulin, M., Ustinenko, V., Kucherova, P., Tentner, A., - Lo, S., & Splawski, A. (2007). + Ioilev, A., Samigulin, M., Ustinenko (2007). Advances in the modeling of cladding heat transfer and critical heat flux in boiling water reactor fuel assemblies. In Proc. 12th International Topical Meeting on diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index 5abe9f3561..a1794a7820 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair ) : conductivityModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) {} @@ -103,7 +103,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); L_.readIfPresent(coeffDict_); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index ab6d3d354a..6b110d3731 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ JohnsonJackson ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), eta_("eta", dimless, coeffDict_), p_("p", dimless, coeffDict_), @@ -130,7 +130,7 @@ Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); Fr_.read(coeffDict_); eta_.read(coeffDict_); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C index 3b69aa8a62..67517beb07 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), eta_("eta", dimless, coeffDict_), p_("p", dimless, coeffDict_), @@ -190,7 +190,7 @@ JohnsonJacksonSchaeffer::nu bool Foam::kineticTheoryModels::frictionalStressModels:: JohnsonJacksonSchaeffer::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); Fr_.read(coeffDict_); eta_.read(coeffDict_); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C index be2555958c..eeabe622e1 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), phi_("phi", dimless, coeffDict_) { phi_ *= constant::mathematical::pi/180.0; @@ -178,7 +178,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); phi_.read(coeffDict_); phi_ *= constant::mathematical::pi/180.0; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C index 415bb3145a..6607b16443 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair ) : viscosityModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) {} @@ -100,7 +100,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::nu bool Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); L_.readIfPresent(coeffDict_); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 8115f05cd0..62bbe6af40 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -201,7 +201,6 @@ void Foam::twoPhaseSystem::solve() word alphaScheme("div(phi," + alpha1.name() + ')'); word alpharScheme("div(phir," + alpha1.name() + ')'); - const surfaceScalarField& phi = this->phi(); const surfaceScalarField& phi1 = phase1_.phi(); const surfaceScalarField& phi2 = phase2_.phi(); @@ -236,9 +235,7 @@ void Foam::twoPhaseSystem::solve() } alpha1.correctBoundaryConditions(); - surfaceScalarField alpha1f(fvc::interpolate(max(alpha1, scalar(0)))); - surfaceScalarField phic("phic", phi); surfaceScalarField phir("phir", phi1 - phi2); tmp alphaDbyA; @@ -279,7 +276,7 @@ void Foam::twoPhaseSystem::solve() ), // Divergence term is handled explicitly to be // consistent with the explicit transport solution - fvc::div(phi)*min(alpha1, scalar(1)) + fvc::div(phi_)*min(alpha1, scalar(1)) ); if (tdgdt.valid()) @@ -300,11 +297,11 @@ void Foam::twoPhaseSystem::solve() } } - surfaceScalarField alphaPhic1 + surfaceScalarField alphaPhi1 ( fvc::flux ( - phic, + phi_, alpha1, alphaScheme ) @@ -316,28 +313,7 @@ void Foam::twoPhaseSystem::solve() ) ); - surfaceScalarField::Boundary& alphaPhic1Bf = - alphaPhic1.boundaryFieldRef(); - - // Ensure that the flux at inflow BCs is preserved - forAll(alphaPhic1Bf, patchi) - { - fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi]; - - if (!alphaPhic1p.coupled()) - { - const scalarField& phi1p = phi1.boundaryField()[patchi]; - const scalarField& alpha1p = alpha1.boundaryField()[patchi]; - - forAll(alphaPhic1p, facei) - { - if (phi1p[facei] < 0) - { - alphaPhic1p[facei] = alpha1p[facei]*phi1p[facei]; - } - } - } - } + phase1_.correctInflowOutflow(alphaPhi1); if (nAlphaSubCycles > 1) { @@ -355,14 +331,14 @@ void Foam::twoPhaseSystem::solve() !(++alphaSubCycle).end(); ) { - surfaceScalarField alphaPhic10(alphaPhic1); + surfaceScalarField alphaPhi10(alphaPhi1); MULES::explicitSolve ( geometricOneField(), alpha1, - phi, - alphaPhic10, + phi_, + alphaPhi10, (alphaSubCycle.index()*Sp)(), (Su - (alphaSubCycle.index() - 1)*Sp*alpha1)(), phase1_.alphaMax(), @@ -371,11 +347,11 @@ void Foam::twoPhaseSystem::solve() if (alphaSubCycle.index() == 1) { - phase1_.alphaPhi() = alphaPhic10; + phase1_.alphaPhi() = alphaPhi10; } else { - phase1_.alphaPhi() += alphaPhic10; + phase1_.alphaPhi() += alphaPhi10; } } @@ -387,15 +363,15 @@ void Foam::twoPhaseSystem::solve() ( geometricOneField(), alpha1, - phi, - alphaPhic1, + phi_, + alphaPhi1, Sp, Su, phase1_.alphaMax(), 0 ); - phase1_.alphaPhi() = alphaPhic1; + phase1_.alphaPhi() = alphaPhi1; } if (alphaDbyA.valid()) @@ -415,8 +391,8 @@ void Foam::twoPhaseSystem::solve() phase1_.alphaRhoPhi() = fvc::interpolate(phase1_.rho())*phase1_.alphaPhi(); - phase2_.alphaPhi() = phi - phase1_.alphaPhi(); - alpha2 = scalar(1) - alpha1; + phase2_.alphaPhi() = phi_ - phase1_.alphaPhi(); + phase2_.correctInflowOutflow(phase2_.alphaPhi()); phase2_.alphaRhoPhi() = fvc::interpolate(phase2_.rho())*phase2_.alphaPhi(); @@ -425,6 +401,13 @@ void Foam::twoPhaseSystem::solve() << " Min(alpha1) = " << min(alpha1).value() << " Max(alpha1) = " << max(alpha1).value() << endl; + + // Ensure the phase-fractions are bounded + alpha1.max(0); + alpha1.min(1); + + // Update the phase-fraction of the other phase + alpha2 = scalar(1) - alpha1; } } diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options index 4dfc63419d..e9549744ce 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options @@ -1,6 +1,6 @@ EXE_INC = \ -I. \ - -I../interFoam \ + -I../VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H index 4ca36a0a96..c5963a3eff 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::constantAspectRatio + Foam::aspectRatioModels::constantAspectRatio Description Constant value aspect ratio model. diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index 5abe9f3561..a1794a7820 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair ) : conductivityModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) {} @@ -103,7 +103,7 @@ Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); L_.readIfPresent(coeffDict_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index ab6d3d354a..6b110d3731 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ JohnsonJackson ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), eta_("eta", dimless, coeffDict_), p_("p", dimless, coeffDict_), @@ -130,7 +130,7 @@ Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); Fr_.read(coeffDict_); eta_.read(coeffDict_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C index 3b69aa8a62..67517beb07 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), eta_("eta", dimless, coeffDict_), p_("p", dimless, coeffDict_), @@ -190,7 +190,7 @@ JohnsonJacksonSchaeffer::nu bool Foam::kineticTheoryModels::frictionalStressModels:: JohnsonJacksonSchaeffer::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); Fr_.read(coeffDict_); eta_.read(coeffDict_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C index be2555958c..eeabe622e1 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer ) : frictionalStressModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), phi_("phi", dimless, coeffDict_) { phi_ *= constant::mathematical::pi/180.0; @@ -178,7 +178,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); phi_.read(coeffDict_); phi_ *= constant::mathematical::pi/180.0; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C index 415bb3145a..6607b16443 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair ) : viscosityModel(dict), - coeffDict_(dict.subDict(typeName + "Coeffs")), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) {} @@ -100,7 +100,7 @@ Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::nu bool Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::read() { - coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); L_.readIfPresent(coeffDict_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C index 55225147ac..d7eaa2f081 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/diameterModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,7 @@ void Foam::diameterModel::correct() bool Foam::diameterModel::read(const dictionary& phaseProperties) { - diameterProperties_ = phaseProperties.subDict(type() + "Coeffs"); + diameterProperties_ = phaseProperties.optionalSubDict(type() + "Coeffs"); return true; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.C index 51e7407882..963ad160f7 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/diameterModel/newDiameterModel.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-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,11 @@ Foam::autoPtr Foam::diameterModel::New << exit(FatalError); } - return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase); + return cstrIter() + ( + dict.optionalSubDict(diameterModelType + "Coeffs"), + phase + ); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index f5522c7509..9352b72397 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,6 +109,9 @@ Foam::phaseModel::phaseModel dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0) ) { + alphaPhi_.setOriented(); + alphaRhoPhi_.setOriented(); + thermo_->validate("phaseModel " + name_, "h", "e"); const word phiName = IOobject::groupName("phi", name_); @@ -248,27 +251,19 @@ bool Foam::phaseModel::read(const dictionary& phaseProperties) } -void Foam::phaseModel::correctInflowFlux(surfaceScalarField& alphaPhi) const +void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const { surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef(); + const volScalarField::Boundary& alphaBf = boundaryField(); + const surfaceScalarField::Boundary& phiBf = phi().boundaryField(); - // Ensure that the flux at inflow BCs is preserved forAll(alphaPhiBf, patchi) { fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi]; if (!alphaPhip.coupled()) { - const scalarField& phip = phi().boundaryField()[patchi]; - const scalarField& alphap = boundaryField()[patchi]; - - forAll(alphaPhip, facei) - { - if (phip[facei] < SMALL) - { - alphaPhip[facei] = alphap[facei]*phip[facei]; - } - } + alphaPhip = phiBf[patchi]*alphaBf[patchi]; } } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index a5ae107c90..894907fe7c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -319,8 +319,8 @@ public: return alphaRhoPhi_; } - //- Ensure that the flux at inflow BCs is preserved - void correctInflowFlux(surfaceScalarField& alphaPhi) const; + //- Ensure that the flux at inflow/outflow BCs is preserved + void correctInflowOutflow(surfaceScalarField& alphaPhi) const; //- Correct the phase properties // other than the thermodynamics and turbulence diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 808fe255f9..c6861dcf2c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -444,7 +444,7 @@ void Foam::twoPhaseSystem::solve() ) ); - phase1_.correctInflowFlux(alphaPhic1); + phase1_.correctInflowOutflow(alphaPhic1); if (nAlphaSubCycles > 1) { @@ -515,8 +515,7 @@ void Foam::twoPhaseSystem::solve() fvc::interpolate(phase1_.rho())*phase1_.alphaPhi(); phase2_.alphaPhi() = phi_ - phase1_.alphaPhi(); - alpha2 = scalar(1) - alpha1; - phase2_.correctInflowFlux(phase2_.alphaPhi()); + phase2_.correctInflowOutflow(phase2_.alphaPhi()); phase2_.alphaRhoPhi() = fvc::interpolate(phase2_.rho())*phase2_.alphaPhi(); @@ -525,6 +524,12 @@ void Foam::twoPhaseSystem::solve() << " Min(" << alpha1.name() << ") = " << min(alpha1).value() << " Max(" << alpha1.name() << ") = " << max(alpha1).value() << endl; + + // Ensure the phase-fractions are bounded + alpha1.max(0); + alpha1.min(1); + + alpha2 = scalar(1) - alpha1; } } diff --git a/applications/test/FixedList/Test-FixedList.C b/applications/test/FixedList/Test-FixedList.C index 6e8210c825..9fd0fde37a 100644 --- a/applications/test/FixedList/Test-FixedList.C +++ b/applications/test/FixedList/Test-FixedList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,7 +100,11 @@ int main(int argc, char *argv[]) Serr<< "slave sending to master " << Pstream::masterNo() << endl; - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster + ( + Pstream::commsTypes::blocking, + Pstream::masterNo() + ); FixedList list3; list3[0] = 0; @@ -117,7 +121,7 @@ int main(int argc, char *argv[]) ) { Serr << "master receiving from slave " << slave << endl; - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::commsTypes::blocking, slave); FixedList list3(fromSlave); Serr<< list3 << endl; diff --git a/applications/test/Function1/Make/options b/applications/test/Function1/Make/options index af5541db76..b8e72a86c6 100644 --- a/applications/test/Function1/Make/options +++ b/applications/test/Function1/Make/options @@ -9,7 +9,6 @@ EXE_INC = \ EXE_LIBS = \ -llagrangianIntermediate \ -lradiationModels \ - -lthermophysicalFunctions \ -lregionModels \ -lfiniteVolume \ -lmeshTools \ diff --git a/applications/test/Hashing/Test-Hashing.C b/applications/test/Hashing/Test-Hashing.C index 0ab7e9a7cb..4461679d08 100644 --- a/applications/test/Hashing/Test-Hashing.C +++ b/applications/test/Hashing/Test-Hashing.C @@ -42,13 +42,44 @@ Description using namespace Foam; +void infoHashString +( + unsigned modulus, + std::initializer_list lst +) +{ + if (modulus) + { + Info<< "basic string hashing (mod " << label(modulus) << ")" << endl; + + for (const auto& str : lst) + { + Info<<"hash(" << str.c_str() << ")=" + << (Hash()(str) % modulus) << nl; + } + + } + else + { + Info<< "basic string hashing" << nl; + + for (const auto& str : lst) + { + Info<<"hash(" << str.c_str() << ")=" + << Hash()(str) << nl; + } + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: int main(int argc, char *argv[]) { - IFstream is("hashingTests"); + infoHashString(8, {"asdathis1", "adsxf", "hij", "klmpq"}); + IFstream is("hashingTests"); while (is.good()) { diff --git a/applications/test/NamedEnum/Test-NamedEnum.C b/applications/test/NamedEnum/Test-NamedEnum.C index 08d1f74972..d0b7f58d79 100644 --- a/applications/test/NamedEnum/Test-NamedEnum.C +++ b/applications/test/NamedEnum/Test-NamedEnum.C @@ -26,6 +26,7 @@ Description \*---------------------------------------------------------------------------*/ #include "NamedEnum.H" +#include "Enum.H" #include "IOstreams.H" using namespace Foam; @@ -34,15 +35,27 @@ class namedEnumTest { public: - enum option + enum class option { - a, - b, - c, - d + A, + B, + C, + D }; - static const Foam::NamedEnum namedEnum; + enum class otherOption + { + A, + B, + C, + D + }; + + static const Foam::NamedEnum optionNamed; + + static const Foam::Enum optionEnum; + + static const Foam::Enum