From c3e9d8bd20513012feb8c005b9c7f240cd227619 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Tue, 19 Nov 2013 15:43:03 +0000 Subject: [PATCH 01/52] BUG: Correcting mapping rho and mu to calculate momemtum sink of the master on the slave region --- .../interRegionExplicitPorositySource.C | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C index 799a901bae..29d72dd112 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C @@ -173,10 +173,55 @@ void Foam::fv::interRegionExplicitPorositySource::addSup if (eqn.dimensions() == dimForce) { - const volScalarField& rhoNbr = - nbrMesh.lookupObject(rhoName_); - const volScalarField& muNbr = - nbrMesh.lookupObject(muName_); + volScalarField rhoNbr + ( + IOobject + ( + "rho:UNbr", + nbrMesh.time().timeName(), + nbrMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + nbrMesh, + dimensionedScalar("zero", dimDensity, 0.0) + ); + + volScalarField muNbr + ( + IOobject + ( + "mu:UNbr", + nbrMesh.time().timeName(), + nbrMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + nbrMesh, + dimensionedScalar("zero", dimViscosity, 0.0) + ); + + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + + const volScalarField& mu = + mesh_.lookupObject(muName_); + + // map local rho onto neighbour region + meshInterp().mapSrcToTgt + ( + rho.internalField(), + plusEqOp(), + rhoNbr.internalField() + ); + + // map local mu onto neighbour region + meshInterp().mapSrcToTgt + ( + mu.internalField(), + plusEqOp(), + muNbr.internalField() + ); porosityPtr_->addResistance(nbrEqn, rhoNbr, muNbr); } From 84e3fb4db2893895580e17776ae81c7fa35a2823 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 19 Nov 2013 16:38:44 +0000 Subject: [PATCH 02/52] ENH: Tutorial update --- .../counterFlowFlame2D/0/T | 1 - .../counterFlowFlame2D/0/U | 3 +- .../counterFlowFlame2D/0/epsilon | 45 ---------- .../counterFlowFlame2D/0/k | 45 ---------- .../counterFlowFlame2D/0/p | 14 +-- .../constant/chemistryProperties | 19 +++- .../constant/combustionProperties | 7 +- .../{0/alphat => constant/polyMesh/boundary} | 34 +++---- .../constant/turbulenceProperties | 2 +- .../counterFlowFlame2D/system/controlDict | 2 +- .../counterFlowFlame2D/system/fvSolution | 90 +++++++++---------- 11 files changed, 87 insertions(+), 175 deletions(-) delete mode 100644 tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon delete mode 100644 tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k rename tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/{0/alphat => constant/polyMesh/boundary} (66%) diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T index d5d567628e..fcf963a775 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T @@ -36,7 +36,6 @@ boundaryField type inletOutlet; inletValue uniform 293; value uniform 293; - } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U index 27773aea2b..c235ba3d65 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U @@ -33,7 +33,8 @@ boundaryField } outlet { - type zeroGradient; + type pressureInletOutletVelocity; + value $internalField; } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon deleted file mode 100644 index ad65f7ea0f..0000000000 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object epsilon; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -3 0 0 0 0]; - -internalField uniform 50; - -boundaryField -{ - fuel - { - type fixedValue; - value uniform 1e-05; - } - air - { - type fixedValue; - value uniform 1e-05; - } - outlet - { - type zeroGradient; - } - frontAndBack - { - type empty; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k deleted file mode 100644 index 3dcedaa2da..0000000000 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object k; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 3.75e-05; - -boundaryField -{ - fuel - { - type fixedValue; - value uniform 3.75e-05; - } - air - { - type fixedValue; - value uniform 3.75e-05; - } - outlet - { - type zeroGradient; - } - frontAndBack - { - type empty; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p index 79f071ce31..deca9ba60d 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p @@ -29,14 +29,16 @@ boundaryField { type zeroGradient; } - inlet2 - { - type zeroGradient; - } outlet { - type fixedValue; - value uniform 1e5; + type totalPressure; + p0 $internalField; + U U; + phi phi; + rho none; + psi none; + gamma 1; + value $internalField; } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties index 254f5c4633..ebdde7591f 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties @@ -17,14 +17,25 @@ FoamFile chemistryType { - chemistrySolver noChemistrySolver; + chemistrySolver EulerImplicit; chemistryThermo rho; } -chemistry on; // off; +chemistry on; -chemCalcFreq 1; +initialChemicalTimeStep 1e-07; -initialChemicalTimeStep 1e-8; // NOT USED +EulerImplicitCoeffs +{ + cTauChem 1; + equilibriumRateLimiter off; +} + +odeCoeffs +{ + solver Rosenbrock43; + absTol 1e-12; + relTol 0.01; +} // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties index 06715e90f1..bad68a398b 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties @@ -15,15 +15,12 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -combustionModel PaSR; +combustionModel laminar; active true; -PaSRCoeffs +laminarCoeffs { - Cmix 0.1; - turbulentReaction off; - useReactionRate true; } diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary similarity index 66% rename from tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat rename to tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary index c74018bbdb..4ba3243474 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary @@ -9,37 +9,39 @@ FoamFile { version 2.0; format ascii; - class volScalarField; - location "0"; - object alphat; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [1 -1 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ +4 +( fuel { - type fixedValue; - value uniform 0; + type patch; + nFaces 40; + startFace 7860; } air { - type fixedValue; - value uniform 0; + type patch; + nFaces 40; + startFace 7900; } outlet { - type zeroGradient; + type patch; + nFaces 200; + startFace 7940; } frontAndBack { type empty; + inGroups 1(empty); + nFaces 8000; + startFace 8140; } -} - +) // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties index 3721a46a2e..c2c3b28a1b 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -simulationType RASModel; +simulationType laminar; // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict index bb20dffbf2..e27ca26539 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict @@ -23,7 +23,7 @@ startTime 0; stopAt endTime; -endTime 10000; +endTime 2000; deltaT 1; diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution index 552f948a84..cf6feec247 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution @@ -17,79 +17,69 @@ FoamFile solvers { - rho + "rho.*" { - solver PCG; - preconditioner DIC; - tolerance 0; - relTol 0.1; - } - - rhoFinal - { - solver PCG; - preconditioner DIC; - tolerance 1e-4; - relTol 0; + solver diagonal; } p { - solver GAMG; - - tolerance 0; - relTol 0.05; - - smoother DICGaussSeidel; - nPreSweeps 0; - nPostSweeps 2; - - cacheAgglomeration true; - - nCellsInCoarsestLevel 10; - agglomerator faceAreaPair; - mergeLevels 1; - - maxIter 50; - }; + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } pFinal { $p; - - tolerance 1e-4; relTol 0; - }; + } - "(U|Yi|h|k|epsilon)" + "(U|h|k|epsilon)" { - solver smoothSolver; - smoother GaussSeidel; - tolerance 0; + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; relTol 0.1; } - "(U|Yi|h|k|epsilon)Final" + "(U|h|k|epsilon)Final" { - solver smoothSolver; - smoother GaussSeidel; - tolerance 1e-4; - relTol 0; + $U; + relTol 0.1; + } + + Yi + { + $U; + relTol 0.1; } } PIMPLE { - nCorrectors 2; + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 1; nNonOrthogonalCorrectors 0; - momentumPredictor yes; - rhoMin 0.1; - rhoMax 1.5; - maxCo 0.1; - rDeltaTSmoothingCoeff 0.1; - maxDeltaT 2e-4; - alphaTemp 0.005; + maxDeltaT 1e-2; + maxCo 1; + alphaTemp 0.05; + rDeltaTSmoothingCoeff 1; + rDeltaTDampingCoeff 1; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } } From 3e5864be6fa3c06746a54833c05c62864144546b Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 11:22:08 +0000 Subject: [PATCH 03/52] ENH: Tutorial update --- .../parcelInBox/constant/chemistryProperties | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties index ff1c96ea96..9dcb7f347e 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties @@ -17,25 +17,12 @@ FoamFile chemistryType { - chemistrySolver ode; + chemistrySolver noChemistrySolver; chemistryThermo rho; } chemistry off; -initialChemicalTimeStep 1e-07; - -EulerImplicitCoeffs -{ - cTauChem 0.05; - equilibriumRateLimiter off; -} - -odeCoeffs -{ - solver RK; - eps 0.05; -} - +initialChemicalTimeStep 1e-7; // ************************************************************************* // From 17bb9fd22abd443cf75a7edfe88a1b8cef0c6b86 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 11:22:36 +0000 Subject: [PATCH 04/52] BUG: particle tracking - wrong index used - mantis #1059 --- src/lagrangian/basic/particle/particleTemplates.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index cdc12634bd..ad50f7ddd8 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -424,7 +424,7 @@ Foam::scalar Foam::particle::trackToFace ( position_, endPosition, - triI, + tI, tetAreas[tI], tetPlaneBasePtIs[tI], cellI_, From 44330257319893c5a9f067817ff01f6d5da0d655 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 11:44:14 +0000 Subject: [PATCH 05/52] ENH: chemkin reader - updated to remove compiler warnings --- .../chemkinReader/chemkinReader.C | 75 ++++++------------- 1 file changed, 22 insertions(+), 53 deletions(-) diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 63dd057f3d..701ce73c8d 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -281,9 +281,8 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - case Troe: { scalarList TroeCoeffs @@ -337,9 +336,8 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - case SRI: { scalarList SRICoeffs @@ -395,27 +393,16 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - default: { - if (fofType < 4) - { - FatalErrorIn("chemkinReader::addPressureDependentReaction") - << "Fall-off function type " - << fallOffFunctionNames[fofType] - << " on line " << lineNo_-1 - << " not implemented" - << exit(FatalError); - } - else - { - FatalErrorIn("chemkinReader::addPressureDependentReaction") - << "Unknown fall-off function type " << fofType - << " on line " << lineNo_-1 - << exit(FatalError); - } + FatalErrorIn("chemkinReader::addPressureDependentReaction") + << "Fall-off function type " + << fallOffFunctionNames[fofType] + << " on line " << lineNo_-1 + << " not implemented" + << exit(FatalError); } } } @@ -537,9 +524,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case thirdBodyArrhenius: { if (rType == nonEquilibriumReversible) @@ -597,9 +583,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case unimolecularFallOff: { addPressureDependentReaction @@ -616,9 +601,8 @@ void Foam::chemkinReader::addReaction Afactor, RR ); + break; } - break; - case chemicallyActivatedBimolecular: { addPressureDependentReaction @@ -635,9 +619,8 @@ void Foam::chemkinReader::addReaction Afactor/concFactor, RR ); + break; } - break; - case LandauTeller: { const scalarList& LandauTellerCoeffs = @@ -705,9 +688,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case Janev: { const scalarList& JanevCoeffs = @@ -727,9 +709,8 @@ void Foam::chemkinReader::addReaction FixedList(JanevCoeffs) ) ); + break; } - break; - case powerSeries: { const scalarList& powerSeriesCoeffs = @@ -749,35 +730,23 @@ void Foam::chemkinReader::addReaction FixedList(powerSeriesCoeffs) ) ); + break; } - break; - case unknownReactionRateType: { FatalErrorIn("chemkinReader::addReaction") << "Internal error on line " << lineNo_-1 << ": reaction rate type has not been set" << exit(FatalError); + break; } - break; - default: { - if (rrType < 9) - { - FatalErrorIn("chemkinReader::addReaction") - << "Reaction rate type " << reactionRateTypeNames[rrType] - << " on line " << lineNo_-1 - << " not implemented" - << exit(FatalError); - } - else - { - FatalErrorIn("chemkinReader::addReaction") - << "Unknown reaction rate type " << rrType - << " on line " << lineNo_-1 - << exit(FatalError); - } + FatalErrorIn("chemkinReader::addReaction") + << "Reaction rate type " << reactionRateTypeNames[rrType] + << " on line " << lineNo_-1 + << " not implemented" + << exit(FatalError); } } From cc8e6e0f7b39832787e34f0b952a84c4cf1dab92 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 11:52:04 +0000 Subject: [PATCH 06/52] ENH: Removed deleted files on tutorial clean-up --- .../pimpleFoam/TJunctionFan/0/U | 49 ---------------- .../pimpleFoam/TJunctionFan/0/epsilon | 55 ------------------ .../pimpleFoam/TJunctionFan/0/k | 50 ----------------- .../pimpleFoam/TJunctionFan/0/nuTilda | 43 -------------- .../pimpleFoam/TJunctionFan/0/nut | 50 ----------------- .../pimpleFoam/TJunctionFan/0/p | 56 ------------------- 6 files changed, 303 deletions(-) delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/U delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/k delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut delete mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0/p diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U deleted file mode 100644 index 54e519308c..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U +++ /dev/null @@ -1,49 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - location "0"; - object U; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m s^-1]; - -internalField uniform (0 0 0); - -boundaryField -{ - inlet - { - type pressureInletOutletVelocity; - value uniform (0 0 0); - } - outlet1 - { - type inletOutlet; - inletValue uniform (0 0 0); - value uniform (0 0 0); - } - outlet2 - { - type inletOutlet; - inletValue uniform (0 0 0); - value uniform (0 0 0); - } - defaultFaces - { - type fixedValue; - value uniform (0 0 0); - } -} - - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon deleted file mode 100644 index 3648316bd3..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon +++ /dev/null @@ -1,55 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object epsilon; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m^2 s^-3]; - -internalField uniform 200; - -boundaryField -{ - inlet - { - type turbulentMixingLengthDissipationRateInlet; - mixingLength 0.01; - phi phi; - k k; - value uniform 200; - } - outlet1 - { - type inletOutlet; - inletValue uniform 200; - value uniform 200; - } - outlet2 - { - type inletOutlet; - inletValue uniform 200; - value uniform 200; - } - defaultFaces - { - type epsilonWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 200; - } -} - - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k deleted file mode 100644 index bd8e325c2f..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k +++ /dev/null @@ -1,50 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object k; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m^2 s^-2]; - -internalField uniform 0.375; - -boundaryField -{ - inlet - { - type turbulentIntensityKineticEnergyInlet; - intensity 0.05; - value uniform 0.375; - } - outlet1 - { - type inletOutlet; - inletValue uniform 0.375; - value uniform 0.375; - } - outlet2 - { - type inletOutlet; - inletValue uniform 0.375; - value uniform 0.375; - } - defaultFaces - { - type kqRWallFunction; - value uniform 0.375; - } -} - - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda deleted file mode 100644 index 5bd1e94d8b..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda +++ /dev/null @@ -1,43 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object nuTilda; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m^2 s^-1]; - -internalField uniform 0; - -boundaryField -{ - inlet - { - type zeroGradient; - } - outlet1 - { - type zeroGradient; - } - outlet2 - { - type zeroGradient; - } - defaultFaces - { - type zeroGradient; - } -} - - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut deleted file mode 100644 index 894d5b5345..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut +++ /dev/null @@ -1,50 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object nut; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m^2 s^-1]; - -internalField uniform 0; - -boundaryField -{ - inlet - { - type calculated; - value uniform 0; - } - outlet1 - { - type calculated; - value uniform 0; - } - outlet2 - { - type calculated; - value uniform 0; - } - defaultFaces - { - type nutkWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; - } -} - - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p deleted file mode 100644 index 42728c992c..0000000000 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object p; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [m^2 s^-2]; - -internalField uniform 0; - -boundaryField -{ - inlet - { - type uniformTotalPressure; - rho none; - psi none; - gamma 1; - pressure table - 2 - ( - (0 10) - (1 40) - ) - ; - value uniform 40; - } - outlet1 - { - type fixedValue; - value uniform 10; - } - outlet2 - { - type fixedValue; - value uniform 0; - } - defaultFaces - { - type zeroGradient; - } -} - - -// ************************************************************************* // From f6b22f4b975af38ad165ff91c9e04142cc90a84d Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 12:56:17 +0000 Subject: [PATCH 07/52] COMP: hexRef8 - changes to work-aroung clang compiler bug --- src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index 9cc5ed3d6d..efed7f22f7 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -3185,7 +3185,8 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 forAll(refineCell, cellI) { - if (refineCell.get(cellI)) +// if (refineCell.get(cellI)) + if (refineCell[cellI]) { nRefined++; } @@ -3196,7 +3197,8 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 forAll(refineCell, cellI) { - if (refineCell.get(cellI)) +// if (refineCell.get(cellI)) + if (refineCell[cellI]) { newCellsToRefine[nRefined++] = cellI; } From b314fb887e71c1ed6eb7e4526edb69352148503a Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 16:22:48 +0000 Subject: [PATCH 08/52] ENH: ACMI - code updates to avoid FPEs --- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 52 ++++++++++++++----- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.H | 15 ++++++ .../cyclicACMIPolyPatchI.H | 6 +-- .../cyclicACMIPolyPatchTemplates.C | 8 +-- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 7 +++ .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 2 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H | 8 --- 7 files changed, 68 insertions(+), 30 deletions(-) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C index 30ae0adf37..4c36dc0be4 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C @@ -90,16 +90,16 @@ void Foam::cyclicACMIPolyPatch::resetAMI AMIPatchToPatchInterpolation::imPartialFaceAreaWeight ); - const scalarField& srcWeightSum = AMI().srcWeightsSum(); + srcMask_ = + min(1.0 - tolerance_, max(tolerance_, AMI().srcWeightsSum())); + + tgtMask_ = + min(1.0 - tolerance_, max(tolerance_, AMI().tgtWeightsSum())); - // set patch face areas based on sum of AMI weights per face forAll(Sf, faceI) { - scalar w = srcWeightSum[faceI]; - w = min(1.0 - tolerance_, max(tolerance_, w)); - - Sf[faceI] *= w; - noSf[faceI] *= 1.0 - w; + Sf[faceI] *= srcMask_[faceI]; + noSf[faceI] *= 1.0 - srcMask_[faceI]; } setNeighbourFaceAreas(); @@ -116,8 +116,6 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const refCast(this->neighbPatch()); const polyPatch& pp = cp.nonOverlapPatch(); - const scalarField& tgtWeightSum = AMI().tgtWeightsSum(); - const vectorField& faceAreas0 = cp.faceAreas0(); vectorField::subField Sf = cp.faceAreas(); @@ -125,11 +123,8 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const forAll(Sf, faceI) { - scalar w = tgtWeightSum[faceI]; - w = min(1.0 - tolerance_, max(tolerance_, w)); - - Sf[faceI] = w*faceAreas0[faceI]; - noSf[faceI] = (1.0 - w)*faceAreas0[faceI]; + Sf[faceI] = tgtMask_[faceI]*faceAreas0[faceI]; + noSf[faceI] = (1.0 - tgtMask_[faceI])*faceAreas0[faceI]; } } @@ -184,6 +179,18 @@ void Foam::cyclicACMIPolyPatch::clearGeom() } +const Foam::scalarField& Foam::cyclicACMIPolyPatch::srcMask() const +{ + return srcMask_; +} + + +const Foam::scalarField& Foam::cyclicACMIPolyPatch::tgtMask() const +{ + return tgtMask_; +} + + // * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch @@ -201,6 +208,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(word::null), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { // Non-overlapping patch might not be valid yet so cannot determine @@ -221,6 +230,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(dict.lookup("nonOverlapPatch")), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { if (nonOverlapPatchName_ == name) @@ -256,6 +267,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(pp.nonOverlapPatchName_), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { // Non-overlapping patch might not be valid yet so cannot determine @@ -278,6 +291,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(nonOverlapPatchName), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { if (nonOverlapPatchName_ == name()) @@ -314,6 +329,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(pp.nonOverlapPatchName_), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) {} @@ -326,6 +343,13 @@ Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::cyclicACMIPolyPatch& Foam::cyclicACMIPolyPatch::neighbPatch() const +{ + const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; + return refCast(pp); +} + + Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const { if (nonOverlapPatchID_ == -1) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H index b092c14f04..b153034d87 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H @@ -66,6 +66,12 @@ private: //- Index of non-overlapping patch mutable label nonOverlapPatchID_; + //- Mask/weighting for source patch + mutable scalarField srcMask_; + + //- Mask/weighting for target patch + mutable scalarField tgtMask_; + //- Flag to indicate that AMI has been updated mutable bool updated_; @@ -111,6 +117,12 @@ protected: //- Clear geometry virtual void clearGeom(); + //- Return the mask/weighting for the source patch + virtual const scalarField& srcMask() const; + + //- Return the mask/weighting for the target patch + virtual const scalarField& tgtMask() const; + public: @@ -245,6 +257,9 @@ public: //- Return access to the original patch face areas inline const vectorField& faceAreas0() const; + //- Return a reference to the neighbour patch + virtual const cyclicACMIPolyPatch& neighbPatch() const; + //- Non-overlapping patch name inline const word& nonOverlapPatchName() const; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H index a245f779c0..fbb049a725 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H @@ -67,15 +67,15 @@ inline Foam::polyPatch& Foam::cyclicACMIPolyPatch::nonOverlapPatch() } -inline const Foam::scalarField& Foam::cyclicACMIPolyPatch::mask() const +inline const scalarField& Foam::cyclicACMIPolyPatch::mask() const { if (owner()) { - return AMI().srcWeightsSum(); + return srcMask_; } else { - return neighbPatch().AMI().tgtWeightsSum(); + return neighbPatch().tgtMask(); } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C index 127085ac44..b64842bf12 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C @@ -34,7 +34,7 @@ Foam::tmp > Foam::cyclicACMIPolyPatch::interpolate { if (owner()) { - const scalarField& w = AMI().srcWeightsSum(); + const scalarField& w = srcMask_; return w*AMI().interpolateToSource(fldCouple) @@ -42,7 +42,7 @@ Foam::tmp > Foam::cyclicACMIPolyPatch::interpolate } else { - const scalarField& w = neighbPatch().AMI().tgtWeightsSum(); + const scalarField& w = neighbPatch().tgtMask(); return w*neighbPatch().AMI().interpolateToTarget(fldCouple) @@ -73,14 +73,14 @@ void Foam::cyclicACMIPolyPatch::interpolate { if (owner()) { - const scalarField& w = AMI().srcWeightsSum(); + const scalarField& w = srcMask_; AMI().interpolateToSource(fldCouple, cop, result); result = w*result + (1.0 - w)*fldNonOverlap; } else { - const scalarField& w = neighbPatch().AMI().tgtWeightsSum(); + const scalarField& w = neighbPatch().tgtMask(); neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result); result = w*result + (1.0 - w)*fldNonOverlap; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index e906689415..52373c438d 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -642,6 +642,13 @@ bool Foam::cyclicAMIPolyPatch::owner() const } +const Foam::cyclicAMIPolyPatch& Foam::cyclicAMIPolyPatch::neighbPatch() const +{ + const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; + return refCast(pp); +} + + const Foam::autoPtr& Foam::cyclicAMIPolyPatch::surfPtr() const { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index 9c0f5fc316..e3bb1d35d9 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -284,7 +284,7 @@ public: virtual bool owner() const; //- Return a reference to the neighbour patch - inline const cyclicAMIPolyPatch& neighbPatch() const; + virtual const cyclicAMIPolyPatch& neighbPatch() const; //- Return a reference to the projection surface const autoPtr& surfPtr() const; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H index 217d189ae3..b136f90ad0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H @@ -38,14 +38,6 @@ inline const Foam::word& Foam::cyclicAMIPolyPatch::neighbPatchName() const } -inline const Foam::cyclicAMIPolyPatch& -Foam::cyclicAMIPolyPatch::neighbPatch() const -{ - const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; - return refCast(pp); -} - - inline const Foam::vector& Foam::cyclicAMIPolyPatch::rotationAxis() const { return rotationAxis_; From 80a191e7ddaa5434eb9fada01592c6a02f5b1784 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 16:23:12 +0000 Subject: [PATCH 09/52] BUG: Reinstated missing tutorial files --- .../pimpleFoam/TJunctionFan/0.org/U | 49 ++++++++++++++++ .../pimpleFoam/TJunctionFan/0.org/epsilon | 55 ++++++++++++++++++ .../pimpleFoam/TJunctionFan/0.org/k | 50 +++++++++++++++++ .../pimpleFoam/TJunctionFan/0.org/nuTilda | 43 ++++++++++++++ .../pimpleFoam/TJunctionFan/0.org/nut | 50 +++++++++++++++++ .../pimpleFoam/TJunctionFan/0.org/p | 56 +++++++++++++++++++ 6 files changed, 303 insertions(+) create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut create mode 100644 tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U new file mode 100644 index 0000000000..54e519308c --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m s^-1]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } + outlet1 + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + outlet2 + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + defaultFaces + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon new file mode 100644 index 0000000000..3648316bd3 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m^2 s^-3]; + +internalField uniform 200; + +boundaryField +{ + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.01; + phi phi; + k k; + value uniform 200; + } + outlet1 + { + type inletOutlet; + inletValue uniform 200; + value uniform 200; + } + outlet2 + { + type inletOutlet; + inletValue uniform 200; + value uniform 200; + } + defaultFaces + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 200; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k new file mode 100644 index 0000000000..bd8e325c2f --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m^2 s^-2]; + +internalField uniform 0.375; + +boundaryField +{ + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; + value uniform 0.375; + } + outlet1 + { + type inletOutlet; + inletValue uniform 0.375; + value uniform 0.375; + } + outlet2 + { + type inletOutlet; + inletValue uniform 0.375; + value uniform 0.375; + } + defaultFaces + { + type kqRWallFunction; + value uniform 0.375; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda new file mode 100644 index 0000000000..5bd1e94d8b --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m^2 s^-1]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + outlet1 + { + type zeroGradient; + } + outlet2 + { + type zeroGradient; + } + defaultFaces + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut new file mode 100644 index 0000000000..894d5b5345 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m^2 s^-1]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + outlet1 + { + type calculated; + value uniform 0; + } + outlet2 + { + type calculated; + value uniform 0; + } + defaultFaces + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p new file mode 100644 index 0000000000..42728c992c --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [m^2 s^-2]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type uniformTotalPressure; + rho none; + psi none; + gamma 1; + pressure table + 2 + ( + (0 10) + (1 40) + ) + ; + value uniform 40; + } + outlet1 + { + type fixedValue; + value uniform 10; + } + outlet2 + { + type fixedValue; + value uniform 0; + } + defaultFaces + { + type zeroGradient; + } +} + + +// ************************************************************************* // From 4e19a1a56a88c7ab4deae6ba573bdd08f468ed34 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 20 Nov 2013 16:29:43 +0000 Subject: [PATCH 10/52] BUG: Added missing scoping --- .../cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H index fbb049a725..07f6b07bcb 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H @@ -67,7 +67,7 @@ inline Foam::polyPatch& Foam::cyclicACMIPolyPatch::nonOverlapPatch() } -inline const scalarField& Foam::cyclicACMIPolyPatch::mask() const +inline const Foam::scalarField& Foam::cyclicACMIPolyPatch::mask() const { if (owner()) { From 1dc64adbdbf174fdeb24249bb548ce13e2b56cc0 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 09:59:51 +0000 Subject: [PATCH 11/52] BUG: mappedPatchBase - cannot use samplePatch() for NEARESTCELL mode - must use samplePatch_ --- .../mappedPolyPatch/mappedPatchBase.C | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 93c05785bb..4c6858a79b 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -203,7 +203,7 @@ void Foam::mappedPatchBase::findSamples { case NEARESTCELL: { - if (samplePatch().size() && samplePatch() != "none") + if (samplePatch_.size() && samplePatch_ != "none") { FatalErrorIn ( @@ -495,7 +495,6 @@ void Foam::mappedPatchBase::findSamples void Foam::mappedPatchBase::calcMapping() const { static bool hasWarned = false; - if (mapPtr_.valid()) { FatalErrorIn("mappedPatchBase::calcMapping() const") @@ -509,10 +508,8 @@ void Foam::mappedPatchBase::calcMapping() const // Get offsetted points const pointField offsettedPoints(samplePoints(patchPoints())); - - // Do a sanity check - // Am I sampling my own patch? This only makes sense for a non-zero - // offset. + // Do a sanity check - am I sampling my own patch? + // This only makes sense for a non-zero offset. bool sampleMyself = ( mode_ == NEARESTPATCHFACE @@ -550,7 +547,6 @@ void Foam::mappedPatchBase::calcMapping() const << "offsetMode_:" << offsetModeNames_[offsetMode_] << endl; } - // Get global list of all samples and the processor and face they come from. pointField samples; labelList patchFaceProcs; @@ -565,7 +561,6 @@ void Foam::mappedPatchBase::calcMapping() const patchFc ); - // Find processor and cell/face samples are in and actual location. labelList sampleProcs; labelList sampleIndices; @@ -641,7 +636,6 @@ void Foam::mappedPatchBase::calcMapping() const } } - // Now we have all the data we need: // - where sample originates from (so destination when mapping): // patchFaces, patchFaceProcs. @@ -688,7 +682,6 @@ void Foam::mappedPatchBase::calcMapping() const } } - // Determine schedule. mapPtr_.reset(new mapDistribute(sampleProcs, patchFaceProcs)); @@ -806,38 +799,34 @@ void Foam::mappedPatchBase::calcAMI() const } AMIPtr_.clear(); -/* - const polyPatch& nbr = samplePolyPatch(); - -// pointField nbrPoints(offsettedPoints()); - pointField nbrPoints(nbr.localPoints()); if (debug) { + const polyPatch& nbr = samplePolyPatch(); + + pointField nbrPoints(nbr.localPoints()); + OFstream os(patch_.name() + "_neighbourPatch-org.obj"); meshTools::writeOBJ(os, samplePolyPatch().localFaces(), nbrPoints); - } - // transform neighbour patch to local system - primitivePatch nbrPatch0 - ( - SubList + // transform neighbour patch to local system + primitivePatch nbrPatch0 ( - nbr.localFaces(), - nbr.size() - ), - nbrPoints - ); + SubList + ( + nbr.localFaces(), + nbr.size() + ), + nbrPoints + ); - if (debug) - { OFstream osN(patch_.name() + "_neighbourPatch-trans.obj"); meshTools::writeOBJ(osN, nbrPatch0, nbrPoints); OFstream osO(patch_.name() + "_ownerPatch.obj"); meshTools::writeOBJ(osO, patch_.localFaces(), patch_.localPoints()); } -*/ + // Construct/apply AMI interpolation to determine addressing and weights AMIPtr_.reset ( From 35485351119d73c92e01f1483baebc80c7b40dec Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 10:00:26 +0000 Subject: [PATCH 12/52] ENH: Code formatting updates --- .../mappedPolyPatch/mappedPatchBase.H | 1 + .../sampledPatch/sampledPatch.C | 6 +- .../sampledPatch/sampledPatch.H | 168 +++++++++--------- .../sampledPatchInternalField.C | 3 +- .../sampledPatchInternalField.H | 107 +++++------ .../sampledSurfacesTemplates.C | 10 +- 6 files changed, 155 insertions(+), 140 deletions(-) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H index 928a1d5b85..7dd98c1806 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H @@ -392,6 +392,7 @@ public: //- Get the patch on the region const polyPatch& samplePolyPatch() const; + // Helpers //- Get the sample points diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C index da2d90c9fa..b100f7ed74 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -248,6 +248,7 @@ Foam::tmp Foam::sampledPatch::sample return sampleField(vField); } + Foam::tmp Foam::sampledPatch::sample ( const volSphericalTensorField& vField @@ -292,6 +293,7 @@ Foam::tmp Foam::sampledPatch::sample return sampleField(sField); } + Foam::tmp Foam::sampledPatch::sample ( const surfaceSphericalTensorField& sField @@ -318,6 +320,7 @@ Foam::tmp Foam::sampledPatch::sample return sampleField(sField); } + Foam::tmp Foam::sampledPatch::interpolate ( const interpolation& interpolator @@ -335,6 +338,7 @@ Foam::tmp Foam::sampledPatch::interpolate return interpolateField(interpolator); } + Foam::tmp Foam::sampledPatch::interpolate ( const interpolation& interpolator diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index 0385f96a63..f0b810a5ba 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -53,7 +53,8 @@ class sampledPatch public sampledSurface { //- Private typedefs for convenience - typedef MeshedSurface MeshStorage; + typedef MeshedSurface MeshStorage; + // Private data @@ -78,16 +79,17 @@ class sampledPatch //- Start indices (in patchFaceLabels_) of patches labelList patchStart_; + // Private Member Functions - //- sample field on faces + //- Sample field on faces template tmp > sampleField ( const GeometricField& vField ) const; - //- sample surface field on faces + //- Sample surface field on faces template tmp > sampleField ( @@ -95,10 +97,9 @@ class sampledPatch ) const; template - tmp > - interpolateField(const interpolation&) const; + tmp > interpolateField(const interpolation&) const; - //- remap action on triangulation or cleanup + //- Re-map action on triangulation or cleanup virtual void remapFaces(const labelUList& faceMap); @@ -180,96 +181,99 @@ public: } - //- sample field on surface - virtual tmp sample - ( - const volScalarField& - ) const; + // Sample + //- Sample field on surface + virtual tmp sample + ( + const volScalarField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volVectorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volVectorField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volSphericalTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volSphericalTensorField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volSymmTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volSymmTensorField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volTensorField& + ) const; - //- Surface sample field on surface - virtual tmp sample - ( - const surfaceScalarField& - ) const; + //- Surface sample field on surface + virtual tmp sample + ( + const surfaceScalarField& + ) const; - //- Surface Sample field on surface - virtual tmp sample - ( - const surfaceVectorField& - ) const; + //- Surface Sample field on surface + virtual tmp sample + ( + const surfaceVectorField& + ) const; - //- Surface sample field on surface - virtual tmp sample - ( - const surfaceSphericalTensorField& - ) const; + //- Surface sample field on surface + virtual tmp sample + ( + const surfaceSphericalTensorField& + ) const; - //- Surface sample field on surface - virtual tmp sample - ( - const surfaceSymmTensorField& - ) const; + //- Surface sample field on surface + virtual tmp sample + ( + const surfaceSymmTensorField& + ) const; - //- Surface sample field on surface - virtual tmp sample - ( - const surfaceTensorField& - ) const; - - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Surface sample field on surface + virtual tmp sample + ( + const surfaceTensorField& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + // Interpolate - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; + + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; + + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; //- Write virtual void print(Ostream&) const; diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C index 4f16bbed59..a133fdd8ce 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,6 +204,7 @@ Foam::tmp Foam::sampledPatchInternalField::interpolate return interpolateField(interpolator); } + Foam::tmp Foam::sampledPatchInternalField::interpolate ( diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H index f2b3b7c4dc..05a7ea61a9 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H @@ -49,7 +49,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class sampledPatchInternalField Declaration + Class sampledPatchInternalField Declaration \*---------------------------------------------------------------------------*/ class sampledPatchInternalField @@ -74,6 +74,7 @@ class sampledPatchInternalField template tmp > interpolateField(const interpolation&) const; + public: //- Runtime type information @@ -97,67 +98,71 @@ public: // Member Functions - //- sample field on surface - virtual tmp sample - ( - const volScalarField& - ) const; + // Sample - //- sample field on surface - virtual tmp sample - ( - const volVectorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volScalarField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volSphericalTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volVectorField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volSymmTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volSphericalTensorField& + ) const; - //- sample field on surface - virtual tmp sample - ( - const volTensorField& - ) const; + //- Sample field on surface + virtual tmp sample + ( + const volSymmTensorField& + ) const; + + //- Sample field on surface + virtual tmp sample + ( + const volTensorField& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + // Interpolate + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; + + //- Interpolate field on surface + virtual tmp interpolate + ( + const interpolation& + ) const; - //- interpolate field on surface - virtual tmp interpolate - ( - const interpolation& - ) const; //- Write virtual void print(Ostream&) const; diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 35880afafa..8683e320dc 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -113,9 +113,9 @@ void Foam::sampledSurfaces::sampleAndWrite ) { // interpolator for this field - autoPtr< interpolation > interpolator; + autoPtr > interpolatorPtr; - const word& fieldName = vField.name(); + const word& fieldName = vField.name(); const fileName outputDir = outputPath_/vField.time().timeName(); forAll(*this, surfI) @@ -126,16 +126,16 @@ void Foam::sampledSurfaces::sampleAndWrite if (s.interpolate()) { - if (interpolator.empty()) + if (interpolatorPtr.empty()) { - interpolator = interpolation::New + interpolatorPtr = interpolation::New ( interpolationScheme_, vField ); } - values = s.interpolate(interpolator()); + values = s.interpolate(interpolatorPtr()); } else { From 853b469fd23a1354031315e5902a19375ed8f7df Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 10:19:43 +0000 Subject: [PATCH 13/52] ENH: Tutorial updates --- tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes | 2 +- .../multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes | 2 +- tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes | 2 +- .../interFoam/ras/damBreakPorousBaffle/system/fvSchemes | 2 +- .../multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes | 2 +- .../laminar/damBreak4phaseFine/system/fvSchemes | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes index de87355816..da652a662a 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linearUpwind grad(U); + div(rhoPhi,U) Gauss linearUpwind grad(U); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes index 26e06a656b..21e1243948 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss limitedLinear 1; diff --git a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes index 8ed8e03cc0..ca2cd3a2b8 100644 --- a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes +++ b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes index 8ed8e03cc0..ca2cd3a2b8 100644 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes index e1436932da..48eb9c4f98 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes @@ -29,7 +29,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss upwind; + div(rhoPhi,U) Gauss upwind; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div((muEff*dev(T(grad(U))))) Gauss linear; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes index e1436932da..48eb9c4f98 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes @@ -29,7 +29,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss upwind; + div(rhoPhi,U) Gauss upwind; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div((muEff*dev(T(grad(U))))) Gauss linear; From 578fb9f6bbb75d357a2bff7748309fef3229e7df Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 11:02:37 +0000 Subject: [PATCH 14/52] STYLE: doxygen - prevent auto link to class for description --- .../field/regionSizeDistribution/regionSizeDistribution.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index abbdf6bac0..b639d8e251 100644 --- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -47,7 +47,7 @@ Description - alpha_liquidCore : alpha with outside liquid core set to 0 - alpha_background : alpha with outside background set to 0. - Histogram: + %Histogram: - determine histogram of diameter (given minDiameter, maxDiameter, nBins) - write graph of number of droplets per bin - write graph of sum, average and deviation of droplet volume per bin From 6544abe3892d04096020c9c692f92ee0bedf767a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 14:57:44 +0000 Subject: [PATCH 15/52] ENH: Updated doygen css (Chris) --- doc/Doxygen/css/doxyTabs.css | 21 ++- doc/Doxygen/css/doxygen.css | 353 ++++++++++++++++++----------------- 2 files changed, 198 insertions(+), 176 deletions(-) diff --git a/doc/Doxygen/css/doxyTabs.css b/doc/Doxygen/css/doxyTabs.css index 58f32ccf41..c97c25ee55 100644 --- a/doc/Doxygen/css/doxyTabs.css +++ b/doc/Doxygen/css/doxyTabs.css @@ -12,7 +12,8 @@ div.navigation div.tabs, -div.tabs2 +div.tabs2, +div.tabs3 { width : 100%; padding-top : 5px; @@ -22,7 +23,8 @@ div.tabs2 } div.tabs ul, -div.tabs2 ul +div.tabs2 ul, +div.tabs3 ul { margin: 0px; padding-left: 10px; @@ -33,7 +35,8 @@ div.tabs2 ul div.tabs li, div.tabs form, -div.tabs2 li, div.tabs2 form +div.tabs2 li, div.tabs2 form, +div.tabs3 li, div.tabs3 form { display : inline; margin : 0px; @@ -41,7 +44,8 @@ div.tabs2 li, div.tabs2 form } div.tabs ul li, -div.tabs2 ul li +div.tabs2 ul li, +div.tabs3 ul li { padding-top: 10px; padding-bottom: 10px; @@ -77,14 +81,19 @@ div.tabs a:hover, div.tabs2 a:link, div.tabs2 a:visited, div.tabs2 a:active, -div.tabs2 a:hover +div.tabs2 a:hover, +div.tabs3 a:link, +div.tabs3 a:visited, +div.tabs3 a:active, +div.tabs3 a:hover { color : #000000; color:#555; } div.tabs span, -div.tabs2 span +div.tabs2 span, +div.tabs3 span { display : inline; padding : 0px 9px; diff --git a/doc/Doxygen/css/doxygen.css b/doc/Doxygen/css/doxygen.css index c063349e6e..83787a71f9 100644 --- a/doc/Doxygen/css/doxygen.css +++ b/doc/Doxygen/css/doxygen.css @@ -11,49 +11,49 @@ body, table, div, p, dl { /* @group Heading Levels */ h1 { - text-align: center; - font-size: 150%; + text-align: center; + font-size: 150%; } h2 { - font-size: 120%; + font-size: 120%; } h3 { - font-size: 100%; + font-size: 100%; } dt { - font-weight: bold; + font-weight: bold; } div.multicol { - -moz-column-gap: 1em; - -webkit-column-gap: 1em; - -moz-column-count: 3; - -webkit-column-count: 3; + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { - margin-top: 2px; + margin-top: 2px; } p.endli { - margin-bottom: 0px; + margin-bottom: 0px; } p.enddd { - margin-bottom: 4px; + margin-bottom: 4px; } p.endtd { - margin-bottom: 2px; + margin-bottom: 2px; } /* @end */ caption { - font-weight: bold; + font-weight: bold; } span.legend { @@ -67,47 +67,47 @@ h3.version { } div.qindex, div.navtab{ - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; } div.qindex, div.navpath { - width: 100%; - line-height: 140%; + width: 100%; + line-height: 140%; } div.navtab { - margin-right: 15px; + margin-right: 15px; } /* @group Link Styling */ a { - color: #153788; - font-weight: normal; - text-decoration: none; + color: #153788; + font-weight: normal; + text-decoration: none; } .contents a:visited { - color: #1b77c5; + color: #1b77c5; } a:hover { - text-decoration: underline; + text-decoration: underline; } a.qindex { - font-weight: bold; + font-weight: bold; } a.qindexHL { - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; } .contents a.qindexHL:visited { @@ -115,90 +115,92 @@ a.qindexHL { } a.el { - font-weight: bold; + font-weight: bold; } a.elRef { } a.code { - color: #3030f0; + color: #3030f0;; + font-family: "Courier New", Courier, monospace, fixed; } a.codeRef { - color: #3030f0; + color: #3030f0;; + font-family: "Courier New", Courier, monospace, fixed; } /* @end */ dl.el { - margin-left: -1cm; + margin-left: -1cm; } .fragment { - font-family: monospace, fixed; - font-size: 105%; + font-size: 105%; + font-family: "Courier New", Courier, monospace, fixed; } pre.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; } div.ah { - background-color: black; - font-weight: bold; - color: #ffffff; - margin-bottom: 3px; - margin-top: 3px + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px } div.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; } div.groupText { - margin-left: 16px; - font-style: italic; + margin-left: 16px; + font-style: italic; } body { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; } td.indexkey { - background-color: #e8eef2; - font-weight: bold; - border: 1px solid #CCCCCC; - margin: 2px 0px 2px 0; - padding: 2px 10px; + background-color: #e8eef2; + font-weight: bold; + border: 1px solid #CCCCCC; + margin: 2px 0px 2px 0; + padding: 2px 10px; } td.indexvalue { - background-color: #e8eef2; - border: 1px solid #CCCCCC; - padding: 2px 10px; - margin: 2px 0px; + background-color: #e8eef2; + border: 1px solid #CCCCCC; + padding: 2px 10px; + margin: 2px 0px; } tr.memlist { - background-color: #f0f0f0; + background-color: #f0f0f0; } p.formulaDsp { - text-align: center; + text-align: center; } img.formulaDsp { @@ -206,113 +208,124 @@ img.formulaDsp { } img.formulaInl { - vertical-align: middle; + vertical-align: middle; } div.center { - text-align: center; + text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { - border: 0px; + border: 0px; } img.footer { - border: 0px; - vertical-align: middle; + border: 0px; + vertical-align: middle; } /* @group Code Colorization */ span.keyword { - color: #008000 + color: #008000; + font-family: "Courier New", Courier, monospace, fixed; } span.keywordtype { - color: #604020 + color: #604020; + font-family: "Courier New", Courier, monospace, fixed; } span.keywordflow { - color: #e08000 + color: #e08000; + font-family: "Courier New", Courier, monospace, fixed; } span.comment { - color: #800000 + color: #800000; + font-family: "Courier New", Courier, monospace, fixed; } span.preprocessor { - color: #806020 + color: #806020; + font-family: "Courier New", Courier, monospace, fixed; } span.stringliteral { - color: #002080 + color: #002080; + font-family: "Courier New", Courier, monospace, fixed; } span.charliteral { - color: #008080 + color: #008080; + font-family: "Courier New", Courier, monospace, fixed; } span.vhdldigit { - color: #ff00ff + color: #ff00ff; + font-family: "Courier New", Courier, monospace, fixed; } span.vhdlchar { - color: #000000 + color: #000000; + font-family: "Courier New", Courier, monospace, fixed; } span.vhdlkeyword { - color: #700070 + color: #700070; + font-family: "Courier New", Courier, monospace, fixed; } span.vhdllogic { - color: #ff0000 + color: #ff0000; + font-family: "Courier New", Courier, monospace, fixed; } /* @end */ .search { - color: #003399; - font-weight: bold; + color: #003399; + font-weight: bold; } form.search { - margin-bottom: 0px; - margin-top: 0px; + margin-bottom: 0px; + margin-top: 0px; } input.search { - font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; } td.tiny { - font-size: 75%; + font-size: 75%; } .dirtab { - padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; } th.dirtab { - background: #e8eef2; - font-weight: bold; + background: #e8eef2; + font-weight: bold; } hr { - height: 0px; - border: none; - border-top: 1px solid #666; + height: 0px; + border: none; + border-top: 1px solid #666; } hr.footer { - height: 1px; + height: 1px; } /* @group Member Descriptions */ @@ -320,19 +333,19 @@ hr.footer { .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { - background-color: #FAFAFA; - border: none; - margin: 4px; - padding: 1px 0 0 8px; + background-color: #FAFAFA; + border: none; + margin: 4px; + padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { - padding: 0px 8px 4px 8px; - color: #555; + padding: 0px 8px 4px 8px; + color: #555; } .memItemLeft, .memItemRight, .memTemplParams { - border-top: 1px solid #ccc; + border-top: 1px solid #ccc; } .memItemLeft, .memTemplItemLeft { @@ -340,7 +353,7 @@ hr.footer { } .memTemplParams { - color: #606060; + color: #606060; white-space: nowrap; } @@ -351,24 +364,24 @@ hr.footer { /* Styles for detailed member documentation */ .memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; - margin-left: 3px; + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; } .memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; } .memitem { - padding: 0; - margin-bottom: 10px; + padding: 0; + margin-bottom: 10px; } .memname { @@ -415,19 +428,19 @@ hr.footer { } .paramkey { - text-align: right; + text-align: right; } .paramtype { - white-space: nowrap; + white-space: nowrap; } .paramname { - color: #602020; - white-space: nowrap; + color: #602020; + white-space: nowrap; } .paramname em { - font-style: normal; + font-style: normal; } /* @end */ @@ -437,21 +450,21 @@ hr.footer { /* for the tree view */ .ftvtree { - font-family: sans-serif; - margin: 0.5em; + font-family: sans-serif; + margin: 0.5em; } /* these are for tree view when used as main index */ .directory { - font-size: 9pt; - font-weight: bold; + font-size: 9pt; + font-weight: bold; } .directory h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; + margin: 0px; + margin-top: 1em; + font-size: 11pt; } /* @@ -463,86 +476,86 @@ proper pixel height of your image. /* .directory h3.swap { - height: 61px; - background-repeat: no-repeat; - background-image: url("yourimage.gif"); + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); } .directory h3.swap span { - display: none; + display: none; } */ .directory > h3 { - margin-top: 0; + margin-top: 0; } .directory p { - margin: 0px; - white-space: nowrap; + margin: 0px; + white-space: nowrap; } .directory div { - display: none; - margin: 0px; + display: none; + margin: 0px; } .directory img { - vertical-align: -30%; + vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { - font-size: 100%; - font-weight: bold; + font-size: 100%; + font-weight: bold; } .directory-alt h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; + margin: 0px; + margin-top: 1em; + font-size: 11pt; } .directory-alt > h3 { - margin-top: 0; + margin-top: 0; } .directory-alt p { - margin: 0px; - white-space: nowrap; + margin: 0px; + white-space: nowrap; } .directory-alt div { - display: none; - margin: 0px; + display: none; + margin: 0px; } .directory-alt img { - vertical-align: -30%; + vertical-align: -30%; } /* @end */ address { - font-style: normal; - color: #333; + font-style: normal; + color: #333; } table.doxtable { - border-collapse:collapse; + border-collapse:collapse; } table.doxtable td, table.doxtable th { - border: 1px solid #153788; - padding: 3px 7px 2px; + border: 1px solid #153788; + padding: 3px 7px 2px; } table.doxtable th { - background-color: #254798; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; - text-align:left; + background-color: #254798; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; } From c00c3456e2dd2828b58cd83dbc2a874b1c31186c Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 15:10:44 +0000 Subject: [PATCH 16/52] ENH: Updated header documentation --- ...allHeatFluxTemperatureFvPatchScalarField.H | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 48fad5af6d..93c26299a1 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - externalWallHeatFluxTemperatureFvPatchScalarField + Foam::externalWallHeatFluxTemperatureFvPatchScalarField Group grpThermoBoundaryConditions grpWallBoundaryConditions @@ -34,34 +34,50 @@ Description fixed heat transfer coefficient mode. The condition can operate in two modes: - \li fixed heat transfer coefficient: supply h and Ta - \li fixed heat flux: supply q + - fixed heat transfer coefficient: supply h and Ta + - fixed heat flux: supply q - where - \var h = heat transfer coefficient [W/m2/K] - \var Ta = ambient temperature [K] - \var q = heat flux [W/m2] + where: + \vartable + h | heat transfer coefficient [W/m2/K] + Ta | ambient temperature [K] + q | heat flux [W/m2] + \endvartable The thermal conductivity, \c kappa, can either be retrieved from the mesh database using the \c lookup option, or from a \c solidThermo thermophysical package. + + \heading Patch usage + + \table + Property | Description | Required | Default value + kappa | thermal conductivity option | yes | + q | heat flux [W/m2] | yes* | + Ta | ambient temperature [K] | yes* | + h | heat transfer coefficient [W/m/K] | yes*| + 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 | + \endtable + Example of the boundary condition specification: \verbatim - myPatch - { - type externalWallHeatFluxTemperature; - kappa fluidThermo; // fluidThermo, solidThermo or - // lookup - q uniform 1000; // heat flux / [W/m2] - Ta uniform 300.0; // ambient temperature /[K] - h uniform 10.0; // heat transfer coeff /[W/Km2] - thicknessLayers (0.1 0.2 0.3 0.4); // thickness of layer [m] - kappaLayers (1 2 3 4) // thermal conductivity of - // layer [W/m/K] - value uniform 300.0; // initial temperature / [K] - kappaName none; - } + myPatch + { + type externalWallHeatFluxTemperature; + kappa fluidThermo; // fluidThermo, solidThermo or + // lookup + q uniform 1000; // heat flux / [W/m2] + Ta uniform 300.0; // ambient temperature /[K] + h uniform 10.0; // heat transfer coeff /[W/Km2] + thicknessLayers (0.1 0.2 0.3 0.4); // thickness of layer [m] + kappaLayers (1 2 3 4) // thermal conductivity of + // layer [W/m/K] + value uniform 300.0; // initial temperature / [K] + kappaName none; + } \endverbatim Note From eff13c862a66559a0cb127f3e3ff3c0a296c6d89 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 17:18:36 +0000 Subject: [PATCH 17/52] ENH: totalPressure boundary condition header documentation update --- .../totalPressureFvPatchScalarField.H | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H index 5c40707334..5887bbc3fa 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H @@ -33,47 +33,47 @@ Description 1. incompressible subsonic: \f[ - p_T = p_0 + 0.5 |U|^2 + p_p = p_0 - 0.5 |U|^2 \f] where \vartable - p_T | incompressible total pressure [m2/s2] - p_0 | incompressible reference pressure [m2/s2] + p_p | incompressible pressure at patch [m2/s2] + p_0 | incompressible total pressure [m2/s2] U | velocity \endvartable 2. compressible subsonic: \f[ - p_T = p_0 + 0.5 \rho |U|^2 + p_p = p_0 - 0.5 \rho |U|^2 \f] where \vartable - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] \rho | density [kg/m3] U | velocity \endvartable 3. compressible transonic (\gamma <= 1): \f[ - p_T = \frac{p_0}{1 + 0.5 \psi |U|^2} + p_p = \frac{p_0}{1 + 0.5 \psi |U|^2} \f] where \vartable - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ \endvartable 4. compressible supersonic (\gamma > 1): \f[ - p_T = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}} + p_p = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}} \f] where \vartable + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] \gamma | ratio of specific heats (Cp/Cv) - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] \psi | compressibility [m2/s2] G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ \endvartable @@ -98,7 +98,7 @@ Description rho | density field name | no | none psi | compressibility field name | no | none gamma | ratio of specific heats (Cp/Cv) | yes | - p0 | static pressure reference | yes | + p0 | total pressure | yes | \endtable Example of the boundary condition specification: From 42befaaa08cb63940ba7316aa5094638e9143363 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 21 Nov 2013 17:23:15 +0000 Subject: [PATCH 18/52] ENH: externalWallHeatFlux boundary condition header documentation update --- ...allHeatFluxTemperatureFvPatchScalarField.H | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 93c26299a1..c07344e8b6 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -67,21 +67,20 @@ Description myPatch { type externalWallHeatFluxTemperature; - kappa fluidThermo; // fluidThermo, solidThermo or - // lookup - q uniform 1000; // heat flux / [W/m2] - Ta uniform 300.0; // ambient temperature /[K] - h uniform 10.0; // heat transfer coeff /[W/Km2] - thicknessLayers (0.1 0.2 0.3 0.4); // thickness of layer [m] - kappaLayers (1 2 3 4) // thermal conductivity of - // layer [W/m/K] - value uniform 300.0; // initial temperature / [K] + kappa fluidThermo; + q uniform 1000; + Ta uniform 300.0; + h uniform 10.0; + thicknessLayers (0.1 0.2 0.3 0.4); + kappaLayers (1 2 3 4) + value uniform 300.0; kappaName none; } \endverbatim Note - Only supply \c h and \c Ta, or \c q in the dictionary (see above) + - Only supply \c h and \c Ta, or \c q in the dictionary (see above) + - kappa entries can be: fluidThermo, solidThermo or lookup SourceFiles externalWallHeatFluxTemperatureFvPatchScalarField.C From b0ca0d9dde9cc2d407d91882321970b284c431b0 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 22 Nov 2013 15:07:36 +0000 Subject: [PATCH 19/52] ENH: surface film - updated removeInjection model --- .../removeInjection/removeInjection.C | 50 ++++++++++++++++--- .../removeInjection/removeInjection.H | 12 ++++- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C index a19eee6d1b..8cd45f60af 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,11 +45,35 @@ addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary); removeInjection::removeInjection ( const surfaceFilmModel& owner, - const dictionary& + const dictionary& dict ) : - injectionModel(owner) -{} + injectionModel(type(), owner, dict), + deltaStable_(coeffs_.lookupOrDefault("deltaStable", 0.0)), + mask_(owner.regionMesh().nCells(), -1) +{ + wordReList patches; + if (coeffs_.readIfPresent("patches", patches)) + { + Info<< " applying to patches:" << nl; + const polyBoundaryMesh& pbm = owner.regionMesh().boundaryMesh(); + const labelHashSet patchSet = pbm.patchSet(patches); + + forAllConstIter(labelHashSet, patchSet, iter) + { + label patchI = iter.key(); + const polyPatch& pp = pbm[patchI]; + UIndirectList(mask_, pp.faceCells()) = 1.0; + + Info<< " " << pp.name() << endl; + } + } + else + { + Info<< " applying to all patches" << endl; + mask_ = 1.0; + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -64,11 +88,23 @@ void removeInjection::correct ( scalarField& availableMass, scalarField& massToInject, - scalarField& + scalarField& diameterToInject ) { - massToInject = availableMass; - availableMass = 0.0; + const scalarField& delta = owner().delta(); + const scalarField& rho = owner().rho(); + const scalarField& magSf = owner().magSf(); + + forAll(delta, cellI) + { + if (mask_[cellI] > 0) + { + scalar ddelta = max(0.0, delta[cellI] - deltaStable_); + scalar dMass = ddelta*rho[cellI]*magSf[cellI]; + massToInject[cellI] += dMass; + availableMass[cellI] -= dMass; + } + } } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H index 35c1f5809d..fd8c635344 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,16 @@ private: void operator=(const removeInjection&); +protected: + + //- Stable film thickness - mass only removed if thickness execeeds + // this threhold value + scalar deltaStable_; + + //- Mask per cell to indicate whether mass can be removed + scalarField mask_; + + public: //- Runtime type information From 01d215097c1d3e62f27c6b465237985085261aef Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 24 Nov 2013 11:33:49 +0000 Subject: [PATCH 20/52] prghPressure: New pressure BC to allow the specification of a fixed static-pressure distribution in the p_rgh field --- .../prghPressureFvPatchScalarField.C | 185 ++++++++++++++ .../prghPressureFvPatchScalarField.H | 236 ++++++++++++++++++ 2 files changed, 421 insertions(+) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C new file mode 100644 index 0000000000..2338247e78 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 "prghPressureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + rhoName_("rho"), + p_(p.size(), 0.0) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + rhoName_(dict.lookupOrDefault("rhoName", "rho")), + p_("p", dict, p.size()) +{ + if (dict.found("value")) + { + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); + } + else + { + fvPatchField::operator=(p_); + } +} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + rhoName_(ptf.rhoName_), + p_(ptf.p_, mapper) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf +) +: + fixedValueFvPatchScalarField(ptf), + rhoName_(ptf.rhoName_), + p_(ptf.p_) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(ptf, iF), + rhoName_(ptf.rhoName_), + p_(ptf.p_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::prghPressureFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + p_.autoMap(m); +} + + +void Foam::prghPressureFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const prghPressureFvPatchScalarField& tiptf = + refCast(ptf); + + p_.rmap(tiptf.p_, addr); +} + + +void Foam::prghPressureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& rhop = patch().lookupPatchField + ( + rhoName_ + ); + + const uniformDimensionedVectorField& g = + db().lookupObject("g"); + + operator==(p_ - rhop*((g.value() & patch().Cf()))); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::prghPressureFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + if (rhoName_ != "rho") + { + os.writeKeyword("rhoName") + << rhoName_ << token::END_STATEMENT << nl; + } + p_.writeEntry("p", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + prghPressureFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H new file mode 100644 index 0000000000..9431ae325e --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H @@ -0,0 +1,236 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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::prghPressureFvPatchScalarField + +Group + grpGenericBoundaryConditions + +Description + This boundary condition provides static pressure condition for p_rgh, + calculated as: + + \f[ + p_rgh = p - \rho g h + \f] + + where + \vartable + p_rgh | Pseudo hydrostatic pressure [Pa] + p | Static pressure [Pa] + h | Height in the opposite direction to gravity + \rho | density + g | acceleration due to gravity [m/s2] + \endtable + + \heading Patch usage + + \table + Property | Description | Required | Default value + rhoName | rho field name | no | rho + p | static pressure | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type prghPressure; + rhoName rho; + p uniform 0; + value uniform 0; // optional initial value + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchScalarField + +SourceFiles + prghPressureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef prghPressureFvPatchScalarField_H +#define prghPressureFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class prghPressureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class prghPressureFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + +protected: + + // Protected data + + //- Name of phase-fraction field + word rhoName_; + + //- Static pressure + scalarField p_; + + +public: + + //- Runtime type information + TypeName("prghPressure"); + + + // Constructors + + //- Construct from patch and internal field + prghPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + prghPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // prghPressureFvPatchScalarField onto a new patch + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new prghPressureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new prghPressureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the rhoName + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the rhoName to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the static pressure + const scalarField& p() const + { + return p_; + } + + //- Return reference to the static pressure to allow adjustment + scalarField& p() + { + return p_; + } + + + // 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& + ); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From c5323158eea19ea17da5a7b9041de4b78c77d882 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 24 Nov 2013 11:38:15 +0000 Subject: [PATCH 21/52] CMULES: Corrected the handling of outflow faces --- .../fvMatrices/solvers/MULES/CMULES.C | 4 ++ .../fvMatrices/solvers/MULES/CMULES.H | 7 ++++ .../solvers/MULES/CMULESTemplates.C | 41 ++++++++++++++++--- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C index a954dccf56..5c3f71487d 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C @@ -30,6 +30,7 @@ License void Foam::MULES::correct ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiPsiCorr, const scalar psiMax, const scalar psiMin @@ -39,6 +40,7 @@ void Foam::MULES::correct ( geometricOneField(), psi, + phi, phiPsiCorr, zeroField(), zeroField(), psiMax, psiMin @@ -49,6 +51,7 @@ void Foam::MULES::correct void Foam::MULES::LTScorrect ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiPsiCorr, const scalar psiMax, const scalar psiMin @@ -58,6 +61,7 @@ void Foam::MULES::LTScorrect ( geometricOneField(), psi, + phi, phiPsiCorr, zeroField(), zeroField(), psiMax, psiMin diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H index 2786a86aae..78a1d9f9de 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H @@ -66,6 +66,7 @@ void correct const RdeltaTType& rDeltaT, const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su @@ -76,6 +77,7 @@ void correct ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -86,6 +88,7 @@ void correct void correct ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const scalar psiMax, const scalar psiMin @@ -96,6 +99,7 @@ void LTScorrect ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -106,6 +110,7 @@ void LTScorrect void LTScorrect ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const scalar psiMax, const scalar psiMin @@ -119,6 +124,7 @@ void limiterCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -133,6 +139,7 @@ void limitCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index 2ff99745da..e41c9bec11 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -37,6 +37,7 @@ void Foam::MULES::correct const RdeltaTType& rDeltaT, const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su @@ -77,6 +78,7 @@ void Foam::MULES::correct ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -94,8 +96,18 @@ void Foam::MULES::correct readLabel(MULEScontrols.lookup("nLimiterIter")) ); - limitCorr(rDeltaT, rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); - correct(rDeltaT, rho, psi, phiCorr, Sp, Su); + limitCorr + ( + rDeltaT, + rho, + psi, + phi, + phiCorr, + Sp, Su, + psiMax, psiMin, + nLimiterIter + ); + correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su); } @@ -104,6 +116,7 @@ void Foam::MULES::LTScorrect ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -123,8 +136,18 @@ void Foam::MULES::LTScorrect readLabel(MULEScontrols.lookup("nLimiterIter")) ); - limitCorr(rDeltaT, rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); - correct(rDeltaT, rho, psi, phiCorr, Sp, Su); + limitCorr + ( + rDeltaT, + rho, + psi, + phi, + phiCorr, + Sp, Su, + psiMax, psiMin, + nLimiterIter + ); + correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su); } @@ -135,6 +158,7 @@ void Foam::MULES::limiterCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -153,6 +177,9 @@ void Foam::MULES::limiterCorr tmp tVsc = mesh.Vsc(); const scalarField& V = tVsc(); + const surfaceScalarField::GeometricBoundaryField& phiBf = + phi.boundaryField(); + const scalarField& phiCorrIf = phiCorr; const surfaceScalarField::GeometricBoundaryField& phiCorrBf = phiCorr.boundaryField(); @@ -408,12 +435,12 @@ void Foam::MULES::limiterCorr { const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); - const scalarField& phiCorrPf = phiCorrBf[patchi]; + const scalarField& phiPf = phiBf[patchi]; forAll(lambdaPf, pFacei) { // Limit outlet faces only - if (phiCorrPf[pFacei] > SMALL*SMALL) + if (phiPf[pFacei] > SMALL*SMALL) { label pfCelli = pFaceCells[pFacei]; @@ -443,6 +470,7 @@ void Foam::MULES::limitCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -478,6 +506,7 @@ void Foam::MULES::limitCorr rDeltaT, rho, psi, + phi, phiCorr, Sp, Su, From 9f1a299a5d39f15e5834a6b43fa754384c60579d Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 24 Nov 2013 17:02:50 +0000 Subject: [PATCH 22/52] outletPhaseMeanVelocityFvPatchVectorField: New BC for the outlet of a towing-tank to maintain the water level at the same level as the inlet --- ...utletPhaseMeanVelocityFvPatchVectorField.C | 188 +++++++++++++++++ ...utletPhaseMeanVelocityFvPatchVectorField.H | 197 ++++++++++++++++++ 2 files changed, 385 insertions(+) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..abf782bc90 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 "outletPhaseMeanVelocityFvPatchVectorField.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchField(p, iF), + Umean_(0), + alphaName_("none") +{ + refValue() = vector::zero; + refGrad() = vector::zero; + valueFraction() = 0.0; +} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchField(ptf, p, iF, mapper), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchField(p, iF), + Umean_(readScalar(dict.lookup("Umean"))), + alphaName_(dict.lookup("alpha")) +{ + refValue() = vector::zero; + refGrad() = vector::zero; + valueFraction() = 0.0; + + if (dict.found("value")) + { + fvPatchVectorField::operator= + ( + vectorField("value", dict, p.size()) + ); + } + else + { + fvPatchVectorField::operator=(patchInternalField()); + } +} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf +) +: + mixedFvPatchField(ptf), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + mixedFvPatchField(ptf, iF), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::outletPhaseMeanVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + scalarField alphap = + patch().lookupPatchField(alphaName_); + + alphap = max(alphap, scalar(0)); + alphap = min(alphap, scalar(1)); + + // Get the patchInternalField (zero-gradient field) + vectorField Uzg(patchInternalField()); + + // Calculate the phase mean zero-gradient velocity + scalar Uzgmean = + gSum(alphap*(patch().Sf() & Uzg)) + /gSum(alphap*patch().magSf()); + + // Set the refValue and valueFraction to adjust the boundary field + // such that the phase mean is Umean_ + if (Uzgmean >= Umean_) + { + refValue() = vector::zero; + valueFraction() = 1.0 - Umean_/Uzgmean; + } + else + { + refValue() = (Umean_ + Uzgmean)*patch().nf(); + valueFraction() = 1.0 - Uzgmean/Umean_; + } + + mixedFvPatchField::updateCoeffs(); +} + + +void Foam::outletPhaseMeanVelocityFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchField::write(os); + + os.writeKeyword("Umean") << Umean_ + << token::END_STATEMENT << nl; + os.writeKeyword("alpha") << alphaName_ + << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + outletPhaseMeanVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..5e5dec0213 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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::outletPhaseMeanVelocityFvPatchVectorField + +Group + grpOutletBoundaryConditions + +Description + This boundary condition adjusts the velocity for the given phase to achieve + the specified mean thus causing the phase-fraction to adjust according to + the mass flow rate. + + Typical usage is as the outlet condition for a towing-tank ship simulation + to maintain the outlet water level at the level as the inlet. + + \heading Patch usage + \table + Property | Description | Required | Default value + Umean | mean velocity normal to the boundary [m/s] | yes | + alpha | phase-fraction field | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type outletPhaseMeanVelocity; + Umean 1.2; + alpha alpha.water; + value uniform (1.2 0 0); + } + \endverbatim + +SeeAlso + Foam::mixedFvPatchField + Foam::variableHeightFlowRateInletVelocityFvPatchVectorField + +SourceFiles + outletPhaseMeanVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef outletPhaseMeanVelocityFvPatchVectorField_H +#define outletPhaseMeanVelocityFvPatchVectorField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class outletPhaseMeanVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class outletPhaseMeanVelocityFvPatchVectorField +: + public mixedFvPatchVectorField +{ + // Private data + + //- Inlet integral flow rate + scalar Umean_; + + //- Name of the phase-fraction field + word alphaName_; + + +public: + + //- Runtime type information + TypeName("outletPhaseMeanVelocity"); + + + // Constructors + + //- Construct from patch and internal field + outletPhaseMeanVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + outletPhaseMeanVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // outletPhaseMeanVelocityFvPatchVectorField + // onto a new patch + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new outletPhaseMeanVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new outletPhaseMeanVelocityFvPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Access + + //- Return the flux + scalar Umean() const + { + return Umean_; + } + + //- Return reference to the flux to allow adjustment + scalar& Umean() + { + return Umean_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From e1887bd0637c02dc87248d77b57239c752ebc159 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Nov 2013 08:32:51 +0000 Subject: [PATCH 23/52] Updated --- src/finiteVolume/Make/files | 1 + 1 file changed, 1 insertion(+) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 212a22baf5..7bc4bacf70 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -189,6 +189,7 @@ $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C $(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C $(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C $(derivedFvPatchFields)/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C From e3e04be28aa1b1114942d4d80f7488154923ab46 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Nov 2013 08:33:02 +0000 Subject: [PATCH 24/52] Updated for PC-MULES --- src/finiteVolume/cfdTools/general/include/alphaControls.H | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/finiteVolume/cfdTools/general/include/alphaControls.H b/src/finiteVolume/cfdTools/general/include/alphaControls.H index e57869309a..7ba7a2f20f 100644 --- a/src/finiteVolume/cfdTools/general/include/alphaControls.H +++ b/src/finiteVolume/cfdTools/general/include/alphaControls.H @@ -10,3 +10,11 @@ bool alphaOuterCorrectors ( alphaControls.lookupOrDefault("alphaOuterCorrectors", false) ); + +// Apply the compression correction from the previous iteration +// Improves efficiency for steady-simulations but can only be applied +// once the alpha field is reasonably steady, i.e. fully developed +bool alphaApplyPrevCorr +( + alphaControls.lookupOrDefault("alphaApplyPrevCorr", false) +); From 4bb0f806433539ef778dc4954a8ba396a4fec3e4 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Nov 2013 10:06:35 +0000 Subject: [PATCH 25/52] Added prghPressureFvPatchScalarField --- src/finiteVolume/Make/files | 1 + 1 file changed, 1 insertion(+) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 212a22baf5..3cf741ef81 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -192,6 +192,7 @@ $(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRa $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C $(derivedFvPatchFields)/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/prghPressure/prghPressureFvPatchScalarField.C fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C From 1a56cdfd14c912d213f5be09d0c96e258eaecda2 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Nov 2013 10:10:00 +0000 Subject: [PATCH 26/52] interfaceProperties: Name grad(alpha1) "nHat" so that a specific scheme can be selected for it --- .../interfaceProperties/interfaceProperties.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index cfa20630ae..9387769cae 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -112,7 +112,7 @@ void Foam::interfaceProperties::calculateK() const surfaceVectorField& Sf = mesh.Sf(); // Cell gradient of alpha - const volVectorField gradAlpha(fvc::grad(alpha1_)); + const volVectorField gradAlpha(fvc::grad(alpha1_, "nHat")); // Interpolated face-gradient of alpha surfaceVectorField gradAlphaf(fvc::interpolate(gradAlpha)); @@ -123,6 +123,11 @@ void Foam::interfaceProperties::calculateK() // Face unit interface normal surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_)); + // surfaceVectorField nHatfv + // ( + // (gradAlphaf + deltaN_*vector(0, 0, 1) + // *sign(gradAlphaf.component(vector::Z)))/(mag(gradAlphaf) + deltaN_) + // ); correctContactAngle(nHatfv.boundaryField(), gradAlphaf.boundaryField()); // Face unit interface normal flux From 72530d40ba7f85272212fc5fc458d50f6974a379 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Mon, 25 Nov 2013 10:46:52 +0000 Subject: [PATCH 27/52] ENH: adding const access to reactingMixture list --- .../mixtures/reactingMixture/reactingMixture.H | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H index b29c0758ad..210b9771b7 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,6 +96,11 @@ public: { return PtrList >::operator[](i); } + + const Reaction& operator [] (const label i) const + { + return PtrList >::operator[](i); + } }; From 18ae63051bcd3aa2047a9cf628d2d56074c67eaa Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 25 Nov 2013 10:51:44 +0000 Subject: [PATCH 28/52] ENH: functionObjectFile - added standardised function for writing values --- .../functionObjectFile/functionObjectFile.C | 6 ++++++ .../functionObjectFile/functionObjectFile.H | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index b711b2d17f..f441f125a6 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -147,6 +147,12 @@ void Foam::functionObjectFile::resetName(const word& name) } +Foam::Omanip Foam::functionObjectFile::valueWidth(const label offset) const +{ + return setw(IOstream::defaultPrecision() + 7 + offset); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::functionObjectFile::functionObjectFile diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H index f4c0ab1178..54658bdba9 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ SourceFiles #include "OFstream.H" #include "PtrList.H" #include "HashSet.H" +#include "IOmanip.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -98,6 +99,9 @@ protected: //- Reset the list of names to a single name entry virtual void resetName(const word& name); + //- Return the value width when writing to stream with optional offset + virtual Omanip valueWidth(const label offset = 0) const; + //- Disallow default bitwise copy construct functionObjectFile(const functionObjectFile&); @@ -149,6 +153,14 @@ public: //- Return file 'i' OFstream& file(const label i); + + //- Write a formatted value to stream + template + const char* writeValue + ( + const Type& value, + const label offset = 0 + ) const; }; @@ -158,6 +170,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "functionObjectFileTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // From 636215a0ea9591f17d8b9e70d7cd1c23fcc18d91 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 25 Nov 2013 10:52:20 +0000 Subject: [PATCH 29/52] ENH: functionObjects - updated writing to file --- .../functionObjectFile/functionObjectFile.C | 51 +++++++- .../functionObjectFile/functionObjectFile.H | 41 ++++++- .../cloud/cloudInfo/cloudInfo.C | 5 +- .../field/fieldMinMax/fieldMinMax.C | 15 ++- .../field/fieldMinMax/fieldMinMaxTemplates.C | 34 +++--- .../fieldValueDelta/fieldValueDelta.C | 11 +- .../forces/forceCoeffs/forceCoeffs.C | 48 ++++---- .../functionObjects/forces/forces/forces.C | 110 +++++++++--------- .../DESModelRegions/DESModelRegions.C | 14 ++- .../wallShearStress/wallShearStress.C | 16 ++- .../utilities/yPlusLES/yPlusLES.C | 31 +++-- .../utilities/yPlusRAS/yPlusRAS.C | 31 +++-- .../simpleFoam/motorBike/system/controlDict | 2 +- .../simpleFoam/motorBike/system/forceCoeffs | 3 +- 14 files changed, 267 insertions(+), 145 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index f441f125a6..f2bab5983a 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -31,9 +31,18 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing"; +Foam::label Foam::functionObjectFile::addChars = 7; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +void Foam::functionObjectFile::initStream(Ostream& os) const +{ + os.setf(ios_base::scientific, ios_base::floatfield); +// os.precision(IOstream::defaultPrecision()); + os.width(charWidth()); +} + + Foam::fileName Foam::functionObjectFile::baseFileDir() const { fileName baseDir = obr_.time().path(); @@ -96,6 +105,8 @@ void Foam::functionObjectFile::createFiles() filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat"))); + initStream(filePtrs_[i]); + writeFileHeader(i); i++; @@ -149,7 +160,7 @@ void Foam::functionObjectFile::resetName(const word& name) Foam::Omanip Foam::functionObjectFile::valueWidth(const label offset) const { - return setw(IOstream::defaultPrecision() + 7 + offset); + return setw(IOstream::defaultPrecision() + addChars + offset); } @@ -295,4 +306,42 @@ Foam::OFstream& Foam::functionObjectFile::file(const label i) } +Foam::label Foam::functionObjectFile::charWidth() const +{ + return IOstream::defaultPrecision() + addChars; +} + + +void Foam::functionObjectFile::writeCommented +( + Ostream& os, + const string& str +) const +{ + os << setw(1) << "#" << setw(1) << ' ' + << setw(charWidth() - 2) << str.c_str(); +} + + +void Foam::functionObjectFile::writeTabbed +( + Ostream& os, + const string& str +) const +{ + os << tab << setw(charWidth()) << str.c_str(); +} + + +void Foam::functionObjectFile::writeHeader +( + Ostream& os, + const string& str +) const +{ + os << setw(1) << "#" << setw(1) << ' ' + << setf(ios_base::left) << setw(charWidth() - 2) << str.c_str() << nl; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H index 54658bdba9..5488da6e58 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H @@ -78,6 +78,9 @@ protected: // Protected Member Functions + //- Initialise the output stream for writing + virtual void initStream(Ostream& os) const; + //- Return the base directory for output virtual fileName baseFileDir() const; @@ -114,6 +117,9 @@ public: //- Folder prefix static const word outputPrefix; + //- Additional characters for writing + static label addChars; + // Constructors //- Construct null @@ -154,13 +160,38 @@ public: //- Return file 'i' OFstream& file(const label i); - //- Write a formatted value to stream - template - const char* writeValue + //- Write a commented string to stream + void writeCommented ( - const Type& value, - const label offset = 0 + Ostream& os, + const string& str ) const; + + //- Write a tabbed string to stream + void writeTabbed + ( + Ostream& os, + const string& str + ) const; + + //- Write a commented header to stream + void writeHeader + ( + Ostream& os, + const string& str + ) const; + + //- Write a (commented) header property and value pair + template + void writeHeaderValue + ( + Ostream& os, + const string& property, + const Type& value + ) const; + + //- Return width of character stream output + label charWidth() const; }; diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C index 6d338d96bc..f497c6188c 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -39,7 +39,10 @@ defineTypeNameAndDebug(cloudInfo, 0); void Foam::cloudInfo::writeFileHeader(const label i) { - file(i) << "# Time" << tab << "nParcels" << tab << "mass" << endl; + writeHeader(file(), "Cloud information"); + writeCommented(file(), "Time"); + writeTabbed(file(), "nParcels"); + writeTabbed(file(), "mass"); } diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 5c612fe8a3..0c61259012 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -112,20 +112,23 @@ void Foam::fieldMinMax::read(const dictionary& dict) void Foam::fieldMinMax::writeFileHeader(const label i) { - file() - << "# Time" << token::TAB << "field" << token::TAB - << "min" << token::TAB << "position(min)"; + writeHeader(file(), "Field minima and maxima"); + writeCommented(file(), "Time"); + writeTabbed(file(), "field"); + writeTabbed(file(), "min"); + writeTabbed(file(), "position(min)"); if (Pstream::parRun()) { - file() << token::TAB << "proc"; + writeTabbed(file(), "processor"); } - file() << token::TAB << "max" << token::TAB << "position(max)"; + writeTabbed(file(), "max"); + writeTabbed(file(), "position(max)"); if (Pstream::parRun()) { - file() << token::TAB << "proc"; + writeTabbed(file(), "processor"); } file() << endl; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 6bd6102b2e..4aa2a2b6cd 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,21 +111,25 @@ void Foam::fieldMinMax::calcMinMaxFields scalar maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; + file()<< obr_.time().value(); + writeTabbed(file(), fieldName); + file() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; + << token::TAB << minValue + << token::TAB << minC; if (Pstream::parRun()) { - file() << token::TAB << minI; + file()<< token::TAB << minI; } - file() << token::TAB << maxValue << token::TAB << maxC; + file() + << token::TAB << maxValue + << token::TAB << maxC; if (Pstream::parRun()) { - file() << token::TAB << maxI; + file()<< token::TAB << maxI; } file() << endl; @@ -212,21 +216,25 @@ void Foam::fieldMinMax::calcMinMaxFields Type maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; + file()<< obr_.time().value(); + writeTabbed(file(), fieldName); + file() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; + << token::TAB << minValue + << token::TAB << minC; if (Pstream::parRun()) { - file() << token::TAB << minI; + file()<< token::TAB << minI; } - file() << token::TAB << maxValue << token::TAB << maxC; + file() + << token::TAB << maxValue + << token::TAB << maxC; if (Pstream::parRun()) { - file() << token::TAB << maxI; + file()<< token::TAB << maxI; } file() << endl; diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C index 681ea7a02a..b251a362ea 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -94,11 +94,10 @@ void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i) Ostream& os = file(); - os << "# Source1 : " << source1Ptr_->name() << nl - << "# Source2 : " << source2Ptr_->name() << nl - << "# Operation : " << operationTypeNames_[operation_] << nl; - - os << "# Time"; + writeHeaderValue(os, "Source1", source1Ptr_->name()); + writeHeaderValue(os, "Source2", source2Ptr_->name()); + writeHeaderValue(os, "Operation", operationTypeNames_[operation_]); + writeCommented(os, "Time"); forAll(commonFields, i) { @@ -156,7 +155,7 @@ void Foam::fieldValues::fieldValueDelta::write() if (Pstream::master()) { - file()<< obr_.time().timeName(); + file()<< obr_.time().value(); } if (log_) diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 91943e1191..1daa0c279c 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -45,34 +45,41 @@ void Foam::forceCoeffs::writeFileHeader(const label i) { // force coeff data + writeHeader(file(i), "Force coefficients"); + writeHeaderValue(file(i), "liftDir", liftDir_); + writeHeaderValue(file(i), "dragDir", dragDir_); + writeHeaderValue(file(i), "pitchAxis", pitchAxis_); + writeHeaderValue(file(i), "magUInf", magUInf_); + writeHeaderValue(file(i), "lRef", lRef_); + writeHeaderValue(file(i), "Aref", Aref_); + writeHeaderValue(file(i), "CofR", coordSys_.origin()); + writeCommented(file(i), "Time"); + writeTabbed(file(i), "Cm"); + writeTabbed(file(i), "Cd"); + writeTabbed(file(i), "Cl"); + writeTabbed(file(i), "Cl(f)"); + writeTabbed(file(i), "Cl(r)"); file(i) - << "# liftDir : " << liftDir_ << nl - << "# dragDir : " << dragDir_ << nl - << "# pitchAxis : " << pitchAxis_ << nl - << "# magUInf : " << magUInf_ << nl - << "# lRef : " << lRef_ << nl - << "# Aref : " << Aref_ << nl - << "# CofR : " << coordSys_.origin() << nl - << "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab - << "Cl(f)" << tab << "Cl(r)"; + << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab << "Cl(f)" + << tab << "Cl(r)"; } else if (i == 1) { // bin coeff data - file(i) - << "# bins : " << nBin_ << nl - << "# start : " << binMin_ << nl - << "# delta : " << binDx_ << nl - << "# direction : " << binDir_ << nl - << "# Time"; + writeHeader(file(i), "Force coefficient bins"); + writeHeaderValue(file(i), "bins", nBin_); + writeHeaderValue(file(i), "start", binMin_); + writeHeaderValue(file(i), "delta", binDx_); + writeHeaderValue(file(i), "direction", binDir_); + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); - - file(i) - << tab << "Cm" << jn << tab << "Cd" << jn << tab << "Cl" << jn; + writeTabbed(file(i), "Cm" + jn); + writeTabbed(file(i), "Cd" + jn); + writeTabbed(file(i), "Cl" + jn); } } else @@ -193,9 +200,8 @@ void Foam::forceCoeffs::write() scalar Clr = Cl/2.0 - Cm; file(0) - << obr_.time().value() << tab - << Cm << tab << Cd << tab << Cl << tab << Clf << tab << Clr - << endl; + << obr_.time().value() << tab << Cm << tab << Cd + << tab << Cl << tab << Clf << tab << Clr << endl; if (log_) { diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 74b892aa1e..70c1e00e78 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -73,11 +73,13 @@ void Foam::forces::writeFileHeader(const label i) { // force data + writeHeader(file(i), "Forces"); + writeHeaderValue(file(i), "CofR", coordSys_.origin()); + writeCommented(file(i), "Time"); + file(i) - << "# CofR : " << coordSys_.origin() << nl - << "# Time" << tab - << "forces(pressure,viscous,porous) " - << "moment(pressure,viscous,porous)"; + << "forces[pressure,viscous,porous] " + << "moment[pressure,viscous,porous]"; if (localSystem_) { @@ -91,32 +93,30 @@ void Foam::forces::writeFileHeader(const label i) { // bin data - file(i) - << "# bins : " << nBin_ << nl - << "# start : " << binMin_ << nl - << "# delta : " << binDx_ << nl - << "# direction : " << binDir_ << nl - << "# Time"; + writeHeader(file(i), "Force bins"); + writeHeaderValue(file(i), "bins", nBin_); + writeHeaderValue(file(i), "start", binMin_); + writeHeaderValue(file(i), "delta", binDx_); + writeHeaderValue(file(i), "direction", binDir_); + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); + const word f("forces" + jn + "[pressure,viscous,porous]"); + const word m("moments" + jn + "[pressure,viscous,porous]"); - file(i) - << tab - << "forces" << jn << "(pressure,viscous,porous) " - << "moment" << jn << "(pressure,viscous,porous)"; + file(i)<< tab << f << tab << m; } if (localSystem_) { for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); + const word f("localForces" + jn + "[pressure,viscous,porous]"); + const word m("localMoments" + jn + "[pressure,viscous,porous]"); - file(i) - << tab - << "localForces" << jn << "(pressure,viscous,porous) " - << "localMoments" << jn << "(pressure,viscous,porous)"; + file(i)<< tab << f << tab << m; } } } @@ -370,28 +370,24 @@ void Foam::forces::writeForces() if (log_) { Info<< type() << " " << name_ << " output:" << nl - << " forces(pressure,viscous,porous) = (" - << sum(force_[0]) << "," - << sum(force_[1]) << "," - << sum(force_[2]) << ")" << nl - << " moment(pressure,viscous,porous) = (" - << sum(moment_[0]) << "," - << sum(moment_[1]) << "," - << sum(moment_[2]) << ")" - << nl; + << " sum of forces:" << nl + << " pressure : " << sum(force_[0]) << nl + << " viscous : " << sum(force_[1]) << nl + << " porous : " << sum(force_[2]) << nl + << " sum of moments:" << nl + << " pressure : " << sum(moment_[0]) << nl + << " viscous : " << sum(moment_[1]) << nl + << " porous : " << sum(moment_[2]) + << endl; } - file(0) << obr_.time().value() << tab - << "(" - << sum(force_[0]) << "," - << sum(force_[1]) << "," - << sum(force_[2]) - << ") " - << "(" - << sum(moment_[0]) << "," - << sum(moment_[1]) << "," - << sum(moment_[2]) - << ")" + file(0) << obr_.time().value() << tab << setw(1) << '[' + << sum(force_[0]) << setw(1) << ',' + << sum(force_[1]) << setw(1) << "," + << sum(force_[2]) << setw(3) << "] [" + << sum(moment_[0]) << setw(1) << "," + << sum(moment_[1]) << setw(1) << "," + << sum(moment_[2]) << setw(1) << "]" << endl; if (localSystem_) @@ -403,17 +399,13 @@ void Foam::forces::writeForces() vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentP(coordSys_.localVector(moment_[2])); - file(0) << obr_.time().value() << tab - << "(" - << sum(localForceN) << "," - << sum(localForceT) << "," - << sum(localForceP) - << ") " - << "(" - << sum(localMomentN) << "," - << sum(localMomentT) << "," - << sum(localMomentP) - << ")" + file(0) << obr_.time().value() << tab << setw(1) << "[" + << sum(localForceN) << setw(1) << "," + << sum(localForceT) << setw(1) << "," + << sum(localForceP) << setw(3) << "] [" + << sum(localMomentN) << setw(1) << "," + << sum(localMomentT) << setw(1) << "," + << sum(localMomentP) << setw(1) << "]" << endl; } } @@ -448,9 +440,13 @@ void Foam::forces::writeBins() forAll(f[0], i) { file(1) - << tab - << "(" << f[0][i] << "," << f[1][i] << "," << f[2][i] << ") " - << "(" << m[0][i] << "," << m[1][i] << "," << m[2][i] << ")"; + << tab << setw(1) << "[" + << f[0][i] << setw(1) << "," + << f[1][i] << setw(1) << "," + << f[2][i] << setw(3) << "] [" + << m[0][i] << setw(1) << "," + << m[1][i] << setw(1) << "," + << m[2][i] << setw(1) << "]"; } if (localSystem_) @@ -480,9 +476,13 @@ void Foam::forces::writeBins() forAll(lf[0], i) { file(1) - << tab - << "(" << lf[0][i] << "," << lf[1][i] << "," << lf[2][i] << ") " - << "(" << lm[0][i] << "," << lm[1][i] << "," << lm[2][i] << ")"; + << tab << setw(1) << "[" + << lf[0][i] << setw(1) << "," + << lf[1][i] << setw(1) << "," + << lf[2][i] << setw(3) << "] [" + << lm[0][i] << setw(1) << "," + << lm[1][i] << setw(1) << "," + << lm[2][i] << setw(1) << "]"; } } diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C index 5deb9e884d..f79a7beb79 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -42,9 +42,11 @@ defineTypeNameAndDebug(DESModelRegions, 0); void Foam::DESModelRegions::writeFileHeader(const label i) { - file() << "# DES model region coverage (% volume)" << nl - << "# time " << token::TAB << "LES" << token::TAB << "RAS" - << endl; + writeHeader(file(), "DES model region coverage (% volume)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "LES"); + writeTabbed(file(), "RAS"); } @@ -206,8 +208,10 @@ void Foam::DESModelRegions::write() if (Pstream::master() && log_) { - file() << obr_.time().timeName() << token::TAB - << prc << token::TAB << 100.0 - prc << endl; + file() << obr_.time().value() + << token::TAB << prc + << token::TAB << 100.0 - prc + << endl; } if (log_) diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index 88b48d2e13..30f4f34ff8 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -43,9 +43,11 @@ defineTypeNameAndDebug(wallShearStress, 0); void Foam::wallShearStress::writeFileHeader(const label i) { // Add headers to output data - file() << "# Wall shear stress" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << endl; + writeHeader(file(), "Wall shear stress"); + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); } @@ -73,9 +75,11 @@ void Foam::wallShearStress::calcShearStress if (Pstream::master()) { - file() << mesh.time().timeName() << token::TAB - << pp.name() << token::TAB << minSsp - << token::TAB << maxSsp << endl; + file() << mesh.time().value() + << token::TAB << pp.name() + << token::TAB << minSsp + << token::TAB << maxSsp + << endl; } if (log_) diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C index 32c9043058..acad1aef70 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -44,10 +44,13 @@ defineTypeNameAndDebug(yPlusLES, 0); void Foam::yPlusLES::writeFileHeader(const label i) { - file() << "# y+ (LES)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; + writeHeader(file(), "y+ (LES)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); + writeTabbed(file(), "average"); } @@ -100,10 +103,12 @@ void Foam::yPlusLES::calcIncompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << currPatch.name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << currPatch.name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -166,10 +171,12 @@ void Foam::yPlusLES::calcCompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << currPatch.name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << currPatch.name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 9b5d2eca6c..610cc28bbf 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -46,10 +46,13 @@ defineTypeNameAndDebug(yPlusRAS, 0); void Foam::yPlusRAS::writeFileHeader(const label i) { - file() << "# y+ (RAS)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; + writeHeader(file(), "y+ (RAS)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); + writeTabbed(file(), "average"); } @@ -95,10 +98,12 @@ void Foam::yPlusRAS::calcIncompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << nutPw.patch().name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << nutPw.patch().name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -153,10 +158,12 @@ void Foam::yPlusRAS::calcCompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << mutPw.patch().name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << mutPw.patch().name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index 553c603b44..3bde7dac61 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -23,7 +23,7 @@ libs application simpleFoam; -startFrom latestTime; +startFrom startTime; // latestTime; startTime 0; diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs index 1d62bff73a..e308215f26 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs +++ b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs @@ -8,7 +8,8 @@ forceCoeffs1 { - type forceCoeffs; +// type forceCoeffs; + type forces; functionObjectLibs ( "libforces.so" ); From bcc5b89040b7015862837872d7204e318ffe2bbb Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Mon, 25 Nov 2013 10:56:43 +0000 Subject: [PATCH 30/52] BUG: Changing fvOption source in UEqn.H to the rhs --- .../solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H index 35881bb544..602a04a6e5 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H @@ -4,7 +4,8 @@ fvm::ddt(rho, U) + fvm::div(phi, U) + turb.divDevRhoReff(U) - + fvOptions(rho, U) + == + fvOptions(rho, U) ); UEqn().relax(); From cc5a7c3d9de658632ce03d84bac9e14c4d97016d Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 10:17:18 +0000 Subject: [PATCH 31/52] pressureInletOutletParSlipVelocityFvPatchVectorField: Removed UName option and rationalised operator= --- ...tOutletParSlipVelocityFvPatchVectorField.C | 39 +++++++------------ ...tOutletParSlipVelocityFvPatchVectorField.H | 6 +-- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C index 9ce17a2025..0eb6a52034 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,8 +41,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho"), - UName_("U") + rhoName_("rho") { refValue() = *this; refGrad() = vector::zero; @@ -61,8 +60,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - UName_(ptf.UName_) + rhoName_(ptf.rhoName_) {} @@ -76,8 +74,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")), - UName_(dict.lookupOrDefault("U", "U")) + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); refValue() = *this; @@ -94,8 +91,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - UName_(pivpvf.UName_) + rhoName_(pivpvf.rhoName_) {} @@ -108,8 +104,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - UName_(pivpvf.UName_) + rhoName_(pivpvf.rhoName_) {} @@ -122,8 +117,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() return; } - const label patchI = patch().index(); - const surfaceScalarField& phi = db().lookupObject(phiName_); @@ -131,23 +124,22 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() patch().patchField(phi); tmp n = patch().nf(); - const Field& magS = patch().magSf(); + const Field& magSf = patch().magSf(); - const volVectorField& U = db().lookupObject(UName_); - - vectorField Uc(U.boundaryField()[patchI].patchInternalField()); - Uc -= n()*(Uc & n()); + // Get the tangential component from the internalField (zero-gradient) + vectorField Ut(patchInternalField()); + Ut -= n()*(Ut & n()); if (phi.dimensions() == dimVelocity*dimArea) { - refValue() = Uc + n*phip/magS; + refValue() = Ut + n*phip/magSf; } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField& rhop = patch().lookupPatchField(rhoName_); - refValue() = Uc + n*phip/(rhop*magS); + refValue() = Ut + n*phip/(rhop*magSf); } else { @@ -176,7 +168,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); writeEntryIfDifferent(os, "rho", "rho", rhoName_); - writeEntryIfDifferent(os, "U", "U", UName_); writeEntry("value", os); } @@ -188,11 +179,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::operator= const fvPatchField& pvf ) { - fvPatchField::operator= - ( - valueFraction()*(patch().nf()*(patch().nf() & pvf)) - + (1 - valueFraction())*pvf - ); + fvPatchField::operator=(pvf); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H index 5a485362d5..f73730907d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho - U | velocity field name | no | U \endtable Example of the boundary condition specification: @@ -95,9 +94,6 @@ class pressureInletOutletParSlipVelocityFvPatchVectorField //- Density field name word rhoName_; - //- Velocity field name - word UName_; - public: From 5f21e8ca887d7f6b2bcba6edda35952ff0e37188 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 26 Nov 2013 12:31:58 +0000 Subject: [PATCH 32/52] ENH: force/Coeffs - added writing of bin co-ordinates to output --- .../forces/forceCoeffs/forceCoeffs.C | 24 +++++++++++++++++++ .../functionObjects/forces/forces/forces.C | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 1daa0c279c..42ae77e264 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -72,6 +72,30 @@ void Foam::forceCoeffs::writeFileHeader(const label i) writeHeaderValue(file(i), "start", binMin_); writeHeaderValue(file(i), "delta", binDx_); writeHeaderValue(file(i), "direction", binDir_); + + vectorField binPoints(nBin_); + writeCommented(file(i), "x co-ords :"); + forAll(binPoints, pointI) + { + binPoints[pointI] = (binMin_ + (pointI + 1)*binDx_)*binDir_; + file(i) << tab << binPoints[pointI].x(); + } + file(i) << nl; + + writeCommented(file(i), "y co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].y(); + } + file(i) << nl; + + writeCommented(file(i), "z co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].z(); + } + file(i) << nl; + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 70c1e00e78..c096ad5d4b 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -98,6 +98,30 @@ void Foam::forces::writeFileHeader(const label i) writeHeaderValue(file(i), "start", binMin_); writeHeaderValue(file(i), "delta", binDx_); writeHeaderValue(file(i), "direction", binDir_); + + vectorField binPoints(nBin_); + writeCommented(file(i), "x co-ords :"); + forAll(binPoints, pointI) + { + binPoints[pointI] = (binMin_ + (pointI + 1)*binDx_)*binDir_; + file(i) << tab << binPoints[pointI].x(); + } + file(i) << nl; + + writeCommented(file(i), "y co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].y(); + } + file(i) << nl; + + writeCommented(file(i), "z co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].z(); + } + file(i) << nl; + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) From 0de0f137e3e6b25dec4e8f499f35bd0f54e5c292 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 12:44:57 +0000 Subject: [PATCH 33/52] pressureInletOutletVelocity/rotatingPressureInletOutletVelocity: Set the normal component of the inlet velocity from the flux rather than the zero-gradient velocity --- ...ureInletOutletVelocityFvPatchVectorField.C | 97 ++++++++++++++----- ...ureInletOutletVelocityFvPatchVectorField.H | 65 +++++++++---- ...ureInletOutletVelocityFvPatchVectorField.C | 35 ++++--- ...ureInletOutletVelocityFvPatchVectorField.H | 9 +- 4 files changed, 143 insertions(+), 63 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 8503b83ef7..8c041f374f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.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) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,10 +25,10 @@ License #include "pressureInletOutletVelocityFvPatchVectorField.H" #include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::pressureInletOutletVelocityFvPatchVectorField:: @@ -38,12 +38,13 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField& iF ) : - directionMixedFvPatchVectorField(p, iF), - phiName_("phi") + mixedFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho") { - refValue() = vector::zero; + refValue() = *this; refGrad() = vector::zero; - valueFraction() = symmTensor::zero; + valueFraction() = 0.0; } @@ -56,8 +57,9 @@ pressureInletOutletVelocityFvPatchVectorField const fvPatchFieldMapper& mapper ) : - directionMixedFvPatchVectorField(ptf, p, iF, mapper), - phiName_(ptf.phiName_) + mixedFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_) { if (ptf.tangentialVelocity_.size()) { @@ -74,8 +76,9 @@ pressureInletOutletVelocityFvPatchVectorField const dictionary& dict ) : - directionMixedFvPatchVectorField(p, iF), - phiName_(dict.lookupOrDefault("phi", "phi")) + mixedFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); @@ -92,7 +95,7 @@ pressureInletOutletVelocityFvPatchVectorField } refGrad() = vector::zero; - valueFraction() = symmTensor::zero; + valueFraction() = 0.0; } @@ -102,8 +105,9 @@ pressureInletOutletVelocityFvPatchVectorField const pressureInletOutletVelocityFvPatchVectorField& pivpvf ) : - directionMixedFvPatchVectorField(pivpvf), + mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), tangentialVelocity_(pivpvf.tangentialVelocity_) {} @@ -115,8 +119,9 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField& iF ) : - directionMixedFvPatchVectorField(pivpvf, iF), + mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), + rhoName_(pivpvf.rhoName_), tangentialVelocity_(pivpvf.tangentialVelocity_) {} @@ -127,8 +132,8 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField:: setTangentialVelocity(const vectorField& tangentialVelocity) { tangentialVelocity_ = tangentialVelocity; - const vectorField n(patch().nf()); - refValue() = tangentialVelocity_ - n*(n & tangentialVelocity_); + vectorField n(patch().nf()); + tangentialVelocity_ -= n*(n & tangentialVelocity_); } @@ -137,7 +142,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::autoMap const fvPatchFieldMapper& m ) { - directionMixedFvPatchVectorField::autoMap(m); + mixedFvPatchVectorField::autoMap(m); if (tangentialVelocity_.size()) { tangentialVelocity_.autoMap(m); @@ -151,7 +156,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::rmap const labelList& addr ) { - directionMixedFvPatchVectorField::rmap(ptf, addr); + mixedFvPatchVectorField::rmap(ptf, addr); if (tangentialVelocity_.size()) { @@ -170,24 +175,66 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() return; } + const surfaceScalarField& phi = + db().lookupObject(phiName_); + const fvsPatchField& phip = - patch().lookupPatchField(phiName_); + patch().patchField(phi); - valueFraction() = neg(phip)*(I - sqr(patch().nf())); + vectorField n(patch().nf()); + const Field& magSf = patch().magSf(); - directionMixedFvPatchVectorField::updateCoeffs(); - directionMixedFvPatchVectorField::evaluate(); + if (phi.dimensions() == dimVelocity*dimArea) + { + refValue() = n*phip/magSf; + } + else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) + { + const fvPatchField& rhop = + patch().lookupPatchField(rhoName_); + + refValue() = n*phip/(rhop*magSf); + } + else + { + FatalErrorIn + ( + "pressureInletOutletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) << "dimensions of phi are not correct" << nl + << " on patch " << this->patch().name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalError); + } + + if (tangentialVelocity_.size()) + { + // Adjust the tangential velocity to conserve kinetic energy + // of the entrained fluid + // scalarField magSqrUt(magSqr(tangentialVelocity_)); + // scalarField scale + // ( + // max(sqrt((magSqrUt - magSqr(refValue()))/magSqrUt), scalar(0)) + // ); + // refValue() += scale*tangentialVelocity_; + refValue() += tangentialVelocity_; + } + + valueFraction() = 1.0 - pos(phip); + + mixedFvPatchVectorField::updateCoeffs(); } void Foam::pressureInletOutletVelocityFvPatchVectorField::write ( Ostream& os -) -const +) const { fvPatchVectorField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); if (tangentialVelocity_.size()) { tangentialVelocity_.writeEntry("tangentialVelocity", os); @@ -203,9 +250,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::operator= const fvPatchField& pvf ) { - tmp normalValue = transform(valueFraction(), refValue()); - tmp transformGradValue = transform(I - valueFraction(), pvf); - fvPatchField::operator=(normalValue + transformGradValue); + fvPatchField::operator=(pvf); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 49ebb5d77e..d73e21697d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.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) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,21 +25,21 @@ Class Foam::pressureInletOutletVelocityFvPatchVectorField Group - grpInletletBoundaryConditions grpOutletBoundaryConditions + grpInletBoundaryConditions grpOutletBoundaryConditions Description This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is - obtained from the patch-face normal component of the internal-cell value. - - The tangential patch velocity can be optionally specified. + obtained from the patch-face normal component of the internal-cell value and + the tangential patch velocity can be optionally specified. \heading Patch usage \table Property | Description | Required | Default value phi | flux field name | no | phi + rho | density field name | no | rho tangentialVelocity | tangential velocity field | no | \endtable @@ -49,6 +49,7 @@ Description { type pressureInletOutletVelocity; phi phi; + rho rho; tangentialVelocity uniform (0 0 0); value uniform 0; } @@ -69,7 +70,7 @@ SourceFiles #define pressureInletOutletVelocityFvPatchVectorField_H #include "fvPatchFields.H" -#include "directionMixedFvPatchFields.H" +#include "mixedFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,18 +78,24 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class pressureInletOutletVelocityFvPatchVectorField Declaration + Class pressureInletOutletVelocityFvPatchVectorField Declaration \*---------------------------------------------------------------------------*/ class pressureInletOutletVelocityFvPatchVectorField : - public directionMixedFvPatchVectorField + public mixedFvPatchVectorField { // Private data //- Flux field name word phiName_; + //- Density field name + word rhoName_; + + +protected: + //- Optional tangential velocity component vectorField tangentialVelocity_; @@ -108,16 +115,9 @@ public: const DimensionedField& ); - //- Construct from patch, internal field and dictionary - pressureInletOutletVelocityFvPatchVectorField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - //- Construct by mapping given - // pressureInletOutletVelocityFvPatchVectorField onto a new patch + // pressureInletOutletVelocityFvPatchVectorField + // onto a new patch pressureInletOutletVelocityFvPatchVectorField ( const pressureInletOutletVelocityFvPatchVectorField&, @@ -126,6 +126,14 @@ public: const fvPatchFieldMapper& ); + //- Construct from patch, internal field and dictionary + pressureInletOutletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + //- Construct as copy pressureInletOutletVelocityFvPatchVectorField ( @@ -137,7 +145,10 @@ public: { return tmp ( - new pressureInletOutletVelocityFvPatchVectorField(*this) + new pressureInletOutletVelocityFvPatchVectorField + ( + *this + ) ); } @@ -156,7 +167,11 @@ public: { return tmp ( - new pressureInletOutletVelocityFvPatchVectorField(*this, iF) + new pressureInletOutletVelocityFvPatchVectorField + ( + *this, + iF + ) ); } @@ -177,6 +192,18 @@ public: return phiName_; } + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + //- Return the tangential velocity const vectorField& tangentialVelocity() const { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index 830a4b1288..e7044a5909 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,13 +37,11 @@ calcTangentialVelocity() vector om = omega_->value(t); vector axisHat = om/mag(om); - const vectorField tangentialVelocity - ( - (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())) - ); + tangentialVelocity_ = + (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); const vectorField n(patch().nf()); - refValue() = tangentialVelocity - n*(n & tangentialVelocity); + tangentialVelocity_ -= n*(n & tangentialVelocity_); } @@ -87,9 +85,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(p, iF, dict), omega_(DataEntry::New("omega", dict)) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -100,9 +96,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf), omega_(rppvf.omega_().clone().ptr()) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -114,13 +108,24 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), omega_(rppvf.omega_().clone().ptr()) -{ - calcTangentialVelocity(); -} +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + calcTangentialVelocity(); + + pressureInletOutletVelocityFvPatchVectorField::updateCoeffs(); +} + + void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write ( Ostream& os diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index cc114d7c6b..b4b7297692 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi tangentialVelocity | tangential velocity field | no | - omega | angular velocty of the frame [rad/s] | yes | + omega | angular velocty of the frame [rad/s] | yes | \endtable Example of the boundary condition specification: @@ -49,7 +49,7 @@ Description type rotatingPressureInletOutletVelocity; phi phi; tangentialVelocity uniform (0 0 0); - omega 100; + omega 100; } \endverbatim @@ -177,6 +177,9 @@ public: // Member functions + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + //- Write virtual void write(Ostream&) const; }; From b3e44e036ff4dc0859b56d09a5187c9aaf6e6b11 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 12:47:34 +0000 Subject: [PATCH 34/52] fvcReconstructSimple: Gauss rather than least-squares reconstruct --- .../finiteVolume/fvc/fvcReconstructSimple.C | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C new file mode 100644 index 0000000000..c3e7f8dc85 --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 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 "fvcReconstruct.H" +#include "fvMesh.H" +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fvc +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp +< + GeometricField + < + typename outerProduct::type, fvPatchField, volMesh + > +> +reconstruct +( + const GeometricField& ssf +) +{ + typedef typename outerProduct::type GradType; + + const fvMesh& mesh = ssf.mesh(); + + const labelUList& owner = mesh.owner(); + const labelUList& neighbour = mesh.neighbour(); + + const volVectorField& C = mesh.C(); + const surfaceVectorField& Cf = mesh.Cf(); + + tmp > treconField + ( + new GeometricField + ( + IOobject + ( + "reconstruct("+ssf.name()+')', + ssf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensioned + ( + "0", + ssf.dimensions()/dimArea, + pTraits::zero + ), + zeroGradientFvPatchField::typeName + ) + ); + + Field& rf = treconField(); + + forAll(owner, facei) + { + label own = owner[facei]; + label nei = neighbour[facei]; + + rf[own] += (Cf[facei] - C[own])*ssf[facei]; + rf[nei] -= (Cf[facei] - C[nei])*ssf[facei]; + } + + const typename GeometricField:: + GeometricBoundaryField& bsf = ssf.boundaryField(); + + forAll(bsf, patchi) + { + const fvsPatchField& psf = bsf[patchi]; + + const labelUList& pOwner = mesh.boundary()[patchi].faceCells(); + const vectorField& pCf = Cf.boundaryField()[patchi]; + + forAll(pOwner, pFacei) + { + label own = pOwner[pFacei]; + rf[own] += (pCf[pFacei] - C[own])*psf[pFacei]; + } + } + + rf /= mesh.V(); + + treconField().correctBoundaryConditions(); + + return treconField; +} + + +template +tmp +< + GeometricField + < + typename outerProduct::type, fvPatchField, volMesh + > +> +reconstruct +( + const tmp >& tssf +) +{ + typedef typename outerProduct::type GradType; + tmp > tvf + ( + fvc::reconstruct(tssf()) + ); + tssf.clear(); + return tvf; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvc + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // From d302bf68198740883b870674477a5796533026b9 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 26 Nov 2013 14:45:27 +0000 Subject: [PATCH 35/52] STYLE: Updated spelling errors --- .../twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties | 2 +- .../twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties | 2 +- .../twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties | 2 +- .../laminar/mixerVessel2D/constant/phaseProperties | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties index 591ebc005a..a3bec3a577 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties index 591ebc005a..a3bec3a577 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties index cb95638812..b5eb1e24ee 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties @@ -55,7 +55,7 @@ dispersedPhase particles; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties index f867970c9a..c31927d84d 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient From 1d93885257c4b655e7ad10e3d385698ab8f2b2ea Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 26 Nov 2013 15:01:53 +0000 Subject: [PATCH 36/52] ENH: surface film - updated Courant number calculation --- .../kinematicSingleLayer/kinematicSingleLayer.C | 15 +++++++++------ .../kinematicSingleLayer/kinematicSingleLayer.H | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 26e2936f31..347e3ddb89 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -440,6 +440,7 @@ kinematicSingleLayer::kinematicSingleLayer cumulativeContErr_(0.0), deltaSmall_("deltaSmall", dimLength, SMALL), + deltaCoLimit_(solution().lookupOrDefault("deltaCoLimit", 1e-4)), rho_ ( @@ -898,15 +899,17 @@ scalar kinematicSingleLayer::CourantNumber() const if (regionMesh().nInternalFaces() > 0) { - const scalarField sumPhi(fvc::surfaceSum(mag(phi_))); + const scalarField sumPhi + ( + fvc::surfaceSum(mag(phi_))().internalField() + / (deltaRho_.internalField() + ROOTVSMALL) + ); - const scalarField& V = regionMesh().V(); - - forAll(deltaRho_, i) + forAll(delta_, i) { - if (deltaRho_[i] > SMALL) + if (delta_[i] > deltaCoLimit_) { - CoNum = max(CoNum, sumPhi[i]/deltaRho_[i]/V[i]); + CoNum = max(CoNum, sumPhi[i]/(delta_[i]*magSf()[i])); } } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 197895c844..181a58b68b 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -100,6 +100,9 @@ protected: //- Small delta const dimensionedScalar deltaSmall_; + //- Film thickness above which Courant number calculation in valid + scalar deltaCoLimit_; + // Thermo properties From a62f28a9f93fc2712b1dc9064bb929838a47c4d4 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 15:39:57 +0000 Subject: [PATCH 37/52] pressureInletOutletVelocity BC: Corrected parallel handling of tangentialVelocity --- ...ureInletOutletVelocityFvPatchVectorField.C | 27 ++++++++++++------- ...ureInletOutletVelocityFvPatchVectorField.H | 2 ++ ...ureInletOutletVelocityFvPatchVectorField.C | 6 ++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 8c041f374f..2187d5b48c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -40,7 +40,8 @@ pressureInletOutletVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho") + rhoName_("rho"), + applyTangentialVelocity_(false) { refValue() = *this; refGrad() = vector::zero; @@ -59,9 +60,10 @@ pressureInletOutletVelocityFvPatchVectorField : mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + applyTangentialVelocity_(ptf.applyTangentialVelocity_) { - if (ptf.tangentialVelocity_.size()) + if (applyTangentialVelocity_) { tangentialVelocity_ = mapper(ptf.tangentialVelocity_); } @@ -78,12 +80,15 @@ pressureInletOutletVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")) + rhoName_(dict.lookupOrDefault("rho", "rho")), + applyTangentialVelocity_(false) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); if (dict.found("tangentialVelocity")) { + applyTangentialVelocity_ = true; + setTangentialVelocity ( vectorField("tangentialVelocity", dict, p.size()) @@ -108,7 +113,8 @@ pressureInletOutletVelocityFvPatchVectorField mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), rhoName_(pivpvf.rhoName_), - tangentialVelocity_(pivpvf.tangentialVelocity_) + tangentialVelocity_(pivpvf.tangentialVelocity_), + applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) {} @@ -122,7 +128,8 @@ pressureInletOutletVelocityFvPatchVectorField mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), rhoName_(pivpvf.rhoName_), - tangentialVelocity_(pivpvf.tangentialVelocity_) + tangentialVelocity_(pivpvf.tangentialVelocity_), + applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) {} @@ -143,7 +150,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::autoMap ) { mixedFvPatchVectorField::autoMap(m); - if (tangentialVelocity_.size()) + if (applyTangentialVelocity_) { tangentialVelocity_.autoMap(m); } @@ -158,7 +165,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::rmap { mixedFvPatchVectorField::rmap(ptf, addr); - if (tangentialVelocity_.size()) + if (applyTangentialVelocity_) { const pressureInletOutletVelocityFvPatchVectorField& tiptf = refCast(ptf); @@ -208,7 +215,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() << exit(FatalError); } - if (tangentialVelocity_.size()) + if (applyTangentialVelocity_) { // Adjust the tangential velocity to conserve kinetic energy // of the entrained fluid @@ -235,7 +242,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); writeEntryIfDifferent(os, "rho", "rho", rhoName_); - if (tangentialVelocity_.size()) + if (applyTangentialVelocity_) { tangentialVelocity_.writeEntry("tangentialVelocity", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index d73e21697d..4f8c546452 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H @@ -99,6 +99,8 @@ protected: //- Optional tangential velocity component vectorField tangentialVelocity_; + bool applyTangentialVelocity_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index e7044a5909..e9f2bbeef6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -33,6 +33,8 @@ License void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: calcTangentialVelocity() { + applyTangentialVelocity_ = true; + const scalar t = this->db().time().timeOutputValue(); vector om = omega_->value(t); @@ -70,9 +72,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), omega_(ptf.omega_().clone().ptr()) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: From 7a76df3074807566c3aede426ecbb6786bd29083 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 21:15:59 +0000 Subject: [PATCH 38/52] pressureInletOutletVelocityFvPatchVectorField: Corrected initialisation of refValue --- .../pressureInletOutletVelocityFvPatchVectorField.C | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 2187d5b48c..6b12a664ce 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -94,11 +94,8 @@ pressureInletOutletVelocityFvPatchVectorField vectorField("tangentialVelocity", dict, p.size()) ); } - else - { - refValue() = vector::zero; - } + refValue() = *this; refGrad() = vector::zero; valueFraction() = 0.0; } @@ -138,6 +135,7 @@ pressureInletOutletVelocityFvPatchVectorField void Foam::pressureInletOutletVelocityFvPatchVectorField:: setTangentialVelocity(const vectorField& tangentialVelocity) { + applyTangentialVelocity_ = true; tangentialVelocity_ = tangentialVelocity; vectorField n(patch().nf()); tangentialVelocity_ -= n*(n & tangentialVelocity_); From 7429f5935896b4d694086ae19379118e4cf95860 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Nov 2013 21:16:51 +0000 Subject: [PATCH 39/52] VoF solvers: Updated PC-MULES --- .../interFoam/LTSInterFoam/LTSInterFoam.C | 4 - .../interFoam/MRFInterFoam/MRFInterFoam.C | 2 - .../solvers/multiphase/interFoam/alphaEqn.H | 86 ++++++++++++++++--- .../multiphase/interFoam/createFields.H | 3 + .../interFoam/interDyMFoam/interDyMFoam.C | 2 - .../solvers/multiphase/interFoam/interFoam.C | 2 - .../interMixingFoam/interMixingFoam.C | 2 - .../porousInterFoam/porousInterFoam.C | 2 - 8 files changed, 77 insertions(+), 26 deletions(-) diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index e9aa9fb9b9..494acaf05f 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -77,8 +77,6 @@ int main(int argc, char *argv[]) #include "setrDeltaT.H" - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { @@ -91,8 +89,6 @@ int main(int argc, char *argv[]) #define LTSSOLVE #include "alphaEqnSubCycle.H" #undef LTSSOLVE - - interface.correct(); } turbulence->correct(); diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 56527781a2..ccf89e5467 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -81,8 +81,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index f0e9dab403..195ed09fc9 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -2,11 +2,29 @@ word alphaScheme("div(phi,alpha)"); word alpharScheme("div(phirb,alpha)"); - surfaceScalarField phic(mag(phi/mesh.magSf())); - phic = min(interface.cAlpha()*phic, max(phic)); - surfaceScalarField phir(phic*interface.nHatf()); + //surfaceScalarField phic(mag(phi/mesh.magSf())); + //phic = min(interface.cAlpha()*phic, max(phic)); + surfaceScalarField phic + ( + (0.5*interface.cAlpha()) + *fvc::interpolate(volScalarField("tauc", fvc::surfaceSum(mag(phi)))) + /mesh.magSf() + ); + + // Do not compress interface at non-coupled boundary faces + // (inlets, outlets etc.) + forAll(phic.boundaryField(), patchi) + { + fvsPatchScalarField& phicp = phic.boundaryField()[patchi]; + + if (!phicp.coupled()) + { + phicp == 0; + } + } + + tmp tphiAlpha; - //***HGW if (pimple.firstIter() && MULESCorr) if (MULESCorr) { fvScalarMatrix alpha1Eqn @@ -32,12 +50,37 @@ << " Max(alpha1) = " << max(alpha1).value() << endl; - tphiAlpha = alpha1Eqn.flux(); + tmp tphiAlphaUD(alpha1Eqn.flux()); + tphiAlpha = tmp + ( + new surfaceScalarField(tphiAlphaUD()) + ); + + if (alphaApplyPrevCorr && tphiAlphaCorr0.valid()) + { + Info<< "Applying the previous iteration compression flux" << endl; + #ifdef LTSSOLVE + MULES::LTScorrect(alpha1, tphiAlpha(), tphiAlphaCorr0(), 1, 0); + #else + MULES::correct(alpha1, tphiAlpha(), tphiAlphaCorr0(), 1, 0); + #endif + + tphiAlpha() += tphiAlphaCorr0(); + } + + // Cache the upwind-flux + tphiAlphaCorr0 = tphiAlphaUD; + + alpha2 = 1.0 - alpha1; + + interface.correct(); } for (int aCorr=0; aCorr tphiAlpha0 + surfaceScalarField phir(phic*interface.nHatf()); + + tmp tphiAlphaUn ( fvc::flux ( @@ -47,7 +90,7 @@ ) + fvc::flux ( - -fvc::flux(-phir, alpha2, alpharScheme), + -fvc::flux(-phir, alpha2, alpharScheme), alpha1, alpharScheme ) @@ -55,17 +98,29 @@ if (MULESCorr) { - tphiAlpha0() -= tphiAlpha(); + tmp tphiAlphaCorr(tphiAlphaUn() - tphiAlpha()); + volScalarField alpha10(alpha1); + #ifdef LTSSOLVE - MULES::LTScorrect(alpha1, tphiAlpha0(), 1, 0); + MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); #else - MULES::correct(alpha1, tphiAlpha0(), 1, 0); + MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); #endif - tphiAlpha() += tphiAlpha0(); + + // Under-relax the correction for more than 3 correctors + if (aCorr < 3) + { + tphiAlpha() += tphiAlphaCorr(); + } + else + { + alpha1 = 0.5*alpha1 + 0.5*alpha10; + tphiAlpha() += 0.5*tphiAlphaCorr(); + } } else { - tphiAlpha = tphiAlpha0; + tphiAlpha = tphiAlphaUn; #ifdef LTSSOLVE MULES::explicitLTSSolve(alpha1, phi, tphiAlpha(), 1, 0); @@ -75,10 +130,17 @@ } alpha2 = 1.0 - alpha1; + + interface.correct(); } rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2; + if (alphaApplyPrevCorr && MULESCorr) + { + tphiAlphaCorr0 = tphiAlpha() - tphiAlphaCorr0; + } + Info<< "Phase-1 volume fraction = " << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 3039171f77..00a7d12db6 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -135,3 +135,6 @@ } fv::IOoptionList fvOptions(mesh); + + + tmp tphiAlphaCorr0; diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index d56e300581..0a3d7ed11e 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -77,8 +77,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 0ddfed5039..f221ff9ad3 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -80,8 +80,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 3321da57f9..fad2224461 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -74,8 +74,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 15b4439220..d81f5c93d3 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -83,8 +83,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { From 6fd59794f0e2fe7fe7d238819b0322ee62537919 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Nov 2013 08:47:23 +0000 Subject: [PATCH 40/52] ENH: v2-f model updates --- src/turbulenceModels/incompressible/RAS/v2f/v2f.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C index ec67161758..ea5fb18728 100644 --- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -366,10 +366,10 @@ void v2f::correct() const volScalarField G(GName(), nut_*S2); const volScalarField T(Ts()); - const volScalarField L2(type() + ".L2", sqr(Ls())); + const volScalarField L2(type() + ":L2", sqr(Ls())); const volScalarField alpha ( - "v2f::alpha", + "v2f:alpha", 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) ); From 5f3ea76c83588ae38072b683d5ca6bf335047e12 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Nov 2013 14:32:24 +0000 Subject: [PATCH 41/52] STYLE: Updated header documentation --- src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H index e6fb30a20f..8adbc4b204 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -32,7 +32,7 @@ Description csvFile; csvFileCoeffs { - nHeaderLines 4; + nHeaderLine 4; refColumn 0; // reference column index componentColumns (1 2 3); // component column indices separator ","; // optional (defaults to ",") From 5768a52bdf72c55c3b9baea69cfa1875a5ff739b Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 27 Nov 2013 22:01:06 +0000 Subject: [PATCH 42/52] pressureInletOutletVelocityFvPatchVectorField: Corrected limiting of the scaling factor --- .../pressureInletOutletVelocityFvPatchVectorField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 6b12a664ce..fda087d8b5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -220,7 +220,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() // scalarField magSqrUt(magSqr(tangentialVelocity_)); // scalarField scale // ( - // max(sqrt((magSqrUt - magSqr(refValue()))/magSqrUt), scalar(0)) + // sqrt(max(magSqrUt - magSqr(refValue()), scalar(0))/magSqrUt) // ); // refValue() += scale*tangentialVelocity_; refValue() += tangentialVelocity_; From 1c4d93e63786f20cf342d58a4332e473d90e3964 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 28 Nov 2013 16:55:32 +0000 Subject: [PATCH 43/52] BUG: Removed unused file --- .../processorField/processorFieldTemplates.C | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C diff --git a/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C b/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C deleted file mode 100644 index ac190e298b..0000000000 --- a/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 "processorField.H" -#include "volFields.H" -#include "surfaceFields.H" -#include "Time.H" -#include "transformGeometricField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -void Foam::processorField::transformField -( - const Type& field -) const -{ - const word& fieldName = field.name() + "Transformed"; - - dimensionedTensor R("R", field.dimensions(), coordSys_.R()); - - if (obr_.foundObject(fieldName)) - { - Type& transField = - const_cast(obr_.lookupObject(fieldName)); - - transField == field; - - forAll(field, i) - { - Foam::transform(transField, R, transField); - } - - transField.write(); - } - else - { - Type& transField = obr_.store - ( - new Type - ( - IOobject - ( - fieldName, - obr_.time().timeName(), - obr_, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ), - field - ) - ); - - forAll(field, i) - { - Foam::transform(transField, R, transField); - } - - transField.write(); - } -} - - -template -void Foam::processorField::transform -( - const word& fieldName -) const -{ - typedef GeometricField vfType; - typedef GeometricField sfType; - - if (obr_.foundObject(fieldName)) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " already in database" - << endl; - } - - transformField(obr_.lookupObject(fieldName)); - } - else if (obr_.foundObject(fieldName)) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " already in database" - << endl; - } - - transformField(obr_.lookupObject(fieldName)); - } - else - { - IOobject fieldHeader - ( - fieldName, - obr_.time().timeName(), - obr_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if - ( - fieldHeader.headerOk() - && fieldHeader.headerClassName() == vfType::typeName - ) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " read from file" - << endl; - } - - transformField(obr_.lookupObject(fieldName)); - } - else if - ( - fieldHeader.headerOk() - && fieldHeader.headerClassName() == sfType::typeName - ) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " read from file" - << endl; - } - - transformField(obr_.lookupObject(fieldName)); - } - } -} - - -// ************************************************************************* // From d24bc269f2f81cfbc8d2569f22bfc6be9c65c0b2 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 29 Nov 2013 09:24:11 +0000 Subject: [PATCH 44/52] ENH: output function objects - added evaluateControl --- .../OutputFilterFunctionObject.C | 8 ++++-- .../OutputFilterFunctionObject.H | 3 +++ .../outputFilterOutputControl.C | 27 +++++++++++++------ .../outputFilterOutputControl.H | 15 ++++++++--- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index a9049b07bc..df1e480b87 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -110,7 +110,8 @@ Foam::OutputFilterFunctionObject::OutputFilterFunctionObject storeFilter_(true), timeStart_(-VGREAT), timeEnd_(VGREAT), - outputControl_(t, dict) + outputControl_(t, dict, "output"), + evaluateControl_(t, dict, "evaluate") { readDict(); } @@ -159,7 +160,10 @@ bool Foam::OutputFilterFunctionObject::execute allocateFilter(); } - ptr_->execute(); + if (evaluateControl_.output()) + { + ptr_->execute(); + } if (forceWrite || outputControl_.output()) { diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index c9cc34c8ce..6e874dc52a 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -98,6 +98,9 @@ class OutputFilterFunctionObject //- Output controls outputFilterOutputControl outputControl_; + //- Evaluate controls + outputFilterOutputControl evaluateControl_; + //- Pointer to the output filter autoPtr ptr_; diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 6865b31fb9..5ddb9d564b 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C @@ -31,7 +31,7 @@ License namespace Foam { template<> - const char* NamedEnum:: + const char* NamedEnum:: names[] = { "timeStep", @@ -39,11 +39,12 @@ namespace Foam "adjustableTime", "runTime", "clockTime", - "cpuTime" + "cpuTime", + "none" }; } -const Foam::NamedEnum +const Foam::NamedEnum Foam::outputFilterOutputControl::outputControlNames_; @@ -52,10 +53,12 @@ const Foam::NamedEnum Foam::outputFilterOutputControl::outputFilterOutputControl ( const Time& t, - const dictionary& dict + const dictionary& dict, + const word& prefix ) : time_(t), + prefix_(prefix), outputControl_(ocTimeStep), outputInterval_(0), outputTimeLastDump_(0), @@ -75,9 +78,12 @@ Foam::outputFilterOutputControl::~outputFilterOutputControl() void Foam::outputFilterOutputControl::read(const dictionary& dict) { - if (dict.found("outputControl")) + const word controlName(prefix_ + "Control"); + const word intervalName(prefix_ + "Interval"); + + if (dict.found(controlName)) { - outputControl_ = outputControlNames_.read(dict.lookup("outputControl")); + outputControl_ = outputControlNames_.read(dict.lookup(controlName)); } else { @@ -88,13 +94,13 @@ void Foam::outputFilterOutputControl::read(const dictionary& dict) { case ocTimeStep: { - outputInterval_ = dict.lookupOrDefault