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

This commit is contained in:
mattijs
2013-11-18 14:51:19 +00:00
3 changed files with 61 additions and 30 deletions

View File

@ -49,6 +49,8 @@
{ {
phi = phiHbyA - p_rghEqn.flux(); phi = phiHbyA - p_rghEqn.flux();
p_rgh.relax();
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);

View File

@ -74,11 +74,11 @@ thermalBaffle1DFvPatchScalarField
mixedFvPatchScalarField(ptf, p, iF, mapper), mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_), TName_(ptf.TName_),
baffleActivated_(ptf.baffleActivated_), baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_), thickness_(ptf.thickness_, mapper),
Qs_(ptf.Qs_), Qs_(ptf.Qs_, mapper),
solidDict_(ptf.solidDict_), solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_), solidPtr_(ptf.solidPtr_),
QrPrevious_(ptf.QrPrevious_), QrPrevious_(ptf.QrPrevious_, mapper),
QrRelaxation_(ptf.QrRelaxation_), QrRelaxation_(ptf.QrRelaxation_),
QrName_(ptf.QrName_) QrName_(ptf.QrName_)
{} {}
@ -98,7 +98,7 @@ thermalBaffle1DFvPatchScalarField
TName_("T"), TName_("T"),
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)), baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
thickness_(), thickness_(),
Qs_(), Qs_(p.size(), 0),
solidDict_(dict), solidDict_(dict),
solidPtr_(), solidPtr_(),
QrPrevious_(p.size(), 0.0), QrPrevious_(p.size(), 0.0),
@ -107,6 +107,21 @@ thermalBaffle1DFvPatchScalarField
{ {
fvPatchScalarField::operator=(scalarField("value", dict, p.size())); fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("thickness"))
{
thickness_ = scalarField("thickness", dict, p.size());
}
if (dict.found("Qs"))
{
Qs_ = scalarField("Qs", dict, p.size());
}
if (dict.found("QrPrevious"))
{
QrPrevious_ = scalarField("QrPrevious", dict, p.size());
}
if (dict.found("refValue") && baffleActivated_) if (dict.found("refValue") && baffleActivated_)
{ {
// Full restart // Full restart
@ -209,23 +224,30 @@ const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const
template<class solidType> template<class solidType>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>:: tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::
baffleThickness() const baffleThickness() const
{ {
if (this->owner()) if (this->owner())
{ {
if (thickness_.size() > 0) if (thickness_.size() != patch().size())
{ {
FatalErrorIn
(
" template<class solidType>"
" tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>
" baffleThickness() const"
)<< " Field thickness has not been specified "
<< " for patch " << this->patch().name()
<< " in dictionary " << solidDict_
<< abort(FatalError);
}
return thickness_; return thickness_;
} }
else else
{ {
thickness_ = scalarField("thickness", solidDict_, patch().size()); const mapDistribute& mapDist = this->mappedPatchBase::map();
return thickness_;
}
}
else
{
const fvPatch& nbrPatch = const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()]; patch().boundaryMesh()[samplePolyPatch().index()];
const thermalBaffle1DFvPatchScalarField& nbrField = const thermalBaffle1DFvPatchScalarField& nbrField =
@ -234,28 +256,28 @@ baffleThickness() const
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_) nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
); );
return nbrField.thickness_; tmp<scalarField> tthickness
(
new scalarField(nbrField.baffleThickness())
);
scalarField& thickness = tthickness();
mapDist.distribute(thickness);
return tthickness;
} }
} }
template<class solidType> template<class solidType>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
{ {
if (this->owner()) if (this->owner())
{
if (Qs_.size() > 0)
{ {
return Qs_; return Qs_;
} }
else else
{ {
Qs_ = scalarField("Qs", solidDict_, patch().size()); const mapDistribute& mapDist = this->mappedPatchBase::map();
return Qs_;
}
}
else
{
const fvPatch& nbrPatch = const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()]; patch().boundaryMesh()[samplePolyPatch().index()];
@ -265,7 +287,10 @@ const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_) nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
); );
return nbrField.Qs_; tmp<scalarField> tQs(new scalarField(nbrField.Qs()));
scalarField& Qs = tQs();
mapDist.distribute(Qs);
return tQs;
} }
} }
@ -293,9 +318,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::rmap
const thermalBaffle1DFvPatchScalarField& tiptf = const thermalBaffle1DFvPatchScalarField& tiptf =
refCast<const thermalBaffle1DFvPatchScalarField>(ptf); refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
if (this->owner())
{
thickness_.rmap(tiptf.thickness_, addr); thickness_.rmap(tiptf.thickness_, addr);
Qs_.rmap(tiptf.Qs_, addr); Qs_.rmap(tiptf.Qs_, addr);
} }
}
template<class solidType> template<class solidType>
@ -399,11 +427,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::write(Ostream& os) const
if (this->owner()) if (this->owner())
{ {
baffleThickness().writeEntry("thickness", os); baffleThickness()().writeEntry("thickness", os);
Qs().writeEntry("Qs", os); Qs()().writeEntry("Qs", os);
solid().write(os); solid().write(os);
} }
QrPrevious_.writeEntry("QrPrevious", os);
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrRelaxation")<< QrRelaxation_ os.writeKeyword("QrRelaxation")<< QrRelaxation_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;

View File

@ -152,10 +152,10 @@ class thermalBaffle1DFvPatchScalarField
const solidType& solid() const; const solidType& solid() const;
//- Return Qs from master //- Return Qs from master
const scalarField& Qs() const; tmp<scalarField> Qs() const;
//- Return thickness from master //- Return thickness from master
const scalarField& baffleThickness() const; tmp<scalarField> baffleThickness() const;
//- Is Owner //- Is Owner
bool owner() const; bool owner() const;