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

VectorCodedSource Factor

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Tobermory
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2020, 14:40
Default VectorCodedSource Factor
  #1
New Member
 
Join Date: Jun 2020
Posts: 9
Rep Power: 6
mattms is on a distinguished road
In using the scalarCodedSource in fvOptions, OpenFOAM documentation shows that you multiply by a factor of V[i], the volume of the cell.

Is there such a factor that you multiply when using vectorCodedSource for the U equation?
mattms is offline   Reply With Quote

Old   August 11, 2020, 15:23
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14
Tobermory will become famous soon enough
I am not sure that I understand your question. The cell volume is the same whatever the equation you are solving, so perhaps the answer is "yes". Just to be sure, let me elaborate. For any of the equations, if the source term option volumeMode is specific, then you need to divide the source term value by the source volume; if volumeMode is absolute then you need to put the actual value in, and the code will calculate the specific value internally.

Why? Well let's take the density equation as an example. The terms are all drho/dt terms, although since this is finite volume we have integrated over the volume of the cell, and so the terms have dimensions rho x vol / time, i.e. mass flow rate. In other words, a source term for the density equation (or scalar transport equation) would be a mass flow rate, which makes sense. Now you can either state explicitly the mass flow rate that you want to apply across the set of cells that you are flagging as your source (e.g. 5kg/s), in which case use the absolute flag. Or you can specify the specific value (e.g. 1 kg/s/m3, in this example if your source volume was 5m3). Up to you which you apply - there may be some benefits of one approach over the other - have a think about what happens when you refine your mesh, for example.
Haitham Osman CFD likes this.
Tobermory is offline   Reply With Quote

Old   August 11, 2020, 15:58
Default
  #3
New Member
 
Join Date: Jun 2020
Posts: 9
Rep Power: 6
mattms is on a distinguished road
OK, I was referring to this documentation: https://www.openfoam.com/documentati...ces-coded.html which shows multiplying by V[i]. I did not realize the need to use volumeMode in scalarCodedSource. Thanks!
mattms is offline   Reply With Quote

Old   August 12, 2020, 05:35
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 711
Rep Power: 14
Tobermory will become famous soon enough
Hmm ... that example is confusing, and my post was probably also confusing for you since I was referring to the other, simpler source terms like semiImplictSource. I don't think that the volumeMode option is relevant for codedSource - sorry for the misdirection.

Beware that the text in the link that you provided is wrong, though. It suggests that it is trying to implement an energy source, and then gives the equation in the text as "(1/V) 10^5 sin(200Cx)". I think the 1/V in this expression is probably a typo since in the coding snippet below it, it uses "10^5 sin(200Cx)" as the specific source, and then multiplies it by the volume to give the absolute source term that is applied to the energy equation. The *V[i] converts the specific source to an absolute source, and so the specific source must be "10^5 sin(200Cx)".

See also the example in the header file for codedSource (https://cpp.openfoam.org/v8/CodedSource_8H_source.html). It appears that the source term that is returned by codedSource must be an absolute value (which is odd since the coding for the other sources, like semiImplictSource convert an absolute term into a specific term! I am sure there's a good reason somewhere ... ).
Haitham Osman CFD likes this.
Tobermory is offline   Reply With Quote

Reply


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
Floating point exception error Alan OpenFOAM Running, Solving & CFD 11 July 1, 2021 21:51
Lets talk about relaxation factor optimization chriss85 OpenFOAM Running, Solving & CFD 35 June 21, 2019 09:54
Long output in terminal. ssa_cfd OpenFOAM Running, Solving & CFD 1 March 18, 2019 05:25
Hybrid discretisation - blend factor gcoopermax CFX 5 September 23, 2016 08:05
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 00:07


All times are GMT -4. The time now is 22:12.