# Howto mass source in interFoam

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

 April 23, 2008, 06:48 Dear Foamers, i would like #1 Member   Christian Winkler Join Date: Mar 2009 Location: Mannheim, Germany Posts: 63 Rep Power: 10 Dear Foamers, i would like to calculate a growing bubble with interFoam. So far nothing spectacular. I would like to let the bubble grow simply by adding a mass source term within the bubble. In principle that would be done by adding a source term to the continuity equation ddt(rho) + div(rho,U)= mass_source * gamma Unfortunatly the continuity is not solved that way in interFoam. Is there anyone out there who has done something like this (adding mass sources to any solver?), or anybody who could give me a good hint? Thanks in advance best regards Christian Mahmoud_aboukhedr likes this.

 April 23, 2008, 11:54 Dear Christian, The continu #2 Member   Patricio Bohorquez Join Date: Mar 2009 Location: Jaén, Spain Posts: 95 Rep Power: 10 Dear Christian, The continuity equation used by interFoam, Eq. (4.3) in Rusche (2002), is div(U) = 0. We do not use div(rho)+div(rho,U) = 0 because the free-surface is expected to be a thin interface. Thus, the equation you want to solve now reads div(U) = mass_source*gamma/rho The PISO-Loop should then be reformulated according to the equation shown above. Have a look, for instance, to Rusche (2002, Section 4.2.4) and Jasak (2006, Section 10.4.1): "A revised formulation of the pressure equation via a Schur's complement yields" ... fvScalarMatrix pdEqn( fvm::laplacian(rUAf, pd) == fvc::div(phi) - mass_source*gamma/rho ); Be careful with the numerical treatment of the source term on the r.h.s. All the best, Patricio Rusche, H., 2002. Computational fluid dynamics of dispersed two-phase flows at high phase fractions. Ph.D. thesis, Imperial College, University of London. Jasak, H., 2006. Numerical solution algorithms for compressible flows: Lecture Notes. University of Zagreb, Croatia.

 April 25, 2008, 02:06 Dear Patricio, thanks for p #3 Member   Christian Winkler Join Date: Mar 2009 Location: Mannheim, Germany Posts: 63 Rep Power: 10 Dear Patricio, thanks for pointing me into the right direction. I allready thought that i would have to modify the pressure equation. This is done for now and works. The problem this causes is that gamma stays conservative. That is because gamma is calculated based on the face flux from last timestep and therefore changes over time. What follows is that the mass within the system stays constant which it should not because there is a mass source term. If i use a mass sink i can even cause gamma to grow greater than one ;-) Therefore i have to add the mass source to the gamma equation as well. When i have found a convenient way to do this, i will post the solution. Kind regards Christian

 April 25, 2008, 11:55 I don't know if the info that #4 Member   Patricio Bohorquez Join Date: Mar 2009 Location: Jaén, Spain Posts: 95 Rep Power: 10 I don't know if the info that follows will help or work? I agree with you. We are adding mass corresponding to the gamma-phase, so the mass source should be added not only to the mixture continuity equation but to the gamma-phase continuity equation by itself. In this line the gammaEqn.H file is to be updated. Presently, the key point is MULES MULES::explicitSolve01(gamma, phi, phiGamma); which employs the explicit solver and ensures a bounded solution in the range [0,1]. So, how to add the source term and conserve the bounded solution? If the source could be written as a divergence, it would be quite easy, because the gamma equation would read ddt(gamma) + div(phi, gamma) + div(phirg, gamma) + div(source/gamma, gamma) == 0 and therefore the fluxes used by MULES could be readily modified to include the gamma-source. Otherwise, we can use the alternative MULES::explicitSolve01 ( volScalarField& psi, const surfaceScalarField& phi, surfaceScalarField& phiPsi, const SpType& Sp, const SuType& Su ); which accepts source terms in the gamma equation. Hope your code works. Patricio

 April 29, 2008, 09:28 Hi all, i have a problem;i ne #5 Member   davey david Join Date: Mar 2009 Posts: 54 Rep Power: 10 Hi all, i have a problem;i need to add the laplace equation to my solver because i need to solve for electric potential(fields) in particular regions of my mesh.i tried doing it as before(i.e like adding a source term to a code)but i am getting error messages all the while.can anyone please help out here? thanks in advance davey

 June 24, 2009, 11:57 #6 Senior Member   isabel Join Date: Apr 2009 Location: Spain Posts: 171 Rep Power: 10 Dear Pbohorquez, Thanks for your explanation about how to add a source to the gamma equation. The problem is that I don´t understand very well. I am working with interFoam solver. In gammaEqn.H I want to add a source. I must modify the line: MULES::explicitSolve(gamma,phi,phiGamma,1,0) I don´t know how to solve the equation: ddt(gamma) + div(phi, gamma) == user_source

 July 16, 2009, 06:59 #7 Senior Member   isabel Join Date: Apr 2009 Location: Spain Posts: 171 Rep Power: 10 There is other way to add a source to the gamma equation: in the solver interPhaseChangeFoam, the gammaEqn.H is: volScalarField Sp ( IOobject ( "Sp", runTime.timeName(), mesh ), vDotvAlphal - vDotcAlphal ); volScalarField Su ( IOobject ( "Su", runTime.timeName(), mesh ), divU*gamma + vDotcAlphal ); MULES::implicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0); where: gamma is the actual value to be solved phi is the normal convective flux phiGamma = gamma*(1-gamma)*U Sp is the implicit source term Su is the divergence term My doubt is: What divergence term Su means? Divergence of what?

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post msrinath80 OpenFOAM Running, Solving & CFD 5 December 9, 2013 02:19 frank CFX 0 May 14, 2008 11:55 newbee OpenFOAM Running, Solving & CFD 3 July 9, 2006 07:15 lu FLUENT 5 September 25, 2003 22:29 shao1 FLUENT 2 July 11, 2002 20:36

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