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();
p_rgh.relax();
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);

View File

@ -74,11 +74,11 @@ thermalBaffle1DFvPatchScalarField
mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_),
baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_),
Qs_(ptf.Qs_),
thickness_(ptf.thickness_, mapper),
Qs_(ptf.Qs_, mapper),
solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_),
QrPrevious_(ptf.QrPrevious_),
QrPrevious_(ptf.QrPrevious_, mapper),
QrRelaxation_(ptf.QrRelaxation_),
QrName_(ptf.QrName_)
{}
@ -98,7 +98,7 @@ thermalBaffle1DFvPatchScalarField
TName_("T"),
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
thickness_(),
Qs_(),
Qs_(p.size(), 0),
solidDict_(dict),
solidPtr_(),
QrPrevious_(p.size(), 0.0),
@ -107,6 +107,21 @@ thermalBaffle1DFvPatchScalarField
{
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_)
{
// Full restart
@ -209,23 +224,30 @@ const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const
template<class solidType>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::
tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::
baffleThickness() const
{
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_;
}
else
{
thickness_ = scalarField("thickness", solidDict_, patch().size());
return thickness_;
}
}
else
{
const mapDistribute& mapDist = this->mappedPatchBase::map();
const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()];
const thermalBaffle1DFvPatchScalarField& nbrField =
@ -234,28 +256,28 @@ baffleThickness() const
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>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
{
if (this->owner())
{
if (Qs_.size() > 0)
{
return Qs_;
}
else
{
Qs_ = scalarField("Qs", solidDict_, patch().size());
return Qs_;
}
}
else
{
const mapDistribute& mapDist = this->mappedPatchBase::map();
const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()];
@ -265,7 +287,10 @@ const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
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 =
refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
if (this->owner())
{
thickness_.rmap(tiptf.thickness_, addr);
Qs_.rmap(tiptf.Qs_, addr);
}
}
template<class solidType>
@ -399,11 +427,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::write(Ostream& os) const
if (this->owner())
{
baffleThickness().writeEntry("thickness", os);
Qs().writeEntry("Qs", os);
baffleThickness()().writeEntry("thickness", os);
Qs()().writeEntry("Qs", os);
solid().write(os);
}
QrPrevious_.writeEntry("QrPrevious", os);
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrRelaxation")<< QrRelaxation_
<< token::END_STATEMENT << nl;

View File

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