CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   energy equation coupled with liquid fraction updating (http://www.cfd-online.com/Forums/openfoam-programming-development/108960-energy-equation-coupled-liquid-fraction-updating.html)

chaolian November 5, 2012 21:54

energy equation coupled with liquid fraction updating
 
Hello Foamers -
I have a question. Say, I want to solve a temperature equation involving liquid fraction alpha, but alpha updates very simply in each iteration. I tried to modify fabian's meltFoam TEqn.H, the following is part of TEqn.H. It compiles fine but the result is not correct. Any ideas?
---------------------------------------
fvScalarMatrix TEqn
(
fvm::ddt(cp, T)
+ fvm::div(phi*fvc::interpolate(cp), T)
+ hs*(fvc::ddt(alpha)+fvc::div(phi,alpha))
- fvm::laplacian(lambda/rho, T)
);


TEqn.relax();
TEqn.solve();


forAll(T, celli)
{
if (T[celli] < Ts.value())
{
alpha[celli] = 0;
}
else if (T[celli] > Tl.value())
{
alpha[celli] = 1;
}
else
{
alpha[celli] = (T[celli]-Ts.value())/(Tl.value()-Ts.value());
}
}
----------------------------------------
Thanks in advance for any response.


All times are GMT -4. The time now is 00:38.