diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C index 84f32a85..e1d0b3d4 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C @@ -62,7 +62,7 @@ Foam::heatTransferModels::RanzMarshall::~RanzMarshall() Foam::tmp Foam::heatTransferModels::RanzMarshall::K() const { - volScalarField Nu(scalar(2) + 0.6*pair_.Re()*cbrt(pair_.Pr())); + volScalarField Nu(scalar(2) + 0.6*sqrt(pair_.Re())*cbrt(pair_.Pr())); return 6.0 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 c9549399..104201d4 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -199,7 +199,10 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() const scalarField nu ( - phased.nu()->boundaryField()[patch().index()] + patch().lookupPatchField + ( + IOobject::groupName("nut", phased.name()) + ) ); word ThetaName(IOobject::groupName("Theta", phased.name())); diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C index 3f24ca74..965f53ed 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.C +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.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 @@ -60,6 +60,20 @@ bool Foam::fileName::isAbsolute() const } +Foam::fileName& Foam::fileName::toAbsolute() +{ + fileName& f = *this; + + if (!f.isAbsolute()) + { + f = cwd()/f; + f.clean(); + } + + return f; +} + + // // * remove repeated slashes // /abc////def --> /abc/def diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H index 3e97853a..d6e9684a 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.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 @@ -141,11 +141,14 @@ public: // Interrogation - //- Return the file type: FILE, DIRECTORY or UNDEFINED - Type type() const; + //- Return the file type: FILE, DIRECTORY or UNDEFINED + Type type() const; - //- Return true if file name is absolute - bool isAbsolute() const; + //- Return true if file name is absolute + bool isAbsolute() const; + + //- Convert from relative to absolute + fileName& toAbsolute(); // Decomposition diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 9fa08201..9cdbff68 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.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 @@ -154,11 +154,11 @@ Foam::cyclicACMIFvPatchField::patchNeighbourField() const const Field& iField = this->internalField(); const labelUList& nbrFaceCellsCoupled = cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().faceCells(); - const labelUList& nbrFaceCellsNonOverlap = + const labelUList& faceCellsNonOverlap = cyclicACMIPatch_.cyclicACMIPatch().nonOverlapPatch().faceCells(); Field pnfCoupled(iField, nbrFaceCellsCoupled); - Field pnfNonOverlap(iField, nbrFaceCellsNonOverlap); + Field pfNonOverlap(iField, faceCellsNonOverlap); tmp > tpnf ( @@ -167,7 +167,7 @@ Foam::cyclicACMIFvPatchField::patchNeighbourField() const cyclicACMIPatch_.interpolate ( pnfCoupled, - pnfNonOverlap + pfNonOverlap ) ) ); @@ -287,10 +287,14 @@ Foam::tmp > Foam::cyclicACMIFvPatchField::snGrad template void Foam::cyclicACMIFvPatchField::updateCoeffs() { - const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); + // update non-overlap patch - some will implement updateCoeffs, and + // others will implement evaluate + // scale neighbour field by (1 - mask) + + const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); const fvPatchField& npf = nonOverlapPatchField(); - const_cast&>(npf).updateCoeffs(mask); + const_cast&>(npf).updateCoeffs(1.0 - mask); } @@ -300,9 +304,21 @@ void Foam::cyclicACMIFvPatchField::initEvaluate const Pstream::commsTypes comms ) { - // update non-overlap patch - const fvPatchField& npf = nonOverlapPatchField(); - const_cast&>(npf).evaluate(comms); + // update non-overlap patch (if not already updated by updateCoeffs) + + // scale neighbour field by (1 - mask) + + fvPatchField& npf = + const_cast&>(nonOverlapPatchField()); + + if (!npf.updated()) + { + const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); + + npf.evaluate(comms); + + npf *= 1.0 - mask; + } } @@ -313,13 +329,16 @@ void Foam::cyclicACMIFvPatchField::evaluate ) { // blend contributions from the coupled and non-overlap patches + + // neighbour patch field is updated via updateCoeffs or initEvaluate + // and is already scaled by (1 - mask) const fvPatchField& npf = nonOverlapPatchField(); coupledFvPatchField::evaluate(comms); const Field& cpf = *this; const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); - Field::operator=(mask*cpf + (1.0 - mask)*npf); + Field::operator=(mask*cpf + npf); fvPatchField::evaluate(); } @@ -333,7 +352,7 @@ Foam::cyclicACMIFvPatchField::valueInternalCoeffs ) const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::valueInternalCoeffs(w); } @@ -346,7 +365,7 @@ Foam::cyclicACMIFvPatchField::valueBoundaryCoeffs ) const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::valueBoundaryCoeffs(w); } @@ -359,7 +378,7 @@ Foam::cyclicACMIFvPatchField::gradientInternalCoeffs ) const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::gradientInternalCoeffs(deltaCoeffs); } @@ -369,7 +388,7 @@ Foam::tmp > Foam::cyclicACMIFvPatchField::gradientInternalCoeffs() const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::gradientInternalCoeffs(); } @@ -382,7 +401,7 @@ Foam::cyclicACMIFvPatchField::gradientBoundaryCoeffs ) const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::gradientBoundaryCoeffs(deltaCoeffs); } @@ -392,7 +411,7 @@ Foam::tmp > Foam::cyclicACMIFvPatchField::gradientBoundaryCoeffs() const { // note: do not blend based on mask field - // - when applied this is scaled by the areas which area already scaled + // - when applied this is scaled by the areas which are already scaled return coupledFvPatchField::gradientBoundaryCoeffs(); } @@ -403,11 +422,13 @@ void Foam::cyclicACMIFvPatchField::manipulateMatrix fvMatrix& matrix ) { - // blend contributions from the coupled and non-overlap patches + const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); + + // nothing to be done by the AMI, but re-direct to non-overlap patch + // with non-overlap patch weights const fvPatchField& npf = nonOverlapPatchField(); - const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask(); - const_cast&>(npf).manipulateMatrix(matrix, mask); + const_cast&>(npf).manipulateMatrix(matrix, 1.0 - mask); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H index 3a8198a9..dd2d8d75 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H @@ -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 @@ -166,9 +166,30 @@ public: // Evaluation functions //- Return true if coupled. Note that the underlying patch - // is not coupled() - the points don't align. + // is not coupled() - the points don't align virtual bool coupled() const; + //- Return true if this patch field fixes a value + // Needed to check if a level has to be specified while solving + // Poissons equations + virtual bool fixesValue() const + { + const scalarField& mask = + cyclicACMIPatch_.cyclicACMIPatch().mask(); + + if (gMax(mask) > 1e-5) + { + // regions connected + return false; + } + else + { + // fully separated + return nonOverlapPatchField().fixesValue(); + } + } + + //- Return neighbour coupled internal cell data virtual tmp > patchNeighbourField() const; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 8e2fc115..b0899d12 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -38,6 +38,10 @@ namespace Foam namespace compressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar epsilonWallFunctionFvPatchScalarField::tolerance_ = 1e-5; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void epsilonWallFunctionFvPatchScalarField::checkType() @@ -469,17 +473,17 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs scalarField& epsilonf = *this; - // only set the values if the weights are < 1 - tolerance + // only set the values if the weights are > tolerance forAll(weights, faceI) { scalar w = weights[faceI]; - if (w < 1.0 - 1e-6) + if (w > tolerance_) { label cellI = patch().faceCells()[faceI]; - G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI]; - epsilon[cellI] = w*epsilon[cellI] + (1.0 - w)*epsilon0[cellI]; + G[cellI] = (1.0 - w)*G[cellI] + w*G0[cellI]; + epsilon[cellI] = (1.0 - w)*epsilon[cellI] + w*epsilon0[cellI]; epsilonf[faceI] = epsilon[cellI]; } } @@ -521,16 +525,16 @@ void epsilonWallFunctionFvPatchScalarField::manipulateMatrix DynamicList constraintEpsilon(weights.size()); const labelUList& faceCells = patch().faceCells(); - const DimensionedField& epsilon - = dimensionedInternalField(); + const DimensionedField& epsilon = + dimensionedInternalField(); label nConstrainedCells = 0; forAll(weights, faceI) { - // only set the values if the weights are < 1 - tolerance - if (weights[faceI] < (1.0 - 1e-6)) + // only set the values if the weights are > tolerance + if (weights[faceI] > tolerance_) { nConstrainedCells++; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index 9eefc786..b0243132 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.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 @@ -94,6 +94,9 @@ protected: // Protected data + //- Tolerance used in weighted calculations + static scalar tolerance_; + //- Cmu coefficient scalar Cmu_; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 506b652a..4fa24330 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -39,6 +39,10 @@ namespace Foam namespace compressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar omegaWallFunctionFvPatchScalarField::tolerance_ = 1e-5; + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void omegaWallFunctionFvPatchScalarField::checkType() @@ -81,14 +85,14 @@ void omegaWallFunctionFvPatchScalarField::setMaster() { if (isA(bf[patchI])) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); if (master == -1) { master = patchI; } - epf.master() = master; + opf.master() = master; } } } @@ -162,10 +166,10 @@ omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchI) const volScalarField::GeometricBoundaryField& bf = omega.boundaryField(); - const omegaWallFunctionFvPatchScalarField& epf = + const omegaWallFunctionFvPatchScalarField& opf = refCast(bf[patchI]); - return const_cast(epf); + return const_cast(opf); } @@ -181,11 +185,11 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields { if (!cornerWeights_[patchI].empty()) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); const List& w = cornerWeights_[patchI]; - epf.calculate(turbulence, w, epf.patch(), G0, omega0); + opf.calculate(turbulence, w, opf.patch(), G0, omega0); } } @@ -194,9 +198,9 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields { if (!cornerWeights_[patchI].empty()) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); - epf == scalarField(omega0, epf.patch().faceCells()); + opf == scalarField(omega0, opf.patch().faceCells()); } } } @@ -486,17 +490,17 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs scalarField& omegaf = *this; - // only set the values if the weights are < 1 - tolerance + // only set the values if the weights are > tolerance_ forAll(weights, faceI) { scalar w = weights[faceI]; - if (w < 1.0 - 1e-6) + if (w > tolerance_) { label cellI = patch().faceCells()[faceI]; - G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI]; - omega[cellI] = w*omega[cellI] + (1.0 - w)*omega0[cellI]; + G[cellI] = (1.0 - w)*G[cellI] + w*G0[cellI]; + omega[cellI] = (1.0 - w)*omega[cellI] + w*omega0[cellI]; omegaf[faceI] = omega[cellI]; } } @@ -538,16 +542,16 @@ void omegaWallFunctionFvPatchScalarField::manipulateMatrix DynamicList constraintomega(weights.size()); const labelUList& faceCells = patch().faceCells(); - const DimensionedField& omega - = dimensionedInternalField(); + const DimensionedField& omega = + dimensionedInternalField(); label nConstrainedCells = 0; forAll(weights, faceI) { - // only set the values if the weights are < 1 - tolerance - if (weights[faceI] < (1.0 - 1e-6)) + // only set the values if the weights are > tolerance + if (weights[faceI] > tolerance_) { nConstrainedCells++; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 9db8e32a..a17c65ef 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.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 @@ -99,6 +99,9 @@ protected: // Protected data + //- Tolerance used in weighted calculations + static scalar tolerance_; + //- Cmu coefficient scalar Cmu_; diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 4b51db9f..ea273e25 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.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 @@ -269,7 +269,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() } } } - q = (Ta_ - Tp)*(1.0/h_ + totalSolidRes); + q = (Ta_ - Tp)/(1.0/h_ + totalSolidRes); break; } default: @@ -287,7 +287,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() { if (q[i] > 0) //in { - this->refGrad()[i] = q[i]/KWall[i]; + this->refGrad()[i] = q[i]/KWall[i]; this->refValue()[i] = 0.0; this->valueFraction()[i] = 0.0; } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 0520f726..9a8841f7 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -38,6 +38,10 @@ namespace Foam namespace incompressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar epsilonWallFunctionFvPatchScalarField::tolerance_ = 1e-5; + // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // void epsilonWallFunctionFvPatchScalarField::checkType() @@ -469,17 +473,17 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs scalarField& epsilonf = *this; - // only set the values if the weights are < 1 - tolerance + // only set the values if the weights are > tolerance forAll(weights, faceI) { scalar w = weights[faceI]; - if (w < 1.0 - 1e-6) + if (w > tolerance_) { label cellI = patch().faceCells()[faceI]; - G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI]; - epsilon[cellI] = w*epsilon[cellI] + (1.0 - w)*epsilon0[cellI]; + G[cellI] = (1.0 - w)*G[cellI] + w*G0[cellI]; + epsilon[cellI] = (1.0 - w)*epsilon[cellI] + w*epsilon0[cellI]; epsilonf[faceI] = epsilon[cellI]; } } @@ -521,16 +525,16 @@ void epsilonWallFunctionFvPatchScalarField::manipulateMatrix DynamicList constraintEpsilon(weights.size()); const labelUList& faceCells = patch().faceCells(); - const DimensionedField& epsilon - = dimensionedInternalField(); + const DimensionedField& epsilon = + dimensionedInternalField(); label nConstrainedCells = 0; forAll(weights, faceI) { - // only set the values if the weights are < 1 - tolerance - if (weights[faceI] < (1.0 - 1e-6)) + // only set the values if the weights are > tolerance + if (weights[faceI] > tolerance_) { nConstrainedCells++; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index 61de72a3..ef2eeeb8 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.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 @@ -94,6 +94,9 @@ protected: // Protected data + //- Tolerance used in weighted calculations + static scalar tolerance_; + //- Cmu coefficient scalar Cmu_; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 3cc0370a..066f03a0 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -39,6 +39,10 @@ namespace Foam namespace incompressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar omegaWallFunctionFvPatchScalarField::tolerance_ = 1e-5; + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void omegaWallFunctionFvPatchScalarField::checkType() @@ -81,14 +85,14 @@ void omegaWallFunctionFvPatchScalarField::setMaster() { if (isA(bf[patchI])) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); if (master == -1) { master = patchI; } - epf.master() = master; + opf.master() = master; } } } @@ -162,10 +166,10 @@ omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchI) const volScalarField::GeometricBoundaryField& bf = omega.boundaryField(); - const omegaWallFunctionFvPatchScalarField& epf = + const omegaWallFunctionFvPatchScalarField& opf = refCast(bf[patchI]); - return const_cast(epf); + return const_cast(opf); } @@ -181,11 +185,11 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields { if (!cornerWeights_[patchI].empty()) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); const List& w = cornerWeights_[patchI]; - epf.calculate(turbulence, w, epf.patch(), G0, omega0); + opf.calculate(turbulence, w, opf.patch(), G0, omega0); } } @@ -194,9 +198,9 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields { if (!cornerWeights_[patchI].empty()) { - omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchI); + omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchI); - epf == scalarField(omega0, epf.patch().faceCells()); + opf == scalarField(omega0, opf.patch().faceCells()); } } } @@ -484,17 +488,17 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs scalarField& omegaf = *this; - // only set the values if the weights are < 1 - tolerance + // only set the values if the weights are > tolerance forAll(weights, faceI) { scalar w = weights[faceI]; - if (w < 1.0 - 1e-6) + if (w > tolerance_) { label cellI = patch().faceCells()[faceI]; - G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI]; - omega[cellI] = w*omega[cellI] + (1.0 - w)*omega0[cellI]; + G[cellI] = (1.0 - w)*G[cellI] + w*G0[cellI]; + omega[cellI] = (1.0 - w)*omega[cellI] + w*omega0[cellI]; omegaf[faceI] = omega[cellI]; } } @@ -536,16 +540,16 @@ void omegaWallFunctionFvPatchScalarField::manipulateMatrix DynamicList constraintomega(weights.size()); const labelUList& faceCells = patch().faceCells(); - const DimensionedField& omega - = dimensionedInternalField(); + const DimensionedField& omega = + dimensionedInternalField(); label nConstrainedCells = 0; forAll(weights, faceI) { - // only set the values if the weights are < 1 - tolerance - if (weights[faceI] < (1.0 - 1e-6)) + // only set the values if the weights are > tolerance + if (weights[faceI] > tolerance_) { nConstrainedCells++; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 957d0f94..49606279 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.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 @@ -99,6 +99,9 @@ protected: // Protected data + //- Tolerance used in weighted calculations + static scalar tolerance_; + //- Cmu coefficient scalar Cmu_; diff --git a/tutorials/lagrangian/MPPICFoam/cyclone/constant/kinematicCloudProperties b/tutorials/lagrangian/MPPICFoam/cyclone/constant/kinematicCloudProperties index d87d0dbf..d39da39a 100644 --- a/tutorials/lagrangian/MPPICFoam/cyclone/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/MPPICFoam/cyclone/constant/kinematicCloudProperties @@ -69,26 +69,25 @@ subModels model1 { type patchInjection; - parcelBasisType fixed; + massTotal 40; + SOI 1; + parcelBasisType mass; patchName inlet; + duration 4; + parcelsPerSecond 100644; U0 (-10 0 0); - nParticle 500000; - parcelsPerSecond 244462; + flowRateProfile constant 1; sizeDistribution { type normal; normalDistribution { - expectation 50e-6; - variance 20e-6; - minValue 10e-6; - maxValue 90e-6; + expectation 100e-6; + variance 25e-6; + minValue 20e-6; + maxValue 180e-6; } } - flowRateProfile constant 1; - massTotal 0; - SOI 1; - duration 4; } }