CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to calculate the flux of this term grad(alpha1)*alphaf*U? (https://www.cfd-online.com/Forums/openfoam-solving/172792-how-calculate-flux-term-grad-alpha1-alphaf-u.html)

keepfit June 6, 2016 10:26

How to calculate the flux of this term grad(alpha1)*alphaf*U?
 
Hi Foamers,

I am working on a modified solver based on interFoam, having problem to calculate the flux of the following term (in modified VOF method):

https://66.media.tumblr.com/09e03f7c...ssaho1_250.png

where alpha1 is the liquid phase volume fraction, alphaf the fluid volume fraction, and U the fluid velocity. The term alphaf is introduced because there is a third phase: solid.

To calculate the flux of this term, I tried the following code:
Code:

volVectorField afGrada1("afGrada1", alphaf*fvc::grad(alpha1));
//volVectorField afGrada1("afGrada1", alphaf*fvc::snGrad(alpha1));
surfaceScalarField afGrada1Uf(fvc::interpolate(U*afGrada1) & mesh.Sf());

But it seems that there is a problem on the gradient of alpha1.

Code:

alphaEqn.H: In function ‘int main(int, char**)’:
alphaEqn.H:16:69: error: no matching function for call to ‘Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(const char [9], Foam::tmp<Foam::Field<double> >)’
 volVectorField afGrada1("afGrada1", alphaf*fvc::snGrad(alpha1));
                                                                                                                  ^
alphaEqn.H:16:69: note: candidates are: ...........

I have tried a bot of combinations, but none is working. Any advice to calculate alphaf*grad(alpha1)?

Thanks in advance.

bala_gk1988 June 7, 2016 05:37

Code:

U*afGrada1
Both U and afGrada1 are volVectorFields. You are taking outer product of those two vector fields, which produces a volTensorField.

The inner product of that volTensorField with mesh.Sf()should produce a vector field not a scalar field.

keepfit June 9, 2016 15:08

Quote:

Originally Posted by bala_gk1988 (Post 603691)
Code:

U*afGrada1
Both U and afGrada1 are volVectorFields. You are taking outer product of those two vector fields, which produces a volTensorField.

The inner product of that volTensorField with mesh.Sf()should produce a vector field not a scalar field.

thanks for your reply, bala_gk1988!

I was not aware of this problem. I tried the following code (no compile error)

Code:

volVectorField afGrada1("afGrada1", a1af*fvc::grad(alpha1));
volScalarField afGrada1U("afGrada1U", afGrada1&U);
surfaceScalarField Phi_afGrada1Uf("Phi_afGrada1Uf", fvc::interpolate(afGrada1U) * mesh.magSf());

however, it seems the result of Phi_afGrada1Uf is not compatible with fvc::flux(a, b, scheme).

Code:

LHS and RHS of + have different dimensions
    dimensions : [0 3 -1 0 0 0 0] + [0 2 -1 0 0 0 0]

it seems that i need to dig into the fvc:flux(...) code


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