|
[Sponsors] |
Solid Thermal Conductivity as a function of temperature |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 14, 2019, 05:05 |
Solid Thermal Conductivity as a function of temperature
|
#1 | ||
Senior Member
|
Hello Foamers,
Currently, I'm building a 1D mathematical model for simulating the coal pyrolysis. I would like to define the expression for solid thermal conductivity (K) as a function of temperature in the following location (below), ~/OpenFOAM/OpenFOAM-2.1.1/src/thermophysicalModels/solid/transport The expression is defined as follows: Quote:
During step 1 execution, there is no compilation errors. But as expected, after compiling step 2, I got the following errors: Quote:
Kindly give some insight view about this topic, which will be highly helpful for my research. Thank you Last edited by Kummi; May 16, 2019 at 03:37. |
|||
May 14, 2019, 23:00 |
|
#2 |
Senior Member
|
Can someone share their ideas please ?
|
|
May 15, 2019, 09:25 |
Solid thermal conductivity as a function of temperature
|
#3 |
New Member
Dinesh
Join Date: Jun 2018
Posts: 15
Rep Power: 8 |
Hello,
Your question s more related to C++ I guess. However, it can solved appropriately. I am new to use OpenFOAm, so I have some basic questions ~ don't mind it please 1) Will foamers answer questions related to programming here as caption implies "Programming & Development" - because I have only basic knowledge in C++ 2) Is there any other user friendly forum, where I can discuss my queries related to C++ (sometimes even simple questions) Sorry to ask too many questions, because I am keep exploring to solve my problems in all possible ways. Thank you |
|
May 16, 2019, 01:55 |
|
#4 |
New Member
prabhakaran
Join Date: Aug 2018
Location: southkorea
Posts: 9
Rep Power: 8 |
Dear Kummi,
Your question seems to be quite thoughtful. As mentioned in the location (thermophysicalModels -> solid -> transport), seems only input variables can be called and fitted in the main equation appropriately. Looks there is no clue to declare iterating variables in this thermophysical model section. But sure, there might be some other way to goooooo.... Hope, it will be a good topic of discussion if someone help you out here and will help for future foamers too. |
|
May 16, 2019, 03:13 |
|
#5 |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
||
May 16, 2019, 03:41 |
|
#6 | |
Senior Member
|
Quote:
Hi Mr. Daniel, First of all, thanks for the reply. I am hereby attaching the files of the code structure located in ~/OpenFOAM/OpenFOAM-2.1.1/src/thermophysicalModels/solid/transport. Kindly check it. Thank you |
||
May 16, 2019, 03:59 |
|
#7 | |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
Quote:
Code:
template<class thermo> inline Foam::scalar Foam::conductivitySolidTransport<thermo>::K ( const scalar T ) const { if (T < 773) //STEP 1 { return ((1-pT_)*(0.0139*pow(T,0.5)) + (pT_*0.000496*T) + (pi_*0.0000000000342)*pow(T,3) + (px_*0.00000000228)*pow(T,3)); } else if (T > 773) //STEP 2 { scalar pii = (pR_*(1-pT_))/(1-pR_); scalar pxx = 1-((1-pT_)/(1-pR_)); scalar pRR = (pii/(1-pxx)); scalar pTT= pii + pxx; return ((1-pTT)*(0.0139*pow(T,0.5)) + (pTT*0.000496*T) + (pii*0.0000000000342)*pow(T,3) + (pxx*0.00000000228)*pow(T,3)); } } Code:
pii = (pR_*(1-pT_))/(1-pR_); Code:
scalar pii = (pR_*(1-pT_))/(1-pR_); Code:
pRR=pR_; //pRR should be Iterated back as variable pR_ pTT=pT_; //pTT should be Iterated back as variable pT_ |
||
May 16, 2019, 04:43 |
|
#8 | ||||
Senior Member
|
Quote:
Thank you for sharing your knowledge. Its highly helpful. Quote:
Quote:
For T<773K ==> The flow is solved with respect to input variables!! For T>773K ==> The flow is iterated continuously (within else if loop) where the calculated variables pRR and pTT should replace the value of the variables pR and pT for next iteration (followed by simultaneous calculation). Thats why, I have mentioned as, Quote:
Could you please assist me with it? Last edited by Kummi; May 16, 2019 at 06:08. |
|||||
May 16, 2019, 06:44 |
|
#9 |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
This is what you should do if you want to update values of pR_ and pT_ for the next time step or iteration:
Code:
template<class thermo> inline Foam::scalar Foam::conductivitySolidTransport<thermo>::K ( const scalar T ) const { if (T < 773) //STEP 1 { return ((1-pT_)*(0.0139*pow(T,0.5)) + (pT_*0.000496*T) + (pi_*0.0000000000342)*pow(T,3) + (px_*0.00000000228)*pow(T,3)); } else if (T > 773) //STEP 2 { scalar pii = (pR_*(1-pT_))/(1-pR_); scalar pxx = 1-((1-pT_)/(1-pR_)); scalar pRR = (pii/(1-pxx)); scalar pTT= pii + pxx; pR_ = pRR; //pRR should be Iterated back as variable pR_ pT_ = pTT; //pTT should be Iterated back as variable pT_ return ((1-pTT)*(0.0139*pow(T,0.5)) + (pTT*0.000496*T) + (pii*0.0000000000342)*pow(T,3) + (pxx*0.00000000228)*pow(T,3)); } } |
|
May 16, 2019, 06:55 |
|
#10 | ||
Senior Member
|
Thank you for your comments.
Quote:
Quote:
As pR_ and pT_ are read only object marked with underscore (_) |
|||
May 16, 2019, 08:09 |
|
#11 | |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
Quote:
I just noticed that the K function is using const attribute, so you can't modify any private data member inside that function. I will check it when I'm back home so I can actually try to compile it. |
||
May 16, 2019, 09:02 |
|
#12 |
Senior Member
|
Dear Mr. Daniel,
Thank you so much for your concern. I'll also look into it for further modification. Thank you ^^ |
|
May 17, 2019, 02:00 |
|
#13 | |||||
Senior Member
|
Dear Mr. Daniel,
Why should the const attribute need to be removed!! For example ~ in my case I defined Cp as a function of T and it works well however T is declared as const attribute. Quote:
Am I understanding it right? Correct me if I am wrong because I am not proficient in C++. Concerning, non-const attributes, I came across few posts related to it: ==> Access private data member For read-only access to a private member accessed via a public function, - public const member need to be added to the header as, Quote:
Another post addressed about the non-const references [[objectRegistry: Added lookupObjectRef]] Problem with lookupObject functionality Quote:
Quote:
Quote:
|
||||||
May 17, 2019, 04:16 |
|
#14 | |||
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
Quote:
Code:
template<class thermo> inline Foam::scalar Foam::conductivitySolidTransport<thermo>::K ( const scalar T ) const This probably doesn't work either but you can try as I didn't check the base class of your derived calss: Code:
template<class thermo> inline Foam::scalar Foam::conductivitySolidTransport<thermo>::K ( const scalar T )
Code:
Cp = function(T); Quote:
Code:
foo& bar() { return bar_; } Quote:
|
||||
May 17, 2019, 05:04 |
|
#15 |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
Can you try the attached file and let me know whether it works or not?
I don't have OpenFOAM-2.1.1 installed.... |
|
May 17, 2019, 06:45 |
|
#16 | ||||
Senior Member
|
Dear Daniel,
Thank you for your reply. Quote:
Quote:
I tried the following section below removing red const (for K) ==> leads to error Quote:
The reason your example about Cp works is that:
This is how my Cp is defined in member functions and as Cp=f(T) :: Quote:
|
|||||
May 17, 2019, 07:08 |
|
#17 | |||||
Senior Member
|
Dear Mr. Daniel,
I have tried working it ~ compiled successfully by changing one thing under conductivitySolidTransportI.H. Thank you loads !! However, I have queries related to it. conductivitySolidTransport.H Quote:
Quote:
Quote:
Quote:
When T > 773K, if pRR = pR_ ==> for first run pRR is activated as input as variable pR_ *For second run, will pRR be iterated back in the equation automatically ?? ==> scalar pii = (pRR*(1-pTT))/(1-pRR); //*******************// However after compiling, I got some following errors: Quote:
|
||||||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thermal conductivity as function of temperature | magazoni | OpenFOAM Programming & Development | 5 | May 19, 2016 19:25 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 04:32 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 10:56 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 05:37 |