|
[Sponsors] |
August 1, 2015, 15:40 |
|
#21 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
You are right, usually I check the source code to get a definitive answer. Additionally, some code testing could be needed to better understand how certain parts of OF really works.
|
|
August 2, 2015, 01:50 |
|
#22 | |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Quote:
I prefer to trace/search the part of main program of OF recalling hesource at following scalarCodedSource code: Code:
FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // energySource { type scalarCodedSource; active true; selectionMode all; scalarCodedSourceCoeffs { fieldNames (h); redirectType sourceTime; codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ const Time& time = mesh().time(); const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); // How & where (which sub-program) does main program (source code) read/recall hesource?// scalarField& heSource = eqn.source(); scalar hs = (2.0*time.value())/(1+time.value()); // heSource += hs .OR. heSource += hs*V;// Pout << "***codeAddSup***" << endl; #}; codeSetValue #{ Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { // Dummy entry } I'd appreciated for any help. Last edited by Asghari_M; August 2, 2015 at 04:12. |
||
August 2, 2015, 10:06 |
|
#23 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
Tomislav Maric post about fvOptions is very good starting point to understand how fvOptions works. [LINK].
I can confirm two points here, first the source term "he" should have units of Watts [Kg m2 S-3]. Secondary the heSource should be (heSource-= hs) or (he = -hs) too act as source otherwise it will act as sink. I think that could explain the drop in Temperature in your case. |
|
August 2, 2015, 16:23 |
|
#24 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Hello Hassan.
I conclude the correct scalarCodedSource type of fvOptions for my heat source is based on ur points as follows: Code:
FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // energySource { type scalarCodedSource; active true; selectionMode all; scalarCodedSourceCoeffs { fieldNames (h); redirectType sourceTime; codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ const Time& time = mesh().time(); const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); scalarField& heSource = eqn.source(); scalar hs = (2.0*time.value())/(1+time.value()); // the correct relation for hesource is presented as follows: // heSource -= hs*V;//Isn't it?// Pout << "***codeAddSup***" << endl; #}; codeSetValue #{ Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { // Dummy entry } M.Asghari |
|
August 2, 2015, 16:35 |
|
#25 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
Yes, it looks good. Give it a try and see the results. Please keep us updated.
Best wishes, Hassan |
|
August 3, 2015, 01:19 |
|
#26 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
conclusion:
Really, since my heat source term is specific and scalarCodedsource returns absolute value as heSource (in watt unit), user should use *V notation (multiplying hesource by mesh volume) for scalarCodedSource type in fvOptions. Best Wishes |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transient spacial dependent heat source | Kumudu | OpenFOAM Running, Solving & CFD | 0 | October 28, 2013 12:02 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 23:40 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 08:56 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 11:57 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 12:44 |