
[Sponsors] 
problems concerning mass conservativity in bubbleFoam with custom scalar transport 

LinkBack  Thread Tools  Display Modes 
February 11, 2013, 09:51 
problems concerning mass conservativity in bubbleFoam with custom scalar transport

#1 
Senior Member
Join Date: Mar 2010
Location: Germany
Posts: 139
Rep Power: 7 
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(); 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.63861e09, No Iterations 9 time step continuity errors : sum local = 9.76258e12, global = 2.48287e20, cumulative = 2.48287e20 GAMGPCG: Solving for p, Initial residual = 0.00150624, Final residual = 2.27757e09, No Iterations 6 time step continuity errors : sum local = 2.54674e10, global = 1.14032e20, cumulative = 3.62318e20 DILUPBiCG: Solving for epsilon, Initial residual = 0.00556307, Final residual = 2.00741e11, No Iterations 5 DILUPBiCG: Solving for k, Initial residual = 1, Final residual = 2.28053e11, No Iterations 5 DILUPBiCG: Solving for myScalar, Initial residual = 0.212308, Final residual = 4.47246e11, 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.00392e05, Final residual = 1.09122e11, No Iterations 4 DILUPBiCG: Solving for alpha1, Initial residual = 1.52951e06, Final residual = 7.31573e12, No Iterations 3 DILUPBiCG: Solving for alpha1, Initial residual = 2.96263e07, Final residual = 1.99348e12, No Iterations 3 Dispersed phase volume fraction = 0.25 Min(alpha1) = 6.05194e33 Max(alpha1) = 1 GAMGPCG: Solving for p, Initial residual = 0.0077321, Final residual = 7.97984e10, No Iterations 7 time step continuity errors : sum local = 5.03872e12, global = 6.34931e20, cumulative = 5.07847e16 GAMGPCG: Solving for p, Initial residual = 0.000680436, Final residual = 1.29913e09, No Iterations 6 time step continuity errors : sum local = 8.1173e12, global = 2.98023e20, cumulative = 5.07877e16 DILUPBiCG: Solving for epsilon, Initial residual = 0.00491431, Final residual = 3.90082e11, No Iterations 8 DILUPBiCG: Solving for k, Initial residual = 0.00319378, Final residual = 4.11936e11, No Iterations 8 DILUPBiCG: Solving for myScalar, Initial residual = 8.51307e05, Final residual = 5.8246e11, No Iterations 15 abs error of myScalar = 0.0138097 rel error of myScalar = 55.2387% ExecutionTime = 52.45 s ClockTime = 54 s End 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 OF2.1.x gitrelease. 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 

March 5, 2013, 09:03 

#2 
Senior Member
Join Date: Mar 2010
Location: Germany
Posts: 139
Rep Power: 7 
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.e7, 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 nonnative 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 

February 9, 2015, 08:25 

#3 
Member
A. Bernath
Join Date: Jun 2011
Location: Karlsruhe, Germany
Posts: 39
Rep Power: 6 
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: Adding transport equation to twoPhaseEulerFoam (OF231) If you did find a solution for your problem, it could be helpful for me too. Thanks, Alex 

February 10, 2015, 05:25 

#4 
Senior Member
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 251
Rep Power: 9 
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 Multi species mass transport library [update] 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 

Tags 
bubblefoam, mass conservation, multiphase, scalar transport, two phase 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Solving N (NonCoupled) 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 