- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Howto mass source in interFoam**
(*https://www.cfd-online.com/Forums/openfoam-solving/58917-howto-mass-source-interfoam.html*)

Dear Foamers,
i would like 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 |

Dear Christian,
The continuDear 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. |

Dear Patricio,
thanks for pDear 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 |

I don't know if the info that 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 |

Hi all,
i have a problem;i neHi 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 |

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 |

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? |

All times are GMT -4. The time now is 09:15. |