# fvOptions() Options and SemiImplicit Source Term - Units

 Register Blogs Members List Search Today's Posts Mark Forums Read

 January 9, 2020, 18:44 fvOptions() Options and SemiImplicit Source Term - Units #1 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,679 Blog Entries: 6 Rep Power: 49 Hi everybody, at the moment I am investigating into the energy equation and the fvOptions possibilities. Therefore, I have a few questions that arises. 1. The unit of the energy (he) is in . That's due to it is the energy per unit mass. Correct? 2. The units of the matrix of the energy equation is given as . Here again, as it is per unit mass 3. The units for fvOptions(he) is equal to 4. The units for fvOptions(rho, he) is equal to . This is clear to point 3. Thus, for point 3. we do have the volumetric fluxes which lead to the units of the energy again (m²/s²) and for point 4 we do have the mass related fluxes which lead to the same units. Therefore, as he is equal to m²/s², I guess the absolute value in the semiImplicitSource has the same units. So the units are actually J/kg. Maybe I am a bit tired right now but I am wondering how to set a energy sink of e.g., 100 W. fnovo likes this. __________________ Keep foaming, Tobias Holzmann

 January 9, 2020, 21:42 #2 Senior Member   Join Date: Aug 2015 Posts: 494 Rep Power: 13 You should be able to use fvOptions with a negative source term value. See fore example the file from a cht tutorial : https://github.com/OpenFOAM/OpenFOAM...ater/fvOptions. Units of the source should be W/m^3 for specific, W for absolute source. Caelan

January 10, 2020, 05:20
#3
Super Moderator

Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,679
Blog Entries: 6
Rep Power: 49
Quote:
 Originally Posted by clapointe You should be able to use fvOptions with a negative source term value. See fore example the file from a cht tutorial : https://github.com/OpenFOAM/OpenFOAM...ater/fvOptions. Units of the source should be W/m^3 for specific, W for absolute source. Caelan
Dear Caelan, thank you for your feedback. Sure, you can set a negative value. That is obvious. For me, it is more interesting why you think that the unit we apply here is in [W] rather than [J/kg], I guess it is due to the fact that Henry set the comment, right? As the fvOptions() term is inside the matrix construction, and we are solving for the energy field (he) that has the units of [J/kg], I expect that the unit of the semiImplicitSource does have to have the same units as the field, thus [J/kg]. I guess I have to check the implementation of the fv:: options class to get the answer.
__________________
Keep foaming,
Tobias Holzmann

 January 10, 2020, 10:41 #4 Senior Member   Join Date: Aug 2015 Posts: 494 Rep Power: 13 If we are to assume that the comment is correct, then yes. Checking the scalarSemiImplicit source code (https://github.com/OpenFOAM/OpenFOAM...plicitSource.C), we see that the units of the addition are equation units/m^3 and that the absolute/volumetric option is just worked in through division. Presuming that the comment is still correct, we also need the same units (W/m^3) on the LHS of the equation. Thinking about the temporal derivative term, we have a temporal derivative of rho*h. As you've pointed out, h is units of m^2/s^2. This is multiplied by density and 1/s for the derivative, for units of J/m^3*s. For the energy source this appears to be consistent. To solve for h itself division by density would be necessary -- making the source term be units of quantity/kg as you've shown. This is a bit circular (and I've not had my coffee yet) but this is how I rationalized the addition in W or W/m^3. Caelan altinel likes this.

 January 10, 2020, 13:49 #5 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,679 Blog Entries: 6 Rep Power: 49 Hi, Just as an hint, as you said correlates to my point #4. However, I was expecting, that the value we set is actually multiplied by the density if we have FvOptions(rho, he). I agree about what you said and will investigate into the code in more depth. But sure, it should be fine and the unit should be in Watt. Thanks Tobi __________________ Keep foaming, Tobias Holzmann

 January 10, 2020, 14:53 #6 Senior Member   Join Date: Aug 2015 Posts: 494 Rep Power: 13 Perhaps I missed a rho term in the code -- I looked again and did not see anything obvious, so will be interested to learn what you figure out. One observation I made is that there is a member function that takes rho as an argument (presumably for compressible, with fvOptions(rho,he)) but appears to use the version that does not take rho as an argument (for fvOptions(he) or generality) : Code: ```template void Foam::fv::SemiImplicitSource::addSup ( const volScalarField& rho, fvMatrix& eqn, const label fieldi ) { return this->addSup(eqn, fieldi); }``` If we look at a different function object, e.g. the buoyancyForce one, the "compressible" member function taking rho as an argument does multiply by rho (in contrast to the "incompressible" function that does not) : Code: ```void Foam::fv::buoyancyForce::addSup ( const volScalarField& rho, fvMatrix& eqn, const label fieldi ) { eqn += rho*g_; }``` vs. Code: ```void Foam::fv::buoyancyForce::addSup ( fvMatrix& eqn, const label fieldi ) { eqn += g_; }``` So perhaps we implicitly multiply by rho by giving the value in Watts for use in a compressible solver, and if we wanted to use in an incompressible sense for fvOptions(he) we would need to divide our source in Watts by a representative rho? This is not to say that we would have a heat source in an incompressible solver, but just thinking out loud. What do you think? Caelan Tobi likes this.

 January 10, 2020, 18:07 #7 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,679 Blog Entries: 6 Rep Power: 49 Exactly that function I came across yesterday. I mean the SuSp that takes the rho and redirects to the SuSp without rho. I will investigate into that. __________________ Keep foaming, Tobias Holzmann

 January 11, 2020, 12:21 #8 Senior Member   anonymous Join Date: Jan 2016 Posts: 416 Rep Power: 13 Hi! If you check the energy equation (chtMultiRegionFoam or buoyantSImple foam), you find the buoyant energy term as rho*(U&g) which is kg/(m*s^3), right? This is just J/(m^3 * s), which is W/m^3. So the equation must be in W/m^3. For me it seems correct, since in the semiImplicitSource you should add the source in W or W/m^3. (Actually this source is always divide with the volume, but if you are using with "absolute", you divide with 1. Kinda efficient...) So let's assume you are correct and he is in m^2/s^2. You have a term: ddt(rho, he) which would give you kg/(m*s^3). This is W/m^3 again, so we are done. In incompressible case, you divide everything with rho. So I think that's why that multiplication with rho is missing in that function. So finally if i'm correct: The energy equation is in W/m^3, not J/m^3. You can add the source in W/m^3. I hope it was clear.

 January 11, 2020, 13:22 #9 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,679 Blog Entries: 6 Rep Power: 49 Yes, I made a mistake in my point 2) ... forgot to divide by m³. Therefore, yes, the equation has the unit of W/m³. Nevertheless, as we can see in the semiImplicit, the units are given as: Code: ``` Valid options for the \c volumeMode entry include: - absolute: values are given as \ - specific: values are given as \/m3``` The quantity is (he) and this takes the units of m²/s². Well, in any case, I guess W or W/m³ are the units here. bikooo3878, SHUBHAM9595 and altinel like this. __________________ Keep foaming, Tobias Holzmann

 January 12, 2020, 04:04 #10 Senior Member   anonymous Join Date: Jan 2016 Posts: 416 Rep Power: 13 Yap, but to be honest I don't trust the comments 100% And just came to my mind. If the units would be in J/kg, then how could you add a 1W heat source for example in a steady state simulation? I think it would be impossible.

 September 30, 2020, 11:24 #11 New Member   Join Date: Jun 2020 Posts: 5 Rep Power: 4 Hey! I just made a post regarding a similar question (Units in addSups fvOption). Maybe someone of you can help me out. A brief description of my problem: I am writing a source class for battery heating. I used to add my heatSource in W to fvMatrix& eqn in addSupp. Code: ` scalarField& heSource = eqn.source(); Info<<"eqn dimension "< FOAM FATAL ERROR: [h[1 -1 -3 0 0 0 0] ] -= [heatSource[1 2 -3 0 0 0 0] ] From function void Foam::checkMethod(const Foam::fvMatrix&, const Foam::DimensionedField&, const char*) [with Type = double] in file /home/student-ift/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1304.` When changing the code again by dividing each value of heatSource by the corrosponding cell volume, to make it volume specific (W/m^3), my model is simulating. Even though, the results seem to be wrong, as the temperature is decreasing instead of increasing. Is there a difference in using eqn.source() or just eqn for the calculation regarding the dimensions? And am I even allowed to use heatSource with the unit W? Hope you can help me out, since this post is pretty similar Kind regards Frederik Last edited by fnovo; September 30, 2020 at 11:24. Reason: just spelling mistakes

February 18, 2021, 10:13
#12
Member

UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 4
Quote:
 Originally Posted by Tobi Yes, I made a mistake in my point 2) ... forgot to divide by m³. Therefore, yes, the equation has the unit of W/m³. Nevertheless, as we can see in the semiImplicit, the units are given as: Code: ``` Valid options for the \c volumeMode entry include: - absolute: values are given as \ - specific: values are given as \/m3``` The quantity is (he) and this takes the units of m²/s². Well, in any case, I guess W or W/m³ are the units here.

So let's suppose I want to simulate the effect of a 10kJ ignitor with this Energy Source.

How can I change my value to W??
How do "timeStart" and "duration" parameters affect the source??

This is for coalChemistryFoam so this should be something like this:

Code:
```sources
{
h
{
explicit 1e4; //10kJ
implicit 0;
}
}```
Thanks!!