CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   trouble with totalTemperature BC (http://www.cfd-online.com/Forums/openfoam/69534-trouble-totaltemperature-bc.html)

pg22 October 26, 2009 15:34

trouble with totalTemperature BC
 
I am using OF1.5 and rhopSonicFoam for a compressible external flow case. On the far field boundary I would like to apply a totalTemperature boundary condition:

topBoundary
{
type totalTemperature;
T0 uniform 300;
U U;
phi phi;
psi psi;
gamma 1.4;
value uniform 300;
}

I find that solver aborts with the following message:

request for volVectorField U from objectRegistry region0 failed
available objects of type volVectorField are

0
(
)

I have found that a totalPressure boundary condition (with fixedValue for T) runs for a short time before inflow leads to rapid divergence.

In the source files for totalPressure and totalTemperature I see that the vector field for velocity is accessed in a different way in each case:

For totalTemperatureFvPatchScalarField.C:

const fvPatchVectorField& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);

For totalPressureFvPatchScalarField.C:

void totalPressureFvPatchScalarField::updateCoeffs()
{
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_));
}

Can anyone explain why the former BC fails and the latter
succeeds; and even suggest a solution?

Many thanks.


pg22 October 27, 2009 11:15

More information ...

I noticed from the log file (for rhopSonicFoam > log) that the totalTemperature BC causes the solver to abort after writing the message:

Reading field T

This message comes from the header file "createFields.H". There is a function T.correctBoundaryConditions() that is called before the vector field for U is established. The fields are created in the order p, T, psi, rho, U, rhoU, rhoE, phiv.

My question is; may I re-arrange the code so that the vector field for U is created before T.correctBoundaryConditions() is called? The order could be p, U, T, psi, rho, rhoU, rhoE, phiv, for example.

agodfrey October 28, 2009 14:28

Sorry, I can't help any, but I'm clawing my way through these bcs also. Any idea what psi and phi represent? I assume phi is the mass flux vector (rho U). Also, in the code, there's a 1 - pos(phip). Any idea where pos() is defined or what it does?

agodfrey October 28, 2009 14:38

Found the pos() function in Doxygen.

00103 inline Scalar pos(const Scalar s)
00104 {
00105 return (s >= 0)? 1: 0;
00106 }

I still don't know what phip is though. I assume it's negative though, or else the bc isn't very useful.

gschaider October 28, 2009 16:54

Quote:

Originally Posted by agodfrey (Post 234392)
Found the pos() function in Doxygen.

00103 inline Scalar pos(const Scalar s)
00104 {
00105 return (s >= 0)? 1: 0;
00106 }

I still don't know what phip is though. I assume it's negative though, or else the bc isn't very useful.

phip: phi on a patch. The definition of phi (mass flow on the face) has been discussed a number of times. Sign says whether it's flowing in or out

agodfrey October 28, 2009 21:18

Thanks Berhard. Saw several of your talks in Montreal last June. I figured the phi part out after the post. From the code, psi must equal rho/p, but I don't know why or how this bc's dictionary works. Why is U part of the class?

gschaider October 29, 2009 05:39

Quote:

Originally Posted by agodfrey (Post 234426)
Thanks Berhard. Saw several of your talks in Montreal last June. I figured the phi part out after the post. From the code, psi must equal rho/p, but I don't know why or how this bc's dictionary works. Why is U part of the class?

Never worked with that boundary condition. But I guess for multiphase-solvers where more than one velocities exist

pg22 October 29, 2009 06:49

Have made some progress with this problem...

First, I re-ordered the creation of the fields defined in "createFields.H". I used the order I mentioned above; p. U, T, psi, rho, rhoU, rhoE, phiv. I re-compiled and found that the solver aborted again, this time on searching for the scalar field phi.

Then I moved the T.correctBoundaryConditions() function down in the file, to the line below rhoU.correctBoundaryConditions().

I re-compiled and the solver ran successfully. However, in order to update the boundary condition after each time step one extra change is needed:

in rhopSonicFoam.C I added the update function just below the expression for U;

U=rhoU/rho;
T.correctBoundaryConditions();


I have re-compiled rhopSonicFoam and it works fine; the temperature at the far field boundary is adjusted as pressure waves move through and the local velocity changes.

To answer the question on why U is involved, the totalTemperature function is simply
an expression of the energy equation; as the velocity increases the temperature drops.


All times are GMT -4. The time now is 14:35.