diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H index 1c4aa0a1..d9345cd9 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqn.H @@ -19,16 +19,7 @@ ).fvmDiv(phi, alpha1) ); - solve - ( - alpha1Eqn - - fv::gaussLaplacianScheme - ( - mesh, - linear(mesh), - fv::uncorrectedSnGrad(mesh) - ).fvmLaplacian(fvc::interpolate(turbulence->nut()), alpha1) - ); + solve(alpha1Eqn); Info<< "Phase-1 volume fraction = " << alpha1.weightedAverage(mesh.Vsc()).value() @@ -42,6 +33,7 @@ if (alphaApplyPrevCorr && tphiAlphaCorr0.valid()) { Info<< "Applying the previous iteration correction flux" << endl; + #ifdef LTSSOLVE MULES::LTScorrect ( diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H index 8ad3234a..4d889f12 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H @@ -50,7 +50,6 @@ // Apply the diffusion term separately to allow implicit solution // and boundedness of the explicit advection - if (!MULESCorr) { fvScalarMatrix alpha1Eqn ( diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 42be066e..d611ff0e 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -503,6 +503,7 @@ $(mapPolyMesh)/faceMapper/faceMapper.C $(mapPolyMesh)/cellMapper/cellMapper.C $(mapPolyMesh)/mapDistribute/mapDistribute.C $(mapPolyMesh)/mapDistribute/mapDistributePolyMesh.C +$(mapPolyMesh)/mapDistribute/IOmapDistribute.C $(mapPolyMesh)/mapAddedPolyMesh.C PrimitivePatch = $(primitiveMesh)/PrimitivePatch diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C new file mode 100644 index 00000000..bb057b63 --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "IOmapDistribute.H" + +/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(IOmapDistribute, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::IOmapDistribute::IOmapDistribute(const IOobject& io) +: + regIOobject(io) +{ + // Temporary warning + if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED) + { + WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)") + << "IOmapDistribute " << name() + << " constructed with IOobject::MUST_READ_IF_MODIFIED" + " but IOmapDistribute does not support automatic rereading." + << endl; + } + + if + ( + ( + io.readOpt() == IOobject::MUST_READ + || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED + ) + || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) + ) + { + readStream(typeName) >> *this; + close(); + } +} + + +Foam::IOmapDistribute::IOmapDistribute +( + const IOobject& io, + const mapDistribute& map +) +: + regIOobject(io) +{ + // Temporary warning + if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED) + { + WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)") + << "IOmapDistribute " << name() + << " constructed with IOobject::MUST_READ_IF_MODIFIED" + " but IOmapDistribute does not support automatic rereading." + << endl; + } + + if + ( + ( + io.readOpt() == IOobject::MUST_READ + || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED + ) + || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) + ) + { + readStream(typeName) >> *this; + close(); + } + else + { + mapDistribute::operator=(map); + } +} + + +Foam::IOmapDistribute::IOmapDistribute +( + const IOobject& io, + const Xfer& map +) +: + regIOobject(io) +{ + // Temporary warning + if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED) + { + WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)") + << "IOmapDistribute " << name() + << " constructed with IOobject::MUST_READ_IF_MODIFIED" + " but IOmapDistribute does not support automatic rereading." + << endl; + } + + mapDistribute::transfer(map()); + + if + ( + ( + io.readOpt() == IOobject::MUST_READ + || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED + ) + || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) + ) + { + readStream(typeName) >> *this; + close(); + } +} + + +// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // + +Foam::IOmapDistribute::~IOmapDistribute() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::IOmapDistribute::readData(Istream& is) +{ + return (is >> *this).good(); +} + + +bool Foam::IOmapDistribute::writeData(Ostream& os) const +{ + return (os << *this).good(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H new file mode 100644 index 00000000..271fb062 --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::IOmapDistribute + +Description + IOmapDistribute is derived from mapDistribute and + IOobject to give the mapDistribute + automatic IO functionality via the objectRegistry. + +SourceFiles + IOmapDistribute.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IOmapDistribute_H +#define IOmapDistribute_H + +#include "mapDistribute.H" +#include "regIOobject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IOmapDistribute Declaration +\*---------------------------------------------------------------------------*/ + +class IOmapDistribute +: + public regIOobject, + public mapDistribute +{ + +public: + + //- Runtime type information + TypeName("mapDistribute"); + + // Constructors + + //- Construct given an IOobject + IOmapDistribute(const IOobject&); + + //- Construct given an IOobject and mapDistribute + IOmapDistribute(const IOobject&, const mapDistribute&); + + //- Construct by transferring the mapDistribute contents + IOmapDistribute(const IOobject&, const Xfer&); + + + //- Destructor + virtual ~IOmapDistribute(); + + + // Member functions + + //- ReadData function required for regIOobject read operation + virtual bool readData(Istream&); + + //- WriteData function required for regIOobject write operation + virtual bool writeData(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index de842403..8feeefcf 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1341,4 +1341,31 @@ void Foam::mapDistribute::operator=(const mapDistribute& rhs) } +// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, mapDistribute& map) +{ + is.fatalCheck("operator>>(Istream&, mapDistribute&)"); + + is >> map.constructSize_ >> map.subMap_ >> map.constructMap_ + >> map.transformElements_ >> map.transformStart_; + + return is; +} + + +// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const mapDistribute& map) +{ + os << map.constructSize_ << token::NL + << map.subMap_ << token::NL + << map.constructMap_ << token::NL + << map.transformElements_ << token::NL + << map.transformStart_ << token::NL; + + return os; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H index 96004c3e..94953027 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -676,6 +676,15 @@ public: void operator=(const mapDistribute&); + + // IOstream operators + + //- Read dictionary from Istream + friend Istream& operator>>(Istream&, mapDistribute&); + + //- Write dictionary to Ostream + friend Ostream& operator<<(Ostream&, const mapDistribute&); + }; diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index e41c9bec..090c096d 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,6 +107,7 @@ void Foam::MULES::correct psiMax, psiMin, nLimiterIter ); + correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su); } @@ -172,6 +173,13 @@ void Foam::MULES::limiterCorr const fvMesh& mesh = psi.mesh(); + const dictionary& MULEScontrols = mesh.solverDict(psi.name()); + + scalar extremaCoeff + ( + MULEScontrols.lookupOrDefault("extremaCoeff", 0.0) + ); + const labelUList& owner = mesh.owner(); const labelUList& neighb = mesh.neighbour(); tmp tVsc = mesh.Vsc(); @@ -283,8 +291,8 @@ void Foam::MULES::limiterCorr } } - psiMaxn = min(psiMaxn, psiMax); - psiMinn = max(psiMinn, psiMin); + psiMaxn = min(psiMaxn + extremaCoeff*(psiMax - psiMin), psiMax); + psiMinn = max(psiMinn - extremaCoeff*(psiMax - psiMin), psiMin); // scalar smooth = 0.5; // psiMaxn = min((1.0 - smooth)*psiIf + smooth*psiMaxn, psiMax); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 402de941..f34f4b2f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -334,8 +334,14 @@ bool Foam::KinematicParcel::move p.stepFraction() = newStepFraction; + bool calcParcel = true; + if (!tracking && td.cloud().solution().steadyState()) + { + calcParcel = false; + } + // Avoid problems with extremely small timesteps - if (dt > ROOTVSMALL) + if ((dt > ROOTVSMALL) && calcParcel) { // Update cell based properties p.setCellValues(td, dt, cellI); diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 441aa3be..90b37e8d 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -700,4 +700,38 @@ Foam::label Foam::edgeIntersections::removeDegenerates } +void Foam::edgeIntersections::replace +( + const edgeIntersections& subInfo, + const labelList& edgeMap, + const labelList& faceMap +) +{ + forAll(subInfo, subI) + { + const List& subHits = subInfo[subI]; + const labelList& subClass = subInfo.classification()[subI]; + + label edgeI = edgeMap[subI]; + List& intersections = operator[](edgeI); + labelList& intersectionTypes = classification_[edgeI]; + + intersections.setSize(subHits.size()); + intersectionTypes.setSize(subHits.size()); + + forAll(subHits, i) + { + const pointIndexHit& subHit = subHits[i]; + intersections[i] = pointIndexHit + ( + subHit.hit(), + subHit.rawPoint(), + faceMap[subHit.index()] + ); + intersectionTypes[i] = subClass[i]; + } + } +} + + // ************************************************************************* // diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H index dc25f2e8..a2e088fd 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -197,6 +197,15 @@ public: const scalarField& surf1PointTol, pointField& points1 ); + + //- Replace edge intersection for a subset (given as edge map and + // face map - for face indices stored in pointIndexHit.index()) + void replace + ( + const edgeIntersections&, + const labelList& edgeMap, + const labelList& faceMap + ); }; diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 96f36417..eaaf8538 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -69,6 +69,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField q_(p.size(), 0.0), h_(p.size(), 0.0), Ta_(p.size(), 0.0), + QrName_("undefined-Qr"), thicknessLayers_(), kappaLayers_() { @@ -93,6 +94,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField q_(ptf.q_, mapper), h_(ptf.h_, mapper), Ta_(ptf.Ta_, mapper), + QrName_(ptf.QrName_), thicknessLayers_(ptf.thicknessLayers_), kappaLayers_(ptf.kappaLayers_) {} @@ -112,6 +114,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField q_(p.size(), 0.0), h_(p.size(), 0.0), Ta_(p.size(), 0.0), + QrName_(dict.lookupOrDefault("Qr", "none")), thicknessLayers_(), kappaLayers_() { @@ -181,6 +184,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField q_(tppsf.q_), h_(tppsf.h_), Ta_(tppsf.Ta_), + QrName_(tppsf.QrName_), thicknessLayers_(tppsf.thicknessLayers_), kappaLayers_(tppsf.kappaLayers_) {} @@ -199,6 +203,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField q_(tppsf.q_), h_(tppsf.h_), Ta_(tppsf.Ta_), + QrName_(tppsf.QrName_), thicknessLayers_(tppsf.thicknessLayers_), kappaLayers_(tppsf.kappaLayers_) {} @@ -245,6 +250,12 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() const scalarField Tp(*this); scalarField hp(patch().size(), 0.0); + scalarField Qr(Tp.size(), 0.0); + if (QrName_ != "none") + { + Qr = patch().lookupPatchField(QrName_); + } + switch (mode_) { case fixedHeatFlux: @@ -281,15 +292,17 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() if (mode_ == fixedHeatFlux) { - refGrad() = q_/kappa(Tp); + refGrad() = (q_ + Qr)/kappa(Tp); refValue() = 0.0; valueFraction() = 0.0; } else if (mode_ == fixedHeatTransferCoeff) { + Qr /= Tp; refGrad() = 0.0; - refValue() = Ta_; - valueFraction() = hp/(hp + kappa(Tp)*patch().deltaCoeffs()); + refValue() = hp*Ta_/(hp - Qr); + valueFraction() = + (hp - Qr)/((hp - Qr) + kappa(Tp)*patch().deltaCoeffs()); } mixedFvPatchScalarField::updateCoeffs(); @@ -318,9 +331,11 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write { mixedFvPatchScalarField::write(os); temperatureCoupledBase::write(os); + os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; switch (mode_) { + case fixedHeatFlux: { q_.writeEntry("q", os); diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index b4ca13a4..911a5549 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -60,6 +60,7 @@ Description thicknessLayers | list of thicknesses per layer [m] | yes | kappaLayers | list of thermal conductivites per layer [W/m/K] | yes | kappaName | name of thermal conductivity field | yes | + QrName | name of the radiative field | no | no \endtable Example of the boundary condition specification: @@ -75,6 +76,7 @@ Description kappaLayers (1 2 3 4) value uniform 300.0; kappaName none; + QrName none; } \endverbatim @@ -137,6 +139,9 @@ private: //- Ambient temperature / [K] scalarField Ta_; + //- Name of the radiative heat flux + const word QrName_; + //- Thickness of layers scalarList thicknessLayers_;