|
[Sponsors] |
Explanation of sinusoidal heat source code on fvOptions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 24, 2022, 03:12 |
Explanation of sinusoidal heat source code on fvOptions
|
#1 |
New Member
Giulia
Join Date: Feb 2022
Posts: 19
Rep Power: 4 |
Hello,
I am using OpenFoam version 6 and chtMultiRegionFoam as a solver to simulate a solid body (heat source) exchanging heat with a moving fluid. In order to give a sinusoidal variation of the heat source, I am using fvOptions on the solid region with the following code: Code:
energySource { type scalarCodedSource; active yes; timeStart 0; duration 1e6; name sourceTime; selectionMode all; scalarCodedSourceCoeffs { selectionMode all; volumeMode specific; fields (h); 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(); heSource += 2.729e6*sin(2*3.14*0.1*time.value())*V; Pout << "***codeAddSup***" << endl; #}; codeSetValue #{ Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } - what does "const scalarField& V = mesh_.V()" mean? - what does "const vectorField& C = mesh_.C()" mean? - why heSource has to be multiplied by V? - what is a dummy entry? Any further explication about the code is highly appreciated. Thank you very much for your help!! |
|
June 24, 2022, 04:22 |
|
#2 |
Member
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4 |
Code:
const scalarField& V = mesh_.V() const vectorField& C = mesh_.C() Both are just const references to the cell volume of each cell or cell centers. Why the heat source is multiplied with V depends on the formulation of the source term. I would guess that the relation derived is normed by the volume and in order get the correct values/dimensions it is multiplied by it. I dont know the reason or the idea behind a dummy entry. But there are #-symbols has to do with preprocessor directives and inside the directory are the directories defined in your file (for example $AddSup) |
|
June 24, 2022, 04:27 |
|
#3 | |
New Member
Giulia
Join Date: Feb 2022
Posts: 19
Rep Power: 4 |
Quote:
So this means that if I want to give a heat source not dependent on the volume (so an absolute heat source expressed in W and not W/m3) I just have to remove the multiplication of V? |
||
June 24, 2022, 05:09 |
|
#4 |
Member
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4 |
I cant give you the exact answer to this, because I dont know the exact definiton of your source term. Thats why I mentioned my guess. But it would be the other way as you have written.
Do yoou know the dimensions of the prefactor 2.729e6? Dimensioncontrol could help you here. |
|
Tags |
chtmultiregionfoam, fvoptions, heat source, regions, sinusoidal |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 04:30 |
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 | tlcoons | OpenFOAM Installation | 13 | April 20, 2016 18:34 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 22:53 |
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error | FerdiFuchs | OpenFOAM Community Contributions | 27 | April 16, 2014 16:14 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |