|
[Sponsors] |
Adding different properties to Thermophysical Model |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 27, 2014, 15:16 |
Adding different properties to Thermophysical Model
|
#1 |
New Member
Andrea Prestigiacomo
Join Date: Jun 2013
Location: Milan
Posts: 10
Rep Power: 13 |
Hi,
I'm trying to change the thermal conductivity and heat capacity in a solid region, depending on position. I've already create the file Kappa and Cp in the 0/solid directory with the command: Code:
setFields -region solid The first idea was to simply import these quantities, with this code, in the createSolidFields.H file Code:
KappaSolid.set ( i, new volScalarField ( IOobject ( "Kappa", runTime.timeName(), solidRegions[i], IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), solidRegions[i] ) ); The problem is that the coupling fvPatch read the solid thermal conductivity from thermo.kappa(). So now my goal is to replace the thermo.kappa() with the readed values, directly in the file createSolidFields.H. I've tried booth these codes, without results: Code:
KappaSolid.set ( i, new volScalarField ( IOobject ( "Kappa", runTime.timeName(), solidRegions[i], IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), solidRegions[i] ) ); thermos[i].kappa() = KappaSolid[i]; Code:
thermos[i].kappa() = IOdictionary ( IOobject ( "Kappa", runTime.timeName(), solidRegions[i], IOobject::MUST_READ, IOobject::AUTO_WRITE ) ); Thanks for the help |
|
April 28, 2014, 05:08 |
|
#3 |
New Member
Andrea Prestigiacomo
Join Date: Jun 2013
Location: Milan
Posts: 10
Rep Power: 13 |
Thanks for reply!
I'm using OF-2.2.1 and the solver is a modified version of chtMultiregionFoam (see attachment). |
|
April 28, 2014, 05:42 |
|
#4 |
Senior Member
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21 |
I have zero experience with multiregion coupling, but I'll give you a few hints code-wise.
For a start, this line: Code:
PtrList<solidThermo> thermos(solidRegions.size()); Code:
// thermos[i].kappa() = KappaSolid[i]; Code:
virtual tmp<volScalarField> kappa() const = 0; What is it you are trying to do actually? Providing more background on the actual idea would make it easier for someone to help you...
__________________
When asking a question, prepare a SSCCE. |
|
April 28, 2014, 06:13 |
|
#5 |
New Member
Andrea Prestigiacomo
Join Date: Jun 2013
Location: Milan
Posts: 10
Rep Power: 13 |
Well, the idea was to replace the volScalarField in kappa with the volScalarField readed from the IOobject.
But, if I've well understood, kappa is not a volScalarField. The volScalarField is generated every time the member function kappa() is called. Is it right? Thanks for the help. |
|
April 28, 2014, 06:25 |
|
#6 | |
Senior Member
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21 |
The 'kappa()' member function generates a temporary volume scalar field.
If you are searching for a way to set such a field for an object of the 'solidThermo' class, you can easily find out if the class stores such a field: Code:
class solidThermo : public basicThermo { protected: // Protected data //- Density field [kg/m^3] // Named 'rhoThermo' to avoid (potential) conflict with solver density volScalarField rho_; Code:
class basicThermo : public IOdictionary { protected: // Protected data //- Phase-name const word& phaseName_; // Fields //- Pressure [Pa] volScalarField& p_; //- Temperature [K] volScalarField T_; //- Laminar thermal diffusuvity [kg/m/s] volScalarField alpha_; // This might be your candidate right here. One thing though - looking at 'createSolidFields.H', I have noticed that the solidThermo objects are set by constructing new objects using run-time selection: Code:
Info<< " Adding to thermos\n" << endl; thermos.set(i, solidThermo::New(solidRegions[i])); Code:
template<class Thermo> Foam::autoPtr<Thermo> Foam::basicThermo::New ( const fvMesh& mesh, const word& phaseName ) { IOdictionary thermoDict ( IOobject ( phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) ); typename Thermo::fvMeshConstructorTable::iterator cstrIter = lookupThermo<Thermo, typename Thermo::fvMeshConstructorTable> ( thermoDict, Thermo::fvMeshConstructorTablePtr_ ); return autoPtr<Thermo>(cstrIter()(mesh, phaseName)); } So the next question is: why are you trying to do the object modification afterwards, using the volume fields, when this is not done in the original solver? Your answer: Quote:
__________________
When asking a question, prepare a SSCCE. |
||
April 28, 2014, 07:10 |
|
#7 |
New Member
Andrea Prestigiacomo
Join Date: Jun 2013
Location: Milan
Posts: 10
Rep Power: 13 |
Ok, i will try to explain better: the problem is in the coupling between solid and fluids regions. In particular the coupling boundary condition (compressible::turbulentTemperatureCoupledBaffleMix ed) takes into account the conservation of heat flux between patches as follow:
kappa_fluid*d(T_fluid)/dn = kappa_solid*d(T_solid)/dn where n is the vector normal to the contact surface. The problem is that kappa_solid is taken form the thermophysicalProperties file in constant/solid (in which the thermal conductivity is a constant for the whole solid), while I need to use the value taken from the IOobject (because my solid has different thermal conductivity, depending on position). At this point, probably, it's more convenient to modify the fvPatchScalarField library... |
|
April 29, 2014, 07:02 |
|
#8 | |
Senior Member
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21 |
Quote:
I'll describe how I would approach this problem. Beware, I'm using pseudocode to describe the idea, the code below is not something you should copy and paste + compile. I would suggest you to think about first implementing a heat conduction model that computes thermal conducitivity depending on position. When you do that properly, the model will be run-time selectable. Make sure that the selection of the conductivity model is dictionary based. Extend the turbulentTemperatureCoupledBaffleMixed boundary condition into a BC that makes use of a modeled thermal conductivity and not a constant. Make the BC contain the model and select it during run-time. Make the 'updateCoeffs' delegate the conductivity calculation to the model : constant or variable, depending on the sub-dict entry. The dictionary entry of your new ('turbulentTemperatureCoupledeBaffleMixedModel') boundary condition should contain a sub-dictionary Code:
turbulentTemperatureHowEverYouNameYourBc { conductivityModels { solid spatiallyVariable someFunctionName; fluid constant 0.007; } // Whatever other parameters go with the original BC. } Your new model will be contained within your new BC class (depending on the OF smart pointer you decide on for the run-time selection): Code:
class turbulentTemperatureBlah { private: autoPtr<spatiallyVariableThermalConductivityModel> modelPtr_; public: turbulentTemperatureBlah(IOobject const & io) : modelPtr_ = transportModel::New(io.subdict(" .... }; Code:
kappa_fluid*d(T_fluid)/dn = kappa_solid*d(T_solid)/dn Code:
modelPtr->kappa_fluid()*d(T_fluid)/dn = modelPtr->kappa_solid()*d(T_solid)/dn Note: No solver application is touched, and you have a small library that you can share with anyone that is using OF. You'll have to understand RTS in OF to do this, there is a great page about that in the OF Wiki.
__________________
When asking a question, prepare a SSCCE. |
||
May 1, 2014, 11:33 |
|
#9 |
New Member
Andrea Prestigiacomo
Join Date: Jun 2013
Location: Milan
Posts: 10
Rep Power: 13 |
Thanks for the help and sorry for the late I answer you.
This way seems to be easier than modifying the thermophysical model, and your explanation was very clear. I will try to make it on next week. I will write again in case of problems Thanks again |
|
Tags |
coupled patches, heat conduction, space dependent terms, thermal conductivity, thermophysical model |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding a new viscosity model | ICL | OpenFOAM Running, Solving & CFD | 20 | April 10, 2017 23:44 |
chtMultiRegionSimpleFoam: strange error | samiam1000 | OpenFOAM Running, Solving & CFD | 26 | December 29, 2015 23:14 |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 06:36 |
error message | cuteapathy | CFX | 14 | March 20, 2012 07:45 |
Eulerian Model - properties | ssamton | FLUENT | 1 | March 16, 2012 02:34 |