ENH: Allow proper restart (without knowing the boundary condition)

The boundary conditions were still accessing e.g. the temperature even
when restarting. Now they
will reread all their data if there is a 'value' field present.
This commit is contained in:
mattijs 2010-01-27 10:36:06 +00:00
parent 4fe467c3cb
commit c7b8b1f43c
3 changed files with 30 additions and 23 deletions

View File

@ -76,21 +76,24 @@ Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity")))
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
refGrad() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
refGrad() = 0.0;
fvPatchScalarField::operator=(refValue());
}
}
@ -169,10 +172,9 @@ void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs()
void Foam::MarshakRadiationFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
mixedFvPatchScalarField::write(os);
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -79,18 +79,22 @@ MarshakRadiationFixedTMixedFvPatchScalarField
Trad_("Trad", dict, p.size()),
emissivity_(readScalar(dict.lookup("emissivity")))
{
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_);
refGrad() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_);
refGrad() = 0.0;
valueFraction() = 1.0;
fvPatchScalarField::operator=(refValue());
}
}
@ -128,7 +132,7 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::autoMap
const fvPatchFieldMapper& m
)
{
scalarField::autoMap(m);
mixedFvPatchScalarField::autoMap(m);
Trad_.autoMap(m);
}
@ -173,10 +177,9 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs()
void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
mixedFvPatchScalarField::write(os);
Trad_.writeEntry("Trad", os);
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -82,22 +82,25 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity")))
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() =
emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi;
refGrad() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() =
emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi;
refGrad() = 0.0;
fvPatchScalarField::operator=(refValue());
}
}
@ -218,10 +221,9 @@ void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::write
Ostream& os
) const
{
fvPatchScalarField::write(os);
mixedFvPatchScalarField::write(os);
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}