From 5414fd3058db34c8c64fb9b5b188a48c1841b259 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 7 May 2013 12:15:18 +0100 Subject: [PATCH 1/3] Update header --- .../threePhaseInterfaceProperties.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C index f7edec6415..f812b472e0 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From b6b6bbef894a79ee3055c0a0ec2928ee74bc615f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 7 May 2013 12:17:43 +0100 Subject: [PATCH 2/3] Bird-Carreau extended to Bird-Carreau-Yasuda by the addition of the "a" coefficient "a" defaults to 2 (Bird-Carreau) --- .../viscosityModels/BirdCarreau/BirdCarreau.C | 17 +++++++++++++++-- .../viscosityModels/BirdCarreau/BirdCarreau.H | 6 +++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C index 730dbe5ec4..0f2213b686 100644 --- a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C +++ b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ Foam::viscosityModels::BirdCarreau::calcNu() const return nuInf_ + (nu0_ - nuInf_) - *pow(scalar(1) + sqr(k_*strainRate()), (n_ - 1.0)/2.0); + *pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_); } @@ -72,6 +72,14 @@ Foam::viscosityModels::BirdCarreau::BirdCarreau nuInf_(BirdCarreauCoeffs_.lookup("nuInf")), k_(BirdCarreauCoeffs_.lookup("k")), n_(BirdCarreauCoeffs_.lookup("n")), + a_ + ( + BirdCarreauCoeffs_.lookupOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ) + ), nu_ ( IOobject @@ -102,6 +110,11 @@ bool Foam::viscosityModels::BirdCarreau::read BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_; BirdCarreauCoeffs_.lookup("k") >> k_; BirdCarreauCoeffs_.lookup("n") >> n_; + a_ = BirdCarreauCoeffs_.lookupOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ); return true; } diff --git a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H index 14589cae12..e235041087 100644 --- a/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H +++ b/src/transportModels/incompressible/viscosityModels/BirdCarreau/BirdCarreau.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,9 @@ Class Description An incompressible Bird-Carreau non-Newtonian viscosity model. + The Bird-Carreau-Yasuda form is also supported if the optional "a" + coefficient is specified. "a" defaults to 2 for the Bird-Carreau model. + SourceFiles BirdCarreau.C @@ -62,6 +65,7 @@ class BirdCarreau dimensionedScalar nuInf_; dimensionedScalar k_; dimensionedScalar n_; + dimensionedScalar a_; volScalarField nu_; From 7dd14d82e0b67c64b620e17d56dc180cca723dd0 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Wed, 8 May 2013 09:27:48 +0100 Subject: [PATCH 3/3] BUG: Completing autoMap and rMap fucntions for private scalarFields. Correcting write function for solidThermo Ptr --- .../thermalBaffle1DFvPatchScalarField.C | 35 ++++++++++++++++--- .../thermalBaffle1DFvPatchScalarField.H | 16 +++++++-- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 05370cbc44..e39162f585 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -51,6 +51,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(true), thickness_(p.size()), Qs_(p.size()), + solidDict_(), solidPtr_(NULL) {} @@ -70,6 +71,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -88,6 +90,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(readBool(dict.lookup("baffleActivated"))), thickness_(scalarField("thickness", dict, p.size())), Qs_(scalarField("Qs", dict, p.size())), + solidDict_(dict), solidPtr_(new solidType(dict)) { if (!isA(this->patch().patch())) @@ -141,6 +144,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -158,12 +162,28 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +const solidType& thermalBaffle1DFvPatchScalarField::solidPtr() const +{ + if (!solidPtr_.empty()) + { + return solidPtr_(); + } + else + { + solidPtr_.reset(new solidType(solidDict_)); + return solidPtr_(); + } +} + + template void thermalBaffle1DFvPatchScalarField::autoMap ( @@ -171,6 +191,8 @@ void thermalBaffle1DFvPatchScalarField::autoMap ) { mixedFvPatchScalarField::autoMap(m); + thickness_.autoMap(m); + Qs_.autoMap(m); } template @@ -181,6 +203,12 @@ void thermalBaffle1DFvPatchScalarField::rmap ) { mixedFvPatchScalarField::rmap(ptf, addr); + + const thermalBaffle1DFvPatchScalarField& tiptf = + refCast(ptf); + + thickness_.rmap(tiptf.thickness_, addr); + Qs_.rmap(tiptf.Qs_, addr); } @@ -264,7 +292,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() forAll(KDeltaw, i) { KDeltaw[i] = - solidPtr_().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i]; + solidPtr().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i]; } const scalarField q @@ -338,8 +366,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() } template -void thermalBaffle1DFvPatchScalarField:: -write(Ostream& os) const +void thermalBaffle1DFvPatchScalarField:: write(Ostream& os) const { mixedFvPatchScalarField::write(os); os.writeKeyword("TName") @@ -348,7 +375,7 @@ write(Ostream& os) const os.writeKeyword("baffleActivated") << baffleActivated_ << token::END_STATEMENT << nl; Qs_.writeEntry("Qs", os); - solidPtr_->write(os); + solidPtr().write(os); } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H index c2b209cb16..399e80062a 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H @@ -70,8 +70,17 @@ class thermalBaffle1DFvPatchScalarField //- Superficial heat source [W/m2] scalarField Qs_; - // Solid thermo - autoPtr solidPtr_; + //- Solid dictionary + dictionary solidDict_; + + //- Solid thermo + mutable autoPtr solidPtr_; + + + // Private members + + //- Return non const solid thermo autoMap + const solidType& solidPtr() const; public: @@ -144,6 +153,7 @@ public: // Member functions + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -160,6 +170,8 @@ public: ); + + //- Update the coefficients associated with the patch field virtual void updateCoeffs();