From 808aced503d2c730a971a101135e214a4d1a049e Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Mar 2014 16:46:38 +0000 Subject: [PATCH 01/12] ENH: redistributePar: start with all patches present --- .../redistributePar/loadOrCreateMesh.C | 246 ++++++++++-------- 1 file changed, 143 insertions(+), 103 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index 136dea38..aa792712 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,10 +25,19 @@ License #include "loadOrCreateMesh.H" #include "processorPolyPatch.H" +#include "processorCyclicPolyPatch.H" #include "Time.H" +#include "IOPtrList.H" // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // +namespace Foam +{ + defineTemplateTypeNameAndDebug(IOPtrList, 0); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // Read mesh if available. Otherwise create empty mesh with same non-proc // patches as proc0 mesh. Requires all processors to have all patches // (and in same order). @@ -48,11 +57,68 @@ Foam::autoPtr Foam::loadOrCreateMesh meshSubDir = io.name()/polyMesh::meshSubDir; } + + // Scatter master patches + PtrList patchEntries; + if (Pstream::master()) + { + // Read PtrList of dictionary as dictionary. + const word oldTypeName = IOPtrList::typeName; + const_cast(IOPtrList::typeName) = word::null; + IOPtrList dictList + ( + IOobject + ( + "boundary", + io.time().findInstance + ( + meshSubDir, + "boundary", + IOobject::MUST_READ + ), + meshSubDir, + io.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + const_cast(IOPtrList::typeName) = oldTypeName; + // Fake type back to what was in field + const_cast(dictList.type()) = dictList.headerClassName(); + + patchEntries.transfer(dictList); + + // Send patches + for + ( + int slave=Pstream::firstSlave(); + slave<=Pstream::lastSlave(); + slave++ + ) + { + OPstream toSlave(Pstream::scheduled, slave); + toSlave << patchEntries; + } + } + else + { + // Receive patches + IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); + fromMaster >> patchEntries; + } + + + // Check who has a mesh const bool haveMesh = isDir(io.time().path()/io.instance()/meshSubDir); if (!haveMesh) { + bool oldParRun = Pstream::parRun(); + Pstream::parRun() = false; + + // Create dummy mesh. Only used on procs that don't have mesh. IOobject noReadIO(io); noReadIO.readOpt() = IOobject::NO_READ; @@ -65,6 +131,39 @@ Foam::autoPtr Foam::loadOrCreateMesh xferCopy(labelList()), false ); + + // Add patches + List patches(patchEntries.size()); + label nPatches = 0; + + forAll(patchEntries, patchI) + { + const entry& e = patchEntries[patchI]; + const word type(e.dict().lookup("type")); + const word& name = e.keyword(); + + if + ( + type != processorPolyPatch::typeName + && type != processorCyclicPolyPatch::typeName + ) + { + dictionary patchDict(e.dict()); + patchDict.set("nFaces", 0); + patchDict.set("startFace", 0); + + patches[patchI] = polyPatch::New + ( + name, + patchDict, + nPatches++, + dummyMesh.boundaryMesh() + ).ptr(); + } + } + patches.setSize(nPatches); + dummyMesh.addFvPatches(patches, false); // no parallel comms + // Add some dummy zones so upon reading it does not read them // from the undecomposed case. Should be done as extra argument to // regIOobject::readStream? @@ -106,6 +205,8 @@ Foam::autoPtr Foam::loadOrCreateMesh //Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath() // << endl; dummyMesh.write(); + + Pstream::parRun() = oldParRun; } //Pout<< "Reading mesh from " << io.objectPath() << endl; @@ -116,118 +217,57 @@ Foam::autoPtr Foam::loadOrCreateMesh // Sync patches // ~~~~~~~~~~~~ - if (Pstream::master()) + if (!Pstream::master() && haveMesh) { - // Send patches - for - ( - int slave=Pstream::firstSlave(); - slave<=Pstream::lastSlave(); - slave++ - ) + // Check master names against mine + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + forAll(patchEntries, patchI) { - OPstream toSlave(Pstream::scheduled, slave); - toSlave << mesh.boundaryMesh(); - } - } - else - { - // Receive patches - IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); - PtrList patchEntries(fromMaster); + const entry& e = patchEntries[patchI]; + const word type(e.dict().lookup("type")); + const word& name = e.keyword(); - if (haveMesh) - { - // Check master names against mine - - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - - forAll(patchEntries, patchI) + if (type == processorPolyPatch::typeName) { - const entry& e = patchEntries[patchI]; - const word type(e.dict().lookup("type")); - const word& name = e.keyword(); - - if (type == processorPolyPatch::typeName) - { - break; - } - - if (patchI >= patches.size()) - { - FatalErrorIn - ( - "createMesh(const Time&, const fileName&, const bool)" - ) << "Non-processor patches not synchronised." - << endl - << "Processor " << Pstream::myProcNo() - << " has only " << patches.size() - << " patches, master has " - << patchI - << exit(FatalError); - } - - if - ( - type != patches[patchI].type() - || name != patches[patchI].name() - ) - { - FatalErrorIn - ( - "createMesh(const Time&, const fileName&, const bool)" - ) << "Non-processor patches not synchronised." - << endl - << "Master patch " << patchI - << " name:" << type - << " type:" << type << endl - << "Processor " << Pstream::myProcNo() - << " patch " << patchI - << " has name:" << patches[patchI].name() - << " type:" << patches[patchI].type() - << exit(FatalError); - } + break; } - } - else - { - // Add patch - List patches(patchEntries.size()); - label nPatches = 0; - forAll(patchEntries, patchI) + if (patchI >= patches.size()) { - const entry& e = patchEntries[patchI]; - const word type(e.dict().lookup("type")); - const word& name = e.keyword(); - - if (type == processorPolyPatch::typeName) - { - break; - } - - //Pout<< "Adding patch:" << nPatches - // << " name:" << name << " type:" << type << endl; - - dictionary patchDict(e.dict()); - patchDict.remove("nFaces"); - patchDict.add("nFaces", 0); - patchDict.remove("startFace"); - patchDict.add("startFace", 0); - - patches[patchI] = polyPatch::New + FatalErrorIn ( - name, - patchDict, - nPatches++, - mesh.boundaryMesh() - ).ptr(); + "createMesh(const Time&, const fileName&, const bool)" + ) << "Non-processor patches not synchronised." + << endl + << "Processor " << Pstream::myProcNo() + << " has only " << patches.size() + << " patches, master has " + << patchI + << exit(FatalError); } - patches.setSize(nPatches); - mesh.addFvPatches(patches, false); // no parallel comms - //// Write empty mesh now we have correct patches - //meshPtr().write(); + if + ( + type != patches[patchI].type() + || name != patches[patchI].name() + ) + { + FatalErrorIn + ( + "createMesh(const Time&, const fileName&, const bool)" + ) << "Non-processor patches not synchronised." + << endl + << "Master patch " << patchI + << " name:" << type + << " type:" << type << endl + << "Processor " << Pstream::myProcNo() + << " patch " << patchI + << " has name:" << patches[patchI].name() + << " type:" << patches[patchI].type() + << exit(FatalError); + } } } From 712d960b8611a3cc7622b12eb1944ef8a52cc98c Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Mar 2014 16:50:42 +0000 Subject: [PATCH 02/12] BUG: refinementHistory: access outside range --- .../polyTopoChange/refinementHistory.C | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C index 1c7d63e6..8e9e844c 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C @@ -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 @@ -649,22 +649,20 @@ void Foam::refinementHistory::countProc // Increment parent if whole splitCell moves to same processor if (splitCellNum[index] == 8) { - Pout<< "Moving " << splitCellNum[index] - << " cells originating from cell " << index - << " from processor " << Pstream::myProcNo() - << " to processor " << splitCellProc[index] - << endl; + if (debug) + { + Pout<< "Moving " << splitCellNum[index] + << " cells originating from cell " << index + << " from processor " << Pstream::myProcNo() + << " to processor " << splitCellProc[index] + << endl; + } label parent = splitCells_[index].parent_; if (parent >= 0) { - string oldPrefix = Pout.prefix(); - Pout.prefix() = " " + oldPrefix; - countProc(parent, newProcNo, splitCellProc, splitCellNum); - - Pout.prefix() = oldPrefix; } } } @@ -924,7 +922,10 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map) forAll(newVisibleCells, i) { - visibleCells_[constructMap[i]] = newVisibleCells[i] + offset; + if (newVisibleCells[i] >= 0) + { + visibleCells_[constructMap[i]] = newVisibleCells[i] + offset; + } } } splitCells_.shrink(); From 81a240af8c1e9ae7ff393b9fa1cb7128fb8a1300 Mon Sep 17 00:00:00 2001 From: william Date: Fri, 21 Mar 2014 10:02:06 +0000 Subject: [PATCH 03/12] BUG: LaheyKEpsilon: fixed incorrect multiple of alpha*rho added in commit 13cdbe3 --- .../phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C index 83edf7de..91c401ee 100644 --- a/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C +++ b/src/TurbulenceModels/phaseIncompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C @@ -194,7 +194,6 @@ tmp LaheyKEpsilon::bubbleG() const tmp bubbleG ( Cp_ - *liquid*liquid.rho() *( pow3(magUr) + pow(fluid.drag(gas).CdRe()*liquid.nu()/gas.d(), 4.0/3.0) From 9d0ee459184976e87290028c7c4d6c746a5a1d02 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 21 Mar 2014 10:33:34 +0000 Subject: [PATCH 04/12] Updated floatingObject boundary condition to handle tangential flow at surface in a more stable manner. --- .../oscillatingBox/0.org/U | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/0.org/U b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/0.org/U index 695fc93f..e6b10c7c 100644 --- a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/0.org/U +++ b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/0.org/U @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 2.3.0 | +| \\ / O peration | Version: 2.3.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -33,16 +33,25 @@ boundaryField } floatingObject { - type oscillatingFixedValue; - refValue uniform (0 1 0); - offset (0 -1 0); - amplitude table - ( - ( 0 0) - ( 10 0.025) - (1000 0.025) - ); - frequency constant 1; + type fixedNormalInletOutletVelocity; + + fixTangentialInflow false; + + normalVelocity + { + type oscillatingFixedValue; + refValue uniform (0 1 0); + offset (0 -1 0); + amplitude table + ( + ( 0 0) + ( 10 0.025) + (1000 0.025) + ); + frequency constant 1; + value uniform (0 0 0); + } + value uniform (0 0 0); } frontAndBack From b4c22cc0acd4740ab85d9ba643ab69bb01c868f8 Mon Sep 17 00:00:00 2001 From: william Date: Mon, 24 Mar 2014 10:30:41 +0000 Subject: [PATCH 05/12] ENH: twoPhaseEulerFoam: Added Johnson-Jackson slip and granular temperature BCs --- .../Make/files | 3 + ...sonJacksonParticleSlipFvPatchVectorField.C | 258 ++++++++++++++ ...sonJacksonParticleSlipFvPatchVectorField.H | 177 ++++++++++ ...onJacksonParticleThetaFvPatchScalarField.C | 320 ++++++++++++++++++ ...onJacksonParticleThetaFvPatchScalarField.H | 179 ++++++++++ 5 files changed, 937 insertions(+) create mode 100644 applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C create mode 100644 applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H create mode 100644 applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C create mode 100644 applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files index 96f9c63e..2a3a6a96 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/Make/files @@ -32,4 +32,7 @@ kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStr kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C + LIB = $(FOAM_LIBBIN)/libphaseIncompressibleTurbulenceModels diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C new file mode 100644 index 00000000..2a81a553 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "JohnsonJacksonParticleSlipFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "twoPhaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + JohnsonJacksonParticleSlipFvPatchVectorField + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + partialSlipFvPatchVectorField(p, iF), + specularityCoefficient_(p.size()) +{} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const JohnsonJacksonParticleSlipFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + partialSlipFvPatchVectorField(ptf, p, iF, mapper), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + partialSlipFvPatchVectorField(p, iF), + specularityCoefficient_ + ( + "specularityCoefficient", + dimless, + dict.lookup("specularityCoefficient") + ) +{ + if + ( + (specularityCoefficient_.value() < 0) + || (specularityCoefficient_.value() > 1) + ) + { + FatalErrorIn + ( + "(" + "Foam::JohnsonJacksonParticleSlipFvPatchVectorField::" + "JohnsonJacksonParticleSlipFvPatchVectorField" + "const fvPatch& p," + "const DimensionedField& iF," + "const dictionary& dict" + ")" + ) << "The specularity coefficient has to be between 0 and 1" + << abort(FatalError); + } + + if (dict.found("value")) + { + fvPatchVectorField::operator= + ( + vectorField("value", dict, p.size()) + ); + } + else + { + partialSlipFvPatchVectorField::evaluate(); + } +} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const JohnsonJacksonParticleSlipFvPatchVectorField& ptf +) +: + partialSlipFvPatchVectorField(ptf), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const JohnsonJacksonParticleSlipFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + partialSlipFvPatchVectorField(ptf, iF), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + partialSlipFvPatchVectorField::autoMap(m); +} + + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + partialSlipFvPatchVectorField::rmap(ptf, addr); +} + + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // lookup the fluid model and the phase + const twoPhaseSystem& fluid = db().lookupObject + ( + "phaseProperties" + ); + + const phaseModel& phased + ( + fluid.phase1().name() == dimensionedInternalField().group() + ? fluid.phase1() + : fluid.phase2() + ); + + // lookup all the fields on this patch + const fvPatchScalarField& alpha + ( + patch().lookupPatchField + ( + phased.volScalarField::name() + ) + ); + + const fvPatchScalarField& gs0 + ( + patch().lookupPatchField + ( + IOobject::groupName("gs0", phased.name()) + ) + ); + + const scalarField nu + ( + phased.nu()->boundaryField()[patch().index()] + ); + + word ThetaName(IOobject::groupName("Theta", phased.name())); + + const fvPatchScalarField& Theta + ( + db().foundObject(ThetaName) + ? patch().lookupPatchField(ThetaName) + : alpha + ); + + // lookup the packed volume fraction + dimensionedScalar alphaMax + ( + "alphaMax", + dimless, + db() + .lookupObject + ( + IOobject::groupName("turbulenceProperties", phased.name()) + ) + .subDict("RAS") + .subDict("kineticTheoryCoeffs") + .lookup("alphaMax") + ); + + // calculate the slip value fraction + scalarField c + ( + constant::mathematical::pi + *alpha + *gs0 + *specularityCoefficient_.value() + *sqrt(3.0*Theta) + /max(6.0*nu*alphaMax.value(), SMALL) + ); + + this->valueFraction() = c/(c + patch().deltaCoeffs()); + + partialSlipFvPatchVectorField::updateCoeffs(); +} + + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write +( + Ostream& os +) const +{ + partialSlipFvPatchVectorField::write(os); + os.writeKeyword("specularityCoefficient") + << specularityCoefficient_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H new file mode 100644 index 00000000..9d3bc14a --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::JohnsonJacksonParticleSlipFvPatchVectorField + +Description + Partial slip boundary condition for the particulate velocity. + + References: + \verbatim + "Multifluid Eulerian modeling of dense gas–solids fluidized bed + hydrodynamics: Influence of the dissipation parameters" + N Reuge + Chemical Engineering Science + Volume 63, Issue 22, Pages 5540-5551, November 2008 + \endverbatim + + \verbatim + "Frictional-collisional constitutive relations for granular materials, + with application to plane shearing" + P C Johnson and R Jackson + Journal of Fluid Mechanics + Volume 176, Pages 67-93, March 1987 + \endverbatim + +SourceFiles + JohnsonJacksonParticleSlipFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonParticleSlipFvPatchVectorField_H +#define JohnsonJacksonParticleSlipFvPatchVectorField_H + +#include "partialSlipFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonParticleSlipFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonParticleSlipFvPatchVectorField +: + public partialSlipFvPatchVectorField +{ + // Private data + + //- Specularity coefficient + dimensionedScalar specularityCoefficient_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonParticleSlip"); + + + // Constructors + + //- Construct from patch and internal field + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping onto a new patch + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new JohnsonJacksonParticleSlipFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new JohnsonJacksonParticleSlipFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + //- Update the coefficients + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C new file mode 100644 index 00000000..73bc22a1 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -0,0 +1,320 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "JohnsonJacksonParticleThetaFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "twoPhaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + JohnsonJacksonParticleThetaFvPatchScalarField + ); +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF), + restitutionCoefficient_(p.size()), + specularityCoefficient_(p.size()) +{} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const JohnsonJacksonParticleThetaFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(ptf, p, iF, mapper), + restitutionCoefficient_(ptf.restitutionCoefficient_), + specularityCoefficient_(ptf.specularityCoefficient_) +{ +} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF), + restitutionCoefficient_ + ( + "restitutionCoefficient", + dimless, + dict.lookup("restitutionCoefficient") + ), + specularityCoefficient_ + ( + "specularityCoefficient", + dimless, + dict.lookup("specularityCoefficient") + ) +{ + if + ( + (restitutionCoefficient_.value() < 0) + || (restitutionCoefficient_.value() > 1) + ) + { + FatalErrorIn + ( + "Foam::JohnsonJacksonParticleThetaFvPatchScalarField::" + "JohnsonJacksonParticleThetaFvPatchScalarField" + "(" + "const fvPatch& p," + "const DimensionedField& iF," + "const dictionary& dict" + ")" + ) << "The restitution coefficient has to be between 0 and 1" + << abort(FatalError); + } + + if + ( + (specularityCoefficient_.value() < 0) + || (specularityCoefficient_.value() > 1) + ) + { + FatalErrorIn + ( + "Foam::JohnsonJacksonParticleThetaFvPatchScalarField::" + "JohnsonJacksonParticleThetaFvPatchScalarField" + "(" + "const fvPatch& p," + "const DimensionedField& iF," + "const dictionary& dict" + ")" + ) << "The specularity coefficient has to be between 0 and 1" + << abort(FatalError); + } + + if (dict.found("value")) + { + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); + } + else + { + evaluate(); + } +} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const JohnsonJacksonParticleThetaFvPatchScalarField& ptf +) +: + mixedFvPatchScalarField(ptf), + restitutionCoefficient_(ptf.restitutionCoefficient_), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const JohnsonJacksonParticleThetaFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(ptf, iF), + restitutionCoefficient_(ptf.restitutionCoefficient_), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + mixedFvPatchScalarField::autoMap(m); +} + + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + mixedFvPatchScalarField::rmap(ptf, addr); +} + + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // lookup the fluid model and the phase + const twoPhaseSystem& fluid = db().lookupObject + ( + "phaseProperties" + ); + + const phaseModel& phased + ( + fluid.phase1().name() == dimensionedInternalField().group() + ? fluid.phase1() + : fluid.phase2() + ); + + // lookup all the fields on this patch + const fvPatchScalarField& alpha + ( + patch().lookupPatchField + ( + phased.volScalarField::name() + ) + ); + + const fvPatchVectorField& U + ( + patch().lookupPatchField + ( + IOobject::groupName("U", phased.name()) + ) + ); + + const fvPatchScalarField& gs0 + ( + patch().lookupPatchField + ( + IOobject::groupName("gs0", phased.name()) + ) + ); + + const fvPatchScalarField& kappa + ( + patch().lookupPatchField + ( + IOobject::groupName("kappa", phased.name()) + ) + ); + + const scalarField Theta(patchInternalField()); + + // lookup the packed volume fraction + dimensionedScalar alphaMax + ( + "alphaMax", + dimless, + db() + .lookupObject + ( + IOobject::groupName("turbulenceProperties", phased.name()) + ) + .subDict("RAS") + .subDict("kineticTheoryCoeffs") + .lookup("alphaMax") + ); + + // calculate the reference value and the value fraction + if (restitutionCoefficient_.value() != 1.0) + { + this->refValue() = + (2.0/3.0) + *specularityCoefficient_.value() + *magSqr(U) + /(scalar(1) - sqr(restitutionCoefficient_.value())); + + this->refGrad() = 0.0; + + scalarField c + ( + constant::mathematical::pi + *alpha + *gs0 + *(scalar(1) - sqr(restitutionCoefficient_.value())) + *sqrt(3.0*Theta) + /max(4.0*kappa*alphaMax.value(), SMALL) + ); + + this->valueFraction() = c/(c + patch().deltaCoeffs()); + } + + // for a restitution coefficient of 1, the boundary degenerates to a fixed + // gradient condition + else + { + this->refValue() = 0.0; + + this->refGrad() = + pos(alpha - SMALL) + *constant::mathematical::pi + *specularityCoefficient_.value() + *alpha + *gs0 + *sqrt(3.0*Theta) + *magSqr(U) + /max(6.0*kappa*alphaMax.value(), SMALL); + + this->valueFraction() = 0.0; + } + + mixedFvPatchScalarField::updateCoeffs(); +} + + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write +( + Ostream& os +) const +{ + // ... + + mixedFvPatchScalarField::write(os); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H new file mode 100644 index 00000000..9c75efd9 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::JohnsonJacksonParticleThetaFvPatchScalarField + +Description + Robin condition for the particulate granular temperature. + + References: + \verbatim + "Multifluid Eulerian modeling of dense gas–solids fluidized bed + hydrodynamics: Influence of the dissipation parameters" + N Reuge + Chemical Engineering Science + Volume 63, Issue 22, Pages 5540-5551, November 2008 + \endverbatim + + \verbatim + "Frictional-collisional constitutive relations for granular materials, + with application to plane shearing" + P C Johnson and R Jackson + Journal of Fluid Mechanics + Volume 176, Pages 67-93, March 1987 + \endverbatim + +SourceFiles + JohnsonJacksonParticleThetaFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonParticleThetaFvPatchScalarField_H +#define JohnsonJacksonParticleThetaFvPatchScalarField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonParticleThetaFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonParticleThetaFvPatchScalarField +: + public mixedFvPatchScalarField +{ + // Private data + + //- Particle-wall restitution coefficient + dimensionedScalar restitutionCoefficient_; + + //- Specularity coefficient + dimensionedScalar specularityCoefficient_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonParticleTheta"); + + + // Constructors + + //- Construct from patch and internal field + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping onto a new patch + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new JohnsonJacksonParticleThetaFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new JohnsonJacksonParticleThetaFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + //- Update the coefficients + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From a07e04cdb65caea5520f5b66babb86aafad64d13 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 25 Mar 2014 14:36:18 +0000 Subject: [PATCH 06/12] BUG: twoPhaseEulerFoam: Fixed JohnsonJackson Theta BC write --- .../JohnsonJacksonParticleThetaFvPatchScalarField.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 73bc22a1..87789ac8 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -311,9 +311,12 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write Ostream& os ) const { - // ... - mixedFvPatchScalarField::write(os); + os.writeKeyword("restitutionCoefficient") + << restitutionCoefficient_ << token::END_STATEMENT << nl; + os.writeKeyword("specularityCoefficient") + << specularityCoefficient_ << token::END_STATEMENT << nl; + writeEntry("value", os); } From 7cc1ed27b3d9033cb9394f5b44a23e8db97138b8 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 25 Mar 2014 16:06:03 +0000 Subject: [PATCH 07/12] BUG: driftFluxFoam: removed divide by alpha from general Udm model --- .../driftFluxFoam/relativeVelocityModels/general/general.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C index c260bf85..b3d46e1e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/general/general.C @@ -70,8 +70,7 @@ void Foam::relativeVelocityModels::general::correct() *( exp(-a_*max(alphad_ - residualAlpha_, scalar(0))) - exp(-a1_*max(alphad_ - residualAlpha_, scalar(0))) - ) - /max(alphac_, residualAlpha_); + ); } From c957f2450d5d5b7f638781f8b8d9099163c55f16 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Mar 2014 12:48:37 +0000 Subject: [PATCH 08/12] continuousGasKEpsilon: Omega now consistent with Lahey 2005 paper --- .../continuousGasKEpsilon/continuousGasKEpsilon.C | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C index b6eef980..b3b453d6 100644 --- a/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C +++ b/src/TurbulenceModels/phaseIncompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C @@ -124,9 +124,17 @@ void continuousGasKEpsilon::correctNut() const transportModel& liquid = fluid.otherPhase(gas); volScalarField thetal(liquidTurbulence.k()/liquidTurbulence.epsilon()); - volScalarField thetag((1.0/(18*liquid.nu()))*sqr(gas.d())); - volScalarField expThetar(exp(min(thetal/thetag, scalar(50)))); - volScalarField omega(sqr(expThetar - 1)/(sqr(expThetar) - 1)); + volScalarField rhodv(gas.rho() + fluid.virtualMass(gas).Cvm()*liquid.rho()); + volScalarField thetag((rhodv/(18*liquid.rho()*liquid.nu()))*sqr(gas.d())); + volScalarField expThetar + ( + min + ( + exp(min(thetal/thetag, scalar(50))), + scalar(1) + ) + ); + volScalarField omega((1 - expThetar)/(1 + expThetar)); nutEff_ = omega*liquidTurbulence.nut(); } From 962bb79676c3a56cd1620ac79c705fade3bc423d Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Mar 2014 12:49:18 +0000 Subject: [PATCH 09/12] driftFluxFoam: Changed the laminar viscosity used in the k-epsilon model that of the mixture --- .../multiphase/driftFluxFoam/driftFluxFoam.C | 1 - .../multiphase/driftFluxFoam/kEpsilon.H | 20 ++++++++++--------- .../multiphase/driftFluxFoam/wallFunctions.H | 4 ++-- .../multiphase/driftFluxFoam/wallViscosity.H | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index da03517e..8ab48d7b 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -87,7 +87,6 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" twoPhaseProperties.correct(); - Info<< average(twoPhaseProperties.mu()) << endl; #include "UEqn.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H index 66216b87..ddcc8cf2 100644 --- a/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H +++ b/applications/solvers/multiphase/driftFluxFoam/kEpsilon.H @@ -10,8 +10,6 @@ if (turbulence) dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), 0); dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL); - volScalarField divU(fvc::div(phi)); - tmp tgradU = fvc::grad(U); volScalarField G(mut*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); @@ -21,7 +19,7 @@ if (turbulence) Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin) ); - volScalarField muc(twoPhaseProperties.nucModel().nu()*rho2); + volScalarField mul(twoPhaseProperties.mu()); #include "wallFunctions.H" @@ -32,12 +30,12 @@ if (turbulence) + fvm::div(rhoPhi, epsilon) - fvm::laplacian ( - mut/sigmaEps + muc, epsilon, + mut/sigmaEps + mul, epsilon, "laplacian(DepsilonEff,epsilon)" ) == C1*G*epsilon/(k + kMin) - - fvm::SuSp(C1*(1.0 - C3)*Gcoef + (2.0/3.0*C1)*rho*divU, epsilon) + - fvm::SuSp(C1*(1.0 - C3)*Gcoef, epsilon) - fvm::Sp(C2*rho*epsilon/(k + kMin), epsilon) ); @@ -56,12 +54,12 @@ if (turbulence) + fvm::div(rhoPhi, k) - fvm::laplacian ( - mut/sigmak + muc, k, + mut/sigmak + mul, k, "laplacian(DkEff,k)" ) == G - - fvm::SuSp(Gcoef + 2.0/3.0*rho*divU, k) + - fvm::SuSp(Gcoef, k) - fvm::Sp(rho*epsilon/(k + kMin), k) ); @@ -75,6 +73,10 @@ if (turbulence) mut = rho*Cmu*sqr(k)/(epsilon + epsilonMin); #include "wallViscosity.H" -} -muEff = mut + twoPhaseProperties.mu(); + muEff = mut + mul; +} +else +{ + muEff = mut + twoPhaseProperties.mu(); +} diff --git a/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H b/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H index b9ff8481..2a064b47 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallFunctions.H @@ -33,7 +33,7 @@ if (isA(curPatch)) { const scalarField& mutw = mut.boundaryField()[patchi]; - const scalarField& mucw = muc.boundaryField()[patchi]; + const scalarField& mulw = mul.boundaryField()[patchi]; scalarField magFaceGradU ( @@ -55,7 +55,7 @@ /(kappa_*y[patchi][facei]); G[faceCelli] += - (mutw[facei] + mucw[facei]) + (mutw[facei] + mulw[facei]) *magFaceGradU[facei] *Cmu25*::sqrt(k[faceCelli]) /(kappa_*y[patchi][facei]); diff --git a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H index 2b54f6c2..d73e0a5d 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H @@ -12,7 +12,7 @@ if (isA(curPatch)) { scalarField& mutw = mut.boundaryField()[patchi]; - const scalarField& mucw = muc.boundaryField()[patchi]; + const scalarField& mulw = mul.boundaryField()[patchi]; forAll(curPatch, facei) { @@ -20,12 +20,12 @@ scalar yPlus = Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) - /(mucw[facei]/rho2.value()); + /(mulw[facei]/rho2.value()); if (yPlus > 11.6) { mutw[facei] = - mucw[facei]*(yPlus*kappa_/::log(E_*yPlus) - 1); + mulw[facei]*(yPlus*kappa_/::log(E_*yPlus) - 1); } else { From 840078c02e073350059dad00fe2f8638174e2245 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Mar 2014 14:31:09 +0000 Subject: [PATCH 10/12] driftFluxFoam: corrected density to get kinematic viscosity for yPlus --- applications/solvers/multiphase/driftFluxFoam/wallViscosity.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H index d73e0a5d..b75db346 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H @@ -20,7 +20,7 @@ scalar yPlus = Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) - /(mulw[facei]/rho2.value()); + /(mulw[facei]/rho[facei]); if (yPlus > 11.6) { From 43841790346c8f52a0188899eb6189b671a08b8e Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Mar 2014 15:19:39 +0000 Subject: [PATCH 11/12] Corrected rho used for yPlus --- applications/solvers/multiphase/driftFluxFoam/wallViscosity.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H index b75db346..632432ff 100644 --- a/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H +++ b/applications/solvers/multiphase/driftFluxFoam/wallViscosity.H @@ -13,6 +13,7 @@ { scalarField& mutw = mut.boundaryField()[patchi]; const scalarField& mulw = mul.boundaryField()[patchi]; + const scalarField& rhow = rho.boundaryField()[patchi]; forAll(curPatch, facei) { @@ -20,7 +21,7 @@ scalar yPlus = Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) - /(mulw[facei]/rho[facei]); + /(mulw[facei]/rhow[facei]); if (yPlus > 11.6) { From 0f873c5a312e291c16836383439c5b623da57bfc Mon Sep 17 00:00:00 2001 From: william Date: Thu, 27 Mar 2014 11:58:15 +0000 Subject: [PATCH 12/12] BUG: twoPhaseEulerFoam: Fixed JohnsonJackson BCs write --- .../JohnsonJacksonParticleSlipFvPatchVectorField.C | 2 +- .../JohnsonJacksonParticleThetaFvPatchScalarField.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index 2a81a553..c9549399 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -248,7 +248,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write Ostream& os ) const { - partialSlipFvPatchVectorField::write(os); + fvPatchVectorField::write(os); os.writeKeyword("specularityCoefficient") << specularityCoefficient_ << token::END_STATEMENT << nl; writeEntry("value", os); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 87789ac8..4369c4ad 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -311,7 +311,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write Ostream& os ) const { - mixedFvPatchScalarField::write(os); + fvPatchScalarField::write(os); os.writeKeyword("restitutionCoefficient") << restitutionCoefficient_ << token::END_STATEMENT << nl; os.writeKeyword("specularityCoefficient")