# TEqn in compressibleInterFoam

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

 August 9, 2023, 10:24 TEqn in compressibleInterFoam #1 New Member   S Abrahams Join Date: Mar 2022 Location: UK Posts: 14 Rep Power: 4 Hi everyone! I wonder if anyone can help me to understand the formulation of the TEqn in compressibleInterFoam in OF9. The TEqn is: Code: fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - fvm::Sp(contErr, T) - fvm::laplacian(turbulence.alphaEff(), T) + ( fvc::div(fvc::absolute(phi, U), p)()() // - contErr/rho*p + (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))()() - (U()&(fvModels.source(rho, U)&U)()) - contErr*K ) *( alpha1()/mixture.thermo1().Cv()() + alpha2()/mixture.thermo2().Cv()() ) == fvModels.source(rho, T) I believe should be inside the derivatives since is averaged over the two phases and can therefore vary in time and space. I believe the TEqn should be equivalent to but the formulation above seems to be equivalent to Can anyone help me to understand how has been taken out in this way? Many thanks, SAbrahams Last edited by sabrahams; August 9, 2023 at 13:09. Reason: typos

 August 15, 2023, 09:34 #2 New Member   S Abrahams Join Date: Mar 2022 Location: UK Posts: 14 Rep Power: 4 Does no-one know the answer to this?

 August 15, 2023, 10:55 #3 Senior Member   Join Date: Apr 2020 Location: UK Posts: 670 Rep Power: 14 I think the problem lies with your first Teqn equation ... Start from basics - the underlying energy equation is stated in terms of the internal energy, i.e. in conservative form: which we can expand out using continuity to the non-conservative form: Now using the definition of the specific heat, we write , so substitute and you have: or in terms of the material derivative: with the specific heat capacity on the outside. Hopefully that helps.

 August 15, 2023, 11:22 #4 New Member   S Abrahams Join Date: Mar 2022 Location: UK Posts: 14 Rep Power: 4 Hi Tobermory, Thanks for your reply. However, since is not a constant in this case, I don't believe we can say . Instead, it should be . In a two phase system, as we have in compressibleInterFoam, is averaged over the two phases, that is While and may be constant, is not since and vary in time and space. Furthermore, TEqn in compressibleInterFoam (as shown in my original post) is not it seems to be (if you divide through by , which is multiplying the second term in TEqn) So I'm trying to understand how the energy equation has been rearranged to get the form in the TEqn as in my original post. Do you know how this is derived? Thanks again, SAbrahams Last edited by sabrahams; August 15, 2023 at 11:28. Reason: correcting mistake in equation

August 16, 2023, 11:32
#5
Senior Member

Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14
Okay - let me break this down. First up, the following is not correct I am afraid:

Quote:
 Originally Posted by sabrahams However, since is not a constant in this case, I don't believe we can say . Instead, it should be .
You need to start with the definition of the specific heat capacity, which is ... and now can you see where I got my original from? We have said nothing so far about the variability of Cv in space, just that the process is assumed to be a constant volume process (which makes sense for two immiscible fluids). If you're still not convinced, then think of the chain rule:

etc. Now consider the single phase energy equation, which in OpenFOAM is (refer to buoyantPimpleFoam for example):

expand out the first two terms into the nonconservative form using continuity, substitute for and convert back to conservative form and you get:

NOW a minor approximation is made in the laplacian, where it assumed that local variations in Cv are small, so that the terms cancel leaving:

and we are almost there. All that is left is to realise that the finite volume discretised form of the energy (or temperature) budget equation is the sum of alpha1 times the equation for phase 1 plus alpha2 times that for phase two, which results in:

or on noting that , we have:

noting that these should now not be differentials etc., but should instead be volume integrals of the differentials yielding volume average values or surface fluxes (I didn't have the time to tidy up the terminology). This is the form that appears in TEqn.h for compressibleInterFoam.

There are clearly a bunch of other implicit assumptions here ... but this is my reverse engineering of the code. I couldn't find any explicit reference to the source of the model equations, and suspect it was authored by one of the OpenFOAM team. If you do find a reference - share it with the forum please.

Last edited by Tobermory; August 16, 2023 at 12:36.

 August 17, 2023, 10:38 #6 New Member   S Abrahams Join Date: Mar 2022 Location: UK Posts: 14 Rep Power: 4 That makes perfect sense. Thank you for the clear explanation! I haven't found any references for the equations used in compressibleInterFoam in OF9. If I find anything I'll certainly share. UEqn and alphaEqn appear to be in the same form as equations (7) and (25) of Shi et al.. Although, this paper was published later than OF9 so isn't a reference but just a useful resource to understand the equations (for anyone else reading this). Thanks again Tobermory. Tobermory likes this.

August 23, 2023, 10:36
#7
New Member

S Abrahams
Join Date: Mar 2022
Location: UK
Posts: 14
Rep Power: 4
Hi again Tobermory,

I've just been working through this and I'm stuck on this step:
Quote:
 Originally Posted by Tobermory All that is left is to realise that the finite volume discretised form of the energy (or temperature) budget equation is the sum of alpha1 times the equation for phase 1 plus alpha2 times that for phase two, which results in:
I believe that the equation for phase 1 would have and the equation for phase 2 would have so I'm struggling to see how the two equations could be summed in the way that you've shown above. I'm getting an equation of the form:

Am I missing a step or an assumption somewhere?

 August 24, 2023, 10:34 #8 Senior Member   Join Date: Apr 2020 Location: UK Posts: 670 Rep Power: 14 The way to think of it, I reckon, is as follows: we need to integrate the differential equations over the cell volume to get the finite volume expressions. Focus just on the first two terms, for simplicity: integrate these to get: where it's assumed that the mesh is not moving or morphing, are the face fluxes, and the P subscript denotes a volume-averaged value, e.g. Note though that we are integrating over volume for phase 1, and for phase 2. This is the origin of the and coefficients in each of the terms. This is what I meant rather laconically in my earlier post by "noting that these should now not be differentials etc.". Hope this helps.

 Tags heat capacity, temperature, teqn