CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Lift force modeling in bubbleFoam (

holger_marschall December 8, 2007 08:15

Hello there, I have some pr
Hello there,

I have some problems with the implementation of lift force models in bubbleFoam, hopefully someone can help me: Basically what I'm trying to do is to implement a lift model in the bubbleFoam solver analogical to the drag model implemented in the twoPhaseEulerFoam solver. I've added the drag model from twoPhaseEuler to BubbleFoam before and it's working fine. Then I've created a folder "liftModels" with subfolders "liftModel" and "Tomiyama", including liftModel.H, liftModel.C and so on, everything exactly like it's done for the drag (also updated lnInclude and the files and options in the make directory). Lastly I duplicated the drag model files and renamed all "drag" with "lift". In createFields.H I added the runtime-selection pointer
autoPtr<liftmodel> lift = liftModel::New
My liftDragCoeffs looks like this at the moment:

volVectorField Ur = Ua - Ub;
volScalarField magUr = mag(Ur);

volScalarField Ka = draga->K(magUr);
volScalarField dragCoef = Ka;

volScalarField Clift = lift->L(magUr);
scalar Cl=0.5;
volVectorField liftCoeff = Cl*(beta*rhob + alpha*rhoa)*(Ur ^ fvc::curl(U));
'L' is implemented like 'K' for the drag in twoPhaseEulerFoam (e.g. interfacialModels/dragModels/SchillerNaumann.C),
the correlating part in my Tomiyama.C file is

Foam::tmp<foam::volscalarfield> Foam::Tomiyama::L
const volScalarField& Ur
) const
volScalarField Re = (Ur*phasea_.d()/;
volScalarField II = 0.288*tanh(0.121*Re);
return II;
(I've skipped some lines here too keep my text from getting even longer, of course the above is not really Tomiyama)

Now my two problems:

1. If I comment out the line "volScalarField Clift = lift->L(magUr);" in liftDrafCoeffs.H everything works fine, if I don't I can compile the code but starting the solver brings up the following error

Time = 0.01

Courant Number mean: 0 max: 0.0455581
Max Ur Courant Number = 0.455581
deltaT = 0.01
Max Ur Courant Number = 0.455581
DILUPBiCG: Solving for alpha, Initial residual = 1.24905e-05, Final residual = 8.9929e-22, No Iterations 1
DILUPBiCG: Solving for alpha, Initial residual = 8.99302e-22, Final residual = 8.99302e-22, No Iterations 0
Dispersed phase volume fraction = 0.502812 Min(alpha) = 0 Max(alpha) = 1

--> FOAM FATAL ERROR : LHS and RHS of - have different dimensions
dimensions : [0 -3 6 0 0 0 0] - [0 -2 4 0 0 0 0]
#0 Foam::error::printStack(Foam:: Ostream&) in "/home/user/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/"
#1 Foam::error::abort() in "/home/user/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/"
#2 Foam::operator-(Foam::dimensionSet const&, Foam::dimensionSet const&) in "/home/user/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/"
#3 Foam::dimensioned<double> Foam::operator-<double>(Foam::dimensioned<double> const&, Foam::dimensioned<double> const&) in "/home/user/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libEulerianInterfacialMo"
#4 Foam::Tomiyama::L(Foam::GeometricField<double,> const&) const in "/home/user/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libEulerianInterfacialMo"
#5 main in "/home/user/OpenFOAM/user-1.4.1/applications/bin/linux64GccDPOpt/bubbleFoamExt"
#6 __libc_start_main in "/lib64/"
#7 Foam::regIOobject::readIfModified() in "/home/user/OpenFOAM/user-1.4.1/applications/bin/linux64GccDPOpt/bubbleFoamExt"

From function operator-(const dimensionSet& ds1, const dimensionSet& ds2)
in file dimensionSet/dimensionSet.C at line 395.

FOAM aborting
Obviously is has to do something with the volScalarField Clift = lift->L(magUr); What I don't understand here is how left and right hand side can have different dimensions and how it can happen at all if Clift is not further used?

2. Regarding the lift implementation my code doesn't make too much sense like this, what I really want to do is get back a dimensionedScalar from the function 'L' (like dimensionedScalar Clift=lift->L(magUr); and then have 'L' calculating the liftCoefficient as dimensionedScalar. However if I change the syntax to

Foam::tmp<foam::dimensionedscalar> Foam::Tomiyama::L
I get the error message (Of course I've changed the syntax not only in Tomiyama.C but also in liftModel.H, Tomiyama.H and liftModel.H):

/home/user/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/tmpI.H: In destructor ‚&euro;&tilde;Foam::tmp<t>::~tmp() [with T = Foam::dimensioned<double>]‚&euro;&trade;:
liftDragCoeffs.H:35: instantiated from here
/home/user/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/tmpI.H:82: error: ‚&euro;&tilde;struct Foam::dimensioned<double>‚&euro;&trade; has no member named ‚&euro;&tilde;okToDelete‚&euro;&trade;
/home/user/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/tmpI.H:89: error: ‚&euro;&tilde;struct Foam::dimensioned<double>‚&euro;&trade; has no member named ‚&euro;&tilde;operator--‚&euro;&trade;
make: *** [Make/linux64GccDPOpt/bubbleFoamExt.o] Fehler 1
So how can I have a function give back a "dimensionedScalar" value? Also, to avoid further problems like this, where could I look it up, I've looked for other OpenFoam functions doing something similar but what I found wasn't very helpful.

Hope my description isn't too confusing, any help is appreciated.

Best Regards

holger_marschall December 10, 2007 14:44

Any idea as to what might be c
Any idea as to what might be causing this?
What went wrong?


mattijs December 10, 2007 16:24

2. the dragModels have been de
2. the dragModels have been defined to return a tmp<volscalarfield> so your model will have to adhere. It can be a uniform volScalarField though.

1. From the traceback your model does a '-' somewhere. If you recompile your model with full debugging (-g -O0) it should show you the exact line number.

All times are GMT -4. The time now is 08:55.