Adding transport equation to twoPhaseEulerFoam (OF231)
Hello all,
I'm struggling with the implementation of a scalar transport equation in twoPhaseEulerFoam. I've done that in various solvers before but this one seems to be "special". Also, the explanation in the wiki (http://openfoamwiki.net/index.php/Ho...sport_equation) isn't sufficient for this solver. At the moment, the psiEqn.H looks like this: Code:
{ Code:
volScalarField psi Also the divScheme for "div\(alphaRhoPhi.*,psi\)" was set to "Gauss limitedLinear 1;" (upwind doesn't help) and an entry in fvSolution was done according to the one of the energy equation (smoothSolver etc.). I also tried different solvers but that didn't make a change at all. When I run the solver on the injection tutorial case, it crashes in the moment, when it should solve psiEqn: Code:
Starting time loop Would be very glad to get any help on this! Thanks in advance. Regards, Alex |
Hello Alex,
Perhaps I can help you. I am not sure why your method is wrong, but I can push you in the right direction. twoPhaseEulerFoam makes use of two phases, so your scalar has to be defined for one or both of the phases, i.e. in phaseModel.C and .H, you have to add your scalar similar to 'alpha'. So for example you add an entry 'phi', which should be and IOobject named "psi", and depending on what you want with regard to BCs/ICs you can make it READ_IF_PRESENT, NO_READ, AUTO_WRITE, etc... Don't forget to declare psi in the phaseModel.H file! After having done this you can add your scalar to one or both of the phases in twoPhaseEulerFoam, look at all the examples in the beginning of the createFields.H file. For example, you can call your psi for phase 1 with the command phase1.psi. Now you should be able to use this psi in your scalar transport equation. I hope this makes sense to you, if you have any questions let me know. Kind regards, Ramon |
Hi Ramon,
thanks for the help. Does it make a difference if I declare psi like in my first post compared to the implementation through phaseModel.C/H as you mentioned? I'm trying that approach at the moment but I'm curious what could be the difference. Thanks, Alex EDIT: Actually, the results are the same :-/ |
You could first of all try leaving out any turbulence terms and other complexities, try just a simple convection/diffusion equation, and build it up from there. I know its a little trivial but it that way you can find the part of the equation that is destroying your solver.
K.R. Ramon |
Hi,
may I ask why are you using alphaEff coefficient for diffusion? fvc::interpolate(thermo1.alphaEff(phase1.turbulenc e().mut())) This coefficient is the thermal diffusion rate (ratio between kinematic visocsity and Prandtl number). Is this what you really want? Can you also try do add before the solve the following line? fvOptions.constrain(psiEqn); Ciao Mattia |
Try the PBiCG solver with none as preconditioner.
From the solver output I figure that there are zones in your domain with alpha=0. In these zones the terms of your transport equation are multiplied by zero. Solving the linear equation system involves dividing terms in some cases. Since the floating point exception happens during the smoothing operation, my guess is, that you run into numerical trouble due to the zero-alpha values in parts of your domain. |
I found a much easier option using function objects, that doensn't require you to modify the solver.
please find it in this thread http://www.cfd-online.com/Forums/ope...tml#post574980 |
Great post vkoppejan, this could be very useful for obtaining some quick results. I will definitely add the post to my ever growing list of OpenFOAM tips & tricks.
Keep in mind that this only works for constant isotropic diffusion type problems. So for simple cases this could be the perfect solution, for more advances problems this seems to lack flexibility. Kind regards, Ramon |
Hi Ramon,
Your right, it's a very simple solution but the function object can easily adapted to cope with other types of diffusion problems. You just need to make sure the proper files are included and that the makefiles are adapted accordingly. Glad to have helped you. Cheers, Victor |
All times are GMT -4. The time now is 11:37. |