|
[Sponsors] |
Correction of T after TEqn in compressibleInterFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 26, 2017, 05:38 |
Correction of T after TEqn in compressibleInterFoam
|
#1 |
Member
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9 |
Hello everyone!
Why is in compressibleInterFoam T first calculated from the temperature equation TEqn and then again from internal energy he() in heRhoThermo.C with calculate()? Code:
TCells[celli] = mixture_.THE ( hCells[celli], pCells[celli], TCells[celli] ); |
|
October 27, 2017, 06:08 |
|
#2 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
It isn’t.
I am going by memory and it’s been a long time since I’ve been working with OF (2.2.x), so I may we wrong about the details. But as far as I remember the twoPhaseMixtureThermo that compressibleInterFoam uses inherits from basicThermo and this is where the solver gets its p, T fields from. The twoPhaseMixtureThermo has two thermo objects, one for each phase. Each of those also inherit from basicThermo so they both have their own p, T fields as well. The solver uses the p, T fields of the twoPhaseMixtureThermo. Those fields are not known to the phasic thermo objects. The twoPhaseMixtureThermo in turn doesn’t know how to calculate transport properties of the constituent phases. Only the phasic thermo objects know that. In the correct() function of twoPhaseMixtureThermo there should for each phase ‘x’ be a line something like this: thermox->he() = thermox->he(p,T). The right hand side creates a new volScalarField with enthalpy initialized from the current p and T fields of the solver (see heThermo). It then assigns that field to the same thermo object. In turn, the correct() function can be called on each of the phasic termo objects to update the transport properties. You don’t state exactly what you commented out, but if it is the calls to the thermo object correct() functions inside the twoPhaseMixtureThermo then it will not work. The missing update of transport properties – e.g. compressibility used in the pressure equation - leads to field inconsistency. Eventually something will blow up, quite likely pressure. |
|
October 27, 2017, 10:10 |
|
#3 |
Member
Kristjan
Join Date: Apr 2017
Location: Slovenia
Posts: 36
Rep Power: 9 |
You pointed me in the right direction, thank you!
I then checked the phase temperatures T.air and T.poly and they weren't changing during the calculation, because of the commented code. I wasn't aware of the different temperature objects. Code:
#include "mojHeRhoThermo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class BasicPsiThermo, class MixtureType> void Foam::mojHeRhoThermo<BasicPsiThermo, MixtureType>::calculate() { //const scalarField& hCells = this->he().internalField(); //commented out const scalarField& pCells = this->p_.internalField(); const scalarField& strigCells = this->strig_.internalField(); scalarField& TCells = this->T_.internalField(); scalarField& psiCells = this->psi_.internalField(); scalarField& rhoCells = this->rho_.internalField(); scalarField& muCells = this->mu_.internalField(); scalarField& alphaCells = this->alpha_.internalField(); forAll(TCells, celli) { const typename MixtureType::thermoType& mixture_ = this->cellMixture(celli); //TCells[celli] = mixture_.THE //commented out //( // hCells[celli], // pCells[celli], // TCells[celli] //); This now allows the phase temperatures to be overridden. Code:
void Foam::mojTwoPhaseMixtureThermo::correct() { //thermo1_->he() = thermo1_->he(p_, T_); thermo1_->T() = T_; thermo1_->correct(); //thermo2_->he() = thermo2_->he(p_, T_); thermo2_->T() = T_; thermo2_->correct(); |
|
June 26, 2022, 23:07 |
|
#4 | |
Member
Join Date: Nov 2020
Posts: 53
Rep Power: 6 |
Quote:
Can you please explain what are your goals here and why you commented on some lines? I can barely follow what you did. I need to understand more since I want to modify the TEqn also to my purpose. Regards, Mike |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Floating point exception error | Alan | OpenFOAM Running, Solving & CFD | 11 | July 1, 2021 22:51 |
SIMPLE algorithm does not converge when using old pressure (correction) values | andreasp | Main CFD Forum | 3 | February 9, 2016 22:18 |
Production correction or curvature correction in the SST model | Ang | CFX | 2 | May 20, 2014 21:50 |
Star ccm 9.02 - unsteady flux dissipation correction | fivos | STAR-CCM+ | 4 | April 28, 2014 10:37 |
Pressure correction problem | richard_larson | OpenFOAM Running, Solving & CFD | 8 | October 30, 2008 09:48 |