CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Add temprature equation in openFoam solver??? (https://www.cfd-online.com/Forums/openfoam-programming-development/156953-add-temprature-equation-openfoam-solver.html)

rapierrz July 16, 2015 05:29

Add temprature equation in openFoam solver???
 
Hi friends,

I want to add energy equation in below form:

ddt(rho*Cp,T)+div(rho*Cp*U,T)=div(K*grad(T))

that rho and Cp and K vary with volume fraction.for example :

rho = rho1*alpha+(1-alpha)*rho2;

phi define with createCompressiblePhi.H

How I can define rho*Cp*U in div???

I try it with below codes but T has very strange contour and values.

surfaceScalarField phiEnergy
(
IOobject :
(
"phiEnergy",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(rho*Cp*U) & mesh.Sf()
);

Thank you.

ssss July 16, 2015 11:25

Try using the energy equation used in compressibleInterFoam, it seems to be more stable because it doesnt use the cp in the convective term.

If you want to use your approximation then use:

phicp= phi*fvc::interpolate(cp)

You might also find other approximations in the forum ir you search a bit more

rapierrz July 16, 2015 12:35

Quote:

Originally Posted by ssss (Post 555759)
Try using the energy equation used in compressibleInterFoam, it seems to be more stable because it doesnt use the cp in the convective term.

If you want to use your approximation then use:

phicp= phi*fvc::interpolate(cp)

You might also find other approximations in the forum ir you search a bit more

Thank you ssss,

In my case in inlet and outlet i have high gradient but it isn't normal.

how i can remove this unnatural treat???

ssss July 16, 2015 16:59

Could you describe your testcase, BC, solver, etc?

rapierrz July 17, 2015 01:45

Quote:

Originally Posted by ssss (Post 555791)
Could you describe your testcase, BC, solver, etc?

my solver is settlingFoam with small change and my case is dahl with

change in geometry that change to a circular channel.

fisrt I convert settlingFoam from turbulence to laminar then i use it in flow in

a circular pipe.

My BC is the same there is in dahl case and for temperature for top patch:

top
{
type groovyBC;
valueExpression "298";
variables "q=20000;";
gradientExpression "q/K";
fractionExpression "0";
timelines();
value uniform 298;
}

K is thermal conductivity.


All times are GMT -4. The time now is 04:50.