CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   volume fraction gradient (

Gitesh P November 7, 2012 13:42

volume fraction gradient

Can any one suggest how to get the volume fraction gradient to calculate interfacial area ?

I mean if I have a dispersed phase volume fraction 'alpha'. And I want to calculate the '|grad(alpha)|' field then how I can get the values in OF/paraFoam ?

With regards,

kmooney November 8, 2012 10:51

If you want to be able to see the alpha gradient field during post processing something like this might work for you:


    const volVectorField& gradAlpha = fvc::grad(alpha);


Gitesh P November 9, 2012 04:14


Thank you for that.

Yes now I am able to get the gradients of alpha.

How about absolute value of it. I mean I need to calculate absolute value of gradient of alpha.

Is there any utility where I can direct find those values ?

With regards,

duongquaphim November 9, 2012 10:42

instead of const volVectorField& gradAlpha = fvc::grad(alpha); use const volScalarField& gradAlpha = mag(fvc::grad(alpha));

Gitesh P November 12, 2012 09:04


Can you say me where I include/write this line? I mean in which directory/file.

With regards,

duongquaphim November 12, 2012 10:32

you can just put the above code in interFoam.C for instance and compile. The outputs should be exported into time folders in the same way of U, p or alpha1 fields.


Gitesh P November 13, 2012 08:43

Hello again,

You mean I need to put these lines some where at the end in interFoam.C file ?

With regards,

All times are GMT -4. The time now is 12:17.