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

This commit is contained in:
andy
2013-05-08 11:56:31 +01:00
4 changed files with 69 additions and 22 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
@ -54,7 +54,7 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p)
{ {
if (patchNames_[patchI] == pName) if (patchNames_[patchI] == pName)
{ {
if (patchTypes_[patchI] == pType) if (word(patchDicts_[patchI]["type"]) == pType)
{ {
// Found name and types match // Found name and types match
return patchI; return patchI;
@ -68,7 +68,11 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p)
} }
// Patch not found. Append to the list // Patch not found. Append to the list
patchTypes_.append(pType); {
OStringStream os;
p.write(os);
patchDicts_.append(dictionary(IStringStream(os.str())()));
}
if (nameFound) if (nameFound)
{ {
@ -121,20 +125,22 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
: :
polyMesh(io), polyMesh(io),
meshMod_(*this), meshMod_(*this),
patchTypes_(2*boundaryMesh().size()),
patchNames_(2*boundaryMesh().size()), patchNames_(2*boundaryMesh().size()),
patchDicts_(2*boundaryMesh().size()),
pointZoneNames_(), pointZoneNames_(),
faceZoneNames_(), faceZoneNames_(),
cellZoneNames_() cellZoneNames_()
{ {
// Insert the original patches into the list // Insert the original patches into the list
wordList curPatchTypes = boundaryMesh().types();
wordList curPatchNames = boundaryMesh().names(); wordList curPatchNames = boundaryMesh().names();
forAll(curPatchTypes, patchI) forAll(boundaryMesh(), patchI)
{ {
patchTypes_.append(curPatchTypes[patchI]); patchNames_.append(boundaryMesh()[patchI].name());
patchNames_.append(curPatchNames[patchI]);
OStringStream os;
boundaryMesh()[patchI].write(os);
patchDicts_.append(dictionary(IStringStream(os.str())()));
} }
// Insert point, face and cell zones into the list // Insert point, face and cell zones into the list
@ -379,7 +385,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
void Foam::mergePolyMesh::merge() void Foam::mergePolyMesh::merge()
{ {
Info<< "patch names: " << patchNames_ << nl Info<< "patch names: " << patchNames_ << nl
<< "patch types: " << patchTypes_ << nl << "patch dicts: " << patchDicts_ << nl
<< "point zone names: " << pointZoneNames_ << nl << "point zone names: " << pointZoneNames_ << nl
<< "face zone names: " << faceZoneNames_ << nl << "face zone names: " << faceZoneNames_ << nl
<< "cell zone names: " << cellZoneNames_ << endl; << "cell zone names: " << cellZoneNames_ << endl;
@ -409,14 +415,16 @@ void Foam::mergePolyMesh::merge()
for (; patchI < patchNames_.size(); patchI++) for (; patchI < patchNames_.size(); patchI++)
{ {
// Add a patch // Add a patch
dictionary dict(patchDicts_[patchI]);
dict.set("nFaces", 0);
dict.set("startFace", endOfLastPatch);
newPatches[patchI] = newPatches[patchI] =
( (
polyPatch::New polyPatch::New
( (
patchTypes_[patchI],
patchNames_[patchI], patchNames_[patchI],
0, dict,
endOfLastPatch,
patchI, patchI,
oldPatches oldPatches
).ptr() ).ptr()

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
@ -58,12 +58,12 @@ class mergePolyMesh
//- Topological change to accumulated all mesh changes //- Topological change to accumulated all mesh changes
polyTopoChange meshMod_; polyTopoChange meshMod_;
//- Patch types
DynamicList<word> patchTypes_;
//- Patch names //- Patch names
DynamicList<word> patchNames_; DynamicList<word> patchNames_;
//- Patch dictionaries
DynamicList<dictionary> patchDicts_;
//- Point zone names //- Point zone names
DynamicList<word> pointZoneNames_; DynamicList<word> pointZoneNames_;

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();