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

problems concerning mass conservativity in bubbleFoam with custom scalar transport

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 11, 2013, 09:51
Default problems concerning mass conservativity in bubbleFoam with custom scalar transport
  #1
Senior Member
 
Join Date: Mar 2010
Location: Germany
Posts: 147
Rep Power: 8
cutter is on a distinguished road
Hi foamers,

after adding a simple scalar transport equation to bubbleFoam I'm facing problems regarding the mass conservativity of the scalar for several weeks now. My intention is to transport a passive scalar/ tracer in one of the two phases (currently within the gas phase alpha1 only). I'm therefore using phi1 within the convective part of the equation:

Code:
        fvScalarMatrix myScalarTransportEqn (
             fvm::ddt(myScalar)
          + fvm::div(phi1, myScalar)
          - fvm::laplacian(D_myScalar, myScalar)
        );
        myScalarTransportEqn.solve();
The resulting solver (see below) seems to run without any phase continuity errors. When computing the mass balance for the scalar I'm observing severe errors though. The solver produces mass from the very first step and in the end there's an error of more that 50%:

Code:
Starting time loop

initial integral of scalar = domainIntegrate((myScalar*alpha1)) [0 3 0 0 0 0 0] 0.025
Courant Number mean: 0 max: 0
Time = 0.01

Max Ur Courant Number = 0
DILUPBiCG:  Solving for alpha1, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for alpha1, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for alpha1, Initial residual = 0, Final residual = 0, No Iterations 0
Dispersed phase volume fraction = 0.25  Min(alpha1) = 0  Max(alpha1) = 1
GAMGPCG:  Solving for p, Initial residual = 1, Final residual = 3.63861e-09, No Iterations 9
time step continuity errors : sum local = 9.76258e-12, global = -2.48287e-20, cumulative = -2.48287e-20
GAMGPCG:  Solving for p, Initial residual = 0.00150624, Final residual = 2.27757e-09, No Iterations 6
time step continuity errors : sum local = 2.54674e-10, global = -1.14032e-20, cumulative = -3.62318e-20
DILUPBiCG:  Solving for epsilon, Initial residual = 0.00556307, Final residual = 2.00741e-11, No Iterations 5
DILUPBiCG:  Solving for k, Initial residual = 1, Final residual = 2.28053e-11, No Iterations 5
DILUPBiCG:  Solving for myScalar, Initial residual = 0.212308, Final residual = 4.47246e-11, No Iterations 21
abs error of myScalar = 0.00290427
rel error of myScalar = 11.6171%
ExecutionTime = 0.12 s  ClockTime = 1 s

...

Courant Number mean: 0.0692709 max: 0.278919
Time = 5

Max Ur Courant Number = 0.204834
DILUPBiCG:  Solving for alpha1, Initial residual = 5.00392e-05, Final residual = 1.09122e-11, No Iterations 4
DILUPBiCG:  Solving for alpha1, Initial residual = 1.52951e-06, Final residual = 7.31573e-12, No Iterations 3
DILUPBiCG:  Solving for alpha1, Initial residual = 2.96263e-07, Final residual = 1.99348e-12, No Iterations 3
Dispersed phase volume fraction = 0.25  Min(alpha1) = 6.05194e-33  Max(alpha1) = 1
GAMGPCG:  Solving for p, Initial residual = 0.0077321, Final residual = 7.97984e-10, No Iterations 7
time step continuity errors : sum local = 5.03872e-12, global = 6.34931e-20, cumulative = -5.07847e-16
GAMGPCG:  Solving for p, Initial residual = 0.000680436, Final residual = 1.29913e-09, No Iterations 6
time step continuity errors : sum local = 8.1173e-12, global = -2.98023e-20, cumulative = -5.07877e-16
DILUPBiCG:  Solving for epsilon, Initial residual = 0.00491431, Final residual = 3.90082e-11, No Iterations 8
DILUPBiCG:  Solving for k, Initial residual = 0.00319378, Final residual = 4.11936e-11, No Iterations 8
DILUPBiCG:  Solving for myScalar, Initial residual = 8.51307e-05, Final residual = 5.8246e-11, No Iterations 15
abs error of myScalar = 0.0138097
rel error of myScalar = 55.2387%
ExecutionTime = 52.45 s  ClockTime = 54 s

End
Could you please tell my what am I missing here?! I assume there's something wrong with the usage of phi1 and alpha1. Before the computation of the scalar transport the original code of bubbleFoam performs the transport of the phase fractions alpha1 and alpha2. In my opinion the change of the phase fractions needs to be considered during the computation of my own scalar transport. But all of my approaches towards the inclusion of the phase faction of the current or previous time step into the above equation failed so far.

Please find the modified solver and a simple test case attached. All changes within the code of bubbleFoam are labeled with comments CHANGE#1 through CHANGE#4 (source files bubbleFoamScalarTrans.C and createFields.H). The solver should compile and run with the OF-2.1.x git-release.

The accompanying simplified test case is a bottom driven cavity with a huge bubble inside. This bubble also contains the tracer which needs to be transported within the domain. Since there's no fluid entering/leaving the cavity the total mass of the tracer is expected to always stay constant.

Many thanks in advance for all hints and comments!

cutter
Attached Images
File Type: jpg initial_conditions.jpg (20.6 KB, 23 views)
Attached Files
File Type: gz bubbleFoamScalarTrans.tar.gz (13.0 KB, 13 views)
File Type: gz BottomDrivenCavity.tar.gz (3.6 KB, 3 views)
cutter is offline   Reply With Quote

Old   March 5, 2013, 09:03
Default
  #2
Senior Member
 
Join Date: Mar 2010
Location: Germany
Posts: 147
Rep Power: 8
cutter is on a distinguished road
Dear Foamers,

I'm sorry to bring it up again, but another three weeks passed and I didn't make any significant progress on this issue. Here's what I did so far:

First of all I changed the computation of the total mass within the tank (removed factor alpha1 in integration). The field myScalar is therefore the total mass of the tracer scalar per cell in phase alpha1 (no matter what the actual cell volume and phase fraction is). I also removed the diffusive part of the equation (last line of transport equation). The simulation then yields a relative error e_rel=6.e-7, which should be enough for most engineering applications. When I open the lid and allow air to leave the cavity the error is several magnitudes larger (with correct accounting of the mass that passed through the top).

To sum it up: there's still something important missing here. Could you please provide some references to literature that describes the correct treatment of passive scalar transport in multiphase CFD simulations?

By the way, is there any particular reason this post got no replies at all? Is there any relevant informationion missing? I'm a non-native speaker, so please forgive me all formulations that might sound inappropriate or inpolite in your ears.

I'm looking forward for your answers!

Thanks
cutter
cutter is offline   Reply With Quote

Old   February 9, 2015, 08:25
Default
  #3
Member
 
A. Bernath
Join Date: Jun 2011
Location: Karlsruhe, Germany
Posts: 39
Rep Power: 7
derkermit is on a distinguished road
Hi cutter,
did you manage to solve the problem?
I want to achieve the same thing as you, but I'm using the twoPhaseEulerFoam solver of OF 2.3.1. As far as I know, this solver is a further developed version of bubbleFoam and the changes address mass conservation problems, so maybe your problem has been solved with the newer version or at least gives you some hints.

My problem however is already adding the transport equation: http://www.cfd-online.com/Forums/ope...oam-of231.html

If you did find a solution for your problem, it could be helpful for me too.

Thanks, Alex
derkermit is offline   Reply With Quote

Old   February 10, 2015, 05:25
Default
  #4
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 266
Rep Power: 10
olivierG is on a distinguished road
hello,

As for all scalar transport, take care at inlet / outlet when you "calculate" the flux. The common error is to calculate only the convective flux, not the diffusive one, which lead to the "conservation error"
see http://www.cfd-online.com/Forums/ope...tml#post415846

Solution are:
1) calculate the total flux (with diffusion)
2) set diffusion coef to 0 at inlet/outlet boundary (work but not nice !)
3) take a look at "totaFlowRateAdvectivediffusive" BC (not tested).

regards,
olivier
olivierG is offline   Reply With Quote

Reply

Tags
bubblefoam, mass conservation, multiphase, scalar transport, two phase

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solving N (Non-Coupled) Scalar Transport Equations joel.lehikoinen OpenFOAM Programming & Development 9 October 3, 2013 08:00
Scalar transport in Lid driven cavity CFDtoy Main CFD Forum 2 February 19, 2011 10:43
Is it possible to use divergence in the source term of an scalar transport equation? jannnesss CFX 0 January 8, 2010 20:53
Mass flux - Axisymmetric problems. JSM FLUENT 0 May 2, 2007 23:56
problems on species transport shao1 FLUENT 0 July 11, 2002 21:58


All times are GMT -4. The time now is 01:40.