From 711a0e99cfdd92fa6b28e128d6c8444eb33f051d Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:38:23 +0000 Subject: [PATCH 001/141] ENH: Added film coverage field, alpha, to kinematicSingleLayer film model --- .../kinematicSingleLayer.C | 25 ++++++++++++++++++- .../kinematicSingleLayer.H | 11 +++++++- .../kinematicSingleLayerI.H | 8 +++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 86f5b34b63..050c27d3af 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -197,6 +197,12 @@ tmp kinematicSingleLayer::pp() } +void kinematicSingleLayer::correctAlpha() +{ + alpha_ == pos(delta_ - dimensionedScalar("SMALL", dimless, SMALL)); +} + + void kinematicSingleLayer::updateSubmodels() { if (debug) @@ -503,6 +509,19 @@ kinematicSingleLayer::kinematicSingleLayer ), regionMesh() ), + alpha_ + ( + IOobject + ( + "alpha", + time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimless, 0.0) + ), U_ ( IOobject @@ -838,6 +857,8 @@ void kinematicSingleLayer::evolveRegion() Info<< "kinematicSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ @@ -1032,7 +1053,9 @@ void kinematicSingleLayer::info() const << indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", " << max(mag(U_)).value() << nl << indent << "min/max(delta) = " << min(delta_).value() << ", " - << max(delta_).value() << nl; + << max(delta_).value() << nl + << indent << "coverage = " + << gSum(alpha_.internalField()*magSf())/gSum(magSf()) << nl; injection_.info(Info); } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index b084f885d4..796866330c 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,6 +113,9 @@ protected: //- Film thickness / [m] volScalarField delta_; + //- Film coverage indicator, 1 = covered, 0 = uncovered / [] + volScalarField alpha_; + //- Velocity - mean / [m/s] volVectorField U_; @@ -227,6 +230,9 @@ protected: // Implicit pressure source coefficient virtual tmp pp(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); @@ -323,6 +329,9 @@ public: //- Return const access to the film thickness / [m] inline const volScalarField& delta() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + inline const volScalarField& alpha() const; + //- Return the film velocity [m/s] virtual const volVectorField& U() const; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index e717acc430..89eb8b6145 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,6 +79,12 @@ inline const volScalarField& kinematicSingleLayer::delta() const } +inline const volScalarField& kinematicSingleLayer::alpha() const +{ + return alpha_; +} + + inline volVectorField& kinematicSingleLayer::USpPrimary() { return USpPrimary_; From f75d998b10572e06dde60d1ab7a63f5dd3964706 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:45:11 +0000 Subject: [PATCH 002/141] ENH: Added film coverage calculation to thermoSingleLayer film model --- .../thermoSingleLayer/thermoSingleLayer.C | 40 +++++++++++++++++++ .../thermoSingleLayer/thermoSingleLayer.H | 21 +++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 1cb392eb6a..758abe807b 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -227,6 +227,33 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields() } +void thermoSingleLayer::correctAlpha() +{ + if (hydrophilic_) + { + const scalar hydrophilicDry = hydrophilicDryScale_*deltaWet_; + const scalar hydrophilicWet = hydrophilicWetScale_*deltaWet_; + + forAll(alpha_, i) + { + if ((alpha_[i] < 0.5) && (delta_[i] > hydrophilicDry)) + { + alpha_[i] = 1.0; + } + else if ((alpha_[i] > 0.5) && (delta_[i] < hydrophilicWet)) + { + alpha_[i] = 0.0; + } + } + } + else + { + alpha_ == + pos(delta_ - dimensionedScalar("deltaWet", dimLength, deltaWet_)); + } +} + + void thermoSingleLayer::updateSubmodels() { if (debug) @@ -426,6 +453,11 @@ thermoSingleLayer::thermoSingleLayer zeroGradientFvPatchScalarField::typeName ), + deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), + hydrophilic_(readBool(coeffs_.lookup("hydrophilic"))), + hydrophilicDryScale_(0.0), + hydrophilicWetScale_(0.0), + hsSp_ ( IOobject @@ -510,6 +542,12 @@ thermoSingleLayer::thermoSingleLayer } } + if (hydrophilic_) + { + coeffs_.lookup("hydrophilicDryScale") >> hydrophilicDryScale_; + coeffs_.lookup("hydrophilicWetScale") >> hydrophilicWetScale_; + } + if (readFields) { transferPrimaryRegionThermoFields(); @@ -584,6 +622,8 @@ void thermoSingleLayer::evolveRegion() Info<< "thermoSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index 6814e25a3e..bce30b4483 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,6 +123,22 @@ protected: volScalarField primaryEnergyPCTrans_; + //- Threshold film thickness beyond which the film is considered 'wet' + scalar deltaWet_; + + + // Hyprophilic/phobic properties + + //- Activation flag + bool hydrophilic_; + + //- Length scale applied to deltaWet_ for dry faces, typically 0.5 + scalar hydrophilicDryScale_; + + //- Length scale applied to deltaWet_ for wet faces, typically 0.001 + scalar hydrophilicWetScale_; + + // Source term fields // Film region - registered to the film region mesh @@ -190,6 +206,9 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); From fdcb0f5d0aee1c923a0c57d1f7d2f30ec36922ba Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:46:24 +0000 Subject: [PATCH 003/141] STYLE: Corrected doxygen comment tags --- .../kinematicSingleLayer/kinematicSingleLayer.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 796866330c..079999d0cd 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -224,10 +224,10 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); - // Explicit pressure source contribution + //- Explicit pressure source contribution virtual tmp pu(); - // Implicit pressure source coefficient + //- Implicit pressure source coefficient virtual tmp pp(); //- Correct film coverage field From d1a0319972a1e3f33ca033e9c149b6de48225a22 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:47:49 +0000 Subject: [PATCH 004/141] ENH: Updated film netMass() calculation --- .../kinematicSingleLayer/kinematicSingleLayerI.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index 89eb8b6145..6a77b614bc 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -179,7 +179,8 @@ inline tmp kinematicSingleLayer::netMass() const { dimensionedScalar d0("SMALL", dimLength, ROOTVSMALL); return - fvc::surfaceSum(phi_/(fvc::interpolate(delta_) + d0))*time().deltaT() + fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + d0)) + *time().deltaT() + rho_*delta_*magSf(); } From 6b427e64a18654f39bebc28a528f77c2d5f44b69 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:49:50 +0000 Subject: [PATCH 005/141] ENH: Apply quadratic profilke when setting upper film surface velocity --- .../kinematicSingleLayer/kinematicSingleLayer.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 050c27d3af..a9094d55c1 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -282,8 +282,8 @@ void kinematicSingleLayer::updateSurfaceVelocities() Uw_ -= nHat()*(Uw_ & nHat()); Uw_.correctBoundaryConditions(); - // TODO: apply quadratic profile to determine surface velocity - Us_ = U_; + // apply quadratic profile to surface velocity + Us_ = 2.0*U_; Us_.correctBoundaryConditions(); } From 156d515b43015b0cc09ba3d33630b39246a553ee Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:50:59 +0000 Subject: [PATCH 006/141] ENH: Added call to base class preEvolveRegion --- .../kinematicSingleLayer/kinematicSingleLayer.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index a9094d55c1..28a6acdbaa 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -836,6 +836,8 @@ void kinematicSingleLayer::preEvolveRegion() Info<< "kinematicSingleLayer::preEvolveRegion()" << endl; } + surfaceFilmModel::preEvolveRegion(); + transferPrimaryRegionThermoFields(); correctThermoFields(); From 85f1ba27523d3bc12385f0c00d7292505fa1ef12 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:53:48 +0000 Subject: [PATCH 007/141] ENH: Added dummy access to alpha for noFilm film model --- .../surfaceFilmModels/noFilm/noFilm.C | 17 +++++++++++++---- .../surfaceFilmModels/noFilm/noFilm.H | 9 ++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 1c267307ec..82f3d0afc9 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,10 +102,10 @@ const volScalarField& noFilm::delta() const } -const volScalarField& noFilm::sigma() const +const volScalarField& noFilm::alpha() const { - FatalErrorIn("const volScalarField& noFilm::sigma() const") - << "sigma field not available for " << type() << abort(FatalError); + FatalErrorIn("const volScalarField& noFilm::alpha() const") + << "alpha field not available for " << type() << abort(FatalError); return volScalarField::null(); } @@ -192,6 +192,15 @@ const volScalarField& noFilm::kappa() const } +const volScalarField& noFilm::sigma() const +{ + FatalErrorIn("const volScalarField& noFilm::sigma() const") + << "sigma field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + tmp noFilm::primaryMassTrans() const { return tmp diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H index 76501a4fd8..17915f7788 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,8 +115,8 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const; - //- Return const access to the surface tension / [m/s2] - inline const volScalarField& sigma() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const; //- Return the film velocity [m/s] virtual const volVectorField& U() const; @@ -145,6 +145,9 @@ public: //- Return the film thermal conductivity [W/m/K] virtual const volScalarField& kappa() const; + //- Return const access to the surface tension / [m/s2] + inline const volScalarField& sigma() const; + // Transfer fields - to the primary region From f47adb9a0fbc070651bdb3e82c93f2b43e22d782 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 10:56:16 +0000 Subject: [PATCH 008/141] ENH: Enforce consistent treatment for film energy source with mass term --- .../surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 758abe807b..9f0c18c0cc 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -317,7 +317,8 @@ void thermoSingleLayer::solveEnergy() - hsSp_ + q(hs_) + radiation_->Shs() - - fvm::SuSp(rhoSp_, hs_) +// - fvm::SuSp(rhoSp_, hs_) + - rhoSp_*hs_ ); correctThermoFields(); From f036f5a761a72d8f0fccdf6b49466cab5ea64414 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:00:03 +0000 Subject: [PATCH 009/141] ENH: Added optional temperature limiting to thermo film model --- .../thermoSingleLayer/thermoSingleLayer.C | 14 +++++++++++++- .../thermoSingleLayer/thermoSingleLayer.H | 9 +++++++++ .../thermoSingleLayer/thermoSingleLayerI.H | 9 +++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 9f0c18c0cc..417274da8e 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -514,8 +514,20 @@ thermoSingleLayer::thermoSingleLayer heatTransferModel::New(*this, coeffs().subDict("lowerSurfaceModels")) ), phaseChange_(phaseChangeModel::New(*this, coeffs())), - radiation_(filmRadiationModel::New(*this, coeffs())) + radiation_(filmRadiationModel::New(*this, coeffs())), + Tmin_(-VGREAT), + Tmax_(VGREAT) { + if (coeffs().readIfPresent("Tmin", Tmin_)) + { + Info<< " limiting minimum temperature to " << Tmin_ << endl; + } + + if (coeffs().readIfPresent("Tmax", Tmax_)) + { + Info<< " limiting maximum temperature to " << Tmax_ << endl; + } + if (thermo_.hasMultiComponentCarrier()) { YPrimary_.setSize(thermo_.carrier().species().size()); diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index bce30b4483..c67a6ef6b5 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -166,6 +166,15 @@ protected: PtrList YPrimary_; + // Limits + + //- Minimum temperature limit (optional) + scalar Tmin_; + + //- Maximum temperature limit (optional) + scalar Tmax_; + + // Sub-models //- Heat transfer coefficient bewteen film surface and primary diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 73dc08496b..c8ba48f984 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,7 +88,7 @@ inline tmp thermoSingleLayer::T const volScalarField& hs ) const { - return tmp + tmp tT ( new volScalarField ( @@ -104,6 +104,11 @@ inline tmp thermoSingleLayer::T zeroGradientFvPatchScalarField::typeName ) ); + + tT().min(Tmax_); + tT().max(Tmin_); + + return tT; } From e8e95a38cb985dec3527157f9739cf2de9f1bbf5 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:24:06 +0000 Subject: [PATCH 010/141] ENH: Added on-the-fly heat flux calculations to thermoFilm --- .../thermoSingleLayer/thermoSingleLayer.H | 9 ++++++++ .../thermoSingleLayer/thermoSingleLayerI.H | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index c67a6ef6b5..ae0dc780c9 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -370,6 +370,15 @@ public: inline const filmRadiationModel& radiation() const; + // Derived fields (calculated on-the-fly) + + //- Return the convective heat energy from film to wall + inline tmp Qconvw(const label patchI) const; + + //- Return the convective heat energy from primary region to film + inline tmp Qconvp(const label patchI) const; + + // Evolution //- Pre-evolve film hook diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index c8ba48f984..659a315f49 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "thermoSingleLayer.H" +#include "heatTransferModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -160,6 +161,26 @@ inline const filmRadiationModel& thermoSingleLayer::radiation() const } +inline tmp thermoSingleLayer::Qconvw(const label patchI) const +{ + const scalarField htc(htcw_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Twp = Tw_.boundaryField()[patchI]; + + return htc*(Tp - Twp); +} + + +inline tmp thermoSingleLayer::Qconvp(const label patchI) const +{ + const scalarField htc(htcs_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Tpp = TPrimary_.boundaryField()[patchI]; + + return htc*(Tp - Tpp); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels From fe3751981942aa111a9ec6b68008d0d9988bb847 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:30:00 +0000 Subject: [PATCH 011/141] ENH: Updated film contact angle force to make use of alpha field --- .../contactAngleForce/contactAngleForce.C | 31 +++++++------------ .../contactAngleForce/contactAngleForce.H | 5 +-- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C index 5f31601474..2ceff1429f 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,6 @@ contactAngleForce::contactAngleForce ) : force(typeName, owner, dict), - deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), Ccf_(readScalar(coeffs_.lookup("Ccf"))), rndGen_(label(0), -1), distribution_ @@ -82,7 +81,7 @@ tmp contactAngleForce::correct(volVectorField& U) ( IOobject ( - "contactForce", + typeName + ".contactForce", owner_.time().timeName(), owner_.regionMesh(), IOobject::NO_READ, @@ -100,17 +99,11 @@ tmp contactAngleForce::correct(volVectorField& U) const scalarField& magSf = owner_.magSf(); - const volScalarField& delta = owner_.delta(); + const volScalarField& alpha = owner_.alpha(); const volScalarField& sigma = owner_.sigma(); - volScalarField alpha - ( - "alpha", - pos(delta - dimensionedScalar("deltaWet", dimLength, deltaWet_)) - ); volVectorField gradAlpha(fvc::grad(alpha)); - scalarField nHits(owner_.regionMesh().nCells(), 0.0); forAll(nbr, faceI) @@ -119,19 +112,17 @@ tmp contactAngleForce::correct(volVectorField& U) const label cellN = nbr[faceI]; label cellI = -1; - if ((delta[cellO] > deltaWet_) && (delta[cellN] < deltaWet_)) + if ((alpha[cellO] > 0.5) && (alpha[cellN] < 0.5)) { cellI = cellO; } - else if ((delta[cellO] < deltaWet_) && (delta[cellN] > deltaWet_)) + else if ((alpha[cellO] < 0.5) && (alpha[cellN] > 0.5)) { cellI = cellN; } if (cellI != -1) { -// const scalar dx = Foam::sqrt(magSf[cellI]); - // bit of a cheat, but ok for regular meshes const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI]; const vector n = gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL); @@ -141,17 +132,17 @@ tmp contactAngleForce::correct(volVectorField& U) } } - forAll(delta.boundaryField(), patchI) + forAll(alpha.boundaryField(), patchI) { - const fvPatchField& df = delta.boundaryField()[patchI]; - const scalarField& dx = df.patch().deltaCoeffs(); - const labelUList& faceCells = df.patch().faceCells(); + const fvPatchField& alphaf = alpha.boundaryField()[patchI]; + const scalarField& dx = alphaf.patch().deltaCoeffs(); + const labelUList& faceCells = alphaf.patch().faceCells(); - forAll(df, faceI) + forAll(alphaf, faceI) { label cellO = faceCells[faceI]; - if ((delta[cellO] > deltaWet_) && (df[faceI] < deltaWet_)) + if ((alpha[cellO] > 0.5) && (alphaf[faceI] < 0.5)) { const vector n = gradAlpha[cellO]/(mag(gradAlpha[cellO]) + ROOTVSMALL); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H index 2ed08e02ee..8a6dc7a8b3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,9 +60,6 @@ private: // Private Data - //- Threshold film thickness beyon which the film is 'wet' - scalar deltaWet_; - //- Coefficient applied to the contact angle force scalar Ccf_; From dfb41f426b43487d403e0c67fc50d0e3bdde38e6 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:32:34 +0000 Subject: [PATCH 012/141] ENH: Added pure virtual call to alpha in surfaceFilmModel --- .../surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 32c71b3fed..2aa4423196 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -186,6 +186,9 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const = 0; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const = 0; + //- Return the film velocity [m/s] virtual const volVectorField& U() const = 0; From 01eee4dc42db2debc2218f2df3c5551e72d55fb1 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:34:23 +0000 Subject: [PATCH 013/141] ENH: Corrected initialisation order --- .../thermoSingleLayer/thermoSingleLayer.H | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index ae0dc780c9..696728e7f9 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -166,15 +166,6 @@ protected: PtrList YPrimary_; - // Limits - - //- Minimum temperature limit (optional) - scalar Tmin_; - - //- Maximum temperature limit (optional) - scalar Tmax_; - - // Sub-models //- Heat transfer coefficient bewteen film surface and primary @@ -191,6 +182,14 @@ protected: autoPtr radiation_; + // Limits + + //- Minimum temperature limit (optional) + scalar Tmin_; + + //- Maximum temperature limit (optional) + scalar Tmax_; + // Protected member functions From a3cb7bd6a838a6c73c968883a2ad7a86f078b377 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:37:15 +0000 Subject: [PATCH 014/141] ENH: Updated upper limit for wall shear --- .../kinematic/force/surfaceShearForce/surfaceShearForce.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C index c5419d2909..2c0a94f9f8 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,7 +131,7 @@ tmp surfaceShearForce::correct(volVectorField& U) // linear coeffs to apply to velocity const volScalarField& Cs = tCs(); volScalarField Cw("Cw", mu/(0.3333*(delta + d0))); - Cw.min(1.0e+06); + Cw.min(5000.0); return ( From f1a2be143270efe7e1c94027b93a889165bcf5a9 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:40:30 +0000 Subject: [PATCH 015/141] ENH: Simplified film phase change model for boiling --- .../standardPhaseChange/standardPhaseChange.C | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C index 552bd0dda4..e632712ff4 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,14 +113,10 @@ void standardPhaseChange::correctModel const scalarField& YInf = film.YPrimary()[vapId]; const scalarField& pInf = film.pPrimary(); const scalarField& T = film.T(); - const scalarField& Tw = film.Tw(); const scalarField& rho = film.rho(); - const scalarField& TInf = film.TPrimary(); const scalarField& rhoInf = film.rhoPrimary(); const scalarField& muInf = film.muPrimary(); const scalarField& magSf = film.magSf(); - const scalarField hInf(film.htcs().h()); - const scalarField hFilm(film.htcw().h()); const vectorField dU(film.UPrimary() - film.Us()); const scalarField limMass ( @@ -147,15 +143,10 @@ void standardPhaseChange::correctModel if (pSat >= 0.95*pc) { // boiling - const scalar qDotInf = hInf[cellI]*(TInf[cellI] - T[cellI]); - const scalar qDotFilm = hFilm[cellI]*(T[cellI] - Tw[cellI]); - const scalar Cp = liq.Cp(pc, Tloc); - const scalar Tcorr = max(0.0, T[cellI] - Tb_); + const scalar Tcorr = max(0.0, T[cellI] - Tb); const scalar qCorr = limMass[cellI]*Cp*(Tcorr); - dMass[cellI] = - dt*magSf[cellI]/hVap*(qDotInf + qDotFilm) - + qCorr/hVap; + dMass[cellI] = qCorr/hVap; } else { From ba717a55103ae8e5d61c5651362f4f8bc8fea74b Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 11:43:48 +0000 Subject: [PATCH 016/141] ENH: Calculate film boiling temperature instead of reading from user input --- .../standardPhaseChange/standardPhaseChange.C | 6 ++++-- .../standardPhaseChange/standardPhaseChange.H | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C index e632712ff4..4a08755ee3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C @@ -77,7 +77,6 @@ standardPhaseChange::standardPhaseChange ) : phaseChangeModel(typeName, owner, dict), - Tb_(readScalar(coeffs_.lookup("Tb"))), deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), L_(readScalar(coeffs_.lookup("L"))), TbFactor_(coeffs_.lookupOrDefault("TbFactor", 1.1)) @@ -130,8 +129,11 @@ void standardPhaseChange::correctModel // cell pressure [Pa] const scalar pc = pInf[cellI]; + // calculate the boiling temperature + const scalar Tb = liq.pvInvert(pc); + // local temperature - impose lower limit of 200 K for stability - const scalar Tloc = min(TbFactor_*Tb_, max(200.0, T[cellI])); + const scalar Tloc = min(TbFactor_*Tb, max(200.0, T[cellI])); // saturation pressure [Pa] const scalar pSat = liq.pv(pc, Tloc); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H index 1fff3384ff..ee1b21d6d0 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,9 +69,6 @@ protected: // Protected data - //- Boiling temperature / [K] - const scalar Tb_; - //- Minimum film height for model to be active const scalar deltaMin_; From abfcafc8470a1d9c5d5e06b72490b8f15a4b0736 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:03:03 +0000 Subject: [PATCH 017/141] ENH: Use alpha in film standard radiation model instead of re-calculating wet/dry --- .../standardRadiation/standardRadiation.C | 7 +++---- .../standardRadiation/standardRadiation.H | 6 ------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C index be5460757f..1ff3274716 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C @@ -85,8 +85,6 @@ standardRadiation::standardRadiation dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), zeroGradientFvPatchScalarField::typeName ), - delta_(owner.delta()), - deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), beta_(readScalar(coeffs_.lookup("beta"))), kappaBar_(readScalar(coeffs_.lookup("kappaBar"))) {} @@ -129,9 +127,10 @@ tmp standardRadiation::Shs() scalarField& Shs = tShs(); const scalarField& QinP = QinPrimary_.internalField(); - const scalarField& delta = delta_.internalField(); + const scalarField& delta = owner_.delta().internalField(); + const scalarField& alpha = owner_.alpha().internalField(); - Shs = beta_*(QinP*pos(delta - deltaMin_))*(1.0 - exp(-kappaBar_*delta)); + Shs = beta_*QinP*alpha*(1.0 - exp(-kappaBar_*delta)); // Update net Qr on local region QrNet_.internalField() = QinP - Shs; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H index 9b96fb60fe..799bb6c649 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H @@ -65,15 +65,9 @@ private: //- Remaining radiative flux after removing local contribution volScalarField QrNet_; - //- Reference to the film thickness field / [m] - const volScalarField& delta_; - // Model coefficients - //- Minimum thickness to apply radiation model - scalar deltaMin_; - //- Beta coefficient scalar beta_; From b7dc134a9dc3e20e2596a529b029abc1f166e8eb Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:06:20 +0000 Subject: [PATCH 018/141] ENH: Added new constant film radiation model --- src/regionModels/surfaceFilmModels/Make/files | 1 + .../constantRadiation/constantRadiation.C | 146 ++++++++++++++++++ .../constantRadiation/constantRadiation.H | 130 ++++++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index 12f80a7ce7..8bda6f6aae 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -38,6 +38,7 @@ $(THERMOMODELS)/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveH $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModel.C $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C $(THERMOMODELS)/filmRadiationModel/noRadiation/noRadiation.C +$(THERMOMODELS)/filmRadiationModel/constantRadiation/constantRadiation.C $(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C new file mode 100644 index 0000000000..ac0358f141 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "constantRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(constantRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + constantRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +constantRadiation::constantRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QrConst_ + ( + IOobject + ( + typeName + "::QrConst", + owner.time().timeName(), + owner.regionMesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + owner.regionMesh() + ), + mask_ + ( + IOobject + ( + typeName + "::mask", + owner.time().timeName(), + owner.regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("one", dimless, 1.0), + zeroGradientFvPatchScalarField::typeName + ), + timeStart_(readScalar(coeffs_.lookup("timeStart"))), + duration_(readScalar(coeffs_.lookup("duration"))) +{ + mask_ = pos(mask_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +constantRadiation::~constantRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void constantRadiation::correct() +{} + + +tmp constantRadiation::Shs() +{ + tmp tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + const scalar time = owner().time().value(); + + if ((time >= timeStart_) && (time <= timeStart_ + duration_)) + { + scalarField& Shs = tShs(); + const scalarField& Qr = QrConst_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = mask_*Qr*alpha; + } + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H new file mode 100644 index 0000000000..06e6fe676b --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::constantRadiation + +Description + Film constant radiation model. The constant radiative flux is specified + by the user, and operated over a time interval defined by a start time and + duration. In addition, a mask can be applied to shield the film from the + radiation. + +SourceFiles + constantRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantRadiation_H +#define constantRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class constantRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Constant radiative flux [kg/s3] + volScalarField QrConst_; + + //- Radiation mask + volScalarField mask_; + + //- Time start [s] + const scalar timeStart_; + + //- Duration [s] + const scalar duration_; + + + // Private member functions + + //- Disallow default bitwise copy construct + constantRadiation(const constantRadiation&); + + //- Disallow default bitwise assignment + void operator=(const constantRadiation&); + + +public: + + //- Runtime type information + TypeName("constantRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + constantRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~constantRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 85cbb0e1b909c9b907ba8acca1127ebc153c9fe7 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:08:57 +0000 Subject: [PATCH 019/141] ENH: Added new primary film radiation model --- src/regionModels/surfaceFilmModels/Make/files | 1 + .../primaryRadiation/primaryRadiation.C | 128 ++++++++++++++++++ .../primaryRadiation/primaryRadiation.H | 119 ++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index 8bda6f6aae..06b8f2d414 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -39,6 +39,7 @@ $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModel.C $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C $(THERMOMODELS)/filmRadiationModel/noRadiation/noRadiation.C $(THERMOMODELS)/filmRadiationModel/constantRadiation/constantRadiation.C +$(THERMOMODELS)/filmRadiationModel/primaryRadiation/primaryRadiation.C $(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C new file mode 100644 index 0000000000..2fdccf63f7 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "primaryRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(primaryRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + primaryRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +primaryRadiation::primaryRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QinPrimary_ + ( + IOobject + ( + "Qin", // same name as Qin on primary region to enable mapping + owner.time().timeName(), + owner.regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + owner.mappedPushedFieldPatchTypes() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +primaryRadiation::~primaryRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void primaryRadiation::correct() +{ + // Transfer Qin from primary region + QinPrimary_.correctBoundaryConditions(); +} + + +tmp primaryRadiation::Shs() +{ + tmp tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& Shs = tShs(); + const scalarField& QinP = QinPrimary_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = QinP*alpha; + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H new file mode 100644 index 0000000000..a8904cb1e2 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::primaryRadiation + +Description + Radiation model whereby the radiative heat flux is mapped from the primary + region + +SourceFiles + primaryRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef primaryRadiation_H +#define primaryRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class primaryRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class primaryRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Incident radiative flux mapped from the primary region / [kg/s3] + volScalarField QinPrimary_; + + + // Private member functions + + //- Disallow default bitwise copy construct + primaryRadiation(const primaryRadiation&); + + //- Disallow default bitwise assignment + void operator=(const primaryRadiation&); + + +public: + + //- Runtime type information + TypeName("primaryRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + primaryRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~primaryRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 7e28c1a784a1c303fe73fa3dfd4534a6204bfe9b Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:18:04 +0000 Subject: [PATCH 020/141] BUG: Corrected ESigmaSec in thermo cloud film model --- .../ThermoSurfaceFilm/ThermoSurfaceFilm.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C index 4eee7d990c..3e1a29e988 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C @@ -398,13 +398,15 @@ void Foam::ThermoSurfaceFilm::splashInteraction // surface energy of secondary parcels [J] scalar ESigmaSec = 0; - // sample splash distribution to detrmine secondary parcel diameters + // sample splash distribution to determine secondary parcel diameters scalarList dNew(parcelsPerSplash_); + scalarList npNew(parcelsPerSplash_); forAll(dNew, i) { const scalar y = rndGen_.sample01(); dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K); - ESigmaSec += sigma*p.areaS(dNew[i]); + npNew[i] = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]); } // incident kinetic energy [J] @@ -459,7 +461,7 @@ void Foam::ThermoSurfaceFilm::splashInteraction // perturb new parcels towards the owner cell centre pPtr->position() += 0.5*rndGen_.sample01()*(posC - posCf); - pPtr->nParticle() = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + pPtr->nParticle() = npNew[i]; pPtr->d() = dNew[i]; From 9961dcbf85e30a1435f88058204e4fd9b1edc647 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:40:55 +0000 Subject: [PATCH 021/141] BUG: offset should have dimensions of length --- .../kinematicSingleLayer/kinematicSingleLayer.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 28a6acdbaa..48277b261d 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -199,7 +199,7 @@ tmp kinematicSingleLayer::pp() void kinematicSingleLayer::correctAlpha() { - alpha_ == pos(delta_ - dimensionedScalar("SMALL", dimless, SMALL)); + alpha_ == pos(delta_ - dimensionedScalar("SMALL", dimLength, SMALL)); } From 9f128ec497bdd17a5576ef02b2f3505cd1aa0ce4 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:52:03 +0000 Subject: [PATCH 022/141] ENH: Default film outer correctors to 1 --- .../kinematicSingleLayer/kinematicSingleLayer.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 48277b261d..b52b25b5a9 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -445,7 +445,7 @@ kinematicSingleLayer::kinematicSingleLayer surfaceFilmModel(modelType, mesh, g), momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")), - nOuterCorr_(readLabel(solution().subDict("PISO").lookup("nOuterCorr"))), + nOuterCorr_(solution().subDict("PISO").lookupOrDefault("nOuterCorr", 1)), nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))), nNonOrthCorr_ ( From 3657f608a902294f4105928eec8a4bbe10fef703 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 12:53:01 +0000 Subject: [PATCH 023/141] ENH: Film tutorial updates --- .../cylinder/constant/surfaceFilmProperties | 3 +++ .../cylinder/system/wallFilmRegion/fvSolution | 3 +-- .../hotBoxes/constant/surfaceFilmProperties | 4 +++- .../hotBoxes/system/wallFilmRegion.org/fvSolution | 3 +-- .../rivuletPanel/constant/surfaceFilmProperties | 1 - .../rivuletPanel/system/wallFilmRegion/fvSolution | 3 +-- .../splashPanel/constant/surfaceFilmProperties | 3 +++ .../splashPanel/system/wallFilmRegion/fvSolution | 3 +-- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties index 98c728fdec..e327a82959 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties @@ -26,6 +26,9 @@ thermoSingleLayerCoeffs thermoModel singleComponent; liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution index 381a5c4f27..eedbd097d3 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties index 6984dcbb1e..96e33c1d68 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties @@ -28,6 +28,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + radiationModel none; upperSurfaceModels @@ -65,7 +68,6 @@ thermoSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 0.085; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution index cfae8b06ce..9385e6ec40 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution @@ -39,8 +39,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties index d9a68e059d..8440f3f479 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties @@ -43,7 +43,6 @@ kinematicSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 1; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution index 645d42a456..86cdc388bf 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties index 30a2dd79f3..8335fadfc2 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties @@ -27,6 +27,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution index 381a5c4f27..eedbd097d3 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } From 270cd8268239250abc3ca1971d988faaf21dbb16 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 13:00:19 +0000 Subject: [PATCH 024/141] ENH: Added change missed during commit 9f128ec --- .../kinematicSingleLayer/kinematicSingleLayer.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index b52b25b5a9..87d56add7f 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -61,7 +61,7 @@ bool kinematicSingleLayer::read() { const dictionary& solution = this->solution().subDict("PISO"); solution.lookup("momentumPredictor") >> momentumPredictor_; - solution.lookup("nOuterCorr") >> nOuterCorr_; + solution.readIfPresent("nOuterCorr", nOuterCorr_); solution.lookup("nCorr") >> nCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; From 8be4e49c308bb10a424b32c95217fc62bd94a87d Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:05:03 +0000 Subject: [PATCH 025/141] ENH: Updated film corrector loops --- .../kinematicSingleLayer/kinematicSingleLayer.C | 2 +- .../surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 87d56add7f..941da7e848 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -869,7 +869,7 @@ void kinematicSingleLayer::evolveRegion() // Implicit pressure source coefficient - constant tmp tpp(this->pp()); - for (int oCorr=0; oCorr tpu(this->pu()); diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 417274da8e..21953ae94c 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -642,7 +642,7 @@ void thermoSingleLayer::evolveRegion() // Solve continuity for deltaRho_ solveContinuity(); - for (int oCorr=0; oCorr tpu(this->pu()); From e8073d864ee02e51ba6618ff3666de83d6df0407 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:08:12 +0000 Subject: [PATCH 026/141] ENH: Updated base film sub-model --- src/regionModels/surfaceFilmModels/submodels/subModelBase.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C b/src/regionModels/surfaceFilmModels/submodels/subModelBase.C index 469b62e855..b2283172b3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C +++ b/src/regionModels/surfaceFilmModels/submodels/subModelBase.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ subModelBase::subModelBase ) : owner_(owner), - coeffs_(dict.subDict(type + "Coeffs")) + coeffs_(dict.subOrEmptyDict(type + "Coeffs")) {} From e0f75db2340f3f1a6c99d8adf8548ac0c9df6632 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:16:59 +0000 Subject: [PATCH 027/141] ENH: Added new film BCs based on Nusselt theory --- src/regionModels/surfaceFilmModels/Make/files | 2 + ...linedFilmNusseltHeightFvPatchScalarField.C | 213 ++++++++++++++++++ ...linedFilmNusseltHeightFvPatchScalarField.H | 155 +++++++++++++ ...lmNusseltInletVelocityFvPatchVectorField.C | 210 +++++++++++++++++ ...lmNusseltInletVelocityFvPatchVectorField.H | 158 +++++++++++++ 5 files changed, 738 insertions(+) create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index 06b8f2d414..1151e2f7fd 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -46,6 +46,8 @@ $(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C /* Boundary conditions */ PATCHFIELDS=derivedFvPatchFields $(PATCHFIELDS)/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C +$(PATCHFIELDS)/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C +$(PATCHFIELDS)/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C /* Wall functions for primary region */ WALLFUNCS=$(PATCHFIELDS)/wallFunctions diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C new file mode 100644 index 0000000000..b36832a1d3 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "inclinedFilmNusseltHeightFvPatchScalarField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(DataEntry::New("GammaMean", dict)), + a_(DataEntry::New("a", dict)), + omega_(DataEntry::New("omega", dict)) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf +) +: + fixedValueFvPatchScalarField(wmfrhpsf), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(wmfrhpsf, iF), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, 0.0)/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltHeightFvPatchScalarField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator== + ( + pow(3.0*sqr(mup/rhop)/(gTan + ROOTVSMALL), 0.333)*pow(Re, 0.333) + ); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + inclinedFilmNusseltHeightFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H new file mode 100644 index 0000000000..cb9f999237 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::inclinedFilmNusseltHeightFvPatchScalarField + +Description + Film height boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the height is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltHeightFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltHeightFvPatchScalarField_H +#define inclinedFilmNusseltHeightFvPatchScalarField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltHeightFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltHeightFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltHeight"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltHeightFvPatchScalarField onto a new patch + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..7f21d9a2e4 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "inclinedFilmNusseltInletVelocityFvPatchVectorField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(DataEntry::New("GammaMean", dict)), + a_(DataEntry::New("a", dict)), + omega_(DataEntry::New("omega", dict)) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf +) +: + fixedValueFvPatchVectorField(fmfrpvf), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(fmfrpvf, iF), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, 0.0)/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator==(n*pow(gTan*mup/(3.0*rhop), 0.333)*pow(Re, 0.666)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchVectorField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + inclinedFilmNusseltInletVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..211ea77561 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::inclinedFilmNusseltInletVelocityFvPatchVectorField + +Description + Film velocity boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the velocity is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltInletVelocityFvPatchVectorField_H +#define inclinedFilmNusseltInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltInletVelocityFvPatchVectorField onto a new patch + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + *this, iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 1ea0c7b08708f13186f2d93fe0a9de840f4da0bb Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:24:26 +0000 Subject: [PATCH 028/141] ENH: Added post-evolve hook to film models --- .../regionModel/regionModel/regionModel.C | 37 +++++++++++-------- .../regionModel/regionModel/regionModel.H | 7 +++- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 98e152c3f1..3ab10f4e86 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -315,18 +315,6 @@ Foam::regionModels::regionModel::~regionModel() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::regionModels::regionModel::preEvolveRegion() -{ - // do nothing -} - - -void Foam::regionModels::regionModel::evolveRegion() -{ - // do nothing -} - - void Foam::regionModels::regionModel::evolve() { if (active_) @@ -334,15 +322,14 @@ void Foam::regionModels::regionModel::evolve() Info<< "\nEvolving " << modelName_ << " for region " << regionMesh().name() << endl; - // Update any input information //read(); - // Pre-evolve preEvolveRegion(); - // Increment the region equations up to the new time level evolveRegion(); + postEvolveRegion(); + // Provide some feedback if (infoOutput_) { @@ -354,6 +341,24 @@ void Foam::regionModels::regionModel::evolve() } +void Foam::regionModels::regionModel::preEvolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModel::evolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModel::postEvolveRegion() +{ + // do nothing +} + + void Foam::regionModels::regionModel::info() const { // do nothing diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 6fbad3d372..7b2b2bef28 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -256,14 +256,17 @@ public: // Evolution + //- Main driver routing to evolve the region - calls other evolves + virtual void evolve(); + //- Pre-evolve region virtual void preEvolveRegion(); //- Evolve the region virtual void evolveRegion(); - //- Evolve the region - virtual void evolve(); + //- Post-evolve region + virtual void postEvolveRegion(); // I-O From 0aa2c600bb99a3ebe29887e913ef9475e8bac36e Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:32:01 +0000 Subject: [PATCH 029/141] ENH: Created new film function objects --- src/regionModels/regionModel/Make/files | 4 + .../regionModel/regionModel/regionModel.C | 15 +- .../regionModel/regionModel/regionModel.H | 8 +- .../regionModelFunctionObject.C | 106 ++++++++++++ .../regionModelFunctionObject.H | 157 ++++++++++++++++++ .../regionModelFunctionObjectList.C | 124 ++++++++++++++ .../regionModelFunctionObjectList.H | 133 +++++++++++++++ .../regionModelFunctionObjectListI.H | 47 ++++++ .../regionModelFunctionObjectNew.C | 66 ++++++++ 9 files changed, 650 insertions(+), 10 deletions(-) create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H create mode 100644 src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C diff --git a/src/regionModels/regionModel/Make/files b/src/regionModels/regionModel/Make/files index ab18530890..11002e0a29 100644 --- a/src/regionModels/regionModel/Make/files +++ b/src/regionModels/regionModel/Make/files @@ -8,4 +8,8 @@ derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch. regionProperties/regionProperties.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C + LIB = $(FOAM_LIBBIN)/libregionModels diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 3ab10f4e86..da1ab6e953 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -214,7 +214,8 @@ Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) coeffs_(dictionary::null), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_("none") + regionName_("none"), + functions_(*this) {} @@ -246,7 +247,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(lookup("regionName")) + regionName_(lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -274,7 +276,7 @@ Foam::regionModels::regionModel::regionModel ( IOobject ( - regionType, + regionType + "Properties", mesh.time().constant(), mesh, IOobject::NO_READ, @@ -292,7 +294,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(dict.lookup("regionName")) + regionName_(dict.lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -343,7 +346,7 @@ void Foam::regionModels::regionModel::evolve() void Foam::regionModels::regionModel::preEvolveRegion() { - // do nothing + functions_.preEvolveRegion(); } @@ -355,7 +358,7 @@ void Foam::regionModels::regionModel::evolveRegion() void Foam::regionModels::regionModel::postEvolveRegion() { - // do nothing + functions_.postEvolveRegion(); } diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 7b2b2bef28..0b02fd1a58 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -41,16 +41,13 @@ SourceFiles #include "labelList.H" #include "volFields.H" #include "mappedPatchBase.H" +#include "regionModelFunctionObjectList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes -//class fvMesh; -//class Time; - namespace regionModels { @@ -121,6 +118,9 @@ protected: //- Region name word regionName_; + //- Region model function objects + regionModelFunctionObjectList functions_; + // Protected member functions diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C new file mode 100644 index 0000000000..182258b637 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "regionModelFunctionObject.H" +#include "regionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + defineTypeNameAndDebug(regionModelFunctionObject, 0); + defineRunTimeSelectionTable(regionModelFunctionObject, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + regionModel& owner +) +: + dict_(dictionary::null), + owner_(owner), + modelType_("modelType") +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const dictionary& dict, + regionModel& owner, + const word& type +) +: + dict_(dict), + owner_(owner), + modelType_(type) +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const regionModelFunctionObject& rmfo +) +: + dict_(rmfo.dict_), + owner_(rmfo.owner_), + modelType_(rmfo.modelType_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::~regionModelFunctionObject() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObject::preEvolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModelFunctionObject::postEvolveRegion() +{ + if (owner_.regionMesh().time().outputTime()) + { + write(); + } +} + + +void Foam::regionModels::regionModelFunctionObject::write() const +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H new file mode 100644 index 0000000000..77e56b14d1 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::regionModelFunctionObject + +Description + Region model function object base class + +SourceFiles + regionModelFunctionObject.C + regionModelFunctionObjectNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObject_H +#define regionModelFunctionObject_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObject Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObject +{ +protected: + + // Protected data + + //- Dictionary + dictionary dict_; + + //- Reference to the region model + regionModel& owner_; + + //- Model type name + word modelType_; + + +public: + + //- Runtime type information + TypeName("regionModelFunctionObject"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + regionModelFunctionObject, + dictionary, + ( + const dictionary& dict, + regionModel& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + regionModelFunctionObject(regionModel& owner); + + //- Construct from dictionary + regionModelFunctionObject + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + //- Construct copy + regionModelFunctionObject(const regionModelFunctionObject& ppm); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new regionModelFunctionObject(*this) + ); + } + + + //- Destructor + virtual ~regionModelFunctionObject(); + + + //- Selector + static autoPtr New + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + + // Member Functions + + // Evaluation + + //- Pre-evolve region hook + virtual void preEvolveRegion(); + + //- Post-evolve region hook + virtual void postEvolveRegion(); + + // I-O + + //- write + virtual void write() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C new file mode 100644 index 0000000000..366ec496ba --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "regionModelFunctionObjectList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner +) +: + PtrList(), + owner_(owner), + dict_(dictionary::null) +{} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner, + const dictionary& dict, + const bool readFields +) +: + PtrList(), + owner_(owner), + dict_(dict) +{ + if (readFields) + { + wordList modelNames(dict.toc()); + + Info<< " Selecting region model functions" << endl; + + if (modelNames.size() > 0) + { + this->setSize(modelNames.size()); + + forAll(modelNames, i) + { + const word& modelName = modelNames[i]; + + this->set + ( + i, + regionModelFunctionObject::New + ( + dict, + owner, + modelName + ) + ); + } + } + else + { + Info<< " none" << endl; + } + } +} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + const regionModelFunctionObjectList& cfol +) +: + PtrList(cfol), + owner_(cfol.owner_), + dict_(cfol.dict_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList:: +~regionModelFunctionObjectList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObjectList::preEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).preEvolveRegion(); + } +} + + +void Foam::regionModels::regionModelFunctionObjectList::postEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).postEvolveRegion(); + } +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H new file mode 100644 index 0000000000..22488f18c8 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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::regionModelFunctionObjectList + +Description + List of cloud function objects + +SourceFiles + regionModelFunctionObjectListI.H + regionModelFunctionObjectList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObjectList_H +#define regionModelFunctionObjectList_H + +#include "PtrList.H" +#include "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObjectList Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObjectList +: + public PtrList +{ +protected: + + // Protected Data + + //- Reference to the owner region model + regionModel& owner_; + + //- Dictionary + const dictionary dict_; + + +public: + + // Constructors + + //- Null constructor + regionModelFunctionObjectList(regionModel& owner); + + //- Construct from mesh + regionModelFunctionObjectList + ( + regionModel& owner, + const dictionary& dict, + const bool readFields = true + ); + + //- Construct copy + regionModelFunctionObjectList + ( + const regionModelFunctionObjectList& rmfol + ); + + + //- Destructor + virtual ~regionModelFunctionObjectList(); + + + // Member Functions + + // Access + + //- Return const access to the cloud owner + inline const regionModel& owner() const; + + //- Return refernce to the cloud owner + inline regionModel& owner(); + + //- Return the forces dictionary + inline const dictionary& dict() const; + + + // Evaluation + + //- Pre-evolve hook + virtual void preEvolveRegion(); + + //- Post-evolve hook + virtual void postEvolveRegion(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "regionModelFunctionObjectListI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H new file mode 100644 index 0000000000..a0a90d0f67 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 . + +\*---------------------------------------------------------------------------*/ + +inline const Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() const +{ + return owner_; +} + + +inline Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::regionModels::regionModelFunctionObjectList::dict() const +{ + return dict_; +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C new file mode 100644 index 0000000000..08e451fab2 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::regionModels::regionModelFunctionObject::New +( + const dictionary& dict, + regionModel& owner, + const word& modelName +) +{ + const word modelType = dict.subDict(modelName).lookup("type"); + + Info<< " " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "regionModelFunctionObject::New" + "(" + "const dictionary&, " + "regionModel&, " + "const word&" + ")" + ) << "Unknown region model function type " + << modelType << nl << nl + << "Valid region model function types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict.subDict(modelName), owner)); +} + + +// ************************************************************************* // From 0582d7e611246f06e7f8cbfecd04c65d64e56ae4 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:42:57 +0000 Subject: [PATCH 030/141] ENH: Added film functions to map between regions using AMI functionality --- .../regionModel/regionModel/regionModel.C | 60 +++++++ .../regionModel/regionModel/regionModel.H | 40 +++++ .../regionModel/regionModelTemplates.C | 158 ++++++++++++++++++ 3 files changed, 258 insertions(+) diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index da1ab6e953..227af0adb4 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -190,6 +190,66 @@ bool Foam::regionModels::regionModel::read(const dictionary& dict) } +Foam::label Foam::regionModels::regionModel::nbrCoupledPatchID +( + const regionModel& nbrRegion, + const label regionPatchI +) const +{ + label nbrPatchI = -1; + + // region + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + // boundary mesh + const polyBoundaryMesh& nbrPbm = nbrRegionMesh.boundaryMesh(); + + const mappedPatchBase& mpb = + refCast + ( + regionMesh().boundaryMesh()[regionPatchI] + ); + + // sample patch name on the primary region + const word& primaryPatchName = mpb.samplePatch(); + + // find patch on nbr region that has the same sample patch name + forAll(nbrRegion.intCoupledPatchIDs(), j) + { + const label nbrRegionPatchI = nbrRegion.intCoupledPatchIDs()[j]; + + const mappedPatchBase& mpb = + refCast(nbrPbm[nbrRegionPatchI]); + + if (mpb.samplePatch() == primaryPatchName) + { + nbrPatchI = nbrRegionPatchI; + break; + } + } + + if (nbrPatchI == -1) + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + FatalErrorIn + ( + "Foam::tmp > " + "Foam::regionModels::regionModel::nbrCoupledPatchID" + "(" + "const regionModel& , " + "const label" + ") const" + ) + << "Unable to find patch pair for local patch " + << p.name() << " and region " << nbrRegion.name() + << abort(FatalError); + } + + return nbrPatchI; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 0b02fd1a58..9f2ec23e67 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -219,6 +219,46 @@ public: // Helper + //- Return the coupled patch ID paired with coupled patch + // regionPatchI + label nbrCoupledPatchID + ( + const regionModel& nbrRegion, + const label regionPatchI + ) const; + + //- Map patch field from another region model to local patch + template + tmp > mapRegionPatchField + ( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field& nbrField, + const bool flip = false + ) const; + + //- Map patch field from another region model to local patch + template + tmp > mapRegionPatchField + ( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ) const; + + //- Map patch internal field from another region model to local + // patch + template + tmp > mapRegionPatchInternalField + ( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ) const; + //- Convert a local region field to the primary region template void toPrimary diff --git a/src/regionModels/regionModel/regionModel/regionModelTemplates.C b/src/regionModels/regionModel/regionModel/regionModelTemplates.C index b78772de01..4e98b2e2fb 100644 --- a/src/regionModels/regionModel/regionModel/regionModelTemplates.C +++ b/src/regionModels/regionModel/regionModel/regionModelTemplates.C @@ -23,6 +23,164 @@ License \*---------------------------------------------------------------------------*/ +template +Foam::tmp > +Foam::regionModels::regionModel::mapRegionPatchField +( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field& nbrField, + const bool flip +) const +{ + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami(p, nbrP, faceAreaIntersect::tmMesh, flip); + + tmp > tresult(ami.interpolateToSource(nbrField)); + + UPstream::msgType() = oldTag; + + return tresult; +} + + +template +Foam::tmp > +Foam::regionModels::regionModel::mapRegionPatchField +( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip +) const +{ + typedef GeometricField fieldType; + + const regionModel& nbrRegion = + this->primaryMesh_.lookupObject(regionModelName); + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + if (nbrRegionMesh.foundObject(fieldName)) + { + const fieldType& nbrField = + nbrRegionMesh.lookupObject(fieldName); + + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ); + + const Field& nbrFieldp = nbrField.boundaryField()[nbrPatchI]; + + tmp > tresult(ami.interpolateToSource(nbrFieldp)); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + return + tmp > + ( + new Field + ( + p.size(), + pTraits::zero + ) + ); + } +} + + +template +Foam::tmp > +Foam::regionModels::regionModel::mapRegionPatchInternalField +( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip +) const +{ + typedef GeometricField fieldType; + + const regionModel& nbrRegion = + this->primaryMesh_.lookupObject(regionModelName); + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + if (nbrRegionMesh.foundObject(fieldName)) + { + const fieldType& nbrField = + nbrRegionMesh.lookupObject(fieldName); + + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ); + + const fvPatchField& nbrFieldp = + nbrField.boundaryField()[nbrPatchI]; + + tmp > tresult + ( + ami.interpolateToSource(nbrFieldp.patchInternalField()) + ); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + return + tmp > + ( + new Field + ( + p.size(), + pTraits::zero + ) + ); + } +} + + template void Foam::regionModels::regionModel::toPrimary ( From f4c7f38f0cf30f8b93032f4e255fa17e9a821f16 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:45:59 +0000 Subject: [PATCH 031/141] ENH: Do not shut-down pyrolysis reactions in the presence of a liquid film --- .../reactingOneDim/reactingOneDim.C | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 5c36e4ad53..21d2c5c0ec 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -684,36 +684,6 @@ void reactingOneDim::preEvolveRegion() { solidChemistry_->setCellReacting(cellI, true); } - - // De-activate reactions if pyrolysis region coupled to (valid) film - if (filmCoupled_) - { - const volScalarField& filmDelta = filmDeltaPtr_(); - - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - const scalarField& filmDeltap = filmDelta.boundaryField()[patchI]; - - forAll(filmDeltap, faceI) - { - const scalar filmDelta0 = filmDeltap[faceI]; - if (filmDelta0 > reactionDeltaMin_) - { - const labelList& cells = boundaryFaceCells_[faceI]; - - // TODO: only limit cell adjacent to film? - //solidChemistry_->setCellNoReacting(cells[0]) - - // Propagate flag through 1-D region - forAll(cells, k) - { - solidChemistry_->setCellReacting(cells[k], false); - } - } - } - } - } } From fc7ae2b06fa792ba3832090b2af095a303be2e21 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 14:49:51 +0000 Subject: [PATCH 032/141] ENH: Updated radiation handling in pyrolysis regions --- .../reactingOneDim/reactingOneDim.C | 115 ------------------ .../reactingOneDim/reactingOneDim.H | 21 +--- .../reactingOneDim/reactingOneDimI.H | 9 +- 3 files changed, 2 insertions(+), 143 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 21d2c5c0ec..3588060c72 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -90,58 +90,6 @@ bool reactingOneDim::read(const dictionary& dict) } -void reactingOneDim::updateQr() -{ - // Retrieve field from coupled region using mapped boundary conditions - QrCoupled_.correctBoundaryConditions(); - - // Update local Qr from coupled Qr field - Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0); - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - scalarField& Qrp = Qr_.boundaryField()[patchI]; - - // Qr is negative going out the solid - // If the surface is emitting the radiative flux is set to zero - Qrp = max(Qrp, scalar(0.0)); - } - - const volScalarField kappaRad_(kappaRad()); - - // Propagate Qr through 1-D regions - label totalFaceId = 0; - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - const scalarField& Qrp = Qr_.boundaryField()[patchI]; - const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI]; - - forAll(Qrp, faceI) - { - const scalar Qr0 = Qrp[faceI]; - point Cf0 = Cf[faceI]; - const labelList& cells = boundaryFaceCells_[totalFaceId]; - scalar kappaInt = 0.0; - forAll(cells, k) - { - const label cellI = cells[k]; - const point& Cf1 = regionMesh().cellCentres()[cellI]; - const scalar delta = mag(Cf1 - Cf0); - kappaInt += kappaRad_[cellI]*delta; - Qr_[cellI] = Qr0*exp(-kappaInt); - Cf0 = Cf1; - } - totalFaceId ++; - } - } - - Qr_.correctBoundaryConditions(); -} - - void reactingOneDim::updatePhiGas() { phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0); @@ -198,8 +146,6 @@ void reactingOneDim::updatePhiGas() void reactingOneDim::updateFields() { - updateQr(); - updatePhiGas(); } @@ -305,8 +251,6 @@ void reactingOneDim::solveEnergy() tmp alpha(solidThermo_.alpha()); - const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf()); - const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_)); fvScalarMatrix hEqn @@ -315,7 +259,6 @@ void reactingOneDim::solveEnergy() - fvm::laplacian(alpha, h_) == chemistrySh_ - + fvc::div(phiQr) + fvc::div(phiGas) ); @@ -380,7 +323,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(coeffs().lookupOrDefault("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -427,34 +369,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), @@ -492,7 +406,6 @@ reactingOneDim::reactingOneDim ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(dict.lookupOrDefault("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -539,34 +452,6 @@ reactingOneDim::reactingOneDim dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H index 76cf66a60f..104e56c34e 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,16 +125,6 @@ protected: volScalarField chemistrySh_; - // Source term fields - - //- Coupled region radiative heat flux [W/m2] - // Requires user to input mapping info for coupled patches - volScalarField QrCoupled_; - - //- In depth radiative heat flux [W/m2] - volScalarField Qr_; - - // Checks //- Cumulative lost mass of the condensed phase [kg] @@ -164,9 +154,6 @@ protected: //- Update/move mesh based on change in mass void updateMesh(const scalarField& mass0); - //- Update radiative flux in pyrolysis region - void updateQr(); - //- Update enthalpy flux for pyrolysis gases void updatePhiGas(); @@ -259,12 +246,6 @@ public: virtual scalar solidRegionDiffNo() const; - // Source fields (read/write access) - - //- In depth radiative heat flux - inline const volScalarField& Qr() const; - - // Evolution //- Pre-evolve region diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H index eec1e7fa0a..375c378080 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,11 +34,4 @@ Foam::regionModels::pyrolysisModels::reactingOneDim::nNonOrthCorr() const } -inline const Foam::volScalarField& -Foam::regionModels::pyrolysisModels::reactingOneDim::Qr() const -{ - return Qr_; -} - - // ************************************************************************* // From 8557ff0492d55f4af6b001bde529baca5f021c35 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 15:00:24 +0000 Subject: [PATCH 033/141] BUG: Corrected film/primary region shear force calculation --- .../surfaceShearForce/surfaceShearForce.C | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C index 2c0a94f9f8..a2c910c412 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C @@ -80,11 +80,11 @@ tmp surfaceShearForce::correct(volVectorField& U) tmp tCs; typedef compressible::turbulenceModel turbModel; - if (film.primaryMesh().foundObject("turbulenceProperties")) + if (film.primaryMesh().foundObject("turbulenceModel")) { // local reference to turbulence model const turbModel& turb = - film.primaryMesh().lookupObject("turbulenceProperties"); + film.primaryMesh().lookupObject("turbulenceModel"); // calculate and store the stress on the primary region const volSymmTensorField primaryReff(turb.devRhoReff()); @@ -117,13 +117,23 @@ tmp surfaceShearForce::correct(volVectorField& U) Reff.correctBoundaryConditions(); dimensionedScalar U0("SMALL", U.dimensions(), SMALL); - tCs = Cf_*mag(-film.nHat() & Reff)/(mag(Up - U) + U0); + volVectorField UHat("UHat", (Up - U)/(mag(Up - U) + U0)); + + // shear stress tangential to the film + volVectorField tauTan + ( + "tauTan", + UHat & (Reff + film.nHat()*(-film.nHat() & Reff)) + ); + + // note: Cf_ 'should' be 1 in this case + tCs = Cf_*mag(tauTan)/(mag(Up - U) + U0); } else { // laminar case - employ simple coeff-based model - const volScalarField& rho = film.rho(); - tCs = Cf_*rho*mag(Up - U); + const volScalarField& rhop = film.rhoPrimary(); + tCs = Cf_*rhop*mag(Up - U); } dimensionedScalar d0("SMALL", delta.dimensions(), SMALL); From fe18dc7e7f31908bb5ba61e60dac2d66858edc39 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 12 Nov 2012 15:09:26 +0000 Subject: [PATCH 034/141] ENH: Updated film<>pyrolysis coupled BCs to make use of film alpha field --- ...ysisTemperatureCoupledFvPatchScalarField.C | 38 +++++------------- ...ysisTemperatureCoupledFvPatchScalarField.H | 13 +------ ...rolysisVelocityCoupledFvPatchVectorField.C | 39 ++++++------------- ...rolysisVelocityCoupledFvPatchVectorField.H | 13 +------ 4 files changed, 23 insertions(+), 80 deletions(-) diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C index b0f8d1629a..1ffe2ae82f 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,8 +40,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")), - deltaWet_(dict.lookupOrDefault("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchScalarField::operator=(scalarField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf, iF), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -151,13 +146,12 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, TFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().lookupObject("pyrolysisProperties"); @@ -168,19 +162,8 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() pyrModel.toPrimary(pyrPatchI, TPyr); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // temperature set by film - Tp[i] = TFilm[i]; - } - else - { - // temperature set by pyrolysis model - Tp[i] = TPyr[i]; - } - } + // Evaluate temperature + Tp = alphaFilm*TFilm + (1.0 - alphaFilm)*TPyr; // Restore tag UPstream::msgType() = oldTag; @@ -197,7 +180,6 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write fvPatchScalarField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); writeEntryIfDifferent(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H index 503b023f95..bc4ace8abd 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a temperature boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the temperature is set using the film temperature \li otherwise, it is set using pyrolysis temperature @@ -84,9 +76,6 @@ class filmPyrolysisTemperatureCoupledFvPatchScalarField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' [m] - scalar deltaWet_; - public: diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C index 29b3e34586..9210d30e57 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,8 +40,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")), - deltaWet_(dict.lookupOrDefault("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf, iF), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -154,13 +149,12 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, UFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().objectRegistry::lookupObject @@ -203,19 +197,9 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const scalarField UAvePyr(-phiPyr/patch().magSf()); const vectorField& nf = patch().nf(); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // velocity set by film - Up[i] = UFilm[i]; - } - else - { - // velocity set by pyrolysis model - Up[i] = UAvePyr[i]*nf[i]; - } - } + + // Evaluate velocity + Up = alphaFilm*UFilm + (1.0 - alphaFilm)*UAvePyr*nf; // Restore tag UPstream::msgType() = oldTag; @@ -232,7 +216,6 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent(os, "phi", "phi", phiName_); writeEntryIfDifferent(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H index c7c4c5d24b..b37157ddf0 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a velocity boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the velocity is set using the film velocity \li otherwise, it is set using pyrolysis out-gassing velocity @@ -84,9 +76,6 @@ class filmPyrolysisVelocityCoupledFvPatchVectorField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' - scalar deltaWet_; - public: From 1bf00a47b8432fd62d04bc771c8905a3fcb2e587 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Nov 2012 15:20:53 +0000 Subject: [PATCH 035/141] ENH: Added new particle collector cloud function object --- .../include/makeParcelCloudFunctionObjects.H | 4 +- .../ParticleCollector/ParticleCollector.C | 668 ++++++++++++++++++ .../ParticleCollector/ParticleCollector.H | 252 +++++++ .../ParticleCollector/ParticleCollectorI.H | 34 + 4 files changed, 957 insertions(+), 1 deletion(-) create mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C create mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H create mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index 9e19beae34..783878f480 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,6 +29,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "FacePostProcessing.H" +#include "ParticleCollector.H" #include "ParticleErosion.H" #include "ParticleTracks.H" #include "ParticleTrap.H" @@ -42,6 +43,7 @@ License makeCloudFunctionObject(CloudType); \ \ makeCloudFunctionObjectType(FacePostProcessing, CloudType); \ + makeCloudFunctionObjectType(ParticleCollector, CloudType); \ makeCloudFunctionObjectType(ParticleErosion, CloudType); \ makeCloudFunctionObjectType(ParticleTracks, CloudType); \ makeCloudFunctionObjectType(ParticleTrap, CloudType); \ diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C new file mode 100644 index 0000000000..de22b5a044 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -0,0 +1,668 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "ParticleCollector.H" +#include "Pstream.H" +#include "surfaceWriter.H" +#include "unitConversion.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::ParticleCollector::makeLogFile +( + const faceList& faces, + const Field& points, + const Field& area +) +{ + // Create the output file if not already created + if (log_) + { + if (debug) + { + Info<< "Creating output file" << endl; + } + + if (Pstream::master()) + { + const fileName logDir = outputDir_/this->owner().time().timeName(); + + // Create directory if does not exist + mkDir(logDir); + + // Open new file at start up + outputFilePtr_.reset + ( + new OFstream(logDir/(type() + ".dat")) + ); + + outputFilePtr_() + << "# Source : " << type() << nl + << "# Total area : " << sum(area) << nl + << "# Time"; + + forAll(faces, i) + { + word id = Foam::name(i); + + outputFilePtr_() + << tab << "area[" << id << "]" + << tab << "mass[" << id << "]" + << tab << "massFlowRate[" << id << "]" + << endl; + } + } + } +} + + +template +void Foam::ParticleCollector::initPolygons() +{ + mode_ = mtPolygon; + + List > polygons(this->coeffDict().lookup("polygons")); + label nPoints = 0; + forAll(polygons, polyI) + { + label np = polygons[polyI].size(); + if (np < 3) + { + FatalIOErrorIn + ( + "Foam::ParticleCollector::initPolygons()", + this->coeffDict() + ) + << "polygons must consist of at least 3 points" + << exit(FatalIOError); + } + + nPoints += np; + } + + label pointOffset = 0; + points_.setSize(nPoints); + faces_.setSize(polygons.size()); + faceTris_.setSize(polygons.size()); + area_.setSize(polygons.size()); + forAll(faces_, faceI) + { + const Field& polyPoints = polygons[faceI]; + face f(identity(polyPoints.size()) + pointOffset); + UIndirectList(points_, f) = polyPoints; + area_[faceI] = f.mag(points_); + + DynamicList tris; + f.triangles(points_, tris); + faceTris_[faceI].transfer(tris); + + faces_[faceI].transfer(f); + + pointOffset += polyPoints.size(); + } +} + + +template +void Foam::ParticleCollector::initConcentricCircles() +{ + mode_ = mtConcentricCircle; + + vector origin(this->coeffDict().lookup("origin")); + + radius_ = this->coeffDict().lookup("radius"); + nSector_ = readLabel(this->coeffDict().lookup("nSector")); + + label nS = nSector_; + + vector refDir; + if (nSector_ > 1) + { + refDir = this->coeffDict().lookup("refDir"); + refDir -= normal_*(normal_ & refDir); + refDir /= mag(refDir); + } + else + { + // set 4 quadrants for single sector cases + nS = 4; + + vector tangent = vector::zero; + scalar magTangent = 0.0; + + Random rnd(1234); + while (magTangent < SMALL) + { + vector v = rnd.vector01(); + + tangent = v - (v & normal_)*normal_; + magTangent = mag(tangent); + } + + refDir = tangent/magTangent; + } + + scalar dTheta = 5.0; + scalar dThetaSector = 360.0/scalar(nS); + label intervalPerSector = max(1, ceil(dThetaSector/dTheta)); + dTheta = dThetaSector/scalar(intervalPerSector); + + label nPointPerSector = intervalPerSector + 1; + + label nPointPerRadius = nS*(nPointPerSector - 1); + label nPoint = radius_.size()*nPointPerRadius; + label nFace = radius_.size()*nS; + + // add origin + nPoint++; + + points_.setSize(nPoint); + faces_.setSize(nFace); + area_.setSize(nFace); + + coordSys_ = cylindricalCS("coordSys", origin, normal_, refDir, false); + + List