CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Implementing scalarcoded source in chtmultiregionFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2021, 12:46
Smile Implementing scalarcoded source in chtmultiregionFoam
  #1
New Member
 
Anish Pal
Join Date: Dec 2020
Posts: 3
Rep Power: 5
AnishPal is on a distinguished road
I want to implement a time varying vol. heat generation in chtmultiregionFoam. I have done so following the previous threads but my temperature is not increasing. Can anyone please help me. And sometimes while running the solver it is saying selection mode not define although i have defined it. I think the codedsource is not being properly read by the solver. I am attaching the case here as well.
Attached Files
File Type: zip multiRegionHeaterpuls.zip (24.5 KB, 16 views)
AnishPal is offline   Reply With Quote

Old   March 10, 2021, 11:55
Default
  #2
New Member
 
Anish Pal
Join Date: Dec 2020
Posts: 3
Rep Power: 5
AnishPal is on a distinguished road
Can anyone please help me?
AnishPal is offline   Reply With Quote

Old   July 27, 2021, 10:22
Default
  #3
New Member
 
Sergey
Join Date: Apr 2018
Posts: 16
Rep Power: 8
seregaxvm is on a distinguished road
In all examples heat source value is added to the heSource field:
Code:
heSource += 1e3*(time.value())*V;
seregaxvm is offline   Reply With Quote

Old   July 27, 2021, 17:15
Default
  #4
New Member
 
Sergey
Join Date: Apr 2018
Posts: 16
Rep Power: 8
seregaxvm is on a distinguished road
After investigation using method described in this post I've learned that additional heat source value should be negative and must be divided among mesh cells. So I came up with this line:
Code:
heSource -= (heatW / (heSource.size()));
where heatW is a heat generation rate in [W].
Make sure that heatW is a floating point variable, otherwise you'll get rounded integer division.
seregaxvm is offline   Reply With Quote

Old   July 27, 2021, 17:38
Default
  #5
Member
 
Join Date: Mar 2021
Posts: 39
Rep Power: 5
trailer is on a distinguished road
Quote:
Originally Posted by seregaxvm View Post
After investigation using method described in this post I've learned that additional heat source value should be negative and must be divided among mesh cells. So I came up with this line:
Code:
heSource -= (heatW / (heSource.size()));
where heatW is a heat generation rate in [W].
Make sure that heatW is a floating point variable, otherwise you'll get rounded integer division.

Please correct me if I am wrong, but to implement a source term with fvOptions I think you should have the following:


Code:
const scalarField& V = mesh_.V();
scalarField& S = eqn.source();

forAll(S, cellI)
{
     // Calculation of your source term for each cell in the domain
     mySourceTermForCelllI = Something



     S[cellI] = -V[cellI] * mySourceTermForCelllI;
}
Additionally, do you know why the fvOptions dictionary is sometimes found on constant folder and other times on the system folder?
OpenFOAM documentation says that the file can "live" in both folders [https://www.openfoam.com/documentati...voptions.html]. This must be one of the only dictionaries with this type of flexibility ...
trailer is offline   Reply With Quote

Old   July 27, 2021, 17:53
Default
  #6
New Member
 
Sergey
Join Date: Apr 2018
Posts: 16
Rep Power: 8
seregaxvm is on a distinguished road
Yes, I've skipped boilerplate code. Additionally, mesh_.V() is a cell volume list. You'll need it only if you define your heat source in [W/m^3] units.
seregaxvm is offline   Reply With Quote

Old   July 27, 2021, 19:02
Default
  #7
Member
 
Join Date: Mar 2021
Posts: 39
Rep Power: 5
trailer is on a distinguished road
Quote:
Originally Posted by seregaxvm View Post
Yes, I've skipped boilerplate code. Additionally, mesh_.V() is a cell volume list. You'll need it only if you define your heat source in [W/m^3] units.

Sorry if this is too basic, but do you know the reason why I am multiplying by the cell volume and the heat source is being given in [W/m^3].
trailer is offline   Reply With Quote

Old   July 28, 2021, 04:57
Default
  #8
New Member
 
Sergey
Join Date: Apr 2018
Posts: 16
Rep Power: 8
seregaxvm is on a distinguished road
One other note. codedSourse doesn't seem to work when limitTemperature is on.



Quote:
Originally Posted by trailer View Post
Sorry if this is too basic, but do you know the reason why I am multiplying by the cell volume and the heat source is being given in [W/m^3].

Sorry, didn't understand the question.
seregaxvm is offline   Reply With Quote

Reply

Tags
chtmultiregionfoam, scalarcodedsource


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.com] swak4foam compiling issues on a cluster saj216 OpenFOAM Installation 5 January 17, 2023 17:05
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 11:57


All times are GMT -4. The time now is 10:20.