CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Implementation: Break-up model of Coulaloglou and Tavlarides

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 25, 2014, 08:15
Default Implementation: Break-up model of Coulaloglou and Tavlarides
  #1
Member
 
Andreas Weber
Join Date: Jun 2014
Posts: 37
Rep Power: 12
a.weber is on a distinguished road
Hello everyone,

I'm currently working on my own solver for bubbly flows. I want to be able to calculate breakup and coalescence of bubbles rising in a fluid.

This is all done by a Euler-Lagrange approach, which is working well so far.

I'm now trying to get the breakup-model of Coulaloglou and Tavlarides running in my code.
[COULALOGLOU, C. A.; TAVLARIDES, L. L. Description of interaction processes in agitated liquid-liquid dispersions. Chemical Engineering Science, 1977, 32. Jg., Nr. 11, S. 1289-1297.]

My problem is, that the model uses the turbulent energy (epsilon), which is not availiable in the standard break-up models. (.../src/lagrangian/spray/submodels/BreakupModel/...)
There is no direct connection to the fields of the mesh, so it's also not possible to get the value of epsilon at the particle's position.
The only thing there is the list of variables, that are connected to the single parcel, for example:

Code:
bool Foam::ETAB<CloudType>::update
(
    const scalar dt,
    const vector& g,
    scalar& d,
    scalar& tc,
    scalar& ms,
    scalar& nParticle,
    scalar& KHindex,
    scalar& y,
    scalar& yDot,
    const scalar d0,
    const scalar rho,
    const scalar mu,
    const scalar sigma,
    const vector& U,
    const scalar rhoc,
    const scalar muc,
    const vector& Urel,
    const scalar Urmag,
    const scalar tMom,
    scalar& dChild,
    scalar& massChild
)
but apparently, variables concerning turbulent energy or the parcel's position are missing.

How can I invoke the variables needed from the mesh?

Kind regards,
Andy
a.weber is offline   Reply With Quote

Old   August 25, 2014, 11:11
Default
  #2
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Jep, you don't get these fields like this.

But what you can do is to look them up from the object registry. I'm not quite sure if the turbulence fields are tmp-fields or registered objects, but in any case you can look-up the turbulence model from there, which will give you access to the fields you want.
Now, if you haven't done much coding in OpenFOAM, this might not sound too straight forward, but actually it's not that complicated either.
You can have a look at the dispersion models, there they also look-up the turbulence fields from the registry.
Code:
src/lagrangian/turbulence/submodels/Kinematic/DispersionModel/DispersionRASModel
dkxls is offline   Reply With Quote

Old   August 26, 2014, 06:39
Default
  #3
Member
 
Andreas Weber
Join Date: Jun 2014
Posts: 37
Rep Power: 12
a.weber is on a distinguished road
Ok, thanks, done copy-pasting.

But still one problem: DispersionRASModel makes use of [cellI], that i don't have in my breakupmodel....

How can I solve this?
a.weber is offline   Reply With Quote

Old   August 26, 2014, 08:08
Default
  #4
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Quote:
Originally Posted by a.weber View Post
But still one problem: DispersionRASModel makes use of [cellI], that i don't have in my breakupmodel....
Oh yeah, that's true. :/
Sorry, I didn't think it totally through when I gave you the first hint. I actually wouldn't know how you get the cell ID inside a break-up model.

An option, which I think is very bad, but possible would be to copy and recompile the spray library. You then have to link also your solver against this re-compiled library, rather cumbersome, but would work.
This way you can change the variables that are passed to the break-up model.
(In fact I do the exact same thing for the 2.2.x spray library to fix some bugs that the upstream developers didn't fix yet.)

You only have to copy the folder src/lagrangian/spray to somewhere and change the name of the library, i.e. in somewhere/spray/Make/files
Code:
LIB = $(FOAM_USER_LIBBIN)/liblagrangianSprayXXX
Same thing for the solver and there you have to change also the options file to link against the correct library:
Code:
EXE_INC = \
    -Isomewhere/spray/lnInclude \
....

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -llagrangianSprayXXX\
...
-Armin
dkxls is offline   Reply With Quote

Old   August 28, 2014, 11:43
Default
  #5
Member
 
Andreas Weber
Join Date: Jun 2014
Posts: 37
Rep Power: 12
a.weber is on a distinguished road
At first: Thank you for the great help!!

OK, did a lot of trial and error...finnaly almost got it.

I now have my epsilon-field ready to use at the desired point of my code.

The [cellI] is now taken from src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C (by just adding it to the Table of Parameters):
Code:
     
....
td.cloud().breakup().update
        (
            dt,
            g,
            ...
            dChild,
            massChild,
            cellI
        )
    )
Had to add it into the List in the BreakupModels accordingly.

So far, so good, but still.... I get an Error because the given cellI in the SprayParcel.C is not defined as some kind of

Code:
        const parcelType& p = iter();
        const label cellI = p.cell();
which would give me a label of a particular cell, but as
Code:
    const parcelType& p = static_cast<const parcelType&>(*this);
which gives me something like cellI = -755914244.
This surely can't be used by:
Code:
const scalar epsilon =   epsilonPtr_->internalField()[cellI];
Haven't found a solution yet...but also haven't had much time for that....

Any suggestions?

Kind regards,
Andy
a.weber is offline   Reply With Quote

Old   August 28, 2014, 13:34
Default
  #6
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Sorry I don't understand where your error comes from. As far as I see it in the source code (src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C), you have the cell number readily available in the calcBreakup function.

You can just take that one and pass it on as a const label to the BreakupModel<CloudType>::update (i.e. td.cloud().breakup().update).

Should be straight forward, at least I think so.

If you don't get it solved, can you attach your SprayParcel.C and BreakupModel.C?

-Armin

P.S.: Just to make sure, you are using the latest git version of OpenFOAM 2.3.x, right?
dkxls is offline   Reply With Quote

Old   August 29, 2014, 05:58
Default
  #7
Member
 
Andreas Weber
Join Date: Jun 2014
Posts: 37
Rep Power: 12
a.weber is on a distinguished road
It works!

I've just recompiled all my modifications again... and the cellI gives me the right label now.

I'll now start working on the coalescence model by Coulaloglou and Tavlarides which also makes use of epsilon.
Thanks to your help I can now do that on my own

I'll post my results here when everything is ready

Best regards
Andy

PS: Yes, i'm using version 2.3.x
a.weber is offline   Reply With Quote

Old   September 8, 2014, 06:43
Default
  #8
Member
 
Andreas Weber
Join Date: Jun 2014
Posts: 37
Rep Power: 12
a.weber is on a distinguished road
Done!

Here's my code.
Attached Files
File Type: zip CouTav.zip (12.9 KB, 27 views)
a.weber is offline   Reply With Quote

Reply

Tags
breakup, turbulence


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



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