diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 05370cbc44..e39162f585 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -51,6 +51,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(true), thickness_(p.size()), Qs_(p.size()), + solidDict_(), solidPtr_(NULL) {} @@ -70,6 +71,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -88,6 +90,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(readBool(dict.lookup("baffleActivated"))), thickness_(scalarField("thickness", dict, p.size())), Qs_(scalarField("Qs", dict, p.size())), + solidDict_(dict), solidPtr_(new solidType(dict)) { if (!isA(this->patch().patch())) @@ -141,6 +144,7 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} @@ -158,12 +162,28 @@ thermalBaffle1DFvPatchScalarField baffleActivated_(ptf.baffleActivated_), thickness_(ptf.thickness_), Qs_(ptf.Qs_), + solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +const solidType& thermalBaffle1DFvPatchScalarField::solidPtr() const +{ + if (!solidPtr_.empty()) + { + return solidPtr_(); + } + else + { + solidPtr_.reset(new solidType(solidDict_)); + return solidPtr_(); + } +} + + template void thermalBaffle1DFvPatchScalarField::autoMap ( @@ -171,6 +191,8 @@ void thermalBaffle1DFvPatchScalarField::autoMap ) { mixedFvPatchScalarField::autoMap(m); + thickness_.autoMap(m); + Qs_.autoMap(m); } template @@ -181,6 +203,12 @@ void thermalBaffle1DFvPatchScalarField::rmap ) { mixedFvPatchScalarField::rmap(ptf, addr); + + const thermalBaffle1DFvPatchScalarField& tiptf = + refCast(ptf); + + thickness_.rmap(tiptf.thickness_, addr); + Qs_.rmap(tiptf.Qs_, addr); } @@ -264,7 +292,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() forAll(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 @@ -338,8 +366,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() } template -void thermalBaffle1DFvPatchScalarField:: -write(Ostream& os) const +void thermalBaffle1DFvPatchScalarField:: write(Ostream& os) const { mixedFvPatchScalarField::write(os); os.writeKeyword("TName") @@ -348,7 +375,7 @@ write(Ostream& os) const os.writeKeyword("baffleActivated") << baffleActivated_ << token::END_STATEMENT << nl; Qs_.writeEntry("Qs", os); - solidPtr_->write(os); + solidPtr().write(os); } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H index c2b209cb16..399e80062a 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H @@ -70,8 +70,17 @@ class thermalBaffle1DFvPatchScalarField //- Superficial heat source [W/m2] scalarField Qs_; - // Solid thermo - autoPtr solidPtr_; + //- Solid dictionary + dictionary solidDict_; + + //- Solid thermo + mutable autoPtr solidPtr_; + + + // Private members + + //- Return non const solid thermo autoMap + const solidType& solidPtr() const; public: @@ -144,6 +153,7 @@ public: // Member functions + // Mapping functions //- Map (and resize as needed) from self given a mapping object @@ -160,6 +170,8 @@ public: ); + + //- Update the coefficients associated with the patch field virtual void updateCoeffs();