CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   adding thermophysical model to conjugateHeatFoam (

helmut December 1, 2011 13:12

adding thermophysical model to conjugateHeatFoam
I want to add a thermophysical model to the fluid side of conjugateHeatFoam. Itís not going well!
To get started, I used rhoPisoFoam as a model to rewrite solveFluid.H, but solving for T+T, not h. After it all compiled, I got the runtime error message:

given field does not correspond to patch. Patch size: 10 field size: 0

From function PatchToPatchInterpolation::faceInterpolate(const Field<Type> ff)
in file /usr/local/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/PatchToPatchInterpolate.C at line 133.

FOAM aborting

gdb showed that the error was spawned by the coupled solver solving for T+T.

I backed up and took out all references to the turbulence and thermo models. Fields defined by the thermo model became defined in the 0/ directory (or got left out altogether). The code then ran.

Reinstating the code to create the thermo and turbulence models (without using them later in the solver) brought back the error. Both T eqns referenced rho and Cp in the ddt terms. Coupling those didnít help. I made the application steady, basing solveFluid.H on rhoSimpleFoam. Then only k and T were common to both temperature equations:

coupledFvScalarMatrix TEqns(2);

// Add fluid equation
new fvScalarMatrix
fvm::div((fvc::interpolate(Cp)*phi), T)
- fvm::laplacian(k, T)

// Add solid equation
new fvScalarMatrix
-fvm::laplacian(kSolid, Tsolid)


The problem remains: If I donít create the thermo and turbulence models, the code runs, but when I create them I get the problem in the coupled T+T solution.

Any help will be greatly appreciated! Thanks.

helmut December 8, 2011 11:22

The above problem was solved by creating the thermo model after creating all of the fields. Simple, really.

All times are GMT -4. The time now is 22:41.