Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2013-05-08 09:47:43 +01:00
5 changed files with 66 additions and 10 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,7 +52,7 @@ Foam::viscosityModels::BirdCarreau::calcNu() const
return return
nuInf_ nuInf_
+ (nu0_ - 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")), nuInf_(BirdCarreauCoeffs_.lookup("nuInf")),
k_(BirdCarreauCoeffs_.lookup("k")), k_(BirdCarreauCoeffs_.lookup("k")),
n_(BirdCarreauCoeffs_.lookup("n")), n_(BirdCarreauCoeffs_.lookup("n")),
a_
(
BirdCarreauCoeffs_.lookupOrDefault
(
"a",
dimensionedScalar("a", dimless, 2)
)
),
nu_ nu_
( (
IOobject IOobject
@ -102,6 +110,11 @@ bool Foam::viscosityModels::BirdCarreau::read
BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_; BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_;
BirdCarreauCoeffs_.lookup("k") >> k_; BirdCarreauCoeffs_.lookup("k") >> k_;
BirdCarreauCoeffs_.lookup("n") >> n_; BirdCarreauCoeffs_.lookup("n") >> n_;
a_ = BirdCarreauCoeffs_.lookupOrDefault
(
"a",
dimensionedScalar("a", dimless, 2)
);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,6 +27,9 @@ Class
Description Description
An incompressible Bird-Carreau non-Newtonian viscosity model. 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 SourceFiles
BirdCarreau.C BirdCarreau.C
@ -62,6 +65,7 @@ class BirdCarreau
dimensionedScalar nuInf_; dimensionedScalar nuInf_;
dimensionedScalar k_; dimensionedScalar k_;
dimensionedScalar n_; dimensionedScalar n_;
dimensionedScalar a_;
volScalarField nu_; volScalarField nu_;

View File

@ -51,6 +51,7 @@ thermalBaffle1DFvPatchScalarField
baffleActivated_(true), baffleActivated_(true),
thickness_(p.size()), thickness_(p.size()),
Qs_(p.size()), Qs_(p.size()),
solidDict_(),
solidPtr_(NULL) solidPtr_(NULL)
{} {}
@ -70,6 +71,7 @@ thermalBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_), baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_), thickness_(ptf.thickness_),
Qs_(ptf.Qs_), Qs_(ptf.Qs_),
solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_) solidPtr_(ptf.solidPtr_)
{} {}
@ -88,6 +90,7 @@ thermalBaffle1DFvPatchScalarField
baffleActivated_(readBool(dict.lookup("baffleActivated"))), baffleActivated_(readBool(dict.lookup("baffleActivated"))),
thickness_(scalarField("thickness", dict, p.size())), thickness_(scalarField("thickness", dict, p.size())),
Qs_(scalarField("Qs", dict, p.size())), Qs_(scalarField("Qs", dict, p.size())),
solidDict_(dict),
solidPtr_(new solidType(dict)) solidPtr_(new solidType(dict))
{ {
if (!isA<mappedPatchBase>(this->patch().patch())) if (!isA<mappedPatchBase>(this->patch().patch()))
@ -141,6 +144,7 @@ thermalBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_), baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_), thickness_(ptf.thickness_),
Qs_(ptf.Qs_), Qs_(ptf.Qs_),
solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_) solidPtr_(ptf.solidPtr_)
{} {}
@ -158,12 +162,28 @@ thermalBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_), baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_), thickness_(ptf.thickness_),
Qs_(ptf.Qs_), Qs_(ptf.Qs_),
solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_) solidPtr_(ptf.solidPtr_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class solidType>
const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solidPtr() const
{
if (!solidPtr_.empty())
{
return solidPtr_();
}
else
{
solidPtr_.reset(new solidType(solidDict_));
return solidPtr_();
}
}
template<class solidType> template<class solidType>
void thermalBaffle1DFvPatchScalarField<solidType>::autoMap void thermalBaffle1DFvPatchScalarField<solidType>::autoMap
( (
@ -171,6 +191,8 @@ void thermalBaffle1DFvPatchScalarField<solidType>::autoMap
) )
{ {
mixedFvPatchScalarField::autoMap(m); mixedFvPatchScalarField::autoMap(m);
thickness_.autoMap(m);
Qs_.autoMap(m);
} }
template<class solidType> template<class solidType>
@ -181,6 +203,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::rmap
) )
{ {
mixedFvPatchScalarField::rmap(ptf, addr); mixedFvPatchScalarField::rmap(ptf, addr);
const thermalBaffle1DFvPatchScalarField& tiptf =
refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
thickness_.rmap(tiptf.thickness_, addr);
Qs_.rmap(tiptf.Qs_, addr);
} }
@ -264,7 +292,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
forAll(KDeltaw, i) forAll(KDeltaw, i)
{ {
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 const scalarField q
@ -338,8 +366,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
} }
template<class solidType> template<class solidType>
void thermalBaffle1DFvPatchScalarField<solidType>:: void thermalBaffle1DFvPatchScalarField<solidType>:: write(Ostream& os) const
write(Ostream& os) const
{ {
mixedFvPatchScalarField::write(os); mixedFvPatchScalarField::write(os);
os.writeKeyword("TName") os.writeKeyword("TName")
@ -348,7 +375,7 @@ write(Ostream& os) const
os.writeKeyword("baffleActivated") os.writeKeyword("baffleActivated")
<< baffleActivated_ << token::END_STATEMENT << nl; << baffleActivated_ << token::END_STATEMENT << nl;
Qs_.writeEntry("Qs", os); Qs_.writeEntry("Qs", os);
solidPtr_->write(os); solidPtr().write(os);
} }

View File

@ -70,8 +70,17 @@ class thermalBaffle1DFvPatchScalarField
//- Superficial heat source [W/m2] //- Superficial heat source [W/m2]
scalarField Qs_; scalarField Qs_;
// Solid thermo //- Solid dictionary
autoPtr<solidType> solidPtr_; dictionary solidDict_;
//- Solid thermo
mutable autoPtr<solidType> solidPtr_;
// Private members
//- Return non const solid thermo autoMap
const solidType& solidPtr() const;
public: public:
@ -144,6 +153,7 @@ public:
// Member functions // Member functions
// Mapping functions // Mapping functions
//- Map (and resize as needed) from self given a mapping object //- Map (and resize as needed) from self given a mapping object
@ -160,6 +170,8 @@ public:
); );
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();