|
[Sponsors] |
fvOptions() Options and SemiImplicit Source Term - Units |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 9, 2020, 18:44 |
fvOptions() Options and SemiImplicit Source Term - Units
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
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.
__________________
Keep foaming, Tobias Holzmann |
|
January 9, 2020, 21:42 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
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: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Quote:
__________________
Keep foaming, Tobias Holzmann |
||
January 10, 2020, 10:41 |
|
#4 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
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 |
|
January 10, 2020, 13:49 |
|
#5 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
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: 15 |
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<class Type> void Foam::fv::SemiImplicitSource<Type>::addSup ( const volScalarField& rho, fvMatrix<Type>& eqn, const label fieldi ) { return this->addSup(eqn, fieldi); } Code:
void Foam::fv::buoyancyForce::addSup ( const volScalarField& rho, fvMatrix<vector>& eqn, const label fieldi ) { eqn += rho*g_; } Code:
void Foam::fv::buoyancyForce::addSup ( fvMatrix<vector>& eqn, const label fieldi ) { eqn += g_; } Caelan |
|
January 10, 2020, 18:07 |
|
#7 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
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: 14 |
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: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
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 \<quantity\> - specific: values are given as \<quantity\>/m3
__________________
Keep foaming, Tobias Holzmann |
|
January 12, 2020, 04:04 |
|
#10 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
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: 6 |
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<scalar>& eqn in addSupp. Code:
scalarField& heSource = eqn.source(); Info<<"eqn dimension "<<eqn.dimensions()<<nl; Info<<"heatFlow dimension "<<heatFlow.dimensions()<<nl; heSource-=heatSource; Today I changed this part of my code to: Code:
scalarField& heSource = eqn.source(); Info<<"eqn dimension "<<eqn.dimensions()<<nl; Info<<"heatFlow dimension "<<heatFlow.dimensions()<<nl; eqn-=heatSource; Code:
--> 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<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&, const char*) [with Type = double] in file /home/student-ift/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvMatrix.C at line 1304. 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: 6 |
Quote:
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; } } |
||
|
|