|
[Sponsors] |
August 11, 2020, 15:40 |
VectorCodedSource Factor
|
#1 |
New Member
Join Date: Jun 2020
Posts: 9
Rep Power: 6 |
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? |
|
August 11, 2020, 16:23 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
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. |
|
August 11, 2020, 16:58 |
|
#3 |
New Member
Join Date: Jun 2020
Posts: 9
Rep Power: 6 |
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!
|
|
August 12, 2020, 06:35 |
|
#4 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
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 ... ). |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Floating point exception error | Alan | OpenFOAM Running, Solving & CFD | 11 | July 1, 2021 22:51 |
Lets talk about relaxation factor optimization | chriss85 | OpenFOAM Running, Solving & CFD | 35 | June 21, 2019 10:54 |
Long output in terminal. | ssa_cfd | OpenFOAM Running, Solving & CFD | 1 | March 18, 2019 06:25 |
Hybrid discretisation - blend factor | gcoopermax | CFX | 5 | September 23, 2016 09:05 |
chemical reaction - decompostition | La S. Hyuck | CFX | 1 | May 23, 2001 01:07 |