CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Adding a new term in momentum equation of Interfoam (http://www.cfd-online.com/Forums/openfoam/103926-adding-new-term-momentum-equation-interfoam.html)

 udiitm June 29, 2012 06:02

Adding a new term in momentum equation of Interfoam

Dear All,
I need a help in implementing a modified surface tension component ( F
st,i ) in interfoam.
This surface tension force is implemented in Interfoam as

which is basically

This part I need to change it to

F
st,i = -(Pb - Pa) * grad (alpha1)

where
(Pb - Pa) = 0.5* ( P1 + P2 )

P1 =0.5* ((1-2*alpha1)* P)w + ((1-2*alpha1)* P)E
P2 =0.5* ((1-2*alpha1)* P)N +
((1-2*alpha1)* P)S

Here W,E,N and S represents left, right, top and bottom cell information for a cell "i"

YUdhast

 vahid.najafi July 29, 2012 02:35

plese help me

Hi Dear yudhast.
I'm working with openFoam 2.0.1,and have a problem with solver (interPhaseChangeFoam) in multiphase solvers.

I want to add (surface tension or sigma ) in a part of this solver, in directory:
/run/myinterPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.c
I added sigma() in this code:

Foam::tmp<Foam::volScalarField>
Foam:haseChangeTwoPhaseMixtures::SchnerrSauer: Coeff
(
const volScalarField& p
) const
{
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField rho
(
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
);
return
return
//......I want to change it( <<sigma>> surface tension multiple in it):
(3*rho1()*rho2())*sqrt(2/(3*rho1()))*sigma()
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
//.................................................. ......
}

dont successful wmake, and seen(sigma() was not declared ):

phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C:113: error: sigma() was not declared in this scope
make: *** [Make/linux64GccDPOpt/SchnerrSauer.o] Error 1

 vahid.najafi July 29, 2012 03:21

again.

Hi again.

in this code:

Foam::tmp<Foam::volScalarField>
Foam:haseChangeTwoPhaseMixtures::SchnerrSauer: Coeff
(
const volScalarField& p
) const
{
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField rho
(
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
);
return
//......I want to change it( <<sigma>> surface tension multiple in it):
(3*rho1()*rho2())*sqrt(2/(3*rho1()))*interpolate(interface.sigma())
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
//.................................................. ......
}

dont successful wmake, and seen(was not declared ):

phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C:113: error: 'interface' was not declared in this scope
phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C:113: error: 'interpolate' was not declared in this scope
make: *** [Make/linux64GccDPOpt/SchnerrSauer.o] Error 1

 vahid.najafi July 29, 2012 03:30

again.

 nimasam July 29, 2012 08:37

dear vahid
i recommend you to read a C++ book, chapter "class"
interface is object!
interpolation is a function or member of a class
when you call an object, you should first define it some where