ENH: replaced local solid thermo write in BC by proper thermo write

This commit is contained in:
andy
2012-09-19 16:20:07 +01:00
parent ffd10658b1
commit fa28a9ee0b
2 changed files with 29 additions and 93 deletions

View File

@ -51,7 +51,7 @@ temperatureThermoBaffle1DFvPatchScalarField
baffleActivated_(true),
thickness_(p.size()),
Qs_(p.size()),
solid_(NULL)
solidPtr_(NULL)
{}
@ -70,7 +70,7 @@ temperatureThermoBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_),
Qs_(ptf.Qs_),
solid_(ptf.solid_)
solidPtr_(ptf.solidPtr_)
{}
@ -88,19 +88,19 @@ temperatureThermoBaffle1DFvPatchScalarField
baffleActivated_(readBool(dict.lookup("baffleActivated"))),
thickness_(scalarField("thickness", dict, p.size())),
Qs_(scalarField("Qs", dict, p.size())),
solid_(new solidThermoData(dict))
solidPtr_(new solidType(dict))
{
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"temperatureThermoBaffle1DFvPatchScalarField::"
"temperatureThermoBaffle1DFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
"temperatureThermoBaffle1DFvPatchScalarField"
"("
"const fvPatch&,\n"
"const DimensionedField<scalar, volMesh>&, "
"const dictionary&"
")"
) << "\n patch type '" << patch().type()
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << patch().name()
@ -141,7 +141,7 @@ temperatureThermoBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_),
Qs_(ptf.Qs_),
solid_(ptf.solid_)
solidPtr_(ptf.solidPtr_)
{}
@ -158,7 +158,7 @@ temperatureThermoBaffle1DFvPatchScalarField
baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_),
Qs_(ptf.Qs_),
solid_(ptf.solid_)
solidPtr_(ptf.solidPtr_)
{}
@ -197,10 +197,8 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
patch().patch()
);
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch().patch());
const label patchI = patch().index();
@ -208,8 +206,7 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
if (baffleActivated_)
{
const fvPatch& nbrPatch =
patch().boundaryMesh()[mpp.samplePolyPatch().index()];
const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchI];
const compressible::turbulenceModel& model =
db().template lookupObject<compressible::turbulenceModel>
@ -248,10 +245,7 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
const temperatureThermoBaffle1DFvPatchScalarField& nbrField =
refCast<const temperatureThermoBaffle1DFvPatchScalarField>
(
nbrPatch.template lookupPatchField<volScalarField, scalar>
(
TName_
)
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
);
scalarField nbrTi(nbrField.patchInternalField());
@ -278,7 +272,8 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
// Create fields for solid properties
forAll(KDeltaw, i)
{
KDeltaw[i] = solid_().kappa((Tp[i] + nbrTw[i])/2.0)/thickness_[i];
KDeltaw[i] =
solidPtr_().kappa((Tp[i] + nbrTw[i])/2.0)/thickness_[i];
}
const scalarField q
@ -362,7 +357,7 @@ write(Ostream& os) const
os.writeKeyword("baffleActivated")
<< baffleActivated_ << token::END_STATEMENT << nl;
Qs_.writeEntry("Qs", os);
solid_().write(os);
solidPtr_->write(os);
}

View File

@ -48,7 +48,7 @@ namespace compressible
{
/*---------------------------------------------------------------------------*\
Class temperatureThermoBaffle1DFvPatchScalarField Declaration
Class temperatureThermoBaffle1DFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
template<class solidType>
@ -58,73 +58,6 @@ class temperatureThermoBaffle1DFvPatchScalarField
{
// Private data
class solidThermoData
{
// Solid thermo
autoPtr<solidType> solidPtr_;
// Solid dictionaries
dictionary specieDict_;
dictionary transportDict_;
dictionary radiationDict_;
dictionary thermoDict_;
dictionary eosDict_;
public:
// Constructor from components
solidThermoData(const dictionary& dict)
:
solidPtr_(new solidType(dict)),
specieDict_(dict.subDict("specie")),
transportDict_(dict.subDict("transport")),
radiationDict_(dict.subDict("radiation")),
thermoDict_(dict.subDict("thermodynamics")),
eosDict_(dict.subDict("equationOfState"))
{}
// Null constructor
solidThermoData()
:
solidPtr_(),
specieDict_(),
transportDict_(),
radiationDict_(),
thermoDict_(),
eosDict_()
{}
// Destructor
virtual ~solidThermoData()
{}
// Member Functions
void write(Ostream& os) const
{
os.writeKeyword("specie");
os << specieDict_ << nl;
os.writeKeyword("transport");
os << transportDict_ << nl;
os.writeKeyword("radiation");
os << radiationDict_ << nl;
os.writeKeyword("thermodynamics");
os << thermoDict_ << nl;
os.writeKeyword("equationOfState");
os << eosDict_ << nl;
}
scalar kappa(const scalar T) const
{
return solidPtr_().kappa(T);
}
};
//- Name of the temperature field
word TName_;
@ -137,8 +70,16 @@ class temperatureThermoBaffle1DFvPatchScalarField
//- Superficial heat source [W/m2]
scalarField Qs_;
//- Solid thermo
autoPtr<solidThermoData> solid_;
// Solid thermo
autoPtr<solidType> solidPtr_;
// Private Member Functions
scalar kappa(const scalar T) const
{
return solidPtr_().kappa(T);
}
public: