# extra term twophasesystem.C

•     if (pPrimeByA_.valid())
{
fvScalarMatrix alpha1Eqn
(
fvm::ddt(alpha1) - fvc::ddt(alpha1)
- fvm::laplacian(alpha1alpha2f()*pPrimeByA_(), alpha1, "bounded")
);

alpha1Eqn.relax();
alpha1Eqn.solve();

phase1_.alphaPhi() += alpha1Eqn.flux();
}


Hi everyone,

I have a question that I need to add one term in phase fraction equation (alpha1Eqn), The following is my continuity equation:

Thus, could I add the term like "fvc::laplacian(phase2.turbulence().nut/mysigma, alpha1)? Thanks for your attention.

• anybody wish to give some suggestions?

• The equation you posted is not correct. Also, it looks like a constrain condition rather than a transport equation.

• @东岳 Thanks dongyue. I am not sure you are saying which transport equation. However the equation in the image, this is the continuity equation in spalding's IPSA method and we published a lot of paper in which this equation used.

• The first term is a second rank tensor, the second term is a scalar, they are inconsistent.

• Dongyue, I understood what you mean but I also found the solution procedure of alpha transport equation in Passalacqua's paper, like following, both of them include the term of fraction gradient.

• @kimy You can have a look at alphaEqn of driftFluxFoam. A similar alpha equation with diffusion term was implemented.

• driftFluxFoam

Thank you for your advice. The problem is that there is no alphaEqu.H in twophaseeulerfoam and only the code lines related to "alpha1Eqn" are given in twophasesystem.C file as I mentioned in top. I am confused that why no convective term in that equation. And after I compile this twophasesystem.C file, how can I link it to the solver file?

• I am confused that why no convective term in that equation.

Don't bother with the convection term. It was handled by explicit FCT scheme. So if you manage to add the diffusion term, it should work.

And after I compile this twophasesystem.C file, how can I link it to the solver file?

If you modify the original file, you dont need to link it, it is linked automatically

• Really thank you. Usually, if we would like to add a new model, such as a turbulence model, we need to compile it as a user's library and then include the path "lib***" in the system/controdict. Here, I am not sure what I should do agter I compile "twophasesysterm.C".

• Yes you can do it. twoPhaseSystem is a combined lib. It combines lots of class into one lib. Its difficult to explain here. I would suggest you modify the original file directly to see if it works. If it works, then you can consider to build your own lib.

• I see. Great!
Grazie mille.

• @东岳 Hi Dongyue, it works. Now I am trying to add it into user's library. I changed the Make/files as following and I include "libmycompressibleTwoPhaseSystem" in system/controDict, but the solver neglect it. I really don't know how to make the solver to call the modified "twophasesystem.C", or I need to change the name of "twophasesystem.C". Do you have any suggestion? Thanks.

LIB = $(FOAM_USER_LIBBIN)/libmycompressibleTwoPhaseSystem  • @kimyextra term twophasesystem.C 中说： but the solver neglect it. Is there any error message, like "cannot find dynamic library..." or "duplicate entry ..." ? • @xpqiu Thanks for your reply. In fact, There is no error for the compilation and simulation. I don't know how to link the new modified twophasesystem.C to the solver. • Anyone has suggestion about how to link the revised twophasesystem.C to the solver as a user's library? • @东岳 Hi, dongyue. I tried many ways to reach my goal, such as create a newtwophasesystem.C (I found this file in the reactingtwophaseeulerfoam, so it should be possible to use a new one) and compile. But I still cannot link the new file to the solver if I put it in the user's library. Do you have any suggestion? Many Thanks. • the easy way: cd \$FOAM_LIBBIN/
mv libcompressibleTwoPhaseSystem.so libcompressibleTwoPhaseSystem.so.bk
cp \$FOAM_USER_LIBBIN/libmycompressibleTwoPhaseSystem.so ./libcompressibleTwoPhaseSystem.so  the best best way: add below line in solver's Make/options file -L$(FOAM_USER_LIBBIN) \
-lmycompressibleTwoPhaseSystem


make sure every line have "\" end except last line.

• Thanks a lot. The problem was solved.

CFD中文网 2016 - 2020 | 京ICP备15017992号-2