- **OpenFOAM Programming & Development**
(*https://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **problems concerning mass conservativity in bubbleFoam with custom scalar transport**
(*https://www.cfd-online.com/Forums/openfoam-programming-development/113056-problems-concerning-mass-conservativity-bubblefoam-custom-scalar-transport.html*)

problems concerning mass conservativity in bubbleFoam with custom scalar transport3 Attachment(s)
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 (` Code:
`Starting time loop` 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 |

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 |

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 |

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 |

All times are GMT -4. The time now is 00:30. |