From d8c53d1f8ad368ebbe9f121cee0c456bd1c59ad3 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 12 May 2014 12:23:16 +0100 Subject: [PATCH 01/11] explicitPorositySource: Change field naming to support multiphase --- .../explicitPorositySource.C | 78 +++++++++++-------- .../explicitPorositySource.H | 26 +++---- 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C index 00cf50ba..1df69be5 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C @@ -45,10 +45,22 @@ namespace fv } } -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void Foam::fv::explicitPorositySource::initialise() +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::explicitPorositySource::explicitPorositySource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(name, modelType, dict, mesh), + porosityPtr_(NULL) { + read(dict); + if (selectionMode_ != smCellZone) { FatalErrorIn("void Foam::fv::explicitPorositySource::initialise()") @@ -66,29 +78,7 @@ void Foam::fv::explicitPorositySource::initialise() coeffs_, cellSetName_ ).ptr() - ), - - fieldNames_.setSize(1, UName_); - applied_.setSize(1, false); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::fv::explicitPorositySource::explicitPorositySource -( - const word& name, - const word& modelType, - const dictionary& dict, - const fvMesh& mesh -) -: - option(name, modelType, dict, mesh), - porosityPtr_(NULL), - UName_(coeffs_.lookupOrDefault("UName", "U")), - muName_(coeffs_.lookupOrDefault("muName", "thermo:mu")) -{ - initialise(); + ); } @@ -101,9 +91,7 @@ void Foam::fv::explicitPorositySource::addSup ) { fvMatrix porosityEqn(eqn.psi(), eqn.dimensions()); - porosityPtr_->addResistance(porosityEqn); - eqn -= porosityEqn; } @@ -116,14 +104,25 @@ void Foam::fv::explicitPorositySource::addSup ) { fvMatrix porosityEqn(eqn.psi(), eqn.dimensions()); - - const volScalarField& mu = mesh_.lookupObject(muName_); - porosityPtr_->addResistance(porosityEqn, rho, mu); - + porosityPtr_->addResistance(porosityEqn); eqn -= porosityEqn; } +void Foam::fv::explicitPorositySource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI +) +{ + fvMatrix porosityEqn(eqn.psi(), eqn.dimensions()); + porosityPtr_->addResistance(porosityEqn); + eqn -= alpha*porosityEqn; +} + + void Foam::fv::explicitPorositySource::writeData(Ostream& os) const { os << indent << name_ << endl; @@ -135,8 +134,21 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict) { if (option::read(dict)) { - coeffs_.readIfPresent("UName", UName_); - coeffs_.readIfPresent("muName", muName_); + if (coeffs_.found("UNames")) + { + coeffs_.lookup("UNames") >> fieldNames_; + } + else if (coeffs_.found("UName")) + { + word UName(coeffs_.lookup("UName")); + fieldNames_ = wordList(1, UName); + } + else + { + fieldNames_ = wordList(1, "U"); + } + + applied_.setSize(fieldNames_.size(), false); return true; } diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H index 2692fd97..417ddef1 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H @@ -34,6 +34,7 @@ Description explicitPorositySourceCoeffs { type DarcyForchheimer; + DarcyForchheimerCoeffs { d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); @@ -88,22 +89,6 @@ protected: //- Run-time selectable porosity model autoPtr porosityPtr_; - //- Velocity field name, default = U - word UName_; - - //- Density field name (compressible case only), default = rho - word rhoName_; - - //- Dynamic viscosity field name (compressible case only) - // default = thermo:mu - word muName_; - - - // Protected Member Functions - - //- Initialise - void initialise(); - private: @@ -158,6 +143,15 @@ public: const label fieldI ); + //- Add implicit contribution to phase momentum equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI + ); + // I-O From 8772bd474d862c296f77148db934650f23dac366 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 May 2014 15:12:10 +0100 Subject: [PATCH 02/11] BUG: functionObjectFile - updated parallel ops - mantis #1242 --- .../functionObjectFile/functionObjectFile.C | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index f2bab598..a04fc522 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,11 +130,11 @@ void Foam::functionObjectFile::write() void Foam::functionObjectFile::resetNames(const wordList& names) { + names_.clear(); + names_.insert(names); + if (Pstream::master()) { - names_.clear(); - names_.insert(names); - filePtrs_.clear(); filePtrs_.setSize(names_.toc().size()); @@ -145,11 +145,11 @@ void Foam::functionObjectFile::resetNames(const wordList& names) void Foam::functionObjectFile::resetName(const word& name) { + names_.clear(); + names_.insert(name); + if (Pstream::master()) { - names_.clear(); - names_.insert(name); - filePtrs_.clear(); filePtrs_.setSize(1); @@ -191,11 +191,11 @@ Foam::functionObjectFile::functionObjectFile names_(), filePtrs_() { + names_.clear(); + names_.insert(name); + if (Pstream::master()) { - names_.clear(); - names_.insert(name); - filePtrs_.clear(); filePtrs_.setSize(1); @@ -216,11 +216,11 @@ Foam::functionObjectFile::functionObjectFile names_(names), filePtrs_() { + names_.clear(); + names_.insert(names); + if (Pstream::master()) { - names_.clear(); - names_.insert(names); - filePtrs_.clear(); filePtrs_.setSize(names_.size()); From 40e7df1d2abef6289cf28e72b2d8d30401a0e0e6 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 May 2014 16:15:47 +0100 Subject: [PATCH 03/11] BUG: reactingParcel - temperature was only limited on debug --- .../parcels/Templates/ReactingParcel/ReactingParcel.C | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 02d68c78..32427cba 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,7 +120,6 @@ void Foam::ReactingParcel::calcPhaseChange // Average molecular weight of carrier mix - assumes perfect gas const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_; - forAll(dMassPC, i) { const label idc = composition.localToGlobalCarrierId(idPhase, i); @@ -285,7 +284,7 @@ void Foam::ReactingParcel::cellValueSourceCorrection this->Tc_ += td.cloud().hsTrans()[cellI]/(this->Cpc_*massCellNew); - if (debug && (this->Tc_ < td.cloud().constProps().TMin())) + if (this->Tc_ < td.cloud().constProps().TMin()) { if (debug) { From 0d83c251db4d94e88cfe51cccced10b0592650ec Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 May 2014 16:16:59 +0100 Subject: [PATCH 04/11] BUG: manualInjection - set timeEnd so that injection interval is finite - mantis #1241 --- .../InjectionModel/ManualInjection/ManualInjection.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index 5317d032..418ad79e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,8 +154,9 @@ void Foam::ManualInjection::updateMesh() template Foam::scalar Foam::ManualInjection::timeEnd() const { - // Not used - return this->SOI_; + // Injection is instantaneous - but allow for a finite interval to + // avoid numerical issues when interval is zero + return ROOTVSMALL; } From 0baacc2593e3396cea6e716f1c971e1ce6cbedde Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 12 May 2014 23:15:27 +0100 Subject: [PATCH 05/11] DarcyForchheimer: add support for solvers which provide nu rather than mu --- .../DarcyForchheimer/DarcyForchheimer.C | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C index 1ce0a838..54df8c5b 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C @@ -203,9 +203,21 @@ void Foam::porosityModels::DarcyForchheimer::correct if (UEqn.dimensions() == dimForce) { const volScalarField& rho = mesh_.lookupObject(rhoName); - const volScalarField& mu = mesh_.lookupObject(muName); - apply(Udiag, Usource, V, rho, mu, U); + if (mesh_.foundObject(muName)) + { + const volScalarField& mu = + mesh_.lookupObject(muName); + + apply(Udiag, Usource, V, rho, mu, U); + } + else + { + const volScalarField& nu = + mesh_.lookupObject(nuName); + + apply(Udiag, Usource, V, rho, rho*nu, U); + } } else { From 7bbfa57576d2aec3d5b566f40c9e22d943f377b9 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 12 May 2014 23:15:50 +0100 Subject: [PATCH 06/11] tutorials/multiphase/interFoam/ras/angledDuct: VoF tutorial to demonstrate porosity feature via fvOptions --- .../multiphase/interFoam/ras/angledDuct/0/U | 57 ++++++ .../interFoam/ras/angledDuct/0/alpha.water | 53 +++++ .../interFoam/ras/angledDuct/0/epsilon | 59 ++++++ .../multiphase/interFoam/ras/angledDuct/0/k | 59 ++++++ .../multiphase/interFoam/ras/angledDuct/0/nut | 57 ++++++ .../interFoam/ras/angledDuct/0/p_rgh | 55 +++++ .../interFoam/ras/angledDuct/Allrun | 10 + .../ras/angledDuct/constant/RASProperties | 25 +++ .../interFoam/ras/angledDuct/constant/g | 22 ++ .../constant/polyMesh/blockMeshDict.m4 | 189 ++++++++++++++++++ .../ras/angledDuct/constant/polyMesh/boundary | 62 ++++++ .../angledDuct/constant/transportProperties | 67 +++++++ .../angledDuct/constant/turbulenceProperties | 21 ++ .../ras/angledDuct/system/controlDict | 56 ++++++ .../interFoam/ras/angledDuct/system/fvOptions | 50 +++++ .../interFoam/ras/angledDuct/system/fvSchemes | 62 ++++++ .../ras/angledDuct/system/fvSolution | 108 ++++++++++ 17 files changed, 1012 insertions(+) create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/U create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/alpha.water create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/epsilon create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/k create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/nut create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/0/p_rgh create mode 100755 tutorials/multiphase/interFoam/ras/angledDuct/Allrun create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/RASProperties create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/g create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/blockMeshDict.m4 create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/boundary create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/transportProperties create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/constant/turbulenceProperties create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/system/controlDict create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/system/fvOptions create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/system/fvSchemes create mode 100644 tutorials/multiphase/interFoam/ras/angledDuct/system/fvSolution diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/U b/tutorials/multiphase/interFoam/ras/angledDuct/0/U new file mode 100644 index 00000000..d6561fa5 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/U @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + front + { + type fixedValue; + value uniform (0 0 0); + } + back + { + type fixedValue; + value uniform (0 0 0); + } + walls + { + type fixedValue; + value uniform (0 0 0); + } + porosityWall + { + type slip; + value uniform (0 0 0); + } + inlet + { + type flowRateInletVelocity; + massFlowRate constant 0.1; + value uniform (0 0 0); + } + outlet + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + inletValue uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/alpha.water b/tutorials/multiphase/interFoam/ras/angledDuct/0/alpha.water new file mode 100644 index 00000000..3efd7b5b --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/alpha.water @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + + front + { + type zeroGradient; + } + back + { + type zeroGradient; + } + walls + { + type zeroGradient; + } + porosityWall + { + type zeroGradient; + } + inlet + { + type fixedValue; + value uniform 1; + } + outlet + { + type inletOutlet; + value $internalField; + inletValue $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/epsilon b/tutorials/multiphase/interFoam/ras/angledDuct/0/epsilon new file mode 100644 index 00000000..efa9bb4a --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/epsilon @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / 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 200; + +boundaryField +{ + front + { + type epsilonWallFunction; + value uniform 200; + } + back + { + type epsilonWallFunction; + value uniform 200; + } + walls + { + type epsilonWallFunction; + value uniform 200; + } + porosityWall + { + type epsilonWallFunction; + value uniform 200; + } + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.005; + value uniform 200; + } + outlet + { + type inletOutlet; + inletValue uniform 200; + value uniform 200; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/k b/tutorials/multiphase/interFoam/ras/angledDuct/0/k new file mode 100644 index 00000000..9ea687dc --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/k @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / 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 1; + +boundaryField +{ + front + { + type kqRWallFunction; + value uniform 1; + } + back + { + type kqRWallFunction; + value uniform 1; + } + walls + { + type kqRWallFunction; + value uniform 1; + } + porosityWall + { + type kqRWallFunction; + value uniform 1; + } + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; + value uniform 1; + } + outlet + { + type inletOutlet; + inletValue uniform 1; + value uniform 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/nut b/tutorials/multiphase/interFoam/ras/angledDuct/0/nut new file mode 100644 index 00000000..043c71dd --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/nut @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + front + { + type nutkWallFunction; + value uniform 0; + } + back + { + type nutkWallFunction; + value uniform 0; + } + walls + { + type nutkWallFunction; + value uniform 0; + } + porosityWall + { + type nutkWallFunction; + value uniform 0; + } + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/0/p_rgh b/tutorials/multiphase/interFoam/ras/angledDuct/0/p_rgh new file mode 100644 index 00000000..94b19aeb --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/0/p_rgh @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + front + { + type fixedFluxPressure; + value $internalField; + } + back + { + type fixedFluxPressure; + value $internalField; + } + walls + { + type fixedFluxPressure; + value $internalField; + } + porosityWall + { + type fixedFluxPressure; + value $internalField; + } + inlet + { + type fixedFluxPressure; + value $internalField; + } + outlet + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/Allrun b/tutorials/multiphase/interFoam/ras/angledDuct/Allrun new file mode 100755 index 00000000..c9fa9825 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication `getApplication` diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/RASProperties b/tutorials/multiphase/interFoam/ras/angledDuct/constant/RASProperties new file mode 100644 index 00000000..d964d3c8 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/g b/tutorials/multiphase/interFoam/ras/angledDuct/constant/g new file mode 100644 index 00000000..07c16826 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/blockMeshDict.m4 b/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 00000000..3272a943 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,189 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + `format' ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// block definition for a porosity with an angled inlet/outlet +// the porosity is not aligned with the main axes +// +dnl> ----------------------------------------------------------------- +dnl> +dnl> +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'print ($1)')]) dnl> +define(VCOUNT, 0) dnl> +define(vlabel, [[// ]pt VCOUNT ($1) define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) dnl> +dnl> +define(hex2D, hex ($1b $2b $3b $4b $1f $2f $3f $4f)) dnl> +define(quad2D, ($1f $1b $2b $2f)) dnl> +define(frontQuad, ($1f $2f $3f $4f)) dnl> +define(backQuad, ($4b $3b $2b $1b)) dnl> +dnl> +dnl> +dnl> ----------------------------------------------------------------- +dnl> +define(ncells, 20) dnl> +define(ninlet, 15) dnl> +define(nporo, 20) dnl> +define(noutlet, 20) dnl> +dnl> +define(x0,0) dnl> +define(y0,0) dnl> +define(y0,0) dnl> +define(Cos,0.7071067812) dnl> == cos(45) +define(Sin,0.7071067812) dnl> == sin(45) +dnl> +define(width,50) dnl> +define(zBack,calc(-width/2)) dnl> +define(zFront,calc(width/2)) dnl> +define(leninlet,150)dnl> +define(lenporo,100)dnl> +define(lenoutlet,100)dnl> +dnl> +define(xhyp,calc(Sin*width)) dnl> +define(yhyp,calc(Cos*width)) dnl> +define(xinlet,leninlet)dnl> +define(xporo,calc(Cos*lenporo)) dnl> +define(yporo,calc(Sin*lenporo)) dnl> +define(xoutlet,calc(xporo + Cos*lenoutlet)) dnl> +define(youtlet,calc(yporo + Sin*lenoutlet)) dnl> +dnl> + +convertToMeters 0.001; + +vertices +( + // inlet region + ( -xinlet y0 zBack ) vlabel(in1b) + ( -xinlet yhyp zBack ) vlabel(in2b) + ( -xinlet y0 zFront ) vlabel(in1f) + ( -xinlet yhyp zFront ) vlabel(in2f) + + // join inlet->outlet + ( x0 y0 zBack ) vlabel(join1b) + ( -xhyp yhyp zBack ) vlabel(join2b) + ( x0 y0 zFront ) vlabel(join1f) + ( -xhyp yhyp zFront ) vlabel(join2f) + + // porosity ends ->outlet + ( xporo yporo zBack ) vlabel(poro1b) + ( calc(xporo - xhyp) calc(yporo + yhyp) zBack ) vlabel(poro2b) + ( xporo yporo zFront ) vlabel(poro1f) + ( calc(xporo - xhyp) calc(yporo + yhyp) zFront ) vlabel(poro2f) + + // outlet + ( xoutlet youtlet zBack ) vlabel(out1b) + ( calc(xoutlet - xhyp) calc(youtlet + yhyp) zBack ) vlabel(out2b) + ( xoutlet youtlet zFront ) vlabel(out1f) + ( calc(xoutlet - xhyp) calc(youtlet + yhyp) zFront ) vlabel(out2f) +); + +blocks +( + // inlet block + hex2D(in1, join1, join2, in2) + inlet ( ninlet ncells ncells ) simpleGrading (1 1 1) + + // porosity block + hex2D(join1, poro1, poro2, join2) + porosity ( nporo ncells ncells ) simpleGrading (1 1 1) + + // outlet block + hex2D(poro1, out1, out2, poro2) + outlet ( noutlet ncells ncells ) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + // is there no way of defining all my 'defaultFaces' to be 'wall'? + front + { + type wall; + faces + ( + // inlet block + frontQuad(in1, join1, join2, in2) + // outlet block + frontQuad(poro1, out1, out2, poro2) + ); + } + + back + { + type wall; + faces + ( + // inlet block + backQuad(in1, join1, join2, in2) + // outlet block + backQuad(poro1, out1, out2, poro2) + ); + } + + walls + { + type wall; + faces + ( + // inlet block + quad2D(in1, join1) + quad2D(join2, in2) + // outlet block + quad2D(poro1, out1) + quad2D(out2, poro2) + ); + } + + porosityWall + { + type wall; + faces + ( + // porosity block + frontQuad(join1, poro1, poro2, join2) + // porosity block + backQuad(join1, poro1, poro2, join2) + // porosity block + quad2D(join1, poro1) + quad2D(poro2, join2) + ); + } + + inlet + { + type patch; + faces + ( + quad2D(in2, in1) + ); + } + + outlet + { + type patch; + faces + ( + quad2D(out2, out1) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/boundary b/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/boundary new file mode 100644 index 00000000..4ff78a49 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/polyMesh/boundary @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +6 +( + front + { + type wall; + inGroups 1(wall); + nFaces 700; + startFace 63400; + } + back + { + type wall; + inGroups 1(wall); + nFaces 700; + startFace 64100; + } + walls + { + type wall; + inGroups 1(wall); + nFaces 1400; + startFace 64800; + } + porosityWall + { + type wall; + inGroups 1(wall); + nFaces 1600; + startFace 66200; + } + inlet + { + type patch; + nFaces 400; + startFace 67800; + } + outlet + { + type patch; + nFaces 400; + startFace 68200; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/transportProperties b/tutorials/multiphase/interFoam/ras/angledDuct/constant/transportProperties new file mode 100644 index 00000000..2f6fad86 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/transportProperties @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 1000; + CrossPowerLawCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 0; + } + + BirdCarreauCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 99.6; + n n [ 0 0 0 0 0 0 0 ] 0.1003; + } +} + +air +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; + CrossPowerLawCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 0; + } + + BirdCarreauCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 99.6; + n n [ 0 0 0 0 0 0 0 ] 0.1003; + } +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/constant/turbulenceProperties b/tutorials/multiphase/interFoam/ras/angledDuct/constant/turbulenceProperties new file mode 100644 index 00000000..fa68b262 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/system/controlDict b/tutorials/multiphase/interFoam/ras/angledDuct/system/controlDict new file mode 100644 index 00000000..b0244d5a --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/system/controlDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 10; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep on; + +maxCo 1; +maxAlphaCo 1; + +maxDeltaT 1; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/system/fvOptions b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvOptions new file mode 100644 index 00000000..7352696f --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvOptions @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +porosity1 +{ + type explicitPorositySource; + active true; + selectionMode cellZone; + cellZone porosity; + + explicitPorositySourceCoeffs + { + type DarcyForchheimer; + + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0 0 0] (2e8 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + type cartesian; + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } + } + } +} + + +//************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSchemes b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSchemes new file mode 100644 index 00000000..39485cf7 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSchemes @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div((muEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh; + pcorr; + alpha.water; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSolution b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSolution new file mode 100644 index 00000000..b33c4085 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/angledDuct/system/fvSolution @@ -0,0 +1,108 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 2; + nAlphaSubCycles 1; + cAlpha 1; + + MULESCorr yes; + nLimiterIter 3; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + pcorr + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-5; + relTol 0; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + tolerance 1e-5; + relTol 0; + maxIter 50; + } + + p_rgh + { + solver GAMG; + tolerance 5e-9; + relTol 0.01; + + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + + cacheAgglomeration true; + + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + maxIter 50; + }; + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "(U|k|epsilon).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-06; + relTol 0; + minIter 1; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + ".*" 1; + } +} + +// ************************************************************************* // From 78d8f619ee75be3f47df7f16fbfd38d519d0a1d3 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 13 May 2014 10:34:11 +0100 Subject: [PATCH 07/11] Remove confusing IInfo macro the benefit of which is insufficient Simply use the indent manipulator --- src/OpenFOAM/db/error/messageStream.H | 7 ------ src/fvOptions/fvOptions/fvOption.C | 22 +++++++++++-------- .../AMIInterpolation/AMIInterpolation.C | 9 +++++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/OpenFOAM/db/error/messageStream.H b/src/OpenFOAM/db/error/messageStream.H index 68032d40..01575f22 100644 --- a/src/OpenFOAM/db/error/messageStream.H +++ b/src/OpenFOAM/db/error/messageStream.H @@ -282,13 +282,6 @@ extern messageStream Info; ::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] " \ << #var " = " << var << ::Foam::endl -/** - * \def IInfo - * Indented Info -*/ -#define IInfo \ - ::Foam::Info<< indent - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fvOptions/fvOptions/fvOption.C b/src/fvOptions/fvOptions/fvOption.C index 011b8e6e..3387bdec 100644 --- a/src/fvOptions/fvOptions/fvOption.C +++ b/src/fvOptions/fvOptions/fvOption.C @@ -113,7 +113,7 @@ void Foam::fv::option::setCellSet() { case smPoints: { - IInfo<< "- selecting cells using points" << endl; + Info<< indent << "- selecting cells using points" << endl; labelHashSet selectedCells; @@ -141,7 +141,8 @@ void Foam::fv::option::setCellSet() } case smCellSet: { - IInfo<< "- selecting cells using cellSet " << cellSetName_ << endl; + Info<< indent + << "- selecting cells using cellSet " << cellSetName_ << endl; cellSet selectedCells(mesh_, cellSetName_); cells_ = selectedCells.toc(); @@ -150,7 +151,8 @@ void Foam::fv::option::setCellSet() } case smCellZone: { - IInfo<< "- selecting cells using cellZone " << cellSetName_ << endl; + Info<< indent + << "- selecting cells using cellZone " << cellSetName_ << endl; label zoneID = mesh_.cellZones().findZoneID(cellSetName_); if (zoneID == -1) @@ -168,7 +170,7 @@ void Foam::fv::option::setCellSet() { if (active_ && master_) { - IInfo<< "- selecting inter region mapping" << endl; + Info<< indent << "- selecting inter region mapping" << endl; const fvMesh& nbrMesh = mesh_.time().lookupObject(nbrRegionName_); @@ -213,7 +215,7 @@ void Foam::fv::option::setCellSet() } case smAll: { - IInfo<< "- selecting all cells" << endl; + Info<< indent << "- selecting all cells" << endl; cells_ = identity(mesh_.nCells()); break; @@ -238,7 +240,8 @@ void Foam::fv::option::setCellSet() } reduce(V_, sumOp()); - IInfo<< "- selected " << returnReduce(cells_.size(), sumOp